From 4044e78d0b378e18d1f98488ed484aa900d2f753 Mon Sep 17 00:00:00 2001 From: Shanqing Cai Date: Mon, 27 Feb 2017 10:59:37 -0800 Subject: [PATCH 001/101] Internal-only changes Change: 148668420 --- .../tools/ci_build/gpu_build/parallel_gpu_execute.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tensorflow/tools/ci_build/gpu_build/parallel_gpu_execute.sh b/tensorflow/tools/ci_build/gpu_build/parallel_gpu_execute.sh index c33ea2d5cc..6e7b752c06 100755 --- a/tensorflow/tools/ci_build/gpu_build/parallel_gpu_execute.sh +++ b/tensorflow/tools/ci_build/gpu_build/parallel_gpu_execute.sh @@ -24,6 +24,17 @@ # TF_GPU_COUNT = Number of GPUs available. This HAS TO BE IN SYNC with the # value of --local_test_jobs flag for bazel. +BASH_VER_MAJOR=$(echo ${BASH_VERSION} | cut -d '.' -f 1) +BASH_VER_MINOR=$(echo ${BASH_VERSION} | cut -d '.' -f 2) + +if [[ ${BASH_VER_MAJOR} -lt 4 ]]; then + echo "Insufficient bash version: ${BASH_VERSION} < 4.2" >&2 + exit 1 +elif [[ ${BASH_VER_MAJOR} -eq 4 ]] && [[ ${BASH_VER_MINOR} -lt 2 ]]; then + echo "Insufficient bash version: ${BASH_VERSION} < 4.2" >&2 + exit 1 +fi + TF_GPU_COUNT=${TF_GPU_COUNT:-8} for i in `seq 0 $((TF_GPU_COUNT-1))`; do -- GitLab From b83db97a812edc614e6891a4fd69eaf422debea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dandelion=20Man=C3=A9?= Date: Mon, 27 Feb 2017 10:59:38 -0800 Subject: [PATCH 002/101] Migrate tf-audio-dashboard to webfiles. Change: 148668422 --- .../components/tf_audio_dashboard/BUILD | 59 ++++++++++++++++++ .../components/tf_audio_dashboard/demo/BUILD | 26 ++++++++ .../tf_audio_dashboard/demo/data/BUILD | 17 +++++ .../audio_run_run1_tag_au1_2Faudio_2F0.json | 1 + .../audio_run_run2_tag_au2_2Faudio_2F0.json | 1 + ...o_index_0_tag_au1_2Faudio_2F0_run_run1.wav | Bin 0 -> 8044 bytes ...o_index_0_tag_au2_2Faudio_2F0_run_run2.wav | Bin 0 -> 8044 bytes .../tf_audio_dashboard/demo/data/runs.json | 10 +++ .../tf_audio_dashboard/demo/index.html | 53 ++++++++-------- 9 files changed, 140 insertions(+), 27 deletions(-) create mode 100644 tensorflow/tensorboard/components/tf_audio_dashboard/BUILD create mode 100644 tensorflow/tensorboard/components/tf_audio_dashboard/demo/BUILD create mode 100644 tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/BUILD create mode 100644 tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/audio_run_run1_tag_au1_2Faudio_2F0.json create mode 100644 tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/audio_run_run2_tag_au2_2Faudio_2F0.json create mode 100644 tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/individualAudio_index_0_tag_au1_2Faudio_2F0_run_run1.wav create mode 100644 tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/individualAudio_index_0_tag_au2_2Faudio_2F0_run_run2.wav create mode 100644 tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/runs.json diff --git a/tensorflow/tensorboard/components/tf_audio_dashboard/BUILD b/tensorflow/tensorboard/components/tf_audio_dashboard/BUILD new file mode 100644 index 0000000000..975ce6d902 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_audio_dashboard/BUILD @@ -0,0 +1,59 @@ +package(default_visibility = ["//tensorflow:internal"]) + +load("@io_bazel_rules_closure//closure:defs.bzl", "webfiles") +load("//tensorflow/tensorboard:defs.bzl", "tensorboard_ts_library") +load("//tensorflow/tensorboard:defs.bzl", "tensorboard_webcomponent_library") + +licenses(["notice"]) # Apache 2.0 + +webfiles( + name = "tf_audio_dashboard", + srcs = [ + "tf-audio-dashboard.html", + "tf-audio-grid.html", + "tf-audio-loader.html", + ], + path = "/tf-audio-dashboard", + deps = [ + "//tensorflow/tensorboard/components/tf_backend", + "//tensorflow/tensorboard/components/tf_dashboard_common", + "//tensorflow/tensorboard/components/tf_imports:lodash", + "@org_polymer", + "@org_polymer_paper_icon_button", + "@org_polymer_paper_styles", + ], +) + +filegroup( + name = "all_files", + srcs = glob(["**"]), + tags = ["notsan"], +) + +################################################################################ +# MARKED FOR DELETION + +tensorboard_webcomponent_library( + name = "legacy", + srcs = [ + "tf-audio-dashboard.html", + "tf-audio-grid.html", + "tf-audio-loader.html", + ], + destdir = "tf-audio-dashboard", + deps = [ + "//tensorflow/tensorboard/components:tf_imports", + "//tensorflow/tensorboard/components/tf_backend:legacy", + "//tensorflow/tensorboard/components/tf_dashboard_common:legacy", + "//third_party/javascript/polymer/v1/paper-icon-button:lib", + "//third_party/javascript/polymer/v1/paper-styles:lib", + "//third_party/javascript/polymer/v1/polymer:lib", + ], +) + +tensorboard_ts_library( + name = "legacy_ts", + srcs = [ + ], + deps = ["//tensorflow/tensorboard/components:common_deps"], +) diff --git a/tensorflow/tensorboard/components/tf_audio_dashboard/demo/BUILD b/tensorflow/tensorboard/components/tf_audio_dashboard/demo/BUILD new file mode 100644 index 0000000000..383ea8d1b6 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_audio_dashboard/demo/BUILD @@ -0,0 +1,26 @@ +package(default_visibility = ["//tensorflow:internal"]) + +load("@io_bazel_rules_closure//closure:defs.bzl", "webfiles") + +licenses(["notice"]) # Apache 2.0 + +# bazel run //third_party/tensorflow/tensorboard/components/tf_audio_dashboard/demo +webfiles( + name = "demo", + srcs = ["index.html"], + path = "/tf-audio-dashboard/demo", + deps = [ + "//tensorflow/tensorboard/components/tf_audio_dashboard", + "//tensorflow/tensorboard/components/tf_audio_dashboard/demo/data", + "//tensorflow/tensorboard/components/tf_imports:d3", + "@org_polymer_iron_demo_helpers", + "@org_polymer_paper_styles", + "@org_polymer_webcomponentsjs", + ], +) + +filegroup( + name = "all_files", + srcs = glob(["**"]), + tags = ["notsan"], +) diff --git a/tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/BUILD b/tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/BUILD new file mode 100644 index 0000000000..c3824a923d --- /dev/null +++ b/tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/BUILD @@ -0,0 +1,17 @@ +package(default_visibility = ["//tensorflow:internal"]) + +load("@io_bazel_rules_closure//closure:defs.bzl", "webfiles") + +licenses(["notice"]) # Apache 2.0 + +webfiles( + name = "data", + srcs = glob(["*"]), + path = "/tf-audio-dashboard/demo/data", +) + +filegroup( + name = "all_files", + srcs = glob(["**"]), + tags = ["notsan"], +) diff --git a/tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/audio_run_run1_tag_au1_2Faudio_2F0.json b/tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/audio_run_run1_tag_au1_2Faudio_2F0.json new file mode 100644 index 0000000000..7dfe32c711 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/audio_run_run1_tag_au1_2Faudio_2F0.json @@ -0,0 +1 @@ +[{"query": "index=0&tag=au1%2Faudio%2F0&run=run1", "step": 0, "wall_time": 1461795049.203407, "content_type": "audio/wav"}] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/audio_run_run2_tag_au2_2Faudio_2F0.json b/tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/audio_run_run2_tag_au2_2Faudio_2F0.json new file mode 100644 index 0000000000..13f9c2de42 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/audio_run_run2_tag_au2_2Faudio_2F0.json @@ -0,0 +1 @@ +[{"query": "index=0&tag=au2%2Faudio%2F0&run=run2", "step": 0, "wall_time": 1461795049.212815, "content_type": "audio/wav"}] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/individualAudio_index_0_tag_au1_2Faudio_2F0_run_run1.wav b/tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/individualAudio_index_0_tag_au1_2Faudio_2F0_run_run1.wav new file mode 100644 index 0000000000000000000000000000000000000000..f1d24adc0cef5a734e07e8899b9abf8ae26fa228 GIT binary patch literal 8044 zcmWIYbaP9QXJ80-40BD(Em06)U|?WmU}9Ln&%ody&%nUKAi$84Sds{0GcYhP98DG~ zWvpEjcgv#gy7j4v4ab^G4=T*M?KAbyrkWXvf5bP{ZkhJf`tGEtvs{8pTV7X5%!m!r z{<-0JWV~d9Pu;@{Pwmb`HeJ|TKC_jRU1{3q-a}va&f$nXu6V9)O5IJzX)c>CKi;vl z?M0)*6qSe3pHxzpM=dL`s{i`+po?|;>uZTCj;((6Vz5)$ z$NG6Oy1q-U9DESeu%=u3NJFok|J^6Qs~ZAXME}>bOnu;AF-7DFn}|y9u4?8Uj)0Db z|Bqbsb!_-vzv*&I(3|L-=ZniW_OY_e?wZ?Ud2jVRVehpn*X#e)NrtjIoqUzHEoeen zlV_*MlaIH)rMY|P=g+VI@@am!OPkiaS*tiEtu^88_+P*N`Zc3`SJ{;T_0QWxqrQIW z`>0)TY4X9;=WTM2O0I}Dbvp6wcvZK@xhiI7-PbSsmDW#9n0u|Yq1W*u2ipw$#PZy_ zrl|9A7ca*CP-$2&{p7JbEz<+V&ly$Ew&4`IQJXSZC{bzJ@!$W&mdq@#`Psa}_uHwk zLz6A58gy&Bt~n?Fi#7URS-N{RBco1pc=x^I%NI15^{Hpqgw`jgX4}tY`m*`ST+!yT zCidqSkL=7yHeQ)Ksru{tg7mmn4z~MiX4Zow#dGrJGwowsYN0o~!aFmQ>Ha+widO?QSm4>zer$4HZ!l z%DF7(?F2X*%$7HtY;JfG%(pYVYNi@DzhC*~iI4K`OkW`URdVY}rCP@ZTW_0f+x7=5 zA8TMMOTXD$z>@G^%&x?F&ELPG4N6@Vn>Q|ESIE>_Su(p`rRaoBlvK~g2kVYCGdBEt zd1ymk)>awe9JAsdZ7M@pF;; zmfwjA4PJK|SF1EKiOKI3Dmdt4?|SO2<7#!B1JVEu+eoh{5wKi-ti z7tUd0&C9x;_V4AD>SN9RCOsRs9X(;QvT1g`{oG8gIgA?@9ZgZ{T2}M-Z-%*D$*~hG z32DvgH>GDEYcTw`ZU2HKTkoV=rP>OsuaXZ=-hlg z?YBEK9*40%-&8N!EbaMa^Yh!;_NzNX>#z3rsh@edd_iPLc=zLaM#jh9m8C}a|HU$Q zcU`mUt7<5C7ItWV;0oVA_2o5l{QiqIKT?`j*po7Oa}TGGQBK{7<;U-Hu*Lf{^uDZ5nENDnzmmzzops&)dz_zj^6jX;Bib~}Q|{58 z`h%&3VcG?g-+cXIKJj_m{0`ZbW;d@H9e4X*Us1o-=7;y~5I0?R^5a=EK~DtP!@H3KJR?Jk;ers1QM>C*7pBHkRYCD}Lj*Lg5AX>nOqjP^SHb@d(xpIYy2JhY*80c*=5wm+{2p;CZ7Ete0ym! zQzK99@4cLsvph3Tb=6*Oek08|i)&`mpNkX95_x#{)b6Piwn+=^JR5v^Qww9mujyK6 zzyEj~W)?458B)j1Eo6VSf8z!FSu0x~$+Av+UEBBdll#*cmpxbO+#6Y)9Pd89ydY_7 zTSJk`lpjCUKh5uGimF@cP_M7|*5yvU%yo0i8||6v!Y7?;IsESXTY-oMPIvss`sV$-|{t85crx7GKCmT8`=XIeDPtG#RK-T(jMx>lC_?2C+Nc~NxZSJ3K) z&-GIeg!%ILe17n{=1})fiOgR2>8qcFPl^cO7WiMksEQ*%G1%?Nj1$(q0u67wKb;SI zC=$8CSG?j|Jr~F7pv=Dc&!y*_>^rB>-j!R&aWCKXrPr>VSL*jRI)rLJ`17hYC3}K= zp;_m*Z~JdeY?t*|wtRN|AA_Ue-|J)FHJB+)l3DY+ePwIi^{*eCU3K%k>s2zWqPU+O z{CKbF?c~E-uC;kNIA5`VTAbSANLEt94`Kl^rat__Fq`P%Yolf(-FzkfeDdU&Q$!<*)VmyVyZ zh)%U+E?25$V@*ls?M?g7I`8)EZORJGcj`7Af9MowX1P7C#-*t#Rr2vgrkFI=dF%3X zn!bEqa%4)IiSg}~E!BsN`_li{TeBT9c3g0K<+;WwZHo?m`OIgqE`M@WOj>)U5?aIDwOV{G{P zVdjRFt<5qrYZQtb%yt)luYV-_$6)KmWy{$bCboZC`|X>yq=d{X2x_vzgHKP4J-Ue`RY;PLsbHTA&fJ*yj-8jEgxTpSs{lzU~# z@~r>=epj}4>FY5qdbGbxv!=1Fe&)hewzeD*n|5Y&Hvg<*d>L(cFZ1r9IXOH{-`@t$ zKi6`ZC3D@5G;_;`)pzRaO!W1h9IacrxoLif+}s~OGZ-6+mZmI7+En9sce=TI%AUyD z^5e~+4SU0$T5qjiSMTZ>qb+$SY4N_!eVu#y|NNQx@?x=3$l8Rb^|7~jd>%KX+`q9; zqC3Y+sV}_N_Sr|N>48Nv{?-RhJnF~8xAhTsReR5}khwjXr=CAzX?W)+e(rDm{P6t1 zqZQoGxVgCdqWX2a@64Kd|BjrQk3`+`dRcewkgVNlFLN4~^jqG$)ajh;b%(d8!1Mc$ zo%PNg)5A=b9epFOA2{)OeQ!sA1?$blYv;I$wiefadnXd9oU8G{CsTMb%Zu1{zvkmt zRX6W(?zR)J&#!NYZqn%c9J27mly_Y&Z43+(FA0@ia99(!xUTN{?bwM8-@cU|yg2Q) zk7Mhmn&k6;#IM_KnI=(pcamBHmtg#_*Hvd{#0G`5Y&dRrMzZ0G)x!&AwPzyZlJ=IL z`pe0FXV&N5+UC7;lusU4JZe6rZg0&rm)4ZWJ4_j0H2#~T@^D|1N~+MYWd&J{+~W%kXO}d-a!(b28TFadGsemo4Of+T6IZiT}Wq zt?_yqj@(tU^<7zuRg1WT=bv4y-^1C+!YsensZ3jYUd)e*C09~&f*Nk{Ngpv;X6L`O z;diz5E*8-b>MT>wmsd>D&0`a>5!zL~W(7w;WW)a>DccX?NMo1J#W^QwJOPq|LUwuS)J+&)3*JTC~G>sR^$nL!?(118};)=7F+ROtW2}KX4>u*z84$94hb%;YOv?+y4I2XFSe$#vUHseBV+x( z@NS33QleL8Ct(2GuytU>dWSP`l8LH2icz=ZQPlWykKQ+9^2RVYtrLd%d79N zVKvS$FFW#~KB!wXqx+)GlN*1}p15n~e>b<5 zWam2Z+N<*BmesRooO;-IznP2k(aih`y+2VAp@}T#kJfTFIM_6t+;R3v@PU@_syoxU z`H%d#JW(Y6&h(hNuab85O0^F!*n011-M0V5)ME|NU(;_MjA2Q*Q)gFV==Arm@D-)5 zqiq`(aZbt9`tosheO%ND8`t`tjS{ZMntiYTd-<|GFUxk4aL$BxKi<3w?`)Y~Z?OK8 zyNp%et#kFto%Xsd6HYAAfBm;3E%eu~i}jz2_Iv$Kymr^?PH~q?*bAa{b?3vxHe{UCpU`~&hA$bTSzg8U2eH^~2> zZ~%n|C|p3{0}3Zlc!9zV6n>y^1cfIkTtVRr3TIGwgTfsY{-AgO#Rn)}K=A{LCs2HW z;tdpkpm+quCn#P)@e7J)P<(^p9TfkdbO1^ZpmYIBAE0ysN-v;v14=)jbOcIIpmYUF zU!ZgbN^hWa2TFgSbO=h1pmYgJpP+OKO0S@F3rfGBbPP(*pmYsN-=K63O7Ea_4@&=_ zd;rQ1pnL(!AE0~!$}gaN1Ij<3d<4o*pnL_&U!Z&j%5R{22g-k-dqpnM6+pP+mS z%CDe&3(CKsd<@FZpnMI=-=KUB%I~0j56b_basX5wfXW3>`2Z>>K;;Ff+yIpypmGFM zo`A{~Q27EXXF%l*sN4aSKcI35R33rKB~bYUDyKl@6{y?-m0zH83{;+h$~92=1}f)3 z7fpn3#UpMdHWQ2hd`XF&B0sNMn9KcIRDR3CxrB~bkYs;5Bp6{y|<)nA}` z3{;NQaP2CC;k^&P0*1J!?^dJt3}g6c(3{RpZjLG>l5-UQX3pn4QkpMvUDQ2h$3 zXF>HXsNMzDzo2>;R3C%tWl;SLs;5EqHK^VO)!(3c98{l!>UB{44yxxt^*yNG2i5fZ89Rb_l3F0&16l z+9#lP3aGsTYPW#eFQ9e|s67K}*MQnLpmq+Zy#s3ZfZ9Kxb`YpN1Zo$7+DD*v5~#fd zYBzz}PoQ=bs67R0SAp7Bpmr9hy#;D_f!bf7b{MEV25Ogq+Gn748mPSnYPW&fZ=iM@ zs67X2*MZu1pmrXpy$5Rdf!cqdb|9!d2x=FC+J~TaBB;FxYBz$~kDzuWs67d4SAyD? zpmrvxy$Nb}g4&;;b||Pl3Tl@|tZ0&zXH_10QECK{S8pR1JwTj^+Q1Y5m3Jb)IS0BQ$YO{ zP`?G#e*yJlK>Zm|zvlMrZOWj24yeBa>i2;9KgUm5M1%T6pnegke+23$f%;3JeiNww z1nNiao6aN#>Q{mKSD=0tsJ{j3cY*p}pne#rKL+ZTf%<2lej2F12I{wg`fs3q9H>7B z>eqq#cc6YAsJ{p5_ksFfp9b}-LH%n`KO5BF2KBo^{clh|9Mm5N z^~*v1b5K7W)L#en+d=(zP(L2jp9l5p`@Vj12lewo{e4isAJqQ`jRSzj13=>fpz#6F zI00z905om@8b1JyBY?&eK;sIa@deO018BSfH0}Tze*ld`fW{+0;}W3p3D7tNXuJY6 zZUGv<0F7gS#xp?U8ldqF&^X7b^gmgkaSzb=2WT7wG#&yP7XgirfW}Ec<0YVR6VUhx zXdDGJo&p+I0gbPK##un)Eue81(D(~z90oKV0~(hBjn9C_Y04T{8bISVpz#~fI1Xq$ z2Q;n&8s7np^MJ;CK;u53@gLAQ5NJFIG%f@h9|DaNfyRqK<3^zIBhWY!Xgmott^^ui z0*y0)#+yLnPN4B8&^Q!mJPI@}1sb0MjZ=Zft3cycpz$lvI2LF;3pB0;8s7qqbAiUY zK;vGZ@h{Lg7-&2UG%f}j9|Mh(fyT=~<7S}oGtf91Xgm!xt_B)k1C6tR#@j&SZlLiu z&^R1uJPtH22O6IPjnjd~>pYa^8s7tr^MS_uK;wR(@juWwAZR=g zG%k2|j)o&>oDei#2pTs8jUR%>5kcdLpm9ae_#$YW5j5Ti8h6Y)^Se5+g++Az43?=n zzbdAH#wWq!ly)2epm9sk_$6o@6EvO)8rKAkZ-T}-LF1jEaZk|rCukfLG#&~X7X^)v zg2qX~r@cjVpu3mqFvqpz&tVxHD+{88i+J8jl8zOM}LzLF3e*@oLbxHE8@AG>#1# z&jyWagT}W(YY93#(6~8h{2Vln4jNAfjjMyk z*Fod#pz(IlxI1Y49W)LP8jlB!%Y(+}LF4qG@p{m>J!t$MG>#7%&j*d`gU0tk&0B!xFF^Acp!p2Yyas4~qi$JFC1}0_H17eL{{YQ{ zfaXI$^CF=65zssdXubqAZvvV>0nMX;=2JlPDxmol&^!xhz6CVz0-Aq`lRU8mG#>++ zmjTVstd})d51Ow5&D((HZ$R@np!pooybfr72Q<$En(qP4`+(+uK=VML`Jn$|b|t+9 zED4}_BG7yhXx<1kf3$U_QY~mc2{f++nqLCVGlAxtK=V$Z`6tjk6lgvQG%p33p90NO zf#$0~^H!kwE6_X^Xg&)xuLYXl0?l)Q=DR@iUZD9e&^#DuJ`6N32AUrO&69!V%RuvH zp!qY|4K%L?nqLFWvn8iy+k@uaK=W^)c{tE~9B5t+G(QKLrvuH`f#&T%^LIa+ zSNMYF^FZ@@p!q$}JRfMj4>a!wn*RgM1A^uQLGyy3`9aV;A!xqvT5CfuX#Vi)m;Fkh z`9#pXB4~aQG|vc{Zv@Rdg61DV^N^tV$b47Xm7w`a&^#q*z7jNV37WqI&0~V*GePs3 zp!rSEJSS+r6EyD$n*RjNgM#KmXLrr*0nLws=1D>GrJ#9J(EKTA9u+j73Yu31&98#y zSwZuypm|sD{A;hBKWIJ{G%pL9p9Rg+g63;M^R}S*ThKf%Xg(J-uM3*r1i$U|op!s9aJThoL88oj9nqLOZGlS-vLG#X_`Df5P zG-y5=G%pRBp9alSgXXJ2^VXpGYtTG4Xg(V>uML{t2F-JW=DR`j-ZK*ah=bN~dH@`b;v_Xl1q_Sn#1wyszE z0fS=EjC1vl4c5XN7x8v{eSdKGG#CDuJ(c$|nafSiud+34VtJALH(~DH8it1HrU`R3 zXR^FVUa-pcs6BJ}n#w(uUp`KAnbz?2{qLI_7d^;#Y}gxIG$Ue@_Jj7G2D1vei^Xs1 ze^;Luwe|kn@$Gy6&cqc~QA~{i*>5K=yjXN&Z=<~av0vH+iZy#`Kbubv+&hbbVfDPs zb+xuGO=VSA`}@8;yl}UnPrdHCaL&}ce|4Kf=Z6<;;o`{YKD_0PG;7P>di|b6iH4KE zIZ&|*cf(1?t@=HM zVXQ5}d55=jUE|{T(=b20@9V$1{Z+y_vu*m+S?4{x5Iy^9|1Arbriay;>yG|pV3^!E zJ#gZsJ+*hTwF{ae<@I;$D7q2b`F8RdF{Z{Z^@%HLWxsuw?6LJ$-Tb?{KICF?QhtLO z>rL$k8ybpceEHv3fuSKU zD`9R-G|P(@yH?p|bTF4&itMSpQ$NjxUE%9{>)wrvgf==hv;-B+SXQ9@pyhUhSz*J) z;^+^*tFxWa4(Q=@{(+sWd!MK}Kclhc2Dh>jOl?ou?!6I zdo$NHw7WDd7QEWOwf^CSUZp<8%aOPGJw6o; zCsUoT%G)pQOW!hWfBh~)|JZr8+yZkLvvzYeyR-$L{@YQI9(L$s+#m7S{R@(ow*9Z? z=3kK1SpP?yUp4H|lK#IPY-?TGO8l~Ra~5+8^gr;Am2KExum8F)J+b_%{4CdolY&e2 zdu*q&w)pEG-Xc-Q#bL=ZKYUU1zq&6cgmWIG_NlK;cz9va!K?k(T3woocrw>H)H5*j zsZS4lHDOOJ?`rLWcprIvjgq1pl8@g`=4fDQobw`aMP}Kz?70qyKacr19< zkX@ND*U5|Jg>~sF+htFg%NZK>RB}I?=8{_a_5C}~jf*a=aBL`=R5T+~OZ&m&x(2gC z&WpuATYgu29I^FYko4_4Yf9n@`(sRvi7js@+prhim{KRNU#Fv8FnjWzTC?TT17$rJ z7@W#7*O|R=X<}=*+F$$l;f0WrK6M@+;hY1j{?*A%oFD!{or}Yy{_qwa9@dr}t@=HG z4mOx59hd#Le5w|X1kaY6Z z|9Z)W1xcSD{1G=R4m+ge_qSum8ke@K{aL$iuJv^6js0Y3obhw*RWUS$xAu z<8=L=Z>LyW6q*ljVP@ju*i<_|JlgPIUF9_4oVLY%>U*3YUeKtx+8_7UrOB!xb6xg5 z1_s`u>463Tdun&A(=M3VC$IlOsp!VK`nQv91(_OS+Y?um@BQ|@DAv|{XU6a9sIwP~ zr!+N~rTy1_pj%rs{QZ7wuX2^?jq`G#AdwJ(XYIGnZ#Jtg?N6o8`szf`qxI zK@1ItHYCi=>}7e8t+2}WdOdUbW#K)Q&K=WS?00{Cza)C&B9kn~hQsHJW{5UvKREfP z!E9E|#bRZ%-_@-%ZN2}@|MuO^K5@mJN~XrXPj4qLZ78~tep6n5YQA=XQOKU!%bTVL zy7n+IJd({^_p#okDP8Ppzgg$Q3w%5K)Xzi;=Pb$oS7&%>e)y6`E)JbvhqwH$W^Jjn z(C?9+-Eh)<-c|XpHht-fs`l4weD#lg-@q;K`dZd*_dJ(2)v&)EZ?}XU((V2u9xA;c z>3{wI`kxXDlFYjPh(FyHcIZ|3-wuvkm$oHWvUWQ(atloO?jP${y}$m7RbTqvIalT9 z%xO5e%u2r}x|+4+@b|-8+#9(#O0LWgf1C5KP9Q=!hktvYx>DD}3&$j`_W!GQY3h*9 zT<6ryz;JlW^uYh2dukK&v^vD7x|W%iGD5tC$*@^pQ<9{`nt!dPLz<8->Mn|?|!-vR?i!673eXra(&Ba7)PvwVt=5i6aRkqPREH74V zN|?(X!qBiTKVj~Sn=CIDG_10X{={5ai!?K#98Grt0 zKagu`Fq?e-VzETl@9GoLw%%F0zkN6CNL;Z%n5pqf{oBcN6pC&%^vdhc+@M{+7qqAL zeZllV$vX@TsSTOy4!w72`cZMUf34%g3-=fHso$9{oHNPzU!6tm{P3Coxj5!E9p0jK zmbGP0hJMe~*oKpf_g%}V;B)xF{BffHR*rAwde>=1dUE224X6-g(;ug?p_K!V&YJa^*dS7~E z{8jl!`x{P{wCVR0@v*iP*B{=pSe1+8UH|;>iEIAV{qhyg@h$FCS9$pGf_TH#{%NmV znl#HZ*GaoEFw`xb9{6I)p4$C-+66{+^7@xqif$Zhemgny1XE*EYT^o^#Bbj<57~OJ zZ2et*gZpB!etmX038;cSom94u6 z%Zupc33KZwGc@?=B+Q*%$MPbdeU)uq3v;>9u|1Vflc%{HO#1r1?8wGNuUZ@%>^O^N z+^N%kFiWe!tY^~2;x#LNS0C}T^{y=a_TBbb;tGZarpA(|Zzrpl7Tw74lGk@$sa>En zX;1BS&FO*P>lhfgxiZ%&x4JYPIDEC=HtFGo)RaE;lgET}EL;B7En=G=UR%e-!LNIG z%iGDUEytJX_sn%~I9XG6RsP(IzI4up{q@fu`Ns;Ea0_(!WbHOt?b3E}!rzWq^{_*( z^?$^d@+?St*80D`^x%S|?u0+$|5L*bDWCk?F}2yHjg=*9H-83E+ zrRTd|l`k%DIGOlbzek~gwI%k!;VqwwxH#tc%@5aI`>(FMUpVKUN}qaL{lg3P{8#(8 zwz)JJ?9W_xK8}H*FMWDo)9F36|C_W6G8pCcr_>hRcxm`{^2KRPjnaz~S6DiK`yN|i z>;3)h?`oHZi^bROHkchN)PArcplF7{ddG&KzKx5bmA<~;SwGF?n&6(wiS5kgpZBb? z<%nf@A(WXg_xV|dhO(xFxu^fJyx^%_W$SOkTpluGPi4r$X)b>pzP`7v+_ZwKx|~z?(f+yZ3i#??dWa{ zJ2dI%AMq>I3z9f3|JPT~UXb);?jP}7o3KOYs{VEy`s&ig)R?t9@*20mk6i!Q>0$fp zv$po7zw5dxzfY>+hMaE^9kpZd3N4=<=x zU+s^vc4?BEo4L+<4g-UX)%3uY>OHlwKeP*C8|C#MUoN^aC+F?t`Us}RzU_%Co^^iv zt}kKh{iptSwVcew;->BfGxsgp4|+q3W~|S1Y*>GNY+`6FX2G>k^ z{R~s>f|E6SYN!339%$Xfz`$}obKSvAmnP$wtNm|xKfLg}y-%G(SUBfQ{l7XR#rfe! zd$~9iHh@ZJ))w7%lYgwoB5r}E=~=s3ja}NpYyWl_ zGlU)5*Yrnx?wJKiP8t8}|HUpyQs4JST(UjvP@%xzj`{U2ZQGQycK__-7LZ!!AKUN0 zzdp05FWu<=ReAk}hLe-u==VG|*g8w+6Gn7dhnE#V(dXp~}@74ZYy{XRDn~USy_vtN(D>{xcHMS(bovfT(bmRXK zdHn+|+67BE_S7D)n;xjG&A@PXQsz4A6)sJ#o>%*~l|H<1^;w@fV}o$c-6#L*UX;ua zf9b`=v32F)Ete;xCKIvXYCehacSdV z``eLH7j|gA?jLc7DGQP!m;JAobzhLQz3h*8+RLy*ybXUl0w1}wT`bPp&Em@~uzaicoD^x(?|FBCwM8xA@Rpb~E{^pl=Z6J58pkKflWSXU&kFXmr#WAWOzlb!mR8og8! zS4^(|_WcIGt@rb`-_@)4T`W$IYcP9}uKj@jOwo*cO^yxc7&a~{tNr@E+-RDM=JY+4 z8y7K`Z*^K_JE?-@#e{bWbNw0^8XWH?%&jkEd7%)v%67$i=5p@7J(b55r@0)i|N1^( zXyc+|?T!rvdx~bvi_w0NmDylccJ5+vMAPqT!+*BkuWP=2zipDZV*L!J#y1PzPA+#S zx{*^Uudne@yP&yYPwoC&(*s=!7#I|TGuLh1=+g9{=W4&b{KE@R>-*GMM1^xUb^NQd z-Zek`bQBlI{j9@V9$sK=x!b@3>Gres*Bj3Fk2SR87OQW30|Ldm*s!Q#u-O#07@M5dHK4*B*jg`4?Cm+Ac z)F{@NxFY7;x9>lzY`vda|E_MFd$IWT>;|*Rmf8>2R2R+o{=>1Mq;cb-pvzz1d*w`X zc^|Q-l5Yod`RdM9w$sH~Ui_?2n7dVmq2W+>!rW7vSzbtnuCo1;$6W4sV^8I=hG{Mb zKYx91S+#MIp`Bxc;ryZ*_OrAfSeZAN1=UGehq)bC%g+gG^yfm$5tnowvCIjc56=O z7AQCJk1ea+Uw@9FFa2KAReAn14JTiu>-VI`v9_$hDuuy!PP*G5@Rm>xx{Oj^EE*r``a`AFImu)V_7mE@)UHufKk3(G5O>x0AorGBsv1 zC$1=J{`P(SNn7ujwBOZg2^Wjs9cVBUY14jS&s#JjwBE7dl-kBcEfc=JU%q;p3ybfb z%8SL!<$;e@+4459yhwYQFn455C|34y}qn!M&t|fVX zc*jvLj_ECjw{UT=wrr}?@7b%}a8hsbRr%A)`_hkl?63b+>K~i)oLhjoA#1nW6PLD? zC4W28yu%Kuulgh2I&neLW{v;#vh@p+?79Dl*R+Nm+HmM^M_Hmvn@Vcd?t90%1>Q9K z$L6x`ulK3zOV`)CDnDgP!^zi6^?T;Hv9^3DJG|xJOD+zfhWX*U9{#KAFBZE^i zSmfAX=u|Z0XodCz&G!vvkqsA%*WUSEZC+^WJw5Q-cZCg!D~|RuH5w_toqVRg=mv+d zy#DWY?Si+v_tYB4Obi_@A;YEaB^DkReAkQed%+1_SdhH^N)R9&n+-VG;8;(4wtrFJO6gX zMTH$Q$^Ii=cyU3}(Z>JvzkV%9(yjR;e$+hd(A-&nJI>5=XbW@dCFX}e>-<;Ow_P}=KB7;3PR_#% zk1t>Ck8N~miv5wfuB95%zOtUPr&eyRc0r7_yuM0x(T#84-cHtTWNI|Knz$k|_uKcX za9i)RZNICFyDk<_kZdsfU$6aOpH$I|cU_JRSz9+QnjZG`{g2#fE|J&vR5CR(mmm7N z%Jy6p%Zpr_gt<@VGBi}rPMFJS$@1b#^(xy*KbgzB8~0Qmyfn?_d-m7&v5^}W_3dzM zDCjJj@n1~)!MFMbGjG|8#mqgwtNl0IdM^w4_T4i-amAGzOpRL`-cDBkTy%rGN?w15 zop!HM!wda-cM#c6%&FAX1Fm{NPS zKZDVw>3>t^x~9{R{>S;aJ+%h=wF|bk$?Mzm7u{&9e>?e}3R7cuf8q+=wcoza@w4^* zT=cs-_QAzsg@y*R#Mjynipz^;7#d0sCd_@-%JO0<&njEjdgk(2^*xmrCrooOS^f2WhtI}E!X=Ik&mR@d z;B3%-aPCEeSxwo+;<@g>tB)_U^?p0~+joB5#1*x5OpS}!-cGh`DY|j;n7n>!igtl* z(w^D_ho=WBw?g`Z-|JkOu4`WHSDN(jg7eBg^&BtZ9QD$FbtO;dhch&Aao9dPyrr^~ zwdIJXe$Sc}4JUghU6r4u)t7#!ZhyTUr+@6L7H)yEBU!r-Cb_gdP5#>&pG&*#snsmkE|~U8USGVS=!VL}x08K~nHqojCa##c=G*so{kGnVRex6( z*Iz6y;%hJ~Y14l2Xn)a+$au#Fk@Ss=j-UGaUZ;7Qiy70N%00Er<=Td;Y-6UeyjZz7 zVeSiOh6eG9gt^*pSzeeotg@YZkGWi>Xip_az%-YM>%P9<*tc-r^_&b_Z>_W6zRzn)Tru-MQ=>)g+sTuRi*DSRF0X%op?1Mq$33+_ zDy9b>dJh>dk-X#5^uFL~KVQ(p3o|$LsW(}KkNa7CpBfe@=*rDj2za1iSE^Qy`vv!+^aSJGS`o~)C++Y78vM;?O`>H(S zrG}Gh8ufePf3dc(*BsswV8O-lXV(1ijCud+lx>A`CRg>TfBo|C!pnxM{W8~GniBIe z*ZmKLj9)o*@2TyO)-L#0FRy=0qUeTF*W1bb+nE{#A`(};&H47doFlSEDjJ#lR{HyExG(Y@KB^QUC{oyTt=Cii6&eZQw zHfuOJtLCcw$v=JRqD}kj51;psHOb-@SQ4GJ+kUr8n{&tCj?2PfhpyNE5zkgwkd)c` zzy8pM1xcnsf5fjBgdKW*`)@~PgG<}j_gT9+E4c+49sOhXEZkrJYkFV$A>*s^y0r}_ z)BfxCOle|mi8_0D%gzigj-uH4;pKb()y1|8=hzDNsjsVlc;SQ6)&7}%E=@buWv(*_ zfQ;{E-`i7b)u3Gv_f}qCqoU}>9_P1{+ZHo5R!&P?5pDSG`=(l3Z)T?7)e6lQi@%*} zFf&fqeqa_~G-KO-$A*@+jf!Q&&ZA5x-SQ2TgKEnCC%K(iN+ z@pf4cmnO62SNmsAet4lyr%!!Kop6o~`@g!xmigiK$GA9HQx0!gki^>JaYVo8XG_D$ zLe8u5kL&u()~wxc4|5B|CHcp?rtGhueXK9tt>voxRkntcEp_@m z_jFiWE=@kX<;^lKjuYQ$($DgOUo~NFV?9FyH-Ez1 zrEM%PV)w7I{TRnwUXZ@0GWhf~7p~^7@8>XXTr{uNv0;~C(TpwAv>(_nZZJ!AzF6#2 z@w@uSTU&3(hHu|F?j^3cSIE@Z5b$;~$NHihnSJv5y-L~zTkH4KE*6{~*w7A{kJ5>C zY5J0JwSULihZh=}`qcmb6V4H@{a2@8GC$mG1{X)!!oyoM99dhmD)oD!KQx>yY`7}l za=R~mS;7ALmLUIFp^e-E*1cJ~*%e&c?$rP7uoMY9l+p1={Kc*XNios?>+`Y}Bq?3^ zBhK6ub|~r3-;U-Qm$nA8tlfuaatrL3?;rcrZh!sn%D(h3pRUSpXlOXedQ-nADWA2a zKIHHg)y-TSl0EaoYi0k{eW@4DIV0Am9^3iw!j2tR`+##f4!FW{z96A24?p z&G;zg*zmu8t1K^!8WZMferISfs!o`zZ_V=J z-<(yp(Q}x~y{z_BmRC=6(faZAeOTkhMZ#Ac8@A^Z&4`N7evq=g!R%M(#o|PX-_?KX zZN1+}fBT-(ow%Z43sd9f(6^JP<`vzjyDqPPw?Vt0@5`Rrva0EUwYHG?+P$+}nm(If z?N_XMc;VQuKJ~qg!Z`~s{;Lbfo*!-%#l_LT^YE6x9jqjy08GhmP9+5l>#QAW3uP|N7~s3zGKM{1H$7 z8+ORB>2HV0d6%|(nOVE}W4Hwl?)H!6?bu&$E!>xWuKub#gJQ$Ub-nsM9vfI&_6Hu` sB45bGQGI8Acx=PJx|sLEIoB%s)LES#UQk_hwSU2MmnIYA%yquC04Mu(mH+?% literal 0 HcmV?d00001 diff --git a/tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/runs.json b/tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/runs.json new file mode 100644 index 0000000000..811a873684 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_audio_dashboard/demo/data/runs.json @@ -0,0 +1,10 @@ +{ + "run1": + { + "audio": ["au1/audio/0"] + }, + "run2": + { + "audio": ["au2/audio/0"] + } +} diff --git a/tensorflow/tensorboard/components/tf_audio_dashboard/demo/index.html b/tensorflow/tensorboard/components/tf_audio_dashboard/demo/index.html index e6c92b095e..f0a79b573c 100644 --- a/tensorflow/tensorboard/components/tf_audio_dashboard/demo/index.html +++ b/tensorflow/tensorboard/components/tf_audio_dashboard/demo/index.html @@ -16,28 +16,30 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - - - - Audio Dashboard Demo - - - + + + + + +Audio Dashboard Demo + + + + -- GitLab From 2dafcef71bdb03b19b37ae80fe45575c3639e4e3 Mon Sep 17 00:00:00 2001 From: Mark Heffernan Date: Mon, 27 Feb 2017 11:05:41 -0800 Subject: [PATCH 003/101] [XLA] Add HLO call graph. Add an HLO call graph class. The object includes a node for each computation and forward and backwards links between them. Node include the calling context: either parallel (eg, kMap) or sequential (eg, kCall). The class is not used anywhere yet, but there are numerous potential uses throughout the HLO level. Change: 148669295 --- tensorflow/compiler/xla/service/BUILD | 30 ++ tensorflow/compiler/xla/service/call_graph.cc | 258 ++++++++++++++++ tensorflow/compiler/xla/service/call_graph.h | 175 +++++++++++ .../compiler/xla/service/call_graph_test.cc | 290 ++++++++++++++++++ 4 files changed, 753 insertions(+) create mode 100644 tensorflow/compiler/xla/service/call_graph.cc create mode 100644 tensorflow/compiler/xla/service/call_graph.h create mode 100644 tensorflow/compiler/xla/service/call_graph_test.cc diff --git a/tensorflow/compiler/xla/service/BUILD b/tensorflow/compiler/xla/service/BUILD index f5a67124e0..ccd84de654 100644 --- a/tensorflow/compiler/xla/service/BUILD +++ b/tensorflow/compiler/xla/service/BUILD @@ -129,6 +129,36 @@ cc_test( ], ) +cc_library( + name = "call_graph", + srcs = ["call_graph.cc"], + hdrs = ["call_graph.h"], + deps = [ + ":hlo", + "//tensorflow/compiler/xla:status_macros", + "//tensorflow/compiler/xla:statusor", + "//tensorflow/compiler/xla:util", + "//tensorflow/core:lib", + ], +) + +cc_test( + name = "call_graph_test", + srcs = ["call_graph_test.cc"], + deps = [ + ":call_graph", + "//tensorflow/compiler/xla:literal_util", + "//tensorflow/compiler/xla:shape_util", + "//tensorflow/compiler/xla:status_macros", + "//tensorflow/compiler/xla:test_helpers", + "//tensorflow/compiler/xla:xla_data_proto", + "//tensorflow/compiler/xla/service:hlo", + "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + ], +) + cc_library( name = "user_computation", srcs = ["user_computation.cc"], diff --git a/tensorflow/compiler/xla/service/call_graph.cc b/tensorflow/compiler/xla/service/call_graph.cc new file mode 100644 index 0000000000..ed140f728d --- /dev/null +++ b/tensorflow/compiler/xla/service/call_graph.cc @@ -0,0 +1,258 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#include "tensorflow/compiler/xla/service/call_graph.h" + +#include + +#include "tensorflow/compiler/xla/status_macros.h" +#include "tensorflow/compiler/xla/util.h" +#include "tensorflow/core/lib/core/errors.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/lib/strings/strcat.h" +#include "tensorflow/core/lib/strings/stringprintf.h" +#include "tensorflow/core/platform/types.h" + +namespace xla { + +using ::tensorflow::strings::Appendf; +using ::tensorflow::strings::StrCat; + +string CallContextToString(CallContext context) { + switch (context) { + case CallContext::kNone: + return "kNone"; + case CallContext::kSequential: + return "kSequential"; + case CallContext::kParallel: + return "kParallel"; + case CallContext::kBoth: + return "kBoth"; + } +} + +std::ostream& operator<<(std::ostream& out, const CallContext& context) { + out << CallContextToString(context); + return out; +} + +string CallSite::ToString() const { + return StrCat(instruction->name(), " calls ", called_computation->name(), + ", ", CallContextToString(context)); +} + +CallGraphNode::CallGraphNode(HloComputation* computation) + : computation_(computation) {} + +void CallGraphNode::AddCallSite(const CallSite& callsite) { + callsites_.push_back(callsite); + HloComputation* callee = callsite.called_computation; + if (callee_set_.count(callee) == 0) { + callees_.push_back(callee); + callee_set_.insert(callee); + } +} + +void CallGraphNode::AddCallerCallSite(const CallSite& caller_callsite) { + caller_callsites_.push_back(caller_callsite); + HloComputation* caller = caller_callsite.instruction->parent(); + if (caller_set_.count(caller) == 0) { + callers_.push_back(caller); + caller_set_.insert(caller); + } +} + +void CallGraphNode::AddCallSitesInInstruction(HloInstruction* instruction) { + switch (instruction->opcode()) { + case HloOpcode::kCall: + AddCallSite( + {instruction, instruction->to_apply(), CallContext::kSequential}); + break; + case HloOpcode::kMap: + case HloOpcode::kReduce: + case HloOpcode::kReduceWindow: + AddCallSite( + {instruction, instruction->to_apply(), CallContext::kParallel}); + break; + case HloOpcode::kSelectAndScatter: + AddCallSite({instruction, instruction->select(), CallContext::kParallel}); + AddCallSite( + {instruction, instruction->scatter(), CallContext::kParallel}); + break; + case HloOpcode::kWhile: + AddCallSite({instruction, instruction->while_condition(), + CallContext::kSequential}); + AddCallSite( + {instruction, instruction->while_body(), CallContext::kSequential}); + break; + case HloOpcode::kFusion: + for (const auto& fused_instruction : instruction->fused_instructions()) { + AddCallSitesInInstruction(fused_instruction.get()); + } + break; + default: + break; + } +} + +CallGraph::CallGraph(const HloModule* module) : module_(module) {} + +StatusOr CallGraph::GetNode( + const HloComputation* computation) const { + auto it = node_indices_.find(computation); + TF_RET_CHECK(it != node_indices_.end()); + return &nodes_[it->second]; +} + +StatusOr CallGraph::GetNode(const HloComputation* computation) { + auto it = node_indices_.find(computation); + TF_RET_CHECK(it != node_indices_.end()); + return &nodes_[it->second]; +} + +namespace { + +// Returns the call context of a computation which is called from contexts 'a' +// and 'b'. +CallContext UnionContexts(CallContext a, CallContext b) { + if (a == CallContext::kNone) { + return b; + } else if (b == CallContext::kNone) { + return a; + } else if (a == b) { + return a; + } else { + // Contexts are different and neither is kNone, ie one is kSequential and + // the other is kParallel. + return CallContext::kBoth; + } +} + +} // namespace + +Status CallGraph::SetCallContexts() { + std::queue worklist; + + // Initialize worklist with all roots of the call graph (computations without + // callers). + for (const std::unique_ptr& computation : + module_->computations()) { + TF_ASSIGN_OR_RETURN(CallGraphNode * node, GetNode(computation.get())); + if (node->callers().empty()) { + node->set_context(CallContext::kSequential); + worklist.push(node); + } + } + + while (!worklist.empty()) { + CallGraphNode* node = worklist.front(); + worklist.pop(); + + for (const CallSite& callsite : node->callsites()) { + TF_ASSIGN_OR_RETURN(CallGraphNode * callee_node, + GetNode(callsite.called_computation)); + + // Update context of callee computation based on the callsite and its + // current context. + CallContext context_to_add; + if (callsite.context == CallContext::kParallel) { + context_to_add = CallContext::kParallel; + } else { + TF_RET_CHECK(callsite.context == CallContext::kSequential); + context_to_add = node->context(); + } + CallContext new_context = + UnionContexts(context_to_add, callee_node->context()); + + if (new_context != callee_node->context()) { + // Context of computation has been changed so add node to worklist. + callee_node->set_context(new_context); + worklist.push(callee_node); + } + } + } + + // No node should have a kNone calling context. + for (const std::unique_ptr& computation : + module_->computations()) { + TF_ASSIGN_OR_RETURN(CallGraphNode * node, GetNode(computation.get())); + TF_RET_CHECK(node->context() != CallContext::kNone); + } + return Status::OK(); +} + +/* static */ +StatusOr CallGraph::Build(const HloModule* module) { + CallGraph call_graph(module); + + // Construct nodes of the call graph and populate the callsites. + for (const std::unique_ptr& computation : + module->computations()) { + auto it_added = call_graph.node_indices_.insert( + {computation.get(), call_graph.nodes_.size()}); + // All computation should be unique, so the computation should not already + // exist in the map. + TF_RET_CHECK(it_added.second); + call_graph.nodes_.emplace_back(computation.get()); + + // Add all callsites in this computation. + for (const std::unique_ptr& instruction : + computation->instructions()) { + call_graph.nodes_.back().AddCallSitesInInstruction(instruction.get()); + } + } + + // Add caller callsites to each node. + for (const std::unique_ptr& computation : + module->computations()) { + TF_ASSIGN_OR_RETURN(CallGraphNode * caller_node, + call_graph.GetNode(computation.get())); + for (const CallSite& callsite : caller_node->callsites()) { + // Add caller callsites. + TF_ASSIGN_OR_RETURN(CallGraphNode * callee_node, + call_graph.GetNode(callsite.called_computation)); + callee_node->AddCallerCallSite(callsite); + } + } + + TF_RETURN_IF_ERROR(call_graph.SetCallContexts()); + + XLA_VLOG_LINES(1, call_graph.ToString()); + + return std::move(call_graph); +} + +string CallGraph::ToString() const { + string out; + Appendf(&out, "Call graph for module %s:\n", module_->name().c_str()); + for (const CallGraphNode& node : nodes()) { + Appendf(&out, "Computation %s:\n", node.computation()->name().c_str()); + Appendf(&out, " calls:\n"); + for (const HloComputation* callee : node.callees()) { + Appendf(&out, " %s\n", callee->name().c_str()); + } + Appendf(&out, " called by:\n"); + for (const HloComputation* caller : node.callers()) { + Appendf(&out, " %s\n", caller->name().c_str()); + } + Appendf(&out, " callsites:\n"); + for (const CallSite& callsite : node.callsites()) { + Appendf(&out, " %s\n", callsite.ToString().c_str()); + } + } + return out; +} + +} // namespace xla diff --git a/tensorflow/compiler/xla/service/call_graph.h b/tensorflow/compiler/xla/service/call_graph.h new file mode 100644 index 0000000000..f9291684bf --- /dev/null +++ b/tensorflow/compiler/xla/service/call_graph.h @@ -0,0 +1,175 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Call graph for an HLO module. + +#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_HLO_CALL_GRAPH_H_ +#define TENSORFLOW_COMPILER_XLA_SERVICE_HLO_CALL_GRAPH_H_ + +#include + +#include "tensorflow/compiler/xla/service/hlo_computation.h" +#include "tensorflow/compiler/xla/service/hlo_instruction.h" +#include "tensorflow/compiler/xla/service/hlo_module.h" +#include "tensorflow/compiler/xla/statusor.h" + +namespace xla { + +// The context in which a computation is called by another computation. +enum class CallContext { + // In a parallel contex the computation is applied to each element of the + // array argument(s). kMap and kReduce instructions call computations in + // parallel context. + kParallel, + + // In a sequential context the computation is applied to the entire argument + // shape(s). kCall and kWhile (body and condition) call computations in + // sequential context. + kSequential, + + // A computation is called from both a parallel and sequential context. + kBoth, + + // During call graph construction kNone is used to indicate that the context + // has not been determined. This is the top value for the context + // lattice. After construction, no call sites or call graph nodes should have + // this value. + kNone +}; + +string CallContextToString(CallContext context); +std::ostream& operator<<(std::ostream& out, const CallContext& context); + +// Represents an instruction calling a particular computation in an HLO +// module. Some instructions such as kWhile can call more than one computation +// and may be represented with more than one CallSite, one for each computation +// called. +struct CallSite { + // The calling instruction. + HloInstruction* instruction; + + // The computation the instruction is calling. + HloComputation* called_computation; + + // The context in which the computation is called. + CallContext context; + + string ToString() const; +}; + +// A node in the call graph representing an HLO computation. +class CallGraphNode { + public: + CallGraphNode(HloComputation* computation); + + // Return the computation represented by this call graph node. + HloComputation* computation() const { return computation_; } + + // Return the call sites in this computation. These are the instructions in + // this computation which call other computations. + const std::vector& callsites() const { return callsites_; } + + // Return the computations called by this computation. + const std::vector& callees() const { return callees_; } + + // Return the call sites in other computations which call this computation. + const std::vector& caller_callsites() const { + return caller_callsites_; + } + + // Return the computations which call this computation. + const std::vector& callers() const { return callers_; } + + // Return or set the context in which this computation is called. + CallContext context() const { return context_; } + void set_context(CallContext value) { context_ = value; } + + // Add a callsite which calls this computation. Updates callers to include the + // calling computation. + void AddCallerCallSite(const CallSite& caller_callsite); + + // Add a call site to this computation. Updates callees to include the called + // computation. + void AddCallSite(const CallSite& callsite); + + // Add all the call sites (if any) for this instruction. Instruction must be + // an instruction in this node's computation. + void AddCallSitesInInstruction(HloInstruction* instruction); + + string ToString() const; + + private: + // Computation represented by this call graph node. + HloComputation* computation_; + + // The computations called by this computation. The vector is used for a + // stable ordering and the set enables fast membership testing. + std::vector callees_; + std::unordered_set callee_set_; + + // The computations which call this computation. The vector is used for a + // stable ordering and the set enables fast membership testing. + std::vector callers_; + std::unordered_set caller_set_; + + // The call sites in this computation + std::vector callsites_; + + // The call sites in other computations which call this computation. + std::vector caller_callsites_; + + // The context in which this computation is called. + CallContext context_ = CallContext::kNone; +}; + +// The call graph for an HLO module. The graph includes a node for each +// computation in the module. +class CallGraph { + public: + // Build and return a call graph for the given HLO module. + static StatusOr Build(const HloModule* module); + + // Public default constructor required for StatusOr. + CallGraph() = default; + + // Return the node associated with the given computation. + StatusOr GetNode( + const HloComputation* computation) const; + StatusOr GetNode(const HloComputation* computation); + + // Return the vector of all nodes in the call graph. + const std::vector& nodes() const { return nodes_; } + + string ToString() const; + + private: + CallGraph(const HloModule* module); + + // Sets the call contexts for every node in the graph. + Status SetCallContexts(); + + const HloModule* module_ = nullptr; + + // Vector of all nodes in the call graph. + std::vector nodes_; + + // Map from HLO computation to the index of the corresponding call graph node + // in nodes_. + std::unordered_map node_indices_; +}; + +} // namespace xla + +#endif // TENSORFLOW_COMPILER_XLA_SERVICE_HLO_CALL_GRAPH_H_ diff --git a/tensorflow/compiler/xla/service/call_graph_test.cc b/tensorflow/compiler/xla/service/call_graph_test.cc new file mode 100644 index 0000000000..c63a1bef4e --- /dev/null +++ b/tensorflow/compiler/xla/service/call_graph_test.cc @@ -0,0 +1,290 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#include "tensorflow/compiler/xla/service/call_graph.h" + +#include "tensorflow/compiler/xla/literal_util.h" +#include "tensorflow/compiler/xla/service/hlo_computation.h" +#include "tensorflow/compiler/xla/shape_util.h" +#include "tensorflow/compiler/xla/status_macros.h" +#include "tensorflow/compiler/xla/test_helpers.h" +#include "tensorflow/compiler/xla/tests/hlo_test_base.h" +#include "tensorflow/compiler/xla/xla_data.pb.h" +#include "tensorflow/core/lib/core/status_test_util.h" + +namespace xla { +namespace { + +class CallGraphTest : public HloTestBase { + protected: + // Build and return a trivial computation taking and returning a scalar. + std::unique_ptr MakeScalarComputation() { + HloComputation::Builder builder(TestName() + ".ScalarComputation"); + HloInstruction* param0 = builder.AddInstruction( + HloInstruction::CreateParameter(0, kScalarShape, "param0")); + builder.AddInstruction( + HloInstruction::CreateUnary(kScalarShape, HloOpcode::kNegate, param0)); + return builder.Build(); + } + + // Build and return a computation which takes a scalar and maps (kMap) the + // given computation to the value 'callsites' number of times. + std::unique_ptr MakeMappingComputation( + HloComputation* map_computation, int64 callsites) { + HloComputation::Builder builder(TestName() + ".MappingComputation"); + HloInstruction* param0 = builder.AddInstruction( + HloInstruction::CreateParameter(0, kScalarShape, "param0")); + HloInstruction* last_value = param0; + for (int64 i = 0; i < callsites; ++i) { + last_value = builder.AddInstruction(HloInstruction::CreateMap( + kScalarShape, {last_value}, map_computation)); + } + return builder.Build(); + } + + // Build and return a computation which takes a scalar and calls (kCall) the + // given computation with value 'callsites' number of times. + std::unique_ptr MakeCallingComputation( + HloComputation* map_computation, int64 callsites) { + HloComputation::Builder builder(TestName() + ".CallingComputation"); + HloInstruction* param0 = builder.AddInstruction( + HloInstruction::CreateParameter(0, kScalarShape, "param0")); + HloInstruction* last_value = param0; + for (int64 i = 0; i < callsites; ++i) { + last_value = builder.AddInstruction(HloInstruction::CreateCall( + kScalarShape, {last_value}, map_computation)); + } + return builder.Build(); + } + + // Build and return a computation which takes a scalar and returns a PRED + // value. + std::unique_ptr MakeConditionComputation() { + HloComputation::Builder builder(TestName() + ".ConditionComputation"); + HloInstruction* param0 = builder.AddInstruction( + HloInstruction::CreateParameter(0, kScalarShape, "param0")); + HloInstruction* zero = builder.AddInstruction( + HloInstruction::CreateConstant(LiteralUtil::CreateR0(0.0f))); + builder.AddInstruction(HloInstruction::CreateBinary( + ShapeUtil::MakeShape(PRED, {}), HloOpcode::kGt, param0, zero)); + return builder.Build(); + } + + const Shape kScalarShape = ShapeUtil::MakeShape(F32, {}); +}; + +TEST_F(CallGraphTest, SingletonComputation) { + // Test the call graph of a module with a single computation. + HloModule module(TestName()); + HloComputation* computation = + module.AddEntryComputation(MakeScalarComputation()); + TF_ASSIGN_OR_ASSERT_OK(const CallGraph call_graph, CallGraph::Build(&module)); + EXPECT_EQ(1, call_graph.nodes().size()); + TF_ASSIGN_OR_ASSERT_OK(const CallGraphNode* node, + call_graph.GetNode(computation)); + EXPECT_EQ(computation, node->computation()); + EXPECT_TRUE(node->callsites().empty()); + EXPECT_TRUE(node->callees().empty()); + EXPECT_TRUE(node->caller_callsites().empty()); + EXPECT_TRUE(node->callers().empty()); + EXPECT_EQ(CallContext::kSequential, node->context()); +} + +TEST_F(CallGraphTest, UnreachableComputation) { + // Test the call graph of a module with an entry computation and an + // unreachable computation. + HloModule module(TestName()); + HloComputation* entry_computation = + module.AddEntryComputation(MakeScalarComputation()); + HloComputation* unreachable_computation = + module.AddEmbeddedComputation(MakeScalarComputation()); + + TF_ASSIGN_OR_ASSERT_OK(const CallGraph call_graph, CallGraph::Build(&module)); + EXPECT_EQ(2, call_graph.nodes().size()); + + TF_ASSIGN_OR_ASSERT_OK(const CallGraphNode* entry_node, + call_graph.GetNode(entry_computation)); + EXPECT_EQ(entry_computation, entry_node->computation()); + EXPECT_EQ(CallContext::kSequential, entry_node->context()); + + TF_ASSIGN_OR_ASSERT_OK(const CallGraphNode* unreachable_node, + call_graph.GetNode(unreachable_computation)); + EXPECT_EQ(unreachable_computation, unreachable_node->computation()); + EXPECT_EQ(CallContext::kSequential, unreachable_node->context()); +} + +TEST_F(CallGraphTest, ParallelComputation) { + // Test a call graph of a module with an entry computation which calls another + // computation in a parallel context via kMap. + HloModule module(TestName()); + HloComputation* map_computation = + module.AddEmbeddedComputation(MakeScalarComputation()); + HloComputation* entry_computation = module.AddEmbeddedComputation( + MakeMappingComputation(map_computation, /*callsites=*/5)); + + TF_ASSIGN_OR_ASSERT_OK(const CallGraph call_graph, CallGraph::Build(&module)); + EXPECT_EQ(2, call_graph.nodes().size()); + + TF_ASSIGN_OR_ASSERT_OK(const CallGraphNode* entry_node, + call_graph.GetNode(entry_computation)); + EXPECT_EQ(entry_computation, entry_node->computation()); + EXPECT_EQ(CallContext::kSequential, entry_node->context()); + EXPECT_EQ(5, entry_node->callsites().size()); + EXPECT_EQ(1, entry_node->callees().size()); + EXPECT_TRUE(entry_node->caller_callsites().empty()); + EXPECT_TRUE(entry_node->callers().empty()); + + TF_ASSIGN_OR_ASSERT_OK(const CallGraphNode* map_node, + call_graph.GetNode(map_computation)); + EXPECT_EQ(map_computation, map_node->computation()); + EXPECT_EQ(CallContext::kParallel, map_node->context()); + EXPECT_TRUE(map_node->callsites().empty()); + EXPECT_TRUE(map_node->callees().empty()); + EXPECT_EQ(5, map_node->caller_callsites().size()); + EXPECT_EQ(1, map_node->callers().size()); +} + +TEST_F(CallGraphTest, SequentialComputations) { + // Test a call graph of a module with an entry computation which calls another + // computation in a sequential context via kCall. + HloModule module(TestName()); + HloComputation* called_computation = + module.AddEmbeddedComputation(MakeScalarComputation()); + HloComputation* entry_computation = module.AddEmbeddedComputation( + MakeCallingComputation(called_computation, /*callsites=*/3)); + + TF_ASSIGN_OR_ASSERT_OK(const CallGraph call_graph, CallGraph::Build(&module)); + EXPECT_EQ(2, call_graph.nodes().size()); + + TF_ASSIGN_OR_ASSERT_OK(const CallGraphNode* entry_node, + call_graph.GetNode(entry_computation)); + EXPECT_EQ(entry_computation, entry_node->computation()); + EXPECT_EQ(CallContext::kSequential, entry_node->context()); + EXPECT_EQ(3, entry_node->callsites().size()); + EXPECT_EQ(1, entry_node->callees().size()); + EXPECT_TRUE(entry_node->caller_callsites().empty()); + EXPECT_TRUE(entry_node->callers().empty()); + + TF_ASSIGN_OR_ASSERT_OK(const CallGraphNode* called_node, + call_graph.GetNode(called_computation)); + EXPECT_EQ(called_computation, called_node->computation()); + EXPECT_EQ(CallContext::kSequential, called_node->context()); + EXPECT_TRUE(called_node->callsites().empty()); + EXPECT_TRUE(called_node->callees().empty()); + EXPECT_EQ(3, called_node->caller_callsites().size()); + EXPECT_EQ(1, called_node->callers().size()); +} + +TEST_F(CallGraphTest, ContextBothComputations) { + // Test a call graph of a module with an entry computation which calls another + // computation in both a parallel and sequential context. + HloModule module(TestName()); + HloComputation* subcomputation = + module.AddEmbeddedComputation(MakeScalarComputation()); + + HloComputation::Builder builder(TestName()); + HloInstruction* param0 = builder.AddInstruction( + HloInstruction::CreateParameter(0, kScalarShape, "param0")); + HloInstruction* call = builder.AddInstruction( + HloInstruction::CreateCall(kScalarShape, {param0}, subcomputation)); + HloInstruction* map = builder.AddInstruction( + HloInstruction::CreateMap(kScalarShape, {call}, subcomputation)); + HloComputation* entry_computation = + module.AddEmbeddedComputation(builder.Build()); + + TF_ASSIGN_OR_ASSERT_OK(const CallGraph call_graph, CallGraph::Build(&module)); + EXPECT_EQ(2, call_graph.nodes().size()); + + TF_ASSIGN_OR_ASSERT_OK(const CallGraphNode* entry_node, + call_graph.GetNode(entry_computation)); + EXPECT_EQ(entry_computation, entry_node->computation()); + EXPECT_EQ(2, entry_node->callsites().size()); + + const CallSite& call_callsite = entry_node->callsites()[0]; + EXPECT_EQ(call, call_callsite.instruction); + EXPECT_EQ(subcomputation, call_callsite.called_computation); + EXPECT_EQ(CallContext::kSequential, call_callsite.context); + + const CallSite& map_callsite = entry_node->callsites()[1]; + EXPECT_EQ(map, map_callsite.instruction); + EXPECT_EQ(subcomputation, map_callsite.called_computation); + EXPECT_EQ(CallContext::kParallel, map_callsite.context); + + TF_ASSIGN_OR_ASSERT_OK(const CallGraphNode* sub_node, + call_graph.GetNode(subcomputation)); + EXPECT_EQ(CallContext::kBoth, sub_node->context()); +} + +TEST_F(CallGraphTest, ComplexGraph) { + // Test a call graph of a module with several computation called in various + // contexts. The call graph looks like: + // + // entry + // / | + // a | + // / | \ | + // b | cond + // \ | + // c + // + // Calls are made via kCall, kWhile, and kMap instructions. + HloModule module(TestName()); + HloComputation* cond_computation = + module.AddEmbeddedComputation(MakeConditionComputation()); + HloComputation* c_computation = + module.AddEmbeddedComputation(MakeScalarComputation()); + HloComputation* b_computation = module.AddEmbeddedComputation( + MakeMappingComputation(c_computation, /*callsites=*/1)); + + HloComputation* computation_a; + { + HloComputation::Builder builder(TestName() + ".a"); + HloInstruction* param0 = builder.AddInstruction( + HloInstruction::CreateParameter(0, kScalarShape, "param0")); + HloInstruction* call = builder.AddInstruction( + HloInstruction::CreateCall(kScalarShape, {param0}, c_computation)); + builder.AddInstruction(HloInstruction::CreateWhile( + kScalarShape, cond_computation, b_computation, call)); + computation_a = module.AddEmbeddedComputation(builder.Build()); + } + + HloComputation* entry_computation; + { + HloComputation::Builder builder(TestName() + ".entry"); + HloInstruction* param0 = builder.AddInstruction( + HloInstruction::CreateParameter(0, kScalarShape, "param0")); + builder.AddInstruction(HloInstruction::CreateWhile( + kScalarShape, cond_computation, computation_a, param0)); + entry_computation = module.AddEntryComputation(builder.Build()); + } + + TF_ASSIGN_OR_ASSERT_OK(const CallGraph call_graph, CallGraph::Build(&module)); + EXPECT_EQ(5, call_graph.nodes().size()); + + TF_ASSIGN_OR_ASSERT_OK(const CallGraphNode* entry_node, + call_graph.GetNode(entry_computation)); + // Entry computation has one while instruction (two callsites). + EXPECT_EQ(2, entry_node->callsites().size()); + EXPECT_EQ(CallContext::kSequential, entry_node->context()); + + TF_ASSIGN_OR_ASSERT_OK(const CallGraphNode* c_node, + call_graph.GetNode(c_computation)); + EXPECT_TRUE(c_node->callsites().empty()); + EXPECT_EQ(2, c_node->callers().size()); + EXPECT_EQ(CallContext::kBoth, c_node->context()); +} + +} // namespace +} // namespace xla -- GitLab From fb430a425a618665537cb68f2ca9a23873c6bcd7 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 27 Feb 2017 11:07:32 -0800 Subject: [PATCH 004/101] Add the job's DeviceSet to the options for optimization passes that run in the session master. Change: 148669552 --- tensorflow/core/common_runtime/optimization_registry.h | 7 +++++++ .../core/common_runtime/simple_graph_execution_state.cc | 2 ++ 2 files changed, 9 insertions(+) diff --git a/tensorflow/core/common_runtime/optimization_registry.h b/tensorflow/core/common_runtime/optimization_registry.h index adfa17ae9d..a469c8aa4e 100644 --- a/tensorflow/core/common_runtime/optimization_registry.h +++ b/tensorflow/core/common_runtime/optimization_registry.h @@ -22,6 +22,7 @@ limitations under the License. #include #include +#include "tensorflow/core/common_runtime/device_set.h" #include "tensorflow/core/framework/function.h" #include "tensorflow/core/graph/costmodel.h" #include "tensorflow/core/graph/graph.h" @@ -39,6 +40,12 @@ struct GraphOptimizationPassOptions { const CostModel* cost_model = nullptr; FunctionLibraryDefinition* flib_def = nullptr; // Not owned. + // The DeviceSet contains all the devices known to the system and is + // filled in for optimizations run by the session master, i.e., + // PRE_PLACEMENT, POST_PLACEMENT, and POST_REWRITE_FOR_EXEC. It is + // nullptr for POST_PARTITIONING optimizations which are run at the + // workers. + const DeviceSet* device_set = nullptr; // Not owned. // The graph to optimize, for optimization passes that run before // partitioning. Null for post-partitioning passes. diff --git a/tensorflow/core/common_runtime/simple_graph_execution_state.cc b/tensorflow/core/common_runtime/simple_graph_execution_state.cc index 82d36b51b5..a6bcfb8103 100644 --- a/tensorflow/core/common_runtime/simple_graph_execution_state.cc +++ b/tensorflow/core/common_runtime/simple_graph_execution_state.cc @@ -257,6 +257,7 @@ Status SimpleGraphExecutionState::InitBaseGraph( optimization_options.session_options = session_options_; optimization_options.graph = &new_graph; optimization_options.flib_def = flib_def_.get(); + optimization_options.device_set = device_set_; optimization_options.cost_model = &costs; TF_RETURN_IF_ERROR(OptimizationPassRegistry::Global()->RunGrouping( @@ -306,6 +307,7 @@ Status SimpleGraphExecutionState::BuildGraph( optimization_options.session_options = session_options_; optimization_options.graph = &ng; optimization_options.flib_def = flib.get(); + optimization_options.device_set = device_set_; optimization_options.cost_model = &costs; TF_RETURN_IF_ERROR(OptimizationPassRegistry::Global()->RunGrouping( -- GitLab From c216f0ce8622535d6c2dd481709a372d62f29296 Mon Sep 17 00:00:00 2001 From: Derek Murray Date: Mon, 27 Feb 2017 11:10:11 -0800 Subject: [PATCH 005/101] Measure feed/fetch overhead on CPU only, to focus on Session-related overhead. Change: 148669949 --- tensorflow/core/common_runtime/direct_session_test.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tensorflow/core/common_runtime/direct_session_test.cc b/tensorflow/core/common_runtime/direct_session_test.cc index 2336eb7b08..9e717dfc23 100644 --- a/tensorflow/core/common_runtime/direct_session_test.cc +++ b/tensorflow/core/common_runtime/direct_session_test.cc @@ -1169,15 +1169,21 @@ void FeedFetchBenchmarkHelper(int num_feeds, int iters) { Graph g(OpRegistry::Global()); for (int i = 0; i < num_feeds; ++i) { + // NOTE(mrry): We pin nodes to the "/cpu:0" device, so as not to + // measure CPU<->GPU copying overhead. We should also optimize and + // monitor this overhead where possible, but that is not the + // object of study in this benchmark. Node* placeholder; TF_CHECK_OK(NodeBuilder(g.NewName("Placeholder"), "PlaceholderV2") .Attr("shape", TensorShape()) .Attr("dtype", DT_FLOAT) + .Device("/cpu:0") .Finalize(&g, &placeholder)); Node* identity; TF_CHECK_OK(NodeBuilder(g.NewName("Identity"), "Identity") .Input(placeholder) .Attr("T", DT_FLOAT) + .Device("/cpu:0") .Finalize(&g, &identity)); inputs.push_back({placeholder->name() + ":0", value}); outputs.push_back(identity->name() + ":0"); -- GitLab From b4d091d5a372f97af48192cb431985b20b447158 Mon Sep 17 00:00:00 2001 From: Peter Hawkins Date: Mon, 27 Feb 2017 11:16:08 -0800 Subject: [PATCH 006/101] [TF:XLA] Silence a number of compiler warnings, in particular warnings repeatedly issued by code in headers. Fixes #7919 Change: 148670735 --- tensorflow/compiler/xla/literal_util.h | 2 +- tensorflow/compiler/xla/service/backend.h | 2 +- .../xla/service/gpu/convolution_thunk.cc | 1 + .../compiler/xla/service/hlo_computation.h | 2 +- .../compiler/xla/service/hlo_instruction.cc | 19 ------------- .../compiler/xla/service/hlo_ordering.h | 28 +++++++++---------- .../compiler/xla/service/llvm_ir/llvm_loop.h | 26 ++++++++--------- .../compiler/xla/service/logical_buffer.h | 14 ---------- tensorflow/stream_executor/dnn.cc | 1 + 9 files changed, 32 insertions(+), 63 deletions(-) diff --git a/tensorflow/compiler/xla/literal_util.h b/tensorflow/compiler/xla/literal_util.h index 0f291fde34..80470f1586 100644 --- a/tensorflow/compiler/xla/literal_util.h +++ b/tensorflow/compiler/xla/literal_util.h @@ -814,7 +814,7 @@ template *literal->mutable_shape() = ShapeUtil::MakeShape(PRED, {static_cast(values.bits())}); Reserve(values.bits(), literal); - for (int64 i = 0; i < values.bits(); ++i) { + for (int64 i = 0; i < static_cast(values.bits()); ++i) { Set(literal, {i}, values.get(i)); } } diff --git a/tensorflow/compiler/xla/service/backend.h b/tensorflow/compiler/xla/service/backend.h index 9461004c4f..4ce3e32031 100644 --- a/tensorflow/compiler/xla/service/backend.h +++ b/tensorflow/compiler/xla/service/backend.h @@ -34,7 +34,7 @@ limitations under the License. #include "tensorflow/core/platform/thread_annotations.h" namespace Eigen { -class ThreadPoolDevice; +struct ThreadPoolDevice; } namespace xla { diff --git a/tensorflow/compiler/xla/service/gpu/convolution_thunk.cc b/tensorflow/compiler/xla/service/gpu/convolution_thunk.cc index 9be221881b..f6b7fe1e8e 100644 --- a/tensorflow/compiler/xla/service/gpu/convolution_thunk.cc +++ b/tensorflow/compiler/xla/service/gpu/convolution_thunk.cc @@ -91,6 +91,7 @@ string ConvolutionKindToString( case ConvolutionThunk::ConvolutionKind::kBackwardInput: return "backward_input"; } + return "unknown convolution kind"; } ConvolutionThunk::ConvolutionThunk( diff --git a/tensorflow/compiler/xla/service/hlo_computation.h b/tensorflow/compiler/xla/service/hlo_computation.h index 1b83cb08fe..0abb592212 100644 --- a/tensorflow/compiler/xla/service/hlo_computation.h +++ b/tensorflow/compiler/xla/service/hlo_computation.h @@ -111,7 +111,7 @@ class HloComputation { // Returns the parameter instruction for the given parameter number. HloInstruction* parameter_instruction(int64 param_no) const { CHECK_GE(param_no, 0); - CHECK_LT(param_no, param_instructions_.size()); + CHECK_LT(param_no, static_cast(param_instructions_.size())); return param_instructions_[param_no]; } diff --git a/tensorflow/compiler/xla/service/hlo_instruction.cc b/tensorflow/compiler/xla/service/hlo_instruction.cc index 9b49ac1a60..b5438865cb 100644 --- a/tensorflow/compiler/xla/service/hlo_instruction.cc +++ b/tensorflow/compiler/xla/service/hlo_instruction.cc @@ -2042,25 +2042,6 @@ HloInstruction::UseKind HloInstruction::OperandElementUse(int64 i) const { } } -namespace { - -// Prereq: `order` is a permutation of {0, 1, ..., `dims.size()-1`} -void Strip1SizedDimensions(tensorflow::protobuf::RepeatedField* dims, - std::vector* order) { - // We can't merely call StripDegenerateDimensions here as we must also delete - // the dimension indices. - for (size_t i = 0; i < dims->size(); ++i) { - if (1 == dims->Get(i)) { - dims->erase(dims->begin() + i); - // We must find this, as order must be a permutation of operand - // dimensions. - order->erase(std::find(order->begin(), order->end(), i)); - } - } -} - -} // namespace - std::tuple, std::vector> HloInstruction::ReshapeMerelyInsertsOrDeletes1SizedDimensions() const { if (HloOpcode::kReshape != opcode_) { diff --git a/tensorflow/compiler/xla/service/hlo_ordering.h b/tensorflow/compiler/xla/service/hlo_ordering.h index 97f7c6060b..55f1fa6e27 100644 --- a/tensorflow/compiler/xla/service/hlo_ordering.h +++ b/tensorflow/compiler/xla/service/hlo_ordering.h @@ -76,13 +76,13 @@ class PredecessorHloOrdering : public HloOrdering { // An HLO ordering based on data dependencies in the HLO graph. In this partial // order, instruction A executes before instruction B only if there is a path // from A to B in the HLO graph. For example, given the following graph: -// -// param -// / \ -// negate exp -// \ / -// add -// +/* + param + / \ + negate exp + \ / + add +*/ // DependencyHloOrdering gives the following executes-before relations: // param executes before negate, exp, and add // negate executes before add @@ -105,13 +105,13 @@ class DependencyHloOrdering : public PredecessorHloOrdering { // The computation total order is a sequencing of all of its instructions in // the computation (eg, {inst0, inst1, inst2,...}) as in single-threaded // execution. For example, given the following HLO graph: -// -// param -// / \ -// negate exp -// \ / -// add -// +/* + param + / \ + negate exp + \ / + add +*/ // and the following sequence: // // {param, negate, exp, add} diff --git a/tensorflow/compiler/xla/service/llvm_ir/llvm_loop.h b/tensorflow/compiler/xla/service/llvm_ir/llvm_loop.h index 0cc82b040d..60ac0444bc 100644 --- a/tensorflow/compiler/xla/service/llvm_ir/llvm_loop.h +++ b/tensorflow/compiler/xla/service/llvm_ir/llvm_loop.h @@ -47,22 +47,22 @@ class ForLoop { // created exit basic block. Instructions before the insert point remain in // the insert BB: // - // /--------------\ /----------------\ + // +--------------+ +----------------+ // | insert BB | | insert BB | // | ... | | (preheader BB) | // | %foo = ... | | ... | // insert point ->| %bar = ... | ===> | %foo = ... | - // | ... | \----------------/ - // \--------------/ | + // | ... | +----------------+ + // +--------------+ | // V // [[ LOOP BBs ]] // | // V - // /--------------\ + // +--------------+ // | exit BB | // | %bar = ... | // | ... | - // \--------------/ + // +--------------+ // // `suffix` is a string used to disambiguate variable and basic block names // emitted in LLVM IR. This string is appended to the name of the induction @@ -82,31 +82,31 @@ class ForLoop { // do_stuff(i); // } // - // /--------------\ + // +--------------+ // | preheader BB | // | i = 0 | - // \--------------/ + // +--------------+ // | // V - // /-------------\ + // +-------------+ // | header BB |<-+ // | if i < n: | | // | goto body | | // | else: | | // | goto exit | | - // \-------------/ | + // +-------------+ | // | | | // +--------+ | | // | V | - // | /-------------\ | + // | +-------------+ | // | | body BB | | // | | dostuff(i) |--+ // | | ++i | - // | \-------------/ + // | +-------------+ // | - // | /-------------\ + // | +-------------+ // +->| exit BB | - // \-------------/ + // +-------------+ // // Caller-emitted code to execute within the loop should be placed within the // "body" basic block. diff --git a/tensorflow/compiler/xla/service/logical_buffer.h b/tensorflow/compiler/xla/service/logical_buffer.h index a87c00e12b..d985db4a18 100644 --- a/tensorflow/compiler/xla/service/logical_buffer.h +++ b/tensorflow/compiler/xla/service/logical_buffer.h @@ -30,8 +30,6 @@ limitations under the License. namespace xla { -struct HashLogicalBuffer; - // Class describing a contiguous sequence of elements (ie, C array) which form // the components of Shaped values in XLA. XLA arrays are trivially a // single LogicalBuffer. Tuple values are made up of more than one @@ -129,7 +127,6 @@ class LogicalBuffer { string ToString() const; private: - friend struct HashLogicalBuffer; HloInstruction* instruction_; ShapeIndex index_; Id id_; @@ -139,17 +136,6 @@ class LogicalBuffer { TF_DISALLOW_COPY_AND_ASSIGN(LogicalBuffer); }; -struct HashLogicalBuffer { - size_t operator()(const LogicalBuffer& b) const { - std::hash hasher; - size_t h = hasher(b.instruction_); - for (int i = 0; i < b.index_.size(); i++) { - h += static_cast(b.index_[i] << i); - } - return h; - } -}; - std::ostream& operator<<(std::ostream& out, const LogicalBuffer& buffer); } // namespace xla diff --git a/tensorflow/stream_executor/dnn.cc b/tensorflow/stream_executor/dnn.cc index e815a3bf74..943673ae35 100644 --- a/tensorflow/stream_executor/dnn.cc +++ b/tensorflow/stream_executor/dnn.cc @@ -123,6 +123,7 @@ string PadAlignmentString(PadAlignment alignment) { case PadAlignment::kTensorFlowPadding: return "TensorFlow padding"; } + return "unknown pad alignment"; } string ShortPoolingModeString(PoolingMode mode) { -- GitLab From 332ee5051fc38babb53cc8cbf3c3120e5651f4e8 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 27 Feb 2017 11:23:32 -0800 Subject: [PATCH 007/101] [XLA] Set layout of fused instructions in `ReshapeMover` Change: 148671742 --- .../compiler/xla/service/reshape_mover.cc | 5 ++-- .../xla/service/reshape_mover_test.cc | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/tensorflow/compiler/xla/service/reshape_mover.cc b/tensorflow/compiler/xla/service/reshape_mover.cc index 0ff03e90e4..12bb8885cd 100644 --- a/tensorflow/compiler/xla/service/reshape_mover.cc +++ b/tensorflow/compiler/xla/service/reshape_mover.cc @@ -74,8 +74,9 @@ bool TrySinkReshapeOrTranspose(HloComputation* computation, // implicit broadcast as if it were the operands would not be equivalent // reshapes, so all the fused instructions have the same dimensions. for (const auto& fused_instruction : instruction->fused_instructions()) { - *fused_instruction->mutable_shape()->mutable_dimensions() = - operands[0]->shape().dimensions(); + Shape* shape = fused_instruction->mutable_shape(); + *shape->mutable_dimensions() = operands[0]->shape().dimensions(); + *shape->mutable_layout() = operands[0]->shape().layout(); } } auto new_elementwise = diff --git a/tensorflow/compiler/xla/service/reshape_mover_test.cc b/tensorflow/compiler/xla/service/reshape_mover_test.cc index 850295c726..5028300ecf 100644 --- a/tensorflow/compiler/xla/service/reshape_mover_test.cc +++ b/tensorflow/compiler/xla/service/reshape_mover_test.cc @@ -53,5 +53,30 @@ TEST_F(ReshapeMoverTest, ReshapesWithNonSameInputShapesNotMoved) { EXPECT_EQ(add4, computation->root_instruction()); } +TEST_F(ReshapeMoverTest, EquivalentReshapesMovedAcrossFusion) { + auto root_shape = ShapeUtil::MakeShape(F32, {8, 7}); + HloComputation::Builder builder(TestName()); + auto param0 = builder.AddInstruction(HloInstruction::CreateParameter( + 0, ShapeUtil::MakeShape(F32, {1, 8, 1, 7}), "param0")); + auto param1 = builder.AddInstruction(HloInstruction::CreateParameter( + 1, ShapeUtil::MakeShape(F32, {1, 8, 1, 7}), "param0")); + auto reshape2 = + builder.AddInstruction(HloInstruction::CreateReshape(root_shape, param0)); + auto reshape3 = + builder.AddInstruction(HloInstruction::CreateReshape(root_shape, param1)); + auto add4 = builder.AddInstruction(HloInstruction::CreateBinary( + root_shape, HloOpcode::kAdd, reshape2, reshape3)); + + auto module = MakeUnique(TestName()); + auto computation = module->AddEntryComputation(builder.Build()); + auto fusion = computation->AddInstruction(HloInstruction::CreateFusion( + add4->shape(), HloInstruction::FusionKind::kLoop, add4)); + TF_CHECK_OK(computation->ReplaceInstruction(add4, fusion)); + EXPECT_EQ(fusion, computation->root_instruction()); + EXPECT_TRUE(ReshapeMover().Run(module.get()).ValueOrDie()); + EXPECT_NE(fusion, computation->root_instruction()); + EXPECT_EQ(HloOpcode::kReshape, computation->root_instruction()->opcode()); +} + } // namespace } // namespace xla -- GitLab From db8ea4ff07ad75cf5f0220428fbe4b84fcf68f4a Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 27 Feb 2017 11:32:44 -0800 Subject: [PATCH 008/101] - Upgraded libxsmm to 1.7.1. - Applied LLVM optimization patch to libxsmm (https://github.com/hfp/libxsmm/commit/0e412d5d2769a8754cace64e56e26e14093f887d.patch). - Limited outstanding libxsmm sparse matrix multiply handle counts to limit memory usage for temporary space. - Added extra logging to libxsmm handle management in TensorFlow. - Added support for running multiple sparse matrix multiplies simultaneously in performance benchmark to match some practical use cases. - Added more size combinations to sparse matrix multiply benchmark. - Fixed dependencies for xsmm_conv2d_test. Change: 148672973 --- tensorflow/core/kernels/BUILD | 7 +- tensorflow/core/kernels/sparse_matmul_op.cc | 250 ++++++++++++++---- .../core/kernels/sparse_matmul_op_test.cc | 105 +++++++- tensorflow/workspace.bzl | 8 +- 4 files changed, 299 insertions(+), 71 deletions(-) diff --git a/tensorflow/core/kernels/BUILD b/tensorflow/core/kernels/BUILD index a99945353a..d2ffc99383 100644 --- a/tensorflow/core/kernels/BUILD +++ b/tensorflow/core/kernels/BUILD @@ -794,7 +794,12 @@ tf_cc_test( "//tensorflow/core:test", "//tensorflow/core:test_main", "//tensorflow/core:testlib", - ], + ] + select({ + ":xsmm": [ + "@libxsmm_archive//:xsmm_avx", + ], + "//conditions:default": [], + }), ) tf_cc_test( diff --git a/tensorflow/core/kernels/sparse_matmul_op.cc b/tensorflow/core/kernels/sparse_matmul_op.cc index a9ea7261cc..06734a6a2a 100644 --- a/tensorflow/core/kernels/sparse_matmul_op.cc +++ b/tensorflow/core/kernels/sparse_matmul_op.cc @@ -837,6 +837,15 @@ class SparseMatMul { }; #ifdef TENSORFLOW_USE_LIBXSMM +#ifdef EXTRA_CACHE_LOGGING +static tensorflow::mutex global_cache_stats_lock; +static int total_num_entries_outstanding GUARDED_BY(global_cache_stats_lock) = + 0; +static int total_num_entries_in_cache GUARDED_BY(global_cache_stats_lock) = 0; +#endif // EXTRA_CACHE_LOGGING + +static const int max_entries_per_graph_node = 40; + template class LibxsmmSparseMatMul { typedef Eigen::Tensor MatrixL; @@ -852,6 +861,7 @@ class LibxsmmSparseMatMul { MatrixMapR; public: +#if 1 // This structure contains a set of libxsmm kernels for sizes that have been // encountered previously by this operator so that libxsmm does not need to // reallocate its scratchpad memory each time (which hurts performance @@ -870,57 +880,181 @@ class LibxsmmSparseMatMul { // useful (it is an empty struct right now) typename SparseMatMul::TensorInfoCache non_libxsmm_cache; // Currently not used + TF_DISALLOW_COPY_AND_ASSIGN(TensorInfoCacheEntry); + ~TensorInfoCacheEntry() { +#ifdef EXTRA_CACHE_LOGGING + LOG(INFO) << "Deleting tensor cache entry at " << (void*)this; +#endif // EXTRA_CACHE_LOGGING + libxsmm_spmdm_destroy(&handle); + } }; - // protects entries; invariant: entries is a valid std::multimap + // protects entries; invariant: entries is a valid std::list. tensorflow::mutex lock; // Because there could be multiple matrix multiplies with the same sizes // going on at the same time, we need to allow multiple cache entries for a // given set of parameters. Taking and returning entries is used to make // sure the same cache entry is not used from two threads at a time. - std::multimap, - std::unique_ptr> - entries GUARDED_BY(lock); - - TensorInfoCache() : lock(), entries() {} + using entries_map_type = std::list, + std::unique_ptr>>; // multimap in LRU order + entries_map_type entries GUARDED_BY( + lock); // MRU element at end so reverse search will find it first + int num_entries_outstanding GUARDED_BY(lock); + + TensorInfoCache() : lock(), entries(), num_entries_outstanding(0) {} // Look up and remove first entry with these parameters, creating one if // there isn't one std::unique_ptr take_cache_entry(int M, int K, int N, int max_threads) - LOCKS_EXCLUDED(lock) { +#ifdef EXTRA_CACHE_LOGGING + LOCKS_EXCLUDED(lock, global_cache_stats_lock) +#else + LOCKS_EXCLUDED(lock) +#endif + { tensorflow::mutex_lock ml(lock); +#ifdef EXTRA_CACHE_LOGGING + tensorflow::mutex_lock ml2(global_cache_stats_lock); +#endif auto key = std::make_tuple(M, K, N, max_threads); - auto it = entries.find(key); + auto it_rev = + std::find_if(entries.rbegin(), entries.rend(), + [&](const typename entries_map_type::value_type& e) { + return e.first == key; + }); + auto it = + (it_rev == entries.rend() ? entries.end() : std::next(it_rev).base()); if (it != entries.end()) { auto val = std::move(it->second); entries.erase(it); + ++num_entries_outstanding; +#ifdef EXTRA_CACHE_LOGGING + ++total_num_entries_outstanding; + --total_num_entries_in_cache; + LOG(INFO) << "Used existing cache entry at " << (void*)val.get() + << " for " << M << "x" << K << "x" << N << " max_threads " + << max_threads + << ", num_entries_outstanding = " << num_entries_outstanding + << ", new cache size = " << entries.size() + << ", total num_entries_outstanding = " + << total_num_entries_outstanding + << ", total cache size = " << total_num_entries_in_cache; +#endif return val; } else { + while (!entries.empty() && + entries.size() + num_entries_outstanding + 1 > + max_entries_per_graph_node) { +#ifdef EXTRA_CACHE_LOGGING + LOG(INFO) << "Removing old cache entry at " + << (void*)entries.front().second.get(); +#endif + entries.pop_front(); + } std::unique_ptr e{ new TensorInfoCacheEntry{M, K, N, max_threads, {}, nullptr}}; // setup scoped allocator, which uses cpu_allocator() for this scope const libxsmm_tf_allocator tf_allocator; libxsmm_spmdm_init(M, N, K, max_threads, &e->handle, &e->output_csr); + ++num_entries_outstanding; +#ifdef EXTRA_CACHE_LOGGING + ++total_num_entries_outstanding; + LOG(INFO) << "Created cache entry at " << (void*)e.get() << " for " << M + << "x" << K << "x" << N << " max_threads " << max_threads + << ", num_entries_outstanding = " << num_entries_outstanding + << ", new cache size = " << entries.size() + << ", total num_entries_outstanding = " + << total_num_entries_outstanding + << ", total cache size = " << total_num_entries_in_cache; +#endif return e; } } // Add a cache entry with certain parameters void return_cache_entry(std::unique_ptr e) - LOCKS_EXCLUDED(lock) { +#ifdef EXTRA_CACHE_LOGGING + LOCKS_EXCLUDED(lock, global_cache_stats_lock) +#else + LOCKS_EXCLUDED(lock) +#endif + { tensorflow::mutex_lock ml(lock); +#ifdef EXTRA_CACHE_LOGGING + tensorflow::mutex_lock ml2(global_cache_stats_lock); +#endif auto key = std::make_tuple(e->M, e->K, e->N, e->max_threads); - entries.insert(std::make_pair(key, std::move(e))); + --num_entries_outstanding; +#ifdef EXTRA_CACHE_LOGGING + --total_num_entries_outstanding; + LOG(INFO) << "Returned cache entry at " << (void*)e.get() << " for " + << e->M << "x" << e->K << "x" << e->N << " max_threads " + << e->max_threads + << ", num_entries_outstanding = " << num_entries_outstanding + << ", prev cache size = " << entries.size() + << ", total num_entries_outstanding = " + << total_num_entries_outstanding + << ", total cache size = " << total_num_entries_in_cache; +#endif + entries.push_back(std::make_pair(key, std::move(e))); +#ifdef EXTRA_CACHE_LOGGING + ++total_num_entries_in_cache; +#endif } ~TensorInfoCache() { tensorflow::mutex_lock ml(lock); - for (auto& p : entries) { - libxsmm_spmdm_destroy(&p.second->handle); - } +#ifdef EXTRA_CACHE_LOGGING + tensorflow::mutex_lock ml2(global_cache_stats_lock); + LOG(INFO) << "Deleting TensorInfoCache, cache size = " << entries.size() + << ", total num_entries_outstanding = " + << total_num_entries_outstanding + << ", total cache size = " << total_num_entries_in_cache; +#endif + CHECK_EQ(num_entries_outstanding, 0); entries.clear(); } private: TF_DISALLOW_COPY_AND_ASSIGN(TensorInfoCache); }; +#else + // This structure contains a set of libxsmm kernels for sizes that have been + // encountered previously by this operator so that libxsmm does not need to + // reallocate its scratchpad memory each time (which hurts performance + // substantially). + struct TensorInfoCache { + struct TensorInfoCacheEntry { + // Parameters for kernel + int M; + int K; + int N; + int max_threads; + // libxsmm handle and matrix data + libxsmm_spmdm_handle handle; + libxsmm_CSR_sparseslice* output_csr; + // Chain to non-libxsmm implementation's cache in case that ever becomes + // useful (it is an empty struct right now) + typename SparseMatMul::TensorInfoCache + non_libxsmm_cache; // Currently not used + }; + TensorInfoCache() {} + // Look up and remove first entry with these parameters, creating one if + // there isn't one + std::unique_ptr take_cache_entry(int M, int K, int N, + int max_threads) { + std::unique_ptr e{ + new TensorInfoCacheEntry{M, K, N, max_threads, {}, nullptr}}; + libxsmm_spmdm_init(M, N, K, max_threads, &e->handle, &e->output_csr); + return e; + } + // Add a cache entry with certain parameters + void return_cache_entry(std::unique_ptr e) { + libxsmm_spmdm_destroy(&e->handle); + } + + private: + TF_DISALLOW_COPY_AND_ASSIGN(TensorInfoCache); + }; +#endif // Perform matrix multiplication of "left" and "right", and store the result // in *"output". @@ -1345,21 +1479,21 @@ inline void SparseMatMul::ComputeBlockSizes( template void do_on_all_threads(const DeviceBase::CpuWorkerThreads* thread_pool, - const F& f) { + ptrdiff_t max_thread_count, const F& f) { int num_threads = thread_pool->num_threads; if (num_threads == 0) { LOG(FATAL) << "Have 0 threads in thread pool"; } else if (num_threads == 1) { - f(0); + f(0, 1); } else { BlockingCounter counter(num_threads - 1); for (int i = 1; i < num_threads; ++i) { thread_pool->workers->Schedule([&, i]() { - f(i); + f(i, num_threads); counter.DecrementCount(); }); } - f(0); + f(0, num_threads); counter.Wait(); } } @@ -1453,11 +1587,13 @@ inline void LibxsmmSparseMatMul::Compute( const int left_dim1 = transpose_left ? left.dimension(0) : left.dimension(1); const int right_dim0 = right.dimension(0); const int right_dim1 = right.dimension(1); + const int output_dim0 = + transpose_output ? output->dimension(1) : output->dimension(0); + const int output_dim1 = + transpose_output ? output->dimension(0) : output->dimension(1); CHECK_EQ(left_dim1, right_dim0); - CHECK_EQ(left_dim0, - (transpose_output ? output->dimension(1) : output->dimension(0))); - CHECK_EQ(right_dim1, - (transpose_output ? output->dimension(0) : output->dimension(1))); + CHECK_EQ(left_dim0, output_dim0); + CHECK_EQ(right_dim1, output_dim1); if (left_dim0 < 32 || left_dim1 < 32 || right_dim1 < 32) { // Causes problems in libxsmm SparseMatMul::Compute( @@ -1475,42 +1611,52 @@ inline void LibxsmmSparseMatMul::Compute( // Convert the left matrix to compressed sparse row (CSR) format ptrdiff_t total_num_creation_blocks = libxsmm_spmdm_get_num_createSparseSlice_blocks(&entry->handle); + ptrdiff_t total_num_mult_blocks = + libxsmm_spmdm_get_num_compute_blocks(&entry->handle); + bool use_libxsmm = + !(total_num_creation_blocks + total_num_mult_blocks < num_threads && + !transpose_left && !transpose_output); + if (!use_libxsmm) { + // Avoid some performance issues in libxsmm (FIXME) + cache->return_cache_entry(std::move(entry)); + SparseMatMul::Compute( + nullptr /* Assumes no cached data for fallback */, left, right, + transpose_left, thread_pool, transpose_output, output); + return; + } std::atomic cur_create_block_number; cur_create_block_number.store(0); - do_on_all_threads(thread_pool, [&](int i) { - PinnedToCurrentCPU pin; - while (true) { - int work_item = cur_create_block_number.fetch_add(1); - if (work_item >= total_num_creation_blocks) break; - wrapper_libxsmm_spmdm_createSparseSlice_generic_thread( - empty_type_wrapper{}, &entry->handle, - (transpose_left ? 'Y' : 'N'), left_data, entry->output_csr, work_item, - i, num_threads); - } - }); + do_on_all_threads(thread_pool, total_num_creation_blocks, + [&](int i, int actual_num_threads) { + PinnedToCurrentCPU pin; + while (true) { + int work_item = cur_create_block_number.fetch_add(1); + if (work_item >= total_num_creation_blocks) break; + wrapper_libxsmm_spmdm_createSparseSlice_generic_thread( + empty_type_wrapper{}, &entry->handle, + (transpose_left ? 'T' : 'N'), left_data, + entry->output_csr, work_item, i, + actual_num_threads); + } + }); // Do matrix-matrix multiplication - // TODO(jewillco): libxsmm doesn't support beta != 1 yet -- remove when - // release - // includes beta handling - memset(output_data, 0, left_dim0 * right_dim1 * sizeof(TR)); - ptrdiff_t total_num_mult_blocks = - libxsmm_spmdm_get_num_compute_blocks(&entry->handle); std::atomic cur_mult_block_number; cur_mult_block_number.store(0); - do_on_all_threads(thread_pool, [&](int i) { - PinnedToCurrentCPU pin; - while (true) { - int work_item = cur_mult_block_number.fetch_add(1); - if (work_item >= total_num_mult_blocks) break; - const TL alpha(1.0); // Stored in a variable so we can get a pointer - const TL beta(0.0); // Stored in a variable so we can get a pointer - wrapper_libxsmm_spmdm_compute_generic_thread( - empty_type_wrapper{}, &entry->handle, - (transpose_left ? 'Y' : 'N'), 'N', &alpha, entry->output_csr, - right_data, (transpose_output ? 'Y' : 'N'), &beta, output_data, - work_item, i, num_threads); - } - }); + do_on_all_threads( + thread_pool, total_num_mult_blocks, [&](int i, int actual_num_threads) { + PinnedToCurrentCPU pin; + while (true) { + int work_item = cur_mult_block_number.fetch_add(1); + if (work_item >= total_num_mult_blocks) break; + const TL alpha(1.0); // Stored in a variable so we can get a pointer + const TL beta(0.0); // Stored in a variable so we can get a pointer + wrapper_libxsmm_spmdm_compute_generic_thread( + empty_type_wrapper{}, &entry->handle, + (transpose_left ? 'T' : 'N'), 'N', &alpha, entry->output_csr, + right_data, (transpose_output ? 'T' : 'N'), &beta, output_data, + work_item, i, actual_num_threads); + } + }); // Put handle + CSR storage back into cache cache->return_cache_entry(std::move(entry)); } diff --git a/tensorflow/core/kernels/sparse_matmul_op_test.cc b/tensorflow/core/kernels/sparse_matmul_op_test.cc index 42fdde23dd..b5c69466f8 100644 --- a/tensorflow/core/kernels/sparse_matmul_op_test.cc +++ b/tensorflow/core/kernels/sparse_matmul_op_test.cc @@ -94,6 +94,16 @@ static Graph* SparseMatMul(int m, int n, int d, float sparsity_a, transpose_a, transpose_b); } +static Graph* ReplicatedSparseMatMul(int m, int n, int d, float sparsity_1, + float sparsity_2, int copies) { + Graph* g = new Graph(OpRegistry::Global()); + for (int i = 0; i < copies; ++i) { + SparseMatMulHelper(g, m, n, d, sparsity_1, sparsity_2, false, + false); + } + return g; +} + #define BM_SPARSE(M, K, N, S1, S2, TRA, TRB, TA, TB) \ static void \ BM_Sparse##_##M##_##K##_##N##_##S1##_##S2##_##TRA##_##TRB##_##TA##_##TB( \ @@ -112,6 +122,23 @@ static Graph* SparseMatMul(int m, int n, int d, float sparsity_a, BENCHMARK( \ BM_Sparse##_##M##_##K##_##N##_##S1##_##S2##_##TRA##_##TRB##_##TA##_##TB); +#define BM_SPARSE_REPLICATED(M, K, N, S1, S2, Copies) \ + static void BM_Sparse_replicated##_##M##_##K##_##N##_##S1##_##S2##_##Copies( \ + int iters) { \ + testing::StopTiming(); \ + testing::ItemsProcessed(static_cast(iters) * M * K * N * Copies * \ + 2); \ + std::string label = strings::Printf("copies: %d sp_a: %0.2f sp_b: %0.2f", \ + (Copies), S1 / 100.0, S2 / 100.0); \ + testing::SetLabel(label); \ + testing::UseRealTime(); \ + auto g = \ + ReplicatedSparseMatMul(M, N, K, S1 / 100.0, S2 / 100.0, (Copies)); \ + testing::StartTiming(); \ + test::Benchmark("cpu", g).Run(iters); \ + } \ + BENCHMARK(BM_Sparse_replicated##_##M##_##K##_##N##_##S1##_##S2##_##Copies); + #define BM_SPARSE_FLOAT(M, K, N, S1, S2, TRA, TRB) \ BM_SPARSE(M, K, N, S1, S2, TRA, TRB, float, float) #define BM_SPARSE_BFLOAT16(M, K, N, S1, S2, TRA, TRB) \ @@ -144,6 +171,33 @@ BM_SPARSE_FLOAT(1024, 1024, 1024, 1, 0, false, false); BM_SPARSE_FLOAT(1024, 1024, 1024, 85, 0, false, false); BM_SPARSE_FLOAT(256, 256, 256, 1, 0, false, false); BM_SPARSE_FLOAT(512, 512, 512, 1, 0, false, false); +BM_SPARSE_FLOAT(2560, 400, 1024, 85, 0, false, false); +BM_SPARSE_FLOAT(2560, 400, 1024, 85, 0, true, false); + +BM_SPARSE_FLOAT(400, 800, 2560, 85, 0, false, false); +BM_SPARSE_FLOAT(400, 2560, 1024, 85, 0, false, false); +BM_SPARSE_FLOAT(400, 1024, 256, 85, 0, false, false); +BM_SPARSE_FLOAT(400, 256, 1, 85, 0, false, false); + +BM_SPARSE_REPLICATED(400, 800, 2560, 85, 0, 6); +BM_SPARSE_REPLICATED(400, 2560, 1024, 85, 0, 6); +BM_SPARSE_REPLICATED(400, 1024, 256, 85, 0, 6); +BM_SPARSE_REPLICATED(400, 256, 1, 85, 0, 6); + +BM_SPARSE_FLOAT(2048, 1792, 1024, 85, 0, false, false); +BM_SPARSE_FLOAT(2048, 1024, 768, 85, 0, false, false); +BM_SPARSE_FLOAT(2048, 768, 512, 85, 0, false, false); +BM_SPARSE_FLOAT(2048, 512, 256, 85, 0, false, false); + +BM_SPARSE_FLOAT(2049, 1792, 1024, 85, 0, false, false); +BM_SPARSE_FLOAT(2049, 1024, 768, 85, 0, false, false); +BM_SPARSE_FLOAT(2049, 768, 512, 85, 0, false, false); +BM_SPARSE_FLOAT(2049, 512, 256, 85, 0, false, false); + +BM_SPARSE_REPLICATED(2048, 1792, 1024, 85, 0, 6); +BM_SPARSE_REPLICATED(2048, 1024, 768, 85, 0, 6); +BM_SPARSE_REPLICATED(2048, 768, 512, 85, 0, 6); +BM_SPARSE_REPLICATED(2048, 512, 256, 85, 0, 6); // Test bfloat16 BM_SPARSE_BFLOAT16(2048, 2048, 2048, 0, 0, false, false); @@ -156,30 +210,53 @@ BM_SPARSE_FLOAT_BFLOAT16(2048, 2048, 2048, 85, 0, false, false); BM_SPARSE_FLOAT_BFLOAT16(2048, 2048, 2048, 99, 0, false, false); static Graph* MultiSparseMatMul(int m, int n, int d, float sparsity_1, - float sparsity_2) { + float sparsity_2, int copies) { Graph* g = new Graph(OpRegistry::Global()); - SparseMatMulHelper(g, d, n, m, sparsity_1, sparsity_2, true, - false); - SparseMatMulHelper(g, m, d, n, sparsity_2, 0, false, true); + for (int i = 0; i < copies; ++i) { + SparseMatMulHelper(g, d, n, m, sparsity_1, sparsity_2, true, + false); + SparseMatMulHelper(g, m, d, n, sparsity_2, 0, false, true); + } return g; } -#define BM_SPARSE_MULTI(M, K, N, S1, S2) \ - static void BM_Sparse_Multi##_##M##_##K##_##N##_##S1##_##S2(int iters) { \ +#define BM_SPARSE_MULTI(M, K, N, S1, S2, Copies) \ + static void BM_Sparse_Multi##_##M##_##K##_##N##_##S1##_##S2##_##Copies( \ + int iters) { \ testing::StopTiming(); \ - testing::ItemsProcessed(static_cast(iters) * M * K * N * 2 * 3); \ - std::string label = strings::Printf("%d_%d_%d_%0.2f_%0.2f", M, K, N, \ - S1 / 100.0, S2 / 100.0); \ + testing::ItemsProcessed(static_cast(iters) * M * K * N * 2 * 2 * \ + Copies); \ + std::string label = strings::Printf("%d_%d_%d_%d_%0.2f_%0.2f", M, K, N, \ + Copies, S1 / 100.0, S2 / 100.0); \ testing::SetLabel(label); \ testing::UseRealTime(); \ - auto g = MultiSparseMatMul(M, N, K, S1 / 100.0, S2 / 100.0); \ + auto g = MultiSparseMatMul(M, N, K, S1 / 100.0, S2 / 100.0, Copies); \ testing::StartTiming(); \ test::Benchmark("cpu", g).Run(iters); \ } \ - BENCHMARK(BM_Sparse_Multi##_##M##_##K##_##N##_##S1##_##S2); - -BM_SPARSE_MULTI(1024, 2140, 4096, 0, 82); -BM_SPARSE_MULTI(1024, 4096, 2048, 83, 83); + BENCHMARK(BM_Sparse_Multi##_##M##_##K##_##N##_##S1##_##S2##_##Copies); + +BM_SPARSE_MULTI(1024, 2140, 4096, 0, 82, 1); +BM_SPARSE_MULTI(1024, 4096, 2048, 83, 83, 1); +BM_SPARSE_MULTI(400, 800, 2560, 85, 85, 1); +BM_SPARSE_MULTI(400, 2560, 1024, 85, 85, 1); +BM_SPARSE_MULTI(400, 1024, 256, 85, 85, 1); +BM_SPARSE_MULTI(400, 256, 1, 85, 85, 1); + +BM_SPARSE_MULTI(2048, 1792, 1024, 85, 85, 1); +BM_SPARSE_MULTI(2048, 1024, 768, 85, 85, 1); +BM_SPARSE_MULTI(2048, 768, 512, 85, 85, 1); +BM_SPARSE_MULTI(2048, 512, 256, 85, 85, 1); + +BM_SPARSE_MULTI(2048, 1792, 1024, 85, 85, 3); +BM_SPARSE_MULTI(2048, 1024, 768, 85, 85, 3); +BM_SPARSE_MULTI(2048, 768, 512, 85, 85, 3); +BM_SPARSE_MULTI(2048, 512, 256, 85, 85, 3); + +BM_SPARSE_MULTI(2048, 1792, 1024, 85, 85, 6); +BM_SPARSE_MULTI(2048, 1024, 768, 85, 85, 6); +BM_SPARSE_MULTI(2048, 768, 512, 85, 85, 6); +BM_SPARSE_MULTI(2048, 512, 256, 85, 85, 6); } // end namespace tensorflow diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl index 743d2dcdbe..3a20befef8 100644 --- a/tensorflow/workspace.bzl +++ b/tensorflow/workspace.bzl @@ -84,11 +84,11 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""): native.new_http_archive( name = "libxsmm_archive", urls = [ - "http://bazel-mirror.storage.googleapis.com/github.com/hfp/libxsmm/archive/1.7.tar.gz", - "https://github.com/hfp/libxsmm/archive/1.7.tar.gz", + "http://bazel-mirror.storage.googleapis.com/github.com/hfp/libxsmm/archive/1.7.1.tar.gz", + "https://github.com/hfp/libxsmm/archive/1.7.1.tar.gz", ], - sha256 = "2eea65624a697e74b939511cd2a686b4c957e90c99be168fe134d96771e811ad", - strip_prefix = "libxsmm-1.7", + sha256 = "9d3f63ce3eed62f04e4036de6f2be2ce0ff07781ca571af6e0bf85b077edf17a", + strip_prefix = "libxsmm-1.7.1", build_file = str(Label("//third_party:libxsmm.BUILD")), ) -- GitLab From 746dc3b49df98b9f3f52db6679d633752327df7e Mon Sep 17 00:00:00 2001 From: Peter Hawkins Date: Mon, 27 Feb 2017 11:36:50 -0800 Subject: [PATCH 009/101] [TF:XLA] Refactor build targets in //tensorflow/compiler/jit, split ops into more traditional ops/ and kernels/ directories. No functional changes. Change: 148673534 --- tensorflow/BUILD | 2 + tensorflow/compiler/jit/BUILD | 55 +++----------- .../compiler/jit/build_xla_launch_ops_pass.cc | 2 +- tensorflow/compiler/jit/kernels/BUILD | 74 +++++++++++++++++++ .../jit/{ => kernels}/parallel_check_op.cc | 10 --- .../jit/{ => kernels}/xla_device_launch_op.cc | 13 ++-- .../jit/{ => kernels}/xla_device_launch_op.h | 6 +- .../jit/{ => kernels}/xla_local_launch_op.cc | 35 +++------ .../jit/{ => kernels}/xla_local_launch_op.h | 6 +- tensorflow/compiler/jit/ops/BUILD | 45 +++++++++++ .../compiler/jit/ops/parallel_check_op.cc | 30 ++++++++ tensorflow/compiler/jit/ops/xla_ops.cc | 35 +++++++++ tensorflow/compiler/jit/xla_cpu_device.cc | 1 + tensorflow/compiler/jit/xla_device.cc | 1 - tensorflow/compiler/jit/xla_device_ops.h | 1 - tensorflow/compiler/jit/xla_gpu_device.cc | 1 + 16 files changed, 221 insertions(+), 96 deletions(-) create mode 100644 tensorflow/compiler/jit/kernels/BUILD rename tensorflow/compiler/jit/{ => kernels}/parallel_check_op.cc (95%) rename tensorflow/compiler/jit/{ => kernels}/xla_device_launch_op.cc (96%) rename tensorflow/compiler/jit/{ => kernels}/xla_device_launch_op.h (90%) rename tensorflow/compiler/jit/{ => kernels}/xla_local_launch_op.cc (92%) rename tensorflow/compiler/jit/{ => kernels}/xla_local_launch_op.h (91%) create mode 100644 tensorflow/compiler/jit/ops/BUILD create mode 100644 tensorflow/compiler/jit/ops/parallel_check_op.cc create mode 100644 tensorflow/compiler/jit/ops/xla_ops.cc diff --git a/tensorflow/BUILD b/tensorflow/BUILD index cf988da14b..755bf679d3 100644 --- a/tensorflow/BUILD +++ b/tensorflow/BUILD @@ -139,7 +139,9 @@ filegroup( "//tensorflow/compiler/aot/tests:all_files", "//tensorflow/compiler/jit:all_files", "//tensorflow/compiler/jit/graphcycles:all_files", + "//tensorflow/compiler/jit/kernels:all_files", "//tensorflow/compiler/jit/legacy_flags:all_files", + "//tensorflow/compiler/jit/ops:all_files", "//tensorflow/compiler/tests:all_files", "//tensorflow/compiler/tf2xla:all_files", "//tensorflow/compiler/tf2xla/kernels:all_files", diff --git a/tensorflow/compiler/jit/BUILD b/tensorflow/compiler/jit/BUILD index 1a541df96d..2013c5e7f0 100644 --- a/tensorflow/compiler/jit/BUILD +++ b/tensorflow/compiler/jit/BUILD @@ -38,7 +38,7 @@ cc_library( visibility = [":friends"], deps = [ ":jit_compilation_passes", - ":xla_local_launch_op", + "//tensorflow/compiler/jit/kernels:xla_local_launch_op", "//tensorflow/compiler/tf2xla/kernels:xla_ops", "//tensorflow/compiler/xla/service:cpu_plugin", ], @@ -50,7 +50,7 @@ cc_library( visibility = [":friends"], deps = [ ":jit_compilation_passes", - ":xla_local_launch_op", + "//tensorflow/compiler/jit/kernels:xla_local_launch_op", "//tensorflow/compiler/tf2xla/kernels:xla_ops", "//tensorflow/compiler/xla/service:gpu_plugin", ], @@ -64,7 +64,9 @@ cc_library( deps = [ ":jit_compilation_passes", ":xla_device", + "//tensorflow/compiler/jit/kernels:xla_device_launch_op", "//tensorflow/compiler/tf2xla:xla_compiler", + "//tensorflow/compiler/tf2xla/kernels:xla_ops", "//tensorflow/compiler/xla/service:cpu_plugin", "//tensorflow/core:core_cpu_internal", "//tensorflow/core:lib", @@ -79,7 +81,9 @@ cc_library( deps = [ ":jit_compilation_passes", ":xla_device", + "//tensorflow/compiler/jit/kernels:xla_device_launch_op", "//tensorflow/compiler/tf2xla:xla_compiler", + "//tensorflow/compiler/tf2xla/kernels:xla_ops", "//tensorflow/compiler/xla/service:gpu_plugin", "//tensorflow/core:core_cpu_internal", "//tensorflow/core:lib", @@ -105,20 +109,17 @@ cc_library( srcs = [ "xla_device.cc", "xla_device_context.cc", - "xla_device_launch_op.cc", "xla_device_ops.cc", ], hdrs = [ "xla_device.h", "xla_device_context.h", - "xla_device_launch_op.h", "xla_device_ops.h", ], deps = [ ":common", ":jit_compilation_passes", - ":xla_compilation_cache", - ":xla_local_launch_op", + "//tensorflow/compiler/jit/ops:xla_ops", "//tensorflow/compiler/tf2xla:common", "//tensorflow/compiler/tf2xla:dump_graph", "//tensorflow/compiler/tf2xla:xla_compiler", @@ -142,7 +143,6 @@ cc_library( "//tensorflow/core/kernels:sendrecv_ops", "//tensorflow/core/kernels:variable_ops", ], - alwayslink = 1, ) cc_library( @@ -192,11 +192,13 @@ cc_library( ], deps = [ ":common", - ":parallel_check_op", - ":xla_local_launch_op", "//tensorflow/compiler/jit/graphcycles", + "//tensorflow/compiler/jit/kernels:parallel_check_op", + "//tensorflow/compiler/jit/kernels:xla_local_launch_op", "//tensorflow/compiler/jit/legacy_flags:encapsulate_subgraphs_pass_flags", "//tensorflow/compiler/jit/legacy_flags:mark_for_compilation_pass_flags", + "//tensorflow/compiler/jit/ops:parallel_check_op", + "//tensorflow/compiler/jit/ops:xla_ops", "//tensorflow/compiler/tf2xla:const_analysis", "//tensorflow/compiler/tf2xla:dump_graph", "//tensorflow/compiler/tf2xla:xla_compiler", @@ -220,7 +222,6 @@ cc_test( deps = [ ":common", ":compilation_passes", - ":xla_local_launch_op", "//tensorflow/cc:cc_ops", "//tensorflow/cc:cc_ops_internal", "//tensorflow/cc:function_ops", @@ -236,40 +237,6 @@ cc_test( ], ) -cc_library( - name = "xla_local_launch_op", - srcs = ["xla_local_launch_op.cc"], - hdrs = ["xla_local_launch_op.h"], - deps = [ - ":common", - ":xla_compilation_cache", - "//tensorflow/compiler/tf2xla:xla_compiler", - "//tensorflow/compiler/tf2xla:xla_local_runtime_context", - "//tensorflow/compiler/xla:statusor", - "//tensorflow/compiler/xla/client:client_library", - "//tensorflow/compiler/xla/client:local_client", - "//tensorflow/core:core_cpu_internal", - "//tensorflow/core:framework", - "//tensorflow/core:lib", - "//tensorflow/core:stream_executor_no_cuda", - "//tensorflow/core:tensorflow_opensource", - ], - alwayslink = 1, -) - -tf_kernel_library( - name = "parallel_check_op", - srcs = ["parallel_check_op.cc"], - visibility = [":friends"], - deps = [ - "//tensorflow/compiler/jit/legacy_flags:parallel_check_op_flags", - "//tensorflow/core:core_cpu", - "//tensorflow/core:framework", - "//tensorflow/core:lib", - ], - alwayslink = 1, -) - # ----------------------------------------------------------------------------- filegroup( diff --git a/tensorflow/compiler/jit/build_xla_launch_ops_pass.cc b/tensorflow/compiler/jit/build_xla_launch_ops_pass.cc index 37233b3d9c..abb68f73d7 100644 --- a/tensorflow/compiler/jit/build_xla_launch_ops_pass.cc +++ b/tensorflow/compiler/jit/build_xla_launch_ops_pass.cc @@ -16,8 +16,8 @@ limitations under the License. #include "tensorflow/compiler/jit/build_xla_launch_ops_pass.h" #include "tensorflow/compiler/jit/defs.h" #include "tensorflow/compiler/jit/encapsulate_subgraphs_pass.h" +#include "tensorflow/compiler/jit/kernels/xla_local_launch_op.h" #include "tensorflow/compiler/jit/mark_for_compilation_pass.h" -#include "tensorflow/compiler/jit/xla_local_launch_op.h" #include "tensorflow/compiler/tf2xla/const_analysis.h" #include "tensorflow/compiler/tf2xla/dump_graph.h" #include "tensorflow/compiler/tf2xla/xla_op_registry.h" diff --git a/tensorflow/compiler/jit/kernels/BUILD b/tensorflow/compiler/jit/kernels/BUILD new file mode 100644 index 0000000000..c4116cb8b5 --- /dev/null +++ b/tensorflow/compiler/jit/kernels/BUILD @@ -0,0 +1,74 @@ +licenses(["notice"]) # Apache 2.0 + +package( + default_visibility = [ + "//tensorflow/compiler/tf2xla:internal", + ], +) + +cc_library( + name = "xla_local_launch_op", + srcs = ["xla_local_launch_op.cc"], + hdrs = ["xla_local_launch_op.h"], + deps = [ + "//tensorflow/compiler/jit:common", + "//tensorflow/compiler/jit:xla_compilation_cache", + "//tensorflow/compiler/tf2xla:xla_compiler", + "//tensorflow/compiler/tf2xla:xla_local_runtime_context", + "//tensorflow/compiler/xla:statusor", + "//tensorflow/compiler/xla/client:client_library", + "//tensorflow/compiler/xla/client:local_client", + "//tensorflow/core:core_cpu_internal", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:stream_executor_no_cuda", + "//tensorflow/core:tensorflow_opensource", + ], + alwayslink = 1, +) + +cc_library( + name = "xla_device_launch_op", + srcs = ["xla_device_launch_op.cc"], + hdrs = ["xla_device_launch_op.h"], + deps = [ + "//tensorflow/compiler/jit:common", + "//tensorflow/compiler/jit:xla_compilation_cache", + "//tensorflow/compiler/jit:xla_device", + "//tensorflow/compiler/tf2xla:xla_compiler", + "//tensorflow/compiler/xla:statusor", + "//tensorflow/compiler/xla/client:local_client", + "//tensorflow/core:core_cpu_internal", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:tensorflow_opensource", + "//tensorflow/core/kernels:variable_ops", + ], +) + +cc_library( + name = "parallel_check_op", + srcs = ["parallel_check_op.cc"], + visibility = ["//tensorflow/compiler/jit:friends"], + deps = [ + "//tensorflow/compiler/jit/legacy_flags:parallel_check_op_flags", + "//tensorflow/core:core_cpu", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + ], + alwayslink = 1, +) + +# ----------------------------------------------------------------------------- + +filegroup( + name = "all_files", + srcs = glob( + ["**/*"], + exclude = [ + "**/METADATA", + "**/OWNERS", + ], + ), + visibility = ["//tensorflow:__subpackages__"], +) diff --git a/tensorflow/compiler/jit/parallel_check_op.cc b/tensorflow/compiler/jit/kernels/parallel_check_op.cc similarity index 95% rename from tensorflow/compiler/jit/parallel_check_op.cc rename to tensorflow/compiler/jit/kernels/parallel_check_op.cc index d07da46ca0..c86e03118b 100644 --- a/tensorflow/compiler/jit/parallel_check_op.cc +++ b/tensorflow/compiler/jit/kernels/parallel_check_op.cc @@ -25,16 +25,6 @@ limitations under the License. namespace tensorflow { namespace { -REGISTER_OP("ParallelCheck") - .Attr("T: list(type) >= 0") - .Input("expected: T") - .Input("actual: T") - .Output("result: T") - .Doc(R"doc( -Op that compares two sets of inputs for near-identity, and propagates the first. -Inequality is logged to ERROR log. -)doc"); - // Inputs 2*N tensors, outputs the first N inputs. // Logs errors if input tensor i and i + N are not (near) identical // in any position. diff --git a/tensorflow/compiler/jit/xla_device_launch_op.cc b/tensorflow/compiler/jit/kernels/xla_device_launch_op.cc similarity index 96% rename from tensorflow/compiler/jit/xla_device_launch_op.cc rename to tensorflow/compiler/jit/kernels/xla_device_launch_op.cc index c2a0b29910..a70a7921e6 100644 --- a/tensorflow/compiler/jit/xla_device_launch_op.cc +++ b/tensorflow/compiler/jit/kernels/xla_device_launch_op.cc @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ -#include "tensorflow/compiler/jit/xla_device_launch_op.h" +#include "tensorflow/compiler/jit/kernels/xla_device_launch_op.h" #include "tensorflow/compiler/jit/defs.h" #include "tensorflow/compiler/jit/xla_compilation_cache.h" @@ -97,12 +97,11 @@ void XlaDeviceLaunchOp::Compute(OpKernelContext* ctx) { OP_REQUIRES(ctx, rm, errors::Internal("No resource manager.")); XlaCompilationCache* compiler; - OP_REQUIRES_OK(ctx, - rm->LookupOrCreate( - rm->default_container(), "xla_compiler", &compiler, - [rm](XlaCompilationCache** compiler) { - return BuildCompilationCache(rm, compiler); - })); + OP_REQUIRES_OK(ctx, rm->LookupOrCreate( + rm->default_container(), "xla_compiler", &compiler, + [rm](XlaCompilationCache** compiler) { + return BuildCompilationCache(rm, compiler); + })); // Holds the reference to the JIT during evaluation. (We could probably // free it sooner because the ResourceMgr will retain a reference, but // this is more obviously correct.) diff --git a/tensorflow/compiler/jit/xla_device_launch_op.h b/tensorflow/compiler/jit/kernels/xla_device_launch_op.h similarity index 90% rename from tensorflow/compiler/jit/xla_device_launch_op.h rename to tensorflow/compiler/jit/kernels/xla_device_launch_op.h index 3dc320c1b4..c77d5323b5 100644 --- a/tensorflow/compiler/jit/xla_device_launch_op.h +++ b/tensorflow/compiler/jit/kernels/xla_device_launch_op.h @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ -#ifndef TENSORFLOW_COMPILER_JIT_XLA_DEVICE_LAUNCH_OP_H_ -#define TENSORFLOW_COMPILER_JIT_XLA_DEVICE_LAUNCH_OP_H_ +#ifndef TENSORFLOW_COMPILER_JIT_KERNELS_XLA_DEVICE_LAUNCH_OP_H_ +#define TENSORFLOW_COMPILER_JIT_KERNELS_XLA_DEVICE_LAUNCH_OP_H_ #include "tensorflow/core/framework/allocator.h" #include "tensorflow/core/framework/op.h" @@ -53,4 +53,4 @@ class XlaDeviceLaunchOp : public OpKernel { } // namespace tensorflow -#endif // TENSORFLOW_COMPILER_JIT_XLA_DEVICE_LAUNCH_OP_H_ +#endif // TENSORFLOW_COMPILER_JIT_KERNELS_XLA_DEVICE_LAUNCH_OP_H_ diff --git a/tensorflow/compiler/jit/xla_local_launch_op.cc b/tensorflow/compiler/jit/kernels/xla_local_launch_op.cc similarity index 92% rename from tensorflow/compiler/jit/xla_local_launch_op.cc rename to tensorflow/compiler/jit/kernels/xla_local_launch_op.cc index d076cb74ac..e056442975 100644 --- a/tensorflow/compiler/jit/xla_local_launch_op.cc +++ b/tensorflow/compiler/jit/kernels/xla_local_launch_op.cc @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ -#include "tensorflow/compiler/jit/xla_local_launch_op.h" +#include "tensorflow/compiler/jit/kernels/xla_local_launch_op.h" #include "tensorflow/compiler/jit/defs.h" #include "tensorflow/compiler/tf2xla/xla_compiler.h" @@ -38,21 +38,6 @@ namespace gpu = perftools::gputools; namespace tensorflow { -REGISTER_OP("_XlaLaunch") - .Input("constants: Tconstants") - .Attr("Tconstants: list(type) >= 0") - .Input("args: Targs") - .Attr("Targs: list(type) >= 0") - .Input("resources: Nresources * resource") - .Attr("Nresources: int >= 0") - .Output("results: Tresults") - .Attr("Tresults: list(type) >= 0") - .Attr("function: func") - // XLA random-number generation ops are stateful. - // TODO(phawkins): create stateful and non-stateful variants of _XlaLaunch. - .SetIsStateful() - .Doc("XLA Launch Op. For use by the XLA JIT only."); - // Adapter class that wraps a Tensorflow allocator as an XLA allocator. class XlaAllocator : public xla::DeviceMemoryAllocator { public: @@ -200,12 +185,11 @@ void XlaLocalLaunchOp::Compute(OpKernelContext* ctx) { ctx->op_device_context() ? ctx->op_device_context()->stream() : nullptr; XlaCompilationCache* compiler; - OP_REQUIRES_OK(ctx, - rm->LookupOrCreate( - rm->default_container(), "xla_compiler", &compiler, - [this](XlaCompilationCache** compiler) { - return BuildCompilationCache(compiler); - })); + OP_REQUIRES_OK(ctx, rm->LookupOrCreate( + rm->default_container(), "xla_compiler", &compiler, + [this](XlaCompilationCache** compiler) { + return BuildCompilationCache(compiler); + })); // Hold the reference to the JIT during evaluation. (We could probably // free it sooner because the ResourceMgr will retain a reference, but // this is more obviously correct.) @@ -324,10 +308,9 @@ void XlaLocalLaunchOp::Compute(OpKernelContext* ctx) { } Tensor output_tensor; // Looks up the owning Tensor by buffer address. - OP_REQUIRES_OK( - ctx, - xla_allocator.MakeTensorFromBuffer( - buffer, ctx->expected_output_dtype(i), shape, &output_tensor)); + OP_REQUIRES_OK(ctx, xla_allocator.MakeTensorFromBuffer( + buffer, ctx->expected_output_dtype(i), shape, + &output_tensor)); ctx->set_output(i, output_tensor); ++output_num; } diff --git a/tensorflow/compiler/jit/xla_local_launch_op.h b/tensorflow/compiler/jit/kernels/xla_local_launch_op.h similarity index 91% rename from tensorflow/compiler/jit/xla_local_launch_op.h rename to tensorflow/compiler/jit/kernels/xla_local_launch_op.h index 96ae664cbe..cbb366e01b 100644 --- a/tensorflow/compiler/jit/xla_local_launch_op.h +++ b/tensorflow/compiler/jit/kernels/xla_local_launch_op.h @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ -#ifndef TENSORFLOW_COMPILER_JIT_XLA_LOCAL_LAUNCH_OP_H_ -#define TENSORFLOW_COMPILER_JIT_XLA_LOCAL_LAUNCH_OP_H_ +#ifndef TENSORFLOW_COMPILER_JIT_KERNELS_XLA_LOCAL_LAUNCH_OP_H_ +#define TENSORFLOW_COMPILER_JIT_KERNELS_XLA_LOCAL_LAUNCH_OP_H_ #include "tensorflow/compiler/jit/xla_compilation_cache.h" #include "tensorflow/core/framework/allocator.h" @@ -52,4 +52,4 @@ class XlaLocalLaunchOp : public OpKernel { } // namespace tensorflow -#endif // TENSORFLOW_COMPILER_JIT_XLA_LOCAL_LAUNCH_OP_H_ +#endif // TENSORFLOW_COMPILER_JIT_KERNELS_XLA_LOCAL_LAUNCH_OP_H_ diff --git a/tensorflow/compiler/jit/ops/BUILD b/tensorflow/compiler/jit/ops/BUILD new file mode 100644 index 0000000000..8d1fa03cc0 --- /dev/null +++ b/tensorflow/compiler/jit/ops/BUILD @@ -0,0 +1,45 @@ +licenses(["notice"]) # Apache 2.0 + +package( + default_visibility = [ + "//tensorflow/compiler/tf2xla:internal", + ], +) + +cc_library( + name = "xla_ops", + srcs = [ + "xla_ops.cc", + ], + deps = [ + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:protos_all_cc", + ], + alwayslink = 1, +) + +cc_library( + name = "parallel_check_op", + srcs = ["parallel_check_op.cc"], + deps = [ + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:protos_all_cc", + ], + alwayslink = 1, +) + +# ----------------------------------------------------------------------------- + +filegroup( + name = "all_files", + srcs = glob( + ["**/*"], + exclude = [ + "**/METADATA", + "**/OWNERS", + ], + ), + visibility = ["//tensorflow:__subpackages__"], +) diff --git a/tensorflow/compiler/jit/ops/parallel_check_op.cc b/tensorflow/compiler/jit/ops/parallel_check_op.cc new file mode 100644 index 0000000000..db5c195578 --- /dev/null +++ b/tensorflow/compiler/jit/ops/parallel_check_op.cc @@ -0,0 +1,30 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#include "tensorflow/core/framework/op.h" + +namespace tensorflow { + +REGISTER_OP("ParallelCheck") + .Attr("T: list(type) >= 0") + .Input("expected: T") + .Input("actual: T") + .Output("result: T") + .Doc(R"doc( +Op that compares two sets of inputs for near-identity, and propagates the first. +Inequality is logged to ERROR log. +)doc"); + +} // namespace tensorflow diff --git a/tensorflow/compiler/jit/ops/xla_ops.cc b/tensorflow/compiler/jit/ops/xla_ops.cc new file mode 100644 index 0000000000..07320b43da --- /dev/null +++ b/tensorflow/compiler/jit/ops/xla_ops.cc @@ -0,0 +1,35 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#include "tensorflow/core/framework/op.h" + +namespace tensorflow { + +REGISTER_OP("_XlaLaunch") + .Input("constants: Tconstants") + .Attr("Tconstants: list(type) >= 0") + .Input("args: Targs") + .Attr("Targs: list(type) >= 0") + .Input("resources: Nresources * resource") + .Attr("Nresources: int >= 0") + .Output("results: Tresults") + .Attr("Tresults: list(type) >= 0") + .Attr("function: func") + // XLA random-number generation ops are stateful. + // TODO(phawkins): create stateful and non-stateful variants of _XlaLaunch. + .SetIsStateful() + .Doc("XLA Launch Op. For use by the XLA JIT only."); + +} // namespace tensorflow diff --git a/tensorflow/compiler/jit/xla_cpu_device.cc b/tensorflow/compiler/jit/xla_cpu_device.cc index 5753912cec..e5153c2fe5 100644 --- a/tensorflow/compiler/jit/xla_cpu_device.cc +++ b/tensorflow/compiler/jit/xla_cpu_device.cc @@ -16,6 +16,7 @@ limitations under the License. // Registers the XLA_CPU device, which is an XlaDevice instantiation that runs // operators using XLA via the XLA "Host" (CPU) backend. +#include "tensorflow/compiler/jit/kernels/xla_device_launch_op.h" #include "tensorflow/compiler/jit/xla_device.h" #include "tensorflow/compiler/jit/xla_device_ops.h" #include "tensorflow/compiler/tf2xla/xla_op_registry.h" diff --git a/tensorflow/compiler/jit/xla_device.cc b/tensorflow/compiler/jit/xla_device.cc index baf96548bc..51fe9390d3 100644 --- a/tensorflow/compiler/jit/xla_device.cc +++ b/tensorflow/compiler/jit/xla_device.cc @@ -19,7 +19,6 @@ limitations under the License. #include #include "tensorflow/compiler/jit/defs.h" -#include "tensorflow/compiler/jit/xla_compilation_cache.h" #include "tensorflow/compiler/jit/xla_device_context.h" #include "tensorflow/compiler/jit/xla_device_ops.h" #include "tensorflow/compiler/tf2xla/dump_graph.h" diff --git a/tensorflow/compiler/jit/xla_device_ops.h b/tensorflow/compiler/jit/xla_device_ops.h index 34dc00c8d6..7a0a212f5a 100644 --- a/tensorflow/compiler/jit/xla_device_ops.h +++ b/tensorflow/compiler/jit/xla_device_ops.h @@ -18,7 +18,6 @@ limitations under the License. #ifndef TENSORFLOW_COMPILER_JIT_XLA_DEVICE_OPS_H_ #define TENSORFLOW_COMPILER_JIT_XLA_DEVICE_OPS_H_ -#include "tensorflow/compiler/jit/xla_device_launch_op.h" #include "tensorflow/core/framework/op_kernel.h" #include "tensorflow/core/framework/resource_mgr.h" #include "tensorflow/core/kernels/assign_op.h" diff --git a/tensorflow/compiler/jit/xla_gpu_device.cc b/tensorflow/compiler/jit/xla_gpu_device.cc index 1581f59cdb..d7da30718d 100644 --- a/tensorflow/compiler/jit/xla_gpu_device.cc +++ b/tensorflow/compiler/jit/xla_gpu_device.cc @@ -16,6 +16,7 @@ limitations under the License. // Registers the XLA_GPU device, which is an XlaDevice instantiation that runs // operators using XLA via the XLA "CUDA" (GPU) backend. +#include "tensorflow/compiler/jit/kernels/xla_device_launch_op.h" #include "tensorflow/compiler/jit/xla_device.h" #include "tensorflow/compiler/jit/xla_device_ops.h" #include "tensorflow/compiler/tf2xla/xla_op_registry.h" -- GitLab From 79098e13efe58ef3e56025c93761f4d7bb02dfbe Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 27 Feb 2017 12:01:00 -0800 Subject: [PATCH 010/101] Fix a bug where queue_parsed_examples fails for single tensors. Change: 148676738 --- .../contrib/learn/python/learn/learn_io/graph_io.py | 5 +++++ .../learn/python/learn/learn_io/graph_io_test.py | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/tensorflow/contrib/learn/python/learn/learn_io/graph_io.py b/tensorflow/contrib/learn/python/learn/learn_io/graph_io.py index cf4ea6ae2a..7e7974bada 100644 --- a/tensorflow/contrib/learn/python/learn/learn_io/graph_io.py +++ b/tensorflow/contrib/learn/python/learn/learn_io/graph_io.py @@ -673,6 +673,11 @@ def queue_parsed_features(parsed_features, errors.CancelledError))) dequeued_tensors = input_queue.dequeue() + if not isinstance(dequeued_tensors, list): + # input_queue.dequeue() returns a single tensor instead of a list of + # tensors if there is only one tensor to dequeue, which breaks the + # assumption of a list below. + dequeued_tensors = [dequeued_tensors] # Reset shapes on dequeued tensors. for i in range(len(tensors_to_enqueue)): diff --git a/tensorflow/contrib/learn/python/learn/learn_io/graph_io_test.py b/tensorflow/contrib/learn/python/learn/learn_io/graph_io_test.py index 90d58dec14..0f7307e406 100644 --- a/tensorflow/contrib/learn/python/learn/learn_io/graph_io_test.py +++ b/tensorflow/contrib/learn/python/learn/learn_io/graph_io_test.py @@ -34,6 +34,7 @@ from six.moves import xrange # pylint: disable=redefined-builtin from tensorflow.contrib.learn.python.learn.learn_io import graph_io from tensorflow.contrib.learn.python.learn.learn_io.graph_io import _read_keyed_batch_examples_shared_queue from tensorflow.python.client import session as session_lib +from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes as dtypes_lib from tensorflow.python.framework import errors from tensorflow.python.framework import ops @@ -743,6 +744,17 @@ class GraphIOTest(test.TestCase): coord.request_stop() coord.join(threads) + def test_queue_parsed_features_single_tensor(self): + with ops.Graph().as_default() as g, self.test_session(graph=g) as session: + features = {"test": constant_op.constant([1, 2, 3])} + _, queued_features = graph_io.queue_parsed_features(features) + coord = coordinator.Coordinator() + threads = queue_runner_impl.start_queue_runners(session, coord=coord) + out_features = session.run(queued_features["test"]) + self.assertAllEqual([1, 2, 3], out_features) + coord.request_stop() + coord.join(threads) + if __name__ == "__main__": test.main() -- GitLab From f8838fabb0a18ea8ad852718e3c1ded4dcc5917d Mon Sep 17 00:00:00 2001 From: Patrick Nguyen Date: Mon, 27 Feb 2017 12:11:46 -0800 Subject: [PATCH 011/101] Fix spelling errors. Change: 148678164 --- .../ops/stochastic_gradient_estimators.py | 2 +- .../distributions/python/ops/binomial.py | 2 +- .../distributions/python/ops/categorical.py | 4 ++-- .../distributions/python/ops/distribution.py | 4 ++-- .../python/ops/relaxed_onehot_categorical.py | 18 +++++++++--------- .../python/framework/checkpoint_utils.py | 4 ++-- .../contrib/framework/python/ops/variables.py | 4 ++-- tensorflow/contrib/graph_editor/transform.py | 2 +- tensorflow/contrib/graph_editor/util.py | 2 +- .../layers/python/layers/feature_column.py | 4 ++-- .../contrib/layers/python/layers/layers.py | 2 +- .../legacy_seq2seq/python/ops/seq2seq.py | 4 ++-- .../python/ops/linear_operator_composition.py | 2 +- .../python/ops/linear_operator_udvh_update.py | 2 +- tensorflow/contrib/rnn/python/ops/lstm_ops.py | 2 +- tensorflow/core/ops/string_ops.cc | 12 ++++++------ tensorflow/python/debug/lib/debug_utils.py | 2 +- tensorflow/python/ops/string_ops.py | 2 +- tensorflow/python/summary/writer/writer.py | 2 +- tensorflow/python/training/input.py | 4 ++-- .../python/training/monitored_session.py | 6 +++--- 21 files changed, 43 insertions(+), 43 deletions(-) diff --git a/tensorflow/contrib/bayesflow/python/ops/stochastic_gradient_estimators.py b/tensorflow/contrib/bayesflow/python/ops/stochastic_gradient_estimators.py index f9f3721047..695310837e 100644 --- a/tensorflow/contrib/bayesflow/python/ops/stochastic_gradient_estimators.py +++ b/tensorflow/contrib/bayesflow/python/ops/stochastic_gradient_estimators.py @@ -14,7 +14,7 @@ # ============================================================================== """Stochastic gradient estimators. -These functions are meant to be used in conjuction with `StochasticTensor` +These functions are meant to be used in conjunction with `StochasticTensor` (`loss_fn` parameter) and `surrogate_loss`. See Gradient Estimation Using Stochastic Computation Graphs diff --git a/tensorflow/contrib/distributions/python/ops/binomial.py b/tensorflow/contrib/distributions/python/ops/binomial.py index 0143743b01..8f7567ac5d 100644 --- a/tensorflow/contrib/distributions/python/ops/binomial.py +++ b/tensorflow/contrib/distributions/python/ops/binomial.py @@ -65,7 +65,7 @@ class Binomial(distribution.Distribution): where: * `total_count = n`, * `probs = p`, - * `Z` is the normalizaing constant, and, + * `Z` is the normalizing constant, and, * `n!` is the factorial of `n`. #### Examples diff --git a/tensorflow/contrib/distributions/python/ops/categorical.py b/tensorflow/contrib/distributions/python/ops/categorical.py index 6908faa5ad..b4b7f8fb40 100644 --- a/tensorflow/contrib/distributions/python/ops/categorical.py +++ b/tensorflow/contrib/distributions/python/ops/categorical.py @@ -39,7 +39,7 @@ class Categorical(distribution.Distribution): #### Examples - Creates a 3-class distiribution, with the 2nd class, the most likely to be + Creates a 3-class distribution, with the 2nd class, the most likely to be drawn from. ```python @@ -47,7 +47,7 @@ class Categorical(distribution.Distribution): dist = Categorical(probs=p) ``` - Creates a 3-class distiribution, with the 2nd class the most likely to be + Creates a 3-class distribution, with the 2nd class the most likely to be drawn from, using logits. ```python diff --git a/tensorflow/contrib/distributions/python/ops/distribution.py b/tensorflow/contrib/distributions/python/ops/distribution.py index c9dc025547..1b0390a5dc 100644 --- a/tensorflow/contrib/distributions/python/ops/distribution.py +++ b/tensorflow/contrib/distributions/python/ops/distribution.py @@ -520,14 +520,14 @@ class Distribution(_BaseDistribution): """Creates a deep copy of the distribution. Note: the copy distribution may continue to depend on the original - intialization arguments. + initialization arguments. Args: **override_parameters_kwargs: String/value dictionary of initialization arguments to override with new values. Returns: - distribution: A new instance of `type(self)` intitialized from the union + distribution: A new instance of `type(self)` initialized from the union of self.parameters and override_parameters_kwargs, i.e., `dict(self.parameters, **override_parameters_kwargs)`. """ diff --git a/tensorflow/contrib/distributions/python/ops/relaxed_onehot_categorical.py b/tensorflow/contrib/distributions/python/ops/relaxed_onehot_categorical.py index 4e97eae282..82016cab25 100644 --- a/tensorflow/contrib/distributions/python/ops/relaxed_onehot_categorical.py +++ b/tensorflow/contrib/distributions/python/ops/relaxed_onehot_categorical.py @@ -59,8 +59,8 @@ class ExpRelaxedOneHotCategorical(distribution.Distribution): #### Examples - Creates a continuous distribution, whoe exp approximates a 3-class one-hot - categorical distiribution. The 2nd class is the most likely to be the + Creates a continuous distribution, whose exp approximates a 3-class one-hot + categorical distribution. The 2nd class is the most likely to be the largest component in samples drawn from this distribution. If those samples are followed by a `tf.exp` op, then they are distributed as a relaxed onehot categorical. @@ -76,7 +76,7 @@ class ExpRelaxedOneHotCategorical(distribution.Distribution): ``` Creates a continuous distribution, whose exp approximates a 3-class one-hot - categorical distiribution. The 2nd class is the most likely to be the + categorical distribution. The 2nd class is the most likely to be the largest component in samples drawn from this distribution. ```python @@ -90,7 +90,7 @@ class ExpRelaxedOneHotCategorical(distribution.Distribution): ``` Creates a continuous distribution, whose exp approximates a 3-class one-hot - categorical distiribution. Because the temperature is very low, samples from + categorical distribution. Because the temperature is very low, samples from this distribution are almost discrete, with one component almost 0 and the others very negative. The 2nd class is the most likely to be the largest component in samples drawn from this distribution. @@ -106,7 +106,7 @@ class ExpRelaxedOneHotCategorical(distribution.Distribution): ``` Creates a continuous distribution, whose exp approximates a 3-class one-hot - categorical distiribution. Because the temperature is very high, samples from + categorical distribution. Because the temperature is very high, samples from this distribution are usually close to the (-log(3), -log(3), -log(3)) vector. The 2nd class is still the most likely to be the largest component in samples drawn from this distribution. @@ -314,7 +314,7 @@ class RelaxedOneHotCategorical( #### Examples Creates a continuous distribution, which approximates a 3-class one-hot - categorical distiribution. The 2nd class is the most likely to be the + categorical distribution. The 2nd class is the most likely to be the largest component in samples drawn from this distribution. ```python @@ -324,7 +324,7 @@ class RelaxedOneHotCategorical( ``` Creates a continuous distribution, which approximates a 3-class one-hot - categorical distiribution. The 2nd class is the most likely to be the + categorical distribution. The 2nd class is the most likely to be the largest component in samples drawn from this distribution. ```python @@ -334,7 +334,7 @@ class RelaxedOneHotCategorical( ``` Creates a continuous distribution, which approximates a 3-class one-hot - categorical distiribution. Because the temperature is very low, samples from + categorical distribution. Because the temperature is very low, samples from this distribution are almost discrete, with one component almost 1 and the others nearly 0. The 2nd class is the most likely to be the largest component in samples drawn from this distribution. @@ -346,7 +346,7 @@ class RelaxedOneHotCategorical( ``` Creates a continuous distribution, which approximates a 3-class one-hot - categorical distiribution. Because the temperature is very high, samples from + categorical distribution. Because the temperature is very high, samples from this distribution are usually close to the (1/3, 1/3, 1/3) vector. The 2nd class is still the most likely to be the largest component in samples drawn from this distribution. diff --git a/tensorflow/contrib/framework/python/framework/checkpoint_utils.py b/tensorflow/contrib/framework/python/framework/checkpoint_utils.py index 8922c1404a..8c168a6a93 100644 --- a/tensorflow/contrib/framework/python/framework/checkpoint_utils.py +++ b/tensorflow/contrib/framework/python/framework/checkpoint_utils.py @@ -150,7 +150,7 @@ def _collect_partitioned_variable(name, var_scope): def init_from_checkpoint(checkpoint_dir, assignment_map): - """Using assingment map initializes current variables with loaded tensors. + """Using assignment map initializes current variables with loaded tensors. Note: This overrides default initialization ops of specified variables and redefines dtype. @@ -160,7 +160,7 @@ def init_from_checkpoint(checkpoint_dir, assignment_map): current `scope_name` from `checkpoint_scope_name` with matching variable names. `'checkpoint_scope_name/some_other_variable': 'scope_name/variable_name'` - - will initalize `scope_name/variable_name` variable + will initialize `scope_name/variable_name` variable from `checkpoint_scope_name/some_other_variable`. `'scope_variable_name': variable` - will initialize given `tf.Variable` object with variable from the checkpoint. diff --git a/tensorflow/contrib/framework/python/ops/variables.py b/tensorflow/contrib/framework/python/ops/variables.py index 096ab9c21b..1c35b2419c 100644 --- a/tensorflow/contrib/framework/python/ops/variables.py +++ b/tensorflow/contrib/framework/python/ops/variables.py @@ -610,8 +610,8 @@ def assign_from_checkpoint_fn(model_path, var_list, ignore_missing_vars=False, model_path: The full path to the model checkpoint. To get latest checkpoint use `model_path = tf.train.latest_checkpoint(checkpoint_dir)` var_list: A list of `Variable` objects or a dictionary mapping names in the - checkpoint to the correspoing variables to initialize. If empty or None, - it would return no_op(), None. + checkpoint to the corresponding variables to initialize. If empty or + `None`, it would return `no_op(), None`. ignore_missing_vars: Boolean, if True it would ignore variables missing in the checkpoint with a warning instead of failing. reshape_variables: Boolean, if True it would automatically reshape variables diff --git a/tensorflow/contrib/graph_editor/transform.py b/tensorflow/contrib/graph_editor/transform.py index 57fd7d7188..762bc44814 100644 --- a/tensorflow/contrib/graph_editor/transform.py +++ b/tensorflow/contrib/graph_editor/transform.py @@ -137,7 +137,7 @@ def copy_op_handler(info, op, copy_shape=True): op: the `tf.Operation` to be copied. copy_shape: also copy the shape of the tensor Returns: - A `(op, op_outputs)` tuple containgin the transformed op and its outputs. + A `(op, op_outputs)` tuple containing the transformed op and its outputs. """ # pylint: disable=protected-access diff --git a/tensorflow/contrib/graph_editor/util.py b/tensorflow/contrib/graph_editor/util.py index d8824f6792..01c31ffc18 100644 --- a/tensorflow/contrib/graph_editor/util.py +++ b/tensorflow/contrib/graph_editor/util.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Utility funtions for the graph_editor. +"""Utility functions for the graph_editor. """ from __future__ import absolute_import diff --git a/tensorflow/contrib/layers/python/layers/feature_column.py b/tensorflow/contrib/layers/python/layers/feature_column.py index 65b9c87c28..8f755085f0 100644 --- a/tensorflow/contrib/layers/python/layers/feature_column.py +++ b/tensorflow/contrib/layers/python/layers/feature_column.py @@ -50,7 +50,7 @@ should choose depends on (1) the feature type and (2) the model type. Sparse features can be fed directly into linear models. dept_column = sparse_column_with_keys("department", - ["math", "philosphy", "english"]) + ["math", "philosophy", "english"]) It is recommended that continuous features be bucketized before being fed into linear models. @@ -1508,7 +1508,7 @@ def real_valued_column(column_name, TypeError: if default_value is a list but its length is not equal to the value of `dimension`. TypeError: if default_value is not compatible with dtype. - ValueError: if dtype is not convertable to tf.float32. + ValueError: if dtype is not convertible to tf.float32. """ if dimension is not None: diff --git a/tensorflow/contrib/layers/python/layers/layers.py b/tensorflow/contrib/layers/python/layers/layers.py index b0a3d04546..03cb86601f 100644 --- a/tensorflow/contrib/layers/python/layers/layers.py +++ b/tensorflow/contrib/layers/python/layers/layers.py @@ -1797,7 +1797,7 @@ def separable_convolution2d( reuse: Whether or not the layer and its variables should be reused. To be able to reuse the layer scope must be given. variables_collections: Optional list of collections for all the variables or - a dictionay containing a different list of collection per variable. + a dictionary containing a different list of collection per variable. outputs_collections: Collection to add the outputs. trainable: Whether or not the variables should be trainable or not. scope: Optional scope for variable_scope. diff --git a/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py b/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py index 8608054deb..3d1589f27e 100644 --- a/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py +++ b/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py @@ -933,7 +933,7 @@ def one2many_rnn_seq2seq(encoder_inputs, Args: encoder_inputs: A list of 1D int32 Tensors of shape [batch_size]. - decoder_inputs_dict: A dictionany mapping decoder name (string) to + decoder_inputs_dict: A dictionary mapping decoder name (string) to the corresponding decoder_inputs; each decoder_inputs is a list of 1D Tensors of shape [batch_size]; num_decoders is defined as len(decoder_inputs_dict). @@ -1177,7 +1177,7 @@ def model_with_buckets(encoder_inputs, if per_example_loss is set, a list of 1D batch-sized float Tensors. Raises: - ValueError: If length of encoder_inputsut, targets, or weights is smaller + ValueError: If length of encoder_inputs, targets, or weights is smaller than the largest (last) bucket. """ if len(encoder_inputs) < buckets[-1][0]: diff --git a/tensorflow/contrib/linalg/python/ops/linear_operator_composition.py b/tensorflow/contrib/linalg/python/ops/linear_operator_composition.py index 81e7735841..781282eb35 100644 --- a/tensorflow/contrib/linalg/python/ops/linear_operator_composition.py +++ b/tensorflow/contrib/linalg/python/ops/linear_operator_composition.py @@ -122,7 +122,7 @@ class LinearOperatorComposition(linear_operator.LinearOperator): Args: operators: Iterable of `LinearOperator` objects, each with - the same `dtype` and composible shape. + the same `dtype` and composable shape. is_non_singular: Expect that this operator is non-singular. is_self_adjoint: Expect that this operator is equal to its hermitian transpose. diff --git a/tensorflow/contrib/linalg/python/ops/linear_operator_udvh_update.py b/tensorflow/contrib/linalg/python/ops/linear_operator_udvh_update.py index 88323bba56..bce27dcd6f 100644 --- a/tensorflow/contrib/linalg/python/ops/linear_operator_udvh_update.py +++ b/tensorflow/contrib/linalg/python/ops/linear_operator_udvh_update.py @@ -156,7 +156,7 @@ class LinearOperatorUDVHUpdate(linear_operator.LinearOperator): Defaults to `D` being the identity operator. v: Optional `Tensor` of same `dtype` as `u` and shape `[B1,...,Bb, N, K]` Defaults to `v = u`, in which case the perturbation is symmetric. - If `M != N`, then `v` must be set since the pertrubation is not square. + If `M != N`, then `v` must be set since the perturbation is not square. is_diag_positive: Python `bool`. If `True`, expect `diag > 0`. is_non_singular: Expect that this operator is non-singular. Default is `None`, unless `is_positive_definite` is auto-set to be diff --git a/tensorflow/contrib/rnn/python/ops/lstm_ops.py b/tensorflow/contrib/rnn/python/ops/lstm_ops.py index d1d547b952..2e6f2ac05c 100644 --- a/tensorflow/contrib/rnn/python/ops/lstm_ops.py +++ b/tensorflow/contrib/rnn/python/ops/lstm_ops.py @@ -333,7 +333,7 @@ class LSTMBlockCell(core_rnn_cell.RNNCell): reduce the scale of forgetting in the beginning of the training. Unlike `core_rnn_cell.LSTMCell`, this is a monolithic op and should be much - faster. The weight and bias matrixes should be compatible as long as the + faster. The weight and bias matrices should be compatible as long as the variable scope matches. """ diff --git a/tensorflow/core/ops/string_ops.cc b/tensorflow/core/ops/string_ops.cc index 0db1a20557..4e6d39b0e1 100644 --- a/tensorflow/core/ops/string_ops.cc +++ b/tensorflow/core/ops/string_ops.cc @@ -59,7 +59,7 @@ defines the key of the hash function. `key` is an array of 2 elements. A strong hash is important when inputs may be malicious, e.g. URLs with additional components. Adversaries could try to make their inputs hash to the same bucket for a denial-of-service attack or to skew the results. A strong -hash prevents this by making it dificult, if not infeasible, to compute inputs +hash prevents this by making it difficult, if not infeasible, to compute inputs that hash to the same bucket. This comes at a cost of roughly 4x higher compute time than `tf.string_to_hash_bucket_fast`. @@ -308,10 +308,10 @@ REGISTER_OP("Substr") .Doc(R"doc( Return substrings from `Tensor` of strings. -For each string in the input `Tensor`, creates a substring starting at index -`pos` with a total length of `len`. +For each string in the input `Tensor`, creates a substring starting at index +`pos` with a total length of `len`. -If `len` defines a substring that would extend beyond the length of the input +If `len` defines a substring that would extend beyond the length of the input string, then as many characters as possible are used. If `pos` is negative or specifies a character index larger than any of the input @@ -320,7 +320,7 @@ strings, then an `InvalidArgumentError` is thrown. `pos` and `len` must have the same shape, otherwise a `ValueError` is thrown on Op creation. -*NOTE*: `Substr` supports broadcasting up to two dimensions. More about +*NOTE*: `Substr` supports broadcasting up to two dimensions. More about broadcasting [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) @@ -382,7 +382,7 @@ length = [3, 2, 1] output = [b'hir', b'ee', b'n"] ``` -input: Tensor of strings +input: Tensor of strings pos: Scalar defining the position of first character in each substring len: Scalar defining the number of characters to include in each substring output: Tensor of substrings diff --git a/tensorflow/python/debug/lib/debug_utils.py b/tensorflow/python/debug/lib/debug_utils.py index 2b8e95b99e..9bccdfa32d 100644 --- a/tensorflow/python/debug/lib/debug_utils.py +++ b/tensorflow/python/debug/lib/debug_utils.py @@ -159,7 +159,7 @@ def watch_graph_with_blacklists(run_options, run_options: An instance of `config_pb2.RunOptions` to be modified. graph: An instance of `ops.Graph`. debug_ops: (`str` or `list` of `str`) name(s) of the debug op(s) to use. - debug_urls: URL(s) to send ebug values to, e.g., + debug_urls: URL(s) to send debug values to, e.g., `file:///tmp/tfdbg_dump_1`, `grpc://localhost:12345`. node_name_regex_blacklist: Regular-expression blacklist for node_name. This should be a string, e.g., `"(weight_[0-9]+|bias_.*)"`. diff --git a/tensorflow/python/ops/string_ops.py b/tensorflow/python/ops/string_ops.py index 12293f03ad..97f2f761a6 100644 --- a/tensorflow/python/ops/string_ops.py +++ b/tensorflow/python/ops/string_ops.py @@ -55,7 +55,7 @@ def string_split(source, delimiter=" "): # pylint: disable=invalid-name Let N be the size of source (typically N will be the batch size). Split each element of `source` based on `delimiter` and return a `SparseTensor` - containing the splitted tokens. Empty tokens are ignored. + containing the split tokens. Empty tokens are ignored. If `delimiter` is an empty string, each element of the `source` is split into individual strings, each containing one byte. (This includes splitting diff --git a/tensorflow/python/summary/writer/writer.py b/tensorflow/python/summary/writer/writer.py index f87afc53dd..a737fd2c16 100644 --- a/tensorflow/python/summary/writer/writer.py +++ b/tensorflow/python/summary/writer/writer.py @@ -185,7 +185,7 @@ class SummaryToEventTransformer(object): `saver.import_meta_graph()`. Args: - meta_graph_def: A `MetaGraphDef` object, often as retured by + meta_graph_def: A `MetaGraphDef` object, often as returned by `saver.export_meta_graph()`. global_step: Number. Optional global step counter to record with the graph. diff --git a/tensorflow/python/training/input.py b/tensorflow/python/training/input.py index fdb8d593b3..06e21fb420 100644 --- a/tensorflow/python/training/input.py +++ b/tensorflow/python/training/input.py @@ -930,8 +930,8 @@ def maybe_batch(tensors, keep_input, batch_size, num_threads=1, capacity=32, added to the queue or not. If it is a scalar and evaluates `True`, then `tensors` are all added to the queue. If it is a vector and `enqueue_many` is `True`, then each example is added to the queue only if the - corresonding value in `keep_input` is `True`. This tensor essentially acts - as a filtering mechanism. + corresponding value in `keep_input` is `True`. This tensor essentially + acts as a filtering mechanism. batch_size: The new batch size pulled from the queue. num_threads: The number of threads enqueuing `tensors`. capacity: An integer. The maximum number of elements in the queue. diff --git a/tensorflow/python/training/monitored_session.py b/tensorflow/python/training/monitored_session.py index fa10031afc..e2e4b50cb6 100644 --- a/tensorflow/python/training/monitored_session.py +++ b/tensorflow/python/training/monitored_session.py @@ -87,7 +87,7 @@ class Scaffold(object): You can also pass the following additional pieces to the constructor: - * `init_feed_dict`: A sessionn feed dictionary that should be used when + * `init_feed_dict`: A session feed dictionary that should be used when running the init op. * `init_fn`: A callable to run run after the init op to perform additional initializations. The callable will be called as @@ -261,7 +261,7 @@ def MonitoredTrainingSession(master='', # pylint: disable=invalid-name For a chief, this utility sets proper session initializer/restorer. It also creates hooks related to checkpoint and summary saving. For workers, this utility sets proper session creator which waits for the chief to - inialize/restore. + initialize/restore. Args: @@ -673,7 +673,7 @@ class SingularMonitoredSession(_MonitoredSession): * calls `hook.end()` * closes the queue runners and the session - * surpresses `OutOfRange` error which indicates that all inputs have been + * suppresses `OutOfRange` error which indicates that all inputs have been processed if the `SingularMonitoredSession` is used as a context. """ -- GitLab From 57151fe77addf768e0cf6555f0570c52a6356e89 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 27 Feb 2017 12:15:38 -0800 Subject: [PATCH 012/101] Move cluster initialization to happen during training using training hooks instead of depending on variable initialization logic. This avoids deadlocks that can happen if QueueRunners are used to generate data. Deadlocks would happen since initialization would wait for QueueRunner to generate data, but QueueRunners were not started till variable initialization was complete. Also some refactoring of the code to move Hooks and model function out of the Estimator class. Change: 148678573 --- .../contrib/factorization/examples/mnist.py | 21 +- .../python/ops/clustering_ops.py | 84 +++++-- .../learn/python/learn/estimators/kmeans.py | 206 ++++++++++-------- .../python/learn/estimators/kmeans_test.py | 23 ++ 4 files changed, 220 insertions(+), 114 deletions(-) diff --git a/tensorflow/contrib/factorization/examples/mnist.py b/tensorflow/contrib/factorization/examples/mnist.py index 992f4fb804..06a62db004 100644 --- a/tensorflow/contrib/factorization/examples/mnist.py +++ b/tensorflow/contrib/factorization/examples/mnist.py @@ -142,7 +142,8 @@ def inference(inp, num_clusters, hidden1_units, hidden2_units): # initial_clusters=tf.contrib.factorization.KMEANS_PLUS_PLUS_INIT, use_mini_batch=True) - all_scores, _, clustering_scores, kmeans_training_op = kmeans.training_graph() + (all_scores, _, clustering_scores, _, kmeans_init, + kmeans_training_op) = kmeans.training_graph() # Some heuristics to approximately whiten this output. all_scores = (all_scores[0] - 0.5) * 5 # Here we avoid passing the gradients from the supervised objective back to @@ -176,7 +177,7 @@ def inference(inp, num_clusters, hidden1_units, hidden2_units): biases = tf.Variable(tf.zeros([NUM_CLASSES]), name='biases') logits = tf.matmul(hidden2, weights) + biases - return logits, clustering_loss, kmeans_training_op + return logits, clustering_loss, kmeans_init, kmeans_training_op def run_training(): @@ -192,10 +193,11 @@ def run_training(): images_placeholder, labels_placeholder = placeholder_inputs() # Build a Graph that computes predictions from the inference model. - logits, clustering_loss, kmeans_training_op = inference(images_placeholder, - FLAGS.num_clusters, - FLAGS.hidden1, - FLAGS.hidden2) + logits, clustering_loss, kmeans_init, kmeans_training_op = inference( + images_placeholder, + FLAGS.num_clusters, + FLAGS.hidden1, + FLAGS.hidden2) # Add to the Graph the Ops for loss calculation. loss = mnist.loss(logits, labels_placeholder) @@ -213,12 +215,15 @@ def run_training(): # Create a session for running Ops on the Graph. sess = tf.Session() + # Run the Op to initialize the variables. + sess.run(init) + feed_dict = fill_feed_dict(data_sets.train, images_placeholder, labels_placeholder, batch_size=max(FLAGS.batch_size, 5000)) - # Run the Op to initialize the variables. - sess.run(init, feed_dict=feed_dict) + # Run the Op to initialize the clusters. + sess.run(kmeans_init, feed_dict=feed_dict) # Start the training loop. max_test_prec = 0 diff --git a/tensorflow/contrib/factorization/python/ops/clustering_ops.py b/tensorflow/contrib/factorization/python/ops/clustering_ops.py index 226b21c7de..253f2d81e5 100644 --- a/tensorflow/contrib/factorization/python/ops/clustering_ops.py +++ b/tensorflow/contrib/factorization/python/ops/clustering_ops.py @@ -265,15 +265,12 @@ class KMeans(object): (not self._use_mini_batch or self._mini_batch_steps_per_iteration > 1)) - def _init_clusters(self): - """Initialization of clusters. + def _initialize_clusters(self, + cluster_centers, + cluster_centers_initialized, + cluster_centers_updated): + """Returns an op to initialize the cluster centers.""" - Returns: - Tuple with following elements: - cluster_centers: a Tensor for storing cluster centers - cluster_counts: a Tensor for storing counts of points assigned to this - cluster. This is used by mini-batch training. - """ init = self._initial_clusters if init == RANDOM_INIT: clusters_init = self._init_clusters_random() @@ -294,16 +291,53 @@ class KMeans(object): assert False, 'Unsupported init passed to Kmeans %s' % str(init) if self._distance_metric == COSINE_DISTANCE and clusters_init is not None: clusters_init = nn_impl.l2_normalize(clusters_init, dim=1) - clusters_init = clusters_init if clusters_init is not None else [] - # TODO(agarwal): Locally cache cluster_centers on the worker to avoid - # copying them each step. - cluster_centers = variables.Variable(clusters_init, + + with ops.colocate_with(cluster_centers_initialized): + initialized = control_flow_ops.with_dependencies( + [clusters_init], + array_ops.identity(cluster_centers_initialized)) + with ops.colocate_with(cluster_centers): + assign_centers = state_ops.assign(cluster_centers, clusters_init, + validate_shape=False) + if cluster_centers_updated != cluster_centers: + assign_centers = control_flow_ops.group( + assign_centers, + state_ops.assign(cluster_centers_updated, clusters_init, + validate_shape=False)) + assign_centers = control_flow_ops.with_dependencies( + [assign_centers], + state_ops.assign(cluster_centers_initialized, True)) + return control_flow_ops.cond(initialized, + control_flow_ops.no_op, + lambda: assign_centers).op + + def _create_variables(self): + """Creates variables. + + Returns: + Tuple with following elements: + cluster_centers: a Tensor for storing cluster centers + cluster_centers_initialized: bool Variable indicating whether clusters + are initialized. + cluster_counts: a Tensor for storing counts of points assigned to this + cluster. This is used by mini-batch training. + cluster_centers_updated: Tensor representing copy of cluster centers that + are updated every step. + update_in_steps: numbers of steps left before we sync + cluster_centers_updated back to cluster_centers. + """ + init_value = array_ops.constant([], dtype=dtypes.float32) + cluster_centers = variables.Variable(init_value, name='clusters', validate_shape=False) + cluster_centers_initialized = variables.Variable(False, + dtype=dtypes.bool, + name='initialized') + if self._use_mini_batch and self._mini_batch_steps_per_iteration > 1: # Copy of cluster centers actively updated each step according to # mini-batch update rule. - cluster_centers_updated = variables.Variable(clusters_init, + cluster_centers_updated = variables.Variable(init_value, name='clusters_updated', validate_shape=False) # How many steps till we copy the updated clusters to cluster_centers. @@ -319,8 +353,11 @@ class KMeans(object): cluster_counts = (variables.Variable(array_ops.ones([self._num_clusters], dtype=dtypes.int64)) if self._use_mini_batch else None) - return (cluster_centers, cluster_counts, - cluster_centers_updated, update_in_steps) + return (cluster_centers, + cluster_centers_initialized, + cluster_counts, + cluster_centers_updated, + update_in_steps) @classmethod def _l2_normalize_data(cls, inputs): @@ -344,12 +381,21 @@ class KMeans(object): corresponding to the input. scores: Similar to cluster_idx but specifies the distance to the assigned cluster instead. + cluster_centers_initialized: scalar indicating whether clusters have been + initialized. + init_op: an op to initialize the clusters. training_op: an op that runs an iteration of training. """ # Implementation of kmeans. inputs = self._inputs - (cluster_centers_var, total_counts, - cluster_centers_updated, update_in_steps) = self._init_clusters() + (cluster_centers_var, + cluster_centers_initialized, + total_counts, + cluster_centers_updated, + update_in_steps) = self._create_variables() + init_op = self._initialize_clusters(cluster_centers_var, + cluster_centers_initialized, + cluster_centers_updated) cluster_centers = cluster_centers_var if self._distance_metric == COSINE_DISTANCE: @@ -371,7 +417,9 @@ class KMeans(object): assert cluster_centers == cluster_centers_var training_op = self._full_batch_training_op(inputs, cluster_idx, cluster_centers_var) - return all_scores, cluster_idx, scores, training_op + + return (all_scores, cluster_idx, scores, + cluster_centers_initialized, init_op, training_op) def _mini_batch_sync_updates_op(self, update_in_steps, cluster_centers_var, cluster_centers_updated, diff --git a/tensorflow/contrib/learn/python/learn/estimators/kmeans.py b/tensorflow/contrib/learn/python/learn/estimators/kmeans.py index cdee9033a3..a0f501dfba 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/kmeans.py +++ b/tensorflow/contrib/learn/python/learn/estimators/kmeans.py @@ -18,6 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function +import time import numpy as np from tensorflow.contrib.factorization.python.ops import clustering_ops @@ -30,10 +31,114 @@ from tensorflow.python.ops import logging_ops from tensorflow.python.ops import math_ops from tensorflow.python.ops import state_ops from tensorflow.python.ops.control_flow_ops import with_dependencies +from tensorflow.python.platform import tf_logging as logging from tensorflow.python.training import session_run_hook from tensorflow.python.training.session_run_hook import SessionRunArgs +class _LossRelativeChangeHook(session_run_hook.SessionRunHook): + """Stops when the change in loss goes below a tolerance.""" + + def __init__(self, tolerance): + """Initializes _LossRelativeChangeHook. + + Args: + tolerance: A relative tolerance of change between iterations. + """ + self._tolerance = tolerance + self._prev_loss = None + + def begin(self): + self._loss_tensor = ops.get_default_graph().get_tensor_by_name( + KMeansClustering.LOSS_OP_NAME + ':0') + assert self._loss_tensor is not None + + def before_run(self, run_context): + del run_context + return SessionRunArgs( + fetches={KMeansClustering.LOSS_OP_NAME: self._loss_tensor}) + + def after_run(self, run_context, run_values): + loss = run_values.results[KMeansClustering.LOSS_OP_NAME] + assert loss is not None + if self._prev_loss is not None: + relative_change = (abs(loss - self._prev_loss) / + (1 + abs(self._prev_loss))) + if relative_change < self._tolerance: + run_context.request_stop() + self._prev_loss = loss + + +class _InitializeClustersHook(session_run_hook.SessionRunHook): + """Initializes clusters or waits for cluster initialization.""" + + def __init__(self, init_op, is_initialized_op, is_chief): + self._init_op = init_op + self._is_chief = is_chief + self._is_initialized_op = is_initialized_op + + def after_create_session(self, session, _): + assert self._init_op.graph == ops.get_default_graph() + assert self._is_initialized_op.graph == self._init_op.graph + while True: + try: + if session.run(self._is_initialized_op): + break + elif self._is_chief: + session.run(self._init_op) + else: + time.sleep(1) + except RuntimeError as e: + logging.info(e) + + +def _parse_tensor_or_dict(features): + """Helper function to parse features.""" + if isinstance(features, dict): + keys = sorted(features.keys()) + with ops.colocate_with(features[keys[0]]): + features = array_ops.concat([features[k] for k in keys], 1) + return features + + +def _kmeans_clustering_model_fn(features, labels, mode, params, config): + """Model function for KMeansClustering estimator.""" + assert labels is None, labels + (all_scores, model_predictions, losses, + is_initialized, init_op, training_op) = clustering_ops.KMeans( + _parse_tensor_or_dict(features), + params.get('num_clusters'), + initial_clusters=params.get('training_initial_clusters'), + distance_metric=params.get('distance_metric'), + use_mini_batch=params.get('use_mini_batch'), + mini_batch_steps_per_iteration=params.get( + 'mini_batch_steps_per_iteration'), + random_seed=params.get('random_seed'), + kmeans_plus_plus_num_retries=params.get( + 'kmeans_plus_plus_num_retries')).training_graph() + incr_step = state_ops.assign_add(variables.get_global_step(), 1) + loss = math_ops.reduce_sum(losses, name=KMeansClustering.LOSS_OP_NAME) + logging_ops.scalar_summary('loss/raw', loss) + training_op = with_dependencies([training_op, incr_step], loss) + predictions = { + KMeansClustering.ALL_SCORES: all_scores[0], + KMeansClustering.CLUSTER_IDX: model_predictions[0], + } + eval_metric_ops = {KMeansClustering.SCORES: loss} + training_hooks = [_InitializeClustersHook( + init_op, is_initialized, config.is_chief)] + relative_tolerance = params.get('relative_tolerance') + if relative_tolerance is not None: + training_hooks.append(_LossRelativeChangeHook(relative_tolerance)) + return ModelFnOps( + mode=mode, + predictions=predictions, + eval_metric_ops=eval_metric_ops, + loss=loss, + train_op=training_op, + training_hooks=training_hooks) + + # TODO(agarwal,ands): support sharded input. class KMeansClustering(estimator.Estimator): """An Estimator for K-Means clustering.""" @@ -83,48 +188,20 @@ class KMeansClustering(estimator.Estimator): Note that this may not work correctly if use_mini_batch=True. config: See Estimator """ - self._num_clusters = num_clusters - self._training_initial_clusters = initial_clusters - self._distance_metric = distance_metric - self._random_seed = random_seed - self._use_mini_batch = use_mini_batch - self._mini_batch_steps_per_iteration = mini_batch_steps_per_iteration - self._kmeans_plus_plus_num_retries = kmeans_plus_plus_num_retries - self._relative_tolerance = relative_tolerance + params = {} + params['num_clusters'] = num_clusters + params['training_initial_clusters'] = initial_clusters + params['distance_metric'] = distance_metric + params['random_seed'] = random_seed + params['use_mini_batch'] = use_mini_batch + params['mini_batch_steps_per_iteration'] = mini_batch_steps_per_iteration + params['kmeans_plus_plus_num_retries'] = kmeans_plus_plus_num_retries + params['relative_tolerance'] = relative_tolerance super(KMeansClustering, self).__init__( - model_fn=self._get_model_function(), model_dir=model_dir) - - class LossRelativeChangeHook(session_run_hook.SessionRunHook): - """Stops when the change in loss goes below a tolerance.""" - - def __init__(self, tolerance): - """Initializes LossRelativeChangeHook. - - Args: - tolerance: A relative tolerance of change between iterations. - """ - self._tolerance = tolerance - self._prev_loss = None - - def begin(self): - self._loss_tensor = ops.get_default_graph().get_tensor_by_name( - KMeansClustering.LOSS_OP_NAME + ':0') - assert self._loss_tensor is not None - - def before_run(self, run_context): - del run_context - return SessionRunArgs( - fetches={KMeansClustering.LOSS_OP_NAME: self._loss_tensor}) - - def after_run(self, run_context, run_values): - loss = run_values.results[KMeansClustering.LOSS_OP_NAME] - assert loss is not None - if self._prev_loss is not None: - relative_change = (abs(loss - self._prev_loss) / - (1 + abs(self._prev_loss))) - if relative_change < self._tolerance: - run_context.request_stop() - self._prev_loss = loss + model_fn=_kmeans_clustering_model_fn, + params=params, + model_dir=model_dir, + config=config) def predict_cluster_idx(self, input_fn=None): """Yields predicted cluster indices.""" @@ -181,50 +258,3 @@ class KMeansClustering(estimator.Estimator): """Returns cluster centers.""" return super(KMeansClustering, self).get_variable_value(self.CLUSTERS) - def _parse_tensor_or_dict(self, features): - if isinstance(features, dict): - keys = sorted(features.keys()) - with ops.colocate_with(features[keys[0]]): - features = array_ops.concat([features[k] for k in keys], 1) - return features - - def _get_model_function(self): - """Creates a model function.""" - - def _model_fn(features, labels, mode): - """Model function.""" - assert labels is None, labels - (all_scores, model_predictions, losses, - training_op) = clustering_ops.KMeans( - self._parse_tensor_or_dict(features), - self._num_clusters, - initial_clusters=self._training_initial_clusters, - distance_metric=self._distance_metric, - use_mini_batch=self._use_mini_batch, - mini_batch_steps_per_iteration=( - self._mini_batch_steps_per_iteration), - random_seed=self._random_seed, - kmeans_plus_plus_num_retries=self. - _kmeans_plus_plus_num_retries).training_graph() - incr_step = state_ops.assign_add(variables.get_global_step(), 1) - loss = math_ops.reduce_sum(losses, name=KMeansClustering.LOSS_OP_NAME) - logging_ops.scalar_summary('loss/raw', loss) - training_op = with_dependencies([training_op, incr_step], loss) - predictions = { - KMeansClustering.ALL_SCORES: all_scores[0], - KMeansClustering.CLUSTER_IDX: model_predictions[0], - } - eval_metric_ops = {KMeansClustering.SCORES: loss,} - if self._relative_tolerance is not None: - training_hooks = [self.LossRelativeChangeHook(self._relative_tolerance)] - else: - training_hooks = None - return ModelFnOps( - mode=mode, - predictions=predictions, - eval_metric_ops=eval_metric_ops, - loss=loss, - train_op=training_op, - training_hooks=training_hooks) - - return _model_fn diff --git a/tensorflow/contrib/learn/python/learn/estimators/kmeans_test.py b/tensorflow/contrib/learn/python/learn/estimators/kmeans_test.py index 450199ea1c..7a0b778839 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/kmeans_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/kmeans_test.py @@ -47,6 +47,7 @@ from tensorflow.python.platform import benchmark from tensorflow.python.platform import flags from tensorflow.python.platform import test from tensorflow.python.training import input as input_lib +from tensorflow.python.training import queue_runner FLAGS = flags.FLAGS @@ -523,5 +524,27 @@ class SklearnKMeansBenchmark(KMeansBenchmark): self._report(num_iters, start, time.time(), scores) +class KMeansTestQueues(test.TestCase): + + def input_fn(self): + def _fn(): + queue = data_flow_ops.FIFOQueue(capacity=10, + dtypes=dtypes.float32, + shapes=[10, 3]) + enqueue_op = queue.enqueue(array_ops.zeros([10, 3], dtype=dtypes.float32)) + queue_runner.add_queue_runner(queue_runner.QueueRunner(queue, + [enqueue_op])) + return queue.dequeue(), None + return _fn + + # This test makes sure that there are no deadlocks when using a QueueRunner. + # Note that since cluster initialization is dependendent on inputs, if input + # is generated using a QueueRunner, one has to make sure that these runners + # are started before the initialization. + def test_queues(self): + kmeans = kmeans_lib.KMeansClustering(5) + kmeans.fit(input_fn=self.input_fn(), steps=1) + + if __name__ == '__main__': test.main() -- GitLab From 3fb9948bc5954b7b3de7ed9d1cb41581768f983f Mon Sep 17 00:00:00 2001 From: "Joshua V. Dillon" Date: Mon, 27 Feb 2017 12:17:29 -0800 Subject: [PATCH 013/101] Bugfix: Ensure tf.random_gamma can never return 0. Fixes #7474. Change: 148678769 --- .../python/kernel_tests/random_gamma_test.py | 9 +++++ tensorflow/python/ops/random_ops.py | 33 +++++++------------ 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/tensorflow/python/kernel_tests/random_gamma_test.py b/tensorflow/python/kernel_tests/random_gamma_test.py index 64595ce9cd..aa40228dc1 100644 --- a/tensorflow/python/kernel_tests/random_gamma_test.py +++ b/tensorflow/python/kernel_tests/random_gamma_test.py @@ -27,6 +27,7 @@ from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import random_seed from tensorflow.python.ops import array_ops +from tensorflow.python.ops import math_ops from tensorflow.python.ops import random_ops from tensorflow.python.platform import test from tensorflow.python.platform import tf_logging @@ -252,6 +253,14 @@ class RandomGammaTest(test.TestCase): rnd = random_ops.random_gamma([50], array_ops.placeholder(dtypes.float32)) self.assertIs(None, rnd.get_shape().ndims) + def testPositive(self): + n = int(10e3) + for dt in [dtypes.float16, dtypes.float32, dtypes.float64]: + with self.test_session(): + x = random_ops.random_gamma(shape=[n], alpha=0.001, dtype=dt, seed=0) + self.assertEqual(0, math_ops.reduce_sum(math_ops.cast( + math_ops.less_equal(x, 0.), dtype=dtypes.int64)).eval()) + if __name__ == "__main__": test.main() diff --git a/tensorflow/python/ops/random_ops.py b/tensorflow/python/ops/random_ops.py index 9c606ff76a..19689622b1 100644 --- a/tensorflow/python/ops/random_ops.py +++ b/tensorflow/python/ops/random_ops.py @@ -18,6 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function +import numpy as np from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import random_seed @@ -368,25 +369,12 @@ def random_gamma(shape, samples = tf.random_gamma([30], [[1.],[3.],[5.]], beta=[[3., 4.]]) # samples has shape [30, 3, 2], with 30 samples each of 3x2 distributions. - Note that for small alpha values, there is a chance you will draw a value of - exactly 0, which gets worse for lower-precision dtypes, even though zero is - not in the support of the gamma distribution. - - Relevant cdfs (~chance you will draw a exactly-0 value): - ``` - stats.gamma(.01).cdf(np.finfo(np.float16).tiny) - 0.91269738769897879 - stats.gamma(.01).cdf(np.finfo(np.float32).tiny) - 0.41992668622045726 - stats.gamma(.01).cdf(np.finfo(np.float64).tiny) - 0.00084322740680686662 - stats.gamma(.35).cdf(np.finfo(np.float16).tiny) - 0.037583276135263931 - stats.gamma(.35).cdf(np.finfo(np.float32).tiny) - 5.9514895726818067e-14 - stats.gamma(.35).cdf(np.finfo(np.float64).tiny) - 2.3529843400647272e-108 - ``` + Note: Because internal calculations are done using `float64` and casting has + `floor` semantics, we must manually map zero outcomes to the smallest + possible positive floating-point value, i.e., `np.finfo(dtype).tiny`. This + means that `np.finfo(dtype).tiny` occurs more frequently than it otherwise + should. This bias can only happen for small values of `alpha`, i.e., + `alpha << 1` or large values of `beta`, i.e., `beta >> 1`. Args: shape: A 1-D integer Tensor or Python array. The shape of the output samples @@ -416,9 +404,10 @@ def random_gamma(shape, beta if beta is not None else 1, name="beta", dtype=dtype) alpha_broadcast = alpha + array_ops.zeros_like(beta) seed1, seed2 = random_seed.get_seed(seed) - return gen_random_ops._random_gamma( - shape, alpha_broadcast, seed=seed1, seed2=seed2) / beta - + return math_ops.maximum( + np.finfo(dtype.as_numpy_dtype).tiny, + gen_random_ops._random_gamma( + shape, alpha_broadcast, seed=seed1, seed2=seed2) / beta) ops.NotDifferentiable("RandomGamma") -- GitLab From 23e99cf11c1be75b48fde2076a738add77cce18c Mon Sep 17 00:00:00 2001 From: Jianwei Xie Date: Mon, 27 Feb 2017 12:44:03 -0800 Subject: [PATCH 014/101] Fix assert error in evaluation_test on windows. Change: 148681573 --- tensorflow/python/training/evaluation_test.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tensorflow/python/training/evaluation_test.py b/tensorflow/python/training/evaluation_test.py index 98db0370a6..c7ffd8c60b 100644 --- a/tensorflow/python/training/evaluation_test.py +++ b/tensorflow/python/training/evaluation_test.py @@ -88,17 +88,18 @@ class EvaluateOnceTest(test.TestCase): tf_labels = constant_op.constant(self._labels, dtype=dtypes.float32) tf_predictions = logistic_classifier(tf_inputs) - loss = losses.log_loss(labels=tf_labels, predictions=tf_predictions) + loss_op = losses.log_loss(labels=tf_labels, predictions=tf_predictions) optimizer = gradient_descent.GradientDescentOptimizer(learning_rate=1.0) - train_op = optimizer.minimize(loss, training.get_or_create_global_step()) + train_op = optimizer.minimize(loss_op, + training.get_or_create_global_step()) with monitored_session.MonitoredTrainingSession( checkpoint_dir=checkpoint_dir, hooks=[basic_session_run_hooks.StopAtStepHook(num_steps)]) as session: loss = None while not session.should_stop(): - loss = session.run(train_op) + _, loss = session.run([train_op, loss_op]) if num_steps >= 300: assert loss < .015 -- GitLab From 89df8c789fc580e895106fccee0a2784181fa5ff Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 27 Feb 2017 12:47:27 -0800 Subject: [PATCH 015/101] Update ops-related pbtxt files. Change: 148681977 --- tensorflow/core/ops/ops.pbtxt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/core/ops/ops.pbtxt b/tensorflow/core/ops/ops.pbtxt index 4e1874f6c0..711571e8b5 100644 --- a/tensorflow/core/ops/ops.pbtxt +++ b/tensorflow/core/ops/ops.pbtxt @@ -23123,7 +23123,7 @@ op { description: "The key for the keyed hash function passed as a list of two uint64\nelements." } summary: "Converts each string in the input Tensor to its hash mod by a number of buckets." - description: "The hash function is deterministic on the content of the string within the\nprocess. The hash function is a keyed hash function, where attribute `key`\ndefines the key of the hash function. `key` is an array of 2 elements.\n\nA strong hash is important when inputs may be malicious, e.g. URLs with\nadditional components. Adversaries could try to make their inputs hash to the\nsame bucket for a denial-of-service attack or to skew the results. A strong\nhash prevents this by making it dificult, if not infeasible, to compute inputs\nthat hash to the same bucket. This comes at a cost of roughly 4x higher compute\ntime than `tf.string_to_hash_bucket_fast`." + description: "The hash function is deterministic on the content of the string within the\nprocess. The hash function is a keyed hash function, where attribute `key`\ndefines the key of the hash function. `key` is an array of 2 elements.\n\nA strong hash is important when inputs may be malicious, e.g. URLs with\nadditional components. Adversaries could try to make their inputs hash to the\nsame bucket for a denial-of-service attack or to skew the results. A strong\nhash prevents this by making it difficult, if not infeasible, to compute inputs\nthat hash to the same bucket. This comes at a cost of roughly 4x higher compute\ntime than `tf.string_to_hash_bucket_fast`." } op { name: "StringToNumber" -- GitLab From e45decb6f5bb9c965653175223827c0c962d41f7 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 27 Feb 2017 12:48:57 -0800 Subject: [PATCH 016/101] Go: Update generated wrapper functions for TensorFlow ops. Change: 148682151 --- tensorflow/go/op/wrappers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/go/op/wrappers.go b/tensorflow/go/op/wrappers.go index ebe4242cc1..7cc11b6e19 100644 --- a/tensorflow/go/op/wrappers.go +++ b/tensorflow/go/op/wrappers.go @@ -8247,7 +8247,7 @@ func SparseAddGrad(scope *Scope, backprop_val_grad tf.Output, a_indices tf.Outpu // A strong hash is important when inputs may be malicious, e.g. URLs with // additional components. Adversaries could try to make their inputs hash to the // same bucket for a denial-of-service attack or to skew the results. A strong -// hash prevents this by making it dificult, if not infeasible, to compute inputs +// hash prevents this by making it difficult, if not infeasible, to compute inputs // that hash to the same bucket. This comes at a cost of roughly 4x higher compute // time than `tf.string_to_hash_bucket_fast`. // -- GitLab From 1c707ac780313f48a6733dc3beedf4b8a2b3df77 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 27 Feb 2017 12:50:37 -0800 Subject: [PATCH 017/101] We've moved from using the docs in g3doc/ to docs_src/ files, which get additional processing before being published. Change: 148682342 --- tensorflow/{g3doc => docs_src}/__init__.py | 0 tensorflow/docs_src/about/bib.md | 56 + .../resources => docs_src/about}/index.md | 22 +- tensorflow/docs_src/about/leftnav_files | 3 + .../resources => docs_src/about}/roadmap.md | 0 .../resources => docs_src/about}/uses.md | 0 tensorflow/docs_src/api_guides/cc/guide.md | 282 + .../docs_src/api_guides/python/_toc.yaml | 91 + .../docs_src/api_guides/python/array_ops.md | 87 + .../docs_src/api_guides/python/check_ops.md | 19 + .../docs_src/api_guides/python/client.md | 36 + .../docs_src/api_guides/python/constant_op.md | 87 + .../python/contrib.bayesflow.entropy.md | 47 + .../python/contrib.bayesflow.monte_carlo.md | 54 + .../contrib.bayesflow.stochastic_graph.md | 8 + .../contrib.bayesflow.stochastic_tensor.md | 24 + ...contrib.bayesflow.variational_inference.md | 11 + .../api_guides/python/contrib.copy_graph.md | 4 + .../docs_src/api_guides/python/contrib.crf.md | 11 + .../python/contrib.distributions.bijector.md | 33 + .../python/contrib.distributions.md | 84 + .../api_guides/python/contrib.ffmpeg.md | 23 + .../api_guides/python/contrib.framework.md | 61 + .../api_guides/python/contrib.graph_editor.md | 182 + .../api_guides/python/contrib.integrate.md | 41 + .../api_guides/python/contrib.layers.md | 109 + .../api_guides/python/contrib.learn.md | 62 + .../api_guides/python/contrib.linalg.md | 30 + .../api_guides/python/contrib.losses.md | 126 + .../api_guides/python/contrib.metrics.md | 133 + .../docs_src/api_guides/python/contrib.opt.md | 4 + .../docs_src/api_guides/python/contrib.rnn.md | 61 + .../api_guides/python/contrib.training.md | 50 + .../api_guides/python/contrib.util.md | 12 + .../api_guides/python/control_flow_ops.md | 57 + .../docs_src/api_guides/python/framework.md | 51 + .../api_guides/python/functional_ops.md | 18 + .../api_guides/python/histogram_ops.md | 6 + .../docs_src/api_guides/python/image.md | 143 + .../docs_src/api_guides/python/index.md | 46 + .../docs_src/api_guides/python/io_ops.md | 130 + .../docs_src/api_guides/python/math_ops.md | 204 + tensorflow/docs_src/api_guides/python/nn.md | 290 + .../docs_src/api_guides/python/python_io.md | 29 + .../docs_src/api_guides/python/script_ops.md | 13 + .../docs_src/api_guides/python/session_ops.md | 15 + .../docs_src/api_guides/python/sparse_ops.md | 45 + .../docs_src/api_guides/python/state_ops.md | 108 + .../docs_src/api_guides/python/string_ops.md | 34 + .../docs_src/api_guides/python/summary.md | 23 + tensorflow/docs_src/api_guides/python/test.md | 44 + .../docs_src/api_guides/python/tfdbg.md | 50 + .../docs_src/api_guides/python/train.md | 133 + .../community/documentation.md} | 4 +- tensorflow/docs_src/community/leftnav_files | 2 + .../community}/style_guide.md | 2 +- .../deploy/distributed.md} | 20 +- .../index.md => docs_src/deploy/hadoop.md} | 4 +- tensorflow/docs_src/deploy/leftnav_files | 3 + .../index.md => docs_src/deploy/tfserve.md} | 0 tensorflow/docs_src/extend/add_filesys.md | 256 + .../extend/adding_an_op.md} | 366 +- tensorflow/docs_src/extend/architecture.md | 218 + .../extend/estimators.md} | 94 +- .../extend/language_bindings.md} | 3 +- tensorflow/docs_src/extend/leftnav_files | 7 + .../extend/new_data_formats.md} | 47 +- .../extend}/tool_developers/index.md | 0 .../{g3doc => docs_src}/extras/README.txt | 0 .../get_started/embedding_viz.md} | 18 +- .../docs_src/get_started/get_started.md | 447 + .../get_started/graph_viz.md} | 58 +- .../get_started/input_fn.md} | 24 +- tensorflow/docs_src/get_started/leftnav_files | 10 + .../get_started/mnist/beginners.md} | 24 +- .../get_started/mnist/mechanics.md} | 63 +- .../get_started/mnist/pros.md} | 20 +- .../get_started/monitors.md} | 49 +- .../get_started/summaries_and_tensorboard.md} | 20 +- .../get_started/tflearn.md} | 93 +- tensorflow/docs_src/install/index.md | 10 + tensorflow/docs_src/install/install_linux.md | 728 + tensorflow/docs_src/install/install_mac.md | 699 + .../docs_src/install/install_sources.md | 396 + .../docs_src/install/install_windows.md | 197 + tensorflow/docs_src/install/leftnav_files | 5 + tensorflow/docs_src/install/migration.md | 337 + .../performance}/leftnav_files | 9 +- .../docs_src/performance/performance_guide.md | 143 + .../performance/quantization.md} | 6 +- .../performance}/xla/broadcasting.md | 0 .../xla/developing_new_backend.md | 0 .../performance}/xla/index.md | 12 +- .../performance}/xla/jit.md | 37 +- .../performance}/xla/operation_semantics.md | 19 +- .../performance}/xla/shapes.md | 0 .../performance}/xla/tfcompile.md | 32 +- .../programmers_guide}/data_versions.md | 2 +- .../programmers_guide/debugger.md} | 27 +- .../programmers_guide}/dims_types.md | 2 +- .../programmers_guide}/faq.md | 129 +- .../docs_src/programmers_guide/leftnav_files | 12 + .../programmers_guide/meta_graph.md} | 12 +- .../programmers_guide/reading_data.md} | 72 +- .../programmers_guide/supervisor.md} | 38 +- .../programmers_guide}/tfdbg-tflearn.md | 17 +- .../threading_and_queues.md} | 20 +- .../programmers_guide/variable_scope.md} | 6 +- .../programmers_guide/variables.md} | 24 +- .../programmers_guide/version_semantics.md} | 89 +- .../tutorials/deep_cnn.md} | 106 +- .../tutorials/image_recognition.md} | 21 +- .../tutorials/image_retraining.md} | 11 +- .../index.md => docs_src/tutorials/layers.md} | 165 +- tensorflow/docs_src/tutorials/leftnav_files | 13 + .../tutorials/linear.md} | 8 +- .../tutorials/mandelbrot.md} | 2 +- .../index.md => docs_src/tutorials/pdes.md} | 4 +- .../tutorials/recurrent.md} | 2 +- .../tutorials/seq2seq.md} | 12 +- .../tutorials/using_gpu.md} | 2 +- .../index.md => docs_src/tutorials/wide.md} | 12 +- .../tutorials/wide_and_deep.md} | 17 +- .../tutorials/word2vec.md} | 16 +- tensorflow/g3doc/README.txt | 46 + tensorflow/g3doc/api_docs/cc/ClassEnv.md | 253 - .../g3doc/api_docs/cc/ClassEnvWrapper.md | 97 - .../api_docs/cc/ClassPartialTensorShape.md | 139 - .../cc/ClassPartialTensorShapeUtils.md | 25 - .../api_docs/cc/ClassRandomAccessFile.md | 31 - tensorflow/g3doc/api_docs/cc/ClassSession.md | 124 - tensorflow/g3doc/api_docs/cc/ClassStatus.md | 85 - tensorflow/g3doc/api_docs/cc/ClassTensor.md | 382 - .../g3doc/api_docs/cc/ClassTensorShape.md | 221 - .../api_docs/cc/ClassTensorShapeUtils.md | 85 - tensorflow/g3doc/api_docs/cc/ClassThread.md | 19 - .../g3doc/api_docs/cc/ClassWritableFile.md | 43 - .../g3doc/api_docs/cc/StructSessionOptions.md | 39 - tensorflow/g3doc/api_docs/cc/StructState.md | 19 - .../g3doc/api_docs/cc/StructTensorShapeDim.md | 19 - .../g3doc/api_docs/cc/StructThreadOptions.md | 19 - tensorflow/g3doc/api_docs/cc/index.md | 56 - tensorflow/g3doc/api_docs/index.md | 21 - tensorflow/g3doc/api_docs/leftnav_files | 60 - tensorflow/g3doc/api_docs/python/array_ops.md | 3168 -- tensorflow/g3doc/api_docs/python/check_ops.md | 510 - tensorflow/g3doc/api_docs/python/client.md | 1199 - .../g3doc/api_docs/python/constant_op.md | 775 - .../python/contrib.bayesflow.entropy.md | 304 - .../python/contrib.bayesflow.monte_carlo.md | 206 - .../contrib.bayesflow.stochastic_graph.md | 46 - .../contrib.bayesflow.stochastic_tensor.md | 467 - ...contrib.bayesflow.variational_inference.md | 171 - .../api_docs/python/contrib.copy_graph.md | 86 - .../g3doc/api_docs/python/contrib.crf.md | 212 - .../python/contrib.distributions.bijector.md | 4336 --- .../api_docs/python/contrib.distributions.md | 27438 ---------------- .../g3doc/api_docs/python/contrib.ffmpeg.md | 61 - .../api_docs/python/contrib.framework.md | 1205 - .../api_docs/python/contrib.graph_editor.md | 2054 -- .../api_docs/python/contrib.integrate.md | 100 - .../g3doc/api_docs/python/contrib.layers.md | 2340 -- .../g3doc/api_docs/python/contrib.learn.md | 5510 ---- .../api_docs/python/contrib.learn.monitors.md | 2684 -- .../api_docs/python/contrib.legacy_seq2seq.md | 587 - .../g3doc/api_docs/python/contrib.linalg.md | 4413 --- .../g3doc/api_docs/python/contrib.losses.md | 472 - .../g3doc/api_docs/python/contrib.metrics.md | 1971 -- .../g3doc/api_docs/python/contrib.opt.md | 454 - .../g3doc/api_docs/python/contrib.rnn.md | 2203 -- .../g3doc/api_docs/python/contrib.training.md | 1057 - .../g3doc/api_docs/python/contrib.util.md | 157 - .../g3doc/api_docs/python/control_flow_ops.md | 808 - tensorflow/g3doc/api_docs/python/framework.md | 3969 --- .../g3doc/api_docs/python/functional_ops.md | 299 - .../shard0/tf.PriorityQueue.from_list.md | 21 - .../shard0/tf.ReaderBase.md | 183 - .../shard0/tf.SparseFeature.md | 78 - .../shard0/tf.SparseTensorValue.md | 50 - .../shard0/tf.TensorArray.md | 281 - .../shard0/tf.TensorShape.md | 397 - .../shard0/tf.VarLenFeature.__new__.md | 4 - .../shard0/tf.VariableScope.md | 159 - .../shard0/tf.add_check_numerics_ops.md | 13 - .../functions_and_classes/shard0/tf.add_n.md | 20 - .../shard0/tf.add_to_collection.md | 14 - .../shard0/tf.assert_greater_equal.md | 31 - .../shard0/tf.assert_non_positive.md | 29 - .../functions_and_classes/shard0/tf.case.md | 75 - .../shard0/tf.cholesky.md | 20 - .../functions_and_classes/shard0/tf.cond.md | 54 - ...chastic_tensor.ObservedStochasticTensor.md | 89 - .../tf.contrib.distributions.Bernoulli.md | 593 - .../tf.contrib.distributions.Chi2WithAbsDf.md | 572 - .../tf.contrib.distributions.Dirichlet.md | 682 - .../tf.contrib.distributions.Distribution.md | 690 - ...ions.GammaWithSoftplusConcentrationRate.md | 565 - ...verseGammaWithSoftplusConcentrationRate.md | 578 - .../tf.contrib.distributions.RegisterKL.md | 43 - ....distributions.RelaxedOneHotCategorical.md | 650 - ...ributions.bijector.CholeskyOuterProduct.md | 301 - ....distributions.bijector.SigmoidCentered.md | 276 - ...ontrib.framework.assign_from_checkpoint.md | 27 - .../tf.contrib.framework.deprecated_args.md | 41 - ...contrib.graph_editor.add_control_inputs.md | 18 - .../tf.contrib.graph_editor.detach_inputs.md | 24 - .../tf.contrib.graph_editor.filter_ops.md | 20 - ...aph_editor.make_placeholder_from_tensor.md | 23 - ...f.contrib.graph_editor.placeholder_name.md | 23 - .../tf.contrib.graph_editor.select_ops.md | 30 - .../tf.contrib.graph_editor.swap_inputs.md | 4 - .../tf.contrib.graph_editor.swap_ios.md | 4 - ...f.contrib.layers.convolution2d_in_plane.md | 49 - .../tf.contrib.layers.l2_regularizer.md | 21 - .../tf.contrib.layers.real_valued_column.md | 44 - ....contrib.layers.sparse_column_with_keys.md | 27 - ...f.contrib.layers.weighted_sparse_column.md | 43 - .../tf.contrib.learn.LinearRegressor.md | 412 - .../shard0/tf.contrib.learn.ModelFnOps.md | 135 - .../tf.contrib.learn.extract_pandas_matrix.md | 13 - .../tf.contrib.learn.make_export_strategy.md | 28 - ...rn.monitors.replace_monitors_with_hooks.md | 19 - ...ontrib.learn.read_batch_record_features.md | 32 - ...ontrib.legacy_seq2seq.attention_decoder.md | 60 - ...ib.legacy_seq2seq.embedding_rnn_decoder.md | 48 - ...ib.legacy_seq2seq.embedding_rnn_seq2seq.md | 46 - ...tf.contrib.legacy_seq2seq.sequence_loss.md | 26 - .../tf.contrib.linalg.LinearOperatorDiag.md | 532 - .../shard0/tf.contrib.losses.get_losses.md | 18 - .../shard0/tf.contrib.metrics.set_size.md | 22 - ...f.contrib.metrics.streaming_mean_tensor.md | 48 - .../tf.contrib.rnn.AttentionCellWrapper.md | 77 - .../shard0/tf.contrib.rnn.MultiRNNCell.md | 66 - .../tf.contrib.rnn.OutputProjectionWrapper.md | 68 - ...rib.rnn.stack_bidirectional_dynamic_rnn.md | 50 - .../tf.contrib.training.weighted_resample.md | 25 - .../tf.contrib.util.ops_used_by_graph_def.md | 15 - .../tf.convert_to_tensor_or_sparse_tensor.md | 22 - .../shard0/tf.cumprod.md | 44 - .../shard0/tf.delete_session_tensor.md | 20 - .../shard0/tf.depth_to_space.md | 95 - .../functions_and_classes/shard0/tf.device.md | 19 - .../shard0/tf.errors.CancelledError.md | 17 - .../shard0/tf.errors.DataLossError.md | 13 - .../shard0/tf.errors.DeadlineExceededError.md | 11 - ...f.fake_quant_with_min_max_vars_gradient.md | 27 - ..._with_min_max_vars_per_channel_gradient.md | 30 - .../functions_and_classes/shard0/tf.fft.md | 18 - .../functions_and_classes/shard0/tf.fft2d.md | 22 - .../shard0/tf.floormod.md | 21 - .../shard0/tf.get_seed.md | 22 - .../shard0/tf.get_session_handle.md | 40 - .../shard0/tf.global_norm.md | 27 - .../functions_and_classes/shard0/tf.ifft3d.md | 22 - .../shard0/tf.image.adjust_brightness.md | 25 - .../shard0/tf.image.adjust_gamma.md | 28 - .../shard0/tf.image.decode_jpeg.md | 48 - .../shard0/tf.image.grayscale_to_rgb.md | 17 - .../shard0/tf.image.random_brightness.md | 25 - .../shard0/tf.image.rgb_to_grayscale.md | 19 - .../shard0/tf.is_finite.md | 18 - .../functions_and_classes/shard0/tf.is_nan.md | 18 - .../shard0/tf.is_non_decreasing.md | 25 - .../shard0/tf.is_numeric_tensor.md | 4 - .../functions_and_classes/shard0/tf.mod.md | 21 - .../shard0/tf.name_scope.md | 39 - .../shard0/tf.nn.avg_pool3d.md | 24 - .../shard0/tf.nn.conv2d_backprop_filter.md | 37 - .../shard0/tf.nn.ctc_loss.md | 103 - .../shard0/tf.nn.l2_normalize.md | 25 - .../functions_and_classes/shard0/tf.norm.md | 66 - .../shard0/tf.not_equal.md | 18 - .../shard0/tf.orthogonal_initializer.md | 31 - .../shard0/tf.py_func.md | 51 - .../shard0/tf.quantize_v2.md | 74 - .../shard0/tf.reduce_sum.md | 42 - .../shard0/tf.reshape.md | 73 - .../shard0/tf.reverse_sequence.md | 76 - .../shard0/tf.segment_min.md | 31 - .../shard0/tf.sparse_tensor_to_dense.md | 43 - .../functions_and_classes/shard0/tf.sqrt.md | 17 - .../tf.summary.FileWriterCache.clear.md | 4 - .../shard0/tf.summary.TaggedRunMetadata.md | 252 - .../shard0/tf.summary.merge_all.md | 16 - .../tf.train.ExponentialMovingAverage.md | 232 - .../shard0/tf.train.GlobalStepWaiterHook.md | 87 - .../shard0/tf.train.SessionRunArgs.__new__.md | 4 - .../shard0/tf.train.SessionRunHook.md | 97 - .../shard0/tf.train.add_queue_runner.md | 18 - .../shard0/tf.train.limit_epochs.md | 24 - .../functions_and_classes/shard0/tf.tuple.md | 36 - .../shard0/tf.zeros_initializer.md | 15 - .../tf_debug.DumpingDebugWrapperSession.md | 140 - .../tf_debug.watch_graph_with_blacklists.md | 31 - .../shard1/tf.AggregationMethod.md | 10 - .../shard1/tf.ConditionalAccumulatorBase.md | 79 - .../shard1/tf.FIFOQueue.md | 299 - .../shard1/tf.IdentityReader.md | 175 - .../shard1/tf.NoGradient.md | 32 - .../functions_and_classes/shard1/tf.Print.md | 23 - .../functions_and_classes/shard1/tf.Tensor.md | 940 - .../shard1/tf.Variable.from_proto.md | 4 - .../shard1/tf.accumulate_n.md | 40 - .../shard1/tf.all_variables.md | 8 - .../shard1/tf.assert_less_equal.md | 30 - .../shard1/tf.assert_rank_at_least.md | 33 - .../functions_and_classes/shard1/tf.assign.md | 28 - .../shard1/tf.batch_to_space.md | 100 - .../shard1/tf.constant_initializer.md | 86 - ....stochastic_tensor.BaseStochasticTensor.md | 58 - ...ib.bayesflow.variational_inference.elbo.md | 71 - .../tf.contrib.crf.crf_log_likelihood.md | 22 - ...ib.distributions.MultivariateNormalDiag.md | 771 - ...MultivariateNormalDiagWithSoftplusScale.md | 619 - ...rib.distributions.QuantizedDistribution.md | 740 - .../tf.contrib.distributions.StudentT.md | 683 - ...ibutions.StudentTWithAbsDfSoftplusScale.md | 583 - ...b.distributions.TransformedDistribution.md | 710 - ...contrib.framework.get_graph_from_inputs.md | 32 - ...f.contrib.framework.get_local_variables.md | 14 - ...contrib.framework.get_variables_by_name.md | 14 - ....contrib.framework.init_from_checkpoint.md | 72 - ...ontrib.graph_editor.compute_boundary_ts.md | 32 - ...contrib.graph_editor.get_name_scope_ops.md | 19 - .../tf.contrib.graph_editor.make_list_of_t.md | 22 - .../tf.contrib.graph_editor.reroute_ios.md | 4 - ...h_editor.transform_op_if_inside_handler.md | 19 - .../shard1/tf.contrib.integrate.odeint.md | 90 - .../tf.contrib.layers.embedding_column.md | 37 - .../shard1/tf.contrib.layers.flatten.md | 22 - ..._place_holder_tensors_for_base_features.md | 15 - .../tf.contrib.layers.summarize_tensors.md | 4 - .../tf.contrib.learn.LinearClassifier.md | 467 - .../shard1/tf.contrib.learn.PredictionKey.md | 1 - .../tf.contrib.learn.extract_pandas_data.md | 21 - ...infer_real_valued_columns_from_input_fn.md | 19 - ...b.learn.monitors.SummaryWriterCache.get.md | 13 - ...ontrib.learn.monitors.ValidationMonitor.md | 242 - .../shard1/tf.contrib.learn.train.md | 75 - ...ontrib.linalg.LinearOperatorComposition.md | 536 - ...f.contrib.linalg.LinearOperatorIdentity.md | 562 - .../tf.contrib.losses.absolute_difference.md | 35 - ...tf.contrib.losses.compute_weighted_loss.md | 26 - .../shard1/tf.contrib.losses.hinge_loss.md | 26 - ...ib.metrics.streaming_mean_squared_error.md | 51 - ...ib.metrics.streaming_sparse_recall_at_k.md | 74 - ...f.contrib.opt.VariableClippingOptimizer.md | 66 - .../shard1/tf.contrib.rnn.BasicLSTMCell.md | 72 - .../shard1/tf.contrib.rnn.GRUCell.md | 51 - .../shard1/tf.contrib.rnn.GridLSTMCell.md | 134 - .../tf.contrib.rnn.TimeReversedFusedRNN.md | 25 - .../tf.contrib.rnn.static_state_saving_rnn.md | 33 - .../tf.contrib.training.resample_at_rate.md | 36 - .../shard1/tf.contrib.util.constant_value.md | 31 - .../shard1/tf.convert_to_tensor.md | 50 - .../functions_and_classes/shard1/tf.diag.md | 33 - .../functions_and_classes/shard1/tf.divide.md | 4 - .../functions_and_classes/shard1/tf.einsum.md | 74 - .../functions_and_classes/shard1/tf.erf.md | 15 - .../shard1/tf.errors.AlreadyExistsError.md | 14 - ...f.fake_quant_with_min_max_args_gradient.md | 21 - .../shard1/tf.get_default_session.md | 16 - .../shard1/tf.gradients.md | 48 - .../shard1/tf.greater_equal.md | 18 - .../shard1/tf.igammac.md | 29 - .../shard1/tf.image.adjust_hue.md | 26 - .../shard1/tf.image.central_crop.md | 30 - .../shard1/tf.image.random_hue.md | 28 - .../shard1/tf.image.resize_bicubic.md | 24 - .../shard1/tf.invert_permutation.md | 30 - .../shard1/tf.is_strictly_increasing.md | 26 - .../shard1/tf.linspace.md | 29 - .../functions_and_classes/shard1/tf.log1p.md | 16 - .../functions_and_classes/shard1/tf.map_fn.md | 96 - .../shard1/tf.matching_files.md | 18 - .../shard1/tf.negative.md | 17 - .../shard1/tf.nn.compute_accidental_hits.md | 45 - .../shard1/tf.nn.conv1d.md | 50 - .../shard1/tf.nn.embedding_lookup_sparse.md | 76 - .../shard1/tf.nn.erosion2d.md | 52 - .../shard1/tf.nn.moments.md | 35 - .../shard1/tf.nn.normalize_moments.md | 20 - .../shard1/tf.nn.sampled_softmax_loss.md | 49 - .../shard1/tf.parse_single_example.md | 38 - .../functions_and_classes/shard1/tf.qr.md | 36 - .../shard1/tf.random_uniform_initializer.md | 25 - .../shard1/tf.read_file.md | 14 - .../shard1/tf.reduce_any.md | 40 - .../shard1/tf.reduce_join.md | 46 - .../shard1/tf.reduce_logsumexp.md | 42 - .../shard1/tf.sparse_minimum.md | 28 - .../shard1/tf.string_to_hash_bucket_strong.md | 30 - .../shard1/tf.test.Benchmark.md | 61 - .../shard1/tf.test.get_temp_dir.md | 10 - .../shard1/tf.train.AdadeltaOptimizer.md | 176 - .../shard1/tf.train.ClusterSpec.md | 210 - .../tf.train.GradientDescentOptimizer.md | 18 - .../shard1/tf.train.LoggingTensorHook.md | 85 - .../shard1/tf.train.LooperThread.md | 222 - .../shard1/tf.train.MonitoredSession.md | 128 - .../tf.train.MonitoredTrainingSession.md | 44 - .../shard1/tf.train.NanTensorHook.md | 80 - .../tf.train.Server.create_local_server.md | 21 - ...f.train.generate_checkpoint_state_proto.md | 20 - .../shard1/tf.train.maybe_batch.md | 41 - .../shard1/tf.train.shuffle_batch_join.md | 77 - .../shard1/tf.unsorted_segment_max.md | 38 - .../shard1/tf.unstack.md | 42 - .../functions_and_classes/shard1/tf.zeros.md | 24 - .../shard1/tf.zeros_like.md | 30 - .../shard1/tf_debug.LocalCLIDebugHook.md | 256 - .../functions_and_classes/shard2/tf.DType.md | 250 - .../shard2/tf.FIFOQueue.from_list.md | 21 - .../functions_and_classes/shard2/tf.Graph.md | 885 - .../shard2/tf.InteractiveSession.md | 346 - .../shard2/tf.SparseFeature.__new__.md | 4 - .../shard2/tf.SparseTensorValue.__new__.md | 4 - .../shard2/tf.TFRecordReader.md | 173 - .../shard2/tf.TextLineReader.md | 175 - .../shard2/tf.WholeFileReader.md | 175 - .../shard2/tf.assert_non_negative.md | 29 - .../shard2/tf.betainc.md | 30 - .../shard2/tf.cholesky_solve.md | 35 - .../shard2/tf.constant.md | 53 - ...ntrib.bayesflow.monte_carlo.expectation.md | 56 - .../tf.contrib.copy_graph.get_copied_op.md | 18 - .../tf.contrib.crf.CrfForwardRnnCell.md | 73 - .../shard2/tf.contrib.crf.crf_binary_score.md | 16 - .../tf.contrib.distributions.Categorical.md | 629 - .../shard2/tf.contrib.distributions.Chi2.md | 612 - ...b.distributions.ConditionalDistribution.md | 476 - ...ib.distributions.ReparameterizationType.md | 47 - .../tf.contrib.distributions.Uniform.md | 625 - ...f.contrib.distributions.WishartCholesky.md | 673 - ...contrib.distributions.bijector.Bijector.md | 509 - .../shard2/tf.contrib.framework.arg_scope.md | 26 - .../tf.contrib.framework.assert_scalar_int.md | 19 - ...contrib.framework.deprecated_arg_values.md | 35 - ...f.contrib.framework.get_unique_variable.md | 18 - ...trib.framework.get_variables_to_restore.md | 23 - .../tf.contrib.framework.load_checkpoint.md | 18 - .../tf.contrib.framework.with_same_shape.md | 14 - .../tf.contrib.graph_editor.SubGraphView.md | 472 - ...tf.contrib.graph_editor.TransformerInfo.md | 67 - .../shard2/tf.contrib.graph_editor.copy.md | 31 - ...ntrib.graph_editor.filter_ts_from_regex.md | 21 - ...graph_editor.keep_t_if_possible_handler.md | 18 - ...ontrib.layers.infer_real_valued_columns.md | 4 - .../shard2/tf.contrib.layers.optimize_loss.md | 83 - .../shard2/tf.contrib.layers.repeat.md | 36 - ...rib.layers.safe_embedding_lookup_sparse.md | 50 - ...contrib.layers.shared_embedding_columns.md | 48 - ...ayers.weighted_sum_from_feature_columns.md | 54 - .../shard2/tf.contrib.learn.BaseEstimator.md | 305 - .../shard2/tf.contrib.learn.ModeKeys.md | 7 - .../tf.contrib.learn.ModelFnOps.__new__.md | 54 - .../shard2/tf.contrib.learn.ProblemType.md | 10 - ....contrib.learn.monitors.CaptureVariable.md | 199 - ...tf.contrib.learn.monitors.ExportMonitor.md | 248 - .../tf.contrib.learn.monitors.GraphDump.md | 163 - .../tf.contrib.learn.monitors.NanLoss.md | 184 - .../tf.contrib.learn.monitors.StepCounter.md | 171 - ...acy_seq2seq.embedding_attention_decoder.md | 52 - ...acy_seq2seq.embedding_attention_seq2seq.md | 50 - .../tf.contrib.legacy_seq2seq.rnn_decoder.md | 31 - .../tf.contrib.metrics.set_difference.md | 64 - .../tf.contrib.metrics.streaming_auc.md | 64 - ...tf.contrib.metrics.streaming_covariance.md | 55 - ...streaming_false_negatives_at_thresholds.md | 4 - .../tf.contrib.metrics.streaming_mean.md | 44 - ...b.metrics.streaming_mean_relative_error.md | 52 - ...metrics.streaming_sparse_precision_at_k.md | 77 - .../tf.contrib.opt.ScipyOptimizerInterface.md | 87 - .../shard2/tf.contrib.rnn.GRUBlockCell.md | 84 - ...tf.contrib.rnn.static_bidirectional_rnn.md | 48 - .../shard2/tf.digamma.md | 16 - .../shard2/tf.edit_distance.md | 65 - .../shard2/tf.encode_base64.md | 23 - .../tf.errors.ResourceExhaustedError.md | 12 - .../shard2/tf.expand_dims.md | 54 - .../shard2/tf.floor_div.md | 18 - .../shard2/tf.gather_nd.md | 110 - .../shard2/tf.get_variable_scope.md | 4 - .../shard2/tf.global_variables_initializer.md | 10 - .../shard2/tf.identity.md | 14 - .../functions_and_classes/shard2/tf.imag.md | 28 - .../shard2/tf.image.crop_and_resize.md | 50 - .../shard2/tf.image.encode_jpeg.md | 51 - .../shard2/tf.initialize_all_variables.md | 8 - .../shard2/tf.initialize_local_variables.md | 8 - .../shard2/tf.is_variable_initialized.md | 14 - .../shard2/tf.local_variables_initializer.md | 10 - .../functions_and_classes/shard2/tf.matmul.md | 90 - .../shard2/tf.minimum.md | 18 - .../shard2/tf.nn.conv3d_backprop_filter_v2.md | 28 - ....depthwise_conv2d_native_backprop_input.md | 29 - .../shard2/tf.nn.embedding_lookup.md | 56 - .../tf.nn.log_uniform_candidate_sampler.md | 56 - .../shard2/tf.nn.relu.md | 14 - .../shard2/tf.parallel_stack.md | 41 - .../shard2/tf.random_uniform.md | 41 - .../functions_and_classes/shard2/tf.real.md | 29 - .../tf.report_uninitialized_variables.md | 19 - .../tf.required_space_to_batch_paddings.md | 35 - .../shard2/tf.scatter_nd_sub.md | 61 - .../shard2/tf.scatter_update.md | 46 - .../shard2/tf.setdiff1d.md | 41 - .../shard2/tf.shape_n.md | 17 - .../functions_and_classes/shard2/tf.sin.md | 14 - .../shard2/tf.space_to_batch_nd.md | 137 - .../shard2/tf.sparse_placeholder.md | 43 - .../functions_and_classes/shard2/tf.split.md | 53 - .../shard2/tf.squeeze.md | 44 - .../shard2/tf.string_split.md | 43 - .../shard2/tf.summary.SummaryDescription.md | 245 - .../shard2/tf.summary.audio.md | 35 - .../shard2/tf.summary.tensor_summary.md | 23 - .../shard2/tf.tables_initializer.md | 14 - .../shard2/tf.test.TestCase.md | 875 - .../shard2/tf.test.assert_equal_graph_def.md | 22 - .../shard2/tf.test.compute_gradient.md | 42 - .../shard2/tf.test.is_built_with_cuda.md | 4 - .../shard2/tf.to_int32.md | 19 - .../shard2/tf.train.CheckpointSaverHook.md | 77 - .../shard2/tf.train.Saver.from_proto.md | 14 - .../shard2/tf.train.SessionCreator.md | 8 - .../shard2/tf.train.basic_train_loop.md | 24 - .../shard2/tf.train.global_step.md | 26 - .../shard2/tf.train.latest_checkpoint.md | 16 - .../tf.train.maybe_shuffle_batch_join.md | 42 - .../shard2/tf.train.natural_exp_decay.md | 56 - .../shard2/tf.train.shuffle_batch.md | 86 - .../shard2/tf.train.start_queue_runners.md | 24 - .../tf.uniform_unit_scaling_initializer.md | 38 - .../shard2/tf.variables_initializer.md | 24 - .../shard2/tf.write_file.md | 17 - .../shard3/tf.PriorityQueue.md | 305 - .../shard3/tf.RegisterGradient.md | 45 - .../shard3/tf.SparseTensor.md | 248 - .../shard3/tf.assert_rank.md | 32 - .../shard3/tf.assert_type.md | 22 - .../functions_and_classes/shard3/tf.ceil.md | 14 - .../shard3/tf.check_numerics.md | 18 - ...bayesflow.stochastic_tensor.SampleValue.md | 80 - ...iational_inference.ELBOForms.check_form.md | 4 - .../tf.contrib.copy_graph.copy_op_to_graph.md | 29 - .../tf.contrib.distributions.Binomial.md | 687 - ...trib.distributions.DirichletMultinomial.md | 726 - ...stributions.ExpRelaxedOneHotCategorical.md | 688 - .../tf.contrib.distributions.Exponential.md | 608 - .../shard3/tf.contrib.distributions.Gamma.md | 639 - .../tf.contrib.distributions.InverseGamma.md | 653 - .../tf.contrib.distributions.Multinomial.md | 697 - ...b.distributions.NormalWithSoftplusScale.md | 559 - ...contrib.distributions.OneHotCategorical.md | 637 - .../shard3/tf.contrib.ffmpeg.encode_audio.md | 19 - ...tf.contrib.framework.add_model_variable.md | 9 - ...f.contrib.framework.get_model_variables.md | 14 - .../tf.contrib.framework.local_variable.md | 15 - ...tf.contrib.graph_editor.copy_op_handler.md | 15 - .../tf.contrib.graph_editor.detach_outputs.md | 25 - ...trib.graph_editor.filter_ops_from_regex.md | 21 - .../tf.contrib.graph_editor.filter_ts.md | 20 - .../shard3/tf.contrib.graph_editor.op_type.md | 16 - .../tf.contrib.graph_editor.reroute_inputs.md | 4 - .../tf.contrib.graph_editor.select_ts.md | 30 - .../tf.contrib.graph_editor.swap_outputs.md | 4 - .../tf.contrib.layers.crossed_column.md | 42 - ....contrib.layers.separable_convolution2d.md | 52 - ....sparse_column_with_integerized_feature.md | 43 - .../tf.contrib.layers.summarize_activation.md | 16 - ...rib.layers.variance_scaling_initializer.md | 54 - .../shard3/tf.contrib.learn.Estimator.md | 397 - .../tf.contrib.learn.extract_dask_data.md | 19 - .../tf.contrib.learn.monitors.StopAtStep.md | 154 - .../tf.contrib.learn.monitors.SummarySaver.md | 175 - ...ntrib.learn.monitors.SummaryWriterCache.md | 26 - ...ontrib.legacy_seq2seq.basic_rnn_seq2seq.md | 26 - ...contrib.legacy_seq2seq.tied_rnn_seq2seq.md | 30 - ...rib.linalg.LinearOperatorScaledIdentity.md | 543 - ...contrib.linalg.LinearOperatorUDVHUpdate.md | 600 - .../shard3/tf.contrib.losses.add_loss.md | 14 - .../tf.contrib.losses.cosine_distance.md | 31 - ...ontrib.losses.get_regularization_losses.md | 17 - .../tf.contrib.metrics.auc_using_histogram.md | 38 - .../tf.contrib.metrics.streaming_concat.md | 44 - ....streaming_true_negatives_at_thresholds.md | 4 - ...trib.rnn.CoupledInputForgetGateLSTMCell.md | 127 - .../shard3/tf.contrib.rnn.DropoutWrapper.md | 69 - .../tf.contrib.rnn.InputProjectionWrapper.md | 67 - .../shard3/tf.contrib.rnn.LSTMBlockWrapper.md | 49 - .../shard3/tf.contrib.training.bucket.md | 86 - .../tf.contrib.training.rejection_sample.md | 57 - .../tf.contrib.training.stratified_sample.md | 58 - .../shard3/tf.control_dependencies.md | 20 - .../tf.convert_to_tensor_or_indexed_slices.md | 26 - .../shard3/tf.decode_csv.md | 26 - .../shard3/tf.decode_raw.md | 23 - .../shard3/tf.errors.OutOfRangeError.md | 15 - .../shard3/tf.errors.UnauthenticatedError.md | 11 - .../functions_and_classes/shard3/tf.exp.md | 14 - .../shard3/tf.fake_quant_with_min_max_vars.md | 24 - ...ake_quant_with_min_max_vars_per_channel.md | 25 - .../functions_and_classes/shard3/tf.foldl.md | 44 - .../shard3/tf.global_variables.md | 17 - .../functions_and_classes/shard3/tf.group.md | 25 - .../functions_and_classes/shard3/tf.ifft2d.md | 22 - .../shard3/tf.image.adjust_contrast.md | 29 - .../shard3/tf.image.adjust_saturation.md | 25 - .../shard3/tf.image.convert_image_dtype.md | 32 - .../shard3/tf.image.decode_png.md | 30 - .../shard3/tf.image.random_contrast.md | 26 - .../shard3/tf.image.random_saturation.md | 27 - .../shard3/tf.local_variables.md | 19 - .../shard3/tf.logical_xor.md | 4 - .../shard3/tf.multinomial.md | 28 - .../shard3/tf.nn.dropout.md | 38 - .../shard3/tf.nn.fractional_max_pool.md | 81 - .../shard3/tf.nn.log_softmax.md | 27 - .../shard3/tf.nn.max_pool.md | 22 - .../shard3/tf.nn.quantized_max_pool.md | 31 - .../shard3/tf.nn.quantized_relu_x.md | 24 - .../shard3/tf.nn.softsign.md | 14 - .../shard3/tf.parse_tensor.md | 18 - .../shard3/tf.placeholder.md | 34 - .../shard3/tf.random_gamma.md | 65 - .../shard3/tf.random_shuffle.md | 29 - .../shard3/tf.reduce_min.md | 30 - .../tf.register_tensor_conversion_function.md | 44 - .../shard3/tf.scatter_mul.md | 42 - .../shard3/tf.scatter_nd_add.md | 61 - .../shard3/tf.segment_mean.md | 32 - .../functions_and_classes/shard3/tf.shape.md | 25 - .../shard3/tf.sparse_concat.md | 102 - .../shard3/tf.sparse_softmax.md | 52 - .../shard3/tf.sparse_split.md | 43 - .../shard3/tf.stop_gradient.md | 34 - .../functions_and_classes/shard3/tf.substr.md | 92 - .../functions_and_classes/shard3/tf.svd.md | 47 - .../shard3/tf.test.compute_gradient_error.md | 38 - .../shard3/tf.test.gpu_device_name.md | 4 - .../shard3/tf.test.test_src_dir_path.md | 14 - .../shard3/tf.to_double.md | 19 - .../functions_and_classes/shard3/tf.trace.md | 41 - .../shard3/tf.train.AdagradOptimizer.md | 181 - .../shard3/tf.train.QueueRunner.md | 175 - .../shard3/tf.train.Server.md | 129 - .../shard3/tf.train.SyncReplicasOptimizer.md | 268 - .../shard3/tf.train.assert_global_step.md | 9 - .../shard3/tf.train.batch_join.md | 88 - .../shard3/tf.train.get_checkpoint_mtimes.md | 22 - .../shard3/tf.train.range_input_producer.md | 28 - .../shard3/tf.truncatediv.md | 23 - .../shard3/tf.unique_with_counts.md | 37 - .../shard3/tf_debug.DebugTensorDatum.md | 146 - .../tf_debug.LocalCLIDebugWrapperSession.md | 207 - .../shard3/tf_debug.add_debug_tensor_watch.md | 21 - .../tf_debug.load_tensor_from_event_file.md | 19 - .../functions_and_classes/shard4/tf.Assert.md | 30 - .../shard4/tf.ConditionalAccumulator.md | 136 - .../shard4/tf.FixedLengthRecordReader.md | 175 - .../functions_and_classes/shard4/tf.argmin.md | 17 - .../shard4/tf.assert_less.md | 30 - .../shard4/tf.broadcast_static_shape.md | 19 - .../shard4/tf.clip_by_value.md | 21 - .../shard4/tf.complex.md | 31 - ...flow.stochastic_tensor.StochasticTensor.md | 111 - ...yesflow.variational_inference.ELBOForms.md | 18 - .../shard4/tf.contrib.crf.viterbi_decode.md | 19 - ...f.contrib.distributions.bijector.Invert.md | 307 - ...contrib.distributions.bijector.Softplus.md | 295 - ...ormal_conjugates_known_scale_predictive.md | 55 - ...contrib.framework.VariableDeviceChooser.md | 36 - .../tf.contrib.framework.add_arg_scope.md | 13 - .../tf.contrib.framework.load_variable.md | 14 - .../tf.contrib.graph_editor.OpMatcher.md | 36 - ....contrib.graph_editor.get_consuming_ops.md | 18 - .../tf.contrib.graph_editor.graph_replace.md | 26 - ...tf.contrib.graph_editor.make_list_of_op.md | 24 - ...tf.contrib.graph_editor.reroute_outputs.md | 4 - .../tf.contrib.graph_editor.sgv_scope.md | 14 - .../shard4/tf.contrib.layers.avg_pool2d.md | 32 - .../shard4/tf.contrib.layers.batch_norm.md | 83 - ...tf.contrib.layers.check_feature_columns.md | 15 - .../tf.contrib.layers.one_hot_column.md | 16 - .../tf.contrib.layers.regression_target.md | 22 - .../shard4/tf.contrib.layers.unit_norm.md | 23 - .../shard4/tf.contrib.learn.DNNClassifier.md | 467 - ...ntrib.learn.DNNLinearCombinedClassifier.md | 493 - .../shard4/tf.contrib.learn.Evaluable.md | 77 - .../shard4/tf.contrib.learn.ExportStrategy.md | 89 - .../shard4/tf.contrib.learn.RunConfig.md | 163 - .../shard4/tf.contrib.learn.evaluate.md | 57 - ...rn.infer_real_valued_columns_from_input.md | 16 - ...learn.monitors.SummaryWriterCache.clear.md | 4 - ...rib.learn.monitors.get_default_monitors.md | 18 - .../tf.contrib.learn.read_batch_features.md | 46 - .../shard4/tf.contrib.learn.run_feeds.md | 8 - ...rib.legacy_seq2seq.one2many_rnn_seq2seq.md | 51 - .../tf.contrib.losses.mean_squared_error.md | 35 - .../shard4/tf.contrib.metrics.set_union.md | 63 - ...trics.streaming_precision_at_thresholds.md | 50 - ...f.contrib.metrics.streaming_recall_at_k.md | 55 - ...ics.streaming_sparse_precision_at_top_k.md | 75 - ...ontrib.metrics.streaming_true_positives.md | 37 - .../shard4/tf.contrib.rnn.DeviceWrapper.md | 62 - .../shard4/tf.contrib.rnn.LSTMBlockCell.md | 67 - .../shard4/tf.contrib.rnn.TimeFreqLSTMCell.md | 100 - ...ontrib.training.NextQueuedSequenceBatch.md | 265 - ...ib.training.batch_sequences_with_states.md | 167 - ...contrib.util.stripped_op_list_for_graph.md | 23 - .../shard4/tf.decode_base64.md | 17 - .../tf.errors.FailedPreconditionError.md | 13 - .../shard4/tf.extract_image_patches.md | 40 - .../shard4/tf.fixed_size_partitioner.md | 15 - .../functions_and_classes/shard4/tf.floor.md | 14 - .../shard4/tf.greater.md | 18 - .../shard4/tf.histogram_fixed_width.md | 38 - .../shard4/tf.image.hsv_to_rgb.md | 21 - .../shard4/tf.initialize_variables.md | 8 - .../functions_and_classes/shard4/tf.log.md | 16 - .../shard4/tf.nn.conv2d_backprop_input.md | 37 - .../shard4/tf.nn.conv2d_transpose.md | 37 - .../shard4/tf.nn.ctc_beam_search_decoder.md | 42 - .../shard4/tf.nn.depthwise_conv2d.md | 45 - .../shard4/tf.nn.depthwise_conv2d_native.md | 37 - .../shard4/tf.nn.dilation2d.md | 50 - .../shard4/tf.nn.l2_loss.md | 19 - .../shard4/tf.nn.log_poisson_loss.md | 44 - .../shard4/tf.nn.max_pool3d.md | 23 - .../shard4/tf.nn.nce_loss.md | 58 - .../shard4/tf.nn.softplus.md | 14 - ...parse_softmax_cross_entropy_with_logits.md | 50 - .../shard4/tf.placeholder_with_default.md | 17 - .../tf.python_io.TFRecordCompressionType.md | 1 - .../shard4/tf.reduce_all.md | 40 - .../shard4/tf.reduce_mean.md | 40 - .../shard4/tf.segment_max.md | 30 - .../shard4/tf.self_adjoint_eigvals.md | 16 - .../shard4/tf.sparse_add.md | 55 - .../shard4/tf.sparse_to_indicator.md | 52 - .../functions_and_classes/shard4/tf.stack.md | 44 - .../shard4/tf.string_to_hash_bucket_fast.md | 23 - ...ry.SummaryDescription.RegisterExtension.md | 4 - .../functions_and_classes/shard4/tf.tile.md | 22 - .../tf.train.SingularMonitoredSession.md | 131 - .../shard4/tf.train.WorkerSessionCreator.md | 23 - .../shard4/tf.train.match_filenames_once.md | 14 - .../shard4/tf.train.maybe_batch_join.md | 42 - .../tf.train.update_checkpoint_state.md | 24 - .../shard4/tf.train.write_graph.md | 33 - .../shard4/tf.unsorted_segment_sum.md | 38 - .../shard4/tf.while_loop.md | 117 - .../shard4/tf_debug.DebugDumpDir.md | 548 - .../shard4/tf_debug.DumpingDebugHook.md | 185 - .../shard4/tf_debug.has_inf_or_nan.md | 20 - .../shard5/tf.OpError.md | 66 - .../shard5/tf.RandomShuffleQueue.md | 312 - .../functions_and_classes/shard5/tf.add.md | 18 - .../functions_and_classes/shard5/tf.asin.md | 14 - .../shard5/tf.assert_greater.md | 30 - .../shard5/tf.assert_integer.md | 27 - .../shard5/tf.boolean_mask.md | 43 - .../shard5/tf.broadcast_dynamic_shape.md | 14 - .../functions_and_classes/shard5/tf.cast.md | 30 - .../shard5/tf.clip_by_global_norm.md | 50 - .../shard5/tf.clip_by_norm.md | 37 - .../shard5/tf.container.md | 14 - ...yesflow.stochastic_graph.surrogate_loss.md | 34 - .../shard5/tf.contrib.crf.crf_log_norm.md | 17 - ...f.contrib.distributions.bijector.Affine.md | 399 - ...tf.contrib.distributions.bijector.Chain.md | 324 - .../tf.contrib.distributions.bijector.Exp.md | 305 - ....contrib.framework.arg_scoped_arguments.md | 13 - .../tf.contrib.framework.get_variables.md | 17 - .../tf.contrib.framework.list_variables.md | 13 - .../shard5/tf.contrib.framework.variable.md | 33 - .../shard5/tf.contrib.graph_editor.bypass.md | 23 - .../tf.contrib.graph_editor.can_be_regex.md | 4 - ...rib.graph_editor.detach_control_outputs.md | 11 - ...graph_editor.get_walks_intersection_ops.md | 39 - .../tf.contrib.graph_editor.make_regex.md | 18 - ...trib.graph_editor.remove_control_inputs.md | 19 - .../shard5/tf.contrib.layers.convolution2d.md | 75 - .../tf.contrib.layers.fully_connected.md | 50 - ...f.contrib.layers.legacy_fully_connected.md | 73 - .../tf.contrib.layers.multi_class_target.md | 29 - .../tf.contrib.layers.one_hot_encoding.md | 18 - ...ntrib.layers.scattered_embedding_column.md | 51 - .../tf.contrib.layers.sum_regularizer.md | 15 - .../tf.contrib.layers.summarize_collection.md | 4 - .../tf.contrib.learn.monitors.BaseMonitor.md | 187 - ....contrib.learn.monitors.CheckpointSaver.md | 146 - ...earn.monitors.RunHookAdapterForMonitors.md | 57 - .../shard5/tf.contrib.learn.run_n.md | 23 - ...legacy_seq2seq.sequence_loss_by_example.md | 25 - ...tf.contrib.losses.sigmoid_cross_entropy.md | 39 - .../shard5/tf.contrib.metrics.accuracy.md | 23 - ...ntrib.metrics.streaming_false_positives.md | 37 - ...ntrib.metrics.streaming_percentage_less.md | 43 - ....metrics.streaming_recall_at_thresholds.md | 48 - .../shard5/tf.contrib.rnn.EmbeddingWrapper.md | 71 - .../shard5/tf.contrib.rnn.RNNCell.md | 85 - .../functions_and_classes/shard5/tf.cos.md | 14 - .../shard5/tf.count_nonzero.md | 43 - .../shard5/tf.diag_part.md | 34 - .../functions_and_classes/shard5/tf.div.md | 23 - .../shard5/tf.errors.PermissionDeniedError.md | 14 - .../shard5/tf.errors.UnavailableError.md | 11 - ...errors.raise_exception_on_not_ok_status.md | 4 - .../shard5/tf.floordiv.md | 32 - .../shard5/tf.image.decode_image.md | 26 - .../shard5/tf.image.flip_left_right.md | 23 - .../shard5/tf.image.flip_up_down.md | 23 - .../shard5/tf.image.pad_to_bounding_box.md | 31 - .../tf.image.resize_image_with_crop_or_pad.md | 30 - .../tf.image.resize_nearest_neighbor.md | 22 - .../shard5/tf.image.rot90.md | 15 - .../tf.image.sample_distorted_bounding_box.md | 89 - .../shard5/tf.image.total_variation.md | 40 - .../shard5/tf.load_file_system_library.md | 23 - .../shard5/tf.logical_and.md | 18 - .../shard5/tf.logical_not.md | 14 - .../shard5/tf.make_template.md | 111 - .../shard5/tf.model_variables.md | 8 - .../shard5/tf.nn.atrous_conv2d_transpose.md | 43 - .../shard5/tf.nn.conv3d.md | 29 - ...tf.nn.sigmoid_cross_entropy_with_logits.md | 49 - .../shard5/tf.nn.top_k.md | 31 - .../functions_and_classes/shard5/tf.no_op.md | 13 - .../functions_and_classes/shard5/tf.range.md | 52 - .../shard5/tf.reverse_v2.md | 64 - .../shard5/tf.scatter_nd.md | 94 - .../functions_and_classes/shard5/tf.sign.md | 19 - .../shard5/tf.sparse_maximum.md | 28 - .../shard5/tf.summary.FileWriterCache.get.md | 13 - ...f.summary.SummaryDescription.FromString.md | 4 - .../shard5/tf.summary.image.md | 47 - .../functions_and_classes/shard5/tf.tan.md | 14 - .../shard5/tf.test.main.md | 4 - .../shard5/tf.to_int64.md | 19 - .../shard5/tf.train.ChiefSessionCreator.md | 26 - .../shard5/tf.train.FtrlOptimizer.md | 185 - .../shard5/tf.train.LooperThread.loop.md | 22 - .../shard5/tf.train.NewCheckpointReader.md | 4 - .../shard5/tf.train.Optimizer.md | 265 - .../shard5/tf.train.Saver.md | 372 - .../shard5/tf.train.SessionManager.md | 209 - .../shard5/tf.train.checkpoint_exists.md | 19 - .../shard5/tf.train.maybe_shuffle_batch.md | 41 - .../shard5/tf.train.piecewise_constant.md | 41 - .../shard5/tf.train.polynomial_decay.md | 78 - .../shard5/tf.train.replica_device_setter.md | 63 - .../shard5/tf.transpose.md | 49 - .../shard5/tf.truncated_normal_initializer.md | 30 - .../shard5/tf.variable_op_scope.md | 4 - .../shard5/tf.verify_tensor_all_finite.md | 15 - .../shard6/tf.Dimension.md | 361 - .../shard6/tf.FixedLenSequenceFeature.md | 59 - .../shard6/tf.PaddingFIFOQueue.md | 313 - .../shard6/tf.QueueBase.md | 305 - .../shard6/tf.SparseConditionalAccumulator.md | 209 - .../functions_and_classes/shard6/tf.abs.md | 21 - .../shard6/tf.as_string.md | 31 - .../shard6/tf.assert_positive.md | 28 - .../shard6/tf.bitcast.md | 28 - .../functions_and_classes/shard6/tf.concat.md | 58 - .../functions_and_classes/shard6/tf.conj.md | 33 - ...tf.contrib.bayesflow.entropy.elbo_ratio.md | 68 - ...f.contrib.bayesflow.entropy.renyi_alpha.md | 38 - ...te_carlo.expectation_importance_sampler.md | 43 - ....bayesflow.stochastic_tensor.value_type.md | 35 - ...ntrib.copy_graph.copy_variable_to_graph.md | 20 - .../tf.contrib.crf.crf_sequence_score.md | 19 - .../shard6/tf.contrib.crf.crf_unary_score.md | 16 - ...distributions.BernoulliWithSigmoidProbs.md | 563 - .../shard6/tf.contrib.distributions.Beta.md | 689 - .../tf.contrib.distributions.Laplace.md | 607 - ....distributions.LaplaceWithSoftplusScale.md | 559 - .../tf.contrib.distributions.Logistic.md | 637 - ...ributions.bijector.AffineLinearOperator.md | 358 - ...contrib.distributions.bijector.Identity.md | 283 - .../tf.contrib.framework.assert_scalar.md | 4 - ...tf.contrib.framework.assign_from_values.md | 24 - ...tf.contrib.framework.create_global_step.md | 19 - .../shard6/tf.contrib.framework.deprecated.md | 34 - .../tf.contrib.framework.reduce_sum_n.md | 22 - ...itor.assign_renamed_collections_handler.md | 14 - ...trib.graph_editor.detach_control_inputs.md | 10 - ...ntrib.graph_editor.get_forward_walk_ops.md | 28 - .../tf.contrib.graph_editor.get_tensors.md | 18 - ...itor.replace_t_with_placeholder_handler.md | 17 - ....contrib.graph_editor.select_ops_and_ts.md | 31 - .../shard6/tf.contrib.graph_editor.swap_ts.md | 30 - .../tf.contrib.layers.bucketized_column.md | 19 - .../tf.contrib.layers.embed_sequence.md | 34 - ...tf.contrib.layers.summarize_activations.md | 4 - ...tf.contrib.learn.ExportStrategy.__new__.md | 4 - .../shard6/tf.contrib.learn.MetricSpec.md | 181 - .../shard6/tf.contrib.learn.NotFittedError.md | 17 - .../tf.contrib.learn.RunConfig.get_task_id.md | 12 - .../tf.contrib.learn.extract_dask_labels.md | 27 - .../tf.contrib.learn.monitors.PrintTensor.md | 187 - .../tf.contrib.learn.read_batch_examples.md | 46 - .../tf.contrib.linalg.LinearOperatorMatrix.md | 519 - .../shard6/tf.contrib.losses.log_loss.md | 36 - .../tf.contrib.metrics.set_intersection.md | 63 - ...streaming_false_positives_at_thresholds.md | 4 - .../tf.contrib.metrics.streaming_mean_iou.md | 51 - .../tf.contrib.metrics.streaming_recall.md | 47 - ...trics.streaming_root_mean_squared_error.md | 51 - .../shard6/tf.contrib.rnn.LSTMStateTuple.md | 54 - .../tf.contrib.rnn.LayerNormBasicLSTMCell.md | 84 - .../tf.contrib.util.make_tensor_proto.md | 46 - .../functions_and_classes/shard6/tf.cumsum.md | 42 - .../shard6/tf.decode_json_example.md | 25 - .../shard6/tf.dequantize.md | 52 - .../shard6/tf.dynamic_partition.md | 54 - .../functions_and_classes/shard6/tf.erfc.md | 14 - .../shard6/tf.errors.AbortedError.md | 15 - .../shard6/tf.errors.InternalError.md | 12 - .../shard6/tf.errors.NotFoundError.md | 14 - .../shard6/tf.errors.UnimplementedError.md | 15 - .../shard6/tf.fake_quant_with_min_max_args.md | 22 - .../functions_and_classes/shard6/tf.igamma.md | 29 - .../shard6/tf.image.decode_gif.md | 20 - .../shard6/tf.image.extract_glimpse.md | 56 - .../shard6/tf.image.rgb_to_hsv.md | 23 - .../shard6/tf.import_graph_def.md | 50 - .../shard6/tf.initialize_all_tables.md | 18 - .../shard6/tf.load_op_library.md | 28 - .../shard6/tf.maximum.md | 18 - .../shard6/tf.min_max_variable_partitioner.md | 24 - .../shard6/tf.moving_average_variables.md | 13 - .../shard6/tf.multiply.md | 18 - ...nn.batch_norm_with_global_normalization.md | 30 - .../shard6/tf.nn.ctc_greedy_decoder.md | 40 - ...depthwise_conv2d_native_backprop_filter.md | 29 - .../functions_and_classes/shard6/tf.nn.elu.md | 17 - .../shard6/tf.nn.separable_conv2d.md | 54 - .../shard6/tf.nn.softmax.md | 27 - .../shard6/tf.nn.with_space_to_batch.md | 133 - .../shard6/tf.one_hot.md | 131 - .../shard6/tf.op_scope.md | 4 - .../shard6/tf.parse_example.md | 197 - .../functions_and_classes/shard6/tf.pow.md | 26 - .../shard6/tf.python_io.tf_record_iterator.md | 19 - .../shard6/tf.random_crop.md | 25 - .../shard6/tf.random_normal_initializer.md | 25 - .../functions_and_classes/shard6/tf.rank.md | 32 - .../shard6/tf.reciprocal.md | 16 - .../shard6/tf.self_adjoint_eig.md | 22 - .../shard6/tf.sigmoid.md | 22 - .../functions_and_classes/shard6/tf.slice.md | 47 - .../shard6/tf.space_to_depth.md | 87 - .../shard6/tf.sparse_reduce_sum_sparse.md | 30 - .../shard6/tf.sparse_reset_shape.md | 60 - .../shard6/tf.sparse_segment_mean.md | 27 - .../shard6/tf.sparse_segment_sum.md | 50 - .../shard6/tf.sparse_transpose.md | 40 - .../shard6/tf.string_join.md | 21 - ...ary.TaggedRunMetadata.RegisterExtension.md | 4 - .../tf.summary.get_summary_description.md | 21 - .../shard6/tf.summary.scalar.md | 24 - .../shard6/tf.to_float.md | 19 - .../shard6/tf.train.AdamOptimizer.md | 206 - .../shard6/tf.train.Coordinator.md | 266 - .../shard6/tf.train.QueueRunner.from_proto.md | 4 - .../shard6/tf.train.RMSPropOptimizer.md | 30 - .../shard6/tf.train.Scaffold.md | 144 - .../shard6/tf.train.SessionRunContext.md | 57 - .../shard6/tf.train.StopAtStepHook.md | 85 - .../shard6/tf.train.Supervisor.md | 859 - .../shard6/tf.train.exponential_decay.md | 60 - .../shard6/tf.train.slice_input_producer.md | 35 - .../shard6/tf.trainable_variables.md | 13 - .../shard6/tf.truncated_normal.md | 27 - .../shard6/tf_debug.watch_graph.md | 32 - .../shard7/tf.DeviceSpec.from_string.md | 18 - .../shard7/tf.FixedLenFeature.md | 59 - .../shard7/tf.Operation.md | 234 - .../shard7/tf.PaddingFIFOQueue.from_list.md | 21 - .../shard7/tf.QueueBase.from_list.md | 21 - .../shard7/tf.as_dtype.md | 21 - .../shard7/tf.assert_equal.md | 30 - .../shard7/tf.assert_variables_initialized.md | 24 - ...f.contrib.bayesflow.entropy.renyi_ratio.md | 103 - ...ions.ConditionalTransformedDistribution.md | 489 - ...stributions.ExponentialWithSoftplusRate.md | 565 - ...tions.MultivariateNormalDiagPlusLowRank.md | 792 - .../shard7/tf.contrib.distributions.Normal.md | 639 - ....contrib.distributions.RelaxedBernoulli.md | 706 - ...f.contrib.distributions.bijector.Inline.md | 308 - ...b.distributions.bijector.PowerTransform.md | 301 - .../shard7/tf.contrib.distributions.kl.md | 37 - ...rib.framework.assert_or_get_global_step.md | 20 - ...contrib.framework.assign_from_values_fn.md | 22 - .../tf.contrib.framework.filter_variables.md | 37 - ...ntrib.framework.get_variables_by_suffix.md | 14 - .../tf.contrib.framework.has_arg_scope.md | 13 - .../shard7/tf.contrib.framework.with_shape.md | 24 - ...r.make_placeholder_from_dtype_and_shape.md | 20 - .../tf.contrib.graph_editor.make_view.md | 25 - .../shard7/tf.contrib.graph_editor.ph.md | 20 - .../shard7/tf.contrib.graph_editor.sgv.md | 25 - ....contrib.layers.convolution2d_transpose.md | 52 - ...ntrib.layers.input_from_feature_columns.md | 58 - .../shard7/tf.contrib.layers.layer_norm.md | 39 - ...ers.sequence_input_from_feature_columns.md | 37 - ...b.layers.sparse_column_with_hash_bucket.md | 33 - .../shard7/tf.contrib.learn.InputFnOps.md | 64 - ...ib.learn.build_parsing_serving_input_fn.md | 20 - .../tf.contrib.learn.monitors.EveryN.md | 232 - ...ntrib.legacy_seq2seq.model_with_buckets.md | 43 - ...tf.contrib.losses.softmax_cross_entropy.md | 37 - ...b.metrics.streaming_mean_absolute_error.md | 51 - .../tf.contrib.metrics.streaming_precision.md | 49 - ...cs.streaming_sensitivity_at_specificity.md | 56 - ...cs.streaming_specificity_at_sensitivity.md | 56 - ....streaming_true_positives_at_thresholds.md | 4 - ....contrib.opt.ExternalOptimizerInterface.md | 56 - .../shard7/tf.contrib.rnn.BasicRNNCell.md | 51 - .../tf.contrib.rnn.FusedRNNCellAdaptor.md | 21 - .../tf.contrib.rnn.LSTMBlockFusedCell.md | 72 - .../shard7/tf.contrib.rnn.LSTMCell.md | 124 - .../shard7/tf.contrib.rnn.ResidualWrapper.md | 73 - .../shard7/tf.contrib.util.make_ndarray.md | 20 - .../shard7/tf.count_up_to.md | 20 - .../shard7/tf.dynamic_stitch.md | 59 - ...f.errors.error_code_from_exception_type.md | 4 - ...f.errors.exception_type_from_error_code.md | 4 - .../functions_and_classes/shard7/tf.fft3d.md | 22 - .../shard7/tf.get_collection.md | 25 - .../shard7/tf.get_collection_ref.md | 20 - .../shard7/tf.get_session_tensor.md | 36 - .../functions_and_classes/shard7/tf.ifft.md | 18 - .../shard7/tf.image.non_max_suppression.md | 45 - .../shard7/tf.image.random_flip_left_right.md | 24 - .../shard7/tf.image.resize_area.md | 24 - .../functions_and_classes/shard7/tf.less.md | 18 - .../functions_and_classes/shard7/tf.lgamma.md | 14 - .../shard7/tf.logical_or.md | 18 - .../shard7/tf.matrix_band_part.md | 61 - .../shard7/tf.matrix_diag.md | 42 - .../shard7/tf.matrix_diag_part.md | 45 - .../shard7/tf.matrix_solve.md | 27 - .../shard7/tf.matrix_solve_ls.md | 56 - .../shard7/tf.matrix_transpose.md | 34 - .../shard7/tf.nn.atrous_conv2d.md | 115 - .../shard7/tf.nn.avg_pool.md | 26 - .../shard7/tf.nn.conv3d_transpose.md | 35 - .../tf.nn.fixed_unigram_candidate_sampler.md | 75 - .../shard7/tf.nn.fractional_avg_pool.md | 57 - .../shard7/tf.nn.in_top_k.md | 33 - .../tf.nn.local_response_normalization.md | 34 - .../shard7/tf.nn.quantized_avg_pool.md | 31 - ...tf.nn.softmax_cross_entropy_with_logits.md | 41 - .../shard7/tf.nn.weighted_moments.md | 19 - .../shard7/tf.ones_like.md | 30 - .../shard7/tf.polygamma.md | 22 - .../shard7/tf.python_io.TFRecordWriter.md | 55 - .../shard7/tf.random_normal.md | 23 - .../shard7/tf.reduce_max.md | 30 - .../functions_and_classes/shard7/tf.rint.md | 24 - .../shard7/tf.scatter_nd_update.md | 60 - .../shard7/tf.scatter_sub.md | 44 - .../shard7/tf.segment_prod.md | 31 - .../shard7/tf.segment_sum.md | 30 - .../shard7/tf.sparse_reduce_sum.md | 43 - .../shard7/tf.sparse_tensor_dense_matmul.md | 165 - .../functions_and_classes/shard7/tf.square.md | 17 - .../shard7/tf.string_to_hash_bucket.md | 23 - .../shard7/tf.summary.FileWriter.md | 209 - .../shard7/tf.summary.FileWriterCache.md | 26 - .../shard7/tf.train.MomentumOptimizer.md | 21 - ....train.ProximalGradientDescentOptimizer.md | 24 - .../shard7/tf.train.SessionRunValues.md | 66 - .../shard7/tf.train.export_meta_graph.md | 37 - .../shard7/tf.train.get_checkpoint_state.md | 24 - .../shard7/tf.train.get_global_step.md | 22 - .../shard7/tf.train.inverse_time_decay.md | 56 - .../shard7/tf.truediv.md | 34 - .../functions_and_classes/shard7/tf.unique.md | 34 - .../shard7/tf.variable_scope.md | 100 - .../functions_and_classes/shard7/tf.where.md | 47 - .../tf.FixedLenSequenceFeature.__new__.md | 4 - .../shard8/tf.GraphKeys.md | 44 - .../shard8/tf.IndexedSlices.md | 102 - .../shard8/tf.RandomShuffleQueue.from_list.md | 21 - .../shard8/tf.Session.md | 416 - .../shard8/tf.VarLenFeature.md | 39 - .../shard8/tf.Variable.md | 1156 - .../functions_and_classes/shard8/tf.acos.md | 14 - .../functions_and_classes/shard8/tf.argmax.md | 17 - .../shard8/tf.assert_negative.md | 28 - .../shard8/tf.assert_proper_iterable.md | 18 - .../shard8/tf.assign_sub.md | 26 - .../functions_and_classes/shard8/tf.atan.md | 14 - .../shard8/tf.batch_to_space_nd.md | 136 - ...b.bayesflow.stochastic_tensor.MeanValue.md | 36 - ...riational_inference.elbo_with_log_joint.md | 35 - .../tf.contrib.distributions.Mixture.md | 659 - ....distributions.bijector.SoftmaxCentered.md | 298 - ...rib.distributions.matrix_diag_transform.md | 53 - ...normal_conjugates_known_scale_posterior.md | 48 - ...ntrib.framework.assert_same_float_dtype.md | 27 - ...ontrib.framework.get_variable_full_name.md | 18 - .../tf.contrib.framework.zero_initializer.md | 21 - .../tf.contrib.graph_editor.ControlOutputs.md | 52 - .../tf.contrib.graph_editor.Transformer.md | 64 - .../tf.contrib.graph_editor.check_cios.md | 28 - ...aph_editor.copy_with_input_replacements.md | 37 - .../shard8/tf.contrib.graph_editor.detach.md | 31 - ...trib.graph_editor.get_backward_walk_ops.md | 27 - .../tf.contrib.graph_editor.get_ops_ios.md | 25 - .../tf.contrib.layers.apply_regularization.md | 28 - .../tf.contrib.layers.conv2d_in_plane.md | 49 - .../shard8/tf.contrib.layers.max_pool2d.md | 33 - ...ers.parse_feature_columns_from_examples.md | 52 - ..._feature_columns_from_sequence_examples.md | 28 - .../tf.contrib.layers.summarize_tensor.md | 18 - ...ontrib.layers.xavier_initializer_conv2d.md | 29 - .../shard8/tf.contrib.learn.Experiment.md | 229 - .../tf.contrib.learn.KMeansClustering.md | 413 - .../shard8/tf.contrib.learn.TaskType.md | 1 - .../tf.contrib.learn.extract_pandas_labels.md | 20 - .../tf.contrib.linalg.LinearOperatorTriL.md | 521 - ...rib.losses.sparse_softmax_cross_entropy.md | 33 - .../tf.contrib.metrics.confusion_matrix.md | 4 - .../tf.contrib.metrics.streaming_accuracy.md | 50 - ....metrics.streaming_mean_cosine_distance.md | 46 - ...b.metrics.streaming_pearson_correlation.md | 52 - ...streaming_sparse_average_precision_at_k.md | 57 - ...ontrib.metrics.streaming_true_negatives.md | 37 - .../tf.contrib.opt.MovingAverageOptimizer.md | 217 - .../shard8/tf.contrib.rnn.FusedRNNCell.md | 47 - .../tf.contrib.rnn.LSTMStateTuple.__new__.md | 4 - .../shard8/tf.contrib.rnn.static_rnn.md | 65 - ...trib.training.bucket_by_sequence_length.md | 55 - .../functions_and_classes/shard8/tf.cross.md | 22 - .../functions_and_classes/shard8/tf.equal.md | 18 - .../shard8/tf.hessians.md | 36 - .../shard8/tf.image.crop_to_bounding_box.md | 31 - .../shard8/tf.image.draw_bounding_boxes.md | 32 - .../tf.image.per_image_standardization.md | 25 - .../shard8/tf.image.resize_bilinear.md | 24 - .../shard8/tf.image.resize_images.md | 41 - .../shard8/tf.image.transpose_image.md | 20 - .../functions_and_classes/shard8/tf.is_inf.md | 18 - .../functions_and_classes/shard8/tf.lbeta.md | 31 - .../shard8/tf.less_equal.md | 18 - .../shard8/tf.matrix_inverse.md | 32 - .../shard8/tf.matrix_set_diag.md | 30 - .../shard8/tf.nn.batch_normalization.md | 47 - .../shard8/tf.nn.bidirectional_dynamic_rnn.md | 84 - .../shard8/tf.nn.conv2d.md | 49 - .../shard8/tf.nn.convolution.md | 116 - .../shard8/tf.nn.dynamic_rnn.md | 102 - ...tf.nn.learned_unigram_candidate_sampler.md | 53 - .../shard8/tf.nn.pool.md | 80 - .../shard8/tf.nn.quantized_conv2d.md | 39 - .../shard8/tf.nn.relu6.md | 15 - .../shard8/tf.nn.sufficient_statistics.md | 28 - ...f.nn.weighted_cross_entropy_with_logits.md | 52 - .../shard8/tf.no_regularizer.md | 4 - .../shard8/tf.ones_initializer.md | 15 - .../shard8/tf.python_io.TFRecordOptions.md | 15 - .../shard8/tf.quantized_concat.md | 29 - .../shard8/tf.reduce_prod.md | 30 - .../shard8/tf.reset_default_graph.md | 10 - .../shard8/tf.reverse.md | 64 - .../functions_and_classes/shard8/tf.round.md | 23 - .../functions_and_classes/shard8/tf.rsqrt.md | 16 - .../shard8/tf.scatter_add.md | 46 - .../shard8/tf.scatter_div.md | 42 - .../shard8/tf.sequence_mask.md | 31 - .../shard8/tf.set_random_seed.md | 98 - .../shard8/tf.sparse_fill_empty_rows.md | 54 - .../shard8/tf.sparse_reorder.md | 41 - .../shard8/tf.sparse_retain.md | 33 - .../shard8/tf.sparse_segment_sqrt_n.md | 26 - .../shard8/tf.sparse_to_dense.md | 45 - .../shard8/tf.strided_slice.md | 86 - .../shard8/tf.subtract.md | 18 - .../shard8/tf.summary.histogram.md | 25 - .../shard8/tf.summary.merge.md | 26 - .../shard8/tf.tensordot.md | 54 - .../shard8/tf.train.AdagradDAOptimizer.md | 194 - .../tf.train.Scaffold.get_or_default.md | 4 - .../shard8/tf.train.SessionRunArgs.md | 64 - .../shard8/tf.train.SummarySaverHook.md | 79 - .../shard8/tf.train.batch.md | 81 - ....train.do_quantize_training_on_graphdef.md | 4 - .../shard8/tf.train.import_meta_graph.md | 70 - .../shard8/tf.truncatemod.md | 21 - .../tf.variable_axis_size_partitioner.md | 37 - .../functions_and_classes/shard8/tf.zeta.md | 21 - .../shard9/tf.DeviceSpec.md | 147 - .../shard9/tf.FixedLenFeature.__new__.md | 4 - .../shard9/tf.NotDifferentiable.md | 32 - .../shard9/tf.Session.reset.md | 29 - .../shard9/tf.assign_add.md | 26 - .../shard9/tf.clip_by_average_norm.md | 29 - ...ntrib.bayesflow.entropy.entropy_shannon.md | 38 - ...expectation_importance_sampler_logspace.md | 45 - ...tochastic_tensor.get_current_value_type.md | 4 - ...ow.variational_inference.register_prior.md | 24 - ...ributions.BetaWithSoftplusConcentration.md | 597 - ...ib.distributions.MultivariateNormalTriL.md | 750 - .../tf.contrib.distributions.Poisson.md | 613 - .../tf.contrib.distributions.WishartFull.md | 669 - ....contrib.distributions.softplus_inverse.md | 20 - .../shard9/tf.contrib.ffmpeg.decode_audio.md | 29 - ...rib.framework.assign_from_checkpoint_fn.md | 29 - ...rib.framework.get_or_create_global_step.md | 14 - .../shard9/tf.contrib.framework.is_tensor.md | 16 - .../tf.contrib.framework.model_variable.md | 34 - ....framework.remove_squeezable_dimensions.md | 18 - .../shard9/tf.contrib.graph_editor.connect.md | 27 - ...contrib.graph_editor.get_generating_ops.md | 18 - ...ontrib.graph_editor.get_walks_union_ops.md | 38 - ...ib.graph_editor.get_within_boundary_ops.md | 32 - ...ntrib.graph_editor.make_view_from_scope.md | 14 - .../tf.contrib.graph_editor.reroute_ts.md | 31 - ....layers.create_feature_spec_for_parsing.md | 42 - ...joint_weighted_sum_from_feature_columns.md | 35 - .../tf.contrib.layers.l1_regularizer.md | 21 - .../tf.contrib.layers.xavier_initializer.md | 29 - ...ontrib.learn.DNNLinearCombinedRegressor.md | 408 - .../shard9/tf.contrib.learn.DNNRegressor.md | 393 - .../tf.contrib.learn.InputFnOps.__new__.md | 4 - .../tf.contrib.learn.LogisticRegressor.md | 45 - .../shard9/tf.contrib.learn.Trainable.md | 45 - .../shard9/tf.contrib.learn.infer.md | 31 - ...contrib.learn.monitors.LoggingTrainable.md | 184 - ...gacy_seq2seq.embedding_tied_rnn_seq2seq.md | 53 - .../tf.contrib.linalg.LinearOperator.md | 553 - .../tf.contrib.losses.get_total_loss.md | 26 - ...trib.losses.mean_pairwise_squared_error.md | 49 - ...tf.contrib.metrics.aggregate_metric_map.md | 31 - .../tf.contrib.metrics.aggregate_metrics.md | 19 - ...ntrib.metrics.streaming_false_negatives.md | 36 - .../shard9/tf.contrib.rnn.CompiledWrapper.md | 58 - ...rib.training.SequenceQueueingStateSaver.md | 270 - .../shard9/tf.errors.InvalidArgumentError.md | 17 - .../shard9/tf.errors.UnknownError.md | 15 - .../functions_and_classes/shard9/tf.expm1.md | 16 - .../functions_and_classes/shard9/tf.eye.md | 36 - .../functions_and_classes/shard9/tf.fill.md | 31 - .../functions_and_classes/shard9/tf.foldr.md | 44 - .../functions_and_classes/shard9/tf.gather.md | 37 - .../shard9/tf.get_default_graph.md | 17 - .../shard9/tf.get_local_variable.md | 87 - .../shard9/tf.get_variable.md | 86 - .../shard9/tf.image.encode_png.md | 28 - .../shard9/tf.image.random_flip_up_down.md | 24 - .../shard9/tf.matrix_determinant.md | 19 - .../shard9/tf.matrix_triangular_solve.md | 44 - .../shard9/tf.meshgrid.md | 45 - .../shard9/tf.nn.bias_add.md | 24 - .../shard9/tf.nn.crelu.md | 20 - .../shard9/tf.nn.fused_batch_norm.md | 33 - .../shard9/tf.nn.max_pool_with_argmax.md | 30 - .../shard9/tf.nn.raw_rnn.md | 170 - .../shard9/tf.nn.uniform_candidate_sampler.md | 49 - .../shard9/tf.nn.zero_fraction.md | 24 - .../functions_and_classes/shard9/tf.ones.md | 24 - .../functions_and_classes/shard9/tf.pad.md | 57 - .../shard9/tf.random_poisson.md | 38 - .../shard9/tf.realdiv.md | 20 - .../shard9/tf.saturate_cast.md | 19 - .../shard9/tf.scalar_mul.md | 23 - .../functions_and_classes/shard9/tf.scan.md | 92 - .../functions_and_classes/shard9/tf.size.md | 26 - .../shard9/tf.space_to_batch.md | 110 - .../shard9/tf.sparse_mask.md | 40 - .../shard9/tf.sparse_merge.md | 98 - .../shard9/tf.sparse_reshape.md | 51 - .../shard9/tf.squared_difference.md | 18 - .../shard9/tf.string_to_number.md | 20 - ...tf.summary.TaggedRunMetadata.FromString.md | 4 - .../functions_and_classes/shard9/tf.tanh.md | 16 - .../shard9/tf.test.is_gpu_available.md | 13 - .../shard9/tf.to_bfloat16.md | 19 - .../shard9/tf.train.FeedFnHook.md | 88 - .../shard9/tf.train.FinalOpsHook.md | 111 - .../tf.train.NanLossDuringTrainingError.md | 8 - .../tf.train.ProximalAdagradOptimizer.md | 30 - .../tf.train.SessionRunValues.__new__.md | 4 - .../shard9/tf.train.StepCounterHook.md | 65 - .../shard9/tf.train.input_producer.md | 42 - .../shard9/tf.train.string_input_producer.md | 36 - .../shard9/tf.train.summary_iterator.md | 42 - .../g3doc/api_docs/python/histogram_ops.md | 48 - tensorflow/g3doc/api_docs/python/image.md | 1415 - tensorflow/g3doc/api_docs/python/index.md | 1204 - tensorflow/g3doc/api_docs/python/io_ops.md | 4575 --- tensorflow/g3doc/api_docs/python/math_ops.md | 3672 --- tensorflow/g3doc/api_docs/python/nn.md | 3634 -- tensorflow/g3doc/api_docs/python/python_io.md | 117 - .../g3doc/api_docs/python/script_ops.md | 65 - .../g3doc/api_docs/python/session_ops.md | 116 - .../g3doc/api_docs/python/sparse_ops.md | 1439 - tensorflow/g3doc/api_docs/python/state_ops.md | 3657 -- .../g3doc/api_docs/python/string_ops.md | 392 - tensorflow/g3doc/api_docs/python/summary.md | 1004 - .../g3doc/api_docs/python/tensor_array_ops.md | 297 - tensorflow/g3doc/api_docs/python/test.md | 1133 - tensorflow/g3doc/api_docs/python/tf_debug.md | 1659 - tensorflow/g3doc/api_docs/python/train.md | 6664 ---- .../g3doc/contrib/learn/get_started/index.md | 114 - tensorflow/g3doc/contrib/learn/index.md | 30 - tensorflow/g3doc/experimental/index.md | 13 - tensorflow/g3doc/get_started/basic_usage.md | 324 - tensorflow/g3doc/get_started/index.md | 83 - tensorflow/g3doc/get_started/leftnav_files | 3 - tensorflow/g3doc/get_started/os_setup.md | 1325 - tensorflow/g3doc/how_tos/__init__.py | 0 .../g3doc/how_tos/adding_an_op/__init__.py | 0 .../how_tos/adding_an_op/attr_examples.cc | 46 - .../g3doc/how_tos/adding_an_op/cuda_op.py | 27 - .../how_tos/adding_an_op/cuda_op_kernel.cc | 55 - .../how_tos/adding_an_op/cuda_op_kernel.cu.cc | 31 - .../how_tos/adding_an_op/cuda_op_test.py | 35 - .../g3doc/how_tos/adding_an_op/fact_test.py | 32 - .../how_tos/adding_an_op/zero_out_1_test.py | 42 - .../how_tos/adding_an_op/zero_out_2_test.py | 57 - .../how_tos/adding_an_op/zero_out_3_test.py | 52 - .../how_tos/adding_an_op/zero_out_grad_2.py | 44 - .../how_tos/adding_an_op/zero_out_op_1.py | 27 - .../how_tos/adding_an_op/zero_out_op_2.py | 29 - .../how_tos/adding_an_op/zero_out_op_3.py | 27 - .../adding_an_op/zero_out_op_kernel_1.cc | 62 - .../adding_an_op/zero_out_op_kernel_2.cc | 115 - .../adding_an_op/zero_out_op_kernel_3.cc | 72 - tensorflow/g3doc/how_tos/index.md | 174 - tensorflow/g3doc/how_tos/leftnav_files | 13 - tensorflow/g3doc/images/getting_started.dot | 14 - tensorflow/g3doc/resources/bib.md | 87 - tensorflow/g3doc/resources/glossary.md | 142 - tensorflow/g3doc/resources/leftnav_files | 8 - tensorflow/g3doc/tutorials/__init__.py | 0 .../tutorials/deep_cnn/cifar_tensorboard.html | 21 - tensorflow/g3doc/tutorials/index.md | 177 - tensorflow/g3doc/tutorials/leftnav_files | 26 - tensorflow/g3doc/tutorials/syntaxnet/index.md | 17 - 1346 files changed, 7732 insertions(+), 200866 deletions(-) rename tensorflow/{g3doc => docs_src}/__init__.py (100%) create mode 100644 tensorflow/docs_src/about/bib.md rename tensorflow/{g3doc/resources => docs_src/about}/index.md (84%) create mode 100644 tensorflow/docs_src/about/leftnav_files rename tensorflow/{g3doc/resources => docs_src/about}/roadmap.md (100%) rename tensorflow/{g3doc/resources => docs_src/about}/uses.md (100%) create mode 100644 tensorflow/docs_src/api_guides/cc/guide.md create mode 100644 tensorflow/docs_src/api_guides/python/_toc.yaml create mode 100644 tensorflow/docs_src/api_guides/python/array_ops.md create mode 100644 tensorflow/docs_src/api_guides/python/check_ops.md create mode 100644 tensorflow/docs_src/api_guides/python/client.md create mode 100644 tensorflow/docs_src/api_guides/python/constant_op.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.bayesflow.entropy.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.bayesflow.monte_carlo.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.bayesflow.stochastic_graph.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.bayesflow.stochastic_tensor.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.bayesflow.variational_inference.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.copy_graph.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.crf.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.distributions.bijector.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.distributions.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.ffmpeg.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.framework.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.graph_editor.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.integrate.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.layers.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.learn.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.linalg.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.losses.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.metrics.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.opt.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.rnn.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.training.md create mode 100644 tensorflow/docs_src/api_guides/python/contrib.util.md create mode 100644 tensorflow/docs_src/api_guides/python/control_flow_ops.md create mode 100644 tensorflow/docs_src/api_guides/python/framework.md create mode 100644 tensorflow/docs_src/api_guides/python/functional_ops.md create mode 100644 tensorflow/docs_src/api_guides/python/histogram_ops.md create mode 100644 tensorflow/docs_src/api_guides/python/image.md create mode 100644 tensorflow/docs_src/api_guides/python/index.md create mode 100644 tensorflow/docs_src/api_guides/python/io_ops.md create mode 100644 tensorflow/docs_src/api_guides/python/math_ops.md create mode 100644 tensorflow/docs_src/api_guides/python/nn.md create mode 100644 tensorflow/docs_src/api_guides/python/python_io.md create mode 100644 tensorflow/docs_src/api_guides/python/script_ops.md create mode 100644 tensorflow/docs_src/api_guides/python/session_ops.md create mode 100644 tensorflow/docs_src/api_guides/python/sparse_ops.md create mode 100644 tensorflow/docs_src/api_guides/python/state_ops.md create mode 100644 tensorflow/docs_src/api_guides/python/string_ops.md create mode 100644 tensorflow/docs_src/api_guides/python/summary.md create mode 100644 tensorflow/docs_src/api_guides/python/test.md create mode 100644 tensorflow/docs_src/api_guides/python/tfdbg.md create mode 100644 tensorflow/docs_src/api_guides/python/train.md rename tensorflow/{g3doc/how_tos/documentation/index.md => docs_src/community/documentation.md} (99%) create mode 100644 tensorflow/docs_src/community/leftnav_files rename tensorflow/{g3doc/how_tos => docs_src/community}/style_guide.md (99%) rename tensorflow/{g3doc/how_tos/distributed/index.md => docs_src/deploy/distributed.md} (94%) rename tensorflow/{g3doc/how_tos/hadoop/index.md => docs_src/deploy/hadoop.md} (93%) create mode 100644 tensorflow/docs_src/deploy/leftnav_files rename tensorflow/{g3doc/tutorials/tfserve/index.md => docs_src/deploy/tfserve.md} (100%) create mode 100644 tensorflow/docs_src/extend/add_filesys.md rename tensorflow/{g3doc/how_tos/adding_an_op/index.md => docs_src/extend/adding_an_op.md} (76%) create mode 100644 tensorflow/docs_src/extend/architecture.md rename tensorflow/{g3doc/tutorials/estimators/index.md => docs_src/extend/estimators.md} (89%) rename tensorflow/{g3doc/how_tos/language_bindings/index.md => docs_src/extend/language_bindings.md} (99%) create mode 100644 tensorflow/docs_src/extend/leftnav_files rename tensorflow/{g3doc/how_tos/new_data_formats/index.md => docs_src/extend/new_data_formats.md} (81%) rename tensorflow/{g3doc/how_tos => docs_src/extend}/tool_developers/index.md (100%) rename tensorflow/{g3doc => docs_src}/extras/README.txt (100%) rename tensorflow/{g3doc/how_tos/embedding_viz/index.md => docs_src/get_started/embedding_viz.md} (93%) create mode 100644 tensorflow/docs_src/get_started/get_started.md rename tensorflow/{g3doc/how_tos/graph_viz/index.md => docs_src/get_started/graph_viz.md} (78%) rename tensorflow/{g3doc/tutorials/input_fn/index.md => docs_src/get_started/input_fn.md} (94%) create mode 100644 tensorflow/docs_src/get_started/leftnav_files rename tensorflow/{g3doc/tutorials/mnist/beginners/index.md => docs_src/get_started/mnist/beginners.md} (95%) rename tensorflow/{g3doc/tutorials/mnist/tf/index.md => docs_src/get_started/mnist/mechanics.md} (83%) rename tensorflow/{g3doc/tutorials/mnist/pros/index.md => docs_src/get_started/mnist/pros.md} (96%) rename tensorflow/{g3doc/tutorials/monitors/index.md => docs_src/get_started/monitors.md} (88%) rename tensorflow/{g3doc/how_tos/summaries_and_tensorboard/index.md => docs_src/get_started/summaries_and_tensorboard.md} (92%) rename tensorflow/{g3doc/tutorials/tflearn/index.md => docs_src/get_started/tflearn.md} (78%) create mode 100644 tensorflow/docs_src/install/index.md create mode 100644 tensorflow/docs_src/install/install_linux.md create mode 100644 tensorflow/docs_src/install/install_mac.md create mode 100644 tensorflow/docs_src/install/install_sources.md create mode 100644 tensorflow/docs_src/install/install_windows.md create mode 100644 tensorflow/docs_src/install/leftnav_files create mode 100644 tensorflow/docs_src/install/migration.md rename tensorflow/{g3doc/experimental => docs_src/performance}/leftnav_files (66%) create mode 100644 tensorflow/docs_src/performance/performance_guide.md rename tensorflow/{g3doc/how_tos/quantization/index.md => docs_src/performance/quantization.md} (98%) rename tensorflow/{g3doc/experimental => docs_src/performance}/xla/broadcasting.md (100%) rename tensorflow/{g3doc/experimental => docs_src/performance}/xla/developing_new_backend.md (100%) rename tensorflow/{g3doc/experimental => docs_src/performance}/xla/index.md (89%) rename tensorflow/{g3doc/experimental => docs_src/performance}/xla/jit.md (80%) rename tensorflow/{g3doc/experimental => docs_src/performance}/xla/operation_semantics.md (99%) rename tensorflow/{g3doc/experimental => docs_src/performance}/xla/shapes.md (100%) rename tensorflow/{g3doc/experimental => docs_src/performance}/xla/tfcompile.md (89%) rename tensorflow/{g3doc/resources => docs_src/programmers_guide}/data_versions.md (98%) rename tensorflow/{g3doc/how_tos/debugger/index.md => docs_src/programmers_guide/debugger.md} (92%) rename tensorflow/{g3doc/resources => docs_src/programmers_guide}/dims_types.md (97%) rename tensorflow/{g3doc/resources => docs_src/programmers_guide}/faq.md (64%) create mode 100644 tensorflow/docs_src/programmers_guide/leftnav_files rename tensorflow/{g3doc/how_tos/meta_graph/index.md => docs_src/programmers_guide/meta_graph.md} (95%) rename tensorflow/{g3doc/how_tos/reading_data/index.md => docs_src/programmers_guide/reading_data.md} (86%) rename tensorflow/{g3doc/how_tos/supervisor/index.md => docs_src/programmers_guide/supervisor.md} (91%) rename tensorflow/{g3doc/how_tos/debugger => docs_src/programmers_guide}/tfdbg-tflearn.md (86%) rename tensorflow/{g3doc/how_tos/threading_and_queues/index.md => docs_src/programmers_guide/threading_and_queues.md} (86%) rename tensorflow/{g3doc/how_tos/variable_scope/index.md => docs_src/programmers_guide/variable_scope.md} (98%) rename tensorflow/{g3doc/how_tos/variables/index.md => docs_src/programmers_guide/variables.md} (89%) rename tensorflow/{g3doc/resources/versions.md => docs_src/programmers_guide/version_semantics.md} (64%) rename tensorflow/{g3doc/tutorials/deep_cnn/index.md => docs_src/tutorials/deep_cnn.md} (80%) rename tensorflow/{g3doc/tutorials/image_recognition/index.md => docs_src/tutorials/image_recognition.md} (96%) rename tensorflow/{g3doc/how_tos/image_retraining/index.md => docs_src/tutorials/image_retraining.md} (97%) rename tensorflow/{g3doc/tutorials/layers/index.md => docs_src/tutorials/layers.md} (80%) create mode 100644 tensorflow/docs_src/tutorials/leftnav_files rename tensorflow/{g3doc/tutorials/linear/overview.md => docs_src/tutorials/linear.md} (97%) rename tensorflow/{g3doc/tutorials/mandelbrot/index.md => docs_src/tutorials/mandelbrot.md} (98%) rename tensorflow/{g3doc/tutorials/pdes/index.md => docs_src/tutorials/pdes.md} (97%) rename tensorflow/{g3doc/tutorials/recurrent/index.md => docs_src/tutorials/recurrent.md} (98%) rename tensorflow/{g3doc/tutorials/seq2seq/index.md => docs_src/tutorials/seq2seq.md} (97%) rename tensorflow/{g3doc/how_tos/using_gpu/index.md => docs_src/tutorials/using_gpu.md} (98%) rename tensorflow/{g3doc/tutorials/wide/index.md => docs_src/tutorials/wide.md} (97%) rename tensorflow/{g3doc/tutorials/wide_and_deep/index.md => docs_src/tutorials/wide_and_deep.md} (96%) rename tensorflow/{g3doc/tutorials/word2vec/index.md => docs_src/tutorials/word2vec.md} (97%) create mode 100644 tensorflow/g3doc/README.txt delete mode 100644 tensorflow/g3doc/api_docs/cc/ClassEnv.md delete mode 100644 tensorflow/g3doc/api_docs/cc/ClassEnvWrapper.md delete mode 100644 tensorflow/g3doc/api_docs/cc/ClassPartialTensorShape.md delete mode 100644 tensorflow/g3doc/api_docs/cc/ClassPartialTensorShapeUtils.md delete mode 100644 tensorflow/g3doc/api_docs/cc/ClassRandomAccessFile.md delete mode 100644 tensorflow/g3doc/api_docs/cc/ClassSession.md delete mode 100644 tensorflow/g3doc/api_docs/cc/ClassStatus.md delete mode 100644 tensorflow/g3doc/api_docs/cc/ClassTensor.md delete mode 100644 tensorflow/g3doc/api_docs/cc/ClassTensorShape.md delete mode 100644 tensorflow/g3doc/api_docs/cc/ClassTensorShapeUtils.md delete mode 100644 tensorflow/g3doc/api_docs/cc/ClassThread.md delete mode 100644 tensorflow/g3doc/api_docs/cc/ClassWritableFile.md delete mode 100644 tensorflow/g3doc/api_docs/cc/StructSessionOptions.md delete mode 100644 tensorflow/g3doc/api_docs/cc/StructState.md delete mode 100644 tensorflow/g3doc/api_docs/cc/StructTensorShapeDim.md delete mode 100644 tensorflow/g3doc/api_docs/cc/StructThreadOptions.md delete mode 100644 tensorflow/g3doc/api_docs/cc/index.md delete mode 100644 tensorflow/g3doc/api_docs/index.md delete mode 100644 tensorflow/g3doc/api_docs/leftnav_files delete mode 100644 tensorflow/g3doc/api_docs/python/array_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/check_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/client.md delete mode 100644 tensorflow/g3doc/api_docs/python/constant_op.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.bayesflow.entropy.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.bayesflow.monte_carlo.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.bayesflow.stochastic_graph.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.bayesflow.stochastic_tensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.bayesflow.variational_inference.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.copy_graph.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.crf.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.distributions.bijector.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.distributions.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.ffmpeg.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.framework.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.graph_editor.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.integrate.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.layers.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.learn.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.learn.monitors.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.legacy_seq2seq.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.linalg.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.losses.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.metrics.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.opt.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.rnn.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.training.md delete mode 100644 tensorflow/g3doc/api_docs/python/contrib.util.md delete mode 100644 tensorflow/g3doc/api_docs/python/control_flow_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/framework.md delete mode 100644 tensorflow/g3doc/api_docs/python/functional_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.PriorityQueue.from_list.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.ReaderBase.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.SparseFeature.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.SparseTensorValue.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.TensorArray.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.TensorShape.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.VarLenFeature.__new__.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.VariableScope.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.add_check_numerics_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.add_n.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.add_to_collection.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.assert_greater_equal.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.assert_non_positive.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.case.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.cholesky.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.cond.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Bernoulli.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Chi2WithAbsDf.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Dirichlet.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Distribution.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.GammaWithSoftplusConcentrationRate.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.RegisterKL.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.RelaxedOneHotCategorical.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.bijector.CholeskyOuterProduct.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.bijector.SigmoidCentered.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.framework.assign_from_checkpoint.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.framework.deprecated_args.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.add_control_inputs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.detach_inputs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.filter_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.make_placeholder_from_tensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.placeholder_name.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.select_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.swap_inputs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.swap_ios.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.convolution2d_in_plane.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.l2_regularizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.real_valued_column.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.sparse_column_with_keys.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.weighted_sparse_column.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.LinearRegressor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.ModelFnOps.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.extract_pandas_matrix.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.make_export_strategy.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.monitors.replace_monitors_with_hooks.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.read_batch_record_features.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.attention_decoder.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.embedding_rnn_decoder.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.embedding_rnn_seq2seq.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.sequence_loss.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.linalg.LinearOperatorDiag.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.losses.get_losses.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.metrics.set_size.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.metrics.streaming_mean_tensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.AttentionCellWrapper.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.MultiRNNCell.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.OutputProjectionWrapper.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.stack_bidirectional_dynamic_rnn.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.training.weighted_resample.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.util.ops_used_by_graph_def.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.convert_to_tensor_or_sparse_tensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.cumprod.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.delete_session_tensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.depth_to_space.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.device.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.errors.CancelledError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.errors.DataLossError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.errors.DeadlineExceededError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fake_quant_with_min_max_vars_gradient.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fake_quant_with_min_max_vars_per_channel_gradient.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fft.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fft2d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.floormod.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.get_seed.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.get_session_handle.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.global_norm.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.ifft3d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.adjust_brightness.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.adjust_gamma.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.decode_jpeg.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.grayscale_to_rgb.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.random_brightness.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.rgb_to_grayscale.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_finite.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_nan.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_non_decreasing.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_numeric_tensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.mod.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.name_scope.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.avg_pool3d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.conv2d_backprop_filter.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.ctc_loss.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.l2_normalize.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.norm.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.not_equal.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.orthogonal_initializer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.py_func.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.quantize_v2.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.reduce_sum.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.reshape.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.reverse_sequence.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.segment_min.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.sparse_tensor_to_dense.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.sqrt.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.summary.FileWriterCache.clear.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.summary.TaggedRunMetadata.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.summary.merge_all.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.ExponentialMovingAverage.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.GlobalStepWaiterHook.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.SessionRunArgs.__new__.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.SessionRunHook.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.add_queue_runner.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.limit_epochs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.tuple.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.zeros_initializer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf_debug.DumpingDebugWrapperSession.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf_debug.watch_graph_with_blacklists.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.AggregationMethod.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.ConditionalAccumulatorBase.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.FIFOQueue.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.IdentityReader.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.NoGradient.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.Print.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.Tensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.Variable.from_proto.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.accumulate_n.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.all_variables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.assert_less_equal.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.assert_rank_at_least.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.assign.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.batch_to_space.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.constant_initializer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.bayesflow.variational_inference.elbo.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.crf.crf_log_likelihood.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.MultivariateNormalDiag.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.QuantizedDistribution.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.StudentT.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.TransformedDistribution.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.get_graph_from_inputs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.get_local_variables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.get_variables_by_name.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.init_from_checkpoint.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.compute_boundary_ts.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.get_name_scope_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.make_list_of_t.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.reroute_ios.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.transform_op_if_inside_handler.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.integrate.odeint.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.embedding_column.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.flatten.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.make_place_holder_tensors_for_base_features.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.summarize_tensors.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.LinearClassifier.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.PredictionKey.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.extract_pandas_data.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.infer_real_valued_columns_from_input_fn.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.monitors.SummaryWriterCache.get.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.monitors.ValidationMonitor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.train.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.linalg.LinearOperatorComposition.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.linalg.LinearOperatorIdentity.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.losses.absolute_difference.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.losses.compute_weighted_loss.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.losses.hinge_loss.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.metrics.streaming_mean_squared_error.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.metrics.streaming_sparse_recall_at_k.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.opt.VariableClippingOptimizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.BasicLSTMCell.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.GRUCell.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.GridLSTMCell.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.TimeReversedFusedRNN.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.static_state_saving_rnn.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.training.resample_at_rate.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.util.constant_value.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.convert_to_tensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.diag.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.divide.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.einsum.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.erf.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.errors.AlreadyExistsError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.fake_quant_with_min_max_args_gradient.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.get_default_session.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.gradients.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.greater_equal.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.igammac.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.adjust_hue.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.central_crop.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.random_hue.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.resize_bicubic.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.invert_permutation.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.is_strictly_increasing.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.linspace.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.log1p.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.map_fn.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.matching_files.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.negative.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.compute_accidental_hits.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.conv1d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.embedding_lookup_sparse.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.erosion2d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.moments.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.normalize_moments.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.sampled_softmax_loss.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.parse_single_example.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.qr.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.random_uniform_initializer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.read_file.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.reduce_any.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.reduce_join.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.reduce_logsumexp.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.sparse_minimum.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.string_to_hash_bucket_strong.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.test.Benchmark.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.test.get_temp_dir.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.AdadeltaOptimizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.ClusterSpec.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.GradientDescentOptimizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.LoggingTensorHook.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.LooperThread.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.MonitoredSession.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.MonitoredTrainingSession.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.NanTensorHook.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.Server.create_local_server.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.generate_checkpoint_state_proto.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.maybe_batch.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.shuffle_batch_join.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.unsorted_segment_max.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.unstack.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.zeros.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.zeros_like.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf_debug.LocalCLIDebugHook.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.DType.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.FIFOQueue.from_list.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.Graph.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.InteractiveSession.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.SparseFeature.__new__.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.SparseTensorValue.__new__.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.TFRecordReader.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.TextLineReader.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.WholeFileReader.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.assert_non_negative.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.betainc.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.cholesky_solve.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.constant.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.bayesflow.monte_carlo.expectation.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.copy_graph.get_copied_op.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.crf.CrfForwardRnnCell.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.crf.crf_binary_score.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.Categorical.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.Chi2.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.ConditionalDistribution.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.ReparameterizationType.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.Uniform.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.WishartCholesky.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.bijector.Bijector.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.arg_scope.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.assert_scalar_int.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.deprecated_arg_values.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.get_unique_variable.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.get_variables_to_restore.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.load_checkpoint.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.with_same_shape.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.SubGraphView.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.TransformerInfo.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.copy.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.filter_ts_from_regex.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.keep_t_if_possible_handler.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.infer_real_valued_columns.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.optimize_loss.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.repeat.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.safe_embedding_lookup_sparse.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.shared_embedding_columns.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.weighted_sum_from_feature_columns.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.BaseEstimator.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.ModeKeys.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.ModelFnOps.__new__.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.ProblemType.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.CaptureVariable.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.ExportMonitor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.GraphDump.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.NanLoss.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.StepCounter.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.legacy_seq2seq.embedding_attention_decoder.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.legacy_seq2seq.embedding_attention_seq2seq.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.legacy_seq2seq.rnn_decoder.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.set_difference.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_auc.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_covariance.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_false_negatives_at_thresholds.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_mean.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_mean_relative_error.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_sparse_precision_at_k.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.opt.ScipyOptimizerInterface.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.rnn.GRUBlockCell.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.rnn.static_bidirectional_rnn.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.digamma.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.edit_distance.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.encode_base64.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.errors.ResourceExhaustedError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.expand_dims.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.floor_div.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.gather_nd.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.get_variable_scope.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.global_variables_initializer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.identity.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.imag.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.image.crop_and_resize.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.image.encode_jpeg.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.initialize_all_variables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.initialize_local_variables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.is_variable_initialized.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.local_variables_initializer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.matmul.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.minimum.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.conv3d_backprop_filter_v2.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.depthwise_conv2d_native_backprop_input.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.embedding_lookup.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.log_uniform_candidate_sampler.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.relu.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.parallel_stack.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.random_uniform.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.real.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.report_uninitialized_variables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.required_space_to_batch_paddings.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.scatter_nd_sub.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.scatter_update.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.setdiff1d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.shape_n.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.sin.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.space_to_batch_nd.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.sparse_placeholder.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.split.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.squeeze.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.string_split.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.summary.SummaryDescription.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.summary.audio.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.summary.tensor_summary.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.tables_initializer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.TestCase.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.assert_equal_graph_def.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.compute_gradient.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.is_built_with_cuda.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.to_int32.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.CheckpointSaverHook.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.Saver.from_proto.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.SessionCreator.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.basic_train_loop.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.global_step.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.latest_checkpoint.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.maybe_shuffle_batch_join.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.natural_exp_decay.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.shuffle_batch.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.start_queue_runners.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.uniform_unit_scaling_initializer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.variables_initializer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.write_file.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.PriorityQueue.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.RegisterGradient.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.SparseTensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.assert_rank.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.assert_type.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.ceil.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.check_numerics.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.bayesflow.stochastic_tensor.SampleValue.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.bayesflow.variational_inference.ELBOForms.check_form.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.copy_graph.copy_op_to_graph.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Binomial.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.DirichletMultinomial.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.ExpRelaxedOneHotCategorical.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Exponential.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Gamma.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.InverseGamma.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Multinomial.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.NormalWithSoftplusScale.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.OneHotCategorical.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.ffmpeg.encode_audio.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.framework.add_model_variable.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.framework.get_model_variables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.framework.local_variable.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.copy_op_handler.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.detach_outputs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.filter_ops_from_regex.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.filter_ts.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.op_type.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.reroute_inputs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.select_ts.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.swap_outputs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.crossed_column.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.separable_convolution2d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.sparse_column_with_integerized_feature.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.summarize_activation.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.variance_scaling_initializer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.Estimator.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.extract_dask_data.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.monitors.StopAtStep.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.monitors.SummarySaver.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.monitors.SummaryWriterCache.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.legacy_seq2seq.basic_rnn_seq2seq.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.legacy_seq2seq.tied_rnn_seq2seq.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.linalg.LinearOperatorScaledIdentity.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.linalg.LinearOperatorUDVHUpdate.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.losses.add_loss.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.losses.cosine_distance.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.losses.get_regularization_losses.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.metrics.auc_using_histogram.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.metrics.streaming_concat.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.metrics.streaming_true_negatives_at_thresholds.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.CoupledInputForgetGateLSTMCell.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.DropoutWrapper.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.InputProjectionWrapper.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.LSTMBlockWrapper.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.training.bucket.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.training.rejection_sample.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.training.stratified_sample.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.control_dependencies.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.convert_to_tensor_or_indexed_slices.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.decode_csv.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.decode_raw.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.errors.OutOfRangeError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.errors.UnauthenticatedError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.exp.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.fake_quant_with_min_max_vars.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.fake_quant_with_min_max_vars_per_channel.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.foldl.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.global_variables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.group.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.ifft2d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.adjust_contrast.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.adjust_saturation.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.convert_image_dtype.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.decode_png.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.random_contrast.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.random_saturation.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.local_variables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.logical_xor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.multinomial.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.dropout.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.fractional_max_pool.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.log_softmax.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.max_pool.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.quantized_max_pool.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.quantized_relu_x.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.softsign.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.parse_tensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.placeholder.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.random_gamma.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.random_shuffle.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.reduce_min.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.register_tensor_conversion_function.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.scatter_mul.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.scatter_nd_add.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.segment_mean.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.shape.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.sparse_concat.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.sparse_softmax.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.sparse_split.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.stop_gradient.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.substr.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.svd.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.test.compute_gradient_error.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.test.gpu_device_name.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.test.test_src_dir_path.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.to_double.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.trace.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.AdagradOptimizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.QueueRunner.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.Server.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.SyncReplicasOptimizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.assert_global_step.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.batch_join.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.get_checkpoint_mtimes.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.range_input_producer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.truncatediv.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.unique_with_counts.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.DebugTensorDatum.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.LocalCLIDebugWrapperSession.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.add_debug_tensor_watch.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.load_tensor_from_event_file.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.Assert.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.ConditionalAccumulator.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.FixedLengthRecordReader.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.argmin.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.assert_less.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.broadcast_static_shape.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.clip_by_value.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.complex.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.bayesflow.variational_inference.ELBOForms.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.crf.viterbi_decode.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.distributions.bijector.Invert.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.distributions.bijector.Softplus.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.distributions.normal_conjugates_known_scale_predictive.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.framework.VariableDeviceChooser.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.framework.add_arg_scope.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.framework.load_variable.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.OpMatcher.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.get_consuming_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.graph_replace.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.make_list_of_op.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.reroute_outputs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.sgv_scope.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.avg_pool2d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.batch_norm.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.check_feature_columns.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.one_hot_column.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.regression_target.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.unit_norm.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.DNNClassifier.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.DNNLinearCombinedClassifier.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.Evaluable.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.ExportStrategy.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.RunConfig.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.evaluate.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.infer_real_valued_columns_from_input.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.monitors.SummaryWriterCache.clear.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.monitors.get_default_monitors.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.read_batch_features.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.run_feeds.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.legacy_seq2seq.one2many_rnn_seq2seq.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.losses.mean_squared_error.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.set_union.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_precision_at_thresholds.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_recall_at_k.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_sparse_precision_at_top_k.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_true_positives.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.rnn.DeviceWrapper.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.rnn.LSTMBlockCell.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.rnn.TimeFreqLSTMCell.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.training.NextQueuedSequenceBatch.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.training.batch_sequences_with_states.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.util.stripped_op_list_for_graph.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.decode_base64.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.errors.FailedPreconditionError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.extract_image_patches.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.fixed_size_partitioner.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.floor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.greater.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.histogram_fixed_width.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.image.hsv_to_rgb.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.initialize_variables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.log.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.conv2d_backprop_input.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.conv2d_transpose.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.ctc_beam_search_decoder.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.depthwise_conv2d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.depthwise_conv2d_native.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.dilation2d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.l2_loss.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.log_poisson_loss.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.max_pool3d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.nce_loss.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.softplus.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.sparse_softmax_cross_entropy_with_logits.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.placeholder_with_default.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.python_io.TFRecordCompressionType.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.reduce_all.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.reduce_mean.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.segment_max.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.self_adjoint_eigvals.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.sparse_add.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.sparse_to_indicator.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.stack.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.string_to_hash_bucket_fast.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.summary.SummaryDescription.RegisterExtension.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.tile.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.SingularMonitoredSession.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.WorkerSessionCreator.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.match_filenames_once.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.maybe_batch_join.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.update_checkpoint_state.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.write_graph.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.unsorted_segment_sum.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.while_loop.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf_debug.DebugDumpDir.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf_debug.DumpingDebugHook.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf_debug.has_inf_or_nan.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.OpError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.RandomShuffleQueue.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.add.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.asin.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.assert_greater.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.assert_integer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.boolean_mask.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.broadcast_dynamic_shape.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.cast.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.clip_by_global_norm.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.clip_by_norm.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.container.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.bayesflow.stochastic_graph.surrogate_loss.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.crf.crf_log_norm.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.distributions.bijector.Affine.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.distributions.bijector.Chain.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.distributions.bijector.Exp.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.arg_scoped_arguments.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.get_variables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.list_variables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.variable.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.bypass.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.can_be_regex.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.detach_control_outputs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.get_walks_intersection_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.make_regex.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.remove_control_inputs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.convolution2d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.fully_connected.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.legacy_fully_connected.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.multi_class_target.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.one_hot_encoding.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.scattered_embedding_column.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.sum_regularizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.summarize_collection.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.monitors.BaseMonitor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.monitors.CheckpointSaver.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.monitors.RunHookAdapterForMonitors.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.run_n.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.legacy_seq2seq.sequence_loss_by_example.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.losses.sigmoid_cross_entropy.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.accuracy.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.streaming_false_positives.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.streaming_percentage_less.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.streaming_recall_at_thresholds.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.rnn.EmbeddingWrapper.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.rnn.RNNCell.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.cos.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.count_nonzero.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.diag_part.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.div.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.errors.PermissionDeniedError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.errors.UnavailableError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.errors.raise_exception_on_not_ok_status.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.floordiv.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.decode_image.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.flip_left_right.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.flip_up_down.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.pad_to_bounding_box.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.resize_image_with_crop_or_pad.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.resize_nearest_neighbor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.rot90.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.sample_distorted_bounding_box.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.total_variation.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.load_file_system_library.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.logical_and.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.logical_not.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.make_template.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.model_variables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.atrous_conv2d_transpose.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.conv3d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.sigmoid_cross_entropy_with_logits.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.top_k.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.no_op.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.range.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.reverse_v2.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.scatter_nd.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.sign.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.sparse_maximum.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.summary.FileWriterCache.get.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.summary.SummaryDescription.FromString.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.summary.image.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.tan.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.test.main.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.to_int64.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.ChiefSessionCreator.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.FtrlOptimizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.LooperThread.loop.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.NewCheckpointReader.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.Optimizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.Saver.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.SessionManager.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.checkpoint_exists.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.maybe_shuffle_batch.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.piecewise_constant.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.polynomial_decay.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.replica_device_setter.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.transpose.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.truncated_normal_initializer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.variable_op_scope.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.verify_tensor_all_finite.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.Dimension.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.FixedLenSequenceFeature.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.PaddingFIFOQueue.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.QueueBase.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.SparseConditionalAccumulator.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.abs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.as_string.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.assert_positive.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.bitcast.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.concat.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.conj.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.entropy.elbo_ratio.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.entropy.renyi_alpha.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.monte_carlo.expectation_importance_sampler.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.stochastic_tensor.value_type.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.copy_graph.copy_variable_to_graph.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.crf.crf_sequence_score.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.crf.crf_unary_score.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.BernoulliWithSigmoidProbs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.Beta.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.Laplace.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.LaplaceWithSoftplusScale.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.Logistic.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.bijector.AffineLinearOperator.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.bijector.Identity.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.assert_scalar.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.assign_from_values.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.create_global_step.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.deprecated.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.reduce_sum_n.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.assign_renamed_collections_handler.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.detach_control_inputs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.get_forward_walk_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.get_tensors.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.replace_t_with_placeholder_handler.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.select_ops_and_ts.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.swap_ts.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.layers.bucketized_column.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.layers.embed_sequence.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.layers.summarize_activations.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.ExportStrategy.__new__.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.MetricSpec.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.NotFittedError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.RunConfig.get_task_id.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.extract_dask_labels.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.monitors.PrintTensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.read_batch_examples.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.linalg.LinearOperatorMatrix.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.losses.log_loss.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.set_intersection.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_false_positives_at_thresholds.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_mean_iou.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_recall.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_root_mean_squared_error.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.rnn.LSTMStateTuple.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.rnn.LayerNormBasicLSTMCell.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.util.make_tensor_proto.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.cumsum.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.decode_json_example.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.dequantize.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.dynamic_partition.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.erfc.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.AbortedError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.InternalError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.NotFoundError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.UnimplementedError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.fake_quant_with_min_max_args.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.igamma.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.image.decode_gif.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.image.extract_glimpse.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.image.rgb_to_hsv.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.import_graph_def.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.initialize_all_tables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.load_op_library.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.maximum.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.min_max_variable_partitioner.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.moving_average_variables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.multiply.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.batch_norm_with_global_normalization.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.ctc_greedy_decoder.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.depthwise_conv2d_native_backprop_filter.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.elu.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.separable_conv2d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.softmax.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.with_space_to_batch.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.one_hot.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.op_scope.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.parse_example.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.pow.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.python_io.tf_record_iterator.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.random_crop.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.random_normal_initializer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.rank.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.reciprocal.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.self_adjoint_eig.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sigmoid.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.slice.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.space_to_depth.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_reduce_sum_sparse.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_reset_shape.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_segment_mean.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_segment_sum.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_transpose.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.string_join.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.summary.TaggedRunMetadata.RegisterExtension.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.summary.get_summary_description.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.summary.scalar.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.to_float.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.AdamOptimizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.Coordinator.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.QueueRunner.from_proto.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.RMSPropOptimizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.Scaffold.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.SessionRunContext.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.StopAtStepHook.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.Supervisor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.exponential_decay.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.slice_input_producer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.trainable_variables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.truncated_normal.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf_debug.watch_graph.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.DeviceSpec.from_string.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.FixedLenFeature.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.Operation.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.PaddingFIFOQueue.from_list.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.QueueBase.from_list.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.as_dtype.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.assert_equal.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.assert_variables_initialized.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.bayesflow.entropy.renyi_ratio.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.ConditionalTransformedDistribution.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.ExponentialWithSoftplusRate.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.Normal.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.RelaxedBernoulli.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.bijector.Inline.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.bijector.PowerTransform.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.kl.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.assert_or_get_global_step.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.assign_from_values_fn.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.filter_variables.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.get_variables_by_suffix.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.has_arg_scope.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.with_shape.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.make_placeholder_from_dtype_and_shape.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.make_view.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.ph.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.sgv.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.convolution2d_transpose.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.input_from_feature_columns.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.layer_norm.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.sequence_input_from_feature_columns.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.sparse_column_with_hash_bucket.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.learn.InputFnOps.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.learn.build_parsing_serving_input_fn.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.learn.monitors.EveryN.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.legacy_seq2seq.model_with_buckets.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.losses.softmax_cross_entropy.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_mean_absolute_error.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_precision.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_sensitivity_at_specificity.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_specificity_at_sensitivity.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_true_positives_at_thresholds.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.opt.ExternalOptimizerInterface.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.BasicRNNCell.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.FusedRNNCellAdaptor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.LSTMBlockFusedCell.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.LSTMCell.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.ResidualWrapper.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.util.make_ndarray.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.count_up_to.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.dynamic_stitch.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.errors.error_code_from_exception_type.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.errors.exception_type_from_error_code.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.fft3d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.get_collection.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.get_collection_ref.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.get_session_tensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.ifft.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.image.non_max_suppression.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.image.random_flip_left_right.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.image.resize_area.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.less.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.lgamma.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.logical_or.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_band_part.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_diag.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_diag_part.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_solve.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_solve_ls.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_transpose.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.atrous_conv2d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.avg_pool.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.conv3d_transpose.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.fixed_unigram_candidate_sampler.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.fractional_avg_pool.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.in_top_k.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.local_response_normalization.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.quantized_avg_pool.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.softmax_cross_entropy_with_logits.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.weighted_moments.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.ones_like.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.polygamma.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.python_io.TFRecordWriter.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.random_normal.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.reduce_max.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.rint.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.scatter_nd_update.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.scatter_sub.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.segment_prod.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.segment_sum.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.sparse_reduce_sum.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.sparse_tensor_dense_matmul.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.square.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.string_to_hash_bucket.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.summary.FileWriter.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.summary.FileWriterCache.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.MomentumOptimizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.ProximalGradientDescentOptimizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.SessionRunValues.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.export_meta_graph.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.get_checkpoint_state.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.get_global_step.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.inverse_time_decay.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.truediv.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.unique.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.variable_scope.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.where.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.FixedLenSequenceFeature.__new__.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.GraphKeys.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.IndexedSlices.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.RandomShuffleQueue.from_list.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.Session.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.VarLenFeature.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.Variable.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.acos.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.argmax.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.assert_negative.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.assert_proper_iterable.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.assign_sub.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.atan.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.batch_to_space_nd.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.bayesflow.stochastic_tensor.MeanValue.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.bayesflow.variational_inference.elbo_with_log_joint.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.Mixture.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.bijector.SoftmaxCentered.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.matrix_diag_transform.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.normal_conjugates_known_scale_posterior.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.framework.assert_same_float_dtype.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.framework.get_variable_full_name.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.framework.zero_initializer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.ControlOutputs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.Transformer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.check_cios.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.copy_with_input_replacements.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.detach.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.get_backward_walk_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.get_ops_ios.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.apply_regularization.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.conv2d_in_plane.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.max_pool2d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.parse_feature_columns_from_examples.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.parse_feature_columns_from_sequence_examples.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.summarize_tensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.xavier_initializer_conv2d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.Experiment.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.KMeansClustering.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.TaskType.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.extract_pandas_labels.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.linalg.LinearOperatorTriL.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.losses.sparse_softmax_cross_entropy.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.confusion_matrix.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_accuracy.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_mean_cosine_distance.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_pearson_correlation.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_sparse_average_precision_at_k.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_true_negatives.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.opt.MovingAverageOptimizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.rnn.FusedRNNCell.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.rnn.LSTMStateTuple.__new__.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.rnn.static_rnn.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.training.bucket_by_sequence_length.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.cross.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.equal.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.hessians.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.crop_to_bounding_box.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.draw_bounding_boxes.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.per_image_standardization.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.resize_bilinear.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.resize_images.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.transpose_image.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.is_inf.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.lbeta.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.less_equal.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.matrix_inverse.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.matrix_set_diag.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.batch_normalization.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.bidirectional_dynamic_rnn.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.conv2d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.convolution.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.dynamic_rnn.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.learned_unigram_candidate_sampler.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.pool.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.quantized_conv2d.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.relu6.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.sufficient_statistics.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.weighted_cross_entropy_with_logits.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.no_regularizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.ones_initializer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.python_io.TFRecordOptions.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.quantized_concat.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.reduce_prod.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.reset_default_graph.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.reverse.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.round.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.rsqrt.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.scatter_add.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.scatter_div.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sequence_mask.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.set_random_seed.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_fill_empty_rows.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_reorder.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_retain.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_segment_sqrt_n.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_to_dense.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.strided_slice.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.subtract.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.summary.histogram.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.summary.merge.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.tensordot.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.AdagradDAOptimizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.Scaffold.get_or_default.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.SessionRunArgs.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.SummarySaverHook.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.batch.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.do_quantize_training_on_graphdef.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.import_meta_graph.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.truncatemod.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.variable_axis_size_partitioner.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.zeta.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.DeviceSpec.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.FixedLenFeature.__new__.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.NotDifferentiable.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.Session.reset.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.assign_add.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.clip_by_average_norm.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.entropy.entropy_shannon.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.monte_carlo.expectation_importance_sampler_logspace.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.stochastic_tensor.get_current_value_type.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.variational_inference.register_prior.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.BetaWithSoftplusConcentration.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.MultivariateNormalTriL.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.Poisson.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.WishartFull.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.softplus_inverse.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.ffmpeg.decode_audio.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.assign_from_checkpoint_fn.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.get_or_create_global_step.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.is_tensor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.model_variable.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.remove_squeezable_dimensions.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.connect.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.get_generating_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.get_walks_union_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.get_within_boundary_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.make_view_from_scope.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.reroute_ts.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.create_feature_spec_for_parsing.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.joint_weighted_sum_from_feature_columns.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.l1_regularizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.xavier_initializer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.DNNLinearCombinedRegressor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.DNNRegressor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.InputFnOps.__new__.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.LogisticRegressor.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.Trainable.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.infer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.monitors.LoggingTrainable.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.legacy_seq2seq.embedding_tied_rnn_seq2seq.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.linalg.LinearOperator.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.losses.get_total_loss.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.losses.mean_pairwise_squared_error.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.metrics.aggregate_metric_map.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.metrics.aggregate_metrics.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.metrics.streaming_false_negatives.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.rnn.CompiledWrapper.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.training.SequenceQueueingStateSaver.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.errors.InvalidArgumentError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.errors.UnknownError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.expm1.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.eye.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.fill.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.foldr.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.gather.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.get_default_graph.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.get_local_variable.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.get_variable.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.image.encode_png.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.image.random_flip_up_down.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.matrix_determinant.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.matrix_triangular_solve.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.meshgrid.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.bias_add.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.crelu.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.fused_batch_norm.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.max_pool_with_argmax.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.raw_rnn.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.uniform_candidate_sampler.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.zero_fraction.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.ones.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.pad.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.random_poisson.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.realdiv.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.saturate_cast.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.scalar_mul.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.scan.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.size.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.space_to_batch.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.sparse_mask.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.sparse_merge.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.sparse_reshape.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.squared_difference.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.string_to_number.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.summary.TaggedRunMetadata.FromString.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.tanh.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.test.is_gpu_available.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.to_bfloat16.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.FeedFnHook.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.FinalOpsHook.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.NanLossDuringTrainingError.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.ProximalAdagradOptimizer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.SessionRunValues.__new__.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.StepCounterHook.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.input_producer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.string_input_producer.md delete mode 100644 tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.summary_iterator.md delete mode 100644 tensorflow/g3doc/api_docs/python/histogram_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/image.md delete mode 100644 tensorflow/g3doc/api_docs/python/index.md delete mode 100644 tensorflow/g3doc/api_docs/python/io_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/math_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/nn.md delete mode 100644 tensorflow/g3doc/api_docs/python/python_io.md delete mode 100644 tensorflow/g3doc/api_docs/python/script_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/session_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/sparse_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/state_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/string_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/summary.md delete mode 100644 tensorflow/g3doc/api_docs/python/tensor_array_ops.md delete mode 100644 tensorflow/g3doc/api_docs/python/test.md delete mode 100644 tensorflow/g3doc/api_docs/python/tf_debug.md delete mode 100644 tensorflow/g3doc/api_docs/python/train.md delete mode 100644 tensorflow/g3doc/contrib/learn/get_started/index.md delete mode 100644 tensorflow/g3doc/contrib/learn/index.md delete mode 100644 tensorflow/g3doc/experimental/index.md delete mode 100644 tensorflow/g3doc/get_started/basic_usage.md delete mode 100644 tensorflow/g3doc/get_started/index.md delete mode 100644 tensorflow/g3doc/get_started/leftnav_files delete mode 100644 tensorflow/g3doc/get_started/os_setup.md delete mode 100644 tensorflow/g3doc/how_tos/__init__.py delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/__init__.py delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/attr_examples.cc delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/cuda_op.py delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/cuda_op_kernel.cc delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/cuda_op_kernel.cu.cc delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/cuda_op_test.py delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/fact_test.py delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/zero_out_1_test.py delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/zero_out_2_test.py delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/zero_out_3_test.py delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/zero_out_grad_2.py delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_1.py delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_2.py delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_3.py delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_kernel_1.cc delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_kernel_2.cc delete mode 100644 tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_kernel_3.cc delete mode 100644 tensorflow/g3doc/how_tos/index.md delete mode 100644 tensorflow/g3doc/how_tos/leftnav_files delete mode 100644 tensorflow/g3doc/images/getting_started.dot delete mode 100644 tensorflow/g3doc/resources/bib.md delete mode 100644 tensorflow/g3doc/resources/glossary.md delete mode 100644 tensorflow/g3doc/resources/leftnav_files delete mode 100644 tensorflow/g3doc/tutorials/__init__.py delete mode 100644 tensorflow/g3doc/tutorials/deep_cnn/cifar_tensorboard.html delete mode 100644 tensorflow/g3doc/tutorials/index.md delete mode 100644 tensorflow/g3doc/tutorials/leftnav_files delete mode 100644 tensorflow/g3doc/tutorials/syntaxnet/index.md diff --git a/tensorflow/g3doc/__init__.py b/tensorflow/docs_src/__init__.py similarity index 100% rename from tensorflow/g3doc/__init__.py rename to tensorflow/docs_src/__init__.py diff --git a/tensorflow/docs_src/about/bib.md b/tensorflow/docs_src/about/bib.md new file mode 100644 index 0000000000..4123b9ebfe --- /dev/null +++ b/tensorflow/docs_src/about/bib.md @@ -0,0 +1,56 @@ +# TensorFlow White Papers + +This document identifies white papers about TensorFlow. + +### Large-Scale Machine Learning on Heterogeneous Distributed Systems + +[Access this white paper.](https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/45166.pdf) + +**Abstract:** TensorFlow is an interface for expressing machine learning +algorithms, and an implementation for executing such algorithms. +A computation expressed using TensorFlow can be +executed with little or no change on a wide variety of heterogeneous +systems, ranging from mobile devices such as phones +and tablets up to large-scale distributed systems of hundreds +of machines and thousands of computational devices such as +GPU cards. The system is flexible and can be used to express +a wide variety of algorithms, including training and inference +algorithms for deep neural network models, and it has been +used for conducting research and for deploying machine learning +systems into production across more than a dozen areas of +computer science and other fields, including speech recognition, +computer vision, robotics, information retrieval, natural +language processing, geographic information extraction, and +computational drug discovery. This paper describes the TensorFlow +interface and an implementation of that interface that +we have built at Google. The TensorFlow API and a reference +implementation were released as an open-source package under +the Apache 2.0 license in November, 2015 and are available at +www.tensorflow.org. + + +### TensorFlow: A System for Large-Scale Machine Learning + +[Access this white paper.](https://www.usenix.org/system/files/conference/osdi16/osdi16-abadi.pdf) + +**Abstract:** TensorFlow is a machine learning system that operates at +large scale and in heterogeneous environments. TensorFlow +uses dataflow graphs to represent computation, +shared state, and the operations that mutate that state. It +maps the nodes of a dataflow graph across many machines +in a cluster, and within a machine across multiple computational +devices, including multicore CPUs, generalpurpose +GPUs, and custom-designed ASICs known as +Tensor Processing Units (TPUs). This architecture gives +flexibility to the application developer: whereas in previous +“parameter server” designs the management of shared +state is built into the system, TensorFlow enables developers +to experiment with novel optimizations and training algorithms. +TensorFlow supports a variety of applications, +with a focus on training and inference on deep neural networks. +Several Google services use TensorFlow in production, +we have released it as an open-source project, and +it has become widely used for machine learning research. +In this paper, we describe the TensorFlow dataflow model +and demonstrate the compelling performance that TensorFlow +achieves for several real-world applications. diff --git a/tensorflow/g3doc/resources/index.md b/tensorflow/docs_src/about/index.md similarity index 84% rename from tensorflow/g3doc/resources/index.md rename to tensorflow/docs_src/about/index.md index 034c17436d..e98a5ae112 100644 --- a/tensorflow/g3doc/resources/index.md +++ b/tensorflow/docs_src/about/index.md @@ -12,7 +12,7 @@ The original white paper introducing TensorFlow can be found here: * [TensorFlow: Large-scale machine learning on heterogeneous systems](http://download.tensorflow.org/paper/whitepaper2015.pdf) A white paper about -[contrib.learn](https://www.tensorflow.org/tutorials/tflearn/) is also +@{$tflearn$contrib.learn} is also available: * [TF.Learn: TensorFlow's High-level Module for Distributed Machine Learning](https://arxiv.org/abs/1612.04251) @@ -21,7 +21,7 @@ available: If you use TensorFlow in your research and would like to cite the TensorFlow system, we suggest you cite the paper above. -You can use this [BibTeX entry](bib.md). As the project progresses, we +You can use this @{$bib$BibTeX entry}. As the project progresses, we may update the suggested citation with new papers. Please only use the TensorFlow name and marks when accurately referencing this @@ -36,7 +36,7 @@ TensorFlow enables researchers to build machine learning models. We collect such models in our [Zoo](https://github.com/tensorflow/models). If you have built a model with TensorFlow, you may consider publishing it there. -We keep a list of projects that use TensorFlow [here](uses.md). If you made +We keep a list of projects that use TensorFlow @{$uses$here}. If you made something amazing with TensorFlow, we'd like to hear about it! ## Community @@ -66,14 +66,14 @@ https://github.com/tensorflow/tensorflow/blob/master/CONTRIBUTING.md). For help and support, technical or algorithmic questions, please submit your questions to Stack Overflow: . -You may also find answers in our [FAQ](faq.md), our [glossary](glossary.md), or -in the [shapes, sizes and types guide](dims_types.md). Please do not use the +You may also find answers in our @{$faq$FAQ}, or +in the @{$dims_types$shapes, sizes and types guide}. Please do not use the mailing list or issue tracker for support. ### Discussions -For general discussions, please join the [TensorFlow discuss mailing list]( -https://groups.google.com/a/tensorflow.org/d/forum/discuss). +For general discussions, please join the +[TensorFlow discuss mailing list](https://groups.google.com/a/tensorflow.org/d/forum/discuss). This list is intended for general discussions about TensorFlow development and directions, not as a help forum. Instead, direct your questions to [Stack Overflow](https://stackoverflow.com/questions/tagged/tensorflow), and @@ -91,10 +91,4 @@ tracker for that. Instead, direct your questions to ## Versioning TensorFlow uses [Semantic Versioning 2.0](http://semver.org). For details on -the versioning of our public API and binary compatibility, see the [versioning -document](versions.md). Additional details for developers are in [TensorFlow -Data Versioning](data_versions.md). - -## Roadmap - -A roadmap containing what we're working on at the moment is [here](roadmap.md). +the versioning of our public API and binary compatibility, see the @{$data_versions$versioning document}. Additional details for developers are in @{$data_versions$TensorFlow Data Versioning}. diff --git a/tensorflow/docs_src/about/leftnav_files b/tensorflow/docs_src/about/leftnav_files new file mode 100644 index 0000000000..8798254ec5 --- /dev/null +++ b/tensorflow/docs_src/about/leftnav_files @@ -0,0 +1,3 @@ +index.md +bib.md +uses.md diff --git a/tensorflow/g3doc/resources/roadmap.md b/tensorflow/docs_src/about/roadmap.md similarity index 100% rename from tensorflow/g3doc/resources/roadmap.md rename to tensorflow/docs_src/about/roadmap.md diff --git a/tensorflow/g3doc/resources/uses.md b/tensorflow/docs_src/about/uses.md similarity index 100% rename from tensorflow/g3doc/resources/uses.md rename to tensorflow/docs_src/about/uses.md diff --git a/tensorflow/docs_src/api_guides/cc/guide.md b/tensorflow/docs_src/api_guides/cc/guide.md new file mode 100644 index 0000000000..2f360a33c2 --- /dev/null +++ b/tensorflow/docs_src/api_guides/cc/guide.md @@ -0,0 +1,282 @@ +# C++ API +[TOC] + +TensorFlow's C++ API provides mechanisms for constructing and executing a data +flow graph. The API is designed to be simple and concise: graph operations are +clearly expressed using a "functional" construction style, including easy +specification of names, device placement, etc., and the resulting graph can be +efficiently run and the desired outputs fetched in a few lines of code. This +guide explains the basic concepts and data structures needed to get started with +TensorFlow graph construction and execution in C++. + +## The Basics + +Let's start with a simple example that illustrates graph construction and +execution using the C++ API. + +```c++ +// tensorflow/cc/example/example.cc + +#include "tensorflow/cc/client/client_session.h" +#include "tensorflow/cc/ops/standard_ops.h" +#include "tensorflow/core/framework/tensor.h" + +int main() { + using namespace tensorflow; + using namespace tensorflow::ops; + Scope root = Scope::NewRootScope(); + // Matrix A = [3 2; -1 0] + auto A = Const(root, {{3.f, 2.f}, {-1.f, 0.f}}); + // Vector b = [3 5] + auto b = Const(root, {{3.f, 5.f}}); + // v = Ab^T + auto v = MatMul(root.WithOpName("v"), A, b, MatMul::TransposeB(true)); + std::vector outputs; + ClientSession session(root); + // Run and fetch v + TF_CHECK_OK(session.Run({v}, &outputs)); + // Expect outputs[0] == [19; -3] + LOG(INFO) << outputs[0].matrix(); + return 0; +} +``` + +Place this example code in the file `tensorflow/cc/example/example.cc` inside a +clone of the +TensorFlow +[github repository](http://www.github.com/tensorflow/tensorflow). Also place a +`BUILD` file in the same directory with the following contents: + +```python +cc_binary( + name = "example", + srcs = ["example.cc"], + deps = [ + "//tensorflow/cc:cc_ops", + "//tensorflow/cc:client_session", + "//tensorflow/core:tensorflow", + ], +) +``` + +You should be able to build and run the example using the following command: + +```shell +bazel run -c opt //tensorflow/cc/example:example +``` + +This example shows some of the important features of the C++ API such as the +following: + +* Constructing tensor constants from C++ nested initializer lists +* Constructing and naming of TensorFlow operations +* Specifying optional attributes to operation constructors +* Executing and fetching the tensor values from the TensorFlow session. + +We will delve into the details of each below. + +## Graph Construction + +### Scope + +@{tensorflow::Scope} is the main data structure that holds the current state +of graph construction. A `Scope` acts as a handle to the graph being +constructed, as well as storing TensorFlow operation properties. The `Scope` +object is the first argument to operation constructors, and operations that use +a given `Scope` as their first argument inherit that `Scopes`s properties, such +as a common name prefix. Multiple `Scopes`s can refer to the same graph, as +explained further below. + +Create a new `Scope` object by calling `Scope::NewRootScope`. This creates +some resources such as a graph to which operations are added. It also creates a +@{tensorflow::Status} object which will be used to indicate errors encountered +when constructing operations. The `Scope` class has value semantics, thus, a +`Scope` object can be freely copied and passed around. + +The `Scope` object returned by `Scope::NewRootScope` is referred +to as the root scope. "Child" scopes can be constructed from the root scope by +calling various member functions of the `Scope` class, thus forming a hierarchy +of scopes. A child scope inherits all of the properties of the parent scope and +typically has one property added or changed. For instance, `NewSubScope(name)` +appends `name` to the prefix of names for operations created using the returned +`Scope` object. + +Here are some of the properties controlled by a `Scope` object: + +* Operation names +* Set of control dependencies for an operation +* Device placement for an operation +* Kernel attribute for an operation + +Please refer to @{tensorflow::Scope} for the complete list of member functions +that let you create child scopes with new properties. + +### Operation Construtors + +You can create graph operations with operation constructors, one C++ class per +TensorFlow operation. Unlike the Python API which uses snake-case to name the +operation constructors, the C++ API uses camel-case to conform to C++ coding +style. For instance, the `MatMul` operation has a C++ class with the same name. + +Using this class-per-operation method, it is possible, though not recommended, +to construct an operation as follows: + +```c++ +// Not recommended +MatMul m(scope, a, b); +``` + +However, we recommend the following "functional" style for constructing +operations: + +```c++ +// Recommended +auto m = MatMul(scope, a, b); +``` + +The first parameter for all operation constructors is always a `Scope` object. +Tensor inputs and mandatory attributes form the rest of the arguments. + +For optional arguments, constructors have an optional parameter that allows +optional attributes. For operations with optional arguments, the constructor's +last optional parameter is a `struct` type called `[operation]:Attrs` that +contains data members for each optional attribute. You can construct such +`Attrs` in multiple ways: + +* You can specify a single optional attribute by constructing an `Attrs` object +using the `static` functions provided in the C++ class for the operation. For +example: + +```c++ +auto m = MatMul(scope, a, b, MatMul::TransposeA(true)); +``` + +* You can specify multiple optional attributes by chaining together functions + available in the `Attrs` struct. For example: + +```c++ +auto m = MatMul(scope, a, b, MatMul::TransposeA(true).TransposeB(true)); + +// Or, alternatively +auto m = MatMul(scope, a, b, MatMul::Attrs().TransposeA(true).TransposeB(true)); +``` + +The arguments and return values of operations are handled in different ways +depending on their type: + +* For operations that return single tensors, the object returned by + the operation object can be passed directly to other operation + constructors. For example: + +```c++ +auto m = MatMul(scope, x, W); +auto sum = Add(scope, m, bias); +``` + +* For operations producing multiple outputs, the object returned by the + operation constructor has a member for each of the outputs. The names of those + members are identical to the names present in the `OpDef` for the + operation. For example: + +```c++ +auto u = Unique(scope, a); +// u.y has the unique values and u.idx has the unique indices +auto m = Add(scope, u.y, b); +``` + +* Operations producing a list-typed output return an object that can + be indexed using the `[]` operator. That object can also be directly passed to + other constructors that expect list-typed inputs. For example: + +```c++ +auto s = Split(scope, 0, a, 2); +// Access elements of the returned list. +auto b = Add(scope, s[0], s[1]); +// Pass the list as a whole to other constructors. +auto c = Concat(scope, s, 0); +``` + +### Constants + +You may pass many different types of C++ values directly to tensor +constants. You may explicitly create a tensor constant by calling the +@{tensorflow::ops::Const} function from various kinds of C++ values. For +example: + +* Scalars + +```c++ +auto f = Const(scope, 42.0f); +auto s = Const(scope, "hello world!"); +``` + +* Nested initializer lists + +```c++ +// 2x2 matrix +auto c1 = Const(scope, {{1, 2}, {2, 4}}); +// 1x3x1 tensor +auto c2 = Const(scope, {{{1}, {2}, {3}}}); +// 1x2x0 tensor +auto c3 = ops::Const(scope, {{{}, {}}}); +``` + +* Shapes explicitly specified + +```c++ +// 2x2 matrix with all elements = 10 +auto c1 = Const(scope, 10, /* shape */ {2, 2}); +// 1x3x2x1 tensor +auto c2 = Const(scope, {1, 2, 3, 4, 5, 6}, /* shape */ {1, 3, 2, 1}); +``` + +You may directly pass constants to other operation constructors, either by +explicitly constructing one using the `Const` function, or implicitly as any of +the above types of C++ values. For example: + +```c++ +// [1 1] * [41; 1] +auto x = MatMul(scope, {{1, 1}}, {{41}, {1}}); +// [1 2 3 4] + 10 +auto y = Add(scope, {1, 2, 3, 4}, 10); +``` + +## Graph Execution + +When executing a graph, you will need a session. The C++ API provides a +@{tensorflow::ClientSession} class that will execute ops created by the +operation constructors. TensorFlow will automatically determine which parts of +the graph need to be executed, and what values need feeding. For example: + +```c++ +Scope root = Scope::NewRootScope(); +auto c = Const(root, {{1, 1}}); +auto m = MatMul(root, c, {{42}, {1}}); + +ClientSession session(root); +std::vector outputs; +session.Run({m}, &outputs); +// outputs[0] == {42} +``` + +Similarly, the object returned by the operation constructor can be used as the +argument to specify a value being fed when executing the graph. Furthermore, the +value to feed can be specified with the different kinds of C++ values used to +specify tensor constants. For example: + +```c++ +Scope root = Scope::NewRootScope(); +auto a = Placeholder(root, DT_INT32); +// [3 3; 3 3] +auto b = Const(root, 3, {2, 2}); +auto c = Add(root, a, b); +ClientSession session(root); +std::vector outputs; + +// Feed a <- [1 2; 3 4] +session.Run({{a, {{1, 2}, {3, 4}}}}, {c}, &outputs); +// outputs[0] == [4 5; 6 7] +``` + +Please see the @{tensorflow::Tensor} documentation for more information on how +to use the execution output. diff --git a/tensorflow/docs_src/api_guides/python/_toc.yaml b/tensorflow/docs_src/api_guides/python/_toc.yaml new file mode 100644 index 0000000000..94d0bbb8d5 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/_toc.yaml @@ -0,0 +1,91 @@ +toc: +- title: Python API Guides + section: + - title: "Asserts and boolean checks" + path: /TARGET_DOC_ROOT/api_guides/python/check_ops + - title: "Building Graphs" + path: /TARGET_DOC_ROOT/api_guides/python/framework + - title: "Constants, Sequences, and Random Values" + path: /TARGET_DOC_ROOT/api_guides/python/constant_op + - title: "Control Flow" + path: /TARGET_DOC_ROOT/api_guides/python/control_flow_ops + - title: "Data IO (Python functions)" + path: /TARGET_DOC_ROOT/api_guides/python/python_io + - title: "Higher Order Functions" + path: /TARGET_DOC_ROOT/api_guides/python/functional_ops + - title: "Histograms" + path: /TARGET_DOC_ROOT/api_guides/python/histogram_ops + - title: "Images" + path: /TARGET_DOC_ROOT/api_guides/python/image + - title: "Inputs and Readers" + path: /TARGET_DOC_ROOT/api_guides/python/io_ops + - title: "Math" + path: /TARGET_DOC_ROOT/api_guides/python/math_ops + - title: "Neural Network" + path: /TARGET_DOC_ROOT/api_guides/python/nn + - title: "Running Graphs" + path: /TARGET_DOC_ROOT/api_guides/python/client + - title: "Sparse Tensors" + path: /TARGET_DOC_ROOT/api_guides/python/sparse_ops + - title: "Strings" + path: /TARGET_DOC_ROOT/api_guides/python/string_ops + - title: "Summary Operations" + path: /TARGET_DOC_ROOT/api_guides/python/summary + - title: "TensorFlow Debugger" + path: /TARGET_DOC_ROOT/api_guides/python/tfdbg + - title: "Tensor Handle Operations" + path: /TARGET_DOC_ROOT/api_guides/python/session_ops + - title: "Tensor Transformations" + path: /TARGET_DOC_ROOT/api_guides/python/array_ops + - title: "Testing" + path: /TARGET_DOC_ROOT/api_guides/python/test + - title: "Training" + path: /TARGET_DOC_ROOT/api_guides/python/train + - title: "Variables" + path: /TARGET_DOC_ROOT/api_guides/python/state_ops + - title: "Wraps python functions" + path: /TARGET_DOC_ROOT/api_guides/python/script_ops + - title: "BayesFlow Entropy (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.bayesflow.entropy + - title: "BayesFlow Monte Carlo (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.bayesflow.monte_carlo + - title: "BayesFlow Stochastic Graph (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.bayesflow.stochastic_graph + - title: "BayesFlow Stochastic Tensors (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.bayesflow.stochastic_tensor + - title: "BayesFlow Variational Inference (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.bayesflow.variational_inference + - title: "Copying Graph Elements (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.copy_graph + - title: "CRF (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.crf + - title: "FFmpeg (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.ffmpeg + - title: "Framework (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.framework + - title: "Graph Editor (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.graph_editor + - title: "Integrate (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.integrate + - title: "Layers (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.layers + - title: "Learn (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.learn + - title: "Linear Algebra (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.linalg + - title: "Losses (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.losses + - title: "Metrics (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.metrics + - title: "Optimization (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.opt + - title: "Random variable transformations (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.distributions.bijector + - title: "RNN and Cells (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.rnn + - title: "Statistical Distributions (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.distributions + - title: "Training (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.training + - title: "Utilities (contrib)" + path: /TARGET_DOC_ROOT/api_guides/python/contrib.util diff --git a/tensorflow/docs_src/api_guides/python/array_ops.md b/tensorflow/docs_src/api_guides/python/array_ops.md new file mode 100644 index 0000000000..a34f01f073 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/array_ops.md @@ -0,0 +1,87 @@ +# Tensor Transformations + +Note: Functions taking `Tensor` arguments can also take anything accepted by +@{tf.convert_to_tensor}. + +[TOC] + +## Casting + +TensorFlow provides several operations that you can use to cast tensor data +types in your graph. + +* @{tf.string_to_number} +* @{tf.to_double} +* @{tf.to_float} +* @{tf.to_bfloat16} +* @{tf.to_int32} +* @{tf.to_int64} +* @{tf.cast} +* @{tf.bitcast} +* @{tf.saturate_cast} + +## Shapes and Shaping + +TensorFlow provides several operations that you can use to determine the shape +of a tensor and change the shape of a tensor. + +* @{tf.broadcast_dynamic_shape} +* @{tf.broadcast_static_shape} +* @{tf.shape} +* @{tf.shape_n} +* @{tf.size} +* @{tf.rank} +* @{tf.reshape} +* @{tf.squeeze} +* @{tf.expand_dims} +* @{tf.meshgrid} + +## Slicing and Joining + +TensorFlow provides several operations to slice or extract parts of a tensor, +or join multiple tensors together. + +* @{tf.slice} +* @{tf.strided_slice} +* @{tf.split} +* @{tf.tile} +* @{tf.pad} +* @{tf.concat} +* @{tf.stack} +* @{tf.parallel_stack} +* @{tf.unstack} +* @{tf.reverse_sequence} +* @{tf.reverse} +* @{tf.reverse_v2} +* @{tf.transpose} +* @{tf.extract_image_patches} +* @{tf.space_to_batch_nd} +* @{tf.space_to_batch} +* @{tf.required_space_to_batch_paddings} +* @{tf.batch_to_space_nd} +* @{tf.batch_to_space} +* @{tf.space_to_depth} +* @{tf.depth_to_space} +* @{tf.gather} +* @{tf.gather_nd} +* @{tf.unique_with_counts} +* @{tf.scatter_nd} +* @{tf.dynamic_partition} +* @{tf.dynamic_stitch} +* @{tf.boolean_mask} +* @{tf.one_hot} +* @{tf.sequence_mask} +* @{tf.dequantize} +* @{tf.quantize_v2} +* @{tf.quantized_concat} +* @{tf.setdiff1d} + +## Fake quantization +Operations used to help train for better quantization accuracy. + +* @{tf.fake_quant_with_min_max_args} +* @{tf.fake_quant_with_min_max_args_gradient} +* @{tf.fake_quant_with_min_max_vars} +* @{tf.fake_quant_with_min_max_vars_gradient} +* @{tf.fake_quant_with_min_max_vars_per_channel} +* @{tf.fake_quant_with_min_max_vars_per_channel_gradient} diff --git a/tensorflow/docs_src/api_guides/python/check_ops.md b/tensorflow/docs_src/api_guides/python/check_ops.md new file mode 100644 index 0000000000..6f8a18af42 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/check_ops.md @@ -0,0 +1,19 @@ +# Asserts and boolean checks + +* @{tf.assert_negative} +* @{tf.assert_positive} +* @{tf.assert_proper_iterable} +* @{tf.assert_non_negative} +* @{tf.assert_non_positive} +* @{tf.assert_equal} +* @{tf.assert_integer} +* @{tf.assert_less} +* @{tf.assert_less_equal} +* @{tf.assert_greater} +* @{tf.assert_greater_equal} +* @{tf.assert_rank} +* @{tf.assert_rank_at_least} +* @{tf.assert_type} +* @{tf.is_non_decreasing} +* @{tf.is_numeric_tensor} +* @{tf.is_strictly_increasing} diff --git a/tensorflow/docs_src/api_guides/python/client.md b/tensorflow/docs_src/api_guides/python/client.md new file mode 100644 index 0000000000..f5bb256d87 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/client.md @@ -0,0 +1,36 @@ +# Running Graphs +[TOC] + +This library contains classes for launching graphs and executing operations. + +The @{$get_started} guide has +examples of how a graph is launched in a @{tf.Session}. + +## Session management + +* @{tf.Session} +* @{tf.InteractiveSession} +* @{tf.get_default_session} + +## Error classes and convenience functions + +* @{tf.OpError} +* @{tf.errors.CancelledError} +* @{tf.errors.UnknownError} +* @{tf.errors.InvalidArgumentError} +* @{tf.errors.DeadlineExceededError} +* @{tf.errors.NotFoundError} +* @{tf.errors.AlreadyExistsError} +* @{tf.errors.PermissionDeniedError} +* @{tf.errors.UnauthenticatedError} +* @{tf.errors.ResourceExhaustedError} +* @{tf.errors.FailedPreconditionError} +* @{tf.errors.AbortedError} +* @{tf.errors.OutOfRangeError} +* @{tf.errors.UnimplementedError} +* @{tf.errors.InternalError} +* @{tf.errors.UnavailableError} +* @{tf.errors.DataLossError} +* @{tf.errors.exception_type_from_error_code} +* @{tf.errors.error_code_from_exception_type} +* @{tf.errors.raise_exception_on_not_ok_status} diff --git a/tensorflow/docs_src/api_guides/python/constant_op.md b/tensorflow/docs_src/api_guides/python/constant_op.md new file mode 100644 index 0000000000..db3410ce22 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/constant_op.md @@ -0,0 +1,87 @@ +# Constants, Sequences, and Random Values + +Note: Functions taking `Tensor` arguments can also take anything accepted by +@{tf.convert_to_tensor}. + +[TOC] + +## Constant Value Tensors + +TensorFlow provides several operations that you can use to generate constants. + +* @{tf.zeros} +* @{tf.zeros_like} +* @{tf.ones} +* @{tf.ones_like} +* @{tf.fill} +* @{tf.constant} + +## Sequences + +* @{tf.linspace} +* @{tf.range} + +## Random Tensors + +TensorFlow has several ops that create random tensors with different +distributions. The random ops are stateful, and create new random values each +time they are evaluated. + +The `seed` keyword argument in these functions acts in conjunction with +the graph-level random seed. Changing either the graph-level seed using +@{tf.set_random_seed} or the +op-level seed will change the underlying seed of these operations. Setting +neither graph-level nor op-level seed, results in a random seed for all +operations. +See @{tf.set_random_seed} +for details on the interaction between operation-level and graph-level random +seeds. + +### Examples: + +```python +# Create a tensor of shape [2, 3] consisting of random normal values, with mean +# -1 and standard deviation 4. +norm = tf.random_normal([2, 3], mean=-1, stddev=4) + +# Shuffle the first dimension of a tensor +c = tf.constant([[1, 2], [3, 4], [5, 6]]) +shuff = tf.random_shuffle(c) + +# Each time we run these ops, different results are generated +sess = tf.Session() +print(sess.run(norm)) +print(sess.run(norm)) + +# Set an op-level seed to generate repeatable sequences across sessions. +norm = tf.random_normal([2, 3], seed=1234) +sess = tf.Session() +print(sess.run(norm)) +print(sess.run(norm)) +sess = tf.Session() +print(sess.run(norm)) +print(sess.run(norm)) +``` + +Another common use of random values is the initialization of variables. Also see +the @{$variables$Variables How To}. + +```python +# Use random uniform values in [0, 1) as the initializer for a variable of shape +# [2, 3]. The default type is float32. +var = tf.Variable(tf.random_uniform([2, 3]), name="var") +init = tf.global_variables_initializer() + +sess = tf.Session() +sess.run(init) +print(sess.run(var)) +``` + +* @{tf.random_normal} +* @{tf.truncated_normal} +* @{tf.random_uniform} +* @{tf.random_shuffle} +* @{tf.random_crop} +* @{tf.multinomial} +* @{tf.random_gamma} +* @{tf.set_random_seed} diff --git a/tensorflow/docs_src/api_guides/python/contrib.bayesflow.entropy.md b/tensorflow/docs_src/api_guides/python/contrib.bayesflow.entropy.md new file mode 100644 index 0000000000..1ef72d7b44 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.bayesflow.entropy.md @@ -0,0 +1,47 @@ +# BayesFlow Entropy (contrib) +[TOC] + +Entropy Ops. + +## Background + +Common Shannon entropy, the Evidence Lower BOund (ELBO), KL divergence, and more +all have information theoretic use and interpretations. They are also often +used in variational inference. This library brings together `Ops` for +estimating them, e.g. using Monte Carlo expectations. + +## Examples + +Example of fitting a variational posterior with the ELBO. + +```python +# We start by assuming knowledge of the log of a joint density p(z, x) over +# latent variable z and fixed measurement x. Since x is fixed, the Python +# function does not take x as an argument. +def log_joint(z): + theta = tf.Variable(0.) # Trainable variable that helps define log_joint. + ... + +# Next, define a Normal distribution with trainable parameters. +q = distributions.Normal(mu=tf.Variable(0.), sigma=tf.Variable(1.)) + +# Now, define a loss function (negative ELBO) that, when minimized, will adjust +# mu, sigma, and theta, increasing the ELBO, which we hope will both reduce the +# KL divergence between q(z) and p(z | x), and increase p(x). Note that we +# cannot guarantee both, but in general we expect both to happen. +elbo = entropy.elbo_ratio(log_p, q, n=10) +loss = -elbo + +# Minimize the loss +train_op = tf.train.GradientDescentOptimizer(0.1).minimize(loss) +tf.global_variables_initializer().run() +for step in range(100): + train_op.run() +``` + +## Ops + +* @{tf.contrib.bayesflow.entropy.elbo_ratio} +* @{tf.contrib.bayesflow.entropy.entropy_shannon} +* @{tf.contrib.bayesflow.entropy.renyi_ratio} +* @{tf.contrib.bayesflow.entropy.renyi_alpha} diff --git a/tensorflow/docs_src/api_guides/python/contrib.bayesflow.monte_carlo.md b/tensorflow/docs_src/api_guides/python/contrib.bayesflow.monte_carlo.md new file mode 100644 index 0000000000..956dccb64f --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.bayesflow.monte_carlo.md @@ -0,0 +1,54 @@ +# BayesFlow Monte Carlo (contrib) +[TOC] + +Monte Carlo integration and helpers. + +## Background + +Monte Carlo integration refers to the practice of estimating an expectation with +a sample mean. For example, given random variable `Z in R^k` with density `p`, +the expectation of function `f` can be approximated like: + +``` +E_p[f(Z)] = \int f(z) p(z) dz + ~ S_n + := n^{-1} \sum_{i=1}^n f(z_i), z_i iid samples from p. +``` + +If `E_p[|f(Z)|] < infinity`, then `S_n --> E_p[f(Z)]` by the strong law of large +numbers. If `E_p[f(Z)^2] < infinity`, then `S_n` is asymptotically normal with +variance `Var[f(Z)] / n`. + +Practitioners of Bayesian statistics often find themselves wanting to estimate +`E_p[f(Z)]` when the distribution `p` is known only up to a constant. For +example, the joint distribution `p(z, x)` may be known, but the evidence +`p(x) = \int p(z, x) dz` may be intractable. In that case, a parameterized +distribution family `q_lambda(z)` may be chosen, and the optimal `lambda` is the +one minimizing the KL divergence between `q_lambda(z)` and +`p(z | x)`. We only know `p(z, x)`, but that is sufficient to find `lambda`. + + +## Log-space evaluation and subtracting the maximum + +Care must be taken when the random variable lives in a high dimensional space. +For example, the naive importance sample estimate `E_q[f(Z) p(Z) / q(Z)]` +involves the ratio of two terms `p(Z) / q(Z)`, each of which must have tails +dropping off faster than `O(|z|^{-(k + 1)})` in order to have finite integral. +This ratio would often be zero or infinity up to numerical precision. + +For that reason, we write + +``` +Log E_q[ f(Z) p(Z) / q(Z) ] + = Log E_q[ exp{Log[f(Z)] + Log[p(Z)] - Log[q(Z)] - C} ] + C, where +C := Max[ Log[f(Z)] + Log[p(Z)] - Log[q(Z)] ]. +``` + +The maximum value of the exponentiated term will be 0.0, and the expectation +can be evaluated in a stable manner. + +## Ops + +* @{tf.contrib.bayesflow.monte_carlo.expectation} +* @{tf.contrib.bayesflow.monte_carlo.expectation_importance_sampler} +* @{tf.contrib.bayesflow.monte_carlo.expectation_importance_sampler_logspace} diff --git a/tensorflow/docs_src/api_guides/python/contrib.bayesflow.stochastic_graph.md b/tensorflow/docs_src/api_guides/python/contrib.bayesflow.stochastic_graph.md new file mode 100644 index 0000000000..2b57534069 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.bayesflow.stochastic_graph.md @@ -0,0 +1,8 @@ +# BayesFlow Stochastic Graph (contrib) +[TOC] + +Classes and helper functions for Stochastic Computation Graphs. + +## Stochastic Computation Graph Helper Functions + +* @{tf.contrib.bayesflow.stochastic_graph.surrogate_loss} diff --git a/tensorflow/docs_src/api_guides/python/contrib.bayesflow.stochastic_tensor.md b/tensorflow/docs_src/api_guides/python/contrib.bayesflow.stochastic_tensor.md new file mode 100644 index 0000000000..e90f58a822 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.bayesflow.stochastic_tensor.md @@ -0,0 +1,24 @@ +# BayesFlow Stochastic Tensors (contrib) +[TOC] + +Classes and helper functions for creating Stochastic Tensors. + +`StochasticTensor` objects wrap `Distribution` objects. Their +values may be samples from the underlying distribution, or the distribution +mean (as governed by `value_type`). These objects provide a `loss` +method for use when sampling from a non-reparameterized distribution. +The `loss`method is used in conjunction with `stochastic_graph.surrogate_loss` +to produce a single differentiable loss in stochastic graphs having +both continuous and discrete stochastic nodes. + +## Stochastic Tensor Classes + +* @{tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor} +* @{tf.contrib.bayesflow.stochastic_tensor.StochasticTensor} + +## Stochastic Tensor Value Types + +* @{tf.contrib.bayesflow.stochastic_tensor.MeanValue} +* @{tf.contrib.bayesflow.stochastic_tensor.SampleValue} +* @{tf.contrib.bayesflow.stochastic_tensor.value_type} +* @{tf.contrib.bayesflow.stochastic_tensor.get_current_value_type} diff --git a/tensorflow/docs_src/api_guides/python/contrib.bayesflow.variational_inference.md b/tensorflow/docs_src/api_guides/python/contrib.bayesflow.variational_inference.md new file mode 100644 index 0000000000..e6070b9aea --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.bayesflow.variational_inference.md @@ -0,0 +1,11 @@ +# BayesFlow Variational Inference (contrib) +[TOC] + +Variational inference. + +## Ops + +* @{tf.contrib.bayesflow.variational_inference.elbo} +* @{tf.contrib.bayesflow.variational_inference.elbo_with_log_joint} +* @{tf.contrib.bayesflow.variational_inference.ELBOForms} +* @{tf.contrib.bayesflow.variational_inference.register_prior} diff --git a/tensorflow/docs_src/api_guides/python/contrib.copy_graph.md b/tensorflow/docs_src/api_guides/python/contrib.copy_graph.md new file mode 100644 index 0000000000..f61f4c764d --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.copy_graph.md @@ -0,0 +1,4 @@ +# Copying Graph Elements (contrib) +[TOC] + +Functions for copying elements from one graph to another. diff --git a/tensorflow/docs_src/api_guides/python/contrib.crf.md b/tensorflow/docs_src/api_guides/python/contrib.crf.md new file mode 100644 index 0000000000..428383fd41 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.crf.md @@ -0,0 +1,11 @@ +# CRF (contrib) + +Linear-chain CRF layer. + +* @{tf.contrib.crf.crf_sequence_score} +* @{tf.contrib.crf.crf_log_norm} +* @{tf.contrib.crf.crf_log_likelihood} +* @{tf.contrib.crf.crf_unary_score} +* @{tf.contrib.crf.crf_binary_score} +* @{tf.contrib.crf.CrfForwardRnnCell} +* @{tf.contrib.crf.viterbi_decode} diff --git a/tensorflow/docs_src/api_guides/python/contrib.distributions.bijector.md b/tensorflow/docs_src/api_guides/python/contrib.distributions.bijector.md new file mode 100644 index 0000000000..16a47bfd8b --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.distributions.bijector.md @@ -0,0 +1,33 @@ +# Random variable transformations (contrib) +[TOC] + +Bijector Ops. + +An API for invertible, differentiable transformations of random variables. + +## Background + +Differentiable, bijective transformations of continuous random variables alter +the calculations made in the cumulative/probability distribution functions and +sample function. This module provides a standard interface for making these +manipulations. + +For more details and examples, see the `Bijector` docstring. + +To apply a `Bijector`, use `distributions.TransformedDistribution`. + +## Bijectors + +* @{tf.contrib.distributions.bijector.Affine} +* @{tf.contrib.distributions.bijector.AffineLinearOperator} +* @{tf.contrib.distributions.bijector.Bijector} +* @{tf.contrib.distributions.bijector.Chain} +* @{tf.contrib.distributions.bijector.CholeskyOuterProduct} +* @{tf.contrib.distributions.bijector.Exp} +* @{tf.contrib.distributions.bijector.Identity} +* @{tf.contrib.distributions.bijector.Inline} +* @{tf.contrib.distributions.bijector.Invert} +* @{tf.contrib.distributions.bijector.PowerTransform} +* @{tf.contrib.distributions.bijector.SigmoidCentered} +* @{tf.contrib.distributions.bijector.SoftmaxCentered} +* @{tf.contrib.distributions.bijector.Softplus} diff --git a/tensorflow/docs_src/api_guides/python/contrib.distributions.md b/tensorflow/docs_src/api_guides/python/contrib.distributions.md new file mode 100644 index 0000000000..2b43e1281d --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.distributions.md @@ -0,0 +1,84 @@ +# Statistical Distributions (contrib) +[TOC] + +Classes representing statistical distributions and ops for working with them. + +## Classes for statistical distributions + +Classes that represent batches of statistical distributions. Each class is +initialized with parameters that define the distributions. + +## Base classes + +* @{tf.contrib.distributions.ReparameterizationType} +* @{tf.contrib.distributions.Distribution} + +## Univariate (scalar) distributions + +* @{tf.contrib.distributions.Binomial} +* @{tf.contrib.distributions.Bernoulli} +* @{tf.contrib.distributions.BernoulliWithSigmoidProbs} +* @{tf.contrib.distributions.Beta} +* @{tf.contrib.distributions.Categorical} +* @{tf.contrib.distributions.Chi2} +* @{tf.contrib.distributions.Chi2WithAbsDf} +* @{tf.contrib.distributions.Exponential} +* @{tf.contrib.distributions.Gamma} +* @{tf.contrib.distributions.InverseGamma} +* @{tf.contrib.distributions.Laplace} +* @{tf.contrib.distributions.LaplaceWithSoftplusScale} +* @{tf.contrib.distributions.Normal} +* @{tf.contrib.distributions.NormalWithSoftplusScale} +* @{tf.contrib.distributions.Poisson} +* @{tf.contrib.distributions.StudentT} +* @{tf.contrib.distributions.StudentTWithAbsDfSoftplusScale} +* @{tf.contrib.distributions.Uniform} + +## Multivariate distributions + +### Multivariate normal + +* @{tf.contrib.distributions.MultivariateNormalDiag} +* @{tf.contrib.distributions.MultivariateNormalTriL} +* @{tf.contrib.distributions.MultivariateNormalDiagPlusLowRank} +* @{tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale} + +### Other multivariate distributions + +* @{tf.contrib.distributions.Dirichlet} +* @{tf.contrib.distributions.DirichletMultinomial} +* @{tf.contrib.distributions.Multinomial} +* @{tf.contrib.distributions.WishartCholesky} +* @{tf.contrib.distributions.WishartFull} + +### Multivariate Utilities + +* @{tf.contrib.distributions.matrix_diag_transform} + +## Transformed distributions + +* @{tf.contrib.distributions.TransformedDistribution} +* @{tf.contrib.distributions.QuantizedDistribution} + +## Mixture Models + +* @{tf.contrib.distributions.Mixture} + +## Posterior inference with conjugate priors + +Functions that transform conjugate prior/likelihood pairs to distributions +representing the posterior or posterior predictive. + +## Normal likelihood with conjugate prior + +* @{tf.contrib.distributions.normal_conjugates_known_scale_posterior} +* @{tf.contrib.distributions.normal_conjugates_known_scale_predictive} + +## Kullback-Leibler Divergence + +* @{tf.contrib.distributions.kl} +* @{tf.contrib.distributions.RegisterKL} + +## Utilities + +* @{tf.contrib.distributions.softplus_inverse} diff --git a/tensorflow/docs_src/api_guides/python/contrib.ffmpeg.md b/tensorflow/docs_src/api_guides/python/contrib.ffmpeg.md new file mode 100644 index 0000000000..27948689c5 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.ffmpeg.md @@ -0,0 +1,23 @@ +# FFmpeg (contrib) +[TOC] + +## Encoding and decoding audio using FFmpeg + +TensorFlow provides Ops to decode and encode audio files using the +[FFmpeg](https://www.ffmpeg.org/) library. FFmpeg must be +locally [installed](https://ffmpeg.org/download.html) for these Ops to succeed. + +Example: + +```python +from tensorflow.contrib import ffmpeg + +audio_binary = tf.read_file('song.mp3') +waveform = ffmpeg.decode_audio( + audio_binary, file_format='mp3', samples_per_second=44100, channel_count=2) +uncompressed_binary = ffmpeg.encode_audio( + waveform, file_format='wav', samples_per_second=44100) +``` + +* @{tf.contrib.ffmpeg.decode_audio} +* @{tf.contrib.ffmpeg.encode_audio} diff --git a/tensorflow/docs_src/api_guides/python/contrib.framework.md b/tensorflow/docs_src/api_guides/python/contrib.framework.md new file mode 100644 index 0000000000..f7f26e5626 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.framework.md @@ -0,0 +1,61 @@ +# Framework (contrib) +[TOC] + +Framework utilities. + +* @{tf.contrib.framework.assert_same_float_dtype} +* @{tf.contrib.framework.assert_scalar} +* @{tf.contrib.framework.assert_scalar_int} +* @{tf.convert_to_tensor_or_sparse_tensor} +* @{tf.contrib.framework.get_graph_from_inputs} +* @{tf.is_numeric_tensor} +* @{tf.is_non_decreasing} +* @{tf.is_strictly_increasing} +* @{tf.contrib.framework.is_tensor} +* @{tf.contrib.framework.reduce_sum_n} +* @{tf.contrib.framework.remove_squeezable_dimensions} +* @{tf.contrib.framework.with_shape} +* @{tf.contrib.framework.with_same_shape} + +## Deprecation +* @{tf.contrib.framework.deprecated} +* @{tf.contrib.framework.deprecated_args} +* @{tf.contrib.framework.deprecated_arg_values} + +## Arg_Scope +* @{tf.contrib.framework.arg_scope} +* @{tf.contrib.framework.add_arg_scope} +* @{tf.contrib.framework.has_arg_scope} +* @{tf.contrib.framework.arg_scoped_arguments} + +## Variables +* @{tf.contrib.framework.add_model_variable} +* @{tf.train.assert_global_step} +* @{tf.contrib.framework.assert_or_get_global_step} +* @{tf.contrib.framework.assign_from_checkpoint} +* @{tf.contrib.framework.assign_from_checkpoint_fn} +* @{tf.contrib.framework.assign_from_values} +* @{tf.contrib.framework.assign_from_values_fn} +* @{tf.contrib.framework.create_global_step} +* @{tf.contrib.framework.filter_variables} +* @{tf.train.get_global_step} +* @{tf.contrib.framework.get_or_create_global_step} +* @{tf.contrib.framework.get_local_variables} +* @{tf.contrib.framework.get_model_variables} +* @{tf.contrib.framework.get_unique_variable} +* @{tf.contrib.framework.get_variables_by_name} +* @{tf.contrib.framework.get_variables_by_suffix} +* @{tf.contrib.framework.get_variables_to_restore} +* @{tf.contrib.framework.get_variables} +* @{tf.contrib.framework.local_variable} +* @{tf.contrib.framework.model_variable} +* @{tf.contrib.framework.variable} +* @{tf.contrib.framework.VariableDeviceChooser} +* @{tf.contrib.framework.zero_initializer} + +## Checkpoint utilities + +* @{tf.contrib.framework.load_checkpoint} +* @{tf.contrib.framework.list_variables} +* @{tf.contrib.framework.load_variable} +* @{tf.contrib.framework.init_from_checkpoint} diff --git a/tensorflow/docs_src/api_guides/python/contrib.graph_editor.md b/tensorflow/docs_src/api_guides/python/contrib.graph_editor.md new file mode 100644 index 0000000000..10296ee4d7 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.graph_editor.md @@ -0,0 +1,182 @@ +# Graph Editor (contrib) +[TOC] + +TensorFlow Graph Editor. + +The TensorFlow Graph Editor library allows for modification of an existing +`tf.Graph` instance in-place. + +The author's github username is [purpledog](https://github.com/purpledog). + +## Library overview + +Appending new nodes is the only graph editing operation allowed by the +TensorFlow core library. The Graph Editor library is an attempt to allow for +other kinds of editing operations, namely, *rerouting* and *transforming*. + +* *rerouting* is a local operation consisting in re-plugging existing tensors + (the edges of the graph). Operations (the nodes) are not modified by this + operation. For example, rerouting can be used to insert an operation adding + noise in place of an existing tensor. +* *transforming* is a global operation consisting in transforming a graph into + another. By default, a transformation is a simple copy but it can be + customized to achieved other goals. For instance, a graph can be transformed + into another one in which noise is added after all the operations of a + specific type. + +**Important: modifying a graph in-place with the Graph Editor must be done +`offline`, that is, without any active sessions.** + +Of course new operations can be appended online but Graph Editor specific +operations like rerouting and transforming can currently only be done offline. + +Here is an example of what you **cannot** do: + +* Build a graph. +* Create a session and run the graph. +* Modify the graph with the Graph Editor. +* Re-run the graph with the `same` previously created session. + +To edit an already running graph, follow these steps: + +* Build a graph. +* Create a session and run the graph. +* Save the graph state and terminate the session +* Modify the graph with the Graph Editor. +* create a new session and restore the graph state +* Re-run the graph with the newly created session. + +Note that this procedure is very costly because a new session must be created +after any modifications. Among other things, it takes time because the entire +graph state must be saved and restored again. + +## Sub-graph + +Most of the functions in the Graph Editor library operate on *sub-graph*. +More precisely, they take as input arguments instances of the SubGraphView class +(or anything which can be converted to it). Doing so allows the same function +to transparently operate on single operations as well as sub-graph of any size. + +A subgraph can be created in several ways: + +* using a list of ops: + +```python +my_sgv = ge.sgv(ops) +``` + +* from a name scope: + +```python +my_sgv = ge.sgv_scope("foo/bar", graph=tf.get_default_graph()) +``` + +* using regular expression: + +```python +my_sgv = ge.sgv("foo/.*/.*read$", graph=tf.get_default_graph()) +``` + +Note that the Graph Editor is meant to manipulate several graphs at the same +time, typically during transform or copy operation. For that reason, +to avoid any confusion, the default graph is never used and the graph on +which to operate must always be given explicitly. This is the reason why +*`graph=tf.get_default_graph()`* is used in the code snippets above. + +## Modules overview + +* util: utility functions. +* select: various selection methods of TensorFlow tensors and operations. +* match: TensorFlow graph matching. Think of this as regular expressions for + graphs (but not quite yet). +* reroute: various ways of rerouting tensors to different consuming ops like + *swap* or *reroute_a2b*. +* subgraph: the SubGraphView class, which enables subgraph manipulations in a + TensorFlow `tf.Graph`. +* edit: various editing functions operating on subgraphs like *detach*, + *connect* or *bypass*. +* transform: the Transformer class, which enables transforming + (or simply copying) a subgraph into another one. + +## Module: util + +* @{tf.contrib.graph_editor.make_list_of_op} +* @{tf.contrib.graph_editor.get_tensors} +* @{tf.contrib.graph_editor.make_list_of_t} +* @{tf.contrib.graph_editor.get_generating_ops} +* @{tf.contrib.graph_editor.get_consuming_ops} +* @{tf.contrib.graph_editor.ControlOutputs} +* @{tf.contrib.graph_editor.placeholder_name} +* @{tf.contrib.graph_editor.make_placeholder_from_tensor} +* @{tf.contrib.graph_editor.make_placeholder_from_dtype_and_shape} + +## Module: select + +* @{tf.contrib.graph_editor.filter_ts} +* @{tf.contrib.graph_editor.filter_ts_from_regex} +* @{tf.contrib.graph_editor.filter_ops} +* @{tf.contrib.graph_editor.filter_ops_from_regex} +* @{tf.contrib.graph_editor.get_name_scope_ops} +* @{tf.contrib.graph_editor.check_cios} +* @{tf.contrib.graph_editor.get_ops_ios} +* @{tf.contrib.graph_editor.compute_boundary_ts} +* @{tf.contrib.graph_editor.get_within_boundary_ops} +* @{tf.contrib.graph_editor.get_forward_walk_ops} +* @{tf.contrib.graph_editor.get_backward_walk_ops} +* @{tf.contrib.graph_editor.get_walks_intersection_ops} +* @{tf.contrib.graph_editor.get_walks_union_ops} +* @{tf.contrib.graph_editor.select_ops} +* @{tf.contrib.graph_editor.select_ts} +* @{tf.contrib.graph_editor.select_ops_and_ts} + +## Module: subgraph + +* @{tf.contrib.graph_editor.SubGraphView} +* @{tf.contrib.graph_editor.make_view} +* @{tf.contrib.graph_editor.make_view_from_scope} + +## Module: reroute + +* @{tf.contrib.graph_editor.reroute.swap_ts} +* @{tf.contrib.graph_editor.reroute.reroute_ts} +* @{tf.contrib.graph_editor.reroute.swap_inputs} +* @{tf.contrib.graph_editor.reroute.reroute_inputs} +* @{tf.contrib.graph_editor.reroute.swap_outputs} +* @{tf.contrib.graph_editor.reroute.reroute_outputs} +* @{tf.contrib.graph_editor.reroute.swap_ios} +* @{tf.contrib.graph_editor.reroute.reroute_ios} +* @{tf.contrib.graph_editor.reroute.remove_control_inputs} +* @{tf.contrib.graph_editor.reroute.add_control_inputs} + +## Module: edit + +* @{tf.contrib.graph_editor.detach_control_inputs} +* @{tf.contrib.graph_editor.detach_control_outputs} +* @{tf.contrib.graph_editor.detach_inputs} +* @{tf.contrib.graph_editor.detach_outputs} +* @{tf.contrib.graph_editor.detach} +* @{tf.contrib.graph_editor.connect} +* @{tf.contrib.graph_editor.bypass} + +## Module: transform + +* @{tf.contrib.graph_editor.replace_t_with_placeholder_handler} +* @{tf.contrib.graph_editor.keep_t_if_possible_handler} +* @{tf.contrib.graph_editor.assign_renamed_collections_handler} +* @{tf.contrib.graph_editor.transform_op_if_inside_handler} +* @{tf.contrib.graph_editor.copy_op_handler} +* @{tf.contrib.graph_editor.Transformer} +* @{tf.contrib.graph_editor.copy} +* @{tf.contrib.graph_editor.copy_with_input_replacements} +* @{tf.contrib.graph_editor.graph_replace} + +## Module: match + +* @{tf.contrib.graph_editor.op_type} +* @{tf.contrib.graph_editor.OpMatcher} + +## Useful aliases + +* @{tf.contrib.graph_editor.ph} +* @{tf.contrib.graph_editor.sgv} +* @{tf.contrib.graph_editor.sgv_scope} diff --git a/tensorflow/docs_src/api_guides/python/contrib.integrate.md b/tensorflow/docs_src/api_guides/python/contrib.integrate.md new file mode 100644 index 0000000000..e6b730b203 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.integrate.md @@ -0,0 +1,41 @@ +# Integrate (contrib) +[TOC] + +Integration and ODE solvers for TensorFlow. + +## Example: Lorenz attractor + +We can use `odeint` to solve the +[Lorentz system](https://en.wikipedia.org/wiki/Lorenz_system) of ordinary +differential equations, a prototypical example of chaotic dynamics: + +```python +rho = 28.0 +sigma = 10.0 +beta = 8.0/3.0 + +def lorenz_equation(state, t): + x, y, z = tf.unstack(state) + dx = sigma * (y - x) + dy = x * (rho - z) - y + dz = x * y - beta * z + return tf.stack([dx, dy, dz]) + +init_state = tf.constant([0, 2, 20], dtype=tf.float64) +t = np.linspace(0, 50, num=5000) +tensor_state, tensor_info = tf.contrib.integrate.odeint( + lorenz_equation, init_state, t, full_output=True) + +sess = tf.Session() +state, info = sess.run([tensor_state, tensor_info]) +x, y, z = state.T +plt.plot(x, z) +``` + +
+ +
+ +## Ops + +* @{tf.contrib.integrate.odeint} diff --git a/tensorflow/docs_src/api_guides/python/contrib.layers.md b/tensorflow/docs_src/api_guides/python/contrib.layers.md new file mode 100644 index 0000000000..a829c0a02c --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.layers.md @@ -0,0 +1,109 @@ +# Layers (contrib) +[TOC] + +Ops for building neural network layers, regularizers, summaries, etc. + +## Higher level ops for building neural network layers + +This package provides several ops that take care of creating variables that are +used internally in a consistent way and provide the building blocks for many +common machine learning algorithms. + +* @{tf.contrib.layers.avg_pool2d} +* @{tf.contrib.layers.batch_norm} +* @{tf.contrib.layers.convolution2d} +* @{tf.contrib.layers.conv2d_in_plane} +* @{tf.contrib.layers.convolution2d_in_plane} +* @{tf.nn.conv2d_transpose} +* @{tf.contrib.layers.convolution2d_transpose} +* @{tf.nn.dropout} +* @{tf.contrib.layers.flatten} +* @{tf.contrib.layers.fully_connected} +* @{tf.contrib.layers.layer_norm} +* @{tf.contrib.layers.linear} +* @{tf.contrib.layers.max_pool2d} +* @{tf.contrib.layers.one_hot_encoding} +* @{tf.nn.relu} +* @{tf.nn.relu6} +* @{tf.contrib.layers.repeat} +* @{tf.contrib.layers.safe_embedding_lookup_sparse} +* @{tf.nn.separable_conv2d} +* @{tf.contrib.layers.separable_convolution2d} +* @{tf.nn.softmax} +* @{tf.stack} +* @{tf.contrib.layers.unit_norm} +* @{tf.contrib.layers.embed_sequence} + +Aliases for fully_connected which set a default activation function are +available: `relu`, `relu6` and `linear`. + +`stack` operation is also available. It builds a stack of layers by applying +a layer repeatedly. + +## Regularizers + +Regularization can help prevent overfitting. These have the signature +`fn(weights)`. The loss is typically added to +`tf.GraphKeys.REGULARIZATION_LOSSES`. + +* @{tf.contrib.layers.apply_regularization} +* @{tf.contrib.layers.l1_regularizer} +* @{tf.contrib.layers.l2_regularizer} +* @{tf.contrib.layers.sum_regularizer} + +## Initializers + +Initializers are used to initialize variables with sensible values given their +size, data type, and purpose. + +* @{tf.contrib.layers.xavier_initializer} +* @{tf.contrib.layers.xavier_initializer_conv2d} +* @{tf.contrib.layers.variance_scaling_initializer} + +## Optimization + +Optimize weights given a loss. + +* @{tf.contrib.layers.optimize_loss} + +## Summaries + +Helper functions to summarize specific variables or ops. + +* @{tf.contrib.layers.summarize_activation} +* @{tf.contrib.layers.summarize_tensor} +* @{tf.contrib.layers.summarize_tensors} +* @{tf.contrib.layers.summarize_collection} + +The layers module defines convenience functions `summarize_variables`, +`summarize_weights` and `summarize_biases`, which set the `collection` argument +of `summarize_collection` to `VARIABLES`, `WEIGHTS` and `BIASES`, respectively. + +* @{tf.contrib.layers.summarize_activations} + +## Feature columns + +Feature columns provide a mechanism to map data to a model. + +* @{tf.contrib.layers.bucketized_column} +* @{tf.contrib.layers.check_feature_columns} +* @{tf.contrib.layers.create_feature_spec_for_parsing} +* @{tf.contrib.layers.crossed_column} +* @{tf.contrib.layers.embedding_column} +* @{tf.contrib.layers.scattered_embedding_column} +* @{tf.contrib.layers.input_from_feature_columns} +* @{tf.contrib.layers.joint_weighted_sum_from_feature_columns} +* @{tf.contrib.layers.make_place_holder_tensors_for_base_features} +* @{tf.contrib.layers.multi_class_target} +* @{tf.contrib.layers.one_hot_column} +* @{tf.contrib.layers.parse_feature_columns_from_examples} +* @{tf.contrib.layers.parse_feature_columns_from_sequence_examples} +* @{tf.contrib.layers.real_valued_column} +* @{tf.contrib.layers.shared_embedding_columns} +* @{tf.contrib.layers.sparse_column_with_hash_bucket} +* @{tf.contrib.layers.sparse_column_with_integerized_feature} +* @{tf.contrib.layers.sparse_column_with_keys} +* @{tf.contrib.layers.weighted_sparse_column} +* @{tf.contrib.layers.weighted_sum_from_feature_columns} +* @{tf.contrib.layers.infer_real_valued_columns} +* @{tf.contrib.layers.sequence_input_from_feature_columns} diff --git a/tensorflow/docs_src/api_guides/python/contrib.learn.md b/tensorflow/docs_src/api_guides/python/contrib.learn.md new file mode 100644 index 0000000000..8b2fffa201 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.learn.md @@ -0,0 +1,62 @@ +# Learn (contrib) +[TOC] + +High level API for learning with TensorFlow. + +## Estimators + +Train and evaluate TensorFlow models. + +* @{tf.contrib.learn.BaseEstimator} +* @{tf.contrib.learn.Estimator} +* @{tf.contrib.learn.Trainable} +* @{tf.contrib.learn.Evaluable} +* @{tf.contrib.learn.KMeansClustering} +* @{tf.contrib.learn.ModeKeys} +* @{tf.contrib.learn.ModelFnOps} +* @{tf.contrib.learn.MetricSpec} +* @{tf.contrib.learn.PredictionKey} +* @{tf.contrib.learn.DNNClassifier} +* @{tf.contrib.learn.DNNRegressor} +* @{tf.contrib.learn.DNNLinearCombinedRegressor} +* @{tf.contrib.learn.DNNLinearCombinedClassifier} +* @{tf.contrib.learn.LinearClassifier} +* @{tf.contrib.learn.LinearRegressor} +* @{tf.contrib.learn.LogisticRegressor} + +## Distributed training utilities +* @{tf.contrib.learn.Experiment} +* @{tf.contrib.learn.ExportStrategy} +* @{tf.contrib.learn.TaskType} + +## Graph actions + +Perform various training, evaluation, and inference actions on a graph. + +* @{tf.train.NanLossDuringTrainingError} +* @{tf.contrib.learn.RunConfig} +* @{tf.contrib.learn.evaluate} +* @{tf.contrib.learn.infer} +* @{tf.contrib.learn.run_feeds} +* @{tf.contrib.learn.run_n} +* @{tf.contrib.learn.train} + +## Input processing + +Queue and read batched input data. + +* @{tf.contrib.learn.extract_dask_data} +* @{tf.contrib.learn.extract_dask_labels} +* @{tf.contrib.learn.extract_pandas_data} +* @{tf.contrib.learn.extract_pandas_labels} +* @{tf.contrib.learn.extract_pandas_matrix} +* @{tf.contrib.learn.infer_real_valued_columns_from_input} +* @{tf.contrib.learn.infer_real_valued_columns_from_input_fn} +* @{tf.contrib.learn.read_batch_examples} +* @{tf.contrib.learn.read_batch_features} +* @{tf.contrib.learn.read_batch_record_features} + +Export utilities + +* @{tf.contrib.learn.build_parsing_serving_input_fn} +* @{tf.contrib.learn.ProblemType} diff --git a/tensorflow/docs_src/api_guides/python/contrib.linalg.md b/tensorflow/docs_src/api_guides/python/contrib.linalg.md new file mode 100644 index 0000000000..efc2d76ef1 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.linalg.md @@ -0,0 +1,30 @@ +# Linear Algebra (contrib) +[TOC] + +Linear algebra libraries for TensorFlow. + +## `LinearOperator` + +Subclasses of `LinearOperator` provide a access to common methods on a +(batch) matrix, without the need to materialize the matrix. This allows: + +* Matrix free computations +* Different operators to take advantage of special strcture, while providing a + consistent API to users. + +### Base class + +* @{tf.contrib.linalg.LinearOperator} + +### Individual operators + +* @{tf.contrib.linalg.LinearOperatorDiag} +* @{tf.contrib.linalg.LinearOperatorIdentity} +* @{tf.contrib.linalg.LinearOperatorScaledIdentity} +* @{tf.contrib.linalg.LinearOperatorMatrix} +* @{tf.contrib.linalg.LinearOperatorTriL} +* @{tf.contrib.linalg.LinearOperatorUDVHUpdate} + +### Transformations and Combinations of operators + +* @{tf.contrib.linalg.LinearOperatorComposition} diff --git a/tensorflow/docs_src/api_guides/python/contrib.losses.md b/tensorflow/docs_src/api_guides/python/contrib.losses.md new file mode 100644 index 0000000000..cb93f9d549 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.losses.md @@ -0,0 +1,126 @@ +# Losses (contrib) + +## Loss operations for use in neural networks. + +Note: By default all the losses are collected into the `GraphKeys.LOSSES` +collection. + +All of the loss functions take a pair of predictions and ground truth labels, +from which the loss is computed. It is assumed that the shape of both these +tensors is of the form [batch_size, d1, ... dN] where `batch_size` is the number +of samples in the batch and `d1` ... `dN` are the remaining dimensions. + +It is common, when training with multiple loss functions, to adjust the relative +strengths of individual losses. This is performed by rescaling the losses via +a `weight` parameter passed to the loss functions. For example, if we were +training with both log_loss and sum_of_squares_loss, and we wished that the +log_loss penalty be twice as severe as the sum_of_squares_loss, we would +implement this as: + +```python + # Explicitly set the weight. + tf.contrib.losses.log(predictions, labels, weight=2.0) + + # Uses default weight of 1.0 + tf.contrib.losses.sum_of_squares(predictions, labels) + + # All the losses are collected into the `GraphKeys.LOSSES` collection. + losses = tf.get_collection(tf.GraphKeys.LOSSES) +``` + +While specifying a scalar loss rescales the loss over the entire batch, +we sometimes want to rescale the loss per batch sample. For example, if we have +certain examples that matter more to us to get correctly, we might want to have +a higher loss that other samples whose mistakes matter less. In this case, we +can provide a weight vector of length `batch_size` which results in the loss +for each sample in the batch being scaled by the corresponding weight element. +For example, consider the case of a classification problem where we want to +maximize our accuracy but we especially interested in obtaining high accuracy +for a specific class: + +```python + inputs, labels = LoadData(batch_size=3) + logits = MyModelPredictions(inputs) + + # Ensures that the loss for examples whose ground truth class is `3` is 5x + # higher than the loss for all other examples. + weight = tf.multiply(4, tf.cast(tf.equal(labels, 3), tf.float32)) + 1 + + onehot_labels = tf.one_hot(labels, num_classes=5) + tf.contrib.losses.softmax_cross_entropy(logits, onehot_labels, weight=weight) +``` + +Finally, in certain cases, we may want to specify a different loss for every +single measurable value. For example, if we are performing per-pixel depth +prediction, or per-pixel denoising, a single batch sample has P values where P +is the number of pixels in the image. For many losses, the number of measurable +values matches the number of elements in the predictions and labels tensors. +For others, such as softmax_cross_entropy and cosine_distance, the +loss functions reduces the dimensions of the inputs to produces a tensor of +losses for each measurable value. For example, softmax_cross_entropy takes as +input predictions and labels of dimension [batch_size, num_classes] but the +number of measurable values is [batch_size]. Consequently, when passing a weight +tensor to specify a different loss for every measurable value, the dimension of +the tensor will depend on the loss being used. + +For a concrete example, consider the case of per-pixel depth prediction where +certain ground truth depth values are missing (due to sensor noise in the +capture process). In this case, we want to assign zero weight to losses for +these predictions. + +```python + # 'depths' that are missing have a value of 0: + images, depths = LoadData(...) + predictions = MyModelPredictions(images) + + weight = tf.cast(tf.greater(depths, 0), tf.float32) + loss = tf.contrib.losses.sum_of_squares(predictions, depths, weight) +``` + +Note that when using weights for the losses, the final average is computed +by rescaling the losses by the weights and then dividing by the total number of +non-zero samples. For an arbitrary set of weights, this may not necessarily +produce a weighted average. Instead, it simply and transparently rescales the +per-element losses before averaging over the number of observations. For example +if the losses computed by the loss function is an array [4, 1, 2, 3] and the +weights are an array [1, 0.5, 3, 9], then the average loss is: + +```python + (4*1 + 1*0.5 + 2*3 + 3*9) / 4 +``` + +However, with a single loss function and an arbitrary set of weights, one can +still easily create a loss function such that the resulting loss is a +weighted average over the individual prediction errors: + + +```python + images, labels = LoadData(...) + predictions = MyModelPredictions(images) + + weight = MyComplicatedWeightingFunction(labels) + weight = tf.div(weight, tf.size(weight)) + loss = tf.contrib.losses.sum_of_squares(predictions, depths, weight) +``` + +@{tf.contrib.losses.absolute_difference} +@{tf.contrib.losses.add_loss} +@{tf.contrib.losses.hinge_loss} +@{tf.contrib.losses.compute_weighted_loss} +@{tf.contrib.losses.cosine_distance} +@{tf.contrib.losses.get_losses} +@{tf.contrib.losses.get_regularization_losses} +@{tf.contrib.losses.get_total_loss} +@{tf.contrib.losses.log_loss} +@{tf.contrib.losses.mean_pairwise_squared_error} +@{tf.contrib.losses.mean_squared_error} +@{tf.contrib.losses.sigmoid_cross_entropy} +@{tf.contrib.losses.softmax_cross_entropy} +@{tf.contrib.losses.sparse_softmax_cross_entropy} + +The following are deprecated in favor of `mean_pairwise_squared_error` and +`mean_squared_error`. +@{tf.contrib.losses.sum_of_pairwise_squares} +@{tf.contrib.losses.sum_of_squares} + + diff --git a/tensorflow/docs_src/api_guides/python/contrib.metrics.md b/tensorflow/docs_src/api_guides/python/contrib.metrics.md new file mode 100644 index 0000000000..b502826e6a --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.metrics.md @@ -0,0 +1,133 @@ +# Metrics (contrib) +[TOC] + +##Ops for evaluation metrics and summary statistics. + +### API + +This module provides functions for computing streaming metrics: metrics computed +on dynamically valued `Tensors`. Each metric declaration returns a +"value_tensor", an idempotent operation that returns the current value of the +metric, and an "update_op", an operation that accumulates the information +from the current value of the `Tensors` being measured as well as returns the +value of the "value_tensor". + +To use any of these metrics, one need only declare the metric, call `update_op` +repeatedly to accumulate data over the desired number of `Tensor` values (often +each one is a single batch) and finally evaluate the value_tensor. For example, +to use the `streaming_mean`: + +```python +value = ... +mean_value, update_op = tf.contrib.metrics.streaming_mean(values) +sess.run(tf.local_variables_initializer()) + +for i in range(number_of_batches): + print('Mean after batch %d: %f' % (i, update_op.eval()) +print('Final Mean: %f' % mean_value.eval()) +``` + +Each metric function adds nodes to the graph that hold the state necessary to +compute the value of the metric as well as a set of operations that actually +perform the computation. Every metric evaluation is composed of three steps + +* Initialization: initializing the metric state. +* Aggregation: updating the values of the metric state. +* Finalization: computing the final metric value. + +In the above example, calling streaming_mean creates a pair of state variables +that will contain (1) the running sum and (2) the count of the number of samples +in the sum. Because the streaming metrics use local variables, +the Initialization stage is performed by running the op returned +by `tf.local_variables_initializer()`. It sets the sum and count variables to +zero. + +Next, Aggregation is performed by examining the current state of `values` +and incrementing the state variables appropriately. This step is executed by +running the `update_op` returned by the metric. + +Finally, finalization is performed by evaluating the "value_tensor" + +In practice, we commonly want to evaluate across many batches and multiple +metrics. To do so, we need only run the metric computation operations multiple +times: + +```python +labels = ... +predictions = ... +accuracy, update_op_acc = tf.contrib.metrics.streaming_accuracy( + labels, predictions) +error, update_op_error = tf.contrib.metrics.streaming_mean_absolute_error( + labels, predictions) + +sess.run(tf.local_variables_initializer()) +for batch in range(num_batches): + sess.run([update_op_acc, update_op_error]) + +accuracy, mean_absolute_error = sess.run([accuracy, mean_absolute_error]) +``` + +Note that when evaluating the same metric multiple times on different inputs, +one must specify the scope of each metric to avoid accumulating the results +together: + +```python +labels = ... +predictions0 = ... +predictions1 = ... + +accuracy0 = tf.contrib.metrics.accuracy(labels, predictions0, name='preds0') +accuracy1 = tf.contrib.metrics.accuracy(labels, predictions1, name='preds1') +``` + +Certain metrics, such as streaming_mean or streaming_accuracy, can be weighted +via a `weights` argument. The `weights` tensor must be the same size as the +labels and predictions tensors and results in a weighted average of the metric. + +## Metric `Ops` + +* @{tf.contrib.metrics.streaming_accuracy} +* @{tf.contrib.metrics.streaming_mean} +* @{tf.contrib.metrics.streaming_recall} +* @{tf.contrib.metrics.streaming_recall_at_thresholds} +* @{tf.contrib.metrics.streaming_precision} +* @{tf.contrib.metrics.streaming_precision_at_thresholds} +* @{tf.contrib.metrics.streaming_auc} +* @{tf.contrib.metrics.streaming_recall_at_k} +* @{tf.contrib.metrics.streaming_mean_absolute_error} +* @{tf.contrib.metrics.streaming_mean_iou} +* @{tf.contrib.metrics.streaming_mean_relative_error} +* @{tf.contrib.metrics.streaming_mean_squared_error} +* @{tf.contrib.metrics.streaming_mean_tensor} +* @{tf.contrib.metrics.streaming_root_mean_squared_error} +* @{tf.contrib.metrics.streaming_covariance} +* @{tf.contrib.metrics.streaming_pearson_correlation} +* @{tf.contrib.metrics.streaming_mean_cosine_distance} +* @{tf.contrib.metrics.streaming_percentage_less} +* @{tf.contrib.metrics.streaming_sensitivity_at_specificity} +* @{tf.contrib.metrics.streaming_sparse_average_precision_at_k} +* @{tf.contrib.metrics.streaming_sparse_precision_at_k} +* @{tf.contrib.metrics.streaming_sparse_precision_at_top_k} +* @{tf.contrib.metrics.streaming_sparse_recall_at_k} +* @{tf.contrib.metrics.streaming_specificity_at_sensitivity} +* @{tf.contrib.metrics.streaming_concat} +* @{tf.contrib.metrics.streaming_false_negatives} +* @{tf.contrib.metrics.streaming_false_negatives_at_thresholds} +* @{tf.contrib.metrics.streaming_false_positives} +* @{tf.contrib.metrics.streaming_false_positives_at_thresholds} +* @{tf.contrib.metrics.streaming_true_negatives} +* @{tf.contrib.metrics.streaming_true_negatives_at_thresholds} +* @{tf.contrib.metrics.streaming_true_positives} +* @{tf.contrib.metrics.streaming_true_positives_at_thresholds} +* @{tf.contrib.metrics.auc_using_histogram} +* @{tf.contrib.metrics.accuracy} +* @{tf.contrib.metrics.aggregate_metrics} +* @{tf.contrib.metrics.aggregate_metric_map} +* @{tf.contrib.metrics.confusion_matrix} + +## Set `Ops` + +* @{tf.contrib.metrics.set_difference} +* @{tf.contrib.metrics.set_intersection} +* @{tf.contrib.metrics.set_size} +* @{tf.contrib.metrics.set_union} diff --git a/tensorflow/docs_src/api_guides/python/contrib.opt.md b/tensorflow/docs_src/api_guides/python/contrib.opt.md new file mode 100644 index 0000000000..944a80a5cc --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.opt.md @@ -0,0 +1,4 @@ +# Optimization (contrib) +[TOC] + +opt: A module containing optimization routines. diff --git a/tensorflow/docs_src/api_guides/python/contrib.rnn.md b/tensorflow/docs_src/api_guides/python/contrib.rnn.md new file mode 100644 index 0000000000..d089b0616f --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.rnn.md @@ -0,0 +1,61 @@ +# RNN and Cells (contrib) +[TOC] + +Module for constructing RNN Cells and additional RNN operations. + +## Base interface for all RNN Cells + +* @{tf.contrib.rnn.RNNCell} + +## Core RNN Cells for use with TensorFlow's core RNN methods + +* @{tf.contrib.rnn.BasicRNNCell} +* @{tf.contrib.rnn.BasicLSTMCell} +* @{tf.contrib.rnn.GRUCell} +* @{tf.contrib.rnn.LSTMCell} +* @{tf.contrib.rnn.LayerNormBasicLSTMCell} + +## Classes storing split `RNNCell` state + +* @{tf.contrib.rnn.LSTMStateTuple} + +## Core RNN Cell wrappers (RNNCells that wrap other RNNCells) + +* @{tf.contrib.rnn.MultiRNNCell} +* @{tf.contrib.rnn.LSTMBlockWrapper} +* @{tf.contrib.rnn.DropoutWrapper} +* @{tf.contrib.rnn.EmbeddingWrapper} +* @{tf.contrib.rnn.InputProjectionWrapper} +* @{tf.contrib.rnn.OutputProjectionWrapper} +* @{tf.contrib.rnn.DeviceWrapper} +* @{tf.contrib.rnn.ResidualWrapper} + +### Block RNNCells +* @{tf.contrib.rnn.LSTMBlockCell} +* @{tf.contrib.rnn.GRUBlockCell} + +### Fused RNNCells +* @{tf.contrib.rnn.FusedRNNCell} +* @{tf.contrib.rnn.FusedRNNCellAdaptor} +* @{tf.contrib.rnn.TimeReversedFusedRNN} +* @{tf.contrib.rnn.LSTMBlockFusedCell} + +### LSTM-like cells +* @{tf.contrib.rnn.CoupledInputForgetGateLSTMCell} +* @{tf.contrib.rnn.TimeFreqLSTMCell} +* @{tf.contrib.rnn.GridLSTMCell} + +### RNNCell wrappers +* @{tf.contrib.rnn.AttentionCellWrapper} +* @{tf.contrib.rnn.CompiledWrapper} + + +## Recurrent Neural Networks + +TensorFlow provides a number of methods for constructing Recurrent Neural +Networks. + +* @{tf.contrib.rnn.static_rnn} +* @{tf.contrib.rnn.static_state_saving_rnn} +* @{tf.contrib.rnn.static_bidirectional_rnn} +* @{tf.contrib.rnn.stack_bidirectional_dynamic_rnn} diff --git a/tensorflow/docs_src/api_guides/python/contrib.training.md b/tensorflow/docs_src/api_guides/python/contrib.training.md new file mode 100644 index 0000000000..87395d930b --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.training.md @@ -0,0 +1,50 @@ +# Training (contrib) +[TOC] + +Training and input utilities. + +## Splitting sequence inputs into minibatches with state saving + +Use @{tf.contrib.training.SequenceQueueingStateSaver} or +its wrapper @{tf.contrib.training.batch_sequences_with_states} if +you have input data with a dynamic primary time / frame count axis which +you'd like to convert into fixed size segments during minibatching, and would +like to store state in the forward direction across segments of an example. + +* @{tf.contrib.training.batch_sequences_with_states} +* @{tf.contrib.training.NextQueuedSequenceBatch} +* @{tf.contrib.training.SequenceQueueingStateSaver} + + +## Online data resampling + +To resample data with replacement on a per-example basis, use +@{tf.contrib.training.rejection_sample} or +@{tf.contrib.training.resample_at_rate}. For `rejection_sample`, provide +a boolean Tensor describing whether to accept or reject. Resulting batch sizes +are always the same. For `resample_at_rate`, provide the desired rate for each +example. Resulting batch sizes may vary. If you wish to specify relative +rates, rather than absolute ones, use @{tf.contrib.training.weighted_resample} +(which also returns the actual resampling rate used for each output example). + +Use @{tf.contrib.training.stratified_sample} to resample without replacement +from the data to achieve a desired mix of class proportions that the Tensorflow +graph sees. For instance, if you have a binary classification dataset that is +99.9% class 1, a common approach is to resample from the data so that the data +is more balanced. + +* @{tf.contrib.training.rejection_sample} +* @{tf.contrib.training.resample_at_rate} +* @{tf.contrib.training.stratified_sample} +* @{tf.contrib.training.weighted_resample} + +## Bucketing + +Use @{tf.contrib.training.bucket} or +@{tf.contrib.training.bucket_by_sequence_length} to stratify +minibatches into groups ("buckets"). Use `bucket_by_sequence_length` +with the argument `dynamic_pad=True` to receive minibatches of similarly +sized sequences for efficient training via `dynamic_rnn`. + +* @{tf.contrib.training.bucket} +* @{tf.contrib.training.bucket_by_sequence_length} diff --git a/tensorflow/docs_src/api_guides/python/contrib.util.md b/tensorflow/docs_src/api_guides/python/contrib.util.md new file mode 100644 index 0000000000..6bc120d43d --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/contrib.util.md @@ -0,0 +1,12 @@ +# Utilities (contrib) +[TOC] + +Utilities for dealing with Tensors. + +## Miscellaneous Utility Functions + +* @{tf.contrib.util.constant_value} +* @{tf.contrib.util.make_tensor_proto} +* @{tf.contrib.util.make_ndarray} +* @{tf.contrib.util.ops_used_by_graph_def} +* @{tf.contrib.util.stripped_op_list_for_graph} diff --git a/tensorflow/docs_src/api_guides/python/control_flow_ops.md b/tensorflow/docs_src/api_guides/python/control_flow_ops.md new file mode 100644 index 0000000000..68ea96d3dc --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/control_flow_ops.md @@ -0,0 +1,57 @@ +# Control Flow + +Note: Functions taking `Tensor` arguments can also take anything accepted by +@{tf.convert_to_tensor}. + +[TOC] + +## Control Flow Operations + +TensorFlow provides several operations and classes that you can use to control +the execution of operations and add conditional dependencies to your graph. + +* @{tf.identity} +* @{tf.tuple} +* @{tf.group} +* @{tf.no_op} +* @{tf.count_up_to} +* @{tf.cond} +* @{tf.case} +* @{tf.while_loop} + +## Logical Operators + +TensorFlow provides several operations that you can use to add logical operators +to your graph. + +* @{tf.logical_and} +* @{tf.logical_not} +* @{tf.logical_or} +* @{tf.logical_xor} + +## Comparison Operators + +TensorFlow provides several operations that you can use to add comparison +operators to your graph. + +* @{tf.equal} +* @{tf.not_equal} +* @{tf.less} +* @{tf.less_equal} +* @{tf.greater} +* @{tf.greater_equal} +* @{tf.where} + +## Debugging Operations + +TensorFlow provides several operations that you can use to validate values and +debug your graph. + +* @{tf.is_finite} +* @{tf.is_inf} +* @{tf.is_nan} +* @{tf.verify_tensor_all_finite} +* @{tf.check_numerics} +* @{tf.add_check_numerics_ops} +* @{tf.Assert} +* @{tf.Print} diff --git a/tensorflow/docs_src/api_guides/python/framework.md b/tensorflow/docs_src/api_guides/python/framework.md new file mode 100644 index 0000000000..42c3e57477 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/framework.md @@ -0,0 +1,51 @@ +# Building Graphs +[TOC] + +Classes and functions for building TensorFlow graphs. + +## Core graph data structures + +* @{tf.Graph} +* @{tf.Operation} +* @{tf.Tensor} + +## Tensor types + +* @{tf.DType} +* @{tf.as_dtype} + +## Utility functions + +* @{tf.device} +* @{tf.container} +* @{tf.name_scope} +* @{tf.control_dependencies} +* @{tf.convert_to_tensor} +* @{tf.convert_to_tensor_or_indexed_slices} +* @{tf.convert_to_tensor_or_sparse_tensor} +* @{tf.get_default_graph} +* @{tf.reset_default_graph} +* @{tf.import_graph_def} +* @{tf.load_file_system_library} +* @{tf.load_op_library} + +## Graph collections + +* @{tf.add_to_collection} +* @{tf.get_collection} +* @{tf.get_collection_ref} +* @{tf.GraphKeys} + +## Defining new operations + +* @{tf.RegisterGradient} +* @{tf.NotDifferentiable} +* @{tf.NoGradient} +* @{tf.TensorShape} +* @{tf.Dimension} +* @{tf.op_scope} +* @{tf.get_seed} + +## For libraries building on TensorFlow + +* @{tf.register_tensor_conversion_function} diff --git a/tensorflow/docs_src/api_guides/python/functional_ops.md b/tensorflow/docs_src/api_guides/python/functional_ops.md new file mode 100644 index 0000000000..9fd46066a8 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/functional_ops.md @@ -0,0 +1,18 @@ +# Higher Order Functions + +Note: Functions taking `Tensor` arguments can also take anything accepted by +@{tf.convert_to_tensor}. + +[TOC] + +Functional operations. + +## Higher Order Operators + +TensorFlow provides several higher order operators to simplify the common +map-reduce programming patterns. + +* @{tf.map_fn} +* @{tf.foldl} +* @{tf.foldr} +* @{tf.scan} diff --git a/tensorflow/docs_src/api_guides/python/histogram_ops.md b/tensorflow/docs_src/api_guides/python/histogram_ops.md new file mode 100644 index 0000000000..dbd4555429 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/histogram_ops.md @@ -0,0 +1,6 @@ +# Histograms +[TOC] + +## Histograms + +* @{tf.histogram_fixed_width} diff --git a/tensorflow/docs_src/api_guides/python/image.md b/tensorflow/docs_src/api_guides/python/image.md new file mode 100644 index 0000000000..a2c8c3c3c9 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/image.md @@ -0,0 +1,143 @@ +# Images + +Note: Functions taking `Tensor` arguments can also take anything accepted by +@{tf.convert_to_tensor}. + +[TOC] + +## Encoding and Decoding + +TensorFlow provides Ops to decode and encode JPEG and PNG formats. Encoded +images are represented by scalar string Tensors, decoded images by 3-D uint8 +tensors of shape `[height, width, channels]`. (PNG also supports uint16.) + +The encode and decode Ops apply to one image at a time. Their input and output +are all of variable size. If you need fixed size images, pass the output of +the decode Ops to one of the cropping and resizing Ops. + +Note: The PNG encode and decode Ops support RGBA, but the conversions Ops +presently only support RGB, HSV, and GrayScale. Presently, the alpha channel has +to be stripped from the image and re-attached using slicing ops. + +* @{tf.image.decode_gif} +* @{tf.image.decode_jpeg} +* @{tf.image.encode_jpeg} +* @{tf.image.decode_png} +* @{tf.image.encode_png} +* @{tf.image.decode_image} + +## Resizing + +The resizing Ops accept input images as tensors of several types. They always +output resized images as float32 tensors. + +The convenience function @{tf.image.resize_images} supports both 4-D +and 3-D tensors as input and output. 4-D tensors are for batches of images, +3-D tensors for individual images. + +Other resizing Ops only support 4-D batches of images as input: +@{tf.image.resize_area}, @{tf.image.resize_bicubic}, +@{tf.image.resize_bilinear}, +@{tf.image.resize_nearest_neighbor}. + +Example: + +```python +# Decode a JPG image and resize it to 299 by 299 using default method. +image = tf.image.decode_jpeg(...) +resized_image = tf.image.resize_images(image, [299, 299]) +``` + +* @{tf.image.resize_images} +* @{tf.image.resize_area} +* @{tf.image.resize_bicubic} +* @{tf.image.resize_bilinear} +* @{tf.image.resize_nearest_neighbor} + +## Cropping + +* @{tf.image.resize_image_with_crop_or_pad} +* @{tf.image.central_crop} +* @{tf.image.pad_to_bounding_box} +* @{tf.image.crop_to_bounding_box} +* @{tf.image.extract_glimpse} +* @{tf.image.crop_and_resize} + +## Flipping, Rotating and Transposing + +* @{tf.image.flip_up_down} +* @{tf.image.random_flip_up_down} +* @{tf.image.flip_left_right} +* @{tf.image.random_flip_left_right} +* @{tf.image.transpose_image} +* @{tf.image.rot90} + +## Converting Between Colorspaces + +Image ops work either on individual images or on batches of images, depending on +the shape of their input Tensor. + +If 3-D, the shape is `[height, width, channels]`, and the Tensor represents one +image. If 4-D, the shape is `[batch_size, height, width, channels]`, and the +Tensor represents `batch_size` images. + +Currently, `channels` can usefully be 1, 2, 3, or 4. Single-channel images are +grayscale, images with 3 channels are encoded as either RGB or HSV. Images +with 2 or 4 channels include an alpha channel, which has to be stripped from the +image before passing the image to most image processing functions (and can be +re-attached later). + +Internally, images are either stored in as one `float32` per channel per pixel +(implicitly, values are assumed to lie in `[0,1)`) or one `uint8` per channel +per pixel (values are assumed to lie in `[0,255]`). + +TensorFlow can convert between images in RGB or HSV. The conversion functions +work only on float images, so you need to convert images in other formats using +@{tf.image.convert_image_dtype}. + +Example: + +```python +# Decode an image and convert it to HSV. +rgb_image = tf.image.decode_png(..., channels=3) +rgb_image_float = tf.image.convert_image_dtype(rgb_image, tf.float32) +hsv_image = tf.image.rgb_to_hsv(rgb_image) +``` + +* @{tf.image.rgb_to_grayscale} +* @{tf.image.grayscale_to_rgb} +* @{tf.image.hsv_to_rgb} +* @{tf.image.rgb_to_hsv} +* @{tf.image.convert_image_dtype} + +## Image Adjustments + +TensorFlow provides functions to adjust images in various ways: brightness, +contrast, hue, and saturation. Each adjustment can be done with predefined +parameters or with random parameters picked from predefined intervals. Random +adjustments are often useful to expand a training set and reduce overfitting. + +If several adjustments are chained it is advisable to minimize the number of +redundant conversions by first converting the images to the most natural data +type and representation (RGB or HSV). + +* @{tf.image.adjust_brightness} +* @{tf.image.random_brightness} +* @{tf.image.adjust_contrast} +* @{tf.image.random_contrast} +* @{tf.image.adjust_hue} +* @{tf.image.random_hue} +* @{tf.image.adjust_gamma} +* @{tf.image.adjust_saturation} +* @{tf.image.random_saturation} +* @{tf.image.per_image_standardization} + +## Working with Bounding Boxes + +* @{tf.image.draw_bounding_boxes} +* @{tf.image.non_max_suppression} +* @{tf.image.sample_distorted_bounding_box} + +## Denoising + +* @{tf.image.total_variation} diff --git a/tensorflow/docs_src/api_guides/python/index.md b/tensorflow/docs_src/api_guides/python/index.md new file mode 100644 index 0000000000..03f2139f5f --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/index.md @@ -0,0 +1,46 @@ +# Python API Guides + +* [Asserts and boolean checks](check_ops.md) +* [Building Graphs](framework.md) +* [Constants, Sequences, and Random Values](constant_op.md) +* [Control Flow](control_flow_ops.md) +* [Data IO (Python functions)](python_io.md) +* [Higher Order Functions](functional_ops.md) +* [Histograms](histogram_ops.md) +* [Images](image.md) +* [Inputs and Readers](io_ops.md) +* [Math](math_ops.md) +* [Neural Network](nn.md) +* [Running Graphs](client.md) +* [Sparse Tensors](sparse_ops.md) +* [Strings](string_ops.md) +* [Summary Operations](summary.md) +* [TensorFlow Debugger](tfdbg.md) +* [Tensor Handle Operations](session_ops.md) +* [Tensor Transformations](array_ops.md) +* [Testing](test.md) +* [Training](train.md) +* [Variables](state_ops.md) +* [Wraps python functions](script_ops.md) +* [BayesFlow Entropy (contrib)](contrib.bayesflow.entropy.md) +* [BayesFlow Monte Carlo (contrib)](contrib.bayesflow.monte_carlo.md) +* [BayesFlow Stochastic Graph (contrib)](contrib.bayesflow.stochastic_graph.md) +* [BayesFlow Stochastic Tensors (contrib)](contrib.bayesflow.stochastic_tensor.md) +* [BayesFlow Variational Inference (contrib)](contrib.bayesflow.variational_inference.md) +* [Copying Graph Elements (contrib)](contrib.copy_graph.md) +* [CRF (contrib)](contrib.crf.md) +* [FFmpeg (contrib)](contrib.ffmpeg.md) +* [Framework (contrib)](contrib.framework.md) +* [Graph Editor (contrib)](contrib.graph_editor.md) +* [Integrate (contrib)](contrib.integrate.md) +* [Layers (contrib)](contrib.layers.md) +* [Learn (contrib)](contrib.learn.md) +* [Linear Algebra (contrib)](contrib.linalg.md) +* [Losses (contrib)](contrib.losses.md) +* [Metrics (contrib)](contrib.metrics.md) +* [Optimization (contrib)](contrib.opt.md) +* [Random variable transformations (contrib)](contrib.distributions.bijector.md) +* [RNN and Cells (contrib)](contrib.rnn.md) +* [Statistical Distributions (contrib)](contrib.distributions.md) +* [Training (contrib)](contrib.training.md) +* [Utilities (contrib)](contrib.util.md) diff --git a/tensorflow/docs_src/api_guides/python/io_ops.md b/tensorflow/docs_src/api_guides/python/io_ops.md new file mode 100644 index 0000000000..94cf0de32a --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/io_ops.md @@ -0,0 +1,130 @@ +# Inputs and Readers + +Note: Functions taking `Tensor` arguments can also take anything accepted by +@{tf.convert_to_tensor}. + +[TOC] + +## Placeholders + +TensorFlow provides a placeholder operation that must be fed with data +on execution. For more info, see the section on @{$reading_data#feeding$Feeding data}. + +* @{tf.placeholder} +* @{tf.placeholder_with_default} + +For feeding `SparseTensor`s which are composite type, +there is a convenience function: + +* @{tf.sparse_placeholder} + +## Readers + +TensorFlow provides a set of Reader classes for reading data formats. +For more information on inputs and readers, see @{$reading_data$Reading data}. + +* @{tf.ReaderBase} +* @{tf.TextLineReader} +* @{tf.WholeFileReader} +* @{tf.IdentityReader} +* @{tf.TFRecordReader} +* @{tf.FixedLengthRecordReader} + +## Converting + +TensorFlow provides several operations that you can use to convert various data +formats into tensors. + +* @{tf.decode_csv} +* @{tf.decode_raw} + +- - - + +### Example protocol buffer + +TensorFlow's @{$reading_data#standard-tensorflow-format$recommended format for training examples} +is serialized `Example` protocol buffers, [described +here](https://www.tensorflow.org/code/tensorflow/core/example/example.proto). +They contain `Features`, [described +here](https://www.tensorflow.org/code/tensorflow/core/example/feature.proto). + +* @{tf.VarLenFeature} +* @{tf.FixedLenFeature} +* @{tf.FixedLenSequenceFeature} +* @{tf.SparseFeature} +* @{tf.parse_example} +* @{tf.parse_single_example} +* @{tf.parse_tensor} +* @{tf.decode_json_example} + +## Queues + +TensorFlow provides several implementations of 'Queues', which are +structures within the TensorFlow computation graph to stage pipelines +of tensors together. The following describe the basic Queue interface +and some implementations. To see an example use, see @{$threading_and_queues$Threading and Queues}. + +* @{tf.QueueBase} +* @{tf.FIFOQueue} +* @{tf.PaddingFIFOQueue} +* @{tf.RandomShuffleQueue} +* @{tf.PriorityQueue} + +## Conditional Accumulators + +* @{tf.ConditionalAccumulatorBase} +* @{tf.ConditionalAccumulator} +* @{tf.SparseConditionalAccumulator} + +## Dealing with the filesystem + +* @{tf.matching_files} +* @{tf.read_file} +* @{tf.write_file} + +## Input pipeline + +TensorFlow functions for setting up an input-prefetching pipeline. +Please see the @{$reading_data$reading data how-to} +for context. + +### Beginning of an input pipeline + +The "producer" functions add a queue to the graph and a corresponding +`QueueRunner` for running the subgraph that fills that queue. + +* @{tf.train.match_filenames_once} +* @{tf.train.limit_epochs} +* @{tf.train.input_producer} +* @{tf.train.range_input_producer} +* @{tf.train.slice_input_producer} +* @{tf.train.string_input_producer} + +### Batching at the end of an input pipeline + +These functions add a queue to the graph to assemble a batch of +examples, with possible shuffling. They also add a `QueueRunner` for +running the subgraph that fills that queue. + +Use @{tf.train.batch} or @{tf.train.batch_join} for batching +examples that have already been well shuffled. Use +@{tf.train.shuffle_batch} or +@{tf.train.shuffle_batch_join} for examples that would +benefit from additional shuffling. + +Use @{tf.train.batch} or @{tf.train.shuffle_batch} if you want a +single thread producing examples to batch, or if you have a +single subgraph producing examples but you want to run it in *N* threads +(where you increase *N* until it can keep the queue full). Use +@{tf.train.batch_join} or @{tf.train.shuffle_batch_join} +if you have *N* different subgraphs producing examples to batch and you +want them run by *N* threads. Use `maybe_*` to enqueue conditionally. + +* @{tf.train.batch} +* @{tf.train.maybe_batch} +* @{tf.train.batch_join} +* @{tf.train.maybe_batch_join} +* @{tf.train.shuffle_batch} +* @{tf.train.maybe_shuffle_batch} +* @{tf.train.shuffle_batch_join} +* @{tf.train.maybe_shuffle_batch_join} diff --git a/tensorflow/docs_src/api_guides/python/math_ops.md b/tensorflow/docs_src/api_guides/python/math_ops.md new file mode 100644 index 0000000000..2b41820a17 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/math_ops.md @@ -0,0 +1,204 @@ +# Math + +Note: Functions taking `Tensor` arguments can also take anything accepted by +@{tf.convert_to_tensor}. + +[TOC] + +Note: Elementwise binary operations in TensorFlow follow [numpy-style +broadcasting](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html). + +## Arithmetic Operators + +TensorFlow provides several operations that you can use to add basic arithmetic +operators to your graph. + +* @{tf.add} +* @{tf.subtract} +* @{tf.multiply} +* @{tf.scalar_mul} +* @{tf.div} +* @{tf.divide} +* @{tf.truediv} +* @{tf.floordiv} +* @{tf.realdiv} +* @{tf.truncatediv} +* @{tf.floor_div} +* @{tf.truncatemod} +* @{tf.floormod} +* @{tf.mod} +* @{tf.cross} + +## Basic Math Functions + +TensorFlow provides several operations that you can use to add basic +mathematical functions to your graph. + +* @{tf.add_n} +* @{tf.abs} +* @{tf.negative} +* @{tf.sign} +* @{tf.reciprocal} +* @{tf.square} +* @{tf.round} +* @{tf.sqrt} +* @{tf.rsqrt} +* @{tf.pow} +* @{tf.exp} +* @{tf.expm1} +* @{tf.log} +* @{tf.log1p} +* @{tf.ceil} +* @{tf.floor} +* @{tf.maximum} +* @{tf.minimum} +* @{tf.cos} +* @{tf.sin} +* @{tf.lbeta} +* @{tf.tan} +* @{tf.acos} +* @{tf.asin} +* @{tf.atan} +* @{tf.lgamma} +* @{tf.digamma} +* @{tf.erf} +* @{tf.erfc} +* @{tf.squared_difference} +* @{tf.igamma} +* @{tf.igammac} +* @{tf.zeta} +* @{tf.polygamma} +* @{tf.betainc} +* @{tf.rint} + +## Matrix Math Functions + +TensorFlow provides several operations that you can use to add linear algebra +functions on matrices to your graph. + +* @{tf.diag} +* @{tf.diag_part} +* @{tf.trace} +* @{tf.transpose} +* @{tf.eye} +* @{tf.matrix_diag} +* @{tf.matrix_diag_part} +* @{tf.matrix_band_part} +* @{tf.matrix_set_diag} +* @{tf.matrix_transpose} +* @{tf.matmul} +* @{tf.norm} +* @{tf.matrix_determinant} +* @{tf.matrix_inverse} +* @{tf.cholesky} +* @{tf.cholesky_solve} +* @{tf.matrix_solve} +* @{tf.matrix_triangular_solve} +* @{tf.matrix_solve_ls} +* @{tf.qr} +* @{tf.self_adjoint_eig} +* @{tf.self_adjoint_eigvals} +* @{tf.svd} + + +## Tensor Math Function + +TensorFlow provides operations that you can use to add tensor functions to your +graph. + +* @{tf.tensordot} + + +## Complex Number Functions + +TensorFlow provides several operations that you can use to add complex number +functions to your graph. + +* @{tf.complex} +* @{tf.conj} +* @{tf.imag} +* @{tf.real} + +## Fourier Transform Functions + +TensorFlow provides several operations that you can use to add discrete +Fourier transform functions to your graph. + +* @{tf.fft} +* @{tf.ifft} +* @{tf.fft2d} +* @{tf.ifft2d} +* @{tf.fft3d} +* @{tf.ifft3d} + +## Reduction + +TensorFlow provides several operations that you can use to perform +common math computations that reduce various dimensions of a tensor. + +* @{tf.reduce_sum} +* @{tf.reduce_prod} +* @{tf.reduce_min} +* @{tf.reduce_max} +* @{tf.reduce_mean} +* @{tf.reduce_all} +* @{tf.reduce_any} +* @{tf.reduce_logsumexp} +* @{tf.count_nonzero} +* @{tf.accumulate_n} +* @{tf.einsum} + +## Scan + +TensorFlow provides several operations that you can use to perform scans +(running totals) across one axis of a tensor. + +* @{tf.cumsum} +* @{tf.cumprod} + +## Segmentation + +TensorFlow provides several operations that you can use to perform common +math computations on tensor segments. +Here a segmentation is a partitioning of a tensor along +the first dimension, i.e. it defines a mapping from the first dimension onto +`segment_ids`. The `segment_ids` tensor should be the size of +the first dimension, `d0`, with consecutive IDs in the range `0` to `k`, +where `k [[0 0 0 0] + [5 6 7 8]] +``` + +* @{tf.segment_sum} +* @{tf.segment_prod} +* @{tf.segment_min} +* @{tf.segment_max} +* @{tf.segment_mean} +* @{tf.unsorted_segment_sum} +* @{tf.sparse_segment_sum} +* @{tf.sparse_segment_mean} +* @{tf.sparse_segment_sqrt_n} + + +## Sequence Comparison and Indexing + +TensorFlow provides several operations that you can use to add sequence +comparison and index extraction to your graph. You can use these operations to +determine sequence differences and determine the indexes of specific values in +a tensor. + +* @{tf.argmin} +* @{tf.argmax} +* @{tf.setdiff1d} +* @{tf.where} +* @{tf.unique} +* @{tf.edit_distance} +* @{tf.invert_permutation} diff --git a/tensorflow/docs_src/api_guides/python/nn.md b/tensorflow/docs_src/api_guides/python/nn.md new file mode 100644 index 0000000000..44a2696e5c --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/nn.md @@ -0,0 +1,290 @@ +# Neural Network + +Note: Functions taking `Tensor` arguments can also take anything accepted by +@{tf.convert_to_tensor}. + +[TOC] + +## Activation Functions + +The activation ops provide different types of nonlinearities for use in neural +networks. These include smooth nonlinearities (`sigmoid`, `tanh`, `elu`, +`softplus`, and `softsign`), continuous but not everywhere differentiable +functions (`relu`, `relu6`, `crelu` and `relu_x`), and random regularization +(`dropout`). + +All activation ops apply componentwise, and produce a tensor of the same +shape as the input tensor. + +* @{tf.nn.relu} +* @{tf.nn.relu6} +* @{tf.nn.crelu} +* @{tf.nn.elu} +* @{tf.nn.softplus} +* @{tf.nn.softsign} +* @{tf.nn.dropout} +* @{tf.nn.bias_add} +* @{tf.sigmoid} +* @{tf.tanh} + +## Convolution + +The convolution ops sweep a 2-D filter over a batch of images, applying the +filter to each window of each image of the appropriate size. The different +ops trade off between generic vs. specific filters: + +* `conv2d`: Arbitrary filters that can mix channels together. +* `depthwise_conv2d`: Filters that operate on each channel independently. +* `separable_conv2d`: A depthwise spatial filter followed by a pointwise filter. + +Note that although these ops are called "convolution", they are strictly +speaking "cross-correlation" since the filter is combined with an input window +without reversing the filter. For details, see [the properties of +cross-correlation](https://en.wikipedia.org/wiki/Cross-correlation#Properties). + +The filter is applied to image patches of the same size as the filter and +strided according to the `strides` argument. `strides = [1, 1, 1, 1]` applies +the filter to a patch at every offset, `strides = [1, 2, 2, 1]` applies the +filter to every other image patch in each dimension, etc. + +Ignoring channels for the moment, and assume that the 4-D `input` has shape +`[batch, in_height, in_width, ...]` and the 4-D `filter` has shape +`[filter_height, filter_width, ...]`, then the spatial semantics of the +convolution ops are as follows: first, according to the padding scheme chosen +as `'SAME'` or `'VALID'`, the output size and the padding pixels are computed. +For the `'SAME'` padding, the output height and width are computed as: + + out_height = ceil(float(in_height) / float(strides[1])) + out_width = ceil(float(in_width) / float(strides[2])) + +and the padding on the top and left are computed as: + + pad_along_height = max((out_height - 1) * strides[1] + + filter_height - in_height, 0) + pad_along_width = max((out_width - 1) * strides[2] + + filter_width - in_width, 0) + pad_top = pad_along_height // 2 + pad_bottom = pad_along_height - pad_top + pad_left = pad_along_width // 2 + pad_right = pad_along_width - pad_left + + +Note that the division by 2 means that there might be cases when the padding on +both sides (top vs bottom, right vs left) are off by one. In this case, the +bottom and right sides always get the one additional padded pixel. For example, +when `pad_along_height` is 5, we pad 2 pixels at the top and 3 pixels at the +bottom. Note that this is different from existing libraries such as cuDNN and +Caffe, which explicitly specify the number of padded pixels and always pad the +same number of pixels on both sides. + +For the `'VALID`' padding, the output height and width are computed as: + + out_height = ceil(float(in_height - filter_height + 1) / float(strides[1])) + out_width = ceil(float(in_width - filter_width + 1) / float(strides[2])) + +and the padding values are always zero. The output is then computed as + + output[b, i, j, :] = + sum_{di, dj} input[b, strides[1] * i + di - pad_top, + strides[2] * j + dj - pad_left, ...] * + filter[di, dj, ...] + +where any value outside the original input image region are considered zero ( +i.e. we pad zero values around the border of the image). + +Since `input` is 4-D, each `input[b, i, j, :]` is a vector. For `conv2d`, these +vectors are multiplied by the `filter[di, dj, :, :]` matrices to produce new +vectors. For `depthwise_conv_2d`, each scalar component `input[b, i, j, k]` +is multiplied by a vector `filter[di, dj, k]`, and all the vectors are +concatenated. + +* @{tf.nn.convolution} +* @{tf.nn.conv2d} +* @{tf.nn.depthwise_conv2d} +* @{tf.nn.depthwise_conv2d_native} +* @{tf.nn.separable_conv2d} +* @{tf.nn.atrous_conv2d} +* @{tf.nn.atrous_conv2d_transpose} +* @{tf.nn.conv2d_transpose} +* @{tf.nn.conv1d} +* @{tf.nn.conv3d} +* @{tf.nn.conv3d_transpose} +* @{tf.nn.conv2d_backprop_filter} +* @{tf.nn.conv2d_backprop_input} +* @{tf.nn.conv3d_backprop_filter_v2} +* @{tf.nn.depthwise_conv2d_native_backprop_filter} +* @{tf.nn.depthwise_conv2d_native_backprop_input} + +## Pooling + +The pooling ops sweep a rectangular window over the input tensor, computing a +reduction operation for each window (average, max, or max with argmax). Each +pooling op uses rectangular windows of size `ksize` separated by offset +`strides`. For example, if `strides` is all ones every window is used, if +`strides` is all twos every other window is used in each dimension, etc. + +In detail, the output is + + output[i] = reduce(value[strides * i:strides * i + ksize]) + +where the indices also take into consideration the padding values. Please refer +to the `Convolution` section for details about the padding calculation. + +* @{tf.nn.avg_pool} +* @{tf.nn.max_pool} +* @{tf.nn.max_pool_with_argmax} +* @{tf.nn.avg_pool3d} +* @{tf.nn.max_pool3d} +* @{tf.nn.fractional_avg_pool} +* @{tf.nn.fractional_max_pool} +* @{tf.nn.pool} + +## Morphological filtering + +Morphological operators are non-linear filters used in image processing. + +[Greyscale morphological dilation +](https://en.wikipedia.org/wiki/Dilation_(morphology)) +is the max-sum counterpart of standard sum-product convolution: + + output[b, y, x, c] = + max_{dy, dx} input[b, + strides[1] * y + rates[1] * dy, + strides[2] * x + rates[2] * dx, + c] + + filter[dy, dx, c] + +The `filter` is usually called structuring function. Max-pooling is a special +case of greyscale morphological dilation when the filter assumes all-zero +values (a.k.a. flat structuring function). + +[Greyscale morphological erosion +](https://en.wikipedia.org/wiki/Erosion_(morphology)) +is the min-sum counterpart of standard sum-product convolution: + + output[b, y, x, c] = + min_{dy, dx} input[b, + strides[1] * y - rates[1] * dy, + strides[2] * x - rates[2] * dx, + c] - + filter[dy, dx, c] + +Dilation and erosion are dual to each other. The dilation of the input signal +`f` by the structuring signal `g` is equal to the negation of the erosion of +`-f` by the reflected `g`, and vice versa. + +Striding and padding is carried out in exactly the same way as in standard +convolution. Please refer to the `Convolution` section for details. + +* @{tf.nn.dilation2d} +* @{tf.nn.erosion2d} +* @{tf.nn.with_space_to_batch} + +## Normalization + +Normalization is useful to prevent neurons from saturating when inputs may +have varying scale, and to aid generalization. + +* @{tf.nn.l2_normalize} +* @{tf.nn.local_response_normalization} +* @{tf.nn.sufficient_statistics} +* @{tf.nn.normalize_moments} +* @{tf.nn.moments} +* @{tf.nn.weighted_moments} +* @{tf.nn.fused_batch_norm} +* @{tf.nn.batch_normalization} +* @{tf.nn.batch_norm_with_global_normalization} + +## Losses + +The loss ops measure error between two tensors, or between a tensor and zero. +These can be used for measuring accuracy of a network in a regression task +or for regularization purposes (weight decay). + +* @{tf.nn.l2_loss} +* @{tf.nn.log_poisson_loss} + +## Classification + +TensorFlow provides several operations that help you perform classification. + +* @{tf.nn.sigmoid_cross_entropy_with_logits} +* @{tf.nn.softmax} +* @{tf.nn.log_softmax} +* @{tf.nn.softmax_cross_entropy_with_logits} +* @{tf.nn.sparse_softmax_cross_entropy_with_logits} +* @{tf.nn.weighted_cross_entropy_with_logits} + +## Embeddings + +TensorFlow provides library support for looking up values in embedding +tensors. + +* @{tf.nn.embedding_lookup} +* @{tf.nn.embedding_lookup_sparse} + +## Recurrent Neural Networks + +TensorFlow provides a number of methods for constructing Recurrent +Neural Networks. Most accept an `RNNCell`-subclassed object +(see the documentation for `tf.contrib.rnn`). + +* @{tf.nn.dynamic_rnn} +* @{tf.nn.bidirectional_dynamic_rnn} +* @{tf.nn.raw_rnn} + +## Connectionist Temporal Classification (CTC) + +* @{tf.nn.ctc_loss} +* @{tf.nn.ctc_greedy_decoder} +* @{tf.nn.ctc_beam_search_decoder} + +## Evaluation + +The evaluation ops are useful for measuring the performance of a network. +They are typically used at evaluation time. + +* @{tf.nn.top_k} +* @{tf.nn.in_top_k} + +## Candidate Sampling + +Do you want to train a multiclass or multilabel model with thousands +or millions of output classes (for example, a language model with a +large vocabulary)? Training with a full Softmax is slow in this case, +since all of the classes are evaluated for every training example. +Candidate Sampling training algorithms can speed up your step times by +only considering a small randomly-chosen subset of contrastive classes +(called candidates) for each batch of training examples. + +See our +[Candidate Sampling Algorithms +Reference](https://www.tensorflow.org/extras/candidate_sampling.pdf) + +### Sampled Loss Functions + +TensorFlow provides the following sampled loss functions for faster training. + +* @{tf.nn.nce_loss} +* @{tf.nn.sampled_softmax_loss} + +### Candidate Samplers + +TensorFlow provides the following samplers for randomly sampling candidate +classes when using one of the sampled loss functions above. + +* @{tf.nn.uniform_candidate_sampler} +* @{tf.nn.log_uniform_candidate_sampler} +* @{tf.nn.learned_unigram_candidate_sampler} +* @{tf.nn.fixed_unigram_candidate_sampler} + +### Miscellaneous candidate sampling utilities + +* @{tf.nn.compute_accidental_hits} + +### Quantization ops + +* @{tf.nn.quantized_conv2d} +* @{tf.nn.quantized_relu_x} +* @{tf.nn.quantized_max_pool} +* @{tf.nn.quantized_avg_pool} diff --git a/tensorflow/docs_src/api_guides/python/python_io.md b/tensorflow/docs_src/api_guides/python/python_io.md new file mode 100644 index 0000000000..a5444408fe --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/python_io.md @@ -0,0 +1,29 @@ +# Data IO (Python functions) +[TOC] + +A TFRecords file represents a sequence of (binary) strings. The format is not +random access, so it is suitable for streaming large amounts of data but not +suitable if fast sharding or other non-sequential access is desired. + +* @{tf.python_io.TFRecordWriter} +* @{tf.python_io.tf_record_iterator} +* @{tf.python_io.TFRecordCompressionType} +* @{tf.python_io.TFRecordOptions} + +- - - + +## TFRecords Format Details + +A TFRecords file contains a sequence of strings with CRC hashes. Each record +has the format + + uint64 length + uint32 masked_crc32_of_length + byte data[length] + uint32 masked_crc32_of_data + +and the records are concatenated together to produce the file. The CRC32s +are [described here](https://en.wikipedia.org/wiki/Cyclic_redundancy_check), +and the mask of a CRC is + + masked_crc = ((crc >> 15) | (crc << 17)) + 0xa282ead8ul diff --git a/tensorflow/docs_src/api_guides/python/script_ops.md b/tensorflow/docs_src/api_guides/python/script_ops.md new file mode 100644 index 0000000000..ab49a570c1 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/script_ops.md @@ -0,0 +1,13 @@ +# Wraps python functions + +Note: Functions taking `Tensor` arguments can also take anything accepted by +@{tf.convert_to_tensor}. + +[TOC] + +## Script Language Operators + +TensorFlow provides allows you to wrap python/numpy functions as +TensorFlow operators. + +* @{tf.py_func} diff --git a/tensorflow/docs_src/api_guides/python/session_ops.md b/tensorflow/docs_src/api_guides/python/session_ops.md new file mode 100644 index 0000000000..5176e3549c --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/session_ops.md @@ -0,0 +1,15 @@ +# Tensor Handle Operations + +Note: Functions taking `Tensor` arguments can also take anything accepted by +@{tf.convert_to_tensor}. + +[TOC] + +## Tensor Handle Operations + +TensorFlow provides several operators that allows the user to keep tensors +"in-place" across run calls. + +* @{tf.get_session_handle} +* @{tf.get_session_tensor} +* @{tf.delete_session_tensor} diff --git a/tensorflow/docs_src/api_guides/python/sparse_ops.md b/tensorflow/docs_src/api_guides/python/sparse_ops.md new file mode 100644 index 0000000000..19d5faba05 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/sparse_ops.md @@ -0,0 +1,45 @@ +# Sparse Tensors + +Note: Functions taking `Tensor` arguments can also take anything accepted by +@{tf.convert_to_tensor}. + +[TOC] + +## Sparse Tensor Representation + +TensorFlow supports a `SparseTensor` representation for data that is sparse +in multiple dimensions. Contrast this representation with `IndexedSlices`, +which is efficient for representing tensors that are sparse in their first +dimension, and dense along all other dimensions. + +* @{tf.SparseTensor} +* @{tf.SparseTensorValue} + +## Conversion + +* @{tf.sparse_to_dense} +* @{tf.sparse_tensor_to_dense} +* @{tf.sparse_to_indicator} +* @{tf.sparse_merge} + +## Manipulation + +* @{tf.sparse_concat} +* @{tf.sparse_reorder} +* @{tf.sparse_reshape} +* @{tf.sparse_split} +* @{tf.sparse_retain} +* @{tf.sparse_reset_shape} +* @{tf.sparse_fill_empty_rows} +* @{tf.sparse_transpose} + +## Reduction +* @{tf.sparse_reduce_sum} +* @{tf.sparse_reduce_sum_sparse} + +## Math Operations +* @{tf.sparse_add} +* @{tf.sparse_softmax} +* @{tf.sparse_tensor_dense_matmul} +* @{tf.sparse_maximum} +* @{tf.sparse_minimum} diff --git a/tensorflow/docs_src/api_guides/python/state_ops.md b/tensorflow/docs_src/api_guides/python/state_ops.md new file mode 100644 index 0000000000..0d612ee0c7 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/state_ops.md @@ -0,0 +1,108 @@ +# Variables + +Note: Functions taking `Tensor` arguments can also take anything accepted by +@{tf.convert_to_tensor}. + +[TOC] + +## Variables + +* @{tf.Variable} + +## Variable helper functions + +TensorFlow provides a set of functions to help manage the set of variables +collected in the graph. + +* @{tf.global_variables} +* @{tf.local_variables} +* @{tf.model_variables} +* @{tf.trainable_variables} +* @{tf.moving_average_variables} +* @{tf.global_variables_initializer} +* @{tf.local_variables_initializer} +* @{tf.variables_initializer} +* @{tf.is_variable_initialized} +* @{tf.report_uninitialized_variables} +* @{tf.assert_variables_initialized} +* @{tf.assign} +* @{tf.assign_add} +* @{tf.assign_sub} + +## Saving and Restoring Variables + +* @{tf.train.Saver} +* @{tf.train.latest_checkpoint} +* @{tf.train.get_checkpoint_state} +* @{tf.train.update_checkpoint_state} + +## Sharing Variables + +TensorFlow provides several classes and operations that you can use to +create variables contingent on certain conditions. + +* @{tf.get_variable} +* @{tf.get_local_variable} +* @{tf.VariableScope} +* @{tf.variable_scope} +* @{tf.variable_op_scope} +* @{tf.get_variable_scope} +* @{tf.make_template} +* @{tf.no_regularizer} +* @{tf.constant_initializer} +* @{tf.random_normal_initializer} +* @{tf.truncated_normal_initializer} +* @{tf.random_uniform_initializer} +* @{tf.uniform_unit_scaling_initializer} +* @{tf.zeros_initializer} +* @{tf.ones_initializer} +* @{tf.orthogonal_initializer} + +## Variable Partitioners for Sharding + +* @{tf.fixed_size_partitioner} +* @{tf.variable_axis_size_partitioner} +* @{tf.min_max_variable_partitioner} + +## Sparse Variable Updates + +The sparse update ops modify a subset of the entries in a dense `Variable`, +either overwriting the entries or adding / subtracting a delta. These are +useful for training embedding models and similar lookup-based networks, since +only a small subset of embedding vectors change in any given step. + +Since a sparse update of a large tensor may be generated automatically during +gradient computation (as in the gradient of +@{tf.gather}), +an @{tf.IndexedSlices} class is provided that encapsulates a set +of sparse indices and values. `IndexedSlices` objects are detected and handled +automatically by the optimizers in most cases. + +* @{tf.scatter_update} +* @{tf.scatter_add} +* @{tf.scatter_sub} +* @{tf.scatter_mul} +* @{tf.scatter_div} +* @{tf.scatter_nd_update} +* @{tf.scatter_nd_add} +* @{tf.scatter_nd_sub} +* @{tf.sparse_mask} +* @{tf.IndexedSlices} + +### Read-only Lookup Tables + +* @{tf.initialize_all_tables} +* @{tf.tables_initializer} + + +## Exporting and Importing Meta Graphs + +* @{tf.train.export_meta_graph} +* @{tf.train.import_meta_graph} + +# Deprecated functions (removed after 2017-03-02). Please don't use them. + +* @{tf.all_variables} +* @{tf.initialize_all_variables} +* @{tf.initialize_local_variables} +* @{tf.initialize_variables} diff --git a/tensorflow/docs_src/api_guides/python/string_ops.md b/tensorflow/docs_src/api_guides/python/string_ops.md new file mode 100644 index 0000000000..a73a5efac9 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/string_ops.md @@ -0,0 +1,34 @@ +# Strings + +Note: Functions taking `Tensor` arguments can also take anything accepted by +@{tf.convert_to_tensor}. + +[TOC] + +## Hashing + +String hashing ops take a string input tensor and map each element to an +integer. + +* @{tf.string_to_hash_bucket_fast} +* @{tf.string_to_hash_bucket_strong} +* @{tf.string_to_hash_bucket} + +## Joining + +String joining ops concatenate elements of input string tensors to produce a new +string tensor. + +* @{tf.reduce_join} +* @{tf.string_join} + +## Splitting + +* @{tf.string_split} +* @{tf.substr} + +## Conversion + +* @{tf.as_string} +* @{tf.encode_base64} +* @{tf.decode_base64} diff --git a/tensorflow/docs_src/api_guides/python/summary.md b/tensorflow/docs_src/api_guides/python/summary.md new file mode 100644 index 0000000000..eda119ab24 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/summary.md @@ -0,0 +1,23 @@ +# Summary Operations +[TOC] + +Summaries provide a way to export condensed information about a model, which is +then accessible in tools such as @{$summaries_and_tensorboard$TensorBoard}. + +## Generation of Summaries + +### Class for writing Summaries +* @{tf.summary.FileWriter} +* @{tf.summary.FileWriterCache} + +### Summary Ops +* @{tf.summary.tensor_summary} +* @{tf.summary.scalar} +* @{tf.summary.histogram} +* @{tf.summary.audio} +* @{tf.summary.image} +* @{tf.summary.merge} +* @{tf.summary.merge_all} + +## Utilities +* @{tf.summary.get_summary_description} diff --git a/tensorflow/docs_src/api_guides/python/test.md b/tensorflow/docs_src/api_guides/python/test.md new file mode 100644 index 0000000000..6c5e4619a0 --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/test.md @@ -0,0 +1,44 @@ +# Testing +[TOC] + +## Unit tests + +TensorFlow provides a convenience class inheriting from `unittest.TestCase` +which adds methods relevant to TensorFlow tests. Here is an example: + +```python + import tensorflow as tf + + + class SquareTest(tf.test.TestCase): + + def testSquare(self): + with self.test_session(): + x = tf.square([2, 3]) + self.assertAllEqual(x.eval(), [4, 9]) + + + if __name__ == '__main__': + tf.test.main() +``` + +`tf.test.TestCase` inherits from `unittest.TestCase` but adds a few additional +methods. We will document these methods soon. + +* @{tf.test.main} +* @{tf.test.TestCase} +* @{tf.test.test_src_dir_path} + +## Utilities + +* @{tf.test.assert_equal_graph_def} +* @{tf.test.get_temp_dir} +* @{tf.test.is_built_with_cuda} +* @{tf.test.is_gpu_available} +* @{tf.test.gpu_device_name} + +## Gradient checking + +@{tf.test.compute_gradient} and @{tf.test.compute_gradient_error} perform +numerical differentiation of graphs for comparison against registered analytic +gradients. diff --git a/tensorflow/docs_src/api_guides/python/tfdbg.md b/tensorflow/docs_src/api_guides/python/tfdbg.md new file mode 100644 index 0000000000..2212a2da0e --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/tfdbg.md @@ -0,0 +1,50 @@ +# TensorFlow Debugger +[TOC] + +Public Python API of TensorFlow Debugger (tfdbg). + +## Functions for adding debug watches + +These functions help you modify `RunOptions` to specify which `Tensor`s are to +be watched when the TensorFlow graph is executed at runtime. + +* @{tfdbg.add_debug_tensor_watch} +* @{tfdbg.watch_graph} +* @{tfdbg.watch_graph_with_blacklists} + + +## Classes for debug-dump data and directories + +These classes allow you to load and inspect tensor values dumped from +TensorFlow graphs during runtime. + +* @{tfdbg.DebugTensorDatum} +* @{tfdbg.DebugDumpDir} + + +## Functions for loading debug-dump data + +* @{tfdbg.load_tensor_from_event_file} + + +## Tensor-value predicates + +Built-in tensor-filter predicates to support conditional breakpoint between +runs. See `DebugDumpDir.find()` for more details. + +* @{tfdbg.has_inf_or_nan} + + +## Session wrapper class and `SessionRunHook` implementations + +These classes allow you to + +* wrap aroundTensorFlow `Session` objects to debug plain TensorFlow models + (see `DumpingDebugWrapperSession` and `LocalCLIDebugWrapperSession`), or +* generate `SessionRunHook` objects to debug `tf.contrib.learn` models (see + `DumpingDebugHook` and `LocalCLIDebugHook`). + +* @{tfdbg.DumpingDebugHook} +* @{tfdbg.DumpingDebugWrapperSession} +* @{tfdbg.LocalCLIDebugHook} +* @{tfdbg.LocalCLIDebugWrapperSession} diff --git a/tensorflow/docs_src/api_guides/python/train.md b/tensorflow/docs_src/api_guides/python/train.md new file mode 100644 index 0000000000..943394f4ae --- /dev/null +++ b/tensorflow/docs_src/api_guides/python/train.md @@ -0,0 +1,133 @@ +# Training +[TOC] + +@{tf.train} provides a set of classes and functions that help train models. + +## Optimizers + +The Optimizer base class provides methods to compute gradients for a loss and +apply gradients to variables. A collection of subclasses implement classic +optimization algorithms such as GradientDescent and Adagrad. + +You never instantiate the Optimizer class itself, but instead instantiate one +of the subclasses. + +* @{tf.train.Optimizer} +* @{tf.train.GradientDescentOptimizer} +* @{tf.train.AdadeltaOptimizer} +* @{tf.train.AdagradOptimizer} +* @{tf.train.AdagradDAOptimizer} +* @{tf.train.MomentumOptimizer} +* @{tf.train.AdamOptimizer} +* @{tf.train.FtrlOptimizer} +* @{tf.train.ProximalGradientDescentOptimizer} +* @{tf.train.ProximalAdagradOptimizer} +* @{tf.train.RMSPropOptimizer} + +## Gradient Computation + +TensorFlow provides functions to compute the derivatives for a given +TensorFlow computation graph, adding operations to the graph. The +optimizer classes automatically compute derivatives on your graph, but +creators of new Optimizers or expert users can call the lower-level +functions below. + +* @{tf.gradients} +* @{tf.AggregationMethod} +* @{tf.stop_gradient} +* @{tf.hessians} + + +## Gradient Clipping + +TensorFlow provides several operations that you can use to add clipping +functions to your graph. You can use these functions to perform general data +clipping, but they're particularly useful for handling exploding or vanishing +gradients. + +* @{tf.clip_by_value} +* @{tf.clip_by_norm} +* @{tf.clip_by_average_norm} +* @{tf.clip_by_global_norm} +* @{tf.global_norm} + +## Decaying the learning rate +* @{tf.train.exponential_decay} +* @{tf.train.inverse_time_decay} +* @{tf.train.natural_exp_decay} +* @{tf.train.piecewise_constant} +* @{tf.train.polynomial_decay} + +## Moving Averages + +Some training algorithms, such as GradientDescent and Momentum often benefit +from maintaining a moving average of variables during optimization. Using the +moving averages for evaluations often improve results significantly. + +* @{tf.train.ExponentialMovingAverage} + +## Coordinator and QueueRunner + +See @{$threading_and_queues$Threading and Queues} +for how to use threads and queues. For documentation on the Queue API, +see @{$python/io_ops#queues$Queues}. + + +* @{tf.train.Coordinator} +* @{tf.train.QueueRunner} +* @{tf.train.LooperThread} +* @{tf.train.add_queue_runner} +* @{tf.train.start_queue_runners} + +## Distributed execution + +See @{$distributed$Distributed TensorFlow} for +more information about how to configure a distributed TensorFlow program. + +* @{tf.train.Server} +* @{tf.train.Supervisor} +* @{tf.train.SessionManager} +* @{tf.train.ClusterSpec} +* @{tf.train.replica_device_setter} +* @{tf.train.MonitoredTrainingSession} +* @{tf.train.MonitoredSession} +* @{tf.train.SingularMonitoredSession} +* @{tf.train.Scaffold} +* @{tf.train.SessionCreator} +* @{tf.train.ChiefSessionCreator} +* @{tf.train.WorkerSessionCreator} + +## Reading Summaries from Event Files + +See @{$summaries_and_tensorboard$Summaries and TensorBoard} for an +overview of summaries, event files, and visualization in TensorBoard. + +* @{tf.train.summary_iterator} + +## Training Hooks + +Hooks are tools that run in the process of training/evaluation of the model. + +* @{tf.train.SessionRunHook} +* @{tf.train.SessionRunArgs} +* @{tf.train.SessionRunContext} +* @{tf.train.SessionRunValues} +* @{tf.train.LoggingTensorHook} +* @{tf.train.StopAtStepHook} +* @{tf.train.CheckpointSaverHook} +* @{tf.train.NewCheckpointReader} +* @{tf.train.StepCounterHook} +* @{tf.train.NanLossDuringTrainingError} +* @{tf.train.NanTensorHook} +* @{tf.train.SummarySaverHook} +* @{tf.train.GlobalStepWaiterHook} +* @{tf.train.FinalOpsHook} +* @{tf.train.FeedFnHook} + +## Training Utilities + +* @{tf.train.global_step} +* @{tf.train.basic_train_loop} +* @{tf.train.get_global_step} +* @{tf.train.assert_global_step} +* @{tf.train.write_graph} diff --git a/tensorflow/g3doc/how_tos/documentation/index.md b/tensorflow/docs_src/community/documentation.md similarity index 99% rename from tensorflow/g3doc/how_tos/documentation/index.md rename to tensorflow/docs_src/community/documentation.md index 1ccaba32f5..f8a63240a0 100755 --- a/tensorflow/g3doc/how_tos/documentation/index.md +++ b/tensorflow/docs_src/community/documentation.md @@ -138,7 +138,7 @@ a 3-D tensor with shape `[6, 8, 6]`. ### Links To link to something else in the `g3docs` tree, use a relative path, like -`[tf.parse_example](../api_docs/python/ops.md#parse_example)` +`@{tf.parse_example}` Do not use absolute paths for internal links, as this will break the website generator. @@ -320,7 +320,7 @@ Here's an example from the module docsting in `image_ops.py`: TensorFlow can convert between images in RGB or HSV. The conversion functions work only on `float` images, so you need to convert images in - other formats using [`convert_image_dtype`](#convert-image-dtype). + other formats using @{tf.image.convert_image_dtype}. Example: diff --git a/tensorflow/docs_src/community/leftnav_files b/tensorflow/docs_src/community/leftnav_files new file mode 100644 index 0000000000..9a810f3c9f --- /dev/null +++ b/tensorflow/docs_src/community/leftnav_files @@ -0,0 +1,2 @@ +documentation.md +style_guide.md diff --git a/tensorflow/g3doc/how_tos/style_guide.md b/tensorflow/docs_src/community/style_guide.md similarity index 99% rename from tensorflow/g3doc/how_tos/style_guide.md rename to tensorflow/docs_src/community/style_guide.md index ccbb611c3e..a8f2cba0d6 100644 --- a/tensorflow/g3doc/how_tos/style_guide.md +++ b/tensorflow/docs_src/community/style_guide.md @@ -106,7 +106,7 @@ creates a part of the graph and returns output tensors. * Operations should contain an extensive Python comment with Args and Returns declarations that explain both the type and meaning of each value. Possible shapes, dtypes, or ranks should be specified in the description. - [See documentation details](documentation/index.md) + @{$documentation$See documentation details} * For increased usability include an example of usage with inputs / outputs of the op in Example section. diff --git a/tensorflow/g3doc/how_tos/distributed/index.md b/tensorflow/docs_src/deploy/distributed.md similarity index 94% rename from tensorflow/g3doc/how_tos/distributed/index.md rename to tensorflow/docs_src/deploy/distributed.md index cdbb4cfaa5..496d3b9b68 100644 --- a/tensorflow/g3doc/how_tos/distributed/index.md +++ b/tensorflow/docs_src/deploy/distributed.md @@ -2,7 +2,7 @@ This document shows how to create a cluster of TensorFlow servers, and how to distribute a computation graph across that cluster. We assume that you are -familiar with the [basic concepts](../../get_started/basic_usage.md) of +familiar with the @{$get_started$basic concepts} of writing TensorFlow programs. ## Hello distributed TensorFlow! @@ -21,7 +21,7 @@ $ python ``` The -[`tf.train.Server.create_local_server()`](../../api_docs/python/train.md#Server.create_local_server) +@{tf.train.Server.create_local_server} method creates a single-process cluster, with an in-process server. ## Create a cluster @@ -49,7 +49,7 @@ the following: The cluster specification dictionary maps job names to lists of network adresses. Pass this dictionary to -the [`tf.train.ClusterSpec`](../../api_docs/python/train.md#ClusterSpec) +the @{tf.train.ClusterSpec} constructor. For example: @@ -78,10 +78,10 @@ tf.train.ClusterSpec({ ### Create a `tf.train.Server` instance in each task -A [`tf.train.Server`](../../api_docs/python/train.md#Server) object contains a +A @{tf.train.Server} object contains a set of local devices, a set of connections to other tasks in its `tf.train.ClusterSpec`, and a -["session target"](../../api_docs/python/client.md#Session) that can use these +@{tf.Session} that can use these to perform a distributed computation. Each server is a member of a specific named job and has a task index within that job. A server can communicate with any other server in the cluster. @@ -111,7 +111,7 @@ which you'd like to see support, please raise a ## Specifying distributed devices in your model To place operations on a particular process, you can use the same -[`tf.device()`](../../api_docs/python/framework.md#device) +@{tf.device} function that is used to specify whether ops run on the CPU or GPU. For example: ```python @@ -159,7 +159,7 @@ simplify the work of specifying a replicated model. Possible approaches include: for each `/job:worker` task, typically in the same process as the worker task. Each client builds a similar graph containing the parameters (pinned to `/job:ps` as before using - [`tf.train.replica_device_setter()`](../../api_docs/python/train.md#replica_device_setter) + @{tf.train.replica_device_setter} to map them deterministically to the same tasks); and a single copy of the compute-intensive part of the model, pinned to the local task in `/job:worker`. @@ -174,7 +174,7 @@ simplify the work of specifying a replicated model. Possible approaches include: gradient averaging as in the [CIFAR-10 multi-GPU trainer](https://www.tensorflow.org/code/tensorflow_models/tutorials/image/cifar10/cifar10_multi_gpu_train.py)), and between-graph replication (e.g. using the - [`tf.train.SyncReplicasOptimizer`](../../api_docs/python/train.md#SyncReplicasOptimizer)). + @{tf.train.SyncReplicasOptimizer}). ### Putting it all together: example trainer program @@ -312,7 +312,7 @@ A TensorFlow cluster comprises a one or more "jobs", each divided into lists of one or more "tasks". A cluster is typically dedicated to a particular high-level objective, such as training a neural network, using many machines in parallel. A cluster is defined by -a [`tf.train.ClusterSpec`](../../api_docs/python/train.md#ClusterSpec) object. +a @{tf.train.ClusterSpec} object. **Job** @@ -338,7 +338,7 @@ to a single process. A task belongs to a particular "job" and is identified by its index within that job's list of tasks. **TensorFlow server** A process running -a [`tf.train.Server`](../../api_docs/python/train.md#Server) instance, which is +a @{tf.train.Server} instance, which is a member of a cluster, and exports a "master service" and "worker service". **Worker service** diff --git a/tensorflow/g3doc/how_tos/hadoop/index.md b/tensorflow/docs_src/deploy/hadoop.md similarity index 93% rename from tensorflow/g3doc/how_tos/hadoop/index.md rename to tensorflow/docs_src/deploy/hadoop.md index 2f01843604..9493ad02c0 100644 --- a/tensorflow/g3doc/how_tos/hadoop/index.md +++ b/tensorflow/docs_src/deploy/hadoop.md @@ -6,7 +6,7 @@ at the moment. ## HDFS -We assume that you are familiar with [reading data](../reading_data/index.md). +We assume that you are familiar with @{$reading_data$reading data}. To use HDFS with TensorFlow, change the file paths you use to read and write data to an HDFS path. For example: @@ -61,5 +61,5 @@ be set: export KERB_TICKET_CACHE_PATH=/tmp/krb5cc_10002 ``` -If you are running [Distributed TensorFlow](../distributed/index.md), then all +If you are running @{$distributed$Distributed TensorFlow}, then all workers must have the environment variables set and Hadoop installed. diff --git a/tensorflow/docs_src/deploy/leftnav_files b/tensorflow/docs_src/deploy/leftnav_files new file mode 100644 index 0000000000..82ff6279fe --- /dev/null +++ b/tensorflow/docs_src/deploy/leftnav_files @@ -0,0 +1,3 @@ +hadoop.md +distributed.md +tfserve.md diff --git a/tensorflow/g3doc/tutorials/tfserve/index.md b/tensorflow/docs_src/deploy/tfserve.md similarity index 100% rename from tensorflow/g3doc/tutorials/tfserve/index.md rename to tensorflow/docs_src/deploy/tfserve.md diff --git a/tensorflow/docs_src/extend/add_filesys.md b/tensorflow/docs_src/extend/add_filesys.md new file mode 100644 index 0000000000..b955ee8fbe --- /dev/null +++ b/tensorflow/docs_src/extend/add_filesys.md @@ -0,0 +1,256 @@ +# Adding a Custom Filesystem Plugin + +## Background + +The TensorFlow framework is often used in multi-process and +multi-machine environments, such as Google data centers, Google Cloud +Machine Learning, Amazon Web Services (AWS), and on-site distributed clusters. +In order to both share and save certain types of state produced by TensorFlow, +the framework assumes the existence of a reliable, shared filesystem. This +shared filesystem has numerous uses, for example: + +* Checkpoints of state are often saved to a distributed filesystem for + reliability and fault-tolerance. +* Training processes communicate with TensorBoard by writing event files + to a directory, which TensorBoard watches. A shared filesystem allows this + communication to work even when TensorBoard runs in a different process or + machine. + +There are many different implementations of shared or distributed filesystems in +the real world, so TensorFlow provides an ability for users to implement a +custom FileSystem plugin that can be registered with the TensorFlow runtime. +When the TensorFlow runtime attempts to write to a file through the `FileSystem` +interface, it uses a portion of the pathname to dynamically select the +implementation that should be used for filesystem operations. Thus, adding +support for your custom filesystem requires implementing a `FileSystem` +interface, building a shared object containing that implementation, and loading +that object at runtime in whichever process needs to write to that filesystem. + +Note that TensorFlow already includes many filesystem implementations, such as: + +* A standard POSIX filesystem + + Note: NFS filesystems often mount as a POSIX interface, and so standard + TensorFlow can work on top of NFS-mounted remote filesystems. +* HDFS - the Hadoop File System +* GCS - Google Cloud Storage filesystem +* A "memory-mapped-file" filesystem + +The rest of this guide describes how to implement a custom filesystem. + +## Implementing a custom filesystem plugin + +To implement a custom filesystem plugin, you must do the following: + +* Implement subclasses of `RandomAccessFile`, `WriteableFile`, + `AppendableFile`, and `ReadOnlyMemoryRegion`. +* Implement the `FileSystem` interface as a subclass. +* Register the `FileSystem` implementation with an appropriate prefix pattern. +* Load the filesystem plugin in a process that wants to write to that + filesystem. + +### The FileSystem interface + +The `FileSystem` interface is an abstract C++ interface defined in +[file_system.h](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/platform/file_system.h). +An implementation of the `FileSystem` interface should implement all relevant +the methods defined by the interface. Implementing the interface requires +defining operations such as creating `RandomAccessFile`, `WritableFile`, and +implementing standard filesystem operations such as `FileExists`, `IsDirectory`, +`GetMatchingPaths`, `DeleteFile`, and so on. An implementation of these +interfaces will often involve translating the function's input arguments to +delegate to an already-existing library function implementing the equivalent +functionality in your custom filesystem. + +For example, the `PosixFileSystem` implementation implements `DeleteFile` using +the POSIX `unlink()` function; `CreateDir` simply calls `mkdir()`; `GetFileSize` +involves calling `stat()` on the file and then returns the filesize as reported +by the return of the stat object. Similarly, for the `HDFSFileSystem` +implementation, these calls simply delegate to the `libHDFS` implementation of +similar functionality, such as `hdfsDelete` for +[DeleteFile](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/platform/hadoop/hadoop_file_system.cc#L386). + +We suggest looking through these code examples to get an idea of how different +filesystem implementations call their existing libraries. Examples include: + +* [POSIX + plugin](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/platform/posix/posix_file_system.h) +* [HDFS + plugin](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/platform/hadoop/hadoop_file_system.h) +* [GCS + plugin](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/platform/cloud/gcs_file_system.h) + +#### The File interfaces + +Beyond operations that allow you to query and manipulate files and directories +in a filesystem, the `FileSystem` interface requires you to implement factories +that return implementations of abstract objects such as the +[RandomAccessFile](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/platform/file_system.h#L223), +the `WritableFile`, so that TensorFlow code and read and write to files in that +`FileSystem` implementation. + +To implement a `RandomAccessFile`, you must implement a single interface called +`Read()`, in which the implementation must provide a way to read from an offset +within a named file. + +For example, below is the implementation of RandomAccessFile for the POSIX +filesystem, which uses the `pread()` random-access POSIX function to implement +read. Notice that the particular implementation must know how to retry or +propagate errors from the underlying filesystem. + +```C++ + class PosixRandomAccessFile : public RandomAccessFile { + public: + PosixRandomAccessFile(const string& fname, int fd) + : filename_(fname), fd_(fd) {} + ~PosixRandomAccessFile() override { close(fd_); } + + Status Read(uint64 offset, size_t n, StringPiece* result, + char* scratch) const override { + Status s; + char* dst = scratch; + while (n > 0 && s.ok()) { + ssize_t r = pread(fd_, dst, n, static_cast(offset)); + if (r > 0) { + dst += r; + n -= r; + offset += r; + } else if (r == 0) { + s = Status(error::OUT_OF_RANGE, "Read less bytes than requested"); + } else if (errno == EINTR || errno == EAGAIN) { + // Retry + } else { + s = IOError(filename_, errno); + } + } + *result = StringPiece(scratch, dst - scratch); + return s; + } + + private: + string filename_; + int fd_; + }; +``` + +To implement the WritableFile sequential-writing abstraction, one must implement +a few interfaces, such as `Append()`, `Flush()`, `Sync()`, and `Close()`. + +For example, below is the implementation of WritableFile for the POSIX +filesystem, which takes a `FILE` object in its constructor and uses standard +posix functions on that object to implement the interface. + +```C++ + class PosixWritableFile : public WritableFile { + public: + PosixWritableFile(const string& fname, FILE* f) + : filename_(fname), file_(f) {} + + ~PosixWritableFile() override { + if (file_ != NULL) { + fclose(file_); + } + } + + Status Append(const StringPiece& data) override { + size_t r = fwrite(data.data(), 1, data.size(), file_); + if (r != data.size()) { + return IOError(filename_, errno); + } + return Status::OK(); + } + + Status Close() override { + Status result; + if (fclose(file_) != 0) { + result = IOError(filename_, errno); + } + file_ = NULL; + return result; + } + + Status Flush() override { + if (fflush(file_) != 0) { + return IOError(filename_, errno); + } + return Status::OK(); + } + + Status Sync() override { + Status s; + if (fflush(file_) != 0) { + s = IOError(filename_, errno); + } + return s; + } + + private: + string filename_; + FILE* file_; + }; + +``` + +For more details, please see the documentations of those interfaces, and look at +example implementations for inspiration. + +### Registering and loading the filesystem + +Once you have implemented the `FileSystem` implementation for your custom +filesystem, you need to register it under a "scheme" so that paths prefixed with +that scheme are directed to your implementation. To do this, you call +`REGISTER_FILE_SYSTEM`:: + +``` + REGISTER_FILE_SYSTEM("foobar", FooBarFileSystem); +``` + +When TensorFlow tries to operate on a file whose path starts with `foobar://`, +it will use the `FooBarFileSystem` implementation. + +```C++ + string filename = "foobar://path/to/file.txt"; + std::unique_ptr file; + + // Calls FooBarFileSystem::NewWritableFile to return + // a WritableFile class, which happens to be the FooBarFileSystem's + // WritableFile implementation. + TF_RETURN_IF_ERROR(env->NewWritableFile(filename, &file)); +``` + +Next, you must build a shared object containing this implementation. An example +of doing so using bazel's `cc_binary` rule can be found +[here](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/BUILD#L244), +but you may use any build system to do so. See the section on @{$adding_an_op#build-the-op-library$building the op library} for similar +instructions. + +The result of building this target is a `.so` shared object file. + +Lastly, you must dynamically load this implementation in the process. In Python, +you can call the `tf.load_file_system_library(file_system_library)` function, +passing the path to the shared object. Calling this in your client program loads +the shared object in the process, thus registering your implementation as +available for any file operations going through the `FileSystem` interface. You +can see +[test_file_system.py](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/framework/file_system_test.py) +for an example. + +## What goes through this interface? + +Almost all core C++ file operations within TensorFlow use the `FileSystem` +interface, such as the `CheckpointWriter`, the `EventsWriter`, and many other +utilities. This means implementing a `FileSystem` implementation allows most of +your TensorFlow programs to write to your shared filesystem. + +In Python, the `gfile` and `file_io` classes bind underneath to the `FileSystem +implementation via SWIG, which means that once you have loaded this filesystem +library, you can do: + +``` +with gfile.Open("foobar://path/to/file.txt") as w: + + w.write("hi") +``` + +When you do this, a file containing "hi" will appear in the "/path/to/file.txt" +of your shared filesystem. diff --git a/tensorflow/g3doc/how_tos/adding_an_op/index.md b/tensorflow/docs_src/extend/adding_an_op.md similarity index 76% rename from tensorflow/g3doc/how_tos/adding_an_op/index.md rename to tensorflow/docs_src/extend/adding_an_op.md index 6006e00a8e..9b55f95cb7 100644 --- a/tensorflow/g3doc/how_tos/adding_an_op/index.md +++ b/tensorflow/docs_src/extend/adding_an_op.md @@ -1,44 +1,71 @@ # Adding a New Op +If you'd like to create an op that isn't covered by the existing TensorFlow +library, we recommend that you first try writing the op in Python as +a composition of existing Python ops or functions. If that isn't possible, you +can create a custom C++ op. There are several reasons why you might want to +create a custom C++ op: + +* It's not easy or possible to express your operation as a composition of + existing ops. +* It's not efficient to express your operation as a composition of existing + primitives. +* You want to hand-fuse a composition of primitives that a future compiler + would find difficult fusing. + +For example, imagine you want to implement something like "median pooling", +similar to the "MaxPool" operator, but computing medians over sliding windows +instead of maximum values. Doing this using a composition of operations may be +possible (e.g., using ExtractImagePatches and TopK), but may not be as +performance- or memory-efficient as a native operation where you can do +something more clever in a single, fused operation. As always, it is typically +first worth trying to express what you want using operator composition, only +choosing to add a new operation if that proves to be difficult or inefficient. + +To incorporate your custom op you'll need to: + +1. Register the new op in a C++ file. Op registration defines an interface + (specification) for the op's functionality, which is independent of the + op's implementation. For example, op registration defines the op's name and + the op's inputs and outputs. It also defines the shape function + that is used for tensor shape inference. +2. Implement the op in C++. The implementation of an op is known + as a kernel, and it is the concrete implementation of the specification you + registered in Step 1. There can be multiple kernels for different input / + output types or architectures (for example, CPUs, GPUs). +3. Create a Python wrapper (optional). This wrapper is the public API that's + used to create the op in Python. A default wrapper is generated from the + op registration, which can be used directly or added to. +4. Write a function to compute gradients for the op (optional). +5. Test the op. We usually do this in Python for convenience, but you can also + test the op in C++. If you define gradients, you can verify them with the + Python @{tf.test.compute_gradient_error$gradient checker}. + See + [`relu_op_test.py`](https://www.tensorflow.org/code/tensorflow/python/kernel_tests/relu_op_test.py) as + an example that does tests the forward functions of Relu-like operators and + their gradients. + PREREQUISITES: -* Some familiarity with C++. -* Must have installed the - [TensorFlow binary](../../get_started/os_setup.md#pip-installation), or must - have - [downloaded TensorFlow source](../../get_started/os_setup.md#installing-from-sources), - and be able to build it. - -If you'd like to incorporate an operation that isn't covered by the existing -library, you can create a custom Op. To incorporate your custom Op, you'll need -to: - -* Register the new Op in a C++ file. The Op registration is independent of the - implementation, and describes the semantics of how the Op is invoked. For - example, it defines the Op name, and specifies its inputs and outputs. - It also defines the shape function that is used for tensor shape inference. -* Implement the Op in C++. This implementation is called a "kernel", and there - can be multiple kernels for different architectures (e.g. CPUs, GPUs) or - input / output types. -* Optionally, create a Python wrapper. This wrapper is the public API to create - the Op. A default wrapper is generated from the Op registration, which can be - used directly or added to. -* Optionally, write a function to compute gradients for the Op. -* Test the Op, typically in Python. If you define gradients, you can verify them with the Python [`GradientChecker`](https://www.tensorflow.org/code/tensorflow/python/kernel_tests/gradient_checker.py). +* Some familiarity with C++. +* Must have installed the + @{$install$TensorFlow binary}, or must have + @{$install_sources$downloaded TensorFlow source}, + and be able to build it. [TOC] -## Define the Op's interface +## Define the op's interface -You define the interface of an Op by registering it with the TensorFlow system. -In the registration, you specify the name of your Op, its inputs (types and +You define the interface of an op by registering it with the TensorFlow system. +In the registration, you specify the name of your op, its inputs (types and names) and outputs (types and names), as well as docstrings and -any [attrs](#attrs) the Op might require. +any [attrs](#attrs) the op might require. -To see how this works, suppose you'd like to create an Op that takes a tensor of +To see how this works, suppose you'd like to create an op that takes a tensor of `int32`s and outputs a copy of the tensor, with all but the first element set to -zero. Create file `tensorflow/core/user_ops/zero_out.cc` and -add a call to the `REGISTER_OP` macro that defines the interface for such an Op: +zero. To do this, create a file named `zero_out.cc`. Then add a call to the +`REGISTER_OP` macro that defines the interface for your op: ```c++ #include "tensorflow/core/framework/op.h" @@ -55,28 +82,24 @@ REGISTER_OP("ZeroOut") }); ``` -This `ZeroOut` Op takes one tensor `to_zero` of 32-bit integers as input, and -outputs a tensor `zeroed` of 32-bit integers of the same shape as the input. -For example, if the input is a Tensor of shape [10, 20], then this shape -function specifies that the output shape is also [10, 20]. +This `ZeroOut` op takes one tensor `to_zero` of 32-bit integers as input, and +outputs a tensor `zeroed` of 32-bit integers. The op also uses a shape function +to ensure that the output tensor is the same shape as the input tensor. For +example, if the input is a tensor of shape [10, 20], then this shape function +specifies that the output shape is also [10, 20]. + -> A note on naming: The name of the Op should be unique and CamelCase. Names -> starting with an underscore (`_`) are reserved for internal use. +> A note on naming: The op name must be in CamelCase and it must be unique +> among all other ops that are registered in the binary. -## Implement the kernel for the Op +## Implement the kernel for the op -After you define the interface, provide one or more implementations of the Op. +After you define the interface, provide one or more implementations of the op. To create one of these kernels, create a class that extends `OpKernel` and overrides the `Compute` method. The `Compute` method provides one `context` argument of type `OpKernelContext*`, from which you can access useful things like the input and output tensors. -> Important note: Instances of your OpKernel may be accessed concurrently. Your -> `Compute` method must be thread-safe. Guard any access to class members with a -> mutex (Or better yet, don't share state via class members! Consider using a -> [`ResourceMgr`](https://www.tensorflow.org/code/tensorflow/core/framework/resource_mgr.h) -> to keep track of Op state). - Add your kernel to the file you created above. The kernel might look something like this: @@ -123,12 +146,18 @@ To do this for the `ZeroOut` op, add the following to `zero_out.cc`: REGISTER_KERNEL_BUILDER(Name("ZeroOut").Device(DEVICE_CPU), ZeroOutOp); ``` -## Building the Op library -### With TensorFlow binary installation +> Important: Instances of your OpKernel may be accessed concurrently. +> Your `Compute` method must be thread-safe. Guard any access to class +> members with a mutex. Or better yet, don't share state via class members! +> Consider using a [`ResourceMgr`](https://www.tensorflow.org/code/tensorflow/core/framework/resource_mgr.h) +> to keep track of op state. + +## Build the op library +### Compile the op using your system compiler (TensorFlow binary installation) You should be able to compile `zero_out.cc` with a `C++` compiler such as `g++` or `clang` available on your system. The binary PIP package installs the header -files and the library that you need to compile your Op in locations that are +files and the library that you need to compile your op in locations that are system specific. However, the TensorFlow python library provides the `get_include` function to get the header directory. Here is the output of this function on a Ubuntu machine. @@ -142,7 +171,7 @@ $ python ``` Assuming you have `g++` installed, here is the sequence of commands you can use -to compile your Op into a dynamic library. +to compile your op into a dynamic library. ```bash TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())') @@ -151,18 +180,19 @@ g++ -std=c++11 -shared zero_out.cc -o zero_out.so -fPIC -I $TF_INC -O2 ``` On Mac OS X, the additional flag "-undefined dynamic_lookup" is required when -building the .so file. +building the `.so` file. -> Note on gcc version 5: gcc5 uses the new C++ -[ABI](https://gcc.gnu.org/gcc-5/changes.html#libstdcxx). The binary pip packages -available on the TensorFlow website are built with gcc4 that uses the older ABI. -If you compile your op library with gcc5, add `-D_GLIBCXX_USE_CXX11_ABI=0` to -the command line to make the library compatible with the older abi. +> Note on gcc version 5: gcc5 uses the new C++ +> [ABI](https://gcc.gnu.org/gcc-5/changes.html#libstdcxx). The binary pip +> packages available on the TensorFlow website are built with gcc4 that uses +> the older ABI. If you compile your op library with gcc5, add +> `-D_GLIBCXX_USE_CXX11_ABI=0` to the command line to make the library +> compatible with the older abi. -### With TensorFlow source installation +### Compile the op using bazel (TensorFlow source installation) If you have TensorFlow sources installed, you can make use of TensorFlow's build -system to compile your Op. Place a BUILD file with following Bazel build rule in +system to compile your op. Place a BUILD file with following Bazel build rule in the [`tensorflow/core/user_ops`][user_ops] directory. ```python @@ -180,20 +210,20 @@ Run the following command to build `zero_out.so`. $ bazel build --config opt //tensorflow/core/user_ops:zero_out.so ``` -> Note: -Although you can create a shared library (a `.so` file) with the standard -`cc_library` rule, we strongly recommend that you use the `tf_custom_op_library` -macro. It adds some required dependencies, and performs checks to ensure that -the shared library is compatible with TensorFlow's plugin loading mechanism. +> Note: Although you can create a shared library (a `.so` file) with the +> standard `cc_library` rule, we strongly recommend that you use the +> `tf_custom_op_library` macro. It adds some required dependencies, and +> performs checks to ensure that the shared library is compatible with +> TensorFlow's plugin loading mechanism. -## Using the Op in Python +## Use the op in Python TensorFlow Python API provides the -[load_op_library](../../api_docs/python/framework#load_op_library) function to -load the dynamic library and register the Op with the TensorFlow -framework. `load_op_library` returns a Python module, that contains the Python -wrappers for the Op. Thus, once you have built the op, you can do the following -to run it from Python : +@{tf.load_op_library} function to +load the dynamic library and register the op with the TensorFlow +framework. `load_op_library` returns a Python module that contains the Python +wrappers for the op and the kernel. Thus, once you have built the op, you can +do the following to run it from Python : ```python import tensorflow as tf @@ -202,18 +232,16 @@ with tf.Session(''): zero_out_module.zero_out([[1, 2], [3, 4]]).eval() # Prints -array([[1, 0], - [0, 0]], dtype=int32) +array([[1, 0], [0, 0]], dtype=int32) ``` -> Note: The generated function will be given a snake\_case name (to comply with -> [PEP8](https://www.python.org/dev/peps/pep-0008/)). So if your op is named -> `ZeroOut` in the C++ files, the python function will be called `zero_out`. +Keep in mind, the generated function will be given a snake\_case name (to comply +with [PEP8](https://www.python.org/dev/peps/pep-0008/)). So, if your op is +named `ZeroOut` in the C++ files, the python function will be called `zero_out`. -To make the Op available as a regular function `import`-able from a Python +To make the op available as a regular function `import`-able from a Python module, it maybe useful to have the `load_op_library` call in a Python source -file as follows (see -[zero_out_op_1.py](https://www.tensorflow.org/code/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_1.py)) +file as follows (see [zero_out_op_1.py](https://www.tensorflow.org/code/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_1.py)) : ```python @@ -223,11 +251,11 @@ _zero_out_module = tf.load_op_library('zero_out_op_kernel_1.so') zero_out = _zero_out_module.zero_out ``` -## Verify it works +## Verify that the op works -A good way to verify that you've successfully implemented your Op is to write a +A good way to verify that you've successfully implemented your op is to write a test for it. Create the file -`tensorflow/python/kernel_tests/zero_out_op_test.py` with the contents: +`zero_out_op_test.py` with the contents: ```python import tensorflow as tf @@ -243,26 +271,33 @@ if __name__ == "__main__": tf.test.main() ``` -Add a 'zero_out_op_test' target to `tensorflow/python/kernel_tests/BUILD` among the other CPU-only test targets: +Then run your test (assuming you have tensorflow installed): -``` -tf_py_test( - name = "zero_out_op_test", - size = "small", - srcs = ["zero_out_op_test.py"], - additional_deps = ["//tensorflow:tensorflow_py"], -) +```sh +$ python zero_out_op_test.py ``` -Then run your test: +## Building advanced features into your op -```sh -$ bazel test //tensorflow/python/kernel_tests:zero_out_op_test -``` +Now that you know how to build a basic (and somewhat restricted) op and +implementation, we'll look at some of the more complicated things you will +typically need to build into your op. This includes: -## Validation +* [Conditional checks and validation](#validate) +* Op registration + * [Attrs](#attrs) + * [Attr types](#attr-types) + * [Polymorphism](#polymorphism) + * [Inputs and outputs](#inputs-outputs) + * [Backwards compatibility](#backward-compat) +* [GPU support](#gpu-support) + * [Compiling the kernel for the GPU device](#compiling-kernel) +* [Implement the gradient in Python](#implement-gradient) +* [Shape functions in C++](#shape-functions) -The example above assumed that the Op applied to a tensor of any shape. What +### Conditional checks and validation {#validate} + +The example above assumed that the op applied to a tensor of any shape. What if it only applied to vectors? That means adding a check to the above OpKernel implementation. @@ -299,20 +334,22 @@ function is an error, and if so return it, use [`OP_REQUIRES_OK`][validation-macros]. Both of these macros return from the function on error. -## Op registration +### Op registration -### Attrs +#### Attrs {#attrs} -Ops can have attrs, whose values are set when the Op is added to a graph. These -are used to configure the Op, and their values can be accessed both within the -kernel implementation and in the types of inputs and outputs in the Op +Ops can have attrs, whose values are set when the op is added to a graph. These +are used to configure the op, and their values can be accessed both within the +kernel implementation and in the types of inputs and outputs in the op registration. Prefer using an input instead of an attr when possible, since -inputs are more flexible. They can change every step, be set using a feed, etc. -Attrs are used for things that can't be done with inputs: any configuration -that affects the signature (number or type of inputs or outputs) or that -can't change from step-to-step. - -You define an attr when you register the Op, by specifying its name and type +inputs are more flexible. This is because attrs are constants and must be +defined at graph construction time. In contrast, inputs are Tensors whose +values can be dynamic; that is, inputs can change every step, be set using a +feed, etc. Attrs are used for things that can't be done with inputs: any +configuration that affects the signature (number or type of inputs or outputs) +or that can't change from step-to-step. + +You define an attr when you register the op, by specifying its name and type using the `Attr` method, which expects a spec of the form: ``` @@ -323,8 +360,8 @@ where `` begins with a letter and can be composed of alphanumeric characters and underscores, and `` is a type expression of the form [described below](#attr-types). -For example, if you'd like the `ZeroOut` Op to preserve a user-specified index, -instead of only the 0th element, you can register the Op like so: +For example, if you'd like the `ZeroOut` op to preserve a user-specified index, +instead of only the 0th element, you can register the op like so:
 REGISTER\_OP("ZeroOut")
     .Attr("preserve\_index: int")
@@ -332,6 +369,9 @@ REGISTER\_OP("ZeroOut")
     .Output("zeroed: int32");
 
+(Note that the set of [attribute types](#attr-types) is different from the +@{$dims_types$tensor types} used for inputs and outputs.) + Your kernel can then access this attr in its constructor via the `context` parameter:
@@ -358,7 +398,9 @@ which can then be used in the `Compute` method:
 
   void Compute(OpKernelContext\* context) override {
     // ...
-
// Check that preserve\_index is in range +
+ // We're using saved attr to validate potentially dynamic input + // So we check that preserve\_index is in range OP\_REQUIRES(context, preserve\_index_ < input.dimension(0), errors::InvalidArgument("preserve\_index out of range"));
// Set all the elements of the output tensor to 0 @@ -371,18 +413,7 @@ which can then be used in the `Compute` method: }
-> To preserve [backwards compatibility](#backwards-compatibility), you should -> specify a [default value](#default-values-constraints) when adding an attr to -> an existing op: -> ->
-> REGISTER\_OP("ZeroOut")
->     .Attr("preserve\_index: int = 0")
->     .Input("to\_zero: int32")
->     .Output("zeroed: int32");
-> 
- -### Attr types +#### Attr types {#attr-types} The following types are supported in an attr: @@ -398,7 +429,7 @@ The following types are supported in an attr: See also: [`op_def_builder.cc:FinalizeAttr`][FinalizeAttr] for a definitive list. -#### Default values & constraints +##### Default values & constraints Attrs may have default values, and some types of attrs can have constraints. To define an attr with constraints, you can use the following ``s: @@ -414,7 +445,7 @@ define an attr with constraints, you can use the following ``s: * `{, }`: The value is of type `type`, and must be one of `` or ``, where `` and `` are supported - [tensor types](../../resources/dims_types.md#data-types). You don't specify + @{$dims_types#data-types$tensor types}. You don't specify that the type of the attr is `type`. This is implied when you have a list of types in `{...}`. For example, in this case the attr `t` is a type that must be an `int32`, a `float`, or a `bool`: @@ -450,7 +481,7 @@ define an attr with constraints, you can use the following ``s: * `int >= `: The value must be an int whose value is greater than or equal to ``, where `` is a natural number. - For example, the following Op registration specifies that the attr `a` must + For example, the following op registration specifies that the attr `a` must have a value that is at least `2`: ```c++ @@ -461,7 +492,7 @@ define an attr with constraints, you can use the following ``s: * `list() >= `: A list of type `` whose length is greater than or equal to ``. - For example, the following Op registration specifies that the attr `a` is a + For example, the following op registration specifies that the attr `a` is a list of types (either `int32` or `float`), and that there must be at least 3 of them: @@ -496,19 +527,18 @@ REGISTER_OP("AttrDefaultExampleForAllTypes") .Attr("l_int: list(int) = [2, 3, 5, 7]"); ``` -Note in particular that the values of type `type` use [the `DT_*` names -for the types](../../resources/dims_types.md#data-types). +Note in particular that the values of type `type` use @{$dims_types#data-types$the `DT_*` names for the types}. -### Polymorphism -#### Type Polymorphism +#### Polymorphism {#polymorphism} +##### Type Polymorphism For ops that can take different types as input or produce different output types, you can specify [an attr](#attrs) in -[an input or output type](#inputs-and-outputs) in the Op registration. Typically +[an input or output type](#inputs-and-outputs) in the op registration. Typically you would then register an `OpKernel` for each supported type. -For instance, if you'd like the `ZeroOut` Op to work on `float`s -in addition to `int32`s, your Op registration might look like: +For instance, if you'd like the `ZeroOut` op to work on `float`s +in addition to `int32`s, your op registration might look like:
 REGISTER\_OP("ZeroOut")
     .Attr("T: {float, int32}")
@@ -516,7 +546,7 @@ REGISTER\_OP("ZeroOut")
     .Output("zeroed: T");
 
-Your Op registration now specifies that the input's type must be `float`, or +Your op registration now specifies that the input's type must be `float`, or `int32`, and that its output will be the same type, since both have type `T`. > A note on naming: Inputs, outputs, and attrs generally should be @@ -602,7 +632,7 @@ class ZeroOutFloatOp : public OpKernel { } };
// Note that TypeConstraint<int32>("T") means that attr "T" (defined -// in the Op registration above) must be "int32" to use this template +// in the op registration above) must be "int32" to use this template // instantiation. REGISTER\_KERNEL\_BUILDER( Name("ZeroOut") @@ -662,7 +692,7 @@ class ZeroOutOp : public OpKernel { } };
// Note that TypeConstraint<int32>("T") means that attr "T" (defined -// in the Op registration above) must be "int32" to use this template +// in the op registration above) must be "int32" to use this template // instantiation.
REGISTER\_KERNEL\_BUILDER( Name("ZeroOut") @@ -725,7 +755,7 @@ TF_CALL_REAL_NUMBER_TYPES(REGISTER_KERNEL); #undef REGISTER_KERNEL ``` -#### List Inputs and Outputs +##### List Inputs and Outputs In addition to being able to accept or produce different types, ops can consume or produce a variable number of tensors. @@ -743,7 +773,7 @@ REGISTER_OP("PolymorphicListExample") ``` You can also place restrictions on what types can be specified in the list. In -this next case, the input is a list of `float` and `double` tensors. The Op +this next case, the input is a list of `float` and `double` tensors. The op accepts, for example, input types `(float, double, float)` and in that case the output type would also be `(float, double, float)`. @@ -800,9 +830,9 @@ REGISTER_OP("MinimumLengthPolymorphicListExample") .Output("out: T"); ``` -### Inputs and Outputs +#### Inputs and Outputs {#inputs-outputs} -To summarize the above, an Op registration can have multiple inputs and outputs: +To summarize the above, an op registration can have multiple inputs and outputs: ```c++ REGISTER_OP("MultipleInsAndOuts") @@ -826,7 +856,7 @@ expressions: `string`). This specifies a single tensor of the given type. See - [the list of supported Tensor types](../../resources/dims_types.md#data-types). + @{$dims_types#data-types$the list of supported Tensor types}. ```c++ REGISTER_OP("BuiltInTypesExample") @@ -869,9 +899,9 @@ expressions: * For a sequence of tensors with the same type: ` * `, where `` is the name of an [Attr](#attrs) with type `int`. The `` can either be - [a specific type like `int32` or `float`](../../resources/dims_types.md#data-types), + @{$dims_types#data-types$a specific type like `int32` or `float`}, or the name of an attr with type `type`. As an example of the first, this - Op accepts a list of `int32` tensors: + op accepts a list of `int32` tensors: ```c++ REGISTER_OP("Int32SequenceExample") @@ -879,7 +909,7 @@ expressions: .Input("in: NumTensors * int32") ``` - Whereas this Op accepts a list of tensors of any type, as long as they are all + Whereas this op accepts a list of tensors of any type, as long as they are all the same: ```c++ @@ -901,17 +931,22 @@ expressions: For more details, see [`tensorflow/core/framework/op_def_builder.h`][op_def_builder]. -### Backwards compatibility +#### Backwards compatibility {#backward-compat} -In general, changes to specifications must be backwards-compatible: changing the -specification of an Op must not break prior serialized `GraphDef` protocol -buffers constructed from older specifications. The details of `GraphDef` -compatibility are [described here](../../resources/versions.md#graphs). +Let's assume you have written a nice, custom op and shared it with others, so +you have happy customers using your operation. However, you'd like to make +changes to the op in some way. + +In general, changes to existing, checked-in specifications must be +backwards-compatible: changing the specification of an op must not break prior +serialized `GraphDef` protocol buffers constructed from older specifications. +The details of `GraphDef` compatibility are +@{$version_semantics#graphs$described here}. There are several ways to preserve backwards-compatibility. 1. Any new attrs added to an operation must have default values defined, and - with that default value the Op must have the original behavior. To change an + with that default value the op must have the original behavior. To change an operation from not polymorphic to polymorphic, you *must* give a default value to the new type attr to preserve the original signature by default. For example, if your operation was: @@ -941,11 +976,11 @@ There are several ways to preserve backwards-compatibility. 4. You can add a new list input / output, if it defaults to empty. -5. Namespace any new Ops you create, by prefixing the Op names with something - unique to your project. This avoids having your Op colliding with any Ops +5. Namespace any new ops you create, by prefixing the op names with something + unique to your project. This avoids having your op colliding with any ops that might be included in future versions of TensorFlow. -6. Plan ahead! Try to anticipate future uses for the Op. Some signature changes +6. Plan ahead! Try to anticipate future uses for the op. Some signature changes can't be done in a compatible way (for example, making a list of the same type into a list of varying types). @@ -960,9 +995,9 @@ callers. The Python API may be kept compatible by careful changes in a hand-written Python wrapper, by keeping the old signature except possibly adding new optional arguments to the end. Generally incompatible changes may only be made when TensorFlow's changes major versions, and must conform to the -[`GraphDef` version semantics](../../resources/versions.md#graphs). +@{$version_semantics#graphs$`GraphDef` version semantics}. -## GPU Support +### GPU Support {#gpu-support} You can implement different OpKernels and register one for CPU and another for GPU, just like you can [register kernels for different types](#polymorphism). @@ -971,12 +1006,16 @@ There are several examples of kernels with GPU support in Notice some kernels have a CPU version in a `.cc` file, a GPU version in a file ending in `_gpu.cu.cc`, and some code shared in common in a `.h` file. -For example, the [`pad` op](../../api_docs/python/array_ops.md#pad) has +For example, the @{tf.pad} has everything but the GPU kernel in [`tensorflow/core/kernels/pad_op.cc`][pad_op]. The GPU kernel is in [`tensorflow/core/kernels/pad_op_gpu.cu.cc`](https://www.tensorflow.org/code/tensorflow/core/kernels/pad_op_gpu.cu.cc), and the shared code is a templated class defined in [`tensorflow/core/kernels/pad_op.h`](https://www.tensorflow.org/code/tensorflow/core/kernels/pad_op.h). +We organize the code this way for two reasons: it allows you to share common +code among the CPU and GPU implementations, and it puts the GPU implementation +into a separate file so that it can be compiled only by the GPU compiler. + One thing to note, even when the GPU kernel version of `pad` is used, it still needs its `"paddings"` input in CPU memory. To mark that inputs or outputs are kept on the CPU, add a `HostMemory()` call to the kernel registration, e.g.: @@ -990,7 +1029,7 @@ kept on the CPU, add a `HostMemory()` call to the kernel registration, e.g.: PadOp) ``` -### Compiling the kernel for the GPU device +#### Compiling the kernel for the GPU device {#compiling-kernel} Look at [cuda_op_kernel.cu.cc](https://www.tensorflow.org/code/tensorflow/g3doc/how_tos/adding_an_op/cuda_op_kernel.cu.cc) @@ -1021,12 +1060,12 @@ you'll need to specify the path explicitly in the second (g++) command above. For example, add `-L /usr/local/cuda-8.0/lib64/` if your CUDA is installed in `/usr/local/cuda-8.0`. -## Implement the gradient in Python +### Implement the gradient in Python {#implement-gradient} Given a graph of ops, TensorFlow uses automatic differentiation (backpropagation) to add new ops representing gradients with respect to the existing ops (see -[Gradient Computation](../../api_docs/python/train.md#gradient-computation)). +@{$python/train#gradient_computation$Gradient Computation}). To make automatic differentiation work for new ops, you must register a gradient function which computes gradients with respect to the ops' inputs given gradients with respect to the ops' outputs. @@ -1070,16 +1109,16 @@ def _zero_out_grad(op, grad): ``` Details about registering gradient functions with -[`ops.RegisterGradient`](../../api_docs/python/framework.md#RegisterGradient): +@{tf.RegisterGradient}: * For an op with one output, the gradient function will take an - [`Operation`](../../api_docs/python/framework.md#Operation) `op` and a - [`Tensor`](../../api_docs/python/framework.md#Tensor) `grad` and build new ops + @{tf.Operation} `op` and a + @{tf.Tensor} `grad` and build new ops out of the tensors [`op.inputs[i]`](../../api_docs/python/framework.md#Operation.inputs), [`op.outputs[i]`](../../api_docs/python/framework.md#Operation.outputs), and `grad`. Information about any attrs can be found via - [`op.get_attr`](../../api_docs/python/framework.md#Operation.get_attr). + @{tf.Operation.get_attr}. * If the op has multiple outputs, the gradient function will take `op` and `grads`, where `grads` is a list of gradients with respect to each output. @@ -1091,14 +1130,17 @@ Details about registering gradient functions with `None`. For example, for an op taking a floating point tensor `x` and an integer index `i`, the gradient function would `return [x_grad, None]`. -* If there is no meaningful gradient for the op at all, use - `ops.NotDifferentiable("OpName")` to disable automatic differentiation. +* If there is no meaningful gradient for the op at all, you often will not have + to register any gradient, and as long as the op's gradient is never needed, + you will be fine. In some cases, an op has no well-defined gradient but can + be involved in the computation of the gradient. Here you can use + `ops.NotDifferentiable` to automatically propagate zeros backwards. Note that at the time the gradient function is called, only the data flow graph of ops is available, not the tensor data itself. Thus, all computation must be performed using other tensorflow ops, to be run at graph execution time. -## Shape functions in C++ +### Shape functions in C++ {#shape-functions} The TensorFlow API has a feature called "shape inference" that provides information about the shapes of tensors without having to execute the diff --git a/tensorflow/docs_src/extend/architecture.md b/tensorflow/docs_src/extend/architecture.md new file mode 100644 index 0000000000..085f74c056 --- /dev/null +++ b/tensorflow/docs_src/extend/architecture.md @@ -0,0 +1,218 @@ +# TensorFlow Architecture + +We designed TensorFlow for large-scale distributed training and inference, but +it is also flexible enough to support experimentation with new machine +learning models and system-level optimizations. + +This document describes the system architecture that makes possible this +combination of scale and flexibility. It assumes that you have basic familiarity +with TensorFlow programming concepts such as the computation graph, operations, +and sessions. See @{$get_started$Getting Started} +for an introduction to these topics. Some familiarity +with @{$distributed$distributed TensorFlow} +will also be helpful. + +This document is for developers who want to extend TensorFlow in some way not +supported by current APIs, hardware engineers who want to optimize for +TensorFlow, implementers of machine learning systems working on scaling and +distribution, or anyone who wants to look under Tensorflow's hood. After +reading it you should understand TensorFlow architecture well enough to read +and modify the core TensorFlow code. + +## Overview + +The TensorFlow runtime is a cross-platform library. Figure 1 illustrates its +general architecture. A C API separates user level code in different languages +from the core runtime. + +![TensorFlow Layers](../images/layers.png){: width="300"} + +**Figure 1** + + +This document focuses on the following layers: + +* **Client**: + * Defines the computation as a dataflow graph. + * Initiates graph execution using a [**session**]( + https://www.tensorflow.org/code/tensorflow/python/client/session.py) +* **Distributed Master** + * Prunes a specific subgraph from the graph, as defined by the arguments + to Session.run(). + * Partitions the subgraph into multiple pieces that run in different + processes and devices. + * Distributes the graph pieces to worker services. + * Initiates graph piece execution by worker services. +* **Worker Services** (one for each task) + * Schedule the execution of graph operations using kernel implementations + appropriate to the available hardware (CPUs, GPUs, etc). + * Send and receive operation results to and from other worker services. +* **Kernel Implementations** + * Perform the computation for individual graph operations. + +Figure 2 illustrates the interaction of these components. "/job:worker/task:0" and +"/job:ps/task:0" are both tasks with worker services. "PS" stands for "parameter +server": a task responsible for storing and updating the model's parameters. +Other tasks send updates to these parameters as they work on optimizing the +parameters. This particular division of labor between tasks is not required, but +it is common for distributed training. + +![TensorFlow Architecture Diagram](../images/diag1.svg){: width="500"} + +**Figure 2** + +Note that the Distributed Master and Worker Service only exist in +distributed TensorFlow. The single-process version of TensorFlow includes a +special Session implementation that does everything the distributed master does +but only communicates with devices in the local process. + +The following sections describe the core TensorFlow layers in greater detail and +step through the processing of an example graph. + +## Client + +Users write the client TensorFlow program that builds the computation graph. +This program can either directly compose individual operations or use a +convenience library like the Estimators API to compose neural network layers and +other higher-level abstractions. TensorFlow supports multiple client +languages, and we have prioritized Python and C++, because our internal users +are most familiar with these languages. As features become more established, +we typically port them to C++, so that users can access an optimized +implementation from all client languages. Most of the training libraries are +still Python-only, but C++ does have support for efficient inference. + +The client creates a session, which sends the graph definition to the +distributed master as a @{tf.GraphDef} +protocol buffer. When the client evaluates a node or nodes in the +graph, the evaluation triggers a call to the distributed master to initiate +computation. + +In Figure 3, the client has built a graph that applies weights (w) to a +feature vector (x), adds a bias term (b) and saves the result in a variable +(s). + +![TensorFlow Architecture Diagram: Client](../images/graph_client.svg){: width="700"} + +**Figure 3** + +### Code + +* @{tf.Session} + +## Distributed master + +The distributed master: + +* prunes the graph to obtain the subgraph required to evaluate the nodes + requested by the client, +* partitions the graph to obtain graph pieces for + each participating device, and +* caches these pieces so that they may be re-used in subsequent steps. + +Since the master sees the overall computation for +a step, it applies standard optimizations such as common subexpression +elimination and constant folding. It then coordinates execution of the +optimized subgraphs across a set of tasks. + +![TensorFlow Architecture Diagram: Master](../images/graph_master_cln.svg){: width="700"} + +**Figure 4** + + +Figure 5 shows a possible partition of our example graph. The distributed +master has grouped the model parameters in order to place them together on the +parameter server. + +![Partitioned Graph](../images/graph_split1.svg){: width="700"} + +**Figure 5** + + +Where graph edges are cut by the partition, the distributed master inserts +send and receive nodes to pass information between the distributed tasks +(Figure 6). + +![Partitioned Graph](../images/graph_split2.svg){: width="700"} + +**Figure 6** + + +The distributed master then ships the graph pieces to the distributed tasks. + +![Partitioned Graph](../images/graph_workers_cln.svg){: width="700"} + +**Figure 7** + +### Code + +* [MasterService API definition](https://www.tensorflow.org/code/tensorflow/core/protobuf/master_service.proto) +* [Master interface](https://www.tensorflow.org/code/tensorflow/core/distributed_runtime/master_interface.h) + +## Worker Service + +The worker service in each task: + +* handles requests from the master, +* schedules the execution of the kernels for the operations that comprise a + local subgraph, and +* mediates direct communication between tasks. + +We optimize the worker service for running large graphs with low overhead. Our +current implementation can execute tens of thousands of subgraphs per second, +which enables a large number of replicas to make rapid, fine-grained training +steps. The worker service dispatches kernels to local devices and runs kernels +in parallel when possible, for example by using multiple CPU cores or GPU +streams. + +We specialize Send and Recv operations for each pair of source and destination +device types: + +* Transfers between local CPU and GPU devices use the + `cudaMemcpyAsync()` API to overlap computation and data transfer. +* Transfers between two local GPUs use peer-to-peer DMA, to avoid an expensive + copy via the host CPU. + +For transfers between tasks, TensorFlow uses multiple protocols, including: + +* gRPC over TCP. +* RDMA over Converged Ethernet. + +We also have preliminary support for NVIDIA's NCCL library for multi-GPU +communication (see [`tf.contrib.nccl`]( +https://www.tensorflow.org/code/tensorflow/contrib/nccl/python/ops/nccl_ops.py)). + +![Partitioned Graph](../images/graph_send_recv.svg){: width="700"} + +**Figure 8** + +### Code + +* [WorkerService API definition](https://www.tensorflow.org/code/tensorflow/core/protobuf/worker_service.proto) +* [Worker interface](https://www.tensorflow.org/code/tensorflow/core/distributed_runtime/worker_interface.h) +* [Remote rendezvous (for Send and Recv implementations)](https://www.tensorflow.org/code/tensorflow/core/distributed_runtime/rpc/rpc_rendezvous_mgr.h) + +## Kernel Implementations + +The runtime contains over 200 standard operations, including mathematical, array +manipulation, control flow, and state management operations. Each of these +operations can have kernel implementations optimized for a variety of devices. +Many of the operation kernels are implemented using Eigen::Tensor, which uses +C++ templates to generate efficient parallel code for multicore CPUs and GPUs; +however, we liberally use libraries like cuDNN where a more efficient kernel +implementation is possible. We have also implemented +@{$quantization$quantization}, which enables +faster inference in environments such as mobile devices and high-throughput +datacenter applications, and use the +[gemmlowp](https://github.com/google/gemmlowp) low-precision matrix library to +accelerate quantized computation. + +If it is difficult or inefficient to represent a subcomputation as a composition +of operations, users can register additional kernels that provide an efficient +implementation written in C++. For example, we recommend registering your own +fused kernels for some performance critical operations, such as the ReLU and +Sigmoid activation functions and their corresponding gradients. The @{$xla$XLA Compiler} has an +experimental implementation of automatic kernel fusion. + +### Code + +* [`OpKernel` interface](https://www.tensorflow.org/code/tensorflow/core/framework/op_kernel.h) diff --git a/tensorflow/g3doc/tutorials/estimators/index.md b/tensorflow/docs_src/extend/estimators.md similarity index 89% rename from tensorflow/g3doc/tutorials/estimators/index.md rename to tensorflow/docs_src/extend/estimators.md index 01a2ed803c..1203ff2b5b 100644 --- a/tensorflow/g3doc/tutorials/estimators/index.md +++ b/tensorflow/docs_src/extend/estimators.md @@ -2,17 +2,17 @@ The tf.contrib.learn framework makes it easy to construct and train machine learning models via its high-level -[Estimator](../../api_docs/python/contrib.learn.md#estimators) API. `Estimator` +@{$python/contrib.learn#estimators$Estimator} API. `Estimator` offers classes you can instantiate to quickly configure common model types such as regressors and classifiers: -* [`LinearClassifier`](../../api_docs/python/contrib.learn.md#LinearClassifier): +* @{tf.contrib.learn.LinearClassifier}: Constructs a linear classification model. -* [`LinearRegressor`](../../api_docs/python/contrib.learn.md#LinearRegressor): +* @{tf.contrib.learn.LinearRegressor}: Constructs a linear regression model. -* [`DNNClassifier`](../../api_docs/python/contrib.learn.md#DNNClassifier): +* @{tf.contrib.learn.DNNClassifier}: Construct a neural network classification model. -* [`DNNRegressor`](../../api_docs/python/contrib.learn.md#DNNRegressor): +* @{tf.contrib.learn.DNNRegressor}: Construct a neural network regressions model. But what if none of `tf.contrib.learn`'s predefined model types meets your @@ -40,9 +40,9 @@ This tutorial assumes you already know tf.contrib.learn API basics, such as feature columns and `fit()` operations. If you've never used tf.contrib.learn before, or need a refresher, you should first review the following tutorials: -* [tf.contrib.learn Quickstart](../tflearn/index.md): Quick introduction to +* @{$tflearn$tf.contrib.learn Quickstart}: Quick introduction to training a neural network using tf.contrib.learn. -* [TensorFlow Linear Model Tutorial](../wide/index.md): Introduction to +* @{$wide$TensorFlow Linear Model Tutorial}: Introduction to feature columns, and an overview on building a linear classifier in tf.contrib.learn. @@ -55,8 +55,8 @@ viewing the shell under a microscope, it's desirable to find other measurements that can predict age. The [Abalone Data Set](https://archive.ics.uci.edu/ml/datasets/Abalone) contains -the following [feature -data](https://archive.ics.uci.edu/ml/machine-learning-databases/abalone/abalone.names) +the following +[feature data](https://archive.ics.uci.edu/ml/machine-learning-databases/abalone/abalone.names) for abalone: | Feature | Description | @@ -72,7 +72,7 @@ for abalone: The label to predict is number of rings, as a proxy for abalone age. -![Abalone shell](../../images/abalone_shell.jpg) **[“Abalone +![Abalone shell](../images/abalone_shell.jpg) **[“Abalone shell”](https://www.flickr.com/photos/thenickster/16641048623/) (by [Nicki Dugan Pogue](https://www.flickr.com/photos/thenickster/), CC BY-SA 2.0)** @@ -288,8 +288,7 @@ The `model_fn` must accept three arguments: * `targets`: A `Tensor` containing the labels passed to the model via `fit()`, `evaluate()`, or `predict()`. Will be empty for `predict()` calls, as these are the values the model will infer. -* `mode`: One of the following - [`ModeKeys`](../../api_docs/python/contrib.learn.md#ModeKeys) string values +* `mode`: One of the following @{tf.contrib.learn.ModeKeys} string values indicating the context in which the model_fn was invoked: * `tf.contrib.learn.ModeKeys.TRAIN` The `model_fn` was invoked in training mode—e.g., via a `fit()` call. @@ -311,8 +310,7 @@ sections that follow): * Defining the training operation that specifies the `optimizer` algorithm to minimize the loss values calculated by the loss function. -The `model_fn` must return a -[`ModelFnOps`](https://www.tensorflow.org/code/tensorflow/contrib/learn/python/learn/estimators/model_fn.py) +The `model_fn` must return a @{tf.contrib.learn.ModelFnOps} object, which contains the following values: * `mode` (required). The mode in which the model was run. Typically, you will @@ -330,9 +328,10 @@ object, which contains the following values: returned by `predict()`, so you can construct it in the format in which you'd like to consume it. - In `EVAL` mode, the dict is used by [metric - functions](../../api_docs/python/contrib.metrics.md#metric-ops) to compute - metrics. + In `EVAL` mode, the dict is used by + @{$python/contrib.metrics#Metric_Ops_$metric functions} + to compute metrics. + * `loss` (required in `EVAL` and `TRAIN` mode). A `Tensor` containing a scalar loss value: the output of the model's loss function (discussed in more depth @@ -346,8 +345,7 @@ object, which contains the following values: * `eval_metric_ops` (optional). A dict of name/value pairs specifying the metrics that will be calculated when the model runs in `EVAL` mode. The name is a label of your choice for the metric, and the value is the result of - your metric calculation. The - [`tf.metrics`](https://www.tensorflow.org/code/tensorflow/python/ops/metrics_impl.py) + your metric calculation. The @{tf.metrics} module provides predefined functions for a variety of common metrics. The following `eval_metric_ops` contains an `"accuracy"` metric calculated using `tf.metrics.accuracy`: @@ -373,11 +371,10 @@ will accept the feature data that is passed to the `model_fn` in the `features` argument. If `features` contains an n-dimenional `Tensor` with all your feature data (which is the case if `x` and `y` `Dataset`s are passed to `fit()`, `evaluate()`, and `predict()` directly), then it can serve as the input layer. -If `features` contains a dict of [feature -columns](../linear/overview.md#feature-columns-and-transformations) passed to +If `features` contains a dict of @{$linear#feature-columns-and-transformations$feature columns} passed to the model via an input function, you can convert it to an input-layer `Tensor` -with the `input_from_feature_columns()` function in -[tf.contrib.layers](../../api_docs/python/contrib.layers.md#layers-contrib). +with the @{tf.contrib.layers.input_from_feature_columns} function in +@{tf.contrib.layers}. ```python input_layer = tf.contrib.layers.input_from_feature_columns( @@ -403,7 +400,7 @@ fully connected layers: * `relu(inputs, num_outputs)`. Create a layer of `num_outputs` nodes fully connected to the previous layer `inputs` with a [ReLU activation function](https://en.wikipedia.org/wiki/Rectifier_\(neural_networks\)) - ([tf.nn.relu](../../api_docs/python/nn.md#relu)): + (@{tf.nn.relu}): ```python hidden_layer = tf.contrib.layers.relu(inputs=input_layer, num_outputs=10) @@ -411,7 +408,7 @@ fully connected layers: * `relu6(inputs, num_outputs)`. Create a layer of `num_outputs` nodes fully connected to the previous layer `hidden_layer` with a ReLU 6 activation - function ([tf.nn.relu6](../../api_docs/python/nn.md#relu6)): + function (@{tf.nn.relu6}): ```python second_hidden_layer = tf.contrib.layers.relu6(inputs=hidden_layer, num_outputs=20) @@ -427,8 +424,7 @@ fully connected layers: All these functions are [partials](https://docs.python.org/2/library/functools.html#functools.partial) -of the more general -[`fully_connected()`](../../api_docs/python/contrib.layers.md#fully_connected) +of the more general @{tf.contrib.layers.fully_connected} function, which can be used to add fully connected layers with other activation functions, e.g.: @@ -440,9 +436,8 @@ output_layer = tf.contrib.layers.fully_connected(inputs=second_hidden_layer, The above code creates the neural network layer `output_layer`, which is fully connected to `second_hidden_layer` with a sigmoid activation function -([`tf.sigmoid`](../../api_docs/python/nn.md#sigmoid)). For a list of predefined -activation functions available in TensorFlow, see the [API -docs](../../api_docs/python/nn.md#activation-functions). +(@{tf.sigmoid}). For a list of predefined +activation functions available in TensorFlow, see the @{$python/nn#activation_functions$API docs}. Putting it all together, the following code constructs a full neural network for the abalone predictor, and captures its predictions: @@ -472,7 +467,7 @@ Here, because you'll be passing the abalone `Datasets` directly to `fit()`, `features` `Tensor` passed to the `model_fn`. The network contains two hidden layers, each with 10 nodes and a ReLU activation function. The output layer contains no activation function, and is -[reshaped](../../api_docs/python/array_ops.md#reshape) to a one-dimensional +@{tf.reshape} to a one-dimensional tensor to capture the model's predictions, which are stored in `predictions_dict`. @@ -480,8 +475,7 @@ tensor to capture the model's predictions, which are stored in The `ModelFnOps` returned by the `model_fn` must contain `loss`: a `Tensor` representing the loss value, which quantifies how well the model's predictions -reflect the target values during training and evaluation runs. The -[`tf.losses`](https://www.tensorflow.org/code/tensorflow/python/ops/losses/losses.py) +reflect the target values during training and evaluation runs. The @{tf.losses} module provides convenience functions for calculating loss using a variety of metrics, including: @@ -522,7 +516,7 @@ using `mean_squared_error()` (in bold): loss = tf.losses.mean_squared_error(targets, predictions) ...
-See the [API docs](../../api_docs/python/contrib.losses.md#losses-contrib) for a +See the @{$python/contrib.losses$API guide} for a full list of loss functions and more details on supported arguments and usage. Supplementary metrics for evaluation can be added to an `eval_metric_ops` dict. @@ -549,10 +543,10 @@ required arguments: * `loss`. The loss value calculated by the `model_fn` (see [Defining Loss for the Model](#defining-loss)). * `global_step`. An integer - [`Variable`](../../api_docs/python/state_ops.md#Variable) representing the + @{tf.Variable} representing the step counter to increment for each model training run. Can easily be created/incremented in TensorFlow via the - [`get_global_step()`](../../api_docs/python/contrib.framework.md#get_global_step) + @{tf.train.get_global_step} function. * `learning_rate`. The [learning rate](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Background) @@ -563,34 +557,34 @@ required arguments: algorithm predefined in `tf.contrib.layers.optimizers`: * `SGD`. Implementation of [gradient descent](https://en.wikipedia.org/wiki/Gradient_descent) - ([tf.train.GradientDescentOptimizer](../../api_docs/python/train.md#GradientDescentOptimizer)) + (@{tf.train.GradientDescentOptimizer}) * `Adagrad`. Implementation of the [AdaGrad optimization algorithm](http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf) - ([tf.train.AdagradOptimizer](../../api_docs/python/train.md#AdagradOptimizer)) + (@{tf.train.AdagradOptimizer}) * `Adam`. Implementation of the [Adam optimization algorithm](http://arxiv.org/pdf/1412.6980.pdf) - ([tf.train.AdamOptimizer](../../api_docs/python/train.md#AdamOptimizer)) + (@{tf.train.AdamOptimizer}) * `Ftrl`. Implementation of the [FTRL-Proximal](https://www.eecs.tufts.edu/~dsculley/papers/ad-click-prediction.pdf) ("Follow The (Proximally) Regularized Leader") algorithm - ([tf.train.FtrlOptimizer](../../api_docs/python/train.md#FtrlOptimizer)) + (@{tf.train.FtrlOptimizer}) * `Momentum`. Implementation of stochastic gradient descent with [momentum](https://en.wikipedia.org/wiki/Stochastic_gradient_descent#Momentum) - ([tf.train.MomentumOptimizer](../../api_docs/python/train.md#MomentumOptimizer)) + (@{tf.train.MomentumOptimizer}) * `RMSProp`. Implementation of the [RMSprop](http://sebastianruder.com/optimizing-gradient-descent/index.html#rmsprop) algorithm - ([tf.train.RMSPropOptimizer](../../api_docs/python/train.md#RMSPropOptimizer)) + (@{tf.train.RMSPropOptimizer}) NOTE: The `optimize_loss` function supports additional optional arguments to -further configure the optimizer, such as for implementing decay. See the [API -docs](../../api_docs/python/contrib.layers.md#optimize_loss) for more info. +further configure the optimizer, such as for implementing decay. See the +@{tf.contrib.layers.optimize_loss$API docs} for more info. The following code defines a training op for the abalone `model_fn` using the loss value calculated in [Defining Loss for the Model](#defining-loss), the learning rate passed to the function in `params`, and the SGD optimizer. For `global_step`, the convenience function -[`get_global_step()`](../../api_docs/python/contrib.framework.md#get_global_step) +@{tf.train.get_global_step} in tf.contrib.framework takes care of generating an integer variable: ```python @@ -713,9 +707,9 @@ Prediction 7: 11.1289 Congrats! You've successfully built a tf.contrib.learn `Estimator` from scratch. For additional reference materials on building `Estimator`s, see the following -sections of the API docs: +sections of the API guides: -* [Estimators](../../api_docs/python/contrib.learn.md#estimators) -* [Layers](../../api_docs/python/contrib.layers.md#layers-contrib) -* [Losses](../../api_docs/python/contrib.losses.md#losses-contrib) -* [Optimization](../../api_docs/python/contrib.layers.md#optimization) +* @{$python/contrib.learn#Estimators$Estimators} +* @{$python/contrib.layers$Layers} +* @{$python/contrib.losses$Losses} +* @{$python/contrib.layers#optimization$Optimization} diff --git a/tensorflow/g3doc/how_tos/language_bindings/index.md b/tensorflow/docs_src/extend/language_bindings.md similarity index 99% rename from tensorflow/g3doc/how_tos/language_bindings/index.md rename to tensorflow/docs_src/extend/language_bindings.md index 89d7d25162..84e0b03086 100644 --- a/tensorflow/g3doc/how_tos/language_bindings/index.md +++ b/tensorflow/docs_src/extend/language_bindings.md @@ -125,8 +125,7 @@ The `OpDef` specifies the following: instead of CamelCase for the op's function name. - A list of inputs and outputs. The types for these may be polymorphic by referencing attributes, as described in the inputs and outputs section of - [Adding an - op](https://tensorflow.org/how_tos/adding_an_op/index.html). + @{$adding_an_op$Adding an op}. - A list of attributes, along with their default values (if any). Note that some of these will be inferred (if they are determined by an input), some will be optional (if they have a default), and some will be required (no diff --git a/tensorflow/docs_src/extend/leftnav_files b/tensorflow/docs_src/extend/leftnav_files new file mode 100644 index 0000000000..5e0db5007c --- /dev/null +++ b/tensorflow/docs_src/extend/leftnav_files @@ -0,0 +1,7 @@ +architecture.md +adding_an_op.md +add_filesys.md +language_bindings.md +new_data_formats.md +estimators.md +tool_developers/index.md diff --git a/tensorflow/g3doc/how_tos/new_data_formats/index.md b/tensorflow/docs_src/extend/new_data_formats.md similarity index 81% rename from tensorflow/g3doc/how_tos/new_data_formats/index.md rename to tensorflow/docs_src/extend/new_data_formats.md index 254e1b39b7..b3cc968047 100644 --- a/tensorflow/g3doc/how_tos/new_data_formats/index.md +++ b/tensorflow/docs_src/extend/new_data_formats.md @@ -4,7 +4,7 @@ PREREQUISITES: * Some familiarity with C++. * Must have - [downloaded TensorFlow source](../../get_started/os_setup.md#installing-from-sources), and be + @{$install_sources$downloaded TensorFlow source}, and be able to build it. We divide the task of supporting a file format into two pieces: @@ -16,9 +16,9 @@ We divide the task of supporting a file format into two pieces: For example, to read a [CSV file](https://en.wikipedia.org/wiki/Comma-separated_values), we use -[a Reader for text files](../../api_docs/python/io_ops.md#TextLineReader) +@{tf.TextLineReader$a Reader for text files} followed by -[an Op that parses CSV data from a line of text](../../api_docs/python/io_ops.md#decode_csv). +@{tf.decode_csv$an Op that parses CSV data from a line of text}. [TOC] @@ -27,11 +27,11 @@ followed by A `Reader` is something that reads records from a file. There are some examples of Reader Ops already built into TensorFlow: -* [`tf.TFRecordReader`](../../api_docs/python/io_ops.md#TFRecordReader) +* @{tf.TFRecordReader} ([source in `kernels/tf_record_reader_op.cc`](https://www.tensorflow.org/code/tensorflow/core/kernels/tf_record_reader_op.cc)) -* [`tf.FixedLengthRecordReader`](../../api_docs/python/io_ops.md#FixedLengthRecordReader) +* @{tf.FixedLengthRecordReader} ([source in `kernels/fixed_length_record_reader_op.cc`](https://www.tensorflow.org/code/tensorflow/core/kernels/fixed_length_record_reader_op.cc)) -* [`tf.TextLineReader`](../../api_docs/python/io_ops.md#TextLineReader) +* @{tf.TextLineReader} ([source in `kernels/text_line_reader_op.cc`](https://www.tensorflow.org/code/tensorflow/core/kernels/text_line_reader_op.cc)) You can see these all expose the same interface, the only differences @@ -44,15 +44,15 @@ two scalar tensors: a string key and a string value. To create a new reader called `SomeReader`, you will need to: 1. In C++, define a subclass of - [`tensorflow::ReaderBase`](https://www.tensorflow.org/code/tensorflow/core/kernels/reader_base.h) + [`tensorflow::ReaderBase`](https://www.tensorflow.org/code/tensorflow/core/framework/reader_base.h) called `SomeReader`. 2. In C++, register a new reader op and kernel with the name `"SomeReader"`. -3. In Python, define a subclass of [`tf.ReaderBase`](https://www.tensorflow.org/code/tensorflow/python/ops/io_ops.py) called `SomeReader`. +3. In Python, define a subclass of @{tf.ReaderBase} called `SomeReader`. You can put all the C++ code in a file in -`tensorflow/core/user_ops/some_reader_op.cc`. The code to read a file will live +`tensorflow/core/user_ops/some_reader_op.cc`. The code to read a file will live in a descendant of the C++ `ReaderBase` class, which is defined in -[`tensorflow/core/kernels/reader_base.h`](https://www.tensorflow.org/code/tensorflow/core/kernels/reader_base.h). +[`tensorflow/core/kernels/reader_base.h`](https://www.tensorflow.org/code/tensorflow/core/framework/reader_base.h). You will need to implement the following methods: * `OnWorkStartedLocked`: open the next file @@ -87,7 +87,7 @@ helper functions from without modifying any arguments. Next you will create the actual Reader op. It will help if you are familiar -with [the adding an op how-to](../../how_tos/adding_an_op/index.md). The main steps +with @{$adding_an_op$the adding an op how-to}. The main steps are: * Registering the op. @@ -167,8 +167,7 @@ REGISTER_KERNEL_BUILDER(Name("TextLineReader").Device(DEVICE_CPU), ``` The last step is to add the Python wrapper. You can either do this by -[compiling a dynamic -library](../../how_tos/adding_an_op/#building_the_op_library) +@{$adding_an_op#building_the_op_library$compiling a dynamic library} or, if you are building TensorFlow from source, adding to `user_ops.py`. For the latter, you will import `tensorflow.python.ops.io_ops` in [`tensorflow/python/user_ops/user_ops.py`](https://www.tensorflow.org/code/tensorflow/python/user_ops/user_ops.py) @@ -195,28 +194,28 @@ You can see some examples in ## Writing an Op for a record format Generally this is an ordinary op that takes a scalar string record as input, and -so follow [the instructions to add an Op](../../how_tos/adding_an_op/index.md). +so follow @{$adding_an_op$the instructions to add an Op}. You may optionally take a scalar string key as input, and include that in error messages reporting improperly formatted data. That way users can more easily track down where the bad data came from. Examples of Ops useful for decoding records: -* [`tf.parse_single_example`](../../api_docs/python/io_ops.md#parse_single_example) +* @{tf.parse_single_example} (and - [`tf.parse_example`](../../api_docs/python/io_ops.md#parse_example)) -* [`tf.decode_csv`](../../api_docs/python/io_ops.md#decode_csv) -* [`tf.decode_raw`](../../api_docs/python/io_ops.md#decode_raw) + @{tf.parse_example}) +* @{tf.decode_csv} +* @{tf.decode_raw} Note that it can be useful to use multiple Ops to decode a particular record format. For example, you may have an image saved as a string in [a `tf.train.Example` protocol buffer](https://www.tensorflow.org/code/tensorflow/core/example/example.proto). Depending on the format of that image, you might take the corresponding output from a -[`tf.parse_single_example`](../../api_docs/python/io_ops.md#parse_single_example) -op and call [`tf.image.decode_jpeg`](../../api_docs/python/image.md#decode_jpeg), -[`tf.image.decode_png`](../../api_docs/python/image.md#decode_png), or -[`tf.decode_raw`](../../api_docs/python/io_ops.md#decode_raw). It is common to +@{tf.parse_single_example} +op and call @{tf.image.decode_jpeg}, +@{tf.image.decode_png}, or +@{tf.decode_raw}. It is common to take the output of `tf.decode_raw` and use -[`tf.slice`](../../api_docs/python/array_ops.md#slice) and -[`tf.reshape`](../../api_docs/python/array_ops.md#reshape) to extract pieces. +@{tf.slice} and +@{tf.reshape} to extract pieces. diff --git a/tensorflow/g3doc/how_tos/tool_developers/index.md b/tensorflow/docs_src/extend/tool_developers/index.md similarity index 100% rename from tensorflow/g3doc/how_tos/tool_developers/index.md rename to tensorflow/docs_src/extend/tool_developers/index.md diff --git a/tensorflow/g3doc/extras/README.txt b/tensorflow/docs_src/extras/README.txt similarity index 100% rename from tensorflow/g3doc/extras/README.txt rename to tensorflow/docs_src/extras/README.txt diff --git a/tensorflow/g3doc/how_tos/embedding_viz/index.md b/tensorflow/docs_src/get_started/embedding_viz.md similarity index 93% rename from tensorflow/g3doc/how_tos/embedding_viz/index.md rename to tensorflow/docs_src/get_started/embedding_viz.md index 1b54276d5c..6404249703 100644 --- a/tensorflow/g3doc/how_tos/embedding_viz/index.md +++ b/tensorflow/docs_src/get_started/embedding_viz.md @@ -12,7 +12,7 @@ checkpoint file. Although it's most useful for embeddings, it will load any 2D tensor, including your training weights. To learn more about embeddings and how to train them, see the -[Vector Representations of Words](../../tutorials/word2vec/index.md) tutorial. +@{$word2vec$Vector Representations of Words} tutorial. If you are interested in embeddings of images, check out [this article](http://colah.github.io/posts/2014-10-Visualizing-MNIST/) for interesting visualizations of MNIST images. On the other hand, if you are @@ -21,7 +21,7 @@ interested in word embeddings, gives a good introduction. @@ -46,7 +46,7 @@ in the same directory as your checkpoint file. For in depth information on how to run TensorBoard and make sure you are logging all the necessary information, -see [TensorBoard: Visualizing Learning](../../how_tos/summaries_and_tensorboard/index.md). +see @{$summaries_and_tensorboard$TensorBoard: Visualizing Learning}. To visualize your embeddings, there are 3 things you need to do: @@ -101,7 +101,7 @@ embedding.tensor_name = embedding_var.name embedding.metadata_path = os.path.join(LOG_DIR, 'metadata.tsv') # Use the same LOG_DIR where you stored your checkpoint. -summary_writer = tf.train.SummaryWriter(LOG_DIR) +summary_writer = tf.summary.FileWriter(LOG_DIR) # The next line writes a projector_config.pbtxt in the LOG_DIR. TensorBoard will # read this file during startup. @@ -173,7 +173,7 @@ last data point in the bottom right: Note in the example above that the last row doesn't have to be filled. For a concrete example of a sprite, see -[this sprite image](../../images/mnist_10k_sprite.png) of 10,000 MNIST digits +[this sprite image](../images/mnist_10k_sprite.png) of 10,000 MNIST digits (100x100). Note: We currently support sprites up to 8192px X 8192px. @@ -247,7 +247,7 @@ further analysis on their own with the "Isolate Points" button in the Inspector pane on the right hand side. -![Selection of nearest neighbors](../../images/embedding-nearest-points.png "Selection of nearest neighbors") +![Selection of nearest neighbors](../images/embedding-nearest-points.png "Selection of nearest neighbors") *Selection of the nearest neighbors of “important” in a word embedding dataset.* The combination of filtering with custom projection can be powerful. Below, we filtered @@ -260,10 +260,10 @@ You can see that on the right side we have “ideas”, “science”, “perspe
@@ -284,4 +284,4 @@ projection) as a small file. The Projector can then be pointed to a set of one or more of these files, producing the panel below. Other users can then walk through a sequence of bookmarks. -Bookmark panel +Bookmark panel diff --git a/tensorflow/docs_src/get_started/get_started.md b/tensorflow/docs_src/get_started/get_started.md new file mode 100644 index 0000000000..ae0007359d --- /dev/null +++ b/tensorflow/docs_src/get_started/get_started.md @@ -0,0 +1,447 @@ + +# Getting Started With TensorFlow + +This guide gets you started programming in TensorFlow. Before using this guide, +@{$install$install TensorFlow}. To get the most out of +this guide, you should know the following: + +* How to program in Python. +* At least a little bit about arrays. +* Ideally, something about machine learning. However, if you know little or + nothing about machine learning, then this is still the first guide you + should read. + +TensorFlow provides multiple APIs. The lowest level API--TensorFlow Core-- +provides you with complete programming control. We recommend TensorFlow Core for +machine learning researchers and others who require fine levels of control over +their models. The higher level APIs are built on top of TensorFlow Core. These +higher level APIs are typically easier to learn and use than TensorFlow Core. In +addition, the higher level APIs make repetitive tasks easier and more consistent +between different users. A high-level API like tf.contrib.learn helps you manage +data sets, estimators, training and inference. Note that a few of the high-level +TensorFlow APIs--those whose method names contain `contrib`-- are still in +development. It is possible that some `contrib` methods will change or become +obsolete in subsequent TensorFlow releases. + +This guide begins with a tutorial on TensorFlow Core. Later, we +demonstrate how to implement the same model in tf.contrib.learn. Knowing +TensorFlow Core principles will give you a great mental model of how things are +working internally when you use the more compact higher level API. + +# Tensors + +The central unit of data in TensorFlow is the **tensor**. A tensor consists of a +set of primitive values shaped into an array of any number of dimensions. A +tensor's **rank** is its number of dimensions. Here are some examples of +tensors: + +```python +3 # a rank 0 tensor; this is a scalar with shape [] +[1. ,2., 3.] # a rank 1 tensor; this is a vector with shape [3] +[[1., 2., 3.], [4., 5., 6.]] # a rank 2 tensor; a matrix with shape [2, 3] +[[[1., 2., 3.]], [[7., 8., 9.]]] # a rank 3 tensor with shape [2, 1, 3] +``` + +## TensorFlow Core tutorial + +### Importing TensorFlow + +The canonical import statement for TensorFlow programs is as follows: + +```python +import tensorflow as tf + +``` +This gives Python access to all of TensorFlow's classes, methods, and symbols. +Most of the documentation assumes you have already done this. + +### The Computational Graph + +You might think of TensorFlow Core programs as consisting of two discrete +sections: + +1. Building the computational graph. +2. Running the computational graph. + +A **computational graph** is a series of TensorFlow operations arranged into a +graph of nodes. +Let's build a simple computational graph. Each node takes zero +or more tensors as inputs and produces a tensor as an output. One type of node +is a constant. Like all TensorFlow constants, it takes no inputs, and it outputs +a value it stores internally. We can create two floating point Tensors `node1` +and `node2` as follows: +```python +node1 = tf.constant(3.0, tf.float32) +node2 = tf.constant(4.0) # also tf.float32 implicitly +print(node1, node2) +``` +The final print statement produces +``` +Tensor("Const:0", shape=(), dtype=float32) Tensor("Const_1:0", shape=(), dtype=float32) +``` + +Notice that printing the nodes does not output the values `3.0` and `4.0` as you +might expect. Instead, they are nodes that, when evaluated, would produce 3.0 +and 4.0, respectively. To actually evaluate the nodes, we must run the +computational graph within a **session**. A session encapsulates the control and +state of the TensorFlow runtime. + +The following code creates a `Session` object and then invokes its `run` method +to run enough of the computational graph to evaluate `node1` and `node2`. By +running the computational graph in a session as follows: + +```python +sess = tf.Session() +print(sess.run([node1, node2])) +``` +we see the expected values of 3.0 and 4.0: +``` +[3.0, 4.0] +``` + +We can build more complicated computations by combining `Tensor` nodes with +operations (Operations are also nodes.). For example, we can add our two +constant nodes and produce a new graph as follows: + +```python +node3 = tf.add(node1, node2) +print("node3: ", node3) +print("sess.run(node3): ",sess.run(node3)) +``` +The last two print statements produce +``` +node3: Tensor("Add_2:0", shape=(), dtype=float32) +sess.run(node3): 7.0 +``` + +TensorFlow provides a utility called TensorBoard that can display a picture of +the computational graph. Here is a screenshot showing how TensorBoard +visualizes the graph: + +![TensorBoard screenshot](../images/getting_started_add.png) + +As it stands, this graph is not especially interesting because it always +produces a constant result. A graph can be parameterized to accept external +inputs, known as **placeholders**. A **placeholder** is a promise to provide a +value later. + +```python +a = tf.placeholder(tf.float32) +b = tf.placeholder(tf.float32) +adder_node = a + b # + provides a shortcut for tf.add(a, b) +``` + +The preceding three lines are a bit like a function or a lambda in which we +define two input parameters (a and b) and then an operation on them. We can +evaluate this graph with multiple inputs by using the feed_dict parameter to +specify Tensors that provide concrete values to these placeholders: + +```python +print(sess.run(adder_node, {a: 3, b:4.5})) +print(sess.run(adder_node, {a: [1,3], b: [2, 4]})) +``` +resulting in the output +``` +7.5 +[ 3. 7.] +``` +In TensorBoard, the graph looks like this: + +![TensorBoard screenshot](../images/getting_started_adder.png) + +We can make the computational graph more complex by adding another operation. +For example, + +```python +add_and_triple = adder_node * 3. +print(sess.run(add_and_triple, {a: 3, b:4.5})) +``` +produces the output +``` +22.5 +``` + +The preceding computational graph would look as follows in TensorBoard: + +![TensorBoard screenshot](../images/getting_started_triple.png) + +In machine learning we will typically want a model that can take arbitrary +inputs, such as the one above. To make the model trainable, we need to be able +to modify the graph to get new outputs with the same input. **Variables** allow +us to add trainable parameters to a graph. They are constructed with a type and +initial value: + + +```python +W = tf.Variable([.3], tf.float32) +b = tf.Variable([-.3], tf.float32) +x = tf.placeholder(tf.float32) +linear_model = W * x + b +``` + +Constants are initialized when you call `tf.constant`, and their value can never +change. By contrast, variables are not initialized when you call `tf.Variable`. +To initialize all the variables in a TensorFlow program, you must explicitly +call a special operation as follows: + +```python +init = tf.global_variables_initializer() +sess.run(init) +``` +It is important to realize `init` is a handle to the TensorFlow sub-graph that +initializes all the global variables. Until we call `sess.run`, the variables +are uninitialized. + + +Since `x` is a placeholder, we can evaluate `linear_model` for several values of +`x` simultaneously as follows: + +```python +print(sess.run(linear_model, {x:[1,2,3,4]})) +``` +to produce the output +``` +[ 0. 0.30000001 0.60000002 0.90000004] +``` + +We've created a model, but we don't know how good it is yet. To evaluate the +model on training data, we need a `y` placeholder to provide the desired values, +and we need to write a loss function. + +A loss function measures how far apart the +current model is from the provided data. We'll use a standard loss model for +linear regression, which sums the squares of the deltas between the current +model and the provided data. `linear_model - y` creates a vector where each +element is the corresponding example's error delta. We call `tf.square` to +square that error. Then, we sum all the squared errors to create a single scalar +that abstracts the error of all examples using `tf.reduce_sum`: + +```python +y = tf.placeholder(tf.float32) +squared_deltas = tf.square(linear_model - y) +loss = tf.reduce_sum(squared_deltas) +print(sess.run(loss, {x:[1,2,3,4], y:[0,-1,-2,-3]})) +``` +producing the loss value +``` +23.66 +``` + +We could improve this manually by reassigning the values of `W` and `b` to the +perfect values of -1 and 1. A variable is initialized to the value provided to +`tf.Variable` but can be changed using operations like `tf.assign`. For example, +`W=-1` and `b=1` are the optimal parameters for our model. We can change `W` and +`b` accordingly: + +```python +fixW = tf.assign(W, [-1.]) +fixb = tf.assign(b, [1.]) +sess.run([fixW, fixb]) +print(sess.run(loss, {x:[1,2,3,4], y:[0,-1,-2,-3]})) +``` +The final print shows the loss now is zero. +``` +0.0 +``` + +We guessed the "perfect" values of `W` and `b`, but the whole point of machine +learning is to find the correct model parameters automatically. We will show +how to accomplish this in the next section. + +## tf.train API + +A complete discussion of machine learning is out of the scope of this tutorial. +However, TensorFlow provides **optimizers** that slowly change each variable in +order to minimize the loss function. The simplest optimizer is **gradient +descent**. It modifies each variable according to the magnitude of the +derivative of loss with respect to that variable. In general, computing symbolic +derivatives manually is tedious and error-prone. Consequently, TensorFlow can +automatically produce derivatives given only a description of the model using +the function `tf.gradients`. For simplicity, optimizers typically do this +for you. For example, + +```python +optimizer = tf.train.GradientDescentOptimizer(0.01) +train = optimizer.minimize(loss) +``` + +```python +sess.run(init) # reset values to incorrect defaults. +for i in range(1000): + sess.run(train, {x:[1,2,3,4], y:[0,-1,-2,-3]}) + +print(sess.run([W, b])) +``` +results in the final model parameters: +``` +[array([-0.9999969], dtype=float32), array([ 0.99999082], + dtype=float32)] +``` + +Now we have done actual machine learning! Although doing this simple linear +regression doesn't require much TensorFlow core code, more complicated models +and methods to feed data into your model necessitate more code. Thus TensorFlow +provides higher level abstractions for common patterns, structures, and +functionality. We will learn how to use some of these abstractions in the +next section. + +### Complete program + +The completed trainable linear regression model is shown here: + +```python +import numpy as np +import tensorflow as tf + +# Model parameters +W = tf.Variable([.3], tf.float32) +b = tf.Variable([-.3], tf.float32) +# Model input and output +x = tf.placeholder(tf.float32) +linear_model = W * x + b +y = tf.placeholder(tf.float32) +# loss +loss = tf.reduce_sum(tf.square(linear_model - y)) # sum of the squares +# optimizer +optimizer = tf.train.GradientDescentOptimizer(0.01) +train = optimizer.minimize(loss) +# training data +x_train = [1,2,3,4] +y_train = [0,-1,-2,-3] +# training loop +init = tf.global_variables_initializer() +sess = tf.Session() +sess.run(init) # reset values to wrong +for i in range(1000): + sess.run(train, {x:x_train, y:y_train}) + +# evaluate training accuracy +curr_W, curr_b, curr_loss = sess.run([W, b, loss], {x:x_train, y:y_train}) +print("W: %s b: %s loss: %s"%(curr_W, curr_b, curr_loss)) +``` +When run, it produces +``` +W: [-0.9999969] b: [ 0.99999082] loss: 5.69997e-11 +``` + +This more complicated program can still be visualized in TensorBoard +![TensorBoard final model visualization](../images/getting_started_final.png) + +## `tf.contrib.learn` + +`tf.contrib.learn` is a high-level TensorFlow library that simplifies the +mechanics of machine learning, including the following: + +* running training loops +* running evaluation loops +* managing data sets +* managing feeding + +tf.contrib.learn defines many common models. + +### Basic usage + +Notice how much simpler the linear regression program becomes with +`tf.contrib.learn`: + +```python +import tensorflow as tf +# NumPy is often used to load, manipulate and preprocess data. +import numpy as np + +# Declare list of features. We only have one real-valued feature. There are many +# other types of columns that are more complicated and useful. +features = [tf.contrib.layers.real_valued_column("x", dimension=1)] + +# An estimator is the front end to invoke training (fitting) and evaluation +# (inference). There are many predefined types like linear regression, +# logistic regression, linear classification, logistic classification, and +# many neural network classifiers and regressors. The following code +# provides an estimator that does linear regression. +estimator = tf.contrib.learn.LinearRegressor(feature_columns=features) + +# TensorFlow provides many helper methods to read and set up data sets. +# Here we use `numpy_input_fn`. We have to tell the function how many batches +# of data (num_epochs) we want and how big each batch should be. +x = np.array([1., 2., 3., 4.]) +y = np.array([0., -1., -2., -3.]) +input_fn = tf.contrib.learn.io.numpy_input_fn({"x":x}, y, batch_size=4, + num_epochs=1000) + +# We can invoke 1000 training steps by invoking the `fit` method and passing the +# training data set. +estimator.fit(input_fn=input_fn, steps=1000) + +# Here we evaluate how well our model did. In a real example, we would want +# to use a separate validation and testing data set to avoid overfitting. +estimator.evaluate(input_fn=input_fn) +``` +When run, it produces +``` + {'global_step': 1000, 'loss': 1.9650059e-11} +``` + +### A custom model + +`tf.contrib.learn` does not lock you into its predefined models. Suppose we +wanted to create a custom model that is not built into TensorFlow. We can still +retain the high level abstraction of data set, feeding, training, etc. of +`tf.contrib.learn`. For illustration, we will show how to implement our own +equivalent model to `LinearRegressor` using our knowledge of the lower level +TensorFlow API. + +To define a custom model that works with `tf.contrib.learn`, we need to use +`tf.contrib.learn.Estimator`. `tf.contrib.learn.LinearRegressor` is actually +a sub-class of `tf.contrib.learn.Estimator`. Instead of sub-classing +`Estimator`, we simply provide `Estimator` a function `model_fn` that tells +`tf.contrib.learn` how it can evaluate predictions, training steps, and +loss. The code is as follows: + +```python +import numpy as np +import tensorflow as tf +# Declare list of features, we only have one real-valued feature +def model(features, labels, mode): + # Build a linear model and predict values + W = tf.get_variable("W", [1], dtype=tf.float64) + b = tf.get_variable("b", [1], dtype=tf.float64) + y = W*features['x'] + b + # Loss sub-graph + loss = tf.reduce_sum(tf.square(y - labels)) + # Training sub-graph + global_step = tf.train.get_global_step() + optimizer = tf.train.GradientDescentOptimizer(0.01) + train = tf.group(optimizer.minimize(loss), + tf.assign_add(global_step, 1)) + # ModelFnOps connects subgraphs we built to the + # appropriate functionality. + return tf.contrib.learn.ModelFnOps( + mode=mode, predictions=y, + loss=loss, + train_op=train) + +estimator = tf.contrib.learn.Estimator(model_fn=model) +# define our data set +x = np.array([1., 2., 3., 4.]) +y = np.array([0., -1., -2., -3.]) +input_fn = tf.contrib.learn.io.numpy_input_fn({"x": x}, y, 4, num_epochs=1000) + +# train +estimator.fit(input_fn=input_fn, steps=1000) +# evaluate our model +print(estimator.evaluate(input_fn=input_fn, steps=10)) +``` +When run, it produces +```python +{'loss': 5.9819476e-11, 'global_step': 1000} +``` + +Notice how the contents of the custom `model()` function are very similar +to our manual model training loop from the lower level API. + +## Next steps + +Now you have a working knowledge of the basics of TensorFlow. We have several +more tutorials that you can look at to learn more. If you are a beginner in +machine learning see @{$beginners$MNIST for beginners}, +otherwise see @{$pros$Deep MNIST for experts}. diff --git a/tensorflow/g3doc/how_tos/graph_viz/index.md b/tensorflow/docs_src/get_started/graph_viz.md similarity index 78% rename from tensorflow/g3doc/how_tos/graph_viz/index.md rename to tensorflow/docs_src/get_started/graph_viz.md index 70f836d7ab..b69103299e 100644 --- a/tensorflow/g3doc/how_tos/graph_viz/index.md +++ b/tensorflow/docs_src/get_started/graph_viz.md @@ -2,10 +2,10 @@ TensorFlow computation graphs are powerful but complicated. The graph visualization can help you understand and debug them. Here's an example of the visualization at work. -![Visualization of a TensorFlow graph](../../images/graph_vis_animation.gif "Visualization of a TensorFlow graph") +![Visualization of a TensorFlow graph](../images/graph_vis_animation.gif "Visualization of a TensorFlow graph") *Visualization of a TensorFlow graph.* -To see your own graph, run TensorBoard pointing it to the log directory of the job, click on the graph tab on the top pane and select the appropriate run using the menu at the upper left corner. For in depth information on how to run TensorBoard and make sure you are logging all the necessary information, see [TensorBoard: Visualizing Learning](../../how_tos/summaries_and_tensorboard/index.md). +To see your own graph, run TensorBoard pointing it to the log directory of the job, click on the graph tab on the top pane and select the appropriate run using the menu at the upper left corner. For in depth information on how to run TensorBoard and make sure you are logging all the necessary information, see @{$summaries_and_tensorboard$TensorBoard: Visualizing Learning}. ## Name scoping and nodes @@ -15,7 +15,7 @@ variable names can be scoped and the visualization uses this information to define a hierarchy on the nodes in the graph. By default, only the top of this hierarchy is shown. Here is an example that defines three operations under the `hidden` name scope using -[`tf.name_scope`](../../api_docs/python/framework.md#name_scope): +@{tf.name_scope}: ```python import tensorflow as tf @@ -43,10 +43,10 @@ expanded states.
- Custom controls panel + Custom controls panel - Custom projection + Custom projection
@@ -87,10 +87,10 @@ and the auxiliary area.
- Unexpanded name scope + Unexpanded name scope - Expanded name scope + Expanded name scope
@@ -114,10 +114,10 @@ specific set of nodes.
- conv_1 is part of the main graph + conv_1 is part of the main graph - save is extracted as auxiliary node + save is extracted as auxiliary node
@@ -135,15 +135,15 @@ for constants and summary nodes. To summarize, here's a table of node symbols: Symbol | Meaning --- | --- -![Name scope](../../images/namespace_node.png "Name scope") | *High-level* node representing a name scope. Double-click to expand a high-level node. -![Sequence of unconnected nodes](../../images/horizontal_stack.png "Sequence of unconnected nodes") | Sequence of numbered nodes that are not connected to each other. -![Sequence of connected nodes](../../images/vertical_stack.png "Sequence of connected nodes") | Sequence of numbered nodes that are connected to each other. -![Operation node](../../images/op_node.png "Operation node") | An individual operation node. -![Constant node](../../images/constant.png "Constant node") | A constant. -![Summary node](../../images/summary.png "Summary node") | A summary node. -![Data flow edge](../../images/dataflow_edge.png "Data flow edge") | Edge showing the data flow between operations. -![Control dependency edge](../../images/control_edge.png "Control dependency edge") | Edge showing the control dependency between operations. -![Reference edge](../../images/reference_edge.png "Reference edge") | A reference edge showing that the outgoing operation node can mutate the incoming tensor. +![Name scope](../images/namespace_node.png "Name scope") | *High-level* node representing a name scope. Double-click to expand a high-level node. +![Sequence of unconnected nodes](../images/horizontal_stack.png "Sequence of unconnected nodes") | Sequence of numbered nodes that are not connected to each other. +![Sequence of connected nodes](../images/vertical_stack.png "Sequence of connected nodes") | Sequence of numbered nodes that are connected to each other. +![Operation node](../images/op_node.png "Operation node") | An individual operation node. +![Constant node](../images/constant.png "Constant node") | A constant. +![Summary node](../images/summary.png "Summary node") | A summary node. +![Data flow edge](../images/dataflow_edge.png "Data flow edge") | Edge showing the data flow between operations. +![Control dependency edge](../images/control_edge.png "Control dependency edge") | Edge showing the control dependency between operations. +![Reference edge](../images/reference_edge.png "Reference edge") | A reference edge showing that the outgoing operation node can mutate the incoming tensor. ## Interaction {#interaction} @@ -161,10 +161,10 @@ right corner of the visualization.
- Sequence of nodes + Sequence of nodes - Expanded sequence of nodes + Expanded sequence of nodes
@@ -207,10 +207,10 @@ The images below give an illustration for a piece of a real-life graph.
- Info card of a name scope + Info card of a name scope - Info card of operation node + Info card of operation node
@@ -228,12 +228,12 @@ The images below give an illustration for a piece of a real-life graph. When the serialized `GraphDef` includes tensor shapes, the graph visualizer labels edges with tensor dimensions, and edge thickness reflects total tensor size. To include tensor shapes in the `GraphDef` pass the actual graph object -(as in `sess.graph`) to the `SummaryWriter` when serializing the graph. +(as in `sess.graph`) to the `FileWriter` when serializing the graph. The images below show the CIFAR-10 model with tensor shape information:
- Color by structure + Color by structure - Color by device + Color by device
@@ -248,8 +248,8 @@ The images below show the CIFAR-10 model with tensor shape information: Often it is useful to collect runtime metadata for a run, such as total memory usage, total compute time, and tensor shapes for nodes. The code example below is a snippet from the train and test section of a modification of the -[simple MNIST tutorial](../../tutorials/mnist/beginners/index.md), -in which we have recorded summaries and runtime statistics. See the [Summaries Tutorial](../../how_tos/summaries_and_tensorboard/index.md#serializing-the-data) +@{$beginners$simple MNIST tutorial}, +in which we have recorded summaries and runtime statistics. See the @{$summaries_and_tensorboard#serializing-the-data$Summaries Tutorial} for details on how to record summaries. Full source is [here](https://www.tensorflow.org/code/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py). @@ -303,13 +303,13 @@ tensor output sizes.
- CIFAR-10 model with tensor shape information + CIFAR-10 model with tensor shape information
- Color by compute time + Color by compute time - Run metadata graph + Run metadata graph - Run metadata info card + Run metadata info card
diff --git a/tensorflow/g3doc/tutorials/input_fn/index.md b/tensorflow/docs_src/get_started/input_fn.md similarity index 94% rename from tensorflow/g3doc/tutorials/input_fn/index.md rename to tensorflow/docs_src/get_started/input_fn.md index 1c16684848..74ed5fbebf 100644 --- a/tensorflow/g3doc/tutorials/input_fn/index.md +++ b/tensorflow/docs_src/get_started/input_fn.md @@ -10,8 +10,7 @@ median house values. When training a neural network using tf.contrib.learn, it's possible to pass your feature and target data directly into your `fit`, `evaluate`, or `predict` -operations. Here's an example taken from the [tf.contrib.learn quickstart -tutorial](../tflearn/index.md): +operations. Here's an example taken from the @{$tflearn$tf.contrib.learn quickstart tutorial}: ```py training_set = tf.contrib.learn.datasets.base.load_csv_with_header( @@ -105,7 +104,7 @@ This corresponds to the following dense tensor: ``` For more on `SparseTensor`, see the -[TensorFlow API documentation](../../api_docs/python/sparse_ops.md#SparseTensor). +@{tf.SparseTensor}. ### Passing input_fn Data to Your Model @@ -214,8 +213,7 @@ here](https://www.tensorflow.org/code/tensorflow/examples/tutorials/input_fn/bos ### Importing the Housing Data -To start, set up your imports (including `pandas` and `tensorflow`) and [set -logging verbosity](../monitors/index.md#enabling-logging-with-tensorflow) to +To start, set up your imports (including `pandas` and `tensorflow`) and @{$monitors#enabling-logging-with-tensorflow$set logging verbosity} to `INFO` for more detailed log output: ```python @@ -233,8 +231,8 @@ tf.logging.set_verbosity(tf.logging.INFO) Define the column names for the data set in `COLUMNS`. To distinguish features from the label, also define `FEATURES` and `LABEL`. Then read the three CSVs -([train](http://download.tensorflow.org/data/boston_train.csv), -[test](http://download.tensorflow.org/data/boston_test.csv), and +(@{tf.train}, +@{tf.test}, and [predict](http://download.tensorflow.org/data/boston_predict.csv)) into _pandas_ `DataFrame`s: @@ -266,9 +264,9 @@ feature_cols = [tf.contrib.layers.real_valued_column(k) ``` NOTE: For a more in-depth overview of feature columns, see -[this introduction](../linear/overview.md#feature-columns-and-transformations), +@{$linear#feature-columns-and-transformations$this introduction}, and for an example that illustrates how to define `FeatureColumns` for -categorical data, see the [Linear Model Tutorial](../wide/index.md). +categorical data, see the @{$wide$Linear Model Tutorial}. Now, instantiate a `DNNRegressor` for the neural network regression model. You'll need to provide two arguments here: `hidden_units`, a hyperparameter @@ -376,16 +374,16 @@ This tutorial focused on creating an `input_fn` for a neural network regressor. To learn more about using `input_fn`s for other types of models, check out the following resources: -* [Large-scale Linear Models with TensorFlow](../linear/overview.md): This +* @{$linear$Large-scale Linear Models with TensorFlow}: This introduction to linear models in TensorFlow provides a high-level overview of feature columns and techniques for transforming input data. -* [TensorFlow Linear Model Tutorial](../wide/index.md): This tutorial covers +* @{$wide$TensorFlow Linear Model Tutorial}: This tutorial covers creating `FeatureColumn`s and an `input_fn` for a linear classification model that predicts income range based on census data. -* [TensorFlow Wide & Deep Learning Tutorial](../wide_and_deep/index.md): Building on - the [Linear Model Tutorial](../wide/index.md), this tutorial covers +* @{$wide_and_deep$TensorFlow Wide & Deep Learning Tutorial}: Building on + the @{$wide$Linear Model Tutorial}, this tutorial covers `FeatureColumn` and `input_fn` creation for a "wide and deep" model that combines a linear model and a neural network using `DNNLinearCombinedClassifier`. diff --git a/tensorflow/docs_src/get_started/leftnav_files b/tensorflow/docs_src/get_started/leftnav_files new file mode 100644 index 0000000000..c24425fdf5 --- /dev/null +++ b/tensorflow/docs_src/get_started/leftnav_files @@ -0,0 +1,10 @@ +get_started.md +mnist/beginners.md +mnist/pros.md +mnist/mechanics.md +tflearn.md +input_fn.md +summaries_and_tensorboard.md +embedding_viz.md +graph_viz.md +monitors.md diff --git a/tensorflow/g3doc/tutorials/mnist/beginners/index.md b/tensorflow/docs_src/get_started/mnist/beginners.md similarity index 95% rename from tensorflow/g3doc/tutorials/mnist/beginners/index.md rename to tensorflow/docs_src/get_started/mnist/beginners.md index f20954d22f..ce7e23c5e1 100644 --- a/tensorflow/g3doc/tutorials/mnist/beginners/index.md +++ b/tensorflow/docs_src/get_started/mnist/beginners.md @@ -3,8 +3,8 @@ *This tutorial is intended for readers who are new to both machine learning and TensorFlow. If you already know what MNIST is, and what softmax (multinomial logistic) regression is, you might prefer this -[faster paced tutorial](../pros/index.md). Be sure to -[install TensorFlow](../../../get_started/os_setup.md) before starting either +@{$pros$faster paced tutorial}. Be sure to +@{$install$install TensorFlow} before starting either tutorial.* When one learns how to program, there's a tradition that the first thing you do @@ -15,7 +15,7 @@ MNIST is a simple computer vision dataset. It consists of images of handwritten digits like these:
- +
It also includes labels for each image, telling us which digit it is. For @@ -88,7 +88,7 @@ Each image is 28 pixels by 28 pixels. We can interpret this as a big array of numbers:
- +
We can flatten this array into a vector of 28x28 = 784 numbers. It doesn't @@ -110,7 +110,7 @@ Each entry in the tensor is a pixel intensity between 0 and 1, for a particular pixel in a particular image.
- +
Each image in MNIST has a corresponding label, a number between 0 and 9 @@ -124,7 +124,7 @@ vector which is 1 in the \\(n\\)th dimension. For example, 3 would be `[55000, 10]` array of floats.
- +
We're now ready to actually make our model! @@ -157,7 +157,7 @@ classes. Red represents negative weights, while blue represents positive weights.
- +
We also add some extra evidence called a bias. Basically, we want to be able @@ -202,13 +202,13 @@ although with a lot more \\(x\\)s. For each output, we compute a weighted sum of the \\(x\\)s, add a bias, and then apply softmax.
- +
If we write that out as equations, we get:
- +
We can "vectorize" this procedure, turning it into a matrix multiplication @@ -216,7 +216,7 @@ and vector addition. This is helpful for computational efficiency. (It's also a useful way to think.)
- +
More compactly, we can just write: @@ -368,7 +368,7 @@ In this case, we ask TensorFlow to minimize `cross_entropy` using the with a learning rate of 0.5. Gradient descent is a simple procedure, where TensorFlow simply shifts each variable a little bit in the direction that reduces the cost. But TensorFlow also provides -[many other optimization algorithms](../../../api_docs/python/train.md#optimizers): +@{$python/train#optimizers$many other optimization algorithms}: using one is as simple as tweaking one line. What TensorFlow actually does here, behind the scenes, is to add new operations @@ -449,5 +449,5 @@ this What matters is that we learned from this model. Still, if you're feeling a bit down about these results, check out -[the next tutorial](../../../tutorials/mnist/pros/index.md) where we do a lot +@{$pros$the next tutorial} where we do a lot better, and learn how to build more sophisticated models using TensorFlow! diff --git a/tensorflow/g3doc/tutorials/mnist/tf/index.md b/tensorflow/docs_src/get_started/mnist/mechanics.md similarity index 83% rename from tensorflow/g3doc/tutorials/mnist/tf/index.md rename to tensorflow/docs_src/get_started/mnist/mechanics.md index 29b91362bb..afd9039017 100644 --- a/tensorflow/g3doc/tutorials/mnist/tf/index.md +++ b/tensorflow/docs_src/get_started/mnist/mechanics.md @@ -10,7 +10,8 @@ TensorFlow. These tutorials are not intended for teaching Machine Learning in general. -Please ensure you have followed the instructions to [install TensorFlow](../../../get_started/os_setup.md). +Please ensure you have followed the instructions to +@{$install$install TensorFlow}. ## Tutorial Files @@ -33,7 +34,7 @@ MNIST is a classic problem in machine learning. The problem is to look at greyscale 28x28 pixel images of handwritten digits and determine which digit the image represents, for all the digits from zero to nine. -![MNIST Digits](../../../images/mnist_digits.png "MNIST Digits") +![MNIST Digits](../../images/mnist_digits.png "MNIST Digits") For more information, refer to [Yann LeCun's MNIST page](http://yann.lecun.com/exdb/mnist/) or [Chris Olah's visualizations of MNIST](http://colah.github.io/posts/2014-10-Visualizing-MNIST/). @@ -60,7 +61,7 @@ Dataset | Purpose ### Inputs and Placeholders -The `placeholder_inputs()` function creates two [`tf.placeholder`](../../../api_docs/python/io_ops.md#placeholder) +The `placeholder_inputs()` function creates two @{tf.placeholder} ops that define the shape of the inputs, including the `batch_size`, to the rest of the graph and into which the actual training examples will be fed. @@ -89,7 +90,7 @@ loss. and apply gradients.
- +
### Inference @@ -101,7 +102,7 @@ It takes the images placeholder as input and builds on top of it a pair of fully connected layers with [ReLU](https://en.wikipedia.org/wiki/Rectifier_(neural_networks)) activation followed by a ten node linear layer specifying the output logits. -Each layer is created beneath a unique [`tf.name_scope`](../../../api_docs/python/framework.md#name_scope) +Each layer is created beneath a unique @{tf.name_scope} that acts as a prefix to the items created within that scope. ```python @@ -109,7 +110,7 @@ with tf.name_scope('hidden1'): ``` Within the defined scope, the weights and biases to be used by each of these -layers are generated into [`tf.Variable`](../../../api_docs/python/state_ops.md#Variable) +layers are generated into @{tf.Variable} instances, with their desired shapes: ```python @@ -127,7 +128,7 @@ name given to the weights variable would be "`hidden1/weights`". Each variable is given initializer ops as part of their construction. In this most common case, the weights are initialized with the -[`tf.truncated_normal`](../../../api_docs/python/constant_op.md#truncated_normal) +@{tf.truncated_normal} and given their shape of a 2-D tensor with the first dim representing the number of units in the layer from which the weights connect and the second dim representing the number of @@ -137,12 +138,12 @@ weights are connecting the image inputs to the hidden1 layer. The `tf.truncated_normal` initializer generates a random distribution with a given mean and standard deviation. -Then the biases are initialized with [`tf.zeros`](../../../api_docs/python/constant_op.md#zeros) +Then the biases are initialized with @{tf.zeros} to ensure they start with all zero values, and their shape is simply the number of units in the layer to which they connect. -The graph's three primary ops -- two [`tf.nn.relu`](../../../api_docs/python/nn.md#relu) -ops wrapping [`tf.matmul`](../../../api_docs/python/math_ops.md#matmul) +The graph's three primary ops -- two @{tf.nn.relu} +ops wrapping @{tf.matmul} for the hidden layers and one extra `tf.matmul` for the logits -- are then created, each in turn, with separate `tf.Variable` instances connected to each of the input placeholders or the output tensors of the previous layer. @@ -166,7 +167,7 @@ Finally, the `logits` tensor that will contain the output is returned. The `loss()` function further builds the graph by adding the required loss ops. -First, the values from the `labels_placeholder` are converted to 64-bit integers. Then, a [`tf.nn.sparse_softmax_cross_entropy_with_logits`](../../../api_docs/python/nn.md#sparse_softmax_cross_entropy_with_logits) op is added to automatically produce 1-hot labels from the `labels_placeholder` and compare the output logits from the `inference()` function with those 1-hot labels. +First, the values from the `labels_placeholder` are converted to 64-bit integers. Then, a @{tf.nn.sparse_softmax_cross_entropy_with_logits} op is added to automatically produce 1-hot labels from the `labels_placeholder` and compare the output logits from the `inference()` function with those 1-hot labels. ```python labels = tf.to_int64(labels) @@ -174,7 +175,7 @@ cross_entropy = tf.nn.sparse_softmax_cross_entropy_with_logits( labels=labels, logits=logits, name='xentropy') ``` -It then uses [`tf.reduce_mean`](../../../api_docs/python/math_ops.md#reduce_mean) +It then uses @{tf.reduce_mean} to average the cross entropy values across the batch dimension (the first dimension) as the total loss. @@ -195,16 +196,16 @@ The `training()` function adds the operations needed to minimize the loss via [Gradient Descent](https://en.wikipedia.org/wiki/Gradient_descent). Firstly, it takes the loss tensor from the `loss()` function and hands it to a -[`tf.summary.scalar`](../../../api_docs/python/summary#scalar), +@{tf.summary.scalar}, an op for generating summary values into the events file when used with a -`SummaryWriter` (see below). In this case, it will emit the snapshot value of +@{tf.summary.FileWriter} (see below). In this case, it will emit the snapshot value of the loss every time the summaries are written out. ```python tf.summary.scalar('loss', loss) ``` -Next, we instantiate a [`tf.train.GradientDescentOptimizer`](../../../api_docs/python/train.md#GradientDescentOptimizer) +Next, we instantiate a @{tf.train.GradientDescentOptimizer} responsible for applying gradients with the requested learning rate. ```python @@ -212,7 +213,7 @@ optimizer = tf.train.GradientDescentOptimizer(learning_rate) ``` We then generate a single variable to contain a counter for the global -training step and the [`minimize()`](../../../api_docs/python/train.md#Optimizer.minimize) +training step and the @{tf.train.Optimizer.minimize} op is used to both update the trainable weights in the system and increment the global step. This op is, by convention, known as the `train_op` and is what must be run by a TensorFlow session in order to induce one full step of training @@ -232,7 +233,7 @@ controlled by the user code in `fully_connected_feed.py`. At the top of the `run_training()` function is a python `with` command that indicates all of the built ops are to be associated with the default -global [`tf.Graph`](../../../api_docs/python/framework.md#Graph) +global @{tf.Graph} instance. ```python @@ -248,7 +249,7 @@ this simple tutorial. ### The Session Once all of the build preparation has been completed and all of the necessary -ops generated, a [`tf.Session`](../../../api_docs/python/client.md#Session) +ops generated, a @{tf.Session} is created for running the graph. ```python @@ -265,7 +266,7 @@ The empty parameter to session indicates that this code will attach to (or create if not yet created) the default local session. Immediately after creating the session, all of the `tf.Variable` -instances are initialized by calling [`sess.run()`](../../../api_docs/python/client.md#Session.run) +instances are initialized by calling @{tf.Session.run} on their initialization op. ```python @@ -273,10 +274,10 @@ init = tf.global_variables_initializer() sess.run(init) ``` -The [`sess.run()`](../../../api_docs/python/client.md#Session.run) +The @{tf.Session.run} method will run the complete subset of the graph that corresponds to the op(s) passed as parameters. In this first call, the `init` -op is a [`tf.group`](../../../api_docs/python/control_flow_ops.md#group) +op is a @{tf.group} that contains only the initializers for the variables. None of the rest of the graph is run here; that happens in the training loop below. @@ -355,20 +356,20 @@ if step % 100 == 0: #### Visualize the Status -In order to emit the events files used by [TensorBoard](../../../how_tos/summaries_and_tensorboard/index.md), +In order to emit the events files used by @{$summaries_and_tensorboard$TensorBoard}, all of the summaries (in this case, only one) are collected into a single Tensor during the graph building phase. ```python -summary = tf.merge_all_summaries() +summary = tf.summary.merge_all() ``` -And then after the session is created, a [`tf.train.SummaryWriter`](../../../api_docs/python/train/adding_summaries_to_event_files#SummaryWriter) +And then after the session is created, a @{tf.summary.FileWriter} may be instantiated to write the events files, which contain both the graph itself and the values of the summaries. ```python -summary_writer = tf.train.SummaryWriter(FLAGS.train_dir, sess.graph) +summary_writer = tf.summary.FileWriter(FLAGS.train_dir, sess.graph) ``` Lastly, the events file will be updated with new summary values every time the @@ -383,21 +384,21 @@ summary_writer.add_summary(summary_str, step) When the events files are written, TensorBoard may be run against the training folder to display the values from the summaries. -![MNIST TensorBoard](../../../images/mnist_tensorboard.png "MNIST TensorBoard") +![MNIST TensorBoard](../../images/mnist_tensorboard.png "MNIST TensorBoard") -**NOTE**: For more info about how to build and run Tensorboard, please see the accompanying tutorial [Tensorboard: Visualizing Learning](../../../how_tos/summaries_and_tensorboard/index.md). +**NOTE**: For more info about how to build and run Tensorboard, please see the accompanying tutorial @{$summaries_and_tensorboard$Tensorboard: Visualizing Learning}. #### Save a Checkpoint In order to emit a checkpoint file that may be used to later restore a model for further training or evaluation, we instantiate a -[`tf.train.Saver`](../../../api_docs/python/state_ops.md#Saver). +@{tf.train.Saver}. ```python saver = tf.train.Saver() ``` -In the training loop, the [`saver.save()`](../../../api_docs/python/state_ops.md#Saver.save) +In the training loop, the @{tf.train.Saver.save} method will periodically be called to write a checkpoint file to the training directory with the current values of all the trainable variables. @@ -406,7 +407,7 @@ saver.save(sess, FLAGS.train_dir, global_step=step) ``` At some later point in the future, training might be resumed by using the -[`saver.restore()`](../../../api_docs/python/state_ops.md#Saver.restore) +@{tf.train.Saver.restore} method to reload the model parameters. ```python @@ -455,7 +456,7 @@ logits/labels parameters as the `loss()` function. eval_correct = mnist.evaluation(logits, labels_placeholder) ``` -The `evaluation()` function simply generates a [`tf.nn.in_top_k`](../../../api_docs/python/nn.md#in_top_k) +The `evaluation()` function simply generates a @{tf.nn.in_top_k} op that can automatically score each model output as correct if the true label can be found in the K most-likely predictions. In this case, we set the value of K to 1 to only consider a prediction correct if it is for the true label. diff --git a/tensorflow/g3doc/tutorials/mnist/pros/index.md b/tensorflow/docs_src/get_started/mnist/pros.md similarity index 96% rename from tensorflow/g3doc/tutorials/mnist/pros/index.md rename to tensorflow/docs_src/get_started/mnist/pros.md index 7f915f86b7..84f87b3a88 100644 --- a/tensorflow/g3doc/tutorials/mnist/pros/index.md +++ b/tensorflow/docs_src/get_started/mnist/pros.md @@ -8,8 +8,8 @@ TensorFlow model while constructing a deep convolutional MNIST classifier. *This introduction assumes familiarity with neural networks and the MNIST dataset. If you don't have a background with them, check out the -[introduction for beginners](../beginners/index.md). Be sure to -[install TensorFlow](../../../get_started/os_setup.md) before starting.* +@{$beginners$introduction for beginners}. Be sure to +@{$install$install TensorFlow} before starting.* ## About this tutorial @@ -63,12 +63,12 @@ programs is to first create a graph and then launch it in a session. Here we instead use the convenient `InteractiveSession` class, which makes TensorFlow more flexible about how you structure your code. It allows you to interleave operations which build a -[computation graph](../../../get_started/basic_usage.md#the-computation-graph) +@{$get_started#the_computational_graph$computation graph} with ones that run the graph. This is particularly convenient when working in interactive contexts like IPython. If you are not using an `InteractiveSession`, then you should build the entire computation graph before starting a session and -[launching the graph](../../../get_started/basic_usage.md#launching-the-graph-in-a-session). +@{$get_started#the_computational_graph$launching the graph}. ```python import tensorflow as tf @@ -93,11 +93,8 @@ similar to that used in Theano or Torch. The role of the Python code is therefore to build this external computation graph, and to dictate which parts of the computation graph should be run. See -the -[Computation Graph](../../../get_started/basic_usage.md#the-computation-graph) -section of -[Basic Usage](../../../get_started/basic_usage.md) -for more detail. +the @{$get_started#the_computational_graph$Computation Graph} +section of @{$get_started} for more detail. ## Build a Softmax Regression Model @@ -187,7 +184,7 @@ Now that we have defined our model and training loss function, it is straightforward to train using TensorFlow. Because TensorFlow knows the entire computation graph, it can use automatic differentiation to find the gradients of the loss with respect to each of the variables. TensorFlow has a variety of -[built-in optimization algorithms](../../../api_docs/python/train.md#optimizers). +@{$python/train#optimizers$built-in optimization algorithms}. For this example, we will use steepest gradient descent, with a step length of 0.5, to descend the cross entropy. @@ -357,7 +354,8 @@ We create a `placeholder` for the probability that a neuron's output is kept during dropout. This allows us to turn dropout on during training, and turn it off during testing. TensorFlow's `tf.nn.dropout` op automatically handles scaling neuron outputs in -addition to masking them, so dropout just works without any additional scaling.[1](#f1) +addition to masking them, so dropout just works without any additional +scaling.[1](#f1) ```python keep_prob = tf.placeholder(tf.float32) diff --git a/tensorflow/g3doc/tutorials/monitors/index.md b/tensorflow/docs_src/get_started/monitors.md similarity index 88% rename from tensorflow/g3doc/tutorials/monitors/index.md rename to tensorflow/docs_src/get_started/monitors.md index 35bd1fc412..a51194326f 100644 --- a/tensorflow/g3doc/tutorials/monitors/index.md +++ b/tensorflow/docs_src/get_started/monitors.md @@ -4,14 +4,14 @@ When training a model, it’s often valuable to track and evaluate progress in real time. In this tutorial, you’ll learn how to use TensorFlow’s logging capabilities and the `Monitor` API to audit the in-progress training of a neural network classifier for categorizing irises. This tutorial builds on the code -developed in [tf.contrib.learn Quickstart](../tflearn/index.md) so if you +developed in @{$tflearn$tf.contrib.learn Quickstart} so if you haven't yet completed that tutorial, you may want to explore it first, especially if you're looking for an intro/refresher on tf.contrib.learn basics. ## Setup {#setup} For this tutorial, you'll be building upon the following code from -[tf.contrib.learn Quickstart](../tflearn/index.md): +@{$tflearn$tf.contrib.learn Quickstart}: ```python from __future__ import absolute_import @@ -65,7 +65,7 @@ if __name__ == "__main__": Copy the above code into a file, and download the corresponding [training](http://download.tensorflow.org/data/iris_training.csv) and -[test](http://download.tensorflow.org/data/iris_test.csv) data sets to the same +@{tf.test} data sets to the same directory. In the following sections, you'll progressively make updates to the above code @@ -75,7 +75,7 @@ here](https://www.tensorflow.org/code/tensorflow/examples/tutorials/monitors/iri ## Overview -The [tf.contrib.learn Quickstart tutorial](../tflearn/index.md) walked through +The @{$tflearn$tf.contrib.learn Quickstart tutorial} walked through how to implement a neural net classifier to categorize iris examples into one of three species. @@ -98,7 +98,7 @@ One way to address this problem would be to split model training into multiple `fit` calls with smaller numbers of steps in order to evaluate accuracy more progressively. However, this is not recommended practice, as it greatly slows down model training. Fortunately, tf.contrib.learn offers another solution: a -[Monitor API](../../api_docs/python/contrib.learn.monitors.md) designed to help +@{tf.contrib.learn.monitors$Monitor API} designed to help you log metrics and evaluate your model while training is in progress. In the following sections, you'll learn how to enable logging in TensorFlow, set up a ValidationMonitor to do streaming evaluations, and visualize your metrics using @@ -149,7 +149,7 @@ Monitor | Description ------------------- | ----------- `CaptureVariable` | Saves a specified variable's values into a collection at every _n_ steps of training `PrintTensor` | Logs a specified tensor's values at every _n_ steps of training -`SummarySaver` | Saves [`Summary`](../../api_docs/python/train.md#summary-operations) [protocol buffers](https://developers.google.com/protocol-buffers/) for a given tensor using a [`SummaryWriter`](../../api_docs/python/train.md#SummaryWriter) at every _n_ steps of training +`SummarySaver` | Saves @{tf.Summary} [protocol buffers](https://developers.google.com/protocol-buffers/) for a given tensor using a @{tf.summary.FileWriter} at every _n_ steps of training `ValidationMonitor` | Logs a specified set of evaluation metrics at every _n_ steps of training, and, if desired, implements early stopping under certain conditions ### Evaluating Every *N* Steps @@ -173,7 +173,7 @@ Place this code right before the line instantiating the `classifier`. `ValidationMonitor`s rely on saved checkpoints to perform evaluation operations, so you'll want to modify instantiation of the `classifier` to add a -[`RunConfig`](../../api_docs/python/contrib.learn.md#RunConfig) that includes +@{tf.contrib.learn.RunConfig} that includes `save_checkpoints_secs`, which specifies how many seconds should elapse between checkpoint saves during training. Because the iris data set is quite small, and thus trains quickly, it makes sense to set `save_checkpoints_secs` to 1 (saving @@ -234,11 +234,10 @@ object. The `MetricSpec` constructor accepts four parameters: * `metric_fn`. The function that calculates and returns the value of a metric. - This can be a predefined function available in the [tf.contrib.metrics - module](../../api_docs/python/contrib.metrics.md), such as - [`streaming_precision`](https://www.tensorflow.org/code/tensorflow/contrib/metrics/python/ops/metric_ops.py) - or - [`streaming_recall`](https://www.tensorflow.org/code/tensorflow/contrib/metrics/python/ops/metric_ops.py). + This can be a predefined function available in the + @{tf.contrib.metrics} module, such as + @{tf.contrib.metrics.streaming_precision} or + @{tf.contrib.metrics.streaming_recall}. Alternatively, you can define your own custom metric function, which must take `predictions` and `labels` tensors as arguments (a `weights` argument @@ -254,10 +253,10 @@ The `MetricSpec` constructor accepts four parameters: by the model. This argument may be omitted if the model returns either a single tensor or a dict with a single entry. For a `DNNClassifier` model, class predictions will be returned in a tensor with the key - [`PredictionKey.CLASSES`](https://www.tensorflow.org/code/tensorflow/contrib/learn/python/learn/estimators/prediction_key.py). + @{tf.contrib.learn.PredictionKey.CLASSES}. * `label_key`. The key of the tensor containing the labels returned by the - model, as specified by the model's [`input_fn`](../input_fn/index.md). As + model, as specified by the model's @{$input_fn$`input_fn`}. As with `prediction_key`, this argument may be omitted if the `input_fn` returns either a single tensor or a dict with a single entry. In the iris example in this tutorial, the `DNNClassifier` does not have an `input_fn` @@ -265,20 +264,17 @@ The `MetricSpec` constructor accepts four parameters: a `label_key`. * `weights_key`. *Optional*. The key of the tensor (returned by the - [`input_fn`](../input_fn/index.md)) containing weights inputs for the + @{$input_fn$`input_fn`}) containing weights inputs for the `metric_fn`. The following code creates a `validation_metrics` dict that defines three metrics to log during model evaluation: -* `"accuracy"`, using - [`streaming_accuracy`](https://www.tensorflow.org/code/tensorflow/contrib/metrics/python/ops/metric_ops.py) +* `"accuracy"`, using @{tf.contrib.metrics.streaming_accuracy} as the `metric_fn` -* `"precision"`, using - [`streaming_precision`](https://www.tensorflow.org/code/tensorflow/contrib/metrics/python/ops/metric_ops.py) +* `"precision"`, using @{tf.contrib.metrics.streaming_precision} as the `metric_fn` -* `"recall"`, using - [`streaming_recall`](https://www.tensorflow.org/code/tensorflow/contrib/metrics/python/ops/metric_ops.py) +* `"recall"`, using @{tf.contrib.metrics.streaming_recall} as the `metric_fn` ```python @@ -329,8 +325,8 @@ INFO:tensorflow:Validation (step 1500): recall = 1.0, loss = 0.0617403, global_s Note that in the above log output, by step 600, the model has already achieved precision and recall rates of 1.0. This raises the question as to whether model -training could benefit from [early -stopping](https://en.wikipedia.org/wiki/Early_stopping). +training could benefit from +[early stopping](https://en.wikipedia.org/wiki/Early_stopping). In addition to logging eval metrics, `ValidationMonitor`s make it easy to implement early stopping when specified conditions are met, via three params: @@ -408,9 +404,6 @@ Then navigate to `http://0.0.0.0:`*``* in your browser, where If you click on the accuracy field, you'll see an image like the following, which shows accuracy plotted against step count: -![Accuracy over step count in -TensorBoard](../../images/validation_monitor_tensorboard_accuracy.png "Accuracy over step count in TensorBoard") +![Accuracy over step count in TensorBoard](../images/validation_monitor_tensorboard_accuracy.png "Accuracy over step count in TensorBoard") -For more on using TensorBoard, see [TensorBoard: Visualizing -Learning](../../how_tos/summaries_and_tensorboard/index.md) and [TensorBoard: -Graph Visualization](../../how_tos/graph_viz/index.md). +For more on using TensorBoard, see @{$summaries_and_tensorboard$TensorBoard: Visualizing Learning} and @{$graph_viz$TensorBoard: Graph Visualization}. diff --git a/tensorflow/g3doc/how_tos/summaries_and_tensorboard/index.md b/tensorflow/docs_src/get_started/summaries_and_tensorboard.md similarity index 92% rename from tensorflow/g3doc/how_tos/summaries_and_tensorboard/index.md rename to tensorflow/docs_src/get_started/summaries_and_tensorboard.md index 99fc0ea0fd..69677daaef 100644 --- a/tensorflow/g3doc/how_tos/summaries_and_tensorboard/index.md +++ b/tensorflow/docs_src/get_started/summaries_and_tensorboard.md @@ -8,7 +8,7 @@ your TensorFlow graph, plot quantitative metrics about the execution of your graph, and show additional data like images that pass through it. When TensorBoard is fully configured, it looks like this: -![MNIST TensorBoard](../../images/mnist_tensorboard.png "MNIST TensorBoard") +![MNIST TensorBoard](../images/mnist_tensorboard.png "MNIST TensorBoard") This tutorial is intended to get you started with simple TensorBoard usage. @@ -24,12 +24,12 @@ lifecycle for summary data within TensorBoard. First, create the TensorFlow graph that you'd like to collect summary data from, and decide which nodes you would like to annotate with -[summary operations](../../api_docs/python/summary.md). +@{$python/summary$summary operations}. For example, suppose you are training a convolutional neural network for recognizing MNIST digits. You'd like to record how the learning rate varies over time, and how the objective function is changing. Collect these by -attaching [`scalar_summary`](../../api_docs/python/summary.md#scalar) ops +attaching @{tf.summary.scalar} ops to the nodes that output the learning rate and loss respectively. Then, give each `scalar_summary` a meaningful `tag`, like `'learning rate'` or `'loss function'`. @@ -37,24 +37,24 @@ function'`. Perhaps you'd also like to visualize the distributions of activations coming off a particular layer, or the distribution of gradients or weights. Collect this data by attaching -[`histogram_summary`](../../api_docs/python/summary.md#histogram) ops to +@{tf.summary.histogram} ops to the gradient outputs and to the variable that holds your weights, respectively. For details on all of the summary operations available, check out the docs on -[summary operations](../../api_docs/python/summary.md). +@{$python/summary$summary operations}. Operations in TensorFlow don't do anything until you run them, or an op that depends on their output. And the summary nodes that we've just created are peripheral to your graph: none of the ops you are currently running depend on them. So, to generate summaries, we need to run all of these summary nodes. Managing them by hand would be tedious, so use -[`tf.summary.merge_all`](../../api_docs/python/summary.md#merge_all) +@{tf.summary.merge_all} to combine them into a single op that generates all the summary data. Then, you can just run the merged summary op, which will generate a serialized `Summary` protobuf object with all of your summary data at a given step. Finally, to write this summary data to disk, pass the summary protobuf to a -[`tf.summary.FileWriter`](../../api_docs/python/summary.md#FileWriter). +@{tf.summary.FileWriter}. The `FileWriter` takes a logdir in its constructor - this logdir is quite important, it's the directory where all of the events will be written out. @@ -62,7 +62,7 @@ Also, the `FileWriter` can optionally take a `Graph` in its constructor. If it receives a `Graph` object, then TensorBoard will visualize your graph along with tensor shape information. This will give you a much better sense of what flows through the graph: see -[Tensor shape information](../../how_tos/graph_viz/index.md#tensor-shape-information). +@{$graph_viz#tensor-shape-information$Tensor shape information}. Now that you've modified your graph and have a `FileWriter`, you're ready to start running your network! If you want, you could run the merged summary op @@ -71,7 +71,7 @@ data than you need, though. Instead, consider running the merged summary op every `n` steps. The code example below is a modification of the -[simple MNIST tutorial](http://tensorflow.org/tutorials/mnist/beginners/index.md), +@{$beginners$simple MNIST tutorial}, in which we have added some summary ops, and run them every ten steps. If you run this and then launch `tensorboard --logdir=/tmp/mnist_logs`, you'll be able to visualize statistics, such as how the weights or accuracy varied during @@ -209,7 +209,7 @@ When looking at TensorBoard, you will see the navigation tabs in the top right corner. Each tab represents a set of serialized data that can be visualized. For in depth information on how to use the *graph* tab to visualize your graph, -see [TensorBoard: Graph Visualization](../../how_tos/graph_viz/index.md). +see @{$graph_viz$TensorBoard: Graph Visualization}. For more usage information on TensorBoard in general, see the [TensorBoard README](https://www.tensorflow.org/code/tensorflow/tensorboard/README.md). diff --git a/tensorflow/g3doc/tutorials/tflearn/index.md b/tensorflow/docs_src/get_started/tflearn.md similarity index 78% rename from tensorflow/g3doc/tutorials/tflearn/index.md rename to tensorflow/docs_src/get_started/tflearn.md index 9f6485e30b..b1fc04641d 100644 --- a/tensorflow/g3doc/tutorials/tflearn/index.md +++ b/tensorflow/docs_src/get_started/tflearn.md @@ -2,23 +2,21 @@ TensorFlow’s high-level machine learning API (tf.contrib.learn) makes it easy to configure, train, and evaluate a variety of machine learning models. In this -tutorial, you’ll use tf.contrib.learn to construct a [neural -network](https://en.wikipedia.org/wiki/Artificial_neural_network) classifier and -train it on the [Iris data -set](https://en.wikipedia.org/wiki/Iris_flower_data_set) to predict flower -species based on sepal/petal geometry. You'll write code to perform the -following five steps: +tutorial, you’ll use tf.contrib.learn to construct a +[neural network](https://en.wikipedia.org/wiki/Artificial_neural_network) +classifier and train it on the +[Iris data set](https://en.wikipedia.org/wiki/Iris_flower_data_set) to +predict flower species based on sepal/petal geometry. You'll write code to +perform the following five steps: 1. Load CSVs containing Iris training/test data into a TensorFlow `Dataset` -2. Construct a [neural network - classifier](../../api_docs/python/contrib.learn.md#DNNClassifier) +2. Construct a @{tf.contrib.learn.DNNClassifier$neural network classifier} 3. Fit the model using the training data 4. Evaluate the accuracy of the model 5. Classify new samples -NOTE: Remember to [install TensorFlow on your -machine](../../get_started/os_setup.md#download-and-setup) before getting -started with this tutorial. +NOTE: Remember to @{$install$install TensorFlow on your machine} +before getting started with this tutorial. ## Complete Neural Network Source Code @@ -80,8 +78,7 @@ The [Iris data set](https://en.wikipedia.org/wiki/Iris_flower_data_set) contains 150 rows of data, comprising 50 samples from each of three related Iris species: *Iris setosa*, *Iris virginica*, and *Iris versicolor*. -![Petal geometry compared for three iris species: Iris setosa, Iris virginica, -and Iris versicolor](../../images/iris_three_species.jpg) **From left to right, +![Petal geometry compared for three iris species: Iris setosa, Iris virginica, and Iris versicolor](../images/iris_three_species.jpg) **From left to right, [*Iris setosa*](https://commons.wikimedia.org/w/index.php?curid=170298) (by [Radomil](https://commons.wikimedia.org/wiki/User:Radomil), CC BY-SA 3.0), [*Iris versicolor*](https://commons.wikimedia.org/w/index.php?curid=248095) (by @@ -137,12 +134,13 @@ method in `learn.datasets.base`. The `load_csv_with_header()` method takes three required arguments: * `filename`, which takes the filepath to the CSV file -* `target_dtype`, which takes the [`numpy` - datatype](http://docs.scipy.org/doc/numpy/user/basics.types.html) of the - dataset's target value. -* `features_dtype`, which takes the [`numpy` - datatype](http://docs.scipy.org/doc/numpy/user/basics.types.html) of the - dataset's feature values. +* `target_dtype`, which takes the + [`numpy` datatype](http://docs.scipy.org/doc/numpy/user/basics.types.html) + of the dataset's target value. +* `features_dtype`, which takes the + [`numpy` datatype](http://docs.scipy.org/doc/numpy/user/basics.types.html) + of the dataset's feature values. + Here, the target (the value you're training the model to predict) is flower species, which is an integer from 0–2, so the appropriate `numpy` datatype @@ -164,27 +162,28 @@ test_set = tf.contrib.learn.datasets.base.load_csv_with_header( features_dtype=np.float32) ``` -`Dataset`s in tf.contrib.learn are [named -tuples](https://docs.python.org/2/library/collections.html#collections.namedtuple); +`Dataset`s in tf.contrib.learn are +[named tuples](https://docs.python.org/2/library/collections.html#collections.namedtuple); you can access feature data and target values via the `data` and `target` fields. Here, `training_set.data` and `training_set.target` contain the feature data and target values for the training set, respectively, and `test_set.data` and `test_set.target` contain feature data and target values for the test set. -Later on, in ["Fit the DNNClassifier to the Iris Training -Data,"](#fit-dnnclassifier) you'll use `training_set.data` and -`training_set.target` to train your model, and in ["Evaluate Model -Accuracy,"](#evaluate-accuracy) you'll use `test_set.data` and +Later on, in +["Fit the DNNClassifier to the Iris Training Data,"](#fit-dnnclassifier) +you'll use `training_set.data` and +`training_set.target` to train your model, and in +["Evaluate Model Accuracy,"](#evaluate-accuracy) you'll use `test_set.data` and `test_set.target`. But first, you'll construct your model in the next section. ## Construct a Deep Neural Network Classifier tf.contrib.learn offers a variety of predefined models, called -[`Estimator`s](../../api_docs/python/contrib.learn.md#estimators), which you can +@{$python/contrib.learn#estimators$`Estimator`s}, which you can use "out of the box" to run training and evaluation operations on your data. Here, you'll configure a Deep Neural Network Classifier model to fit the Iris data. Using tf.contrib.learn, you can instantiate your -[`DNNClassifier`](../../api_docs/python/contrib.learn.md#DNNClassifier) with +@{tf.contrib.learn.DNNClassifier} with just a couple lines of code: ```python @@ -208,22 +207,20 @@ must be set to `4` to hold all the data. Then, the code creates a `DNNClassifier` model using the following arguments: * `feature_columns=feature_columns`. The set of feature columns defined above. -* `hidden_units=[10, 20, 10]`. Three [hidden - layers](http://stats.stackexchange.com/questions/181/how-to-choose-the-number-of-hidden-layers-and-nodes-in-a-feedforward-neural-netw), +* `hidden_units=[10, 20, 10]`. Three + [hidden layers](http://stats.stackexchange.com/questions/181/how-to-choose-the-number-of-hidden-layers-and-nodes-in-a-feedforward-neural-netw), containing 10, 20, and 10 neurons, respectively. * `n_classes=3`. Three target classes, representing the three Iris species. * `model_dir=/tmp/iris_model`. The directory in which TensorFlow will save checkpoint data during model training. For more on logging and monitoring - with TensorFlow, see [Logging and Monitoring Basics with - tf.contrib.learn](../monitors/index.md). + with TensorFlow, see @{$monitors$Logging and Monitoring Basics with tf.contrib.learn}. ## Fit the DNNClassifier to the Iris Training Data {#fit-dnnclassifier} Now that you've configured your DNN `classifier` model, you can fit it to the -Iris training data using the -[`fit`](../../api_docs/python/contrib.learn.md#BaseEstimator.fit) method. Pass -as arguments your feature data (`training_set.data`), target values -(`training_set.target`), and the number of steps to train (here, 2000): +Iris training data using the @{tf.contrib.learn.BaseEstimator.fit$`fit`} +method. Pass as arguments your feature data (`training_set.data`), target +values (`training_set.target`), and the number of steps to train (here, 2000): ```python # Fit model @@ -240,17 +237,16 @@ classifier.fit(x=training_set.data, y=training_set.target, steps=1000) ``` However, if you're looking to track the model while it trains, you'll likely -want to instead use a TensorFlow -[`monitor`](https://www.tensorflow.org/code/tensorflow/contrib/learn/python/learn/monitors.py) -to perform logging operations. See the tutorial [“Logging and Monitoring -Basics with tf.contrib.learn”](../monitors/index.md) for more on this -topic. +want to instead use a TensorFlow @{tf.contrib.learn.monitors$`monitor`} +to perform logging operations. See the tutorial +@{$monitors$“Logging and Monitoring Basics with tf.contrib.learn”} +for more on this topic. ## Evaluate Model Accuracy {#evaluate-accuracy} You've fit your `DNNClassifier` model on the Iris training data; now, you can check its accuracy on the Iris test data using the -[`evaluate`](../../api_docs/python/contrib.learn.md#BaseEstimator.evaluate) +@{tf.contrib.learn.BaseEstimator.evaluate$`evaluate`} method. Like `fit`, `evaluate` takes feature data and target values as arguments, and returns a `dict` with the evaluation results. The following code passes the Iris test data—`test_set.data` and `test_set.target`—to @@ -301,18 +297,17 @@ second sample is *Iris virginica*. ## Additional Resources -* For further reference materials on tf.contrib.learn, see the official [API - docs](../../api_docs/python/contrib.learn.md). +* For further reference materials on tf.contrib.learn, see the official @{$python/contrib.learn$API docs}. * To learn more about using tf.contrib.learn to create linear models, see - [Large-scale Linear Models with TensorFlow](../linear/overview.md). + @{$linear$Large-scale Linear Models with TensorFlow}. -* To build your own Estimator using tf.contrib.learn APIs, check out [Building - Machine Learning Estimator in - TensorFlow](http://terrytangyuan.github.io/2016/07/08/understand-and-build-tensorflow-estimator/). +* To build your own Estimator using tf.contrib.learn APIs, check out + [Building Machine Learning Estimator in TensorFlow](http://terrytangyuan.github.io/2016/07/08/understand-and-build-tensorflow-estimator/). * To experiment with neural network modeling and visualization in the browser, check out [Deep Playground](http://playground.tensorflow.org/). -* For more advanced tutorials on neural networks, see [Convolutional Neural - Networks](../deep_cnn/) and [Recurrent Neural Networks](../recurrent/). +* For more advanced tutorials on neural networks, see + @{$deep_cnn$Convolutional Neural Networks} and + @{$recurrent$Recurrent Neural Networks}. diff --git a/tensorflow/docs_src/install/index.md b/tensorflow/docs_src/install/index.md new file mode 100644 index 0000000000..fa9539c68b --- /dev/null +++ b/tensorflow/docs_src/install/index.md @@ -0,0 +1,10 @@ +# Installing TensorFlow + +We have installation instructions for the following platform: + +* [Linux](install_linux.md) +* [Mac OS X](install_mac.md) +* [Windows](install_windows.md) +* [From source](install_sources.md) + +We also have help for [migrating from previous versions of TensorFlow to v1.0](migration.md). diff --git a/tensorflow/docs_src/install/install_linux.md b/tensorflow/docs_src/install/install_linux.md new file mode 100644 index 0000000000..2eb91be437 --- /dev/null +++ b/tensorflow/docs_src/install/install_linux.md @@ -0,0 +1,728 @@ +# Installing TensorFlow on Ubuntu + +This guide explains how to install TensorFlow on Ubuntu. These instructions +might also work on other Linux variants, but we have only tested (and we +only support) these instructions on Ubuntu 14.04 or higher. + + +## Determine which TensorFlow to install + +You must choose one of the following types of TensorFlow to install: + + * **TensorFlow with CPU support only**. If your system does not have a + NVIDIA® GPU, you must install this version. Note that this version of + TensorFlow is typically much easier to install (typically, + in 5 or 10 minutes), so even if you have an NVIDIA GPU, we recommend + installing this version first. + * **TensorFlow with GPU support**. TensorFlow programs typically run + significantly faster on a GPU than on a CPU. Therefore, if your + system has a NVIDIA® GPU meeting the prerequisites shown below and you + need to run performance-critical applications, you should ultimately + install this version. + + +### NVIDIA requirements to run TensorFlow with GPU support + +If you are installing TensorFlow with GPU support using one of the +mechanisms described in this guide, then the following NVIDIA software +must be installed on your system: + + * CUDA® Toolkit 8.0. For details, see + [NVIDIA's documentation](http://docs.nvidia.com/cuda/cuda-installation-guide-linux/#axzz4VZnqTJ2A). + Ensure that you append the relevant Cuda pathnames to the + `LD_LIBRARY_PATH` environment variable as described in the + NVIDIA documentation. + * The NVIDIA drivers associated with CUDA Toolkit 8.0. + * cuDNN v5.1. For details, see + [NVIDIA's documentation](https://developer.nvidia.com/cudnn). + Ensure that you create the `CUDA_HOME` environment variable as + described in the NVIDIA documentation. + * GPU card with CUDA Compute Capability 3.0 or higher. See + [NVIDIA documentation](https://developer.nvidia.com/cuda-gpus) for + a list of supported GPU cards. + * The libcupti-dev library, which is the NVIDIA CUDA Profile Tools Interface. + This library provides advanced profiling support. To install this library, + issue the following command: + +
+    $ sudo apt-get install libcupti-dev
+    
+ +If you have an earlier version of the preceding packages, please upgrade to +the specified versions. If upgrading is not possible, then you may still run +TensorFlow with GPU support, but only if you do the following: + + * Install TensorFlow from sources as documented in + *Installing TensorFlow from Sources*). + * Install or upgrade to at least the following NVIDIA versions: + * CUDA toolkit 7.0 or greater + * cuDNN v3 or greater + * GPU card with CUDA Compute Capability 3.0 or higher. + + +## Determine how to install TensorFlow + +You must pick the mechanism by which you install TensorFlow. The +supported choices are as follows: + + * [virtualenv](#InstallingVirtualenv) + * ["native" pip](#InstallingNativePip) + * [Docker](#InstallingDocker) + * [Anaconda](#InstallingAnaconda) + +**We recommend the virtualenv installation.** +[Virtualenv](https://virtualenv.pypa.io/en/stable/) +is a virtual Python environment isolated from other Python development, +incapable of interfering with or being affected by other Python programs +on the same machine. During the virtualenv installation process, +you will install not only TensorFlow but also all the packages that +TensorFlow requires. (This is actually pretty easy.) +To start working with TensorFlow, you simply need to "activate" the +virtual environment. All in all, virtualenv provides a safe and +reliable mechanism for installing and running TensorFlow. + +Native pip installs TensorFlow directly on your system without going +through any container system. **We recommend the native pip install for +system administrators aiming to make TensorFlow available to everyone on a +multi-user system.** Since a native pip installation is not walled-off in +a separate container, the pip installation might interfere with other +Python-based installations on your system. However, if you understand pip +and your Python environment, a native pip installation often entails only +a single command. + +Docker completely isolates the TensorFlow installation +from pre-existing packages on your machine. The Docker container contains +TensorFlow and all its dependencies. Note that the Docker image can be quite +large (hundreds of MBs). You might choose the Docker installation if you are +incorporating TensorFlow into a larger application architecture that already +uses Docker. + +In Anaconda, you may use conda to create a virtual environment. +However, within Anaconda, we recommend installing TensorFlow with the +`pip install` command, not with the `conda install` command. + +**NOTE:** The conda package is community supported, not officially supported. +That is, the TensorFlow team neither tests nor maintains the conda package. +Use that package at your own risk. + + + +## Installing with virtualenv + +Take the following steps to install TensorFlow with Virtualenv: + + 1. Install pip and virtualenv by issuing the following command: + +
$ sudo apt-get install python-pip python-dev python-virtualenv 
+ + 2. Create a virtualenv environment by issuing the following command: + +
$ virtualenv --system-site-packages targetDirectory 
+ + The targetDirectory specifies the top of the + virtualenv tree. Our instructions assume that targetDirectory + is `~/tensorflow`, but you may choose any directory. + + 3. Activate the virtualenv environment by issuing one of the following + commands: + +
 $ source ~/tensorflow/bin/activate # If using bash, ksh, sh, or 
+     $ source ~/tensorflow/bin/activate.csh  # If using csh 
+ + The preceding source command should change your prompt + to the following: + +
 (tensorflow)$ 
+ + 4. Issue one of the following commands to install TensorFlow in the active + virtualenv environment: + +
 (tensorflow)$ pip install --upgrade tensorflow      # for Python 2.7
+     (tensorflow)$ pip3 install --upgrade tensorflow     # for Python 3.n
+     (tensorflow)$ pip install --upgrade tensorflow-gpu  # for Python 2.7 and GPU
+     (tensorflow)$ pip3 install --upgrade tensorflow-gpu # for Python 3.3 and GPU
+ + If the preceding command succeeds, skip Step 5. If the preceding + command fails, perform Step 5. + + 5. (Optional) If Step 4 failed (typically because you invoked a pip version + lower than 8.1), install TensorFlow in the active virtualenv environment + by issuing a command of the following format: + +
 (tensorflow)$ pip install --upgrade TF_PYTHON_URL   # Python 2.7
+     (tensorflow)$ pip3 install --upgrade TF_PYTHON_URL  # Python 3.N 
+ + where TF_PYTHON_URL identifies the URL of the + TensorFlow Python package. The appropriate value of + TF_PYTHON_URLdepends on the operating system, + Python version, and GPU support. Find the appropriate value for + TF_PYTHON_URL for your system + [here](#TF_PYTHON_URL). For example, if you are installing TensorFlow + for Linux, Python version 3.4, and CPU-only support, issue the following + command to install TensorFlow in the active virtualenv environment: + +
(tensorflow)$ pip3 install --upgrade \
+     https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0-py3-none-any.whl
+ +If you encounter installation problems, see +[Common Installation Problems](#CommonInstallationProblems). + + +### Next Steps + +After installing TensorFlow, +[validate the installation](#ValidateYourInstallation). + +Note that you must activate the virtualenv environment each time you +use TensorFlow. If the virtualenv environment is not currently active, +invoke one of the following commands: + +
$ source ~/tensorflow/bin/activate      # bash
+$ source ~/tensorflow/bin/activate.csh  # csh 
+ +When the virtualenv environment is active, you may run +TensorFlow programs from this shell. Your prompt will become +the following to indicate that your tensorflow environment is active: + +
(tensorflow)$ 
+ +When you are done using TensorFlow, you may deactivate the +environment by invoking the `deactivate` function as follows: + +
(tensorflow)$ deactivate 
+ +The prompt will revert back to your default prompt (as defined by the +`PS1` environment variable). + + +### Uninstalling TensorFlow + +To uninstall TensorFlow, simply remove the tree you created. +For example: + +
$ rm -r targetDirectory 
+ + + +## Installing with native pip + +You may install TensorFlow through pip, choosing between a simple +installation procedure or a more complex one. + +**Note:** The +[REQUIRED_PACKAGES section of setup.py](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/pip_package/setup.py) +lists the TensorFlow packages that pip will install or upgrade. + + +### Prerequisite: Python and Pip + +Python is automatically installed on Ubuntu. +Take a moment to confirm (by issuing a `python -V` +command) that one of the following Python versions is already installed +on your system: + + * Python 2.7 + * Python 3.3+ + +The pip or pip3 package manager is *usually* installed on Ubuntu. +Take a moment to confirm (by issuing a `pip -V` or `pip3 -V` command) +that pip or pip3 is installed. We strongly recommend version 8.1 or higher +of pip or pip3. +If Version 8.1 or later is not installed, issue the following command, which +will either install the latest pip version or upgrade to it: + +
+$ sudo apt-get install python-pip python-dev
+
+ + +### Install TensorFlow + +Assuming the prerequisite software is installed on your Mac, +take the following steps: + + 1. Ensure proper protobuf dependencies by issuing one of the following + commands: + +
$ sudo pip uninstall tensorflow # for Python 2.7
+     $ sudo pip3 uninstall tensorflow # for Python 3.n
+ + 2. Install TensorFlow by invoking **one** of the following commands: + +
$ pip install tensorflow      # Python 2.7; CPU support (no GPU support)
+     $ pip3 install tensorflow     # Python 3.n; CPU support (no GPU support)
+     $ pip install tensorflow-gpu  # Python 2.7;  GPU support
+     $ pip3 install tensorflow-gpu # Python 3.n; GPU support 
+ + If the preceding command runs to completion, you should now + [validate your installation](#ValidateInstallation). + + 3. (Optional.) If Step 2 failed, install the latest version of TensorFlow + by issuing a command of the following format: + +
$ sudo pip  install --upgrade TF_BINARY_URL   # Python 2.7
+     $ sudo pip3 install --upgrade TF_BINARY_URL   # Python 3.N 
+ + where TF_BINARY_URL identifies the URL of the TensorFlow Python + package. The appropriate value of TF_BINARY_URL depends on the + operating system, Python version, and GPU support. Find the appropriate + For example, if you are installing TensorFlow for Linux, + Python version 3.4, and CPU-only support, the command to install + TensorFlow is as follows: + +
+     $ sudo pip3 install --upgrade \
+     https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0-py3-none-any.whl
+     
+ + If this step fails, see + [Common Installation Problems](#CommonInstallationProblems). + + +### Next Steps + +After installing TensorFlow, [validate your installation](#ValidateYourInstallation). + + +### Uninstalling TensorFlow + +To uninstall TensorFlow, issue one of following commands: + +
+$ sudo pip uninstall tensorflow  # for Python 2.7
+$ sudo pip3 uninstall tensorflow # for Python 3.n
+
+ + + +## Installing with Docker + +Take the following steps to install TensorFlow through Docker: + + 1. Install Docker on your machine as described in the + [Docker documentation](http://docs.docker.com/engine/installation/). + 2. Optionally, create a Docker group to allow launching containers + without sudo as described in the + [Docker documentation](https://docs.docker.com/engine/installation/linux/ubuntulinux/#/create-a-docker-group). + (If you don't do this step, you'll have to use sudo each time + you invoke Docker.) + 3. To install a version of TensorFlow that supports GPUs, you must first + install [nvidia-docker](https://github.com/NVIDIA/nvidia-docker), which + is stored in github. + 4. Launch a Docker container that contains one of the + [TensorFlow binary images](https://hub.docker.com/r/tensorflow/tensorflow/tags/). + +The remainder of this section explains how to launch a Docker container. + + +### CPU-only + +To launch a Docker container with CPU-only support (that is, without +GPU support), enter a command of the following format: + +
+$ docker run -it -p hostPort:containerPort TensorFlowCPUImage
+
+ +where: + + * -p hostPort:containerPort is optional. + If you plan to run TensorFlow programs from the shell, omit this option. + If you plan to run TensorFlow programs as Jupyter notebooks, set both + hostPort and containerPort + to 8888. If you'd like to run TensorBoard inside the container, + add a second `-p` flag, setting both hostPort and containerPort + to 6006. + * TensorFlowCPUImage is required. It identifies the Docker + container. Specify one of the following values: + * gcr.io/tensorflow/tensorflow, which is the TensorFlow CPU binary image. + * gcr.io/tensorflow/tensorflow:latest-devel, which is the latest + TensorFlow CPU Binary image plus source code. + * gcr.io/tensorflow/tensorflow:version, which is the + specified version (for example, 1.0.0) of TensorFlow CPU binary image. + * gcr.io/tensorflow/tensorflow:version-devel, which is + the specified version (for example, 1.0.0) of the TensorFlow GPU + binary image plus source code. + + gcr.io is the Google Container Registry. Note that some + TensorFlow images are also available at + [dockerhub](https://hub.docker.com/r/tensorflow/tensorflow/). + +For example, the following command launches the latest TensorFlow CPU binary image +in a Docker container from which you can run TensorFlow programs in a shell: + +
+$ docker run -it gcr.io/tensorflow/tensorflow bash
+
+ +The following command also launches the latest TensorFlow CPU binary image in a +Docker container. However, in this Docker container, you can run TensorFlow +programs in a Jupyter notebook: + +
+$ docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow
+
+ +Docker will download the TensorFlow binary image the first time you launch it. + + +### GPU support + +Prior to installing TensorFlow with GPU support, ensure that your system meets all +[NVIDIA software requirements](#NVIDIARequirements). To launch a Docker container +with NVidia GPU support, enter a command of the following format: + +
+$ nvidia-docker run -it -p hostPort:containerPort TensorFlowGPUImage
+
+ +where: + + * -p hostPort:containerPort is optional. If you plan + to run TensorFlow programs from the shell, omit this option. If you plan + to run TensorFlow programs as Jupyter notebooks, set both + hostPort and containerPort to `8888`. + * TensorFlowGPUImage specifies the Docker container. You must + specify one of the following values: + * gcr.io/tensorflow/tensorflow:latest-gpu, which is the latest + TensorFlow GPU binary image. + * gcr.io/tensorflow/tensorflow:latest-devel-gpu, which is + the latest TensorFlow GPU Binary image plus source code. + * gcr.io/tensorflow/tensorflow:version-gpu, which is the + specified version (for example, 0.12.1) of the TensorFlow GPU + binary image. + * gcr.io/tensorflow/tensorflow:version-devel-gpu, which is + the specified version (for example, 0.12.1) of the TensorFlow GPU + binary image plus source code. + +We recommend installing one of the `latest` versions. For example, the +following command launches the latest TensorFlow GPU binary image in a +Docker container from which you can run TensorFlow programs in a shell: + +
+$ nvidia-docker run -it gcr.io/tensorflow/tensorflow:latest-gpu bash
+
+ +The following command also launches the latest TensorFlow GPU binary image +in a Docker container. In this Docker container, you can run TensorFlow +programs in a Jupyter notebook: + +
+$ nvidia-docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow:latest-gpu
+
+ +The following command installs an older TensorFlow version (0.12.1): + +
+$ nvidia-docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow:0.12.1-gpu
+
+ +Docker will download the TensorFlow binary image the first time you launch it. +For more details see the +[TensorFlow docker readme](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/docker). + + +### Next Steps + +You should now +[validate your installation](#ValidateYourInstallation). + + + +## Installing with Anaconda + +Take the following steps to install TensorFlow in an Anaconda environment: + + 1. Follow the instructions on the + [Anaconda download site](https://www.continuum.io/downloads) + to download and install Anaconda. + + 2. Create a conda environment named tensorflow to run a version + of Python by invoking the following command: + + $ conda create -n tensorflow + + 3. Activate the conda environment by issuing the following command: + +
 $ source activate tensorflow
+     (tensorflow)$  # Your prompt should change 
+ + 4. Issue a command of the following format to install + TensorFlow inside your conda environment: + + (tensorflow)$ pip install --ignore-installed --upgrade TF_PYTHON_URL # Python 2.7 + + where TF_PYTHON_URL is the + [URL of the TensorFlow Python package](#TF_PYTHON_URL). For example, + the following command installs the CPU-only version of TensorFlow for + Python 3.4: + +
+     (tensorflow)$ pip install --ignore-installed --upgrade \
+     https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0-cp34-cp34m-linux_x86_64.whl
+     
+ + + +## Validate your installation + +To validate your TensorFlow installation, do the following: + + 1. Ensure that your environment is prepared to run TensorFlow programs. + 2. Run a short TensorFlow program. + + +### Prepare your environment + +If you installed on native pip, virtualenv, or Anaconda, then +do the following: + + 1. Start a terminal. + 2. If you installed with virtualenv or Anaconda, activate your container. + 3. If you installed TensorFlow source code, navigate to any + directory *except* one containing TensorFlow source code. + +If you installed through Docker, start a Docker container +from which you can run bash. For example: + +
+$ docker run -it gcr.io/tensorflow/tensorflow bash
+
+ + +### Run a short TensorFlow program + +Invoke python from your shell as follows: + +
+$ python
+
+ +Then, enter the following short program inside the python interactive shell: + +
+>>> import tensorflow as tf
+>>> hello = tf.constant('Hello, TensorFlow!')
+>>> sess = tf.Session()
+>>> print(sess.run(hello))
+
+ +If the system outputs the following, then you are ready to begin +running TensorFlow programs: + +
Hello, TensorFlow!
+ +If you are new to TensorFlow, see @{$get_started}. + +If the system outputs an error message instead of a greeting, see +[Common installation problems](#CommonInstallationProblems). + + + +## Common installation problems + +We are relying on Stack Overflow to document TensorFlow installation problems +and their remedies. The following table contains links to Stack Overflow +answers for some common installation problems. +If you encounter an error message or other +installation problem not listed in the following table, search for it +on Stack Overflow. If Stack Overflow doesn't show the error message, +ask a new question about it on Stack Overflow and specify +the `tensorflow` tag. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Stack Overflow Link Error Message
36159194
ImportError: libcudart.so.Version: cannot open shared object file:
+  No such file or directory
41991101
ImportError: libcudnn.Version: cannot open shared object file:
+  No such file or directory
36371137 and + here
libprotobuf ERROR google/protobuf/src/google/protobuf/io/coded_stream.cc:207] A
+  protocol message was rejected because it was too big (more than 67108864 bytes).
+  To increase the limit (or to disable these warnings), see
+  CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h.
35252888
Error importing tensorflow. Unless you are using bazel, you should
+  not try to import tensorflow from its source directory; please exit the
+  tensorflow source tree, and relaunch your python interpreter from
+  there.
33623453
IOError: [Errno 2] No such file or directory:
+  '/tmp/pip-o6Tpui-build/setup.py'
+
42006320
ImportError: Traceback (most recent call last):
+File ".../tensorflow/core/framework/graph_pb2.py", line 6, in 
+from google.protobuf import descriptor as _descriptor
+ImportError: cannot import name 'descriptor'
+
35190574
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
+  failed
42009190
+  Installing collected packages: setuptools, protobuf, wheel, numpy, tensorflow
+  Found existing installation: setuptools 1.1.6
+  Uninstalling setuptools-1.1.6:
+  Exception:
+  ...
+  [Errno 1] Operation not permitted:
+  '/tmp/pip-a1DXRT-uninstall/.../lib/python/_markerlib' 
36933958
+  ...
+  Installing collected packages: setuptools, protobuf, wheel, numpy, tensorflow
+  Found existing installation: setuptools 1.1.6
+  Uninstalling setuptools-1.1.6:
+  Exception:
+  ...
+  [Errno 1] Operation not permitted:
+  '/tmp/pip-a1DXRT-uninstall/System/Library/Frameworks/Python.framework/
+   Versions/2.7/Extras/lib/python/_markerlib'
+
+ + + +## The URL of the TensorFlow Python package + +A few installation mechanisms require the URL of the TensorFlow Python package. +The value you specify depends on three factors: + + * operating system + * Python version + * CPU only vs. GPU support + +This section documents the relevant values for Linux installations. + + +### Python 2.7 + +CPU only: + +
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0-cp27-none-linux_x86_64.whl
+
+ + +GPU support: + +
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0-cp27-none-linux_x86_64.whl
+
+ +Note that GPU support requires the NVIDIA hardware and software described in +[NVIDIA requirements to run TensorFlow with GPU support](#NVIDIARequirements). + + +### Python 3.4 + +CPU only: + +
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0-cp34-cp34m-linux_x86_64.whl
+
+ + +GPU support: + +
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0-cp34-cp34m-linux_x86_64.whl
+
+ +Note that GPU support requires the NVIDIA hardware and software described in +[NVIDIA requirements to run TensorFlow with GPU support](#NVIDIARequirements). + + +### Python 3.5 + +CPU only: + +
+https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0-cp35-cp35m-linux_x86_64.whl
+
+ + +GPU support: + +
+https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0-cp35-cp35m-linux_x86_64.whl
+
+ + +Note that GPU support requires the NVIDIA hardware and software described in +[NVIDIA requirements to run TensorFlow with GPU support](#NVIDIARequirements). + + + +### Protobuf pip package 3.1 + +You can skip this section unless you are seeing problems related +to the protobuf pip package. + +**NOTE:** If your TensorFlow programs are running slowly, you might +have a problem related to the protobuf pip package. + +The TensorFlow pip package depends on protobuf pip package version 3.1. The +protobuf pip package downloaded from PyPI (when invoking +pip install protobuf) is a Python-only library containing +Python implementations of proto serialization/deserialization that can run +**10x-50x slower** than the C++ implementation. Protobuf also supports a +binary extension for the Python package that contains fast +C++ based proto parsing. This extension is not available in the +standard Python-only pip package. We have created a custom binary +pip package for protobuf that contains the binary extension. To install +the custom binary protobuf pip package, invoke one of the following commands: + + * for Python 2.7: + +
+  $ pip install --upgrade \
+  https://storage.googleapis.com/tensorflow/linux/cpu/protobuf-3.1.0-cp27-none-linux_x86_64.whl
+  
+ + * for Python 3.5: + +
+  $ pip3 install --upgrade \
+  https://storage.googleapis.com/tensorflow/linux/cpu/protobuf-3.1.0-cp35-none-linux_x86_64.whl
+  
+ +Installing this protobuf package will overwrite the existing protobuf package. +Note that the binary pip package already has support for protobufs +larger than 64MB, which should fix errors such as these: + +
[libprotobuf ERROR google/protobuf/src/google/protobuf/io/coded_stream.cc:207]
+A protocol message was rejected because it was too big (more than 67108864 bytes).
+To increase the limit (or to disable these warnings), see
+CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h.
diff --git a/tensorflow/docs_src/install/install_mac.md b/tensorflow/docs_src/install/install_mac.md new file mode 100644 index 0000000000..6dc682c7d7 --- /dev/null +++ b/tensorflow/docs_src/install/install_mac.md @@ -0,0 +1,699 @@ +# Installing TensorFlow on Mac OS X + +This guide explains how to install TensorFlow on Mac OS X. + +## Determine which TensorFlow to install + +You must choose the type of TensorFlow to install. Your choices are as follows: + + * **TensorFlow with CPU support only**. If your system does not have a + NVIDIA CUDA® GPU, you should install this version. Note that TensorFlow + with CPU support is typically easier to install than TensorFlow with + GPU support. Therefore, even if you have an NVIDIA CUDA GPU, we recommend + installing this version first as a diagnostic step just in case you run + into problems installing TensorFlow with GPU support. + * **TensorFlow with GPU support**. TensorFlow programs typically run + significantly faster on a GPU than on a CPU. Therefore, if your system has + a NVIDIA CUDA GPU meeting the prerequisites shown below and you need + to run performance-critical applications, you should ultimately + install this version. + + +### Requirements to run TensorFlow with GPU support + +If you are installing TensorFlow with GPU support using one of the mechanisms +described in this guide, then the following NVIDIA software must be +installed on your system: + + + * CUDA Toolkit 8.0. For details, see + [NVIDIA's documentation](http://docs.nvidia.com/cuda/cuda-installation-guide-mac-os-x). + Ensure that you append the relevant CUDA pathnames to the + `LD_LIBRARY_PATH` environment variable as described in the + NVIDIA documentation. + * The NVIDIA drivers associated with CUDA Toolkit 8.0. + * cuDNN v5.1. For details, see + [NVIDIA's documentation](https://developer.nvidia.com/cudnn). + Ensure that you create the `CUDA_HOME` environment variable as described in + the NVIDIA documentation. + * GPU card with CUDA Compute Capability 3.0 or higher. See + [NVIDIA documentation](https://developer.nvidia.com/cuda-gpus) + for a list of supported GPU cards. + +If you have an earlier version of the preceding packages, please upgrade to +the specified versions. If upgrading is not possible, you may still run +TensorFlow with GPU support, but only if you do both of the following: + + * Install TensorFlow from sources (as described in + [Installing TensorFlow from Sources](install_sources.md). + * Install or upgrade to at least the following NVIDIA versions: + * CUDA toolkit 7.0 or greater + * cuDNN v3 or greater + * GPU card with CUDA Compute Capability 3.0 or higher. + + +## Determine how to install TensorFlow + +You must pick the mechanism by which you install TensorFlow. The supported choices are as follows: + + * virtualenv + * "native" pip + * Docker + * installing from sources, which is for experts and is documented in + a separate guide. + +**We recommend the virtualenv installation.** +[Virtualenv](https://virtualenv.pypa.io/en/stable/) +is a virtual Python environment isolated from other Python development, +incapable of interfering with or being affected by other Python programs +on the same machine. During the virtualenv installation process, +you will install not only TensorFlow but also all the packages that +TensorFlow requires. (This is actually pretty easy.) +To start working with TensorFlow, you simply need to "activate" the +virtual environment. All in all, virtualenv provides a safe and +reliable mechanism for installing and running TensorFlow. + +Native pip installs TensorFlow directly on your system without going through +any container or virtual environment system. Since a native pip installation +is not walled-off, the pip installation might interfere with or be influenced +by other Python-based installations on your system. Furthermore, you might need +to disable System Integrity Protection (SIP) in order to install through native +pip. However, if you understand SIP, pip, and your Python environment, a +native pip installation is relatively easy to perform. + +[Docker](http://docker.com/) completely isolates the TensorFlow installation +from pre-existing packages on your machine. The Docker container contains +TensorFlow and all its dependencies. Note that the Docker image can be quite +large (hundreds of MBs). You might choose the Docker installation if you are +incorporating TensorFlow into a larger application architecture that +already uses Docker. + +Important: Docker currently does not support TensorFlow with GPU support +on Mac OS; that is, on Mac OS, Docker only supports TensorFlow with +CPU support. + +In Anaconda, you may use conda to create a virtual environment. +However, within Anaconda, we recommend installing TensorFlow with the +`pip install` command, not with the `conda install` command. + +**NOTE:** The conda package is community supported, not officially supported. +That is, the TensorFlow team neither tests nor maintains the conda package. +Use that package at your own risk. + +## Installing with virtualenv + +Take the following steps to install TensorFlow with Virtualenv: + + 1. Start a terminal (a shell). You'll perform all subsequent steps + in this shell. + + 2. Install pip and virtualenv by issuing the following command: + +
+     $ sudo easy_install pip
+     $ sudo pip install --upgrade virtualenv
+     
+ + 3. Create a virtualenv environment by issuing a command of the + following format: + +
+     $ virtualenv --system-site-packages targetDirectory
+     
+ + The targetDirectory identifies the top of the virtualenv tree. + Our instructions assume that targetDirectory + is `~/tensorflow`, but you may choose any directory. + + 4. Activate the virtualenv environment by issuing one of the + following commands: + +
+     $ source ~/tensorflow/bin/activate      # If using bash, sh, ksh, or zsh
+     $ source ~/tensorflow/bin/activate.csh  # If using csh or tcsh
+     
+ + The preceding `source` command should change your prompt to the following: + +
+     (tensorflow)$
+     
+ + 5. If pip version 8.1 or later is installed on your system, issue one of + the following commands to install TensorFlow and all the packages that + TensorFlow requires into the active Virtualenv environment: + +
+     $ pip install --upgrade tensorflow      # for Python 2.7
+     $ pip3 install --upgrade tensorflow     # for Python 3.n
+     $ pip install --upgrade tensorflow-gpu  # for Python 2.7 and GPU
+     $ pip3 install --upgrade tensorflow-gpu # for Python 3.n and GPU
+     
+ + If the preceding command succeed, skip Step 6. If it failed, + perform Step 6. + + 6. Optional. If Step 5 failed (typically because you invoked a pip version + lower than 8.1), install TensorFlow in the active + virtualenv environment by issuing a command of the following format: + +
+     $ pip install --upgrade TF_BINARY_URL   # Python 2.7
+     $ pip3 install --upgrade TF_BINARY_URL  # Python 3.N
+     
+ + where TF_BINARY_URL identifies the URL + of the TensorFlow Python package. The appropriate value of + TF_BINARY_URL depends on the operating system, + Python version, and GPU support. Find the appropriate value for + TF_BINARY_URL for your system + [here](#TF_BINARY_URL). + For example, if you are installing TensorFlow for Mac OS X, + Python version 3.4, and CPU-only support, the command to install + TensorFlow in the active Virtualenv is as follows: + +
+     $ pip3 install --upgrade \
+     https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0-py3-none-any.whl
+     
+ +If you encounter installation problems, see +[Common Installation Problems](#CommonInstallationProblems). + + +### Next Steps + +After installing TensorFlow, +[validate your installation](#ValidateInstallation) +to confirm that the installation worked properly. + +Note that you must activate the virtualenv environment each time you +use TensorFlow in a new shell. If the virtualenv environment is not +currently active (that is, the prompt is not `(tensorflow)`, invoke +one of the following commands: + +
+$ source ~/tensorflow/bin/activate      # bash, sh, ksh, or zsh
+$ source ~/tensorflow/bin/activate.csh  # csh or tcsh
+
+ +Your prompt will transform to the following to indicate that your +tensorflow environment is active: + +
+(tensorflow)$
+
+ +When the virtualenv environment is active, you may run +TensorFlow programs from this shell. + +When you are done using TensorFlow, you may deactivate the +environment by issuing the following command: + +
+(tensorflow)$ deactivate
+
+ +The prompt will revert back to your default prompt (as defined by `PS1`). + + +### Uninstalling TensorFlow + +If you want to uninstall TensorFlow, simply remove the tree you created. For example: + +
+$ rm -r ~/tensorflow
+
+ + +## Installing with native pip + +We have uploaded the TensorFlow binaries to PyPI. +Therefore, you can install TensorFlow through pip. + +The +[REQUIRED_PACKAGES section of setup.py](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/pip_package/setup.py) +lists the packages that pip will install or upgrade. + + +### Prerequisite: Python + +In order to install TensorFlow, your system must contain one of the following Python versions: + + * Python 2.7 + * Python 3.3+ + +If your system does not already have one of the preceding Python versions, +[install](https://wiki.python.org/moin/BeginnersGuide/Download) it now. + +When installing Python, you might need to disable +System Integrity Protection (SIP) to permit any entity other than +Mac App Store to install software. + + +### Prerequisite: pip + +[Pip](https://en.wikipedia.org/wiki/Pip_(package_manager)) installs +and manages software packages written in Python. If you intend to install +with native pip, then one of the following flavors of pip must be +installed on your system: + + * `pip`, for Python 2.7 + * `pip3`, for Python 3.n. + +`pip` or `pip3` was probably installed on your system when you +installed Python. To determine whether pip or pip3 is actually +installed on your system, issue one of the following commands: + +
$ pip -V  # for Python 2.7
+$ pip3 -V # for Python 3.n 
+ +We strongly recommend pip or pip3 version 8.1 or higher in order +to install TensorFlow. If pip or pip3 8.1 or later is not +installed, issue the following commands to install or upgrade: + +
$ sudo easy_install --upgrade pip
+$ sudo easy_install --upgrade six 
+ + +### Install TensorFlow + +Assuming the prerequisite software is installed on your Mac, +take the following steps: + + 1. Ensure proper protobuf dependencies by issuing one of the following + commands: + +
$ sudo pip uninstall tensorflow # for Python 2.7
+     $ sudo pip3 uninstall tensorflow # for Python 3.n
+ + 2. Install TensorFlow by invoking **one** of the following commands: + +
$ pip install tensorflow      # Python 2.7; CPU support (no GPU support)
+     $ pip3 install tensorflow     # Python 3.n; CPU support (no GPU support)
+     $ pip install tensorflow-gpu  # Python 2.7;  GPU support
+     $ pip3 install tensorflow-gpu # Python 3.n; GPU support 
+ + If the preceding command runs to completion, you should now + [validate your installation](#ValidateInstallation). + + 3. (Optional.) If Step 2 failed, install the latest version of TensorFlow + by issuing a command of the following format: + +
$ sudo pip  install --upgrade TF_BINARY_URL   # Python 2.7
+     $ sudo pip3 install --upgrade TF_BINARY_URL   # Python 3.N 
+ + where TF_BINARY_URL identifies the URL of the TensorFlow Python + package. The appropriate value of TF_BINARY_URL depends on the + operating system, Python version, and GPU support. Find the appropriate + value for TF_BINARY_URL [here](#TF_BINARY_URL). For example, if + you are installing TensorFlow for Mac OS, Python version 3.4, and CPU-only + support, issue the following command: + +
+     $ sudo pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0-py3-none-any.whl
+     
+ + If the preceding command fails, see + [Common installation problems](#CommonInstallationProblems). + + + +### Next Steps + +After installing TensorFlow, +[validate your installation](#ValidateYourInstallation) +to confirm that the installation worked properly. + + +### Uninstalling TensorFlow + +To uninstall TensorFlow, issue one of following commands: + +
$ pip uninstall tensorflow
+$ pip3 uninstall tensorflow 
+ + +## Installing with Docker + +Follow these steps to install TensorFlow through Docker. + + 1. Install Docker on your machine as described in the + [Docker documentation](https://docs.docker.com/engine/installation/#/on-macos-and-windows). + + 2. Launch a Docker container that contains one of the TensorFlow + binary images. + +The remainder of this section explains how to launch a Docker container. + +**Note**: You can only launch a Docker container with CPU support. +(You cannot launch a Docker container with GPU support.) + +To launch a Docker container that holds the TensorFlow binary image, +enter a command of the following format: + +
+$ docker run -it -p hostPort:containerPort TensorFlowImage
+
+ +where: + + * -p hostPort:containerPort is optional. If you'd like to run + TensorFlow programs from the shell, omit this option. If you'd like + to run TensorFlow programs from Jupyter notebook, set both + hostPort and containerPort to 8888. + If you'd like to run TensorBoard inside the container, add + a second `-p` flag, setting both hostPort and containerPort + to 6006. + * TensorFlowImage is required. It identifies the Docker container. + You must specify one of the following values: + * gcr.io/tensorflow/tensorflow: TensorFlow binary image. + * gcr.io/tensorflow/tensorflow:latest-devel: TensorFlow + Binary image plus source code. + +gcr.io is the Google Container Registry. Note that some +TensorFlow images are also available at +[dockerhub](https://hub.docker.com/r/tensorflow/tensorflow/). + +For example, the following command launches a TensorFlow CPU binary image +in a Docker container from which you can run TensorFlow programs in a shell: + +
$ docker run -it gcr.io/tensorflow/tensorflow bash
+ +The following command also launches a TensorFlow CPU binary image in a +Docker container. However, in this Docker container, you can run +TensorFlow programs in a Jupyter notebook: + +
$ docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow
+ +Docker will download the TensorFlow binary image the first time you launch it. + + +### Next Steps + +You should now +[validate your installation](#ValidateInstallation). + + +## Installing with Anaconda + +**The Anaconda installation is community supported, not officially supported.** + +Take the following steps to install TensorFlow in an Anaconda environment: + + 1. Follow the instructions on the + [Anaconda download site](https://www.continuum.io/downloads) + to download and install Anaconda. + + 2. Create a conda environment named `tensorflow` + by invoking the following command: + +
$ conda create -n tensorflow
+ + 3. Activate the conda environment by issuing the following command: + +
$ source activate tensorflow
+     (tensorflow)$  # Your prompt should change
+ + 4. Issue a command of the following format to install + TensorFlow inside your conda environment: + +
(tensorflow)$ pip install --ignore-installed --upgrade $TF_PYTHON_URL 
+
+     where `TF_PYTHON_URL` is the
+     [URL of the TensorFlow Python package](#TF_PYTHON_URL).
+     For example, the following command installs the CPU-only version of
+     TensorFlow for Python 3.4:
+
+     
+     (tensorflow)$ pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0-py3-none-any.whl
+     
+ + + +## Validate your installation + +To validate your TensorFlow installation, do the following: + + 1. Ensure that your environment is prepared to run TensorFlow programs. + 2. Run a short TensorFlow program. + + +### Prepare your environment + +If you installed on native pip, virtualenv, or Anaconda, then +do the following: + + 1. Start a terminal. + 2. If you installed with virtualenv or Anaconda, activate your container. + 3. If you installed TensorFlow source code, navigate to any + directory *except* one containing TensorFlow source code. + +If you installed through Docker, start a Docker container that runs bash. +For example: + +
$ docker run -it gcr.io/tensorflow/tensorflow bash
+ + + +### Run a short TensorFlow program + +Invoke python from your shell as follows: + +
$ python
+ +Enter the following short program inside the python interactive shell: + +
>>> import tensorflow as tf
+>>> hello = tf.constant('Hello, TensorFlow!')
+>>> sess = tf.Session()
+>>> print(sess.run(hello))
+ +If the system outputs the following, then you are ready to begin +writing TensorFlow programs: + +
Hello, TensorFlow!
+ +If you are new to TensorFlow, see +@{$get_started$Getting Started with TensorFlow}. + +If the system outputs an error message instead of a greeting, see +[Common installation problems](#CommonInstallationProblems). + + + +## Common installation problems + +We are relying on Stack Overflow to document TensorFlow installation problems +and their remedies. The following table contains links to Stack Overflow +answers for some common installation problems. +If you encounter an error message or other +installation problem not listed in the following table, search for it +on Stack Overflow. If Stack Overflow doesn't show the error message, +ask a new question about it on Stack Overflow and specify +the `tensorflow` tag. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Stack Overflow Link Error Message
36159194
ImportError: libcudart.so.Version: cannot open shared object file:
+  No such file or directory
41991101
ImportError: libcudnn.Version: cannot open shared object file:
+  No such file or directory
42006320
ImportError: Traceback (most recent call last):
+File ".../tensorflow/core/framework/graph_pb2.py", line 6, in 
+from google.protobuf import descriptor as _descriptor
+ImportError: cannot import name 'descriptor'
+
33623453
IOError: [Errno 2] No such file or directory:
+  '/tmp/pip-o6Tpui-build/setup.py'
+
35190574
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
+  failed
42009190
+  Installing collected packages: setuptools, protobuf, wheel, numpy, tensorflow
+  Found existing installation: setuptools 1.1.6
+  Uninstalling setuptools-1.1.6:
+  Exception:
+  ...
+  [Errno 1] Operation not permitted:
+  '/tmp/pip-a1DXRT-uninstall/.../lib/python/_markerlib' 
33622019
ImportError: No module named copyreg
37810228During a `pip install` operation, the system returns: +
OSError: [Errno 1] Operation not permitted
+
33622842An import tensorflow` statement triggers an error such as the + following:
Traceback (most recent call last):
+  File "", line 1, in 
+  File "/usr/local/lib/python2.7/site-packages/tensorflow/__init__.py",
+    line 4, in 
+    from tensorflow.python import *
+    ...
+  File "/usr/local/lib/python2.7/site-packages/tensorflow/core/framework/tensor_shape_pb2.py",
+    line 22, in 
+    serialized_pb=_b('\n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"d\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x02
+      \x03(\x0b\x32
+      .tensorflow.TensorShapeProto.Dim\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01
+      \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tb\x06proto3')
+  TypeError: __init__() got an unexpected keyword argument 'syntax'
+
42073336An `import tensorflow` statement triggers the following error: +
+>>> import tensorflow as tf
+I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.dylib locally
+I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.dylib locally
+I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.dylib locally
+"import tensorflow" terminated by signal SIGSEGV (Address boundary error)
+
42075397A `pip install` command triggers the following error: +
...
+You have not agreed to the Xcode license agreements, please run
+'xcodebuild -license' (for user-level acceptance) or
+'sudo xcodebuild -license' (for system-wide acceptance) from within a
+Terminal window to review and agree to the Xcode license agreements.
+...
+  File "numpy/core/setup.py", line 653, in get_mathlib_info
+
+    raise RuntimeError("Broken toolchain: cannot link a simple C program")
+
+RuntimeError: Broken toolchain: cannot link a simple C program
+
+ + + + + +## The URL of the TensorFlow Python package + +A few installation mechanisms require the URL of the TensorFlow Python package. +The value you specify depends on three factors: + + * operating system + * Python version + * CPU only vs. GPU support + +This section documents the relevant values for Mac OS installations. + +### Python 2.7 + +CPU only: + +
+https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0-py2-none-any.whl
+
+ +GPU support: + +
+https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-1.0.0-py2-none-any.whl
+
+ +Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see +[Installing TensorFlow from Sources](install_sources.md). + + +### Python 3.4 or 3.5 + +CPU only: + +
+https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0-py3-none-any.whl
+
+ +GPU support: + +
+https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-1.0.0-py3-none-any.whl
+
+ +Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see +[Installing TensorFlow from Sources](install_sources.md). + + + + +### Protobuf pip package 3.1 + +You can skip this section unless you are seeing problems related +to the protobuf pip package. + +**NOTE:** If your TensorFlow programs are running slowly, you might +have a problem related to the protobuf pip package. + +The TensorFlow pip package depends on protobuf pip package version 3.1. The +protobuf pip package downloaded from PyPI (when invoking +pip install protobuf) is a Python-only library containing +Python implementations of proto serialization/deserialization that can run +**10x-50x slower** than the C++ implementation. Protobuf also supports a +binary extension for the Python package that contains fast +C++ based proto parsing. This extension is not available in the +standard Python-only pip package. We have created a custom binary +pip package for protobuf that contains the binary extension. To install +the custom binary protobuf pip package, invoke one of the following commands: + + * for Python 2.7: + +
+  $ pip install --upgrade \
+  https://storage.googleapis.com/tensorflow/linux/cpu/protobuf-3.1.0-cp27-none-linux_x86_64.whl
+  
+ + * for Python 3.5: + +
+  $ pip3 install --upgrade \
+  https://storage.googleapis.com/tensorflow/linux/cpu/protobuf-3.1.0-cp35-none-linux_x86_64.whl
+  
+ +Installing this protobuf package will overwrite the existing protobuf package. +Note that the binary pip package already has support for protobufs +larger than 64MB, which should fix errors such as these: + +
[libprotobuf ERROR google/protobuf/src/google/protobuf/io/coded_stream.cc:207]
+A protocol message was rejected because it was too big (more than 67108864 bytes).
+To increase the limit (or to disable these warnings), see
+CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h.
diff --git a/tensorflow/docs_src/install/install_sources.md b/tensorflow/docs_src/install/install_sources.md new file mode 100644 index 0000000000..0fdfe5e546 --- /dev/null +++ b/tensorflow/docs_src/install/install_sources.md @@ -0,0 +1,396 @@ +# Installing TensorFlow from Sources + +This guide explains how to build TensorFlow sources into a TensorFlow +binary and how to install that TensorFlow binary. Note that we provide +well-tested, pre-built TensorFlow binaries for Linux, Mac, and Windows +systems. In addition, there are pre-built TensorFlow +[docker images](https://hub.docker.com/r/tensorflow/tensorflow/). +So, don't build a TensorFlow binary yourself unless you are very +comfortable building complex packages from source and dealing with +the inevitable aftermath should things not go exactly as documented. + +If the last paragraph didn't scare you off, welcome. This guide explains +how to build TensorFlow on the following operating systems: + +* Ubuntu +* Mac OS X + +We don't officially support building TensorFlow on Windows; however, you may try +to build TensorFlow on Windows if you don't mind using the highly experimental +[Bazel on Windows](https://bazel.build/versions/master/docs/windows.html) +or +[TensorFlow CMake build](https://github.com/tensorflow/tensorflow/tree/r0.12/tensorflow/contrib/cmake). + + +## Determine which TensorFlow to install + +You must choose one of the following types of TensorFlow to build and +install: + +* **TensorFlow with CPU support only**. If your system does not have a + NVIDIA® GPU, build and install this version. Note that this version of + TensorFlow is typically easier to build and install, so even if you + have an NVIDIA GPU, we recommend building and installing this version + first. +* **TensorFlow with GPU support**. TensorFlow programs typically run + significantly faster on a GPU than on a CPU. Therefore, if your system + has a NVIDIA GPU and you need to run performance-critical applications, + you should ultimately build and install this version. + Beyond the NVIDIA GPU itself, your system must also fulfill the NVIDIA + software requirements described in one of the following documents: + + * @{$install_linux#NVIDIARequirements$Installing TensorFlow on Ubuntu} + * @{$install_mac#NVIDIARequirements$Installing TensorFlow on Mac OS} + + +## Clone the TensorFlow repository + +Start the process of building TensorFlow by cloning a TensorFlow +repository. + +To clone **the latest** TensorFlow repository, issue the following command: + +
$ git clone https://github.com/tensorflow/tensorflow 
+ +The preceding git clone command creates a subdirectory +named `tensorflow`. After cloning, you may optionally build a +**specific branch** (such as a release branch) by invoking the +following commands: + +
+$ cd tensorflow
+$ git checkout Branch # where Branch is the desired branch
+
+ +For example, to work with the `r1.0` release instead of the master release, +issue the following command: + +
$ git checkout r1.0
+ +Next, you must prepare your environment for +[Linux](#PrepareLinux) +or +[Mac OS](#PrepareMac) + + + +## Prepare environment for Linux + +Before building TensorFlow on Linux, install the following build +tools on your system: + + * bazel + * TensorFlow Python dependencies + * optionally, NVIDIA packages to support TensorFlow for GPU. + + +### Install Bazel + +If bazel is not installed on your system, install it now by following +[these directions](https://bazel.build/versions/master/docs/install.html). + + +### Install TensorFlow Python dependencies + +To install TensorFlow, you must install the following packages: + + * `numpy`, which is a numerical processing package that TensorFlow requires. + * `dev`, which enables adding extensions to Python. + * `pip`, which enables you to install and manage certain Python packages. + * `wheel`, which enables you to manage Python compressed packages in + the wheel (.whl) format. + +To install these packages for Python 2.7, issue the following command: + +
+$ sudo apt-get install python-numpy python-dev python-pip python-wheel
+
+ +To install these packages for Python 3.n, issue the following command: + +
+$ sudo apt-get install python3-numpy python3-dev python3-pip python3-wheel
+
+ + +### Optional: install TensorFlow for GPU prerequisites + +If you are building TensorFlow without GPU support, skip this section. + +The following NVIDIA hardware must be installed on your system: + + * GPU card with CUDA Compute Capability 3.0 or higher. See + [NVIDIA documentation](https://developer.nvidia.com/cuda-gpus) + for a list of supported GPU cards. + +The following NVIDIA software must be installed on your system: + + * NVIDIA's Cuda Toolkit (>= 7.0). We recommend version 8.0. + For details, see + [NVIDIA's documentation](http://docs.nvidia.com/cuda/cuda-installation-guide-linux/#axzz4VZnqTJ2A). + Ensure that you append the relevant Cuda pathnames to the + `LD_LIBRARY_PATH` environment variable as described in the + NVIDIA documentation. + * The NVIDIA drivers associated with NVIDIA's Cuda Toolkit. + * cuDNN (>= v3). We recommend version 5.1. For details, see + [NVIDIA's documentation](https://developer.nvidia.com/cudnn), + particularly the description of appending the appropriate pathname + to your `LD_LIBRARY_PATH` environment variable. + +Finally, you must also install `libcupti-dev` by invoking the following +command: + +
 $ sudo apt-get install libcupti-dev 
+ + +### Next + +After preparing the environment, you must now +[configure the installation](#ConfigureInstallation). + + + +## Prepare environment for Mac OS + +Before building TensorFlow, you must install the following on your system: + + * bazel + * TensorFlow Python dependencies. + * optionally, NVIDIA packages to support TensorFlow for GPU. + + +### Install bazel + +If bazel is not installed on your system, install it now by following +[these directions](https://bazel.build/versions/master/docs/install.html#mac-os-x). + + +### Install python dependencies + +To install TensorFlow, you must install the following packages: + + * six + * numpy, which is a numerical processing package that TensorFlow requires. + * wheel, which enables you to manage Python compressed packages + in the wheel (.whl) format. + +You may install the python dependencies using pip. If you don't have pip +on your machine, we recommend using homebrew to install Python and pip as +[documented here](http://docs.python-guide.org/en/latest/starting/install/osx/). +If you follow these instructions, you will not need to disable SIP. + +After installing pip, invoke the following commands: + +
 $ sudo pip install six numpy wheel 
+ + + +### Optional: install TensorFlow for GPU prerequisites + +If you do not have brew installed, install it by following +[these instructions](http://brew.sh/). + +After installing brew, install GNU coreutils by issuing the following command: + +
$ brew install coreutils
+ +If you want to compile tensorflow and have XCode 7.3 and CUDA 7.5 installed, +note that Xcode 7.3 is not yet compatible with CUDA 7.5. To remedy this +problem, do either of the following: + + * Upgrade to CUDA 8.0. + * Download Xcode 7.2 and select it as your default by issuing the following + command: + +
 $ sudo xcode-select -s /Application/Xcode-7.2/Xcode.app
+ +**NOTE:** Your system must fulfill the NVIDIA software requirements described +in one of the following documents: + + * @{$install_linux#NVIDIARequirements$Installing TensorFlow on Linux} + * @{$install_mac#NVIDIARequirements$Installing TensorFlow on Mac OS} + + + +## Configure the installation + +The root of the source tree contains a bash script named +configure. This script asks you to identify the pathname of all +relevant TensorFlow dependencies and specify other build configuration options +such as compiler flags. You must run this script *prior* to +creating the pip package and installing TensorFlow. + +If you wish to build TensorFlow with GPU, `configure` will ask +you to specify the version numbers of Cuda and cuDNN. If several +versions of Cuda or cuDNN are installed on your system, explicitly select +the desired version instead of relying on the system default. + +Here is an example execution of the `configure` script. Note that your +own input will likely differ from our sample input: + + +
+$ cd tensorflow  # cd to the top-level directory created
+$ ./configure
+Please specify the location of python. [Default is /usr/bin/python]: /usr/bin/python2.7
+Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]:
+Do you wish to use jemalloc as the malloc implementation? [Y/n]
+jemalloc enabled
+Do you wish to build TensorFlow with Google Cloud Platform support? [y/N]
+No Google Cloud Platform support will be enabled for TensorFlow
+Do you wish to build TensorFlow with Hadoop File System support? [y/N]
+No Hadoop File System support will be enabled for TensorFlow
+Do you wish to build TensorFlow with the XLA just-in-time compiler (experimental)? [y/N]
+No XLA JIT support will be enabled for TensorFlow
+Found possible Python library paths:
+  /usr/local/lib/python2.7/dist-packages
+  /usr/lib/python2.7/dist-packages
+Please input the desired Python library path to use.  Default is [/usr/local/lib/python2.7/dist-packages]
+Using python library path: /usr/local/lib/python2.7/dist-packages
+Do you wish to build TensorFlow with OpenCL support? [y/N] N
+No OpenCL support will be enabled for TensorFlow
+Do you wish to build TensorFlow with CUDA support? [y/N] Y
+CUDA support will be enabled for TensorFlow
+Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]:
+Please specify the Cuda SDK version you want to use, e.g. 7.0. [Leave empty to use system default]: 8.0
+Please specify the location where CUDA 8.0 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
+Please specify the cuDNN version you want to use. [Leave empty to use system default]: 5
+Please specify the location where cuDNN 5 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
+Please specify a list of comma-separated Cuda compute capabilities you want to build with.
+You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus.
+Please note that each additional compute capability significantly increases your build time and binary size.
+[Default is: "3.5,5.2"]: 3.0
+Setting up Cuda include
+Setting up Cuda lib
+Setting up Cuda bin
+Setting up Cuda nvvm
+Setting up CUPTI include
+Setting up CUPTI lib64
+Configuration finished
+
+ +If you told `configure` to build for GPU support, then `configure` +will create a canonical set of symbolic links to the Cuda libraries +on your system. Therefore, every time you change the Cuda library paths, +you must rerun the `configure` script before re-invoking +the bazel build command. + +Note the following: + + * Although it is possible to build both Cuda and non-Cuda configs + under the same source tree, we recommend running `bazel clean` when + switching between these two configurations in the same source tree. + * If you don't run the `configure` script *before* running the + `bazel build` command, the `bazel build` command will fail. + + +## Build the pip package + +To build a pip package for TensorFlow with CPU-only support, +invoke the following command: + +
+$ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
+
+ +To build a pip package for TensorFlow with GPU support, +invoke the following command: + +
$ bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package 
+ +Tip: By default, building TensorFlow from sources consumes +a lot of RAM. If RAM is an issue on your system, you may limit RAM usage +by specifying --local_resources 2048,.5,1.0 while +invoking `bazel`. + +The bazel build command builds a script named +`build_pip_package`. Running this script as follows will build +a `.whl` file within the `/tmp/tensorflow_pkg` directory: + +
+$ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
+
+ + +## Install the pip package + +Invoke `pip install` to install that pip package. +The filename of the `.whl `file depends on your platform. +For example, the following command will install the pip package +for TensorFlow 1.0.0 on Linux: + +
+$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.0.0-py2-none-any.whl
+
+ + + +## Validate your installation + +Validate your TensorFlow installation by doing the following: + + 1. Start a terminal. + + 2. Change directory (`cd`) to any directory on your system other than + the `tensorflow` subdirectory from which you invoked the `configure` + command. + + 3. Invoke python: + +
 $ python
+ + 4. Enter the following short program inside the python interactive shell: + +
>>> import tensorflow as tf
+  >>> hello = tf.constant('Hello, TensorFlow!')
+  >>> sess = tf.Session()
+  >>> print(sess.run(hello))
+ + If the Python program outputs the following, then the installation + is successful and you can begin writing TensorFlow programs. (If you + are new to TensorFlow, see *Getting Started with TensorFlow*): + +
Hello, TensorFlow!
+ + If the system generates an error message instead of a greeting, see + the next section. + + +## Common installation problems + +The installation problems you encounter typically depend on the +operating system. See the "Common installation problems" section +of one of the following guides: + + * @{$install_linux#CommonInstallationProblems$Installing TensorFlow on Linux} + * @{$install_mac#CommonInstallationProblems$Installing TensorFlow on Mac OS} + +Beyond the errors documented in those two guides, the following table +notes additional errors specific to building TensorFlow. Note that we +are relying on Stack Overflow as the repository for build and installation +problems. If you encounter an error message not listed in the preceding +two guides or in the following table, search for it on Stack Overflow. If +Stack Overflow doesn't show the error message, ask a new question on +Stack Overflow and specify the `tensorflow` tag. + + + + + + + + + + + + + + + + + + +
Stack Overflow Link Error Message
42013316
ImportError: libcudart.so.8.0: cannot open shared object file:
+  No such file or directory
42013316
ImportError: libcudnn.5: cannot open shared object file:
+  No such file or directory
35953210Invoking `python` or `ipython` generates the following error: +
ImportError: cannot import name pywrap_tensorflow
diff --git a/tensorflow/docs_src/install/install_windows.md b/tensorflow/docs_src/install/install_windows.md new file mode 100644 index 0000000000..570ac99c3a --- /dev/null +++ b/tensorflow/docs_src/install/install_windows.md @@ -0,0 +1,197 @@ +# Installing TensorFlow on Windows + +This guide explains how to install TensorFlow on Windows. + +## Determine which TensorFlow to install + +You must choose one of the following types of TensorFlow to install: + + * **TensorFlow with CPU support only**. If your system does not have a + NVIDIA® GPU, you must install this version. Note that this version of + TensorFlow is typically much easier to install (typically, + in 5 or 10 minutes), so even if you have an NVIDIA GPU, we recommend + installing this version first. + * **TensorFlow with GPU support**. TensorFlow programs typically run + significantly faster on a GPU than on a CPU. Therefore, if your + system has a NVIDIA® GPU meeting the prerequisites shown below + and you need to run performance-critical applications, you should + ultimately install this version. + +### Requirements to run TensorFlow with GPU support + +If you are installing TensorFlow with GPU support using one of the mechanisms +described in this guide, then the following NVIDIA software must be +installed on your system: + + * CUDA® Toolkit 8.0. For details, see + [NVIDIA's + documentation](http://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/) + Ensure that you append the relevant Cuda pathnames to the `%PATH%` + environment variable as described in the NVIDIA documentation. + * The NVIDIA drivers associated with CUDA Toolkit 8.0. + * cuDNN v5.1. For details, see + [NVIDIA's documentation](https://developer.nvidia.com/cudnn). + Note that cuDNN is typically installed in a different location from the + other CUDA DLLs. Ensure that you add the directory where you installed + the cuDNN DLL to your `%PATH%` environment variable. + * GPU card with CUDA Compute Capability 3.0 or higher. See + [NVIDIA documentation](https://developer.nvidia.com/cuda-gpus) for a + list of supported GPU cards. + +If you have an earlier version of the preceding packages, please +upgrade to the specified versions. + + +## Determine how to install TensorFlow + +You must pick the mechanism by which you install TensorFlow. The +supported choices are as follows: + + * "native" pip + * Anaconda + +Native pip installs TensorFlow directly on your system without going +through a virtual environment. Since a native pip installation is not +walled-off in a separate container, the pip installation might interfere +with other Python-based installations on your system. However, if you +understand pip and your Python environment, a native pip installation +often entails only a single command! Furthermore, if you install with +native pip, users can run TensorFlow programs from any directory on +the system. + +In Anaconda, you may use conda to create a virtual environment. +However, within Anaconda, we recommend installing TensorFlow with the +`pip install` command, not with the `conda install` command. + +**NOTE:** The conda package is community supported, not officially supported. +That is, the TensorFlow team neither tests nor maintains this conda package. +Use that package at your own risk. + + +## Installing with native pip + +If the following version of Python is not installed on your machine, +install it now: + + * [Python 3.5.x from python.org](https://www.python.org/downloads/release/python-352/) + +TensorFlow only supports version 3.5.x of Python on Windows. +Note that Python 3.5.x comes with the pip3 package manager, which is the +program you'll use to install TensorFlow. + +To install TensorFlow, start a terminal. Then issue the appropriate +pip3 install command in that terminal. To install the CPU-only +version of TensorFlow, enter the following command: + +
C:\> pip3 install --upgrade tensorflow
+ +To install the GPU version of TensorFlow, enter the following command: + +
C:\> pip3 install --upgrade tensorflow-gpu
+ + +## Installing with Anaconda + +**The Anaconda installation is community supported, not officially supported.** + +Take the following steps to install TensorFlow in an Anaconda environment: + + 1. Follow the instructions on the + [Anaconda download site](https://www.continuum.io/downloads) + to download and install Anaconda. + + 2. Create a conda environment named tensorflow + by invoking the following command: + +
C:\> conda create -n tensorflow 
+ + 3. Activate the conda environment by issuing the following command: + +
C:\> activate tensorflow
+     (tensorflow)C:\>  # Your prompt should change 
+ + 4. Issue the appropriate command to install TensorFlow inside your conda + environment. To install the CPU-only version of TensorFlow, enter the + following command: + +
(tensorflow)C:\> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.0-cp35-cp35m-win_x86_64.whl 
+ + To install the GPU version of TensorFlow, enter the following command + (on a single line): + +
(tensorflow)C:\> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.0.0-cp35-cp35m-win_x86_64.whl 
+ + +## Validate your installation + +Validate your TensorFlow installation by doing the following: + + 1. Start a terminal. + 2. If you installed through Anaconda, activate your Anaconda environment. + 3. Inside that terminal, invoke python: + +
C:\> python 
+ + 4. Enter the following short program inside the python interactive shell: + +
>>> import tensorflow as tf
+     >>> hello = tf.constant('Hello, TensorFlow!')
+     >>> sess = tf.Session()
+     >>> print(sess.run(hello))
+     
+ + If the Python program outputs the following, then the installation + is successful and you can begin writing TensorFlow programs. (If you + are new to TensorFlow, see + @{$get_started$Getting Started with TensorFlow}.) + +
Hello, TensorFlow!
+ + If the system generates an error message instead of a greeting, + see the next section. + + +## Common installation problems + +We are relying on Stack Overflow to document TensorFlow installation problems +and their remedies. The following table contains links to Stack Overflow +answers for some common installation problems. +If you encounter an error message or other +installation problem not listed in the following table, search for it +on Stack Overflow. If Stack Overflow doesn't show the error message, +ask a new question about it on Stack Overflow and specify +the `tensorflow` tag. + + + + + + + + + + + + + + + + + + + + + + + + +
Stack Overflow Link Error Message
41007279 +
[...\stream_executor\dso_loader.cc] Couldn't open CUDA library nvcuda.dll
+
41007279 +
[...\stream_executor\cuda\cuda_dnn.cc] Unable to load cuDNN DSO
+
42006320
ImportError: Traceback (most recent call last):
+File "...\tensorflow\core\framework\graph_pb2.py", line 6, in 
+from google.protobuf import descriptor as _descriptor
+ImportError: cannot import name 'descriptor'
+
42011070
No module named "pywrap_tensorflow"
+ diff --git a/tensorflow/docs_src/install/leftnav_files b/tensorflow/docs_src/install/leftnav_files new file mode 100644 index 0000000000..d7b26bcd01 --- /dev/null +++ b/tensorflow/docs_src/install/leftnav_files @@ -0,0 +1,5 @@ +install_linux.md +install_mac.md +install_windows.md +install_sources.md +migration.md diff --git a/tensorflow/docs_src/install/migration.md b/tensorflow/docs_src/install/migration.md new file mode 100644 index 0000000000..29576b50ec --- /dev/null +++ b/tensorflow/docs_src/install/migration.md @@ -0,0 +1,337 @@ + +# Transitioning to TensorFlow 1.0 + + +The APIs in TensorFlow 1.0 have changed in ways that are not all backwards +compatible. That is, TensorFlow programs that worked on TensorFlow 0.n won't +necessarily work on TensorFlow 1.0. We have made this API changes to ensure an +internally-consistent API, and do not plan to make backwards-breaking changes +throughout the 1.N lifecycle. + +This guide walks you through the major changes in the API and how to +automatically upgrade your programs for TensorFlow 1.0. This guide not +only steps you through the changes but also explains why we've made them. + +## How to upgrade + +If you would like to automatically port your code to 1.0, you can try our +`tf_upgrade.py` script. While this script handles many cases, manual changes +are sometimes necessary. + Get this script from our +[GitHub tree](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/compatibility). + +To convert a single 0.n TensorFlow source file to 1.0, enter a +command of the following format: + +
+$ python tf_upgrade.py --infile InputFile --outfile OutputFile
+
+ +For example, the following command converts a 0.n TensorFlow +program named `test.py` to a 1.0 TensorFlow program named `test_1.0.py`: + +
+$ python tf_upgrade.py --infile test.py --outfile test_1.0.py
+
+ +The `tf_upgrade.py` script also generates a file named `report.txt`, which +details all the changes it performed and makes additional suggestions about +changes you might need to make manually. + +To upgrade a whole directory of 0.n TensorFlow programs to 1.0, +enter a command having the following format: + +
+$ python tf_upgrade.py --intree InputDir --outtree OutputDir
+
+ +For example, the following command converts all the 0.n TensorFlow programs +in the `/home/user/cool` directory, creating their 1.0 equivalents in +the `/home/user/cool_1.0` directory: + +
+$ python tf_upgrade.py --intree /home/user/cool --outtree /home/user/cool_1.0
+
+ +### Limitations + +There are a few things to watch out for. Specifically: + + * You must manually fix any instances of `tf.reverse()`. + The `tf_upgrade.py` script will warn you about `tf.reverse()` in + stdout and in the `report.txt` file. + * On reordered arguments, `tf_upgrade.py` tries to minimally reformat + your code, so it cannot automatically change the actual argument order. + Instead, `tf_upgrade.py` makes your function invocations order-independent + by introducing keyword arguments. + * Constructions like `tf.get_variable_scope().reuse_variables()` + will likely not work. We recommend deleting those lines and replacing + them with lines such as the following: + +
+   with tf.variable_scope(tf.get_variable_scope(), reuse=True):
+     ...
+   
+ + * Analogously to `tf.pack` and `tf.unpack`, we're renamed + `TensorArray.pack` and `TensorArray.unpack` to + `TensorArray.stack` and `TensorArray.unstack`. However, `TensorArray.pack` + and `TensorArray.unpack` cannot be detected lexically since they are + indirectly related to the `tf` namespace e.g. + `foo = tf.TensorArray(); foo.unpack()` + +## Upgrading your code manually + +Instead of running `tf_upgrade.py`, you may manually upgrade your code. +The remainder of this document provides a comprehensive list of +all backward incompatible changes made in TensorFlow 1.0. + + +### Variables + +Variable functions have been made more consistent and less confusing. + +* `tf.VARIABLES` + * should be renamed to `tf.GLOBAL_VARIABLES` +* `tf.all_variables` + * should be renamed to `tf.global_variables` +* `tf.initialize_all_variables` + * should be renamed to `tf.global_variables_initializer` +* `tf.initialize_local_variables` + * should be renamed to `tf.local_variables_initializer` +* `tf.initialize_variables` + * should be renamed to `tf.variables_initializer` + +### Summary functions + +Summary functions have been consolidated under the `tf.summary` namespace. + +* `tf.audio_summary` + * should be renamed to `tf.summary.audio` +* `tf.contrib.deprecated.histogram_summary` + * should be renamed to `tf.summary.histogram` +* `tf.contrib.deprecated.scalar_summary` + * should be renamed to `tf.summary.scalar` +* `tf.histogram_summary` + * should be renamed to `tf.summary.histogram` +* `tf.image_summary` + * should be renamed to `tf.summary.image` +* `tf.merge_all_summaries` + * should be renamed to `tf.summary.merge_all` +* `tf.merge_summary` + * should be renamed to `tf.summary.merge` +* `tf.scalar_summary` + * should be renamed to `tf.summary.scalar` +* `tf.train.SummaryWriter` + * should be renamed to `tf.summary.FileWriter` + +### Numeric differences + + +Integer division and `tf.floordiv` now uses flooring semantics. This is to +make the results of `np.divide` and `np.mod` consistent with `tf.divide` and +`tf.mod`, respectively. In addition we have changed the rounding algorithm +used by `tf.round` to match NumPy. + + +* `tf.div` + + * The semantics of `tf.divide` division have been changed to match Python +semantics completely. That is, `/` in Python 3 and future division mode in +Python 2 will produce floating point numbers always, `//` will produce floored +division. However, even `tf.div` will produce floored integer division. +To force C-style truncation semantics, you must use `tf.truncatediv`. + + * Consider changing your code to use `tf.divide`, which follows Python semantics for promotion. + +* `tf.mod` + + * The semantics of `tf.mod` have been changed to match Python semantics. In +particular, flooring semantics are used for integers. If you wish to have +C-style truncation mod (remainders), you can use `tf.truncatemod` + + +The old and new behavior of division can be summarized with this table: + +| Expr | TF 0.11 (py2) | TF 0.11 (py3) | TF 1.0 (py2) | TF 1.0 (py3) | +|---------------------|---------------|---------------|--------------|--------------| +| tf.div(3,4) | 0 | 0 | 0 | 0 | +| tf.div(-3,4) | 0 | 0 | -1 | -1 | +| tf.mod(-3,4) | -3 | -3 | 1 | 1 | +| -3/4 | 0 | -0.75 | -1 | -0.75 | +| -3/4tf.divide(-3,4) | N/A | N/A | -0.75 | -1 | + +The old and new behavior of rounding can be summarized with this table: + +| Input | Python | NumPy | C++ round() | TensorFlow 0.11(floor(x+.5)) | TensorFlow 1.0 | +|-------|--------|-------|-------------|------------------------------|----------------| +| -3.5 | -4 | -4 | -4 | -3 | -4 | +| -2.5 | -2 | -2 | -3 | -2 | -2 | +| -1.5 | -2 | -2 | -2 | -1 | -2 | +| -0.5 | 0 | 0 | -1 | 0 | 0 | +| 0.5 | 0 | 0 | 1 | 1 | 0 | +| 1.5 | 2 | 2 | 2 | 2 | 2 | +| 2.5 | 2 | 2 | 3 | 3 | 2 | +| 3.5 | 4 | 4 | 4 | 4 | 4 | + + + +### NumPy matching names + + +Many functions have been renamed to match NumPy. This was done to make the +transition between NumPy and TensorFlow as easy as possible. There are still +numerous cases where functions do not match, so this is far from a hard and +fast rule, but we have removed several commonly noticed inconsistencies. + +* `tf.inv` + * should be renamed to `tf.reciprocal` + * This was done to avoid confusion with NumPy's matrix inverse `np.inv` +* `tf.list_diff` + * should be renamed to `tf.setdiff1d` +* `tf.listdiff` + * should be renamed to `tf.setdiff1d` +* `tf.mul` + * should be renamed to `tf.multiply` +* `tf.neg` + * should be renamed to `tf.negative` +* `tf.select` + * should be renamed to `tf.where` + * `tf.where` now takes 3 arguments or 1 argument, just like `np.where` +* `tf.sub` + * should be renamed to `tf.subtract` + +### NumPy matching arguments + +Arguments for certain TensorFlow 1.0 methods now match arguments in certain +NumPy methods. To achieve this, TensorFlow 1.0 has changed keyword arguments +and reordered some arguments. Notably, TensorFlow 1.0 now uses `axis` rather +than `dimension`. TensorFlow 1.0 aims to keep the tensor argument first on +operations that modify Tensors. (see the `tf.concat` change). + + +* `tf.argmax` + * keyword argument `dimension` should be renamed to `axis` +* `tf.argmin` + * keyword argument `dimension` should be renamed to `axis` +* `tf.concat` + * keyword argument `concat_dim` should be renamed to `axis` + * arguments have been reordered to `tf.concat(values, axis, name='concat')`. +* `tf.count_nonzero` + * keyword argument `reduction_indices` should be renamed to `axis` +* `tf.expand_dims` + * keyword argument `dim` should be renamed to `axis` +* `tf.reduce_all` + * keyword argument `reduction_indices` should be renamed to `axis` +* `tf.reduce_any` + * keyword argument `reduction_indices` should be renamed to `axis` +* `tf.reduce_join` + * keyword argument `reduction_indices` should be renamed to `axis` +* `tf.reduce_logsumexp` + * keyword argument `reduction_indices` should be renamed to `axis` +* `tf.reduce_max` + * keyword argument `reduction_indices` should be renamed to `axis` +* `tf.reduce_mean` + * keyword argument `reduction_indices` should be renamed to `axis` +* `tf.reduce_min` + * keyword argument `reduction_indices` should be renamed to `axis` +* `tf.reduce_prod` + * keyword argument `reduction_indices` should be renamed to `axis` +* `tf.reduce_sum` + * keyword argument `reduction_indices` should be renamed to `axis` +* `tf.reverse` + * `tf.reverse` used to take a 1D `bool` tensor to control which dimensions were reversed. Now we use a Tensor of axis indices. + * For example `tf.reverse(a, [True, False, True])` now must be `tf.reverse(a, [0, 2])` +* `tf.reverse_sequence` + * keyword argument `batch_dim` should be renamed to `batch_axis` + * keyword argument `seq_dim` should be renamed to `seq_axis` +* `tf.sparse_concat` + * keyword argument `concat_dim` should be renamed to `axis` +* `tf.sparse_reduce_sum` + * keyword argument `reduction_axes` should be renamed to `axis` +* `tf.sparse_reduce_sum_sparse` + * keyword argument `reduction_axes` should be renamed to `axis` +* `tf.sparse_split` + * keyword argument `split_dim` should be renamed to `axis` + * arguments have been reordered to `tf.sparse_split(keyword_required=KeywordRequired(), sp_input=None, num_split=None, axis=None, name=None, split_dim=None)`. +* `tf.split` + * keyword argument `split_dim` should be renamed to `axis` + * keyword argument `num_split` should be renamed to `num_or_size_splits` + * arguments have been reordered to `tf.split(value, num_or_size_splits, axis=0, num=None, name='split')`. +* `tf.squeeze` + * keyword argument `squeeze_dims` should be renamed to `axis` +* `tf.svd` + * arguments have been reordered to `tf.svd(tensor, full_matrices=False, compute_uv=True, name=None)`. + +### Simplified math variants + +Batched versions of math operations have been removed. Now the functionality is +contained in the non-batched versions. Similarly,`tf.complex_abs` has had its +functionality moved to `tf.abs` + +* `tf.batch_band_part` + * should be renamed to `tf.band_part` +* `tf.batch_cholesky` + * should be renamed to `tf.cholesky` +* `tf.batch_cholesky_solve` + * should be renamed to `tf.cholesky_solve` +* `tf.batch_fft` + * should be renamed to `tf.fft` +* `tf.batch_fft3d` + * should be renamed to `tf.fft3d` +* `tf.batch_ifft` + * should be renamed to `tf.ifft` +* `tf.batch_ifft2d` + * should be renamed to `tf.ifft2d` +* `tf.batch_ifft3d` + * should be renamed to `tf.ifft3d` +* `tf.batch_matmul` + * should be renamed to `tf.matmul` +* `tf.batch_matrix_determinant` + * should be renamed to `tf.matrix_determinant` +* `tf.batch_matrix_diag` + * should be renamed to `tf.matrix_diag` +* `tf.batch_matrix_inverse` + * should be renamed to `tf.matrix_inverse` +* `tf.batch_matrix_solve` + * should be renamed to `tf.matrix_solve` +* `tf.batch_matrix_solve_ls` + * should be renamed to `tf.matrix_solve_ls` +* `tf.batch_matrix_transpose` + * should be renamed to `tf.matrix_transpose` +* `tf.batch_matrix_triangular_solve` + * should be renamed to `tf.matrix_triangular_solve` +* `tf.batch_self_adjoint_eig` + * should be renamed to `tf.self_adjoint_eig` +* `tf.batch_self_adjoint_eigvals` + * should be renamed to `tf.self_adjoint_eigvals` +* `tf.batch_set_diag` + * should be renamed to `tf.set_diag` +* `tf.batch_svd` + * should be renamed to `tf.svd` +* `tf.complex_abs` + * should be renamed to `tf.abs` + +### Misc Changes + +Several other changes have been made, including the following: + +* `tf.image.per_image_whitening` + * should be renamed to `tf.image.per_image_standardization` +* `tf.nn.sigmoid_cross_entropy_with_logits` + * arguments have been reordered to `tf.nn.sigmoid_cross_entropy_with_logits(_sentinel=None, labels=None, logits=None, name=None)`. +* `tf.nn.softmax_cross_entropy_with_logits` + * arguments have been reordered to `tf.nn.softmax_cross_entropy_with_logits(_sentinel=None, labels=None, logits=None, dim=-1, name=None)`. +* `tf.nn.sparse_softmax_cross_entropy_with_logits` + * arguments have been reordered to `tf.nn.sparse_softmax_cross_entropy_with_logits(_sentinel=None, labels=None, logits=None, name=None)`. +* `tf.ones_initializer` + * should be changed to a function call i.e. `tf.ones_initializer()` +* `tf.pack` + * should be renamed to `tf.stack` +* `tf.round` + * The semantics of `tf.round` now match Banker's rounding. +* `tf.unpack` + * should be renamed to `tf.unstack` +* `tf.zeros_initializer` + * should be changed to a function call i.e. `tf.zeros_initializer()` + diff --git a/tensorflow/g3doc/experimental/leftnav_files b/tensorflow/docs_src/performance/leftnav_files similarity index 66% rename from tensorflow/g3doc/experimental/leftnav_files rename to tensorflow/docs_src/performance/leftnav_files index 489f3a846a..0f30cc7fa5 100644 --- a/tensorflow/g3doc/experimental/leftnav_files +++ b/tensorflow/docs_src/performance/leftnav_files @@ -1,8 +1,9 @@ -### XLA +performance_guide.md xla/index.md -xla/jit.md -xla/tfcompile.md +xla/broadcasting.md xla/developing_new_backend.md +xla/jit.md xla/operation_semantics.md xla/shapes.md -xla/broadcasting.md \ No newline at end of file +xla/tfcompile.md +quantization.md diff --git a/tensorflow/docs_src/performance/performance_guide.md b/tensorflow/docs_src/performance/performance_guide.md new file mode 100644 index 0000000000..8a1bba883a --- /dev/null +++ b/tensorflow/docs_src/performance/performance_guide.md @@ -0,0 +1,143 @@ +# Performance + +This guide contains a collection of best practices for optimizing your +TensorFlow code. The best practices apply to both new and experienced +Tensorflow users. + +## Best Practices +While optimizing implementations of different types of models can be different, +the topics below cover best practices to get the most performance from +TensorFlow. Although these suggestions focus on image-based models, we will +regularly add tips for all kinds of models. The following list highlights key +best practices: + +* Build and install from source +* Utilize queues for reading data +* Preprocessing on the CPU +* Use `NCHW` image data format +* Place shared parameters on the GPU +* Use fused batch norm + +The following sections detail the preceding suggestions. + +### Build and install from source + +To install the most optimized version of TensorFlow, build and install +TensorFlow from source by following [Installing TensorFlow from Source](../install/install_sources). +Building from source with compiler optimizations for the target hardware and +ensuring the latest CUDA platform and cuDNN libraries are installed results in +the highest performing installs. + +For the most stable experience, build from the [latest release](https://github.com/tensorflow/tensorflow/releases) +branch. To get the latest performance changes and accept some stability risk, +build from [master](https://github.com/tensorflow/tensorflow). + +If there is a need to build TensorFlow on a platform that has different hardware +than the target, then cross-compile with the highest optimizations for the target +platform. The following command is an example of telling `bazel` to compile for +a specific platform: + +```python +# This command optimizes for Intel’s Broadwell processor +bazel build -c opt --copt=-march="broadwell" --config=cuda //tensorflow/tools/pip_package:build_pip_package + +``` + +#### Environment, build, and install tips + +* Compile with the highest level of compute the [GPU + supports](http://developer.nvidia.com/cuda-gpus), e.g. P100: 6.0, Titan X + (pascal): 6.2, Titan X (maxwell): 5.2, and K80: 3.7. +* Install the latest CUDA platform and cuDNN libraries. +* Make sure to use a version of gcc that supports all of the optimizations of + the target CPU. The recommended minimum gcc version is 4.8.3. +* TensorFlow checks on startup whether it has been compiled with the + optimizations available on the CPU. If the optimizations are not included, + TensorFlow will emit warnings, e.g. AVX, AVX2, and FMA instructions not + included. + +### Utilize queues for reading data + +One common cause of poor performance is underutilizing GPUs, or essentially +"starving" them of data by not setting up an efficient pipeline. Make sure to +set up an input pipeline to utilize queues and stream data effectively. Review +the @{$reading_data#reading_from_files$Reading Data guide} for implementation +details. One way to identify a "starved" GPU is to generate and review +timelines. A detailed tutorial for timelines does not exist, but a quick example +of generating a timeline exists as part of the @{$jit$XLA JIT} tutorial. Another +simple way to check if a GPU is underutilized is to run `watch nvidia-smi`, and +if GPU utilization is not approaching 100% then the GPU is not getting data fast +enough. + +Unless for a special circumstance or for example code, do not feed data +into the session from Python variables, e.g. `dictionary`. + +```python +# This will result in poor performance. +sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys}) +``` + +### Preprocessing on the CPU + +Placing preprocessing operations on the CPU can significantly improve +performance. When preprocessing occurs on the GPU the flow of data is +CPU -> GPU (preprocessing) -> CPU -> GPU (training). The data is bounced back +and forth between the CPU and GPU. When preprocessing is placed on the CPU, +the data flow is CPU (preprocessing) -> GPU (training). Another benefit is +preprocessing on the CPU frees GPU time to focus on training. + +Placing preprocessing on the CPU can result in a 6X+ increase in samples/sec +processed, which could lead to training in 1/6th of the time. To ensure +preprocessing is on the CPU, wrap the preprocessing operations as shown below: + +```python +with tf.device('/cpu:0'): + # function to get and process images or data. + distorted_inputs = load_and_distort_images() +``` + +### Use large files + +Under some circumstances, both the CPU and GPU can be starved for data by the +I/O system. If you are using many small files to form your input data set, you +may be limited by the speed of your filesystem. If your training loop runs +faster when using SSDs vs HDDs for storing your input data, you could could be +I/O bottlenecked. + +If this is the case, you should pre-process your input data, creating a few +large TFRecord files. + +### Use NCHW image data format + +Image data format refers to the representation of batches of images. TensorFlow +supports `NHWC` (TensorFlow default) and `NCHW` (cuDNN default). N refers to the +number of images in a batch, H refers to the number of pixels in the vertical +dimension, W refers to the number of pixels in the horizontal dimension, and C +refers to the channels (e.g. 1 for black and white, 3 for RGB, etc.) Although +cuDNN can operate on both formats, it is faster to operate in its default +format. + +The best practice is to build models that work with both `NCHW` and `NHWC` as it +is common to train using `NCHW` on GPU, and then do inference with NHWC on CPU. + +The very brief history of these two formats is that TensorFlow started by using +`NHWC` because it was a little faster on CPUs. Then the TensorFlow team +discovered that `NCHW` performs better when using the NVIDIA cuDNN library. The +current recommendation is that users support both formats in their models. In +the long term, we plan to rewrite graphs to make switching between the formats +transparent. + +### Use fused batch norm + +When using batch norm +@{tf.contrib.layers.batch_norm} set the attribute `fused=True`: + +```python +bn = tf.contrib.layers.batch_norm( + input_layer, fused=True, data_format='NCHW' + scope=scope, **kwargs) +``` + +The non-fused batch norm does computations using several individual Ops. Fused +batch norm combines the individual operations into a single kernel, which runs +faster. diff --git a/tensorflow/g3doc/how_tos/quantization/index.md b/tensorflow/docs_src/performance/quantization.md similarity index 98% rename from tensorflow/g3doc/how_tos/quantization/index.md rename to tensorflow/docs_src/performance/quantization.md index fa61cadcea..878371f674 100644 --- a/tensorflow/g3doc/how_tos/quantization/index.md +++ b/tensorflow/docs_src/performance/quantization.md @@ -143,13 +143,13 @@ conversion functions before and after to move the data between float and eight-bit. Below is an example of what they look like. First here's the original Relu operation, with float inputs and outputs: -![Relu Diagram](https://www.tensorflow.org/images/quantization0.png) +![Relu Diagram](https://www.tensorflow.org/../images/quantization0.png) Then, this is the equivalent converted subgraph, still with float inputs and outputs, but with internal conversions so the calculations are done in eight bit. -![Converted Diagram](https://www.tensorflow.org/images/quantization1.png) +![Converted Diagram](https://www.tensorflow.org/../images/quantization1.png) The min and max operations actually look at the values in the input float tensor, and then feeds them into the Dequantize operation that converts the @@ -162,7 +162,7 @@ operations that all have float equivalents, then there will be a lot of adjacent Dequantize/Quantize ops. This stage spots that pattern, recognizes that they cancel each other out, and removes them, like this: -![Stripping Diagram](https://www.tensorflow.org/images/quantization2.png) +![Stripping Diagram](https://www.tensorflow.org/../images/quantization2.png) Applied on a large scale to models where all of the operations have quantized equivalents, this gives a graph where all of the tensor calculations are done in diff --git a/tensorflow/g3doc/experimental/xla/broadcasting.md b/tensorflow/docs_src/performance/xla/broadcasting.md similarity index 100% rename from tensorflow/g3doc/experimental/xla/broadcasting.md rename to tensorflow/docs_src/performance/xla/broadcasting.md diff --git a/tensorflow/g3doc/experimental/xla/developing_new_backend.md b/tensorflow/docs_src/performance/xla/developing_new_backend.md similarity index 100% rename from tensorflow/g3doc/experimental/xla/developing_new_backend.md rename to tensorflow/docs_src/performance/xla/developing_new_backend.md diff --git a/tensorflow/g3doc/experimental/xla/index.md b/tensorflow/docs_src/performance/xla/index.md similarity index 89% rename from tensorflow/g3doc/experimental/xla/index.md rename to tensorflow/docs_src/performance/xla/index.md index 702e03ea8f..222b2ba887 100644 --- a/tensorflow/g3doc/experimental/xla/index.md +++ b/tensorflow/docs_src/performance/xla/index.md @@ -10,8 +10,7 @@ XLA (Accelerated Linear Algebra) is a domain-specific compiler for linear algebra that optimizes TensorFlow computations. The results are improvements in speed, memory usage, and portability on server and mobile platforms. Initially, most users will not see large benefits from XLA, but are welcome to experiment -by using XLA via [just-in-time (JIT) compilaton](jit.md) or [ahead-of-time (AOT) -compilation](tfcompile.md). Developers targeting new hardware accelerators are +by using XLA via @{$jit$just-in-time (JIT) compilaton} or @{$tfcompile$ahead-of-time (AOT) compilation}. Developers targeting new hardware accelerators are especially encouraged to try out XLA. The XLA framework is experimental and in active development. In particular, @@ -51,14 +50,13 @@ We had several objectives for XLA to work with TensorFlow: The input language to XLA is called "HLO IR", or just HLO (High Level Optimizer). The semantics of HLO are described on the -[Operation Semantics](operation_semantics.md) page. It +@{$operation_semantics$Operation Semantics} page. It is most convenient to think of HLO as a [compiler IR](https://en.wikipedia.org/wiki/Intermediate_representation). XLA takes graphs ("computations") defined in HLO and compiles them into machine instructions for various architectures. XLA is modular in the sense that it is -easy to slot in an alternative backend to [target some novel HW -architecture](developing_new_backend.md). The CPU backend for x64 and ARM64 as +easy to slot in an alternative backend to @{$developing_new_backend$target some novel HW architecture}. The CPU backend for x64 and ARM64 as well as the NVIDIA GPU backend are in the TensorFlow source tree. The following diagram shows the compilation process in XLA: @@ -91,5 +89,5 @@ CPU backend supports multiple CPU ISAs. ## Supported Platforms -XLA currently supports [JIT compilation](jit.md) on x86-64 and NVIDIA GPUs; and -[AOT compilation](tfcompile.md) for x86-64 and ARM. +XLA currently supports @{$jit$JIT compilation} on x86-64 and NVIDIA GPUs; and +@{$tfcompile$AOT compilation} for x86-64 and ARM. diff --git a/tensorflow/g3doc/experimental/xla/jit.md b/tensorflow/docs_src/performance/xla/jit.md similarity index 80% rename from tensorflow/g3doc/experimental/xla/jit.md rename to tensorflow/docs_src/performance/xla/jit.md index d2eb070c98..4d2a643b7f 100644 --- a/tensorflow/g3doc/experimental/xla/jit.md +++ b/tensorflow/docs_src/performance/xla/jit.md @@ -35,8 +35,7 @@ placed on the same device. Turning on JIT compilation at the session level will result in all possible operators being greedily compiled into XLA computations. Each XLA computation -will be compiled into one or more kernels for the underlying device. (This does -not mean everything will be fused into a single CUDA kernel, for example.) +will be compiled into one or more kernels for the underlying device. Subject to a few constraints, if there are two adjacent operators in the graph that both have XLA implementations, then they will be compiled into a single XLA @@ -54,6 +53,11 @@ config.graph_options.optimizer_options.global_jit_level = tf.OptimizerOptions.ON sess = tf.Session(config=config) ``` +> Note: Turning on JIT at the session level will not result in operations being +> compiled for the CPU. JIT compilation for CPU operations must be done via +> the manual method documented below. This decision was made due to the CPU +> backend being single-threaded. + #### Manual JIT compilation can also be turned on manually for one or more operators. This @@ -93,8 +97,13 @@ it expensive to mix XLA and TensorFlow operators in the same graph. ## Tutorial This tutorial covers training a simple version of MNIST softmax with JIT turned -on. While, the tutorial was created using CPU only, the steps are the same and -the artifacts are similar to running on GPU. +on. Currently JIT at the session level, which is what is used for the tutorial, +only supports GPU. + +Before starting the tutorial verify that the LD_LIBRARY environment variable or +ldconfig contains `$CUDA_ROOT/extras/CUPTI/lib64`, which contains libraries for +the CUDA Profiling Tools Interface [(CUPTI)](http://docs.nvidia.com/cuda/cupti/index.html). +TensorFlow uses CUPTI to pull tracing information from the GPU. ### Step #1: Prepare sample script @@ -107,7 +116,7 @@ into a folder outside of the TensorFlow source tree. Execute the python script to train the model without XLA. ```shell -python mnist_softmax_xla.py --xla=false +python mnist_softmax_xla.py --xla='' ``` Using the Chrome Trace Event Profiler (browse to chrome://tracing), @@ -115,7 +124,7 @@ open the timeline file created when the script finishes: `timeline.ctf.json`. The rendered timeline should look similar to the picture below with multiple green boxes labeled `MatMul`, possibly across multiple CPUs.
- +
### Step #3 Run with XLA @@ -130,7 +139,7 @@ TF_XLA_FLAGS=--xla_generate_hlo_graph=.* python mnist_softmax_xla.py Open the timeline file created (`timeline.ctf.json`). The rendered timeline should look similar to the picture below with one long bar labeled `_XlaLaunch`.
- +
To understand what is happening in `_XlaLaunch`, look at the console output for @@ -142,15 +151,19 @@ pipeline start, before inline]: /tmp/hlo_graph_0.dot ``` -The debug statements point to the location of `hlo_graph_xx.dot` files that -contain info about the graph created by XLA at runtime. To Render the .dot file -into a png, install [GraphViz](http://www.graphviz.org/Download..php) and run: +The console statements point to the location of `hlo_graph_xx.dot` files that +contain information about the graph created by XLA. The process that XLA takes +to fuse Ops is visible by starting at `hlo_graph_0.dot` and viewing each diagram +in succession. + +To Render the .dot file into a png, install +[GraphViz](http://www.graphviz.org/Download..php) and run: ```shell -dot -Tpng hlo_graph_0.dot -o hlo_graph_0.png +dot -Tpng hlo_graph_80.dot -o hlo_graph_80.png ``` The result will look like the following:
- +
diff --git a/tensorflow/g3doc/experimental/xla/operation_semantics.md b/tensorflow/docs_src/performance/xla/operation_semantics.md similarity index 99% rename from tensorflow/g3doc/experimental/xla/operation_semantics.md rename to tensorflow/docs_src/performance/xla/operation_semantics.md index 5fdacd42db..8120c309c9 100644 --- a/tensorflow/g3doc/experimental/xla/operation_semantics.md +++ b/tensorflow/docs_src/performance/xla/operation_semantics.md @@ -65,7 +65,7 @@ The arity and types of the `args` must match the parameters of the See also [`ComputationBuilder::Collapse`](https://www.tensorflow.org/code/tensorflow/compiler/xla/client/computation_builder.h) -and the [`Reshape`](#reshape) operation. +and the @{tf.reshape} operation. Collapses dimensions of an array into one dimension. @@ -87,7 +87,7 @@ same position in the dimension sequence as those they replace, with the new dimension size equal to the product of original dimension sizes. The lowest dimension number in `dimensions` is the slowest varying dimension (most major) in the loop nest which collapses these dimension, and the highest dimension -number is fastest varying (most minor). See the [`Reshape`](#reshape) operator +number is fastest varying (most minor). See the @{tf.reshape} operator if more general collapse ordering is needed. For example, let v be an array of 24 elements: @@ -293,8 +293,7 @@ array. The holes are filled with a no-op value, which for convolution means zeroes. Dilation of the rhs is also called atrous convolution. For more details, see the -[TensorFlow documentation on atrous convolution](https://www.tensorflow.org/ -versions/r0.11/api_docs/python/nn.html#atrous_conv2d). Dilation of the lhs is +@{tf.nn.atrous_conv2d}. Dilation of the lhs is also called deconvolution. The output shape has these dimensions, in this order: @@ -474,7 +473,7 @@ Arguments | Type | Semantics `rhs` | `ComputationDataHandle` | right-hand-side operand: array of type T The arguments' shapes have to be either similar or compatible. See the -[broadcasting](broadcasting.md) documentation about what it means for shapes to +@{$broadcasting$broadcasting} documentation about what it means for shapes to be compatible. The result of an operation has a shape which is the result of broadcasting the two input arrays. In this variant, operations between arrays of different ranks are *not* supported, unless one of the operands is a scalar. @@ -498,7 +497,7 @@ the dimensions of the higher-rank shape. The unmapped dimensions of the expanded shape are filled with dimensions of size one. Degenerate-dimension broadcasting then broadcasts the shapes along these degenerate dimension to equalize the shapes of both operands. The semantics are described in detail on the -[broadcasting page](broadcasting.md). +@{$broadcasting$broadcasting page}. ## Element-wise comparison operations @@ -521,7 +520,7 @@ Arguments | Type | Semantics `rhs` | `ComputationDataHandle` | right-hand-side operand: array of type T The arguments' shapes have to be either similar or compatible. See the -[broadcasting](broadcasting.md) documentation about what it means for shapes to +@{$broadcasting$broadcasting} documentation about what it means for shapes to be compatible. The result of an operation has a shape which is the result of broadcasting the two input arrays with the element type `PRED`. In this variant, operations between arrays of different ranks are *not* supported, unless one of @@ -538,7 +537,7 @@ matrix to a vector). The additional `broadcast_dimensions` operand is a slice of integers specifying the dimensions to use for broadcasting the operands. The semantics are described -in detail on the [broadcasting page](broadcasting.md). +in detail on the @{$broadcasting$broadcasting page}. ## Element-wise unary functions @@ -598,7 +597,7 @@ let t: (f32[10], s32) = tuple(v, s); let element_1: s32 = gettupleelement(t, 1); // Inferred shape matches s32. ``` -See also [`Tuple`](#tuple). +See also @{tf.tuple}. ## Infeed @@ -1381,7 +1380,7 @@ Arguments | Type | Semantics ## Transpose -See also the [`Reshape`](#reshape) operation. +See also the @{tf.reshape} operation. `Transpose(operand)` diff --git a/tensorflow/g3doc/experimental/xla/shapes.md b/tensorflow/docs_src/performance/xla/shapes.md similarity index 100% rename from tensorflow/g3doc/experimental/xla/shapes.md rename to tensorflow/docs_src/performance/xla/shapes.md diff --git a/tensorflow/g3doc/experimental/xla/tfcompile.md b/tensorflow/docs_src/performance/xla/tfcompile.md similarity index 89% rename from tensorflow/g3doc/experimental/xla/tfcompile.md rename to tensorflow/docs_src/performance/xla/tfcompile.md index c99a337a10..60aff2f633 100644 --- a/tensorflow/g3doc/experimental/xla/tfcompile.md +++ b/tensorflow/docs_src/performance/xla/tfcompile.md @@ -17,23 +17,21 @@ kernels that are actually used in the computation. The compiler is built on top of the XLA framework. The code bridging TensorFlow to the XLA framework resides under [tensorflow/compiler](https://www.tensorflow.org/code/tensorflow/compiler/), -which also includes support for [just-in-time (JIT) compilation](jit.md) of +which also includes support for @{$jit$just-in-time (JIT) compilation} of TensorFlow graphs. ## What does tfcompile do? `tfcompile` takes a subgraph, identified by the TensorFlow concepts of -[`feeds`](../../get_started/basic_usage.md#feeds) and -[`fetches`](../../get_started/basic_usage.md#fetches), and generates a function -that implements that subgraph. The feeds are the input arguments for the -function, and the fetches are the output arguments for the function. All inputs -must be fully specified by the feeds; the resulting pruned subgraph cannot -contain Placeholder or Variable nodes. It is common to specify all Placeholders -and Variables as feeds, which ensures the resulting subgraph no longer contains -these nodes. The generated function is packaged as a `cc_library`, with a header -file exporting the function signature, and an object file containing the -implementation. The user writes code to invoke the generated function as -appropriate. +feeds and fetches, and generates a function that implements that subgraph. +The `feeds` are the input arguments for the function, and the `fetches` are the +output arguments for the function. All inputs must be fully specified by the +feeds; the resulting pruned subgraph cannot contain Placeholder or Variable +nodes. It is common to specify all Placeholders and Variables as feeds, which +ensures the resulting subgraph no longer contains these nodes. The generated +function is packaged as a `cc_library`, with a header file exporting the +function signature, and an object file containing the implementation. The user +writes code to invoke the generated function as appropriate. ## Using tfcompile @@ -47,11 +45,9 @@ This section details high level steps for generating an executable binary with ### Step 1: Configure the subgraph to compile -Identify the [`feeds`](../../get_started/basic_usage.md#feeds) and -[`fetches`](../../get_started/basic_usage.md#fetches) of the graph, which -correspond to the input and output arguments for the generated function. Then -configure the feeds and fetches in a -[`tensorflow.tfcompile.Config`](https://www.tensorflow.org/code/tensorflow/compiler/aot/tfcompile.proto) +Identify the feeds and fetches that correspond to the input and output +arguments for the generated function. Then configure the `feeds` and `fetches` +in a [`tensorflow.tfcompile.Config`](https://www.tensorflow.org/code/tensorflow/compiler/aot/tfcompile.proto) proto. ```textproto @@ -120,7 +116,7 @@ tf_library( > [make_test_graphs.py]("https://www.tensorflow.org/code/tensorflow/compiler/aot/tests/make_test_graphs.py") > and specify the output location with the --out_dir flag. -Typical graphs contain [`Variables`](../../api_docs/python/state_ops.md) +Typical graphs contain @{$python/state_ops$`Variables`} representing the weights that are learned via training, but `tfcompile` cannot compile a subgraph that contain `Variables`. The [freeze_graph.py](https://www.tensorflow.org/code/tensorflow/python/tools/freeze_graph.py) diff --git a/tensorflow/g3doc/resources/data_versions.md b/tensorflow/docs_src/programmers_guide/data_versions.md similarity index 98% rename from tensorflow/g3doc/resources/data_versions.md rename to tensorflow/docs_src/programmers_guide/data_versions.md index b8afde3119..006aa2a826 100644 --- a/tensorflow/g3doc/resources/data_versions.md +++ b/tensorflow/docs_src/programmers_guide/data_versions.md @@ -1,7 +1,7 @@ # TensorFlow Data Versioning: GraphDefs and Checkpoints As described in -[Compatibility for Graphs and Checkpoints](versions.md#compatibility-for-graphs-and-checkpoints), +@{$version_semantics#compatibility-for-graphs-and-checkpoints$Compatibility for Graphs and Checkpoints}, TensorFlow marks each kind of data with version information in order to maintain backward compatibility. This document provides additional details about the versioning mechanism, and how to use it to safely change data formats. diff --git a/tensorflow/g3doc/how_tos/debugger/index.md b/tensorflow/docs_src/programmers_guide/debugger.md similarity index 92% rename from tensorflow/g3doc/how_tos/debugger/index.md rename to tensorflow/docs_src/programmers_guide/debugger.md index f13c1a95bd..e66873fa58 100644 --- a/tensorflow/g3doc/how_tos/debugger/index.md +++ b/tensorflow/docs_src/programmers_guide/debugger.md @@ -24,7 +24,7 @@ This code trains a simple NN for MNIST digit image recognition. Notice that the accuracy increases slightly after the first training step, but then gets stuck at a low (near-chance) level: -![debug_mnist training fails](../../images/tfdbg_screenshot_mnist_symptom.png) +![debug_mnist training fails](../images/tfdbg_screenshot_mnist_symptom.png) Scratching your head, you suspect that certain nodes in the training graph generated bad numeric values such as `inf`s and `nan`s. The computation-graph @@ -58,11 +58,11 @@ state. the diagnosis of issues. In this example, we are registering a tensor filter called -[`has_inf_or_nan`](../../../g3doc/api_docs/python/tf_debug.md#has_inf_or_nan), +@{tfdbg.has_inf_or_nan}, which simply determines if there are any `nan` or `inf` values in any intermediate tensor of the graph. (This filter is a common enough use case that we ship it with the -[`debug_data`](../../../g3doc/api_docs/python/tf_debug.md#classes-for-debug-dump-data-and-directories) +@{$python/tfdbg#Classes_for_debug_dump_data_and_directories$`debug_data`} module.) ```python @@ -71,7 +71,7 @@ def has_inf_or_nan(datum, tensor): ``` TIP: You can also write your own custom filters. See -the [API documentation](../../../g3doc/api_docs/python/tf_debug.md#DebugDumpDir.find) +the @{tfdbg.DebugDumpDir.find$API documentation} of `DebugDumpDir.find()` for additional information. ## Debugging Model Training with tfdbg @@ -87,7 +87,7 @@ The debug wrapper session will prompt you when it is about to execute the first `run()` call, with information regarding the fetched tensor and feed dictionaries displayed on the screen. -![tfdbg run-start UI](../../images/tfdbg_screenshot_run_start.png) +![tfdbg run-start UI](../images/tfdbg_screenshot_run_start.png) This is what we refer to as the *run-start UI*. If the screen size is too small to display the content of the message in its entirety, you can resize @@ -106,7 +106,7 @@ intermedate tensors from the run. (These tensors can also be obtained by running the command `lt` after you executed `run`.) This is called the **run-end UI**: -![tfdbg run-end UI: accuracy](../../images/tfdbg_screenshot_run_end_accuracy.png) +![tfdbg run-end UI: accuracy](../images/tfdbg_screenshot_run_end_accuracy.png) ### tfdbg CLI Frequently-Used Commands @@ -174,7 +174,7 @@ screen with a red-colored title line indicating **tfdbg** stopped immediately after a `run()` call generated intermediate tensors that passed the specified filter `has_inf_or_nan`: -![tfdbg run-end UI: infs and nans](../../images/tfdbg_screenshot_run_end_inf_nan.png) +![tfdbg run-end UI: infs and nans](../images/tfdbg_screenshot_run_end_inf_nan.png) As the screen display indicates, the `has_inf_or_nan` filter is first passed during the fourth `run()` call: an [Adam optimizer](https://arxiv.org/abs/1412.6980) @@ -213,7 +213,7 @@ item on the top or entering the equivalent command: tfdbg> ni cross_entropy/Log ``` -![tfdbg run-end UI: infs and nans](../../images/tfdbg_screenshot_run_end_node_info.png) +![tfdbg run-end UI: infs and nans](../images/tfdbg_screenshot_run_end_node_info.png) You can see that this node has the op type `Log` and that its input is the node `softmax/Softmax`. Run the following command to @@ -245,7 +245,7 @@ From the traceback, you can see that the op is constructed at line 109 of diff = y_ * tf.log(y) ``` -Apply a value clipping on the input to [`tf.log`](../../../g3doc/api_docs/python/math_ops.md#log) +Apply a value clipping on the input to @{tf.log} to resolve this problem: ```python @@ -265,9 +265,9 @@ stuck. Success! ## Debugging tf-learn Estimators For documentation on **tfdbg** to debug -[tf.contrib.learn](https://tensorflow.org/tutorials/tflearn/index.html) +@{$tflearn$tf.contrib.learn} `Estimator`s and `Experiment`s, please see -[How to Use TensorFlow Debugger (tfdbg) with tf.contrib.learn](tfdbg-tflearn.md). +@{$tfdbg-tflearn$How to Use TensorFlow Debugger (tfdbg) with tf.contrib.learn}. ## Offline Debugging of Remotely-Running Sessions @@ -276,8 +276,7 @@ have terminal access to. To perform model debugging in such cases, you can use the `offline_analyzer` of `tfdbg`. It operates on dumped data directories. If the process you are running is written in Python, you can configure the `RunOptions` proto that you call your `Session.run()` method -with, by using the method -[`debug_utils.watch_graph()`](../../../g3doc/api_docs/python/tf_debug.md#watch_graph). +with, by using the method @{tfdbg.watch_graph}. This will cause the intermediate tensors and runtime graphs to be dumped to a shared storage location of your choice when the `Session.run()` call occurs. For example: @@ -321,7 +320,7 @@ sess = tf_debug.DumpingDebugWrapperSession( `watch_fn=my_watch_fn` is a `Callable` that allows you to configure what `Tensor`s to watch on different `Session.run()` calls, as a function of the `fetches` and `feed_dict` to the `run()` call and other states. See -[the API doc of DumpingDebugWrapperSession](../../api_docs/python/tf_debug.md#DumpingDebugWrapperSession.__init__) +@{tfdbg.DumpingDebugWrapperSession.__init__$the API doc of DumpingDebugWrapperSession} for more details. If you model code is written in C++ or other languages, you can also diff --git a/tensorflow/g3doc/resources/dims_types.md b/tensorflow/docs_src/programmers_guide/dims_types.md similarity index 97% rename from tensorflow/g3doc/resources/dims_types.md rename to tensorflow/docs_src/programmers_guide/dims_types.md index 3fedbbc0b4..65b748d56e 100644 --- a/tensorflow/g3doc/resources/dims_types.md +++ b/tensorflow/docs_src/programmers_guide/dims_types.md @@ -43,7 +43,7 @@ Rank | Shape | Dimension number | Example n | [D0, D1, ... Dn-1] | n-D | A tensor with shape [D0, D1, ... Dn-1]. Shapes can be represented via Python lists / tuples of ints, or with the -[`TensorShape` class](../api_docs/python/framework.md#TensorShape). +@{tf.TensorShape}. ## Data types diff --git a/tensorflow/g3doc/resources/faq.md b/tensorflow/docs_src/programmers_guide/faq.md similarity index 64% rename from tensorflow/g3doc/resources/faq.md rename to tensorflow/docs_src/programmers_guide/faq.md index 3f84b766d3..a400d91654 100644 --- a/tensorflow/g3doc/resources/faq.md +++ b/tensorflow/docs_src/programmers_guide/faq.md @@ -2,7 +2,7 @@ This document provides answers to some of the frequently asked questions about TensorFlow. If you have a question that is not covered here, you might find an -answer on one of the TensorFlow [community resources](../resources/index.md). +answer on one of the TensorFlow @{$about$community resources}. [TOC] @@ -11,7 +11,7 @@ answer on one of the TensorFlow [community resources](../resources/index.md). #### Can I run distributed training on multiple computers? Yes! TensorFlow gained -[support for distributed computation](../how_tos/distributed/index.md) in +@{$distributed$support for distributed computation} in version 0.8. TensorFlow now supports multiple devices (CPUs and GPUs) in one or more computers. @@ -23,18 +23,18 @@ As of the 0.6.0 release timeframe (Early December 2015), we do support Python ## Building a TensorFlow graph See also the -[API documentation on building graphs](../api_docs/python/framework.md). +@{$python/framework$API documentation on building graphs}. #### Why does `c = tf.matmul(a, b)` not execute the matrix multiplication immediately? In the TensorFlow Python API, `a`, `b`, and `c` are -[`Tensor`](../api_docs/python/framework.md#Tensor) objects. A `Tensor` object is +@{tf.Tensor} objects. A `Tensor` object is a symbolic handle to the result of an operation, but does not actually hold the values of the operation's output. Instead, TensorFlow encourages users to build up complicated expressions (such as entire neural networks and its gradients) as a dataflow graph. You then offload the computation of the entire dataflow graph (or a subgraph of it) to a TensorFlow -[`Session`](../api_docs/python/client.md#Session), which is able to execute the +@{tf.Session}, which is able to execute the whole computation much more efficiently than executing the operations one-by-one. @@ -46,46 +46,46 @@ device, and `"/device:GPU:i"` (or `"/gpu:i"`) for the *i*th GPU device. #### How do I place operations on a particular device? To place a group of operations on a device, create them within a -[`with tf.device(name):`](../api_docs/python/framework.md#device) context. See +@{tf.device$`with tf.device(name):`} context. See the how-to documentation on -[using GPUs with TensorFlow](../how_tos/using_gpu/index.md) for details of how +@{$using_gpu$using GPUs with TensorFlow} for details of how TensorFlow assigns operations to devices, and the -[CIFAR-10 tutorial](../tutorials/deep_cnn/index.md) for an example model that +@{$deep_cnn$CIFAR-10 tutorial} for an example model that uses multiple GPUs. #### What are the different types of tensors that are available? TensorFlow supports a variety of different data types and tensor shapes. See the -[ranks, shapes, and types reference](../resources/dims_types.md) for more details. +@{$dims_types$ranks, shapes, and types reference} for more details. ## Running a TensorFlow computation See also the -[API documentation on running graphs](../api_docs/python/client.md). +@{$python/client$API documentation on running graphs}. #### What's the deal with feeding and placeholders? Feeding is a mechanism in the TensorFlow Session API that allows you to substitute different values for one or more tensors at run time. The `feed_dict` -argument to [`Session.run()`](../api_docs/python/client.md#Session.run) is a -dictionary that maps [`Tensor`](../api_docs/python/framework.md) objects to +argument to @{tf.Session.run} is a +dictionary that maps @{tf.Tensor} objects to numpy arrays (and some other types), which will be used as the values of those tensors in the execution of a step. Often, you have certain tensors, such as inputs, that will always be fed. The -[`tf.placeholder()`](../api_docs/python/io_ops.md#placeholder) op allows you +@{tf.placeholder} op allows you to define tensors that *must* be fed, and optionally allows you to constrain their shape as well. See the -[beginners' MNIST tutorial](../tutorials/mnist/beginners/index.md) for an +@{$beginners$beginners' MNIST tutorial} for an example of how placeholders and feeding can be used to provide the training data for a neural network. #### What is the difference between `Session.run()` and `Tensor.eval()`? -If `t` is a [`Tensor`](../api_docs/python/framework.md#Tensor) object, -[`t.eval()`](../api_docs/python/framework.md#Tensor.eval) is shorthand for -[`sess.run(t)`](../api_docs/python/client.md#Session.run) (where `sess` is the -current [default session](../api_docs/python/client.md#get_default_session). The +If `t` is a @{tf.Tensor} object, +@{tf.Tensor.eval} is shorthand for +@{tf.Session.run} (where `sess` is the +current @{tf.get_default_session}. The two following snippets of code are equivalent: ```python @@ -111,15 +111,15 @@ sessions, it may be more straightforward to make explicit calls to #### Do Sessions have a lifetime? What about intermediate tensors? Sessions can own resources, such as -[variables](../api_docs/python/state_ops.md#Variable), -[queues](../api_docs/python/io_ops.md#QueueBase), and -[readers](../api_docs/python/io_ops.md#ReaderBase); and these resources can use +@{tf.Variable}, +@{tf.QueueBase}, and +@{tf.ReaderBase}; and these resources can use a significant amount of memory. These resources (and the associated memory) are released when the session is closed, by calling -[`Session.close()`](../api_docs/python/client.md#Session.close). +@{tf.Session.close}. The intermediate tensors that are created as part of a call to -[`Session.run()`](../api_docs/python/client.md) will be freed at or before the +@{$python/client$`Session.run()`} will be freed at or before the end of the call. #### Does the runtime parallelize parts of graph execution? @@ -131,32 +131,30 @@ dimensions: CPU, or multiple threads in a GPU. * Independent nodes in a TensorFlow graph can run in parallel on multiple devices, which makes it possible to speed up - [CIFAR-10 training using multiple GPUs](../tutorials/deep_cnn/index.md). + @{$deep_cnn$CIFAR-10 training using multiple GPUs}. * The Session API allows multiple concurrent steps (i.e. calls to - [Session.run()](../api_docs/python/client.md#Session.run) in parallel. This + @{tf.Session.run} in parallel. This enables the runtime to get higher throughput, if a single step does not use all of the resources in your computer. #### Which client languages are supported in TensorFlow? -TensorFlow is designed to support multiple client languages. Currently, the -best-supported client language is [Python](../api_docs/python/index.md). The -[C++ client API](../api_docs/cc/index.md) provides an interface for launching -graphs and running steps; we also have an experimental API for -[building graphs in C++](https://www.tensorflow.org/code/tensorflow/cc/tutorials/example_trainer.cc). +TensorFlow is designed to support multiple client languages. +Currently, the best-supported client language is [Python](../api_docs/python/index.md). Experimental interfaces for +executing and constructing graphs are also available for +[C++](../api_docs/cc/index.md), [Java](../api_docs/java/reference/org/tensorflow/package-summary.html) and [Go](https://godoc.org/github.com/tensorflow/tensorflow/tensorflow/go). -We would like to support more client languages, as determined by community -interest. TensorFlow has a +TensorFlow also has a [C-based client API](https://www.tensorflow.org/code/tensorflow/c/c_api.h) -that makes it easy to build a client in many different languages. We invite -contributions of new language bindings. +to help build support for more client languages. We invite contributions of new +language bindings. #### Does TensorFlow make use of all the devices (GPUs and CPUs) available on my machine? TensorFlow supports multiple GPUs and CPUs. See the how-to documentation on -[using GPUs with TensorFlow](../how_tos/using_gpu/index.md) for details of how +@{$using_gpu$using GPUs with TensorFlow} for details of how TensorFlow assigns operations to devices, and the -[CIFAR-10 tutorial](../tutorials/deep_cnn/index.md) for an example model that +@{$deep_cnn$CIFAR-10 tutorial} for an example model that uses multiple GPUs. Note that TensorFlow only uses GPU devices with a compute capability greater @@ -164,28 +162,28 @@ than 3.5. #### Why does `Session.run()` hang when using a reader or a queue? -The [reader](../api_docs/python/io_ops.md#ReaderBase) and -[queue](../api_docs/python/io_ops.md#QueueBase) classes provide special operations that +The @{tf.ReaderBase} and +@{tf.QueueBase} classes provide special operations that can *block* until input (or free space in a bounded queue) becomes available. These operations allow you to build sophisticated -[input pipelines](../how_tos/reading_data/index.md), at the cost of making the +@{$reading_data$input pipelines}, at the cost of making the TensorFlow computation somewhat more complicated. See the how-to documentation for -[using `QueueRunner` objects to drive queues and readers](../how_tos/reading_data/index.md#creating-threads-to-prefetch-using-queuerunner-objects) +@{$reading_data#creating-threads-to-prefetch-using-queuerunner-objects$using `QueueRunner` objects to drive queues and readers} for more information on how to use them. ## Variables -See also the how-to documentation on [variables](../how_tos/variables/index.md) -and [variable scopes](../how_tos/variable_scope/index.md), and -[the API documentation for variables](../api_docs/python/state_ops.md). +See also the how-to documentation on @{$variables$variables} +and @{$variable_scope$variable scopes}, and +@{$python/state_ops$the API documentation for variables}. #### What is the lifetime of a variable? A variable is created when you first run the -[`tf.Variable.initializer`](../api_docs/python/state_ops.md#Variable.initializer) +@{tf.Variable.initializer} operation for that variable in a session. It is destroyed when that -[`session is closed`](../api_docs/python/client.md#Session.close). +@{tf.Session.close}. #### How do variables behave when they are concurrently accessed? @@ -193,32 +191,32 @@ Variables allow concurrent read and write operations. The value read from a variable may change if it is concurrently updated. By default, concurrent assigment operations to a variable are allowed to run with no mutual exclusion. To acquire a lock when assigning to a variable, pass `use_locking=True` to -[`Variable.assign()`](../api_docs/python/state_ops.md#Variable.assign). +@{tf.Variable.assign}. ## Tensor shapes See also the -[`TensorShape` API documentation](../api_docs/python/framework.md#TensorShape). +@{tf.TensorShape}. #### How can I determine the shape of a tensor in Python? In TensorFlow, a tensor has both a static (inferred) shape and a dynamic (true) shape. The static shape can be read using the -[`tf.Tensor.get_shape()`](../api_docs/python/framework.md#Tensor.get_shape) +@{tf.Tensor.get_shape} method: this shape is inferred from the operations that were used to create the tensor, and may be -[partially complete](../api_docs/python/framework.md#TensorShape). If the static +@{tf.TensorShape$partially complete}. If the static shape is not fully defined, the dynamic shape of a `Tensor` `t` can be -determined by evaluating [`tf.shape(t)`](../api_docs/python/array_ops.md#shape). +determined by evaluating @{tf.shape$`tf.shape(t)`}. #### What is the difference between `x.set_shape()` and `x = tf.reshape(x)`? -The [`tf.Tensor.set_shape()`](../api_docs/python/framework.md) method updates +The @{tf.Tensor.set_shape} method updates the static shape of a `Tensor` object, and it is typically used to provide additional shape information when this cannot be inferred directly. It does not change the dynamic shape of the tensor. -The [`tf.reshape()`](../api_docs/python/array_ops.md#reshape) operation creates +The @{tf.reshape} operation creates a new tensor with a different dynamic shape. #### How do I build a graph that works with variable batch sizes? @@ -226,9 +224,9 @@ a new tensor with a different dynamic shape. It is often useful to build a graph that works with variable batch sizes, for example so that the same code can be used for (mini-)batch training, and single-instance inference. The resulting graph can be -[saved as a protocol buffer](../api_docs/python/framework.md#Graph.as_graph_def) +@{tf.Graph.as_graph_def$saved as a protocol buffer} and -[imported into another program](../api_docs/python/framework.md#import_graph_def). +@{tf.import_graph_def$imported into another program}. When building a variable-size graph, the most important thing to remember is not to encode the batch size as a Python constant, but instead to use a symbolic @@ -238,11 +236,11 @@ to encode the batch size as a Python constant, but instead to use a symbolic to extract the batch dimension from a `Tensor` called `input`, and store it in a `Tensor` called `batch_size`. -* Use [`tf.reduce_mean()`](../api_docs/python/math_ops.md#reduce_mean) instead +* Use @{tf.reduce_mean} instead of `tf.reduce_sum(...) / batch_size`. * If you use - [placeholders for feeding input](../how_tos/reading_data/index.md#feeding), + @{$reading_data#feeding$placeholders for feeding input}, you can specify a variable batch dimension by creating the placeholder with [`tf.placeholder(..., shape=[None, ...])`](../api_docs/python/io_ops.md#placeholder). The `None` element of the shape corresponds to a variable-sized dimension. @@ -251,18 +249,17 @@ to encode the batch size as a Python constant, but instead to use a symbolic #### How can I visualize a TensorFlow graph? -See the [graph visualization tutorial](../how_tos/graph_viz/index.md). +See the @{$graph_viz$graph visualization tutorial}. #### What is the simplest way to send data to TensorBoard? -Add summary ops to your TensorFlow graph, and use a -[`SummaryWriter`](../api_docs/python/train.md#SummaryWriter) to write +Add summary ops to your TensorFlow graph, and write these summaries to a log directory. Then, start TensorBoard using python tensorflow/tensorboard/tensorboard.py --logdir=path/to/log-directory For more details, see the -[Summaries and TensorBoard tutorial](../how_tos/summaries_and_tensorboard/index.md). +@{$summaries_and_tensorboard$Summaries and TensorBoard tutorial}. #### Every time I launch TensorBoard, I get a network security popup! @@ -272,7 +269,7 @@ the flag --host=localhost. This should quiet any security warnings. ## Extending TensorFlow See also the how-to documentation for -[adding a new operation to TensorFlow](../how_tos/adding_an_op/index.md). +@{$adding_an_op$adding a new operation to TensorFlow}. #### My data is in a custom format. How do I read it using TensorFlow? @@ -280,16 +277,16 @@ There are two main options for dealing with data in a custom format. The easier option is to write parsing code in Python that transforms the data into a numpy array, then feed a -[`tf.placeholder()`](../api_docs/python/io_ops.md#placeholder) a tensor with +@{tf.placeholder} a tensor with that data. See the documentation on -[using placeholders for input](../how_tos/reading_data/index.md#feeding) for +@{$reading_data#feeding$using placeholders for input} for more details. This approach is easy to get up and running, but the parsing can be a performance bottleneck. The more efficient option is to -[add a new op written in C++](../how_tos/adding_an_op/index.md) that parses your +@{$adding_an_op$add a new op written in C++} that parses your data format. The -[guide to handling new data formats](../how_tos/new_data_formats/index.md) has +@{$new_data_formats$guide to handling new data formats} has more information about the steps for doing this. #### How do I define an operation that takes a variable number of inputs? @@ -299,7 +296,7 @@ single tensor, a list of tensors with the same type (for example when adding together a variable-length list of tensors), or a list of tensors with different types (for example when enqueuing a tuple of tensors to a queue). See the how-to documentation for -[adding an op with a list of inputs or outputs](../how_tos/adding_an_op/index.md#list-inputs-and-outputs) +@{$adding_an_op#list-inputs-and-outputs$adding an op with a list of inputs or outputs} for more details of how to define these different input types. ## Miscellaneous diff --git a/tensorflow/docs_src/programmers_guide/leftnav_files b/tensorflow/docs_src/programmers_guide/leftnav_files new file mode 100644 index 0000000000..c20635f607 --- /dev/null +++ b/tensorflow/docs_src/programmers_guide/leftnav_files @@ -0,0 +1,12 @@ +reading_data.md +threading_and_queues.md +variable_scope.md +version_semantics.md +data_versions.md +supervisor.md +debugger.md +tfdbg-tflearn.md +meta_graph.md +faq.md +dims_types.md +variables.md diff --git a/tensorflow/g3doc/how_tos/meta_graph/index.md b/tensorflow/docs_src/programmers_guide/meta_graph.md similarity index 95% rename from tensorflow/g3doc/how_tos/meta_graph/index.md rename to tensorflow/docs_src/programmers_guide/meta_graph.md index 63b032995e..add4379d7d 100644 --- a/tensorflow/g3doc/how_tos/meta_graph/index.md +++ b/tensorflow/docs_src/programmers_guide/meta_graph.md @@ -7,10 +7,10 @@ term storage of graphs. The MetaGraph contains the information required to continue training, perform evaluation, or run inference on a previously trained graph. The APIs for exporting and importing the complete model are in -the [`tf.train.Saver`](../../api_docs/python/state_ops.md#Saver) class: -[`export_meta_graph`](../../api_docs/python/train.md#export_meta_graph) +the @{tf.train.Saver} class: +@{tf.train.export_meta_graph} and -[`import_meta_graph`](../../api_docs/python/train.md#import_meta_graph). +@{tf.train.import_meta_graph}. ## What's in a MetaGraph @@ -23,8 +23,8 @@ protocol buffer. It contains the following fields: * [`SaverDef`](https://www.tensorflow.org/code/tensorflow/core/protobuf/saver.proto) for the saver. * [`CollectionDef`](https://www.tensorflow.org/code/tensorflow/core/protobuf/meta_graph.proto) map that further describes additional components of the model, such as -[`Variables`](https://tensorflow.org/api_docs/python/state_ops.html), -[`QueueRunners`](https://tensorflow.org/api_docs/python/train.html#QueueRunner), etc. In order for a Python object to be serialized +@{$python/state_ops$`Variables`}, +@{tf.train.QueueRunner}, etc. In order for a Python object to be serialized to and from `MetaGraphDef`, the Python class must implement `to_proto()` and `from_proto()` methods, and register them with the system using `register_proto_function`. @@ -122,7 +122,7 @@ The API for exporting a running model as a MetaGraph is `export_meta_graph()`. The MetaGraph is also automatically exported via the `save()` API in -[`tf.train.Saver`](../../api_docs/python/state_ops.md#Saver). +@{tf.train.Saver}. ## Import a MetaGraph diff --git a/tensorflow/g3doc/how_tos/reading_data/index.md b/tensorflow/docs_src/programmers_guide/reading_data.md similarity index 86% rename from tensorflow/g3doc/how_tos/reading_data/index.md rename to tensorflow/docs_src/programmers_guide/reading_data.md index 1007f0248c..7c3a37417d 100644 --- a/tensorflow/g3doc/how_tos/reading_data/index.md +++ b/tensorflow/docs_src/programmers_guide/reading_data.md @@ -28,7 +28,7 @@ with tf.Session(): While you can replace any Tensor with feed data, including variables and constants, the best practice is to use a -[`placeholder` op](../../api_docs/python/io_ops.md#placeholder) node. A +@{tf.placeholder} node. A `placeholder` exists solely to serve as the target of feeds. It is not initialized and contains no data. A placeholder generates an error if it is executed without a feed, so you won't forget to feed it. @@ -36,7 +36,7 @@ it is executed without a feed, so you won't forget to feed it. An example using `placeholder` and feeding to train on MNIST data can be found in [`tensorflow/examples/tutorials/mnist/fully_connected_feed.py`](https://www.tensorflow.org/code/tensorflow/examples/tutorials/mnist/fully_connected_feed.py), -and is described in the [MNIST tutorial](../../tutorials/mnist/tf/index.md). +and is described in the @{$mechanics$MNIST tutorial}. ## Reading from files @@ -55,11 +55,9 @@ A typical pipeline for reading records from files has the following stages: For the list of filenames, use either a constant string Tensor (like `["file0", "file1"]` or `[("file%d" % i) for i in range(2)]`) or the -[`tf.train.match_filenames_once` -function](../../api_docs/python/io_ops.md#match_filenames_once). +@{tf.train.match_filenames_once} function. -Pass the list of filenames to the [`tf.train.string_input_producer` -function](../../api_docs/python/io_ops.md#string_input_producer). +Pass the list of filenames to the @{tf.train.string_input_producer} function. `string_input_producer` creates a FIFO queue for holding the filenames until the reader needs them. @@ -85,8 +83,8 @@ decode this string into the tensors that make up an example. To read text files in [comma-separated value (CSV) format](https://tools.ietf.org/html/rfc4180), use a -[`TextLineReader`](../../api_docs/python/io_ops.md#TextLineReader) with the -[`decode_csv`](../../api_docs/python/io_ops.md#decode_csv) operation. For example: +@{tf.TextLineReader} with the +@{tf.decode_csv} operation. For example: ```python filename_queue = tf.train.string_input_producer(["file0.csv", "file1.csv"]) @@ -126,8 +124,8 @@ block while it waits for filenames from the queue. #### Fixed length records To read binary files in which each record is a fixed number of bytes, use -[`tf.FixedLengthRecordReader`](../../api_docs/python/io_ops.md#FixedLengthRecordReader) -with the [`tf.decode_raw`](../../api_docs/python/io_ops.md#decode_raw) operation. +@{tf.FixedLengthRecordReader} +with the @{tf.decode_raw} operation. The `decode_raw` op converts from a string to a uint8 tensor. For example, [the CIFAR-10 dataset](http://www.cs.toronto.edu/~kriz/cifar.html) @@ -137,14 +135,14 @@ a uint8 tensor, standard operations can slice out each piece and reformat as needed. For CIFAR-10, you can see how to do the reading and decoding in [`tensorflow_models/tutorials/image/cifar10/cifar10_input.py`](https://www.tensorflow.org/code/tensorflow_models/tutorials/image/cifar10/cifar10_input.py) and described in -[this tutorial](../../tutorials/deep_cnn/index.md#prepare-the-data). +@{$deep_cnn#prepare-the-data$this tutorial}. #### Standard TensorFlow format Another approach is to convert whatever data you have into a supported format. This approach makes it easier to mix and match data sets and network architectures. The recommended format for TensorFlow is a -[TFRecords file](../../api_docs/python/python_io.md#tfrecords-format-details) +@{$python/python_io#tfrecords_format_details$TFRecords file} containing [`tf.train.Example` protocol buffers](https://www.tensorflow.org/code/tensorflow/core/example/example.proto) (which contain @@ -152,14 +150,14 @@ containing as a field). You write a little program that gets your data, stuffs it in an `Example` protocol buffer, serializes the protocol buffer to a string, and then writes the string to a TFRecords file using the -[`tf.python_io.TFRecordWriter` class](../../api_docs/python/python_io.md#TFRecordWriter). +@{tf.python_io.TFRecordWriter}. For example, [`tensorflow/examples/how_tos/reading_data/convert_to_records.py`](https://www.tensorflow.org/code/tensorflow/examples/how_tos/reading_data/convert_to_records.py) converts MNIST data to this format. To read a file of TFRecords, use -[`tf.TFRecordReader`](../../api_docs/python/io_ops.md#TFRecordReader) with -the [`tf.parse_single_example`](../../api_docs/python/io_ops.md#parse_single_example) +@{tf.TFRecordReader} with +the @{tf.parse_single_example} decoder. The `parse_single_example` op decodes the example protocol buffers into tensors. An MNIST example using the data produced by `convert_to_records` can be found in @@ -180,7 +178,7 @@ for an example. At the end of the pipeline we use another queue to batch together examples for training, evaluation, or inference. For this we use a queue that randomizes the order of examples, using the -[`tf.train.shuffle_batch` function](../../api_docs/python/io_ops.md#shuffle_batch). +@{tf.train.shuffle_batch}. Example: @@ -212,7 +210,7 @@ def input_pipeline(filenames, batch_size, num_epochs=None): If you need more parallelism or shuffling of examples between files, use multiple reader instances using the -[`tf.train.shuffle_batch_join` function](../../api_docs/python/io_ops.md#shuffle_batch_join). +@{tf.train.shuffle_batch_join}. For example: ``` @@ -238,7 +236,7 @@ epoch until all the files from the epoch have been started. (It is also usually sufficient to have a single thread filling the filename queue.) An alternative is to use a single reader via the -[`tf.train.shuffle_batch` function](../../api_docs/python/io_ops.md#shuffle_batch) +@{tf.train.shuffle_batch} with `num_threads` bigger than 1. This will make it read from a single file at the same time (but faster than with 1 thread), instead of N files at once. This can be important: @@ -251,18 +249,18 @@ This can be important: How many threads do you need? the `tf.train.shuffle_batch*` functions add a summary to the graph that indicates how full the example queue is. If you have enough reading threads, that summary will stay above zero. You can -[view your summaries as training progresses using TensorBoard](../../how_tos/summaries_and_tensorboard/index.md). +@{$summaries_and_tensorboard$view your summaries as training progresses using TensorBoard}. ### Creating threads to prefetch using `QueueRunner` objects The short version: many of the `tf.train` functions listed above add -[`QueueRunner`](../../api_docs/python/train.md#QueueRunner) objects to your +@{tf.train.QueueRunner} objects to your graph. These require that you call -[`tf.train.start_queue_runners`](../../api_docs/python/train.md#start_queue_runners) +@{tf.train.start_queue_runners} before running any training or inference steps, or it will hang forever. This will start threads that run the input pipeline, filling the example queue so that the dequeue to get the examples will succeed. This is best combined with a -[`tf.train.Coordinator`](../../api_docs/python/train.md#Coordinator) to cleanly +@{tf.train.Coordinator} to cleanly shut down these threads when there are errors. If you set a limit on the number of epochs, that will use an epoch counter that will need to be initialized. The recommended code pattern combining these is: @@ -311,36 +309,36 @@ operations, so that our training loop can dequeue examples from the example queue.
- +
The helpers in `tf.train` that create these queues and enqueuing operations add -a [`tf.train.QueueRunner`](../../api_docs/python/train.md#QueueRunner) to the +a @{tf.train.QueueRunner} to the graph using the -[`tf.train.add_queue_runner`](../../api_docs/python/train.md#add_queue_runner) +@{tf.train.add_queue_runner} function. Each `QueueRunner` is responsible for one stage, and holds the list of enqueue operations that need to be run in threads. Once the graph is constructed, the -[`tf.train.start_queue_runners`](../../api_docs/python/train.md#start_queue_runners) +@{tf.train.start_queue_runners} function asks each QueueRunner in the graph to start its threads running the enqueuing operations. If all goes well, you can now run your training steps and the queues will be filled by the background threads. If you have set an epoch limit, at some point an attempt to dequeue examples will get an -[`tf.OutOfRangeError`](../../api_docs/python/client.md#OutOfRangeError). This +@{tf.errors.OutOfRangeError}. This is the TensorFlow equivalent of "end of file" (EOF) -- this means the epoch limit has been reached and no more examples are available. The last ingredient is the -[`Coordinator`](../../api_docs/python/train.md#Coordinator). This is responsible +@{tf.train.Coordinator}. This is responsible for letting all the threads know if anything has signalled a shut down. Most commonly this would be because an exception was raised, for example one of the threads got an error when running some operation (or an ordinary Python exception). For more about threading, queues, QueueRunners, and Coordinators -[see here](../../how_tos/threading_and_queues/index.md). +@{$threading_and_queues$see here}. #### Aside: How clean shut-down when limiting epochs works @@ -368,21 +366,21 @@ associated with a single QueueRunner. If this isn't the last thread in the QueueRunner, the `OutOfRange` error just causes the one thread to exit. This allows the other threads, which are still finishing up their last file, to proceed until they finish as well. (Assuming you are using a -[`tf.train.Coordinator`](../../api_docs/python/train.md#Coordinator), +@{tf.train.Coordinator}, other types of errors will cause all the threads to stop.) Once all the reader threads hit the `OutOfRange` error, only then does the next queue, the example queue, gets closed. Again, the example queue will have some elements queued, so training will continue until those are exhausted. If the example queue is a -[`RandomShuffleQueue`](../../api_docs/python/io_ops.md#RandomShuffleQueue), say +@{tf.RandomShuffleQueue}, say because you are using `shuffle_batch` or `shuffle_batch_join`, it normally will avoid ever having fewer than its `min_after_dequeue` attr elements buffered. However, once the queue is closed that restriction will be lifted and the queue will eventually empty. At that point the actual training threads, when they try and dequeue from example queue, will start getting `OutOfRange` errors and exiting. Once all the training threads are done, -[`tf.train.Coordinator.join`](../../api_docs/python/train.md#Coordinator.join) +@{tf.train.Coordinator.join} will return and you can exit cleanly. ### Filtering records or producing multiple examples per record @@ -398,7 +396,7 @@ when calling one of the batching functions (such as `shuffle_batch` or SparseTensors don't play well with queues. If you use SparseTensors you have to decode the string records using -[`tf.parse_example`](../../api_docs/python/io_ops.md#parse_example) **after** +@{tf.parse_example} **after** batching (instead of using `tf.parse_single_example` before batching). ## Preloaded data @@ -446,11 +444,11 @@ update it when training. Setting `collections=[]` keeps the variable out of the `GraphKeys.GLOBAL_VARIABLES` collection used for saving and restoring checkpoints. Either way, -[`tf.train.slice_input_producer function`](../../api_docs/python/io_ops.md#slice_input_producer) +@{tf.train.slice_input_producer} can be used to produce a slice at a time. This shuffles the examples across an entire epoch, so further shuffling when batching is undesirable. So instead of using the `shuffle_batch` functions, we use the plain -[`tf.train.batch` function](../../api_docs/python/io_ops.md#batch). To use +@{tf.train.batch} function. To use multiple preprocessing threads, set the `num_threads` parameter to a number bigger than 1. @@ -471,11 +469,11 @@ another. One way to do this is to actually have two separate processes: model that reads validation input data. This is what is done in -[the example CIFAR-10 model](../../tutorials/deep_cnn/index.md#save-and-restore-checkpoints). This has a couple of benefits: +@{$deep_cnn#save-and-restore-checkpoints$the example CIFAR-10 model}. This has a couple of benefits: * The eval is performed on a single snapshot of the trained variables. * You can perform the eval even after training has completed and exited. You can have the train and eval in the same graph in the same process, and share their trained variables. See -[the shared variables tutorial](../../how_tos/variable_scope/index.md). +@{$variable_scope$the shared variables tutorial}. diff --git a/tensorflow/g3doc/how_tos/supervisor/index.md b/tensorflow/docs_src/programmers_guide/supervisor.md similarity index 91% rename from tensorflow/g3doc/how_tos/supervisor/index.md rename to tensorflow/docs_src/programmers_guide/supervisor.md index 7b3e7677a2..5ea88cf64c 100644 --- a/tensorflow/g3doc/how_tos/supervisor/index.md +++ b/tensorflow/docs_src/programmers_guide/supervisor.md @@ -17,17 +17,17 @@ checkpoint and load it before resuming training. To be monitored through TensorBoard, the training process must run summary ops regularly and append the returned values to an events file as explained in -[TensorBoard: Visualizing Learning](../summaries_and_tensorboard/index.md). +@{$summaries_and_tensorboard$TensorBoard: Visualizing Learning}. TensorBoard monitors events files and displays graphs reporting training progress over time. -The [`tf.Supervisor` class](../../api_docs/python/train.md#Supervisor) provides +The @{tf.train.Supervisor} provides a set of services that helps implement a robust training process. This how-to shows how to use the supervisor directly. Please also consider using one of several frameworks built on top of the supervisor that provide richer training loops, and numerous customization options: -[`tf.learn`](../../api_docs/python/contrib.learn.md) is a good choice. +@{$python/contrib.learn$`tf.learn`} is a good choice. Note that the supervisor is very helpful for training large models, but can also be used for smaller models without any penalty. @@ -40,7 +40,7 @@ The simplest scenario for using a supervisor is to: save checkpoints and summaries. * Ask the supervisor for a session with - [`managed_session()`](../../api_docs/python/train.md#Supervisor.managed_session). + @{tf.train.Supervisor.managed_session}. * Use the session to execute a train op, checking at each step if the supervisor requests that the training stops. @@ -64,8 +64,7 @@ services, which run in their own threads, and use the managed session to run ops in your graph. If your graph contains an integer variable named `global_step`, the services -use its value to measure the number of training steps executed. See the [MNIST -training tutorial](../../tutorials/mnist/tf/index.md#training) for how to +use its value to measure the number of training steps executed. See the @{$mechanics#training$MNIST training tutorial} for how to create a `global_step` variable. * _Checkpointing_ service: Saves a copy of the graph variables in the logdir. @@ -73,7 +72,7 @@ create a `global_step` variable. was added to your graph. Runs every 10 minutes by default. * _Summary_ service: Runs all the summary ops and appends their output to an - [events file](../summaries_and_tensorboard/index.md) in the logdir. Runs + @{$summaries_and_tensorboard$events file} in the logdir. Runs every 2 minutes by default. * _Step counter_: Counts how many steps have been executed, by looking at @@ -81,8 +80,7 @@ create a `global_step` variable. reporting the number of global steps per second. The summary tag is "global_step/sec". This also runs every 2 minutes by default. - * _Queue Runners_: If any [queue - runners](../../api_docs/python/train.md#QueueRunner) were added to the + * _Queue Runners_: If any @{tf.train.QueueRunner} were added to the graph, the supervisor launches them in their own threads. All time intervals can be changed when constructing the supervisor object. See @@ -161,7 +159,7 @@ from scratch, not when the model can be recovered from a checkpoint from the logdir. To load the pre-trained model, the init function needs a -[`tf.Saver`](../../api_docs/python/train.md#Saver) object, so you should create +@{tf.train.Saver} object, so you should create a saver for this purpose. This is usually a good idea because the new model may contain variables that are not present in the pre-trained checkpoint: This saver must only restore the pre-trained variables. If you were using the @@ -196,7 +194,7 @@ to the main training loop. You sometimes want to add your own services, for example to fetch different sets of summaries on a different schedule than the usual summary service. -Use the [`loop()`](../../api_docs/python/train.md#Supervisor.loop) method of +Use the @{tf.train.Supervisor.loop} method of the supervisor for this purpose. It repeatedly calls a function of your choice on a timer until the supervisor stop condition becomes true, so it plays nicely with the other services. @@ -220,13 +218,13 @@ def my_additional_sumaries(sv, sess): ## Writing Summaries The supervisor always creates an events file in its logdir, as well as a -[`tf.SummaryWriter`](../../api_docs/python/train.md#SummaryWriter) to append +@{tf.summary.FileWriter} to append events and summaries to that file. If you want to write your own summaries it is a good idea to append them to that same events file: TensorBoard likes it better when only one events file in a directory is being actively appended to. The supervisor provides a helper function to append summaries: -[`sv.summary_computed()`](../../api_docs/python/train.md#Supervisor.summary_computed). +@{tf.train.Supervisor.summary_computed}. Just pass to the function the output returned by a summary op. Here is an example of using that function to implement `my_additional_sumaries()` from the previous example: @@ -239,7 +237,7 @@ def my_additional_sumaries(sv, sess): For more advanced usages, the supervisor provides access to its summary writer through its -[`summary_writer`](../../api_docs/python/train.md#Supervisor.summary_writer) +@{tf.train.Supervisor.summary_writer} attribute. ## Supervisor Reference @@ -275,7 +273,7 @@ constructor: crash: you will never lose more than `save_model_secs` seconds of work. Setting this to 0 disables the checkpointing service. - * `saver`: A [`tf.Saver`](../../api_docs/python/train.md#Saver) object to use + * `saver`: A @{tf.train.Saver} object to use for checkpointing. If you do not pass one, the supervisor creates one for you by calling @@ -314,8 +312,7 @@ constructor: * `summary_op`: Op to use to fetch the summaries. If not specified, the supervisor use the first op in the - `tf.GraphKeys.SUMMARY_OP` [graph - collection](../../api_docs/python/framework#Graph.add_to_collection). If + `tf.GraphKeys.SUMMARY_OP` @{tf.Graph.add_to_collection$graph collection}. If the collection is empty the supervisor creates an op that aggregates all summaries in the graph using `tf.summary.merge_all()`. @@ -324,8 +321,7 @@ constructor: * `global_step`: Tensor to use to count the global step. If not specified, the supervisor uses the first tensor in the - `tf.GraphKeys.GLOBAL_STEP` [graph - collection](../../api_docs/python/framework#Graph.add_to_collection). If + `tf.GraphKeys.GLOBAL_STEP` @{tf.Graph.add_to_collection$graph collection}. If the collection is empty, the supervisor looks for a scalar integer variable named `global_step` in the graph. @@ -359,8 +355,8 @@ following keyword arguments to the `Supervisor()` constructor: If an init op is also used, the init function is called _after_ the init op. * `local_init_op`: An additional op to initialize parts of the graph that are - not saved in checkpoints such as tables and [local - variables](../../api_docs/python/contrib.framework.md#local_variable). The + not saved in checkpoints such as tables and + @{tf.contrib.framework.local_variable$local variables}. The local init op is run _before_ the init op and the init function. If not specified, the supervisor uses the first op in the diff --git a/tensorflow/g3doc/how_tos/debugger/tfdbg-tflearn.md b/tensorflow/docs_src/programmers_guide/tfdbg-tflearn.md similarity index 86% rename from tensorflow/g3doc/how_tos/debugger/tfdbg-tflearn.md rename to tensorflow/docs_src/programmers_guide/tfdbg-tflearn.md index 17ba37908c..bcf3890ec6 100644 --- a/tensorflow/g3doc/how_tos/debugger/tfdbg-tflearn.md +++ b/tensorflow/docs_src/programmers_guide/tfdbg-tflearn.md @@ -2,12 +2,12 @@ [TOC] -In [a previous tutorial](index.md), we described how to use TensorFlow Debugger (**tfdbg**) +In @{$debugger$a previous tutorial}, we described how to use TensorFlow Debugger (**tfdbg**) to debug TensorFlow graphs running in -[`tf.Session`](https://tensorflow.org/api_docs/python/client.html#Session) +@{tf.Session} objects managed by yourself. However, many users find -[`tf.contrib.learn`](https://tensorflow.org/tutorials/tflearn/index.html) -[Estimator](https://tensorflow.org/api_docs/python/contrib.learn.html?cl=head#Estimator)s +@{$tflearn$`tf.contrib.learn`} +@{tf.contrib.learn.Estimator$Estimator}s to be a convenient higher-level API for creating and using models in TensorFlow. Part of the convenience is that `Estimator`s manage `Session`s internally. Fortunately, you can still use `tfdbg` with `Estimator`s by adding @@ -16,9 +16,8 @@ special hooks. ## Debugging tf.contrib.learn Estimators Currently, **tfdbg** can debug the -[fit()](https://tensorflow.org/api_docs/python/contrib.learn.html#BaseEstimator.fit) -and -[evaluate()](https://tensorflow.org/api_docs/python/contrib.learn.html#BaseEstimator.evaluate) +@{tf.contrib.learn.BaseEstimator.fit$`fit()`} +@{tf.contrib.learn.BaseEstimator.evaluate$`evaluate()`} methods of tf-learn `Estimator`s. To debug `Estimator.fit()`, create a `LocalCLIDebugHook` and supply it as the `monitors` argument. For example: @@ -45,7 +44,7 @@ accuracy_score = classifier.evaluate(x=test_set.data, For a detailed [example](https://www.tensorflow.org/code/tensorflow/python/debug/examples/debug_tflearn_iris.py) based on -[tf-learn's iris tutorial](../../../g3doc/tutorials/tflearn/index.md), +@{$tflearn$tf-learn's iris tutorial}, run: ```none @@ -117,5 +116,5 @@ python -m tensorflow.python.debug.cli.offline_analyzer \ The `LocalCLIDebugHook` also allows you to configure a `watch_fn` that can be used to flexibly specify what `Tensor`s to watch on different `Session.run()` calls, as a function of the `fetches` and `feed_dict` and other states. See -[this API doc](../../api_docs/python/tf_debug.md#DumpingDebugWrapperSession.__init__) +@{tfdbg.DumpingDebugWrapperSession.__init__$this API doc} for more details. diff --git a/tensorflow/g3doc/how_tos/threading_and_queues/index.md b/tensorflow/docs_src/programmers_guide/threading_and_queues.md similarity index 86% rename from tensorflow/g3doc/how_tos/threading_and_queues/index.md rename to tensorflow/docs_src/programmers_guide/threading_and_queues.md index 3b2c8adcbc..1999cf6941 100644 --- a/tensorflow/g3doc/how_tos/threading_and_queues/index.md +++ b/tensorflow/docs_src/programmers_guide/threading_and_queues.md @@ -14,7 +14,7 @@ that takes an item off the queue, adds one to that item, and puts it back on the end of the queue. Slowly, the numbers on the queue increase.
- +
`Enqueue`, `EnqueueMany`, and `Dequeue` are special nodes. They take a pointer @@ -30,8 +30,8 @@ Now that you have a bit of a feel for queues, let's dive into the details... ## Queue usage overview -Queues, such as [`FIFOQueue`](../../api_docs/python/io_ops.md#FIFOQueue) -and [`RandomShuffleQueue`](../../api_docs/python/io_ops.md#RandomShuffleQueue), +Queues, such as @{tf.FIFOQueue} +and @{tf.RandomShuffleQueue}, are important TensorFlow objects for computing tensors asynchronously in a graph. @@ -43,7 +43,7 @@ prepare inputs for training a model: queue This architecture has many benefits, as highlighted in the -[Reading data how to](../reading_data), which also gives an overview of +@{$reading_data$Reading data how to}, which also gives an overview of functions that simplify the construction of input pipelines. The TensorFlow `Session` object is multithreaded, so multiple threads can @@ -53,8 +53,8 @@ threads must be able to stop together, exceptions must be caught and reported, and queues must be properly closed when stopping. TensorFlow provides two classes to help: -[`tf.train.Coordinator`](../../api_docs/python/train.md#Coordinator) and -[`tf.train.QueueRunner`](../../api_docs/python/train.md#QueueRunner). These two classes +@{tf.train.Coordinator} and +@{tf.train.QueueRunner}. These two classes are designed to be used together. The `Coordinator` class helps multiple threads stop together and report exceptions to a program that waits for them to stop. The `QueueRunner` class is used to create a number of threads cooperating to @@ -66,9 +66,9 @@ The `Coordinator` class helps multiple threads stop together. Its key methods are: -* [`should_stop()`](../../api_docs/python/train.md#Coordinator.should_stop): returns True if the threads should stop. -* [`request_stop(exception)`](../../api_docs/python/train.md#Coordinator.request_stop): requests that threads should stop. -* [`join(thread_list)`](../../api_docs/python/train.md#Coordinator.join): waits until the specified threads have stopped. +* @{tf.train.Coordinator.should_stop}: returns True if the threads should stop. +* @{tf.train.Coordinator.request_stop}: requests that threads should stop. +* @{tf.train.Coordinator.join}: waits until the specified threads have stopped. You first create a `Coordinator` object, and then create a number of threads that use the coordinator. The threads typically run loops that stop when @@ -101,7 +101,7 @@ coord.join(threads) Obviously, the coordinator can manage threads doing very different things. They don't have to be all the same as in the example above. The coordinator -also has support to capture and report exceptions. See the [`tf.train.Coordinator`](../../api_docs/python/train.md#Coordinator) documentation for more details. +also has support to capture and report exceptions. See the @{tf.train.Coordinator} documentation for more details. ## QueueRunner diff --git a/tensorflow/g3doc/how_tos/variable_scope/index.md b/tensorflow/docs_src/programmers_guide/variable_scope.md similarity index 98% rename from tensorflow/g3doc/how_tos/variable_scope/index.md rename to tensorflow/docs_src/programmers_guide/variable_scope.md index fda5f3aac6..5084acbab9 100644 --- a/tensorflow/g3doc/how_tos/variable_scope/index.md +++ b/tensorflow/docs_src/programmers_guide/variable_scope.md @@ -1,7 +1,7 @@ # Sharing Variables You can create, initialize, save and load single variables -in the way described in the [Variables HowTo](../../how_tos/variables/index.md). +in the way described in the @{$variables$Variables HowTo}. But when building complex models you often need to share large sets of variables and you might want to initialize all of them in one place. This tutorial shows how this can be done using `tf.variable_scope()` and @@ -10,9 +10,9 @@ the `tf.get_variable()`. ## The Problem Imagine you create a simple model for image filters, similar to our -[Convolutional Neural Networks Tutorial](../../tutorials/deep_cnn/index.md) +@{$deep_cnn$Convolutional Neural Networks Tutorial} model but with only 2 convolutions (for simplicity of this example). If you use -just `tf.Variable`, as explained in [Variables HowTo](../../how_tos/variables/index.md), +just `tf.Variable`, as explained in @{$variables$Variables HowTo}, your model might look like this. ```python diff --git a/tensorflow/g3doc/how_tos/variables/index.md b/tensorflow/docs_src/programmers_guide/variables.md similarity index 89% rename from tensorflow/g3doc/how_tos/variables/index.md rename to tensorflow/docs_src/programmers_guide/variables.md index 99d5eeb995..9189618368 100644 --- a/tensorflow/g3doc/how_tos/variables/index.md +++ b/tensorflow/docs_src/programmers_guide/variables.md @@ -1,6 +1,6 @@ # Variables: Creation, Initialization, Saving, and Loading -When you train a model, you use [variables](../../api_docs/python/state_ops.md) +When you train a model, you use @{$python/state_ops$variables} to hold and update parameters. Variables are in-memory buffers containing tensors. They must be explicitly initialized and can be saved to disk during and after training. You can later restore saved values to exercise or analyze @@ -9,16 +9,16 @@ the model. This document references the following TensorFlow classes. Follow the links to their reference manual for a complete description of their API: -* The [`tf.Variable`](../../api_docs/python/state_ops.md#Variable) class. -* The [`tf.train.Saver`](../../api_docs/python/state_ops.md#Saver) class. +* The @{tf.Variable} class. +* The @{tf.train.Saver} class. ## Creation -When you create a [Variable](../../api_docs/python/state_ops.md) you pass a +When you create a @{$python/state_ops$Variable} you pass a `Tensor` as its initial value to the `Variable()` constructor. TensorFlow provides a collection of ops that produce tensors often used for initialization -from [constants or random values](../../api_docs/python/constant_op.md). +from @{$python/constant_op$constants or random values}. Note that all these ops require you to specify the shape of the tensors. That shape automatically becomes the shape of the variable. Variables generally @@ -46,7 +46,7 @@ The value returned by `tf.Variable()` value is an instance of the Python class ### Device placement A variable can be pinned to a particular device when it is created, using a -[`with tf.device(...):`](../../api_docs/python/framework.md#device) block: +@{tf.device$`with tf.device(...):`} block: ```python # Pin a variable to CPU. @@ -63,15 +63,15 @@ with tf.device("/job:ps/task:7"): ``` **N.B.** Operations that mutate a variable, such as -[`v.assign()`](../../api_docs/python/state_ops.md#Variable.assign) and the parameter +@{tf.Variable.assign} and the parameter update operations in a -[`tf.train.Optimizer`](../../api_docs/python/train.md#Optimizer) *must* run on +@{tf.train.Optimizer} *must* run on the same device as the variable. Incompatible device placement directives will be ignored when creating these operations. Device placement is particularly important when running in a replicated setting. See -[`tf.train.replica_device_setter()`](../../api_docs/python/train.md#replica_device_setter) +@{tf.train.replica_device_setter} for details of a device function that can simplify the configuration for devices for a replicated model. @@ -133,7 +133,7 @@ w_twice = tf.Variable(weights.initialized_value() * 2.0, name="w_twice") The convenience function `tf.global_variables_initializer()` adds an op to initialize *all variables* in the model. You can also pass an explicit list of variables to initialize to `tf.variables_initializer`. See the -[Variables Documentation](../../api_docs/python/state_ops.md) for more options, +@{$python/state_ops$Variables Documentation} for more options, including checking if variables are initialized. ## Saving and Restoring @@ -151,7 +151,7 @@ names to tensor values. When you create a `Saver` object, you can optionally choose names for the variables in the checkpoint files. By default, it uses the value of the -[`Variable.name`](../../api_docs/python/state_ops.md#Variable.name) property for +@{tf.Variable.name} property for each variable. To understand what variables are in a checkpoint, you can use the @@ -238,7 +238,7 @@ Notes: * If you only restore a subset of the model variables at the start of a session, you have to run an initialize op for the other variables. See - [`tf.variables_initializer()`](../../api_docs/python/state_ops.md#variables_initializer) + @{tf.variables_initializer} for more information. ```python diff --git a/tensorflow/g3doc/resources/versions.md b/tensorflow/docs_src/programmers_guide/version_semantics.md similarity index 64% rename from tensorflow/g3doc/resources/versions.md rename to tensorflow/docs_src/programmers_guide/version_semantics.md index 0a9d26b6a8..0f06d4b076 100644 --- a/tensorflow/g3doc/resources/versions.md +++ b/tensorflow/docs_src/programmers_guide/version_semantics.md @@ -6,15 +6,15 @@ TensorFlow follows Semantic Versioning 2.0 ([semver](http://semver.org)) for its public API. Each release version of TensorFlow has the form `MAJOR.MINOR.PATCH`. Changes to the each number have the following meaning: -* **MAJOR**:  Backwards incompatible changes.  Code and data that worked with +* **MAJOR**: Backwards incompatible changes. Code and data that worked with a previous major release will not necessarily work with a new release. However, in some cases existing TensorFlow data (graphs, checkpoints, and other protobufs) may be migratable to the newer release; see below for details on data compatibility. -* **MINOR**: Backwards compatible features, speed improvements, etc.  Code and +* **MINOR**: Backwards compatible features, speed improvements, etc. Code and data that worked with a previous minor release *and* which depends only the - public API will continue to work unchanged.  For details on what is and is + public API will continue to work unchanged. For details on what is and is not the public API, see below. * **PATCH**: Backwards compatible bug fixes. @@ -22,7 +22,7 @@ Changes to the each number have the following meaning: ## What is covered Only the public APIs of TensorFlow are backwards compatible across minor and -patch versions.  The public APIs consist of +patch versions. The public APIs consist of * The documented public [Python](../api_docs/python) API, excluding `tf.contrib`. This includes all public functions and classes (whose names do not start with @@ -54,41 +54,44 @@ patch versions.  The public APIs consist of Some API functions are explicitly marked as "experimental" and can change in backward incompatible ways between minor releases. These include: -* **Experimental APIs**: The `tf.contrib` module and its submodules in Python +* **Experimental APIs**: The @{tf.contrib} module and its submodules in Python and any functions in the C API or fields in protocol buffers that are explicitly commented as being experimental. -* **Other languages**: TensorFlow APIs in languages other than Python and C, - such as: +* **Other languages**: TensorFlow APIs in languages other than Python and C, + such as: - - [C++](../api_docs/cc) (exposed through header files in + - @{$cc/guide$C++} (exposed through header files in [`tensorflow/cc`](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/cc)). - - [Java](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/java) - ([#5](https://github.com/tensorflow/tensorflow/issues/5)), and + - [Java](../api_docs/java/reference/org/tensorflow/package-summary), and - [Go](https://godoc.org/github.com/tensorflow/tensorflow/tensorflow/go) -* **Details of composite ops:**  Many public functions in Python expand to - several primitive ops in the graph, and these details will be part of any - graphs saved to disk as `GraphDef`s.  These details are allowed to change for - minor releases. In particular, regressions tests that check for exact - matching between graphs are likely to break across minor releases, even though - the behavior of the graph should be unchanged and existing checkpoints will - still work. - -* **Floating point numerical details:** The specific floating point values - computed by ops may change at any time: users should rely only on approximate - accuracy and numerical stability, not on the specific bits computed.  Changes - to numerical formulas in minor and patch releases should result in comparable - or improved accuracy, with the caveat that in machine learning improved - accuracy of specific formulas may result in worse accuracy for the overall - system. - -* **Random numbers:** The specific random numbers computed by the [random - ops](../api_docs/python/constant_op.html#random-tensors) may change at any - time: users should rely only on approximately correct distributions and - statistical strength, not the specific bits computed.  However, we will make - changes to random bits rarely and ideally never for patch releases, and all - such intended changes will be documented. +* **Details of composite ops:** Many public functions in Python expand to + several primitive ops in the graph, and these details will be part of any + graphs saved to disk as `GraphDef`s. These details are allowed to change for + minor releases. In particular, regressions tests that check for exact + matching between graphs are likely to break across minor releases, even + though the behavior of the graph should be unchanged and existing + checkpoints will still work. + +* **Floating point numerical details:** The specific floating point values + computed by ops may change at any time: users should rely only on + approximate accuracy and numerical stability, not on the specific bits + computed. Changes to numerical formulas in minor and patch releases should + result in comparable or improved accuracy, with the caveat that in machine + learning improved accuracy of specific formulas may result in worse accuracy + for the overall system. + +* **Random numbers:** The specific random numbers computed by the + @{$python/constant_op#Random_Tensors$random ops} may change at any time: + users should rely only on approximately correct distributions and + statistical strength, not the specific bits computed. However, we will make + changes to random bits rarely and ideally never for patch releases, and all + such intended changes will be documented. + +* **Distributed Tensorflow:** Running 2 different versions of TensorFlow in a + single cluster is unsupported. There are no guarantees about backwards + compatibility of the wire protocol. Furthermore, any API methods marked "deprecated" in the 1.0 release can be deleted in any subsequent minor release. @@ -97,9 +100,9 @@ be deleted in any subsequent minor release. Many users of TensorFlow will be saving graphs and trained models to disk for later evaluation or more training, often changing versions of TensorFlow in the -process.  First, following semver, any graph or checkpoint written out with one +process. First, following semver, any graph or checkpoint written out with one version of TensorFlow can be loaded and evaluated with a later version of -TensorFlow with the same major release.  However, we will endeavour to preserve +TensorFlow with the same major release. However, we will endeavour to preserve backwards compatibility even across major releases when possible, so that the serialized files are usable over long periods of time. @@ -108,13 +111,13 @@ Graphs describe the data flow graphs of ops to be run during training and inference, and checkpoints contain the saved tensor values of variables in a graph. -Graphs are serialized via the `GraphDef` protocol buffer.  To facilitate (rare) +Graphs are serialized via the `GraphDef` protocol buffer. To facilitate (rare) backwards incompatible changes to graphs, each `GraphDef` has an integer version -separate from the TensorFlow version.  The semantics are: +separate from the TensorFlow version. The semantics are: -* Each version of TensorFlow supports an interval of `GraphDef` versions.  This +* Each version of TensorFlow supports an interval of `GraphDef` versions. This interval with be constant across patch releases, and will only grow across - minor releases.  Dropping support for a `GraphDef` version will only occur + minor releases. Dropping support for a `GraphDef` version will only occur for a major release of TensorFlow. * Newly created graphs use the newest `GraphDef` version. @@ -122,15 +125,15 @@ separate from the TensorFlow version.  The semantics are: * If a given version of TensorFlow supports the `GraphDef` version of a graph, it will load and evaluate with the same behavior as when it was written out (except for floating point numerical details and random numbers), regardless - of the major version of TensorFlow.  In particular, all checkpoint files will + of the major version of TensorFlow. In particular, all checkpoint files will be compatible. * If the `GraphDef` upper bound is increased to X in a (minor) release, there will be at least six months before the lower bound is increased to X. For example (numbers and versions hypothetical), TensorFlow 1.2 might support -`GraphDef` versions 4 to 7.  TensorFlow 1.3 could add `GraphDef` version 8 and -support versions 4 to 8.  At least six months later, TensorFlow 2.0.0 could drop +`GraphDef` versions 4 to 7. TensorFlow 1.3 could add `GraphDef` version 8 and +support versions 4 to 8. At least six months later, TensorFlow 2.0.0 could drop support for versions 4 to 7, leaving version 8 only. Finally, when support for a `GraphDef` version is dropped, we will attempt to @@ -138,5 +141,5 @@ provide tools for automatically converting graphs to a newer supported `GraphDef` version. For developer-level details about `GraphDef` versioning, including how to evolve -the versions to account for changes, see [TensorFlow Data -Versioning](data_versions.md). +the versions to account for changes, see +@{$data_versions$TensorFlow Data Versioning}. diff --git a/tensorflow/g3doc/tutorials/deep_cnn/index.md b/tensorflow/docs_src/tutorials/deep_cnn.md similarity index 80% rename from tensorflow/g3doc/tutorials/deep_cnn/index.md rename to tensorflow/docs_src/tutorials/deep_cnn.md index 8c3eeb40cb..ba3fbe1280 100644 --- a/tensorflow/g3doc/tutorials/deep_cnn/index.md +++ b/tensorflow/docs_src/tutorials/deep_cnn.md @@ -34,26 +34,26 @@ new ideas and experimenting with new techniques. The CIFAR-10 tutorial demonstrates several important constructs for designing larger and more sophisticated models in TensorFlow: -* Core mathematical components including [convolution](../../api_docs/python/nn.md#conv2d) +* Core mathematical components including @{tf.nn.conv2d$convolution} ([wiki](https://en.wikipedia.org/wiki/Convolution)), -[rectified linear activations](../../api_docs/python/nn.md#relu) +@{tf.nn.relu$rectified linear activations} ([wiki](https://en.wikipedia.org/wiki/Rectifier_(neural_networks))), -[max pooling](../../api_docs/python/nn.md#max_pool) +@{tf.nn.max_pool$max pooling} ([wiki](https://en.wikipedia.org/wiki/Convolutional_neural_network#Pooling_layer)) -and [local response normalization](../../api_docs/python/nn.md#local_response_normalization) +and @{tf.nn.local_response_normalization$local response normalization} (Chapter 3.3 in [AlexNet paper](http://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf)). -* [Visualization](../../how_tos/summaries_and_tensorboard/index.md) +* @{$summaries_and_tensorboard$Visualization} of network activities during training, including input images, losses and distributions of activations and gradients. * Routines for calculating the -[moving average](../../api_docs/python/train.md#ExponentialMovingAverage) +@{tf.train.ExponentialMovingAverage$moving average} of learned parameters and using these averages during evaluation to boost predictive performance. * Implementation of a -[learning rate schedule](../../api_docs/python/train.md#exponential_decay) +@{tf.train.exponential_decay$learning rate schedule} that systematically decrements over time. -* Prefetching [queues](../../api_docs/python/io_ops.md#shuffle_batch) +* Prefetching @{tf.train.shuffle_batch$queues} for input data to isolate the model from disk latency and expensive image pre-processing. @@ -116,38 +116,38 @@ gradients, variable updates and visualization summaries. The input part of the model is built by the functions `inputs()` and `distorted_inputs()` which read images from the CIFAR-10 binary data files. These files contain fixed byte length records, so we use -[`tf.FixedLengthRecordReader`](../../api_docs/python/io_ops.md#FixedLengthRecordReader). -See [Reading Data](../../how_tos/reading_data/index.md#reading-from-files) to +@{tf.FixedLengthRecordReader}. +See @{$reading_data#reading-from-files$Reading Data} to learn more about how the `Reader` class works. The images are processed as follows: * They are cropped to 24 x 24 pixels, centrally for evaluation or - [randomly](../../api_docs/python/constant_op.md#random_crop) for training. -* They are [approximately whitened](../../api_docs/python/image.md#per_image_standardization) + @{tf.random_crop$randomly} for training. +* They are @{tf.image.per_image_standardization$approximately whitened} to make the model insensitive to dynamic range. For training, we additionally apply a series of random distortions to artificially increase the data set size: -* [Randomly flip](../../api_docs/python/image.md#random_flip_left_right) the image from left to right. -* Randomly distort the [image brightness](../../api_docs/python/image.md#random_brightness). -* Randomly distort the [image contrast](../../api_docs/python/image.md#random_contrast). +* @{tf.image.random_flip_left_right$Randomly flip} the image from left to right. +* Randomly distort the @{tf.image.random_brightness$image brightness}. +* Randomly distort the @{tf.image.random_contrast$image contrast}. -Please see the [Images](../../api_docs/python/image.md) page for the list of +Please see the @{$python/image$Images} page for the list of available distortions. We also attach an -[`image`](../../api_docs/python/summary.md#image) to the images -so that we may visualize them in [TensorBoard](../../how_tos/summaries_and_tensorboard/index.md). +@{tf.summary.image} to the images +so that we may visualize them in @{$summaries_and_tensorboard$TensorBoard}. This is a good practice to verify that inputs are built correctly.
- +
Reading images from disk and distorting them can use a non-trivial amount of processing time. To prevent these operations from slowing down training, we run them inside 16 separate threads which continuously fill a TensorFlow -[queue](../../api_docs/python/io_ops.md#shuffle_batch). +@{tf.train.shuffle_batch$queue}. ### Model Prediction @@ -157,25 +157,25 @@ the model is organized as follows: Layer Name | Description --- | --- -`conv1` | [convolution](../../api_docs/python/nn.md#conv2d) and [rectified linear](../../api_docs/python/nn.md#relu) activation. -`pool1` | [max pooling](../../api_docs/python/nn.md#max_pool). -`norm1` | [local response normalization](../../api_docs/python/nn.md#local_response_normalization). -`conv2` | [convolution](../../api_docs/python/nn.md#conv2d) and [rectified linear](../../api_docs/python/nn.md#relu) activation. -`norm2` | [local response normalization](../../api_docs/python/nn.md#local_response_normalization). -`pool2` | [max pooling](../../api_docs/python/nn.md#max_pool). -`local3` | [fully connected layer with rectified linear activation](../../api_docs/python/nn.md). -`local4` | [fully connected layer with rectified linear activation](../../api_docs/python/nn.md). +`conv1` | @{tf.nn.conv2d$convolution} and @{tf.nn.relu$rectified linear} activation. +`pool1` | @{tf.nn.max_pool$max pooling}. +`norm1` | @{tf.nn.local_response_normalization$local response normalization}. +`conv2` | @{tf.nn.conv2d$convolution} and @{tf.nn.relu$rectified linear} activation. +`norm2` | @{tf.nn.local_response_normalization$local response normalization}. +`pool2` | @{tf.nn.max_pool$max pooling}. +`local3` | @{$python/nn$fully connected layer with rectified linear activation}. +`local4` | @{$python/nn$fully connected layer with rectified linear activation}. `softmax_linear` | linear transformation to produce logits. Here is a graph generated from TensorBoard describing the inference operation:
- +
> **EXERCISE**: The output of `inference` are un-normalized logits. Try editing the network architecture to return normalized predictions using -[`tf.nn.softmax()`](../../api_docs/python/nn.md#softmax). +@{tf.nn.softmax}. The `inputs()` and `inference()` functions provide all the components necessary to perform evaluation on a model. We now shift our focus towards @@ -193,32 +193,32 @@ architecture in the top layer. The usual method for training a network to perform N-way classification is [multinomial logistic regression](https://en.wikipedia.org/wiki/Multinomial_logistic_regression), aka. *softmax regression*. Softmax regression applies a -[softmax](../../api_docs/python/nn.md#softmax) nonlinearity to the +@{tf.nn.softmax$softmax} nonlinearity to the output of the network and calculates the -[cross-entropy](../../api_docs/python/nn.md#softmax_cross_entropy_with_logits) +@{tf.nn.softmax_cross_entropy_with_logits$cross-entropy} between the normalized predictions and a -[1-hot encoding](../../api_docs/python/sparse_ops.md#sparse_to_dense) of the label. +@{tf.sparse_to_dense$1-hot encoding} of the label. For regularization, we also apply the usual -[weight decay](../../api_docs/python/nn.md#l2_loss) losses to all learned +@{tf.nn.l2_loss$weight decay} losses to all learned variables. The objective function for the model is the sum of the cross entropy loss and all these weight decay terms, as returned by the `loss()` function. -We visualize it in TensorBoard with a [`scalar`](../../api_docs/python/summary.md#scalar): +We visualize it in TensorBoard with a @{tf.summary.scalar}: -![CIFAR-10 Loss](../../images/cifar_loss.png "CIFAR-10 Total Loss") +![CIFAR-10 Loss](../images/cifar_loss.png "CIFAR-10 Total Loss") We train the model using standard [gradient descent](https://en.wikipedia.org/wiki/Gradient_descent) -algorithm (see [Training](../../api_docs/python/train.md) for other methods) +algorithm (see @{$python/train$Training} for other methods) with a learning rate that -[exponentially decays](../../api_docs/python/train.md#exponential_decay) +@{tf.train.exponential_decay$exponentially decays} over time. -![CIFAR-10 Learning Rate Decay](../../images/cifar_lr_decay.png "CIFAR-10 Learning Rate Decay") +![CIFAR-10 Learning Rate Decay](../images/cifar_lr_decay.png "CIFAR-10 Learning Rate Decay") The `train()` function adds the operations needed to minimize the objective by calculating the gradient and updating the learned variables (see -[`GradientDescentOptimizer`](../../api_docs/python/train.md#GradientDescentOptimizer) +@{tf.train.GradientDescentOptimizer} for details). It returns an operation that executes all the calculations needed to train and update the model for one batch of images. @@ -267,9 +267,9 @@ training step can take so long. Try decreasing the number of images that initially fill up the queue. Search for `min_fraction_of_examples_in_queue` in `cifar10_input.py`. -`cifar10_train.py` periodically [saves](../../api_docs/python/state_ops.md#Saver) +`cifar10_train.py` periodically @{tf.train.Saver$saves} all model parameters in -[checkpoint files](../../how_tos/variables/index.md#saving-and-restoring) +@{$variables#saving-and-restoring$checkpoint files} but it does *not* evaluate the model. The checkpoint file will be used by `cifar10_eval.py` to measure the predictive performance (see [Evaluating a Model](#evaluating-a-model) below). @@ -286,17 +286,17 @@ how the model is training. We want more insight into the model during training: * Are the gradients, activations and weights reasonable? * What is the learning rate currently at? -[TensorBoard](../../how_tos/summaries_and_tensorboard/index.md) provides this +@{$summaries_and_tensorboard$TensorBoard} provides this functionality, displaying data exported periodically from `cifar10_train.py` via a -[`FileWriter`](../../api_docs/python/summary.md#FileWriter). +@{tf.summary.FileWriter}. For instance, we can watch how the distribution of activations and degree of sparsity in `local3` features evolve during training:
- - + +
Individual loss functions, as well as the total loss, are particularly @@ -304,7 +304,7 @@ interesting to track over time. However, the loss exhibits a considerable amount of noise due to the small batch size employed by training. In practice we find it extremely useful to visualize their moving averages in addition to their raw values. See how the scripts use -[`ExponentialMovingAverage`](../../api_docs/python/train.md#ExponentialMovingAverage) +@{tf.train.ExponentialMovingAverage} for this purpose. ## Evaluating a Model @@ -340,7 +340,7 @@ exports summaries that may be visualized in TensorBoard. These summaries provide additional insight into the model during evaluation. The training script calculates the -[moving average](../../api_docs/python/train.md#ExponentialMovingAverage) +@{tf.train.ExponentialMovingAverage$moving average} version of all learned variables. The evaluation script substitutes all learned model parameters with the moving average version. This substitution boosts model performance at evaluation time. @@ -378,7 +378,7 @@ processing a batch of data. Here is a diagram of this model:
- +
Note that each GPU computes inference as well as the gradients for a unique @@ -405,19 +405,19 @@ gradients for a single model replica. In the code we term this abstraction a "tower". We must set two attributes for each tower: * A unique name for all operations within a tower. -[`tf.name_scope()`](../../api_docs/python/framework.md#name_scope) provides +@{tf.name_scope} provides this unique name by prepending a scope. For instance, all operations in the first tower are prepended with `tower_0`, e.g. `tower_0/conv1/Conv2D`. * A preferred hardware device to run the operation within a tower. -[`tf.device()`](../../api_docs/python/framework.md#device) specifies this. For +@{tf.device} specifies this. For instance, all operations in the first tower reside within `device('/gpu:0')` scope indicating that they should be run on the first GPU. All variables are pinned to the CPU and accessed via -[`tf.get_variable()`](../../api_docs/python/state_ops.md#get_variable) +@{tf.get_variable} in order to share them in a multi-GPU version. -See how-to on [Sharing Variables](../../how_tos/variable_scope/index.md). +See how-to on @{$variable_scope$Sharing Variables}. ### Launching and Training the Model on Multiple GPU cards diff --git a/tensorflow/g3doc/tutorials/image_recognition/index.md b/tensorflow/docs_src/tutorials/image_recognition.md similarity index 96% rename from tensorflow/g3doc/tutorials/image_recognition/index.md rename to tensorflow/docs_src/tutorials/image_recognition.md index 0915000953..6aafd1973f 100644 --- a/tensorflow/g3doc/tutorials/image_recognition/index.md +++ b/tensorflow/docs_src/tutorials/image_recognition.md @@ -36,7 +36,7 @@ images into [1000 classes], like "Zebra", "Dalmatian", and "Dishwasher". For example, here are the results from [AlexNet] classifying some images:
- +
To compare models, we examine how often the model fails to predict the @@ -75,7 +75,7 @@ Start by cloning the [TensorFlow models repo](https://github.com/tensorflow/mode The above command will classify a supplied image of a panda bear.
- +
If the model runs correctly, the script will produce the following output: @@ -106,8 +106,8 @@ unzip tensorflow/examples/label_image/data/inception_dec_2015.zip -d tensorflow/ ``` Next, we need to compile the C++ binary that includes the code to load and run the graph. -If you've followed [the instructions to download the source installation of -TensorFlow](../../get_started/os_setup.md#installing-from-sources) +If you've followed +@{$install_sources$the instructions to download the source installation of TensorFlow} for your platform, you should be able to build the example by running this command from your shell terminal: @@ -138,7 +138,7 @@ score of 0.6.
- +
Next, try it out on your own images by supplying the --image= argument, e.g. @@ -254,7 +254,7 @@ definition with the `ToGraphDef()` function. TF_RETURN_IF_ERROR(session->Run({}, {output_name}, {}, out_tensors)); return Status::OK(); ``` -Then we create a [`Session`](../../api_docs/cc/class/tensorflow/session) +Then we create a @{tf.Session} object, which is the interface to actually running the graph, and run it, specifying which node we want to get the output from, and where to put the output data. @@ -435,7 +435,7 @@ should be able to transfer some of that understanding to solving related problems. One way to perform transfer learning is to remove the final classification layer of the network and extract the [next-to-last layer of the CNN](http://arxiv.org/abs/1310.1531), in this case a 2048 dimensional vector. -There's a guide to doing this [in the how-to section](../../how_tos/image_retraining/index.html). +There's a guide to doing this @{$image_retraining$in the how-to section}. ## Resources for Learning More @@ -449,11 +449,10 @@ and Michael Nielsen's book has a [great chapter](http://neuralnetworksanddeeplearning.com/chap6.html) covering them. -To find out more about implementing convolutional neural networks, you can jump to -the TensorFlow [deep convolutional networks tutorial](http://www.tensorflow.org/tutorials/deep_cnn/index.html), +To find out more about implementing convolutional neural networks, you can jump +to the TensorFlow @{$deep_cnn$deep convolutional networks tutorial}, or start a bit more gently with our -[ML beginner](http://www.tensorflow.org/tutorials/mnist/beginners/index.html) -or [ML expert](http://www.tensorflow.org/tutorials/mnist/pros/index.html) +@{$beginners$ML beginner} or @{$pros$ML expert} MNIST starter tutorials. Finally, if you want to get up to speed on research in this area, you can read the recent work of all the papers referenced in this tutorial. diff --git a/tensorflow/g3doc/how_tos/image_retraining/index.md b/tensorflow/docs_src/tutorials/image_retraining.md similarity index 97% rename from tensorflow/g3doc/how_tos/image_retraining/index.md rename to tensorflow/docs_src/tutorials/image_retraining.md index 9fb78a121f..4a1388ea4c 100644 --- a/tensorflow/g3doc/how_tos/image_retraining/index.md +++ b/tensorflow/docs_src/tutorials/image_retraining.md @@ -18,7 +18,7 @@ to help control the training process. ## Training on Flowers -![Daisies by Kelly Sikkema](../../images/daisies.jpg) +![Daisies by Kelly Sikkema](../images/daisies.jpg) [Image by Kelly Sikkema](https://www.flickr.com/photos/95072945@N05/9922116524/) Before you start any training, you'll need a set of images to teach the network @@ -29,7 +29,7 @@ set of flower photos, run these commands: ```sh cd ~ -curl -O http://download.tensorflow.org/example_images/flower_photos.tgz +curl -O http://download.tensorflow.org/example_../images/flower_photos.tgz tar xzf flower_photos.tgz ``` @@ -40,7 +40,8 @@ of your TensorFlow source directory: bazel build tensorflow/examples/image_retraining:retrain ``` -If you have a machine which supports [the AVX instruction set](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions) +If you have a machine which supports +[the AVX instruction set](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions) (common in x86 CPUs produced in the last few years) you can improve the running speed of the retraining by building for that architecture, like this (after choosing appropriate options in `configure`): @@ -138,7 +139,7 @@ The [TensorBoard README](https://www.tensorflow.org/code/tensorflow/tensorboard/ The script will write out a version of the Inception v3 network with a final layer retrained to your categories to /tmp/output_graph.pb, and a text file containing the labels to /tmp/output_labels.txt. These are both in a format that -the [C++ and Python image classification examples](https://www.tensorflow.org/versions/master/tutorials/image_recognition/index.html) +the @{$image_recognition$C++ and Python image classification examples} can read in, so you can start using your new model immediately. Since you've replaced the top layer, you will need to specify the new name in the script, for example with the flag `--output_layer=final_result` if you're using label_image. @@ -173,7 +174,7 @@ you do that and pass the root folder of the subdirectories as the argument to Here's what the folder structure of the flowers archive looks like, to give you and example of the kind of layout the script is looking for: -![Folder Structure](../../images/folder_structure.png) +![Folder Structure](../images/folder_structure.png) In practice it may take some work to get the accuracy you want. I'll try to guide you through some of the common problems you might encounter below. diff --git a/tensorflow/g3doc/tutorials/layers/index.md b/tensorflow/docs_src/tutorials/layers.md similarity index 80% rename from tensorflow/g3doc/tutorials/layers/index.md rename to tensorflow/docs_src/tutorials/layers.md index 9b8fc301e7..d7f294a38c 100644 --- a/tensorflow/g3doc/tutorials/layers/index.md +++ b/tensorflow/docs_src/tutorials/layers.md @@ -1,15 +1,13 @@ # A Guide to TF Layers: Building a Convolutional Neural Network -The TensorFlow [`layers` -module](https://www.tensorflow.org/code/tensorflow/python/layers/layers.py) -provides a high-level API that makes it easy to construct a neural network. It -provides methods that facilitate the creation of dense (fully connected) layers -and convolutional layers, adding activation functions, and applying dropout -regularization. In this tutorial, you'll learn how to use `layers` to build a -convolutional neural network model to recognize the handwritten digits in the -MNIST data set. +The TensorFlow @{tf.layers$`layers` module} provides a high-level API that makes +it easy to construct a neural network. It provides methods that facilitate the +creation of dense (fully connected) layers and convolutional layers, adding +activation functions, and applying dropout regularization. In this tutorial, +you'll learn how to use `layers` to build a convolutional neural network model +to recognize the handwritten digits in the MNIST data set. -![handwritten digits 0–9 from the MNIST data set](../../images/mnist_0-9.png) +![handwritten digits 0–9 from the MNIST data set](../images/mnist_0-9.png) **The [MNIST dataset](http://yann.lecun.com/exdb/mnist/) comprises 60,000 training examples and 10,000 test examples of the handwritten digits 0–9, @@ -42,8 +40,7 @@ if __name__ == "__main__": As you work through the tutorial, you'll add code to construct, train, and evaluate the convolutional neural network. The complete, final code can be -[found -here](https://www.tensorflow.org/code/tensorflow/examples/tutorials/layers/cnn_mnist.py). +[found here](https://www.tensorflow.org/code/tensorflow/examples/tutorials/layers/cnn_mnist.py). ## Intro to Convolutional Neural Networks @@ -55,12 +52,12 @@ the model can then use for classification. CNNs contains three components: * **Convolutional layers**, which apply a specified number of convolution filters to the image. For each subregion, the layer performs a set of mathematical operations to produce a single value in the output feature map. - Convolutional layers then typically apply a [ReLU activation - function](https://en.wikipedia.org/wiki/Rectifier_\(neural_networks\)) to + Convolutional layers then typically apply a + [ReLU activation function](https://en.wikipedia.org/wiki/Rectifier_\(neural_networks\)) to the output to introduce nonlinearities into the model. -* **Pooling layers**, which [downsample the image - data](https://en.wikipedia.org/wiki/Convolutional_neural_network#Pooling_layer) +* **Pooling layers**, which + [downsample the image data](https://en.wikipedia.org/wiki/Convolutional_neural_network#Pooling_layer) extracted by the convolutional layers to reduce the dimensionality of the feature map in order to decrease processing time. A commonly used pooling algorithm is max pooling, which extracts subregions of the feature map @@ -84,11 +81,11 @@ is equal to 1). We can interpret the softmax values for a given image as relative measurements of how likely it is that the image falls into each target class. -

NOTE: For a more comprehensive walkthrough of CNN -architecture, see Stanford University's -Convolutional Neural Networks for Visual Recognition course materials.

+> Note: For a more comprehensive walkthrough of CNN architecture, see Stanford +> University's +> Convolutional Neural Networks for Visual Recognition course materials.

-## Building the CNN MNIST Classifier {#building-cnn-classifier} +## Building the CNN MNIST Classifier {#building_the_cnn_mnist_classifier} Let's build a model to classify the images in the MNIST dataset using the following CNN architecture: @@ -124,8 +121,8 @@ output from one layer-creation method and supply it as input to another. Open `cnn_mnist.py` and add the following `cnn_model_fn` function, which conforms to the interface expected by TensorFlow's Estimator API (more on this later in [Create the Estimator](#create-the-estimator)). `cnn_mnist.py` takes -MNIST feature data, labels, and [model -mode](../../api_docs/python/contrib.learn.md#ModeKeys) (`TRAIN`, `EVAL`, +MNIST feature data, labels, and +@{tf.contrib.learn.ModeKeys$model mode} (`TRAIN`, `EVAL`, `INFER`) as arguments; configures the CNN; and returns predictions, loss, and a training operation: @@ -197,10 +194,10 @@ def cnn_model_fn(features, labels, mode): The following sections (with headings corresponding to each code block above) dive deeper into the `tf.layers` code used to create each layer, as well as how to calculate loss, configure the training op, and generate predictions. If -you're already experienced with CNNs and [TensorFlow -`Estimator`s](../estimators/index.md), and find the above code intuitive, you -may want to skim these sections or just skip ahead to ["Training and Evaluating -the CNN MNIST Classifier"](#training-evaluating). +you're already experienced with CNNs and @{$estimators$TensorFlow `Estimator`s}, +and find the above code intuitive, you may want to skim these sections or just +skip ahead to ["Training and Evaluating the CNN MNIST +Classifier"](#training-and-evaluating-the-cnn-mnist-classifier). ### Input Layer @@ -259,9 +256,10 @@ The `inputs` argument specifies our input tensor, which must have the shape to `input_layer`, which has the shape [batch_size, 28, 28, 1]. -

NOTE: conv2d() will instead accept a shape of [channels, -batch_size, image_width, image_height] when -passed the argument data_format=channels_first.

+> Note: conv2d() will instead accept a shape of +> [channels, batch_size, image_width, +> image_height] when passed the argument +> data_format=channels_first. The `filters` argument specifies the number of filters to apply (here, 32), and `kernel_size` specifies the dimensions of the filters as [width, @@ -280,7 +278,7 @@ a 5x5 convolution over a 28x28 tensor will produce a 24x24 tensor, as there are The `activation` argument specifies the activation function to apply to the output of the convolution. Here, we specify ReLU activation with -[`tf.nn.relu`](../../api_docs/python/nn.md#relu). +@{tf.nn.relu}. Our output tensor produced by `conv2d()` has a shape of [batch_size, 28, 28, 1]: the same width and height @@ -303,10 +301,10 @@ Again, `inputs` specifies the input tensor, with a shape of the first convolutional layer, which has a shape of [batch_size, 28, 28, 32]. -

NOTE: As with conv2d(), max_pooling2d() will instead accept a shape of -[channels, batch_size, image_width, -image_height] when passed the argument -data_format=channels_first.

+> Note: As with conv2d(), max_pooling2d() will instead +> accept a shape of [channels, batch_size, +> image_width, image_height] when passed the argument +> data_format=channels_first. The `pool_size` argument specifies the size of the max pooling filter as [width, height] (here, `[2, 2]`). If both @@ -419,13 +417,13 @@ Our final output tensor of the CNN, `logits`, has shape ### Calculate Loss {#calculating-loss} -For both training and evaluation, we need to define a [loss -function](https://en.wikipedia.org/wiki/Loss_function) that measures how closely -the model's predictions match the target classes. For multiclass classification -problems like MNIST, [cross -entropy](https://en.wikipedia.org/wiki/Cross_entropy) is typically used as the -loss metric. The following code calculates cross entropy when the model runs in -either `TRAIN` or `EVAL` mode: +For both training and evaluation, we need to define a +[loss function](https://en.wikipedia.org/wiki/Loss_function) +that measures how closely the model's predictions match the target classes. For +multiclass classification problems like MNIST, +[cross entropy](https://en.wikipedia.org/wiki/Cross_entropy) is typically used +as the loss metric. The following code calculates cross entropy when the model +runs in either `TRAIN` or `EVAL` mode: ```python loss = None @@ -442,8 +440,8 @@ Let's take a closer look at what's happening above. Our `labels` tensor contains a list of predictions for our examples, e.g. `[1, 9, ...]`. In order to calculate cross-entropy, first we need to convert `labels` -to the corresponding [one-hot -encoding](https://www.quora.com/What-is-one-hot-encoding-and-when-is-it-used-in-data-science): +to the corresponding +[one-hot encoding](https://www.quora.com/What-is-one-hot-encoding-and-when-is-it-used-in-data-science): ```none [[0, 1, 0, 0, 0, 0, 0, 0, 0, 0], @@ -451,7 +449,7 @@ encoding](https://www.quora.com/What-is-one-hot-encoding-and-when-is-it-used-in- ...] ``` -We use the [`tf.one_hot()`](../../api_docs/python/array_ops.md#one_hot) function +We use the @{tf.one_hot} function to perform this conversion. `tf.one_hot()` has two required arguments: * `indices`. The locations in the one-hot tensor that will have "on @@ -484,11 +482,10 @@ loss = tf.losses.softmax_cross_entropy( In the previous section, we defined loss for our CNN as the softmax cross-entropy of the logits layer and our labels. Let's configure our model to optimize this loss value during training, using the -[`optimize_loss()`](../../api_docs/python/contrib.layers.md#optimize_loss) +@{tf.contrib.layers.optimize_loss} method in `tf.contrib.layers`. We'll use a learning rate of 0.001 and -[stochastic gradient -descent](https://en.wikipedia.org/wiki/Stochastic_gradient_descent) as the -optimization algorithm: +[stochastic gradient descent](https://en.wikipedia.org/wiki/Stochastic_gradient_descent) +as the optimization algorithm: ```python # Configure the Training Op (for TRAIN mode) @@ -500,12 +497,12 @@ if mode == learn.ModeKeys.TRAIN: optimizer="SGD") ``` -

NOTE: For a more in-depth look at configuring training ops for Estimator model -functions, see "Defining the training op for the -model" in the -"Creating Estimations in tf.contrib.learn" tutorial.

+> Note: For a more in-depth look at configuring training ops for Estimator model +> functions, see @{$estimators#defining-the-training-op-for-the-model$"Defining +> the training op for the model"} in the @{$estimators$"Creating Estimations in +> tf.contrib.learn"} tutorial. -### Generate Predictions {#generate-predictions} +### Generate Predictions {#generate_predictions} The logits layer of our model returns our predictions as raw values in a [batch_size, 10]-dimensional tensor. Let's convert these @@ -517,7 +514,7 @@ raw values into two different formats that our model function can return: For a given example, our predicted class is the element in the corresponding row of the logits tensor with the highest raw value. We can find the index of this -element using the [`tf.argmax()`](../../api_docs/python/math_ops.md#argmax) +element using the @{tf.argmax} function: ```python @@ -532,13 +529,15 @@ value along the dimension with index of 1, which corresponds to our predictions 10]
). We can derive probabilities from our logits layer by applying softmax activation -using [`tf.nn.softmax()`](../../api_docs/python/nn.md#softmax): +using @{tf.nn.softmax}: ```python tf.nn.softmax(logits, name="softmax_tensor") ``` -

NOTE: We use the `name` argument to explicitly name this operation `softmax_tensor`, so we can reference it later. (We'll set up logging for the softmax values in Set Up a Logging Hook.)

+> Note: We use the `name` argument to explicitly name this operation +> `softmax_tensor`, so we can reference it later. (We'll set up logging for the +> softmax values in ["Set Up a Logging Hook"](#set-up-a-logging-hook). We compile our predictions in a dict as follows: @@ -553,8 +552,7 @@ predictions = { Finally, now that we've got our `predictions`, `loss`, and `train_op`, we can return them, along with our `mode` argument, in a -[`ModelFnOps`](https://www.tensorflow.org/code/tensorflow/contrib/learn/python/learn/estimators/model_fn.py) -object: +@{tf.contrib.learn.ModelFnOps} object: ```python # Return a ModelFnOps object @@ -562,7 +560,7 @@ return model_fn_lib.ModelFnOps( mode=mode, predictions=predictions, loss=loss, train_op=train_op) ``` -## Training and Evaluating the CNN MNIST Classifier {#training-evaluating} +## Training and Evaluating the CNN MNIST Classifier {#training_and_evaluating_the_cnn_mnist_classifier} We've coded our MNIST CNN model function; now we're ready to train and evaluate it. @@ -603,20 +601,20 @@ mnist_classifier = learn.Estimator( ``` The `model_fn` argument specifies the model function to use for training, -evaluation, and inference; we pass it the `cnn_model_fn` we created in["Building -the CNN MNIST Classifier."](#building-cnn-classifier) The `model_dir` argument -specifies the directory where model data (checkpoints) will be saved (here, we -specify the temp directory `/tmp/mnist_convnet_model`, but feel free to change -to another directory of your choice). +evaluation, and inference; we pass it the `cnn_model_fn` we created in +["Building the CNN MNIST Classifier."](#building-the-cnn-mnist-classifier) The +`model_dir` argument specifies the directory where model data (checkpoints) will +be saved (here, we specify the temp directory `/tmp/mnist_convnet_model`, but +feel free to change to another directory of your choice). -

NOTE: For an in-depth walkthrough of the TensorFlow Estimator API, see the tutorial "Creating Estimators in tf.contrib.learn."

+> Note: For an in-depth walkthrough of the TensorFlow `Estimator` API, see the +> tutorial @{$estimators$"Creating Estimators in tf.contrib.learn."} -### Set Up a Logging Hook {#set-up-a-logging-hook} +### Set Up a Logging Hook {#set_up_a_logging_hook} Since CNNs can take a while to train, let's set up some logging so we can track -progress during training. We can use TensorFlow's [`SessionRunHook` -API](../../api_docs/python/train.md#SessionRunHook) to create a -[`LoggingTensorHook`](https://tensorflow.org/api_docs/python/train.html?cl=head#LoggingTensorHook) +progress during training. We can use TensorFlow's @{tf.train.SessionRunHook} to create a +@{tf.train.LoggingTensorHook} that will log the probability values from the softmax layer of our CNN. Add the following to `main()`: @@ -633,10 +631,11 @@ corresponding label is the name of a `Tensor` in the TensorFlow graph. Here, our `probabilities` can be found in `softmax_tensor`, the name we gave our softmax operation earlier when we generated the probabilities in `cnn_model_fn`. -

NOTE: If you don't explicitly assign a name to an operation via -the `name` argument, TensorFlow will assign a default name. A couple easy ways to discover -the names applied to operations are to visualize your graph on TensorBoard) -or to enable the TensorFlow Debugger (tfdbg).

+> Note: If you don't explicitly assign a name to an operation via the `name` +> argument, TensorFlow will assign a default name. A couple easy ways to +> discover the names applied to operations are to visualize your graph on +> @{$graph_viz$TensorBoard}) or to enable the @{$debugger$TensorFlow Debugger +> (tfdbg)}. Next, we create the `LoggingTensorHook`, passing `tensors_to_log` to the `tensors` argument. We set `every_n_iter=50`, which specifies that probabilities @@ -668,8 +667,7 @@ training. Once training is complete, we want to evaluate our model to determine its accuracy on the MNIST test set. To set up the accuracy metric for our model, we -need to create a metrics dict with a -[`MetricSpec`](https://www.tensorflow.org/code/tensorflow/contrib/learn/python/learn/metric_spec.py) +need to create a metrics dict with a @{tf.contrib.learn.MetricSpec} that calculates accuracy. Add the following to `main()`: ```python @@ -685,12 +683,11 @@ We create our `MetricSpec`s with the following two arguments: * `metric_fn`. The function that calculates and returns the value of our metric. Here, we can use the predefined `accuracy` function in the - [`tf.metrics`](https://www.tensorflow.org/code/tensorflow/python/ops/metrics_impl.py) - module. + @{tf.metrics} module. * `prediction_key`. The key of the tensor that contains the predictions returned by the model function. Here, because we're building a classification model, the prediction key is `"classes"`, which we specified - back in ["Generate Predictions."](#generate-predictions) + back in ["Generate Predictions."](#generate_predictions) Now that we've set up our `metrics` dict, we can evaluate the model. Add the following code, which performs evaluation and prints the results: @@ -711,7 +708,10 @@ just defined. We've coded the CNN model function, `Estimator`, and the training/evaluation logic; now let's see the results. Run `cnn_mnist.py`. -

NOTE: Training CNNs is quite computationally intensive. Estimated completion time of cnn_mnist.py will vary depending on your processor, but will likely be upwards of 1 hour on CPU. To train more quickly, you can decrease the number of steps passed to fit(), but note that this will affect accuracy.

+> Note: Training CNNs is quite computationally intensive. Estimated completion +> time of `cnn_mnist.py` will vary depending on your processor, but will likely +> be upwards of 1 hour on CPU. To train more quickly, you can decrease the +> number of `steps` passed to `fit()`, but note that this will affect accuracy. As the model trains, you'll see log output like the following: @@ -723,11 +723,7 @@ INFO:tensorflow:loss = 2.13119, step = 101 INFO:tensorflow:global_step/sec: 5.44132 ... INFO:tensorflow:Loss for final step: 0.553216. -``` - -When training is complete, you'll see the results of the model evaluation, e.g.: -```python INFO:tensorflow:Restored model from /tmp/mnist_convnet_model INFO:tensorflow:Eval steps [0,inf) for training step 20000. INFO:tensorflow:Input iterator is exhausted. @@ -742,11 +738,10 @@ Here, we've achieved an accuracy of 97.3% on our test data set. To learn more about TensorFlow Estimators and CNNs in TensorFlow, see the following resources: -* [Creating Estimators in tf.contrib.learn](../estimators/index.md). An +* @{$estimators$Creating Estimators in tf.contrib.learn}. An introduction to the TensorFlow Estimator API, which walks through configuring an Estimator, writing a model function, calculating loss, and defining a training op. -* [Deep MNIST for Experts: Building a Multilayer - CNN](../mnist/pros/index.md#build_a_multilayer_convolutional_network). Walks +* @{$pros#build-a-multilayer-convolutional-network$Deep MNIST for Experts: Building a Multilayer CNN}. Walks through how to build a MNIST CNN classification model *without layers* using lower-level TensorFlow operations. diff --git a/tensorflow/docs_src/tutorials/leftnav_files b/tensorflow/docs_src/tutorials/leftnav_files new file mode 100644 index 0000000000..a907b5d3f5 --- /dev/null +++ b/tensorflow/docs_src/tutorials/leftnav_files @@ -0,0 +1,13 @@ +mandelbrot.md +pdes.md +deep_cnn.md +image_recognition.md +image_retraining.md +word2vec.md +recurrent.md +seq2seq.md +layers.md +linear.md +wide.md +wide_and_deep.md +using_gpu.md diff --git a/tensorflow/g3doc/tutorials/linear/overview.md b/tensorflow/docs_src/tutorials/linear.md similarity index 97% rename from tensorflow/g3doc/tutorials/linear/overview.md rename to tensorflow/docs_src/tutorials/linear.md index b239ec2062..3569d47efd 100644 --- a/tensorflow/g3doc/tutorials/linear/overview.md +++ b/tensorflow/docs_src/tutorials/linear.md @@ -11,13 +11,13 @@ tools. It explains: deep learning to get the advantages of both. Read this overview to decide whether the tf.learn linear model tools might be -useful to you. Then do the [Linear Models tutorial](../wide/) to +useful to you. Then do the @{$wide$Linear Models tutorial} to give it a try. This overview uses code samples from the tutorial, but the tutorial walks through the code in greater detail. To understand this overview it will help to have some familiarity with basic machine learning concepts, and also with -[tf.learn](../tflearn/). +@{$tflearn$tf.learn}. [TOC] @@ -177,7 +177,7 @@ the data itself. You provide the data through an input function. The input function must return a dictionary of tensors. Each key corresponds to the name of a `FeatureColumn`. Each key's value is a tensor containing the values of that feature for all data instances. See -[Building Input Functions with tf.contrib.learn](../input_fn/index.md) for a +@{$input_fn$Building Input Functions with tf.contrib.learn} for a more comprehensive look at input functions, and `input_fn` in the [linear models tutorial code](https://www.tensorflow.org/code/tensorflow/examples/learn/wide_n_deep_tutorial.py) for an example implementation of an input function. @@ -235,4 +235,4 @@ e = tf.contrib.learn.DNNLinearCombinedClassifier( dnn_feature_columns=deep_columns, dnn_hidden_units=[100, 50]) ``` -For more information, see the [Wide and Deep Learning tutorial](../wide_and_deep/). +For more information, see the @{$wide_and_deep$Wide and Deep Learning tutorial}. diff --git a/tensorflow/g3doc/tutorials/mandelbrot/index.md b/tensorflow/docs_src/tutorials/mandelbrot.md similarity index 98% rename from tensorflow/g3doc/tutorials/mandelbrot/index.md rename to tensorflow/docs_src/tutorials/mandelbrot.md index 791de11667..a43ac7e8cc 100755 --- a/tensorflow/g3doc/tutorials/mandelbrot/index.md +++ b/tensorflow/docs_src/tutorials/mandelbrot.md @@ -110,7 +110,7 @@ Let's see what we've got. DisplayFractal(ns.eval()) ``` -![jpeg](../../images/mandelbrot_output.jpg) +![jpeg](../images/mandelbrot_output.jpg) Not bad! diff --git a/tensorflow/g3doc/tutorials/pdes/index.md b/tensorflow/docs_src/tutorials/pdes.md similarity index 97% rename from tensorflow/g3doc/tutorials/pdes/index.md rename to tensorflow/docs_src/tutorials/pdes.md index c4ed8dce65..c1ce77a73a 100755 --- a/tensorflow/g3doc/tutorials/pdes/index.md +++ b/tensorflow/docs_src/tutorials/pdes.md @@ -94,7 +94,7 @@ for n in range(40): DisplayArray(u_init, rng=[-0.1, 0.1]) ``` -![jpeg](../../images/pde_output_1.jpg) +![jpeg](../images/pde_output_1.jpg) Now let's specify the details of the differential equation. @@ -136,7 +136,7 @@ for i in range(1000): DisplayArray(U.eval(), rng=[-0.1, 0.1]) ``` -![jpeg](../../images/pde_output_2.jpg) +![jpeg](../images/pde_output_2.jpg) Look! Ripples! diff --git a/tensorflow/g3doc/tutorials/recurrent/index.md b/tensorflow/docs_src/tutorials/recurrent.md similarity index 98% rename from tensorflow/g3doc/tutorials/recurrent/index.md rename to tensorflow/docs_src/tutorials/recurrent.md index 7890da1689..50ddb2189e 100644 --- a/tensorflow/g3doc/tutorials/recurrent/index.md +++ b/tensorflow/docs_src/tutorials/recurrent.md @@ -120,7 +120,7 @@ for current_batch_of_words in words_in_dataset: ### Inputs The word IDs will be embedded into a dense representation (see the -[Vector Representations Tutorial](../../tutorials/word2vec/index.md)) before feeding to +@{$word2vec$Vector Representations Tutorial}) before feeding to the LSTM. This allows the model to efficiently represent the knowledge about particular words. It is also easy to write: diff --git a/tensorflow/g3doc/tutorials/seq2seq/index.md b/tensorflow/docs_src/tutorials/seq2seq.md similarity index 97% rename from tensorflow/g3doc/tutorials/seq2seq/index.md rename to tensorflow/docs_src/tutorials/seq2seq.md index a438ffac67..a3db3e51cf 100644 --- a/tensorflow/g3doc/tutorials/seq2seq/index.md +++ b/tensorflow/docs_src/tutorials/seq2seq.md @@ -1,7 +1,7 @@ # Sequence-to-Sequence Models Recurrent neural networks can learn to model language, as already discussed -in the [RNN Tutorial](../../tutorials/recurrent/index.md) +in the @{$recurrent$RNN Tutorial} (if you did not read it, please go through it before proceeding with this one). This raises an interesting question: could we condition the generated words on some input and generate a meaningful response? For example, could we train @@ -40,11 +40,11 @@ networks (RNNs): an *encoder* that processes the input and a *decoder* that generates the output. This basic architecture is depicted below.
- +
Each box in the picture above represents a cell of the RNN, most commonly -a GRU cell or an LSTM cell (see the [RNN Tutorial](../../tutorials/recurrent/index.md) +a GRU cell or an LSTM cell (see the @{$recurrent$RNN Tutorial} for an explanation of those). Encoder and decoder can share weights or, as is more common, use a different set of parameters. Multi-layer cells have been successfully used in sequence-to-sequence models too, e.g. for @@ -62,7 +62,7 @@ decoding step. A multi-layer sequence-to-sequence network with LSTM cells and attention mechanism in the decoder looks like this.
- +
## TensorFlow seq2seq library @@ -87,7 +87,7 @@ that determines which cell will be used inside the model. You can use an existing cell, such as `GRUCell` or `LSTMCell`, or you can write your own. Moreover, `tf.contrib.rnn` provides wrappers to construct multi-layer cells, add dropout to cell inputs or outputs, or to do other transformations. -See the [RNN Tutorial](../../tutorials/recurrent/index.md) for examples. +See the @{$recurrent$RNN Tutorial} for examples. The call to `basic_rnn_seq2seq` returns two arguments: `outputs` and `states`. Both of them are lists of tensors of the same length as `decoder_inputs`. @@ -114,7 +114,7 @@ outputs, states = embedding_rnn_seq2seq( In the `embedding_rnn_seq2seq` model, all inputs (both `encoder_inputs` and `decoder_inputs`) are integer-tensors that represent discrete values. They will be embedded into a dense representation (see the -[Vectors Representations Tutorial](../../tutorials/word2vec/index.md) for more details +@{$word2vec$Vectors Representations Tutorial} for more details on embeddings), but to construct these embeddings we need to specify the maximum number of discrete symbols that will appear: `num_encoder_symbols` on the encoder side, and `num_decoder_symbols` on the decoder side. diff --git a/tensorflow/g3doc/how_tos/using_gpu/index.md b/tensorflow/docs_src/tutorials/using_gpu.md similarity index 98% rename from tensorflow/g3doc/how_tos/using_gpu/index.md rename to tensorflow/docs_src/tutorials/using_gpu.md index 2cf6dc72f9..e4e342adfe 100644 --- a/tensorflow/g3doc/how_tos/using_gpu/index.md +++ b/tensorflow/docs_src/tutorials/using_gpu.md @@ -208,5 +208,5 @@ AddN: /job:localhost/replica:0/task:0/cpu:0 [ 98. 128.]] ``` -The [cifar10 tutorial](../../tutorials/deep_cnn/index.md) is a good example +The @{$deep_cnn$cifar10 tutorial} is a good example demonstrating how to do training with multiple GPUs. diff --git a/tensorflow/g3doc/tutorials/wide/index.md b/tensorflow/docs_src/tutorials/wide.md similarity index 97% rename from tensorflow/g3doc/tutorials/wide/index.md rename to tensorflow/docs_src/tutorials/wide.md index d30ad11374..312acdd45d 100644 --- a/tensorflow/g3doc/tutorials/wide/index.md +++ b/tensorflow/docs_src/tutorials/wide.md @@ -12,8 +12,7 @@ probability that the individual has an annual income of over 50,000 dollars. To try the code for this tutorial: -1. [Install TensorFlow](../../get_started/os_setup.md) if you haven't -already. +1. @{$install$Install TensorFlow} if you haven't already. 2. Download [the tutorial code]( https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/learn/wide_n_deep_tutorial.py). @@ -147,9 +146,9 @@ When building a TF.Learn model, the input data is specified by means of an Input Builder function. This builder function will not be called until it is later passed to TF.Learn methods such as `fit` and `evaluate`. The purpose of this function is to construct the input data, which is represented in the form of -[Tensors](https://www.tensorflow.org/versions/r0.9/api_docs/python/framework.html#Tensor) +@{tf.Tensor}s or -[SparseTensors](https://www.tensorflow.org/versions/r0.9/api_docs/python/sparse_ops.html#SparseTensor). +@{tf.SparseTensor}s. In more detail, the Input Builder function returns the following as a pair: 1. `feature_cols`: A dict from feature column names to `Tensors` or @@ -169,7 +168,7 @@ Our model represents the input data as *constant* tensors, meaning that the tensor represents a constant value, in this case the values of a particular column of `df_train` or `df_test`. This is the simplest way to pass data into TensorFlow. Another more advanced way to represent input data would be to -construct an [Input Reader](https://www.tensorflow.org/versions/r0.9/api_docs/python/io_ops.html#inputs-and-readers) +construct an @{$python/io_ops#inputs-and-readers$Inputs And Readers} that represents a file or other data source, and iterates through the file as TensorFlow runs the graph. Each continuous column in the train or test dataframe will be converted into a `Tensor`, which in general is a good format to @@ -470,7 +469,6 @@ value would be high. ## Learn Deeper -If you're interested in learning more, check out our [Wide & Deep Learning -Tutorial](../wide_and_deep/) where we'll show you how to combine +If you're interested in learning more, check out our @{$wide_and_deep$Wide & Deep Learning Tutorial} where we'll show you how to combine the strengths of linear models and deep neural networks by jointly training them using the TF.Learn API. diff --git a/tensorflow/g3doc/tutorials/wide_and_deep/index.md b/tensorflow/docs_src/tutorials/wide_and_deep.md similarity index 96% rename from tensorflow/g3doc/tutorials/wide_and_deep/index.md rename to tensorflow/docs_src/tutorials/wide_and_deep.md index 4928dd41a3..9d435da1db 100644 --- a/tensorflow/g3doc/tutorials/wide_and_deep/index.md +++ b/tensorflow/docs_src/tutorials/wide_and_deep.md @@ -1,9 +1,10 @@ # TensorFlow Wide & Deep Learning Tutorial -In the previous [TensorFlow Linear Model Tutorial](../wide/), +In the previous @{$wide$TensorFlow Linear Model Tutorial}, we trained a logistic regression model to predict the probability that the -individual has an annual income of over 50,000 dollars using the [Census Income -Dataset](https://archive.ics.uci.edu/ml/datasets/Census+Income). TensorFlow is +individual has an annual income of over 50,000 dollars using the +[Census Income Dataset](https://archive.ics.uci.edu/ml/datasets/Census+Income). +TensorFlow is great for training deep neural networks too, and you might be thinking which one you should choose—Well, why not both? Would it be possible to combine the strengths of both in one model? @@ -17,7 +18,7 @@ you're interested in learning more about how Wide & Deep Learning works, please check out our [research paper](http://arxiv.org/abs/1606.07792). ![Wide & Deep Spectrum of Models] -(../../images/wide_n_deep.svg "Wide & Deep") +(../images/wide_n_deep.svg "Wide & Deep") The figure above shows a comparison of a wide model (logistic regression with sparse features and transformations), a deep model (feed-forward neural network @@ -38,11 +39,9 @@ And that's it! Let's go through a simple example. To try the code for this tutorial: -1. [Install TensorFlow](../../get_started/os_setup.md) if you haven't -already. +1. @{$install$Install TensorFlow}[Install TensorFlow] if you haven't already. -2. Download [the tutorial code]( -https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/learn/wide_n_deep_tutorial.py). +2. Download [the tutorial code](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/learn/wide_n_deep_tutorial.py). 3. Install the pandas data analysis library. tf.learn doesn't require pandas, but it does support it, and this tutorial uses pandas. To install pandas: 1. Get `pip`: @@ -193,7 +192,7 @@ m = tf.contrib.learn.DNNLinearCombinedClassifier( ## Training and Evaluating The Model Before we train the model, let's read in the Census dataset as we did in the -[TensorFlow Linear Model tutorial](../wide/). The code for +@{$wide$TensorFlow Linear Model tutorial}. The code for input data processing is provided here again for your convenience: ```python diff --git a/tensorflow/g3doc/tutorials/word2vec/index.md b/tensorflow/docs_src/tutorials/word2vec.md similarity index 97% rename from tensorflow/g3doc/tutorials/word2vec/index.md rename to tensorflow/docs_src/tutorials/word2vec.md index 36f9f762ef..a202a62b49 100644 --- a/tensorflow/g3doc/tutorials/word2vec/index.md +++ b/tensorflow/docs_src/tutorials/word2vec.md @@ -51,7 +51,7 @@ means that we may need more data in order to successfully train statistical models. Using vector representations can overcome some of these obstacles.
- +
[Vector space models](https://en.wikipedia.org/wiki/Vector_space_model) (VSMs) @@ -125,7 +125,7 @@ probability using the score for all other \\(V\\) words \\(w'\\) in the current context \\(h\\), *at every training step*.
- +
On the other hand, for feature learning in word2vec we do not need a full @@ -136,7 +136,7 @@ same context. We illustrate this below for a CBOW model. For skip-gram the direction is simply inverted.
- +
Mathematically, the objective (for each example) is to maximize @@ -233,7 +233,7 @@ below (see also for example [Mikolov et al., 2013](http://www.aclweb.org/anthology/N13-1090)).
- +
This explains why these vectors are also useful as features for many canonical @@ -313,7 +313,7 @@ optimizer = tf.train.GradientDescentOptimizer(learning_rate=1.0).minimize(loss) Training the model is then as simple as using a `feed_dict` to push data into the placeholders and calling -[`session.run`](../../api_docs/python/client.md#Session.run) with this new data +@{tf.Session.run} with this new data in a loop. ```python @@ -331,7 +331,7 @@ After training has finished we can visualize the learned embeddings using t-SNE.
- +
Et voila! As expected, words that are similar end up clustering nearby each @@ -379,13 +379,13 @@ compromised speed because we use Python for reading and feeding data items -- each of which require very little work on the TensorFlow back-end. If you find your model is seriously bottlenecked on input data, you may want to implement a custom data reader for your problem, as described in -[New Data Formats](../../how_tos/new_data_formats/index.md). For the case of Skip-Gram +@{$new_data_formats$New Data Formats}. For the case of Skip-Gram modeling, we've actually already done this for you as an example in [tensorflow_models/tutorials/embedding/word2vec.py](https://www.tensorflow.org/code/tensorflow_models/tutorials/embedding/word2vec.py). If your model is no longer I/O bound but you want still more performance, you can take things further by writing your own TensorFlow Ops, as described in -[Adding a New Op](../../how_tos/adding_an_op/index.md). Again we've provided an +@{$adding_an_op$Adding a New Op}. Again we've provided an example of this for the Skip-Gram case [tensorflow_models/tutorials/embedding/word2vec_optimized.py](https://www.tensorflow.org/code/tensorflow_models/tutorials/embedding/word2vec_optimized.py). Feel free to benchmark these against each other to measure performance diff --git a/tensorflow/g3doc/README.txt b/tensorflow/g3doc/README.txt new file mode 100644 index 0000000000..4f4076db37 --- /dev/null +++ b/tensorflow/g3doc/README.txt @@ -0,0 +1,46 @@ +Docs have moved! If you just want to view TensorFlow documentation, +go to: + + https://www.tensorflow.org/ + +Documentation (on Github, tensorflow.org, and anywhere else we decide to +serve it from) is now generated from the files in +third_party/tensorflow/docs_src/ (for tutorials and other guides) and +TensorFlow source code (for the API reference pages). If you see a problem with +API reference, edit the code comments in the appropriate language. If you see a +problem with our other docs, edit the files in docs_src. + +To preview the results of your changes, or generate an offline copy of +the docs, run: + + bazel run -- tensorflow/tools/docs:generate \ + --src_dir=tensorflow/docs_src/ \ + --output_dir=/tmp/tfdocs/ + +When authoring docs, note that we have some new syntax for references -- +at least for docs coming from Python docstrings or +tensorflow/docs_src/. Use: + +* @{tf.symbol} to make a link to the reference page for a Python + symbol. Note that class members don't get their own page, but the + syntax still works, since @{tf.MyClass.method} links to the right + part of the tf.MyClass page. + + +* @{tensorflow::symbol} to make a link to the reference page for a C++ + symbol. (This only works for a few symbols but will work for more soon.) + +* @{$doc_page} to make a link to another (not an API reference) doc + page. To link to + - red/green/blue/index.md use @{$blue} or @{$green/blue}, + - foo/bar/baz.md use @{$baz} or @{$bar/baz}. + The shorter one is preferred, so we can move pages around without + breaking these references. The main exception is that the Python API + guides should probably be referred to using @{$python/} + to avoid ambiguity. To link to an anchor in that doc and use + different link text (by default it uses the title of the target + page) use: + @{$doc_page#anchor-tag$link-text} + (You can skip #anchor-tag if you just want to override the link text). + +Thanks! diff --git a/tensorflow/g3doc/api_docs/cc/ClassEnv.md b/tensorflow/g3doc/api_docs/cc/ClassEnv.md deleted file mode 100644 index 43f75fefb9..0000000000 --- a/tensorflow/g3doc/api_docs/cc/ClassEnv.md +++ /dev/null @@ -1,253 +0,0 @@ -# `class tensorflow::Env` - -An interface used by the tensorflow implementation to access operating system functionality like the filesystem etc. - -Callers may wish to provide a custom Env object to get fine grain control. - -All Env implementations are safe for concurrent access from multiple threads without any external synchronization. - -###Member Details - -#### `tensorflow::Env::Env()` {#tensorflow_Env_Env} - - - - - -#### `virtual tensorflow::Env::~Env()=default` {#virtual_tensorflow_Env_Env} - - - - - -#### `Status tensorflow::Env::GetFileSystemForFile(const string &fname, FileSystem **result)` {#Status_tensorflow_Env_GetFileSystemForFile} - -Returns the FileSystem object to handle operations on the file specified by 'fname'. The FileSystem object is used as the implementation for the file system related (non-virtual) functions that follow. Returned FileSystem object is still owned by the Env object and will. - - - -#### `Status tensorflow::Env::GetRegisteredFileSystemSchemes(std::vector< string > *schemes)` {#Status_tensorflow_Env_GetRegisteredFileSystemSchemes} - -Returns the file system schemes registered for this Env . - - - -#### `Status tensorflow::Env::RegisterFileSystem(const string &scheme, FileSystemRegistry::Factory factory)` {#Status_tensorflow_Env_RegisterFileSystem} - - - - - -#### `Status tensorflow::Env::NewRandomAccessFile(const string &fname, std::unique_ptr< RandomAccessFile > *result)` {#Status_tensorflow_Env_NewRandomAccessFile} - -Creates a brand new random access read-only file with the specified name. - -On success, stores a pointer to the new file in *result and returns OK. On failure stores NULL in *result and returns non-OK. If the file does not exist, returns a non-OK status. - -The returned file may be concurrently accessed by multiple threads. - -The ownership of the returned RandomAccessFile is passed to the caller and the object should be deleted when is not used. The file object shouldn't live longer than the Env object. - -#### `Status tensorflow::Env::NewWritableFile(const string &fname, std::unique_ptr< WritableFile > *result)` {#Status_tensorflow_Env_NewWritableFile} - -Creates an object that writes to a new file with the specified name. - -Deletes any existing file with the same name and creates a new file. On success, stores a pointer to the new file in *result and returns OK. On failure stores NULL in *result and returns non-OK. - -The returned file will only be accessed by one thread at a time. - -The ownership of the returned WritableFile is passed to the caller and the object should be deleted when is not used. The file object shouldn't live longer than the Env object. - -#### `Status tensorflow::Env::NewAppendableFile(const string &fname, std::unique_ptr< WritableFile > *result)` {#Status_tensorflow_Env_NewAppendableFile} - -Creates an object that either appends to an existing file, or writes to a new file (if the file does not exist to begin with). - -On success, stores a pointer to the new file in *result and returns OK. On failure stores NULL in *result and returns non-OK. - -The returned file will only be accessed by one thread at a time. - -The ownership of the returned WritableFile is passed to the caller and the object should be deleted when is not used. The file object shouldn't live longer than the Env object. - -#### `Status tensorflow::Env::NewReadOnlyMemoryRegionFromFile(const string &fname, std::unique_ptr< ReadOnlyMemoryRegion > *result)` {#Status_tensorflow_Env_NewReadOnlyMemoryRegionFromFile} - -Creates a readonly region of memory with the file context. - -On success, it returns a pointer to read-only memory region from the content of file fname. The ownership of the region is passed to the caller. On failure stores nullptr in *result and returns non-OK. - -The returned memory region can be accessed from many threads in parallel. - -The ownership of the returned ReadOnlyMemoryRegion is passed to the caller and the object should be deleted when is not used. The memory region object shouldn't live longer than the Env object. - -#### `Status tensorflow::Env::FileExists(const string &fname)` {#Status_tensorflow_Env_FileExists} - -Returns OK if the named path exists and NOT_FOUND otherwise. - - - -#### `Status tensorflow::Env::GetChildren(const string &dir, std::vector< string > *result)` {#Status_tensorflow_Env_GetChildren} - -Stores in *result the names of the children of the specified directory. The names are relative to "dir". - -Original contents of *results are dropped. - -#### `virtual bool tensorflow::Env::MatchPath(const string &path, const string &pattern)=0` {#virtual_bool_tensorflow_Env_MatchPath} - -Returns true if the path matches the given pattern. The wildcards allowed in pattern are described in FileSystem::GetMatchingPaths. - - - -#### `Status tensorflow::Env::GetMatchingPaths(const string &pattern, std::vector< string > *results)` {#Status_tensorflow_Env_GetMatchingPaths} - -Given a pattern, stores in *results the set of paths that matches that pattern. *results is cleared. - -More details about `pattern` in FileSystem::GetMatchingPaths. - -#### `Status tensorflow::Env::DeleteFile(const string &fname)` {#Status_tensorflow_Env_DeleteFile} - -Deletes the named file. - - - -#### `Status tensorflow::Env::DeleteRecursively(const string &dirname, int64 *undeleted_files, int64 *undeleted_dirs)` {#Status_tensorflow_Env_DeleteRecursively} - -Deletes the specified directory and all subdirectories and files underneath it. undeleted_files and undeleted_dirs stores the number of files and directories that weren't deleted (unspecified if the return status is not OK). REQUIRES: undeleted_files, undeleted_dirs to be not null. Typical return codes. - - - -OK - dirname exists and we were able to delete everything underneath. - -NOT_FOUND - dirname doesn't exist - -PERMISSION_DENIED - dirname or some descendant is not writable - -UNIMPLEMENTED - Some underlying functions (like Delete) are not implemented - -#### `Status tensorflow::Env::RecursivelyCreateDir(const string &dirname)` {#Status_tensorflow_Env_RecursivelyCreateDir} - -Creates the specified directory and all the necessary subdirectories. Typical return codes. - - - -OK - successfully created the directory and sub directories, even if they were already created. - -PERMISSION_DENIED - dirname or some subdirectory is not writable. - -#### `Status tensorflow::Env::CreateDir(const string &dirname)` {#Status_tensorflow_Env_CreateDir} - -Creates the specified directory. Typical return codes. - - - -OK - successfully created the directory. - -ALREADY_EXISTS - directory already exists. - -PERMISSION_DENIED - dirname is not writable. - -#### `Status tensorflow::Env::DeleteDir(const string &dirname)` {#Status_tensorflow_Env_DeleteDir} - -Deletes the specified directory. - - - -#### `Status tensorflow::Env::Stat(const string &fname, FileStatistics *stat)` {#Status_tensorflow_Env_Stat} - -Obtains statistics for the given path. - - - -#### `Status tensorflow::Env::IsDirectory(const string &fname)` {#Status_tensorflow_Env_IsDirectory} - -Returns whether the given path is a directory or not. Typical return codes (not guaranteed exhaustive): - - - -OK - The path exists and is a directory. - -FAILED_PRECONDITION - The path exists and is not a directory. - -NOT_FOUND - The path entry does not exist. - -PERMISSION_DENIED - Insufficient permissions. - -UNIMPLEMENTED - The file factory doesn't support directories. - -#### `Status tensorflow::Env::GetFileSize(const string &fname, uint64 *file_size)` {#Status_tensorflow_Env_GetFileSize} - -Stores the size of `fname` in `*file_size`. - - - -#### `Status tensorflow::Env::RenameFile(const string &src, const string &target)` {#Status_tensorflow_Env_RenameFile} - -Renames file src to target. If target already exists, it will be replaced. - - - -#### `string tensorflow::Env::GetExecutablePath()` {#string_tensorflow_Env_GetExecutablePath} - -Returns the absolute path of the current executable. It resolves symlinks if there is any. - - - -#### `virtual uint64 tensorflow::Env::NowMicros()=0` {#virtual_uint64_tensorflow_Env_NowMicros} - -Returns the number of micro-seconds since the Unix epoch. - - - -#### `virtual uint64 tensorflow::Env::NowSeconds()` {#virtual_uint64_tensorflow_Env_NowSeconds} - -Returns the number of seconds since the Unix epoch. - - - -#### `virtual void tensorflow::Env::SleepForMicroseconds(int64 micros)=0` {#virtual_void_tensorflow_Env_SleepForMicroseconds} - -Sleeps/delays the thread for the prescribed number of micro-seconds. - - - -#### `virtual Thread* tensorflow::Env::StartThread(const ThreadOptions &thread_options, const string &name, std::function< void()> fn) TF_MUST_USE_RESULT=0` {#virtual_Thread_tensorflow_Env_StartThread} - -Returns a new thread that is running fn() and is identified (for debugging/performance-analysis) by "name". - -Caller takes ownership of the result and must delete it eventually (the deletion will block until fn() stops running). - -#### `virtual void tensorflow::Env::SchedClosure(std::function< void()> closure)=0` {#virtual_void_tensorflow_Env_SchedClosure} - - - - - -#### `virtual void tensorflow::Env::SchedClosureAfter(int64 micros, std::function< void()> closure)=0` {#virtual_void_tensorflow_Env_SchedClosureAfter} - - - - - -#### `virtual Status tensorflow::Env::LoadLibrary(const char *library_filename, void **handle)=0` {#virtual_Status_tensorflow_Env_LoadLibrary} - - - - - -#### `virtual Status tensorflow::Env::GetSymbolFromLibrary(void *handle, const char *symbol_name, void **symbol)=0` {#virtual_Status_tensorflow_Env_GetSymbolFromLibrary} - - - - - -#### `virtual string tensorflow::Env::FormatLibraryFileName(const string &name, const string &version)=0` {#virtual_string_tensorflow_Env_FormatLibraryFileName} - - - - - -#### `static Env* tensorflow::Env::Default()` {#static_Env_tensorflow_Env_Default} - -Returns a default environment suitable for the current operating system. - -Sophisticated users may wish to provide their own Env implementation instead of relying on this default environment. - -The result of Default() belongs to this library and must never be deleted. diff --git a/tensorflow/g3doc/api_docs/cc/ClassEnvWrapper.md b/tensorflow/g3doc/api_docs/cc/ClassEnvWrapper.md deleted file mode 100644 index e367f5f042..0000000000 --- a/tensorflow/g3doc/api_docs/cc/ClassEnvWrapper.md +++ /dev/null @@ -1,97 +0,0 @@ -# `class tensorflow::EnvWrapper` - -An implementation of Env that forwards all calls to another Env . - -May be useful to clients who wish to override just part of the functionality of another Env . - -###Member Details - -#### `tensorflow::EnvWrapper::EnvWrapper(Env *t)` {#tensorflow_EnvWrapper_EnvWrapper} - -Initializes an EnvWrapper that delegates all calls to *t. - - - -#### `tensorflow::EnvWrapper::~EnvWrapper()` {#tensorflow_EnvWrapper_EnvWrapper} - - - - - -#### `Env* tensorflow::EnvWrapper::target() const` {#Env_tensorflow_EnvWrapper_target} - -Returns the target to which this Env forwards all calls. - - - -#### `Status tensorflow::EnvWrapper::GetFileSystemForFile(const string &fname, FileSystem **result) override` {#Status_tensorflow_EnvWrapper_GetFileSystemForFile} - -Returns the FileSystem object to handle operations on the file specified by 'fname'. The FileSystem object is used as the implementation for the file system related (non-virtual) functions that follow. Returned FileSystem object is still owned by the Env object and will. - - - -#### `Status tensorflow::EnvWrapper::GetRegisteredFileSystemSchemes(std::vector< string > *schemes) override` {#Status_tensorflow_EnvWrapper_GetRegisteredFileSystemSchemes} - -Returns the file system schemes registered for this Env . - - - -#### `Status tensorflow::EnvWrapper::RegisterFileSystem(const string &scheme, FileSystemRegistry::Factory factory) override` {#Status_tensorflow_EnvWrapper_RegisterFileSystem} - - - - - -#### `bool tensorflow::EnvWrapper::MatchPath(const string &path, const string &pattern) override` {#bool_tensorflow_EnvWrapper_MatchPath} - -Returns true if the path matches the given pattern. The wildcards allowed in pattern are described in FileSystem::GetMatchingPaths. - - - -#### `uint64 tensorflow::EnvWrapper::NowMicros() override` {#uint64_tensorflow_EnvWrapper_NowMicros} - -Returns the number of micro-seconds since the Unix epoch. - - - -#### `void tensorflow::EnvWrapper::SleepForMicroseconds(int64 micros) override` {#void_tensorflow_EnvWrapper_SleepForMicroseconds} - -Sleeps/delays the thread for the prescribed number of micro-seconds. - - - -#### `Thread* tensorflow::EnvWrapper::StartThread(const ThreadOptions &thread_options, const string &name, std::function< void()> fn) override` {#Thread_tensorflow_EnvWrapper_StartThread} - -Returns a new thread that is running fn() and is identified (for debugging/performance-analysis) by "name". - -Caller takes ownership of the result and must delete it eventually (the deletion will block until fn() stops running). - -#### `void tensorflow::EnvWrapper::SchedClosure(std::function< void()> closure) override` {#void_tensorflow_EnvWrapper_SchedClosure} - - - - - -#### `void tensorflow::EnvWrapper::SchedClosureAfter(int64 micros, std::function< void()> closure) override` {#void_tensorflow_EnvWrapper_SchedClosureAfter} - - - - - -#### `Status tensorflow::EnvWrapper::LoadLibrary(const char *library_filename, void **handle) override` {#Status_tensorflow_EnvWrapper_LoadLibrary} - - - - - -#### `Status tensorflow::EnvWrapper::GetSymbolFromLibrary(void *handle, const char *symbol_name, void **symbol) override` {#Status_tensorflow_EnvWrapper_GetSymbolFromLibrary} - - - - - -#### `string tensorflow::EnvWrapper::FormatLibraryFileName(const string &name, const string &version) override` {#string_tensorflow_EnvWrapper_FormatLibraryFileName} - - - - diff --git a/tensorflow/g3doc/api_docs/cc/ClassPartialTensorShape.md b/tensorflow/g3doc/api_docs/cc/ClassPartialTensorShape.md deleted file mode 100644 index ac2c26093d..0000000000 --- a/tensorflow/g3doc/api_docs/cc/ClassPartialTensorShape.md +++ /dev/null @@ -1,139 +0,0 @@ -# `class tensorflow::PartialTensorShape` - -Manages the partially known dimensions of a Tensor and their sizes. - - - -###Member Details - -#### `tensorflow::PartialTensorShape::PartialTensorShape()` {#tensorflow_PartialTensorShape_PartialTensorShape} - -Construct an unknown ` PartialTensorShape `. - - - -#### `tensorflow::PartialTensorShape::PartialTensorShape(gtl::ArraySlice< int64 > dim_sizes)` {#tensorflow_PartialTensorShape_PartialTensorShape} - -Construct a ` PartialTensorShape ` from the provided sizes. REQUIRES: `dim_sizes[i] >= 0` - - - -#### `tensorflow::PartialTensorShape::PartialTensorShape(std::initializer_list< int64 > dim_sizes)` {#tensorflow_PartialTensorShape_PartialTensorShape} - - - - - -#### `tensorflow::PartialTensorShape::PartialTensorShape(const TensorShapeProto &proto)` {#tensorflow_PartialTensorShape_PartialTensorShape} - -REQUIRES: `IsValid(proto)` - - - -#### `PartialTensorShape tensorflow::PartialTensorShape::Concatenate(int64 size) const` {#PartialTensorShape_tensorflow_PartialTensorShape_Concatenate} - - - -Add a dimension to the end ("inner-most"), returns a new PartialTensorShape . REQUIRES: `size >= -1`, where -1 means unknown - -#### `PartialTensorShape tensorflow::PartialTensorShape::Concatenate(const PartialTensorShape &shape) const` {#PartialTensorShape_tensorflow_PartialTensorShape_Concatenate} - - - -Appends all the dimensions from `shape`. Returns a new PartialTensorShape . - -#### `Status tensorflow::PartialTensorShape::MergeWith(const PartialTensorShape &shape, PartialTensorShape *result) const` {#Status_tensorflow_PartialTensorShape_MergeWith} - - - -Merges all the dimensions from `shape`. Returns `InvalidArgument` error if either `shape` has a different rank or if any of the dimensions are incompatible. - -#### `int tensorflow::PartialTensorShape::dims() const` {#int_tensorflow_PartialTensorShape_dims} - - - -Return the number of dimensions in the tensor. If the number of dimensions is unknown, return -1. - -#### `bool tensorflow::PartialTensorShape::IsFullyDefined() const` {#bool_tensorflow_PartialTensorShape_IsFullyDefined} - -Return true iff the rank and all of the dimensions are well defined. - - - -#### `bool tensorflow::PartialTensorShape::IsIdenticalTo(const PartialTensorShape &shape) const` {#bool_tensorflow_PartialTensorShape_IsIdenticalTo} - - - -Exact equality test. Returns true iff the ranks match (i.e., both are unknown, or both are known and equal), and all dimensions are equal (i.e., both dimensions are known, or both are known and equal). This is a stronger condition that IsCompatibleWith. - -#### `bool tensorflow::PartialTensorShape::IsCompatibleWith(const PartialTensorShape &shape) const` {#bool_tensorflow_PartialTensorShape_IsCompatibleWith} - - - -Return true iff the ranks match, and if the dimensions all either match or one is unknown. - -#### `bool tensorflow::PartialTensorShape::IsCompatibleWith(const TensorShape &shape) const` {#bool_tensorflow_PartialTensorShape_IsCompatibleWith} - - - -Return true iff the dimensions of `shape` are compatible with `*this`. - -#### `int64 tensorflow::PartialTensorShape::dim_size(int d) const` {#int64_tensorflow_PartialTensorShape_dim_size} - -Returns the number of elements in dimension `d`. REQUIRES: `0 <= d < dims() ` - - - -#### `gtl::ArraySlice tensorflow::PartialTensorShape::dim_sizes() const` {#gtl_ArraySlice_int64_tensorflow_PartialTensorShape_dim_sizes} - -Returns sizes of all dimensions. - - - -#### `void tensorflow::PartialTensorShape::AsProto(TensorShapeProto *proto) const` {#void_tensorflow_PartialTensorShape_AsProto} - -Fill `*proto` from `*this`. - - - -#### `bool tensorflow::PartialTensorShape::AsTensorShape(TensorShape *tensor_shape) const` {#bool_tensorflow_PartialTensorShape_AsTensorShape} - - - - - -#### `string tensorflow::PartialTensorShape::DebugString() const` {#string_tensorflow_PartialTensorShape_DebugString} - -For error messages. - - - -#### `bool tensorflow::PartialTensorShape::IsValid(const TensorShapeProto &proto)` {#bool_tensorflow_PartialTensorShape_IsValid} - -Returns `true` iff `proto` is a valid partial tensor shape. - - - -#### `Status tensorflow::PartialTensorShape::IsValidShape(const TensorShapeProto &proto)` {#Status_tensorflow_PartialTensorShape_IsValidShape} - - - -Returns `OK` iff `proto` is a valid tensor shape, and a descriptive error status otherwise. - -#### `string tensorflow::PartialTensorShape::DebugString(const TensorShapeProto &proto)` {#string_tensorflow_PartialTensorShape_DebugString} - - - - - -#### `static Status tensorflow::PartialTensorShape::MakePartialShape(const int32 *dims, int n, PartialTensorShape *out)` {#static_Status_tensorflow_PartialTensorShape_MakePartialShape} - -Returns a ` PartialTensorShape ` whose dimensions are `dims[0]`, `dims[1]`, ..., `dims[n-1]`. Values of -1 are considered "unknown". - - - -#### `static Status tensorflow::PartialTensorShape::MakePartialShape(const int64 *dims, int n, PartialTensorShape *out)` {#static_Status_tensorflow_PartialTensorShape_MakePartialShape} - - - - diff --git a/tensorflow/g3doc/api_docs/cc/ClassPartialTensorShapeUtils.md b/tensorflow/g3doc/api_docs/cc/ClassPartialTensorShapeUtils.md deleted file mode 100644 index ca3666ba8f..0000000000 --- a/tensorflow/g3doc/api_docs/cc/ClassPartialTensorShapeUtils.md +++ /dev/null @@ -1,25 +0,0 @@ -# `class tensorflow::PartialTensorShapeUtils` - -Static helper routines for ` PartialTensorShape `. Includes a few common predicates on a partially known tensor shape. - - - -###Member Details - -#### `string tensorflow::PartialTensorShapeUtils::PartialShapeListString(const gtl::ArraySlice< PartialTensorShape > &shapes)` {#string_tensorflow_PartialTensorShapeUtils_PartialShapeListString} - - - - - -#### `bool tensorflow::PartialTensorShapeUtils::AreIdentical(const gtl::ArraySlice< PartialTensorShape > &shapes0, const gtl::ArraySlice< PartialTensorShape > &shapes1)` {#bool_tensorflow_PartialTensorShapeUtils_AreIdentical} - - - - - -#### `bool tensorflow::PartialTensorShapeUtils::AreCompatible(const gtl::ArraySlice< PartialTensorShape > &shapes0, const gtl::ArraySlice< PartialTensorShape > &shapes1)` {#bool_tensorflow_PartialTensorShapeUtils_AreCompatible} - - - - diff --git a/tensorflow/g3doc/api_docs/cc/ClassRandomAccessFile.md b/tensorflow/g3doc/api_docs/cc/ClassRandomAccessFile.md deleted file mode 100644 index 1a1526f66d..0000000000 --- a/tensorflow/g3doc/api_docs/cc/ClassRandomAccessFile.md +++ /dev/null @@ -1,31 +0,0 @@ -# `class tensorflow::RandomAccessFile` - -A file abstraction for randomly reading the contents of a file. - - - -###Member Details - -#### `tensorflow::RandomAccessFile::RandomAccessFile()` {#tensorflow_RandomAccessFile_RandomAccessFile} - - - - - -#### `tensorflow::RandomAccessFile::~RandomAccessFile()` {#tensorflow_RandomAccessFile_RandomAccessFile} - - - - - -#### `virtual Status tensorflow::RandomAccessFile::Read(uint64 offset, size_t n, StringPiece *result, char *scratch) const =0` {#virtual_Status_tensorflow_RandomAccessFile_Read} - -Reads up to `n` bytes from the file starting at `offset`. - -`scratch[0..n-1]` may be written by this routine. Sets `*result` to the data that was read (including if fewer than `n` bytes were successfully read). May set `*result` to point at data in `scratch[0..n-1]`, so `scratch[0..n-1]` must be live when `*result` is used. - -On OK returned status: `n` bytes have been stored in `*result`. On non-OK returned status: `[0..n]` bytes have been stored in `*result`. - -Returns `OUT_OF_RANGE` if fewer than n bytes were stored in `*result` because of EOF. - -Safe for concurrent use by multiple threads. diff --git a/tensorflow/g3doc/api_docs/cc/ClassSession.md b/tensorflow/g3doc/api_docs/cc/ClassSession.md deleted file mode 100644 index 6829548530..0000000000 --- a/tensorflow/g3doc/api_docs/cc/ClassSession.md +++ /dev/null @@ -1,124 +0,0 @@ -# `class tensorflow::Session` - -A Session instance lets a caller drive a TensorFlow graph computation. - -When a Session is created with a given target, a new Session object is bound to the universe of resources specified by that target. Those resources are available to this session to perform computation described in the GraphDef. After extending the session with a graph, the caller uses the Run() API to perform the computation and potentially fetch outputs as Tensors. - -Example: - -```c++ tensorflow::GraphDef graph; -// ... Create or load graph into "graph". - -// This example uses the default options which connects -// to a local runtime. -tensorflow::SessionOptions options; -std::unique_ptr -session(tensorflow::NewSession(options)); - -// Create the session with this graph. -tensorflow::Status s = session->Create(graph); -if (!s.ok()) { ... } - -// Run the graph and fetch the first output of the "output" -// operation, and also run to but do not return anything -// for the "update_state" operation. -std::vector outputs; -s = session->Run({}, {"output:0"}, {"update_state"}, &outputs); -if (!s.ok()) { ... } - -// Map the output as a flattened float tensor, and do something -// with it. -auto output_tensor = outputs[0].flat(); -if (output_tensor(0) > 0.5) { ... } - -// Close the session to release the resources associated with -// this session. -session->Close(); - -``` - -A Session allows concurrent calls to Run() , though a Session must be created / extended by a single thread. - -Only one thread must call Close() , and Close() must only be called after all other calls to Run() have returned. - -###Member Details - -#### `tensorflow::Session::Session()` {#tensorflow_Session_Session} - - - - - -#### `virtual tensorflow::Session::~Session()` {#virtual_tensorflow_Session_Session} - - - - - -#### `virtual Status tensorflow::Session::Create(const GraphDef &graph)=0` {#virtual_Status_tensorflow_Session_Create} - -Create the graph to be used for the session. - -Returns an error if this session has already been created with a graph. To re-use the session with a different graph, the caller must Close() the session first. - -#### `virtual Status tensorflow::Session::Extend(const GraphDef &graph)=0` {#virtual_Status_tensorflow_Session_Extend} - -Adds operations to the graph that is already registered with the Session . - -The names of new operations in "graph" must not exist in the graph that is already registered. - -#### `virtual Status tensorflow::Session::Run(const std::vector< std::pair< string, Tensor > > &inputs, const std::vector< string > &output_tensor_names, const std::vector< string > &target_node_names, std::vector< Tensor > *outputs)=0` {#virtual_Status_tensorflow_Session_Run} - -Runs the graph with the provided input tensors and fills `outputs` for the endpoints specified in `output_tensor_names`. Runs to but does not return Tensors for the nodes in `target_node_names`. - -The order of tensors in `outputs` will match the order provided by `output_tensor_names`. - -If `Run` returns `OK()`, then `outputs->size()` will be equal to `output_tensor_names.size()`. If `Run` does not return `OK()`, the state of `outputs` is undefined. - -REQUIRES: The name of each Tensor of the input or output must match a "Tensor endpoint" in the `GraphDef` passed to ` Create() `. - -REQUIRES: At least one of `output_tensor_names` and `target_node_names` must be non-empty. - -REQUIRES: outputs is not nullptr if `output_tensor_names` is non-empty. - -#### `virtual Status tensorflow::Session::Create(const RunOptions &run_options, const GraphDef &graph)` {#virtual_Status_tensorflow_Session_Create} - -Implementations which support `RunOptions`. - -NOTE: This API is still experimental and may change. - -#### `virtual Status tensorflow::Session::Extend(const RunOptions &run_options, const GraphDef &graph)` {#virtual_Status_tensorflow_Session_Extend} - - - - - -#### `virtual Status tensorflow::Session::Close(const RunOptions &run_options)` {#virtual_Status_tensorflow_Session_Close} - - - - - -#### `virtual Status tensorflow::Session::Run(const RunOptions &run_options, const std::vector< std::pair< string, Tensor > > &inputs, const std::vector< string > &output_tensor_names, const std::vector< string > &target_node_names, std::vector< Tensor > *outputs, RunMetadata *run_metadata)` {#virtual_Status_tensorflow_Session_Run} - -Like `Run`, but allows users to pass in a `RunOptions` proto and to retrieve non-Tensor metadata output via a `RunMetadata` proto for this step. `run_metadata` may be nullptr, in which case any metadata output is discarded. NOTE: This API is still experimental and may change. - - - -#### `virtual Status tensorflow::Session::PRunSetup(const std::vector< string > &input_names, const std::vector< string > &output_names, const std::vector< string > &target_nodes, string *handle)` {#virtual_Status_tensorflow_Session_PRunSetup} - -Sets up a graph for partial execution. All future feeds and fetches are specified by `input_names` and `output_names`. Returns `handle` that can be used to perform a sequence of partial feeds and fetches. NOTE: This API is still experimental and may change. - - - -#### `virtual Status tensorflow::Session::PRun(const string &handle, const std::vector< std::pair< string, Tensor > > &inputs, const std::vector< string > &output_names, std::vector< Tensor > *outputs)` {#virtual_Status_tensorflow_Session_PRun} - -Continues the pending execution specified by `handle` with the provided input tensors and fills `outputs` for the endpoints specified in `output_names`. NOTE: This API is still experimental and may change. - - - -#### `virtual Status tensorflow::Session::Close()=0` {#virtual_Status_tensorflow_Session_Close} - -Closes this session. - -Closing a session releases the resources used by this session on the TensorFlow runtime (specified during session creation by the ` SessionOptions::target ` field). diff --git a/tensorflow/g3doc/api_docs/cc/ClassStatus.md b/tensorflow/g3doc/api_docs/cc/ClassStatus.md deleted file mode 100644 index 8956af75ec..0000000000 --- a/tensorflow/g3doc/api_docs/cc/ClassStatus.md +++ /dev/null @@ -1,85 +0,0 @@ -# `class tensorflow::Status` - -Denotes success or failure of a call in Tensorflow. - - - -###Member Details - -#### `tensorflow::Status::Status()` {#tensorflow_Status_Status} - -Create a success status. - - - -#### `tensorflow::Status::~Status()` {#tensorflow_Status_Status} - - - - - -#### `tensorflow::Status::Status(tensorflow::error::Code code, tensorflow::StringPiece msg)` {#tensorflow_Status_Status} - -Create a status with the specified error code and msg as a human-readable string containing more detailed information. - - - -#### `tensorflow::Status::Status(const Status &s)` {#tensorflow_Status_Status} - -Copy the specified status. - - - -#### `void tensorflow::Status::operator=(const Status &s)` {#void_tensorflow_Status_operator_} - - - - - -#### `bool tensorflow::Status::ok() const` {#bool_tensorflow_Status_ok} - -Returns true iff the status indicates success. - - - -#### `tensorflow::error::Code tensorflow::Status::code() const` {#tensorflow_error_Code_tensorflow_Status_code} - - - - - -#### `const string& tensorflow::Status::error_message() const` {#const_string_tensorflow_Status_error_message} - - - - - -#### `bool tensorflow::Status::operator==(const Status &x) const` {#bool_tensorflow_Status_operator_} - - - - - -#### `bool tensorflow::Status::operator!=(const Status &x) const` {#bool_tensorflow_Status_operator_} - - - - - -#### `void tensorflow::Status::Update(const Status &new_status)` {#void_tensorflow_Status_Update} - -If ` ok() `, stores `new_status` into `*this`. If `!ok()`, preserves the current status, but may augment with additional information about `new_status`. - -Convenient way of keeping track of the first error encountered. Instead of: `if (overall_status.ok()) overall_status = new_status` Use: `overall_status.Update(new_status);` - -#### `string tensorflow::Status::ToString() const` {#string_tensorflow_Status_ToString} - -Return a string representation of this status suitable for printing. Returns the string `"OK"` for success. - - - -#### `return tensorflow::Status::OK()` {#return_tensorflow_Status_OK} - - - - diff --git a/tensorflow/g3doc/api_docs/cc/ClassTensor.md b/tensorflow/g3doc/api_docs/cc/ClassTensor.md deleted file mode 100644 index b909bffe3a..0000000000 --- a/tensorflow/g3doc/api_docs/cc/ClassTensor.md +++ /dev/null @@ -1,382 +0,0 @@ -# `class tensorflow::Tensor` - -Represents an n-dimensional array of values. - - - -###Member Details - -#### `tensorflow::Tensor::Tensor()` {#tensorflow_Tensor_Tensor} - -Creates a 1-dimensional, 0-element float tensor. - -The returned Tensor is not a scalar (shape {}), but is instead an empty one-dimensional Tensor (shape {0}, NumElements() == 0). Since it has no elements, it does not need to be assigned a value and is initialized by default ( IsInitialized() is true). If this is undesirable, consider creating a one-element scalar which does require initialization: - -```c++ Tensor(DT_FLOAT, TensorShape({})) - -``` - -#### `tensorflow::Tensor::Tensor(DataType type, const TensorShape &shape)` {#tensorflow_Tensor_Tensor} - -Creates a Tensor of the given `type` and `shape`. If LogMemory::IsEnabled() the allocation is logged as coming from an unknown kernel and step. Calling the Tensor constructor directly from within an Op is deprecated: use the OpKernelConstruction/OpKernelContext allocate_* methods to allocate a new tensor, which record the kernel and step. - -The underlying buffer is allocated using a ` CPUAllocator `. - -#### `tensorflow::Tensor::Tensor(Allocator *a, DataType type, const TensorShape &shape)` {#tensorflow_Tensor_Tensor} - -Creates a tensor with the input `type` and `shape`, using the allocator `a` to allocate the underlying buffer. If LogMemory::IsEnabled() the allocation is logged as coming from an unknown kernel and step. Calling the Tensor constructor directly from within an Op is deprecated: use the OpKernelConstruction/OpKernelContext allocate_* methods to allocate a new tensor, which record the kernel and step. - -`a` must outlive the lifetime of this Tensor . - -#### `tensorflow::Tensor::Tensor(Allocator *a, DataType type, const TensorShape &shape, const AllocationAttributes &allocation_attr)` {#tensorflow_Tensor_Tensor} - -Creates a tensor with the input `type` and `shape`, using the allocator `a` and the specified "allocation_attr" to allocate the underlying buffer. If the kernel and step are known allocation_attr.allocation_will_be_logged should be set to true and LogMemory::RecordTensorAllocation should be called after the tensor is constructed. Calling the Tensor constructor directly from within an Op is deprecated: use the OpKernelConstruction/OpKernelContext allocate_* methods to allocate a new tensor, which record the kernel and step. - -`a` must outlive the lifetime of this Tensor . - -#### `tensorflow::Tensor::Tensor(DataType type)` {#tensorflow_Tensor_Tensor} - -Creates an empty Tensor of the given data type. - -Like Tensor() , returns a 1-dimensional, 0-element Tensor with IsInitialized() returning True. See the Tensor() documentation for details. - -#### `tensorflow::Tensor::Tensor(const Tensor &other)` {#tensorflow_Tensor_Tensor} - - - - - -#### `tensorflow::Tensor::Tensor(Tensor &&other)` {#tensorflow_Tensor_Tensor} - -Copy constructor. - - - -#### `tensorflow::Tensor::~Tensor()` {#tensorflow_Tensor_Tensor} - - - - - -#### `DataType tensorflow::Tensor::dtype() const` {#DataType_tensorflow_Tensor_dtype} - -Returns the data type. - - - -#### `const TensorShape& tensorflow::Tensor::shape() const` {#const_TensorShape_tensorflow_Tensor_shape} - -Returns the shape of the tensor. - - - -#### `int tensorflow::Tensor::dims() const` {#int_tensorflow_Tensor_dims} - -Convenience accessor for the tensor shape. - -For all shape accessors, see comments for relevant methods of ` TensorShape ` in ` tensor_shape.h `. - -#### `int64 tensorflow::Tensor::dim_size(int d) const` {#int64_tensorflow_Tensor_dim_size} - -Convenience accessor for the tensor shape. - - - -#### `int64 tensorflow::Tensor::NumElements() const` {#int64_tensorflow_Tensor_NumElements} - -Convenience accessor for the tensor shape. - - - -#### `bool tensorflow::Tensor::IsSameSize(const Tensor &b) const` {#bool_tensorflow_Tensor_IsSameSize} - - - - - -#### `bool tensorflow::Tensor::SharesBufferWith(const Tensor &b) const` {#bool_tensorflow_Tensor_SharesBufferWith} - - - - - -#### `bool tensorflow::Tensor::IsInitialized() const` {#bool_tensorflow_Tensor_IsInitialized} - -If necessary, has this Tensor been initialized? - -Zero-element Tensors are always considered initialized, even if they have never been assigned to and do not have any memory allocated. - -#### `size_t tensorflow::Tensor::TotalBytes() const` {#size_t_tensorflow_Tensor_TotalBytes} - -Returns the estimated memory usage of this tensor. - - - -#### `bool tensorflow::Tensor::IsAligned() const` {#bool_tensorflow_Tensor_IsAligned} - -Returns true iff this tensor is aligned. - - - -#### `Tensor& tensorflow::Tensor::operator=(const Tensor &other)` {#Tensor_tensorflow_Tensor_operator_} - -Assign operator. This tensor shares other's underlying storage. - - - -#### `Tensor & tensorflow::Tensor::operator=(Tensor &&other)` {#Tensor_tensorflow_Tensor_operator_} - -Move operator. See move constructor for details. - - - -#### `bool tensorflow::Tensor::CopyFrom(const Tensor &other, const TensorShape &shape) TF_MUST_USE_RESULT` {#bool_tensorflow_Tensor_CopyFrom} - -Copy the other tensor into this tensor and reshape it. - -This tensor shares other's underlying storage. Returns `true` iff `other.shape()` has the same number of elements of the given `shape`. - -#### `Tensor tensorflow::Tensor::Slice(int64 dim0_start, int64 dim0_limit) const` {#Tensor_tensorflow_Tensor_Slice} - -Slice this tensor along the 1st dimension. - -I.e., the returned tensor satisfies returned[i, ...] == this[dim0_start + i, ...]. The returned tensor shares the underlying tensor buffer with this tensor. - -NOTE: The returned tensor may not satisfies the same alignment requirement as this tensor depending on the shape. The caller must check the returned tensor's alignment before calling certain methods that have alignment requirement (e.g., ` flat() `, `tensor()`). - -REQUIRES: ` dims() ` >= 1 REQUIRES: `0 <= dim0_start <= dim0_limit <= dim_size(0)` - -#### `bool tensorflow::Tensor::FromProto(const TensorProto &other) TF_MUST_USE_RESULT` {#bool_tensorflow_Tensor_FromProto} - -Parse `other` and construct the tensor. - -Returns `true` iff the parsing succeeds. If the parsing fails, the state of `*this` is unchanged. - -#### `bool tensorflow::Tensor::FromProto(Allocator *a, const TensorProto &other) TF_MUST_USE_RESULT` {#bool_tensorflow_Tensor_FromProto} - - - - - -#### `void tensorflow::Tensor::AsProtoField(TensorProto *proto) const` {#void_tensorflow_Tensor_AsProtoField} - -Fills in `proto` with `*this` tensor's content. - -` AsProtoField() ` fills in the repeated field for `proto.dtype()`, while `AsProtoTensorContent()` encodes the content in `proto.tensor_content()` in a compact form. - -#### `void tensorflow::Tensor::AsProtoTensorContent(TensorProto *proto) const` {#void_tensorflow_Tensor_AsProtoTensorContent} - - - - - -#### `TTypes::Vec tensorflow::Tensor::vec()` {#TTypes_T_Vec_tensorflow_Tensor_vec} - -Return the tensor data as an `Eigen::Tensor` with the type and sizes of this ` Tensor `. - -Use these methods when you know the data type and the number of dimensions of the Tensor and you want an `Eigen::Tensor` automatically sized to the ` Tensor ` sizes. The implementation check fails if either type or sizes mismatch. - -Example: - -```c++ typedef float T; -Tensor my_mat(...built with Shape{rows: 3, cols: 5}...); -auto mat = my_mat.matrix(); // 2D Eigen::Tensor, 3 x 5. -auto mat = my_mat.tensor(); // 2D Eigen::Tensor, 3 x 5. -auto vec = my_mat.vec(); // CHECK fails as my_mat is 2D. -auto vec = my_mat.tensor(); // CHECK fails as my_mat is 2D. -auto mat = my_mat.matrix();// CHECK fails as type mismatch. - -``` - -#### `TTypes::Matrix tensorflow::Tensor::matrix()` {#TTypes_T_Matrix_tensorflow_Tensor_matrix} - - - - - -#### `TTypes< T, NDIMS >::Tensor tensorflow::Tensor::tensor()` {#TTypes_T_NDIMS_Tensor_tensorflow_Tensor_tensor} - - - - - -#### `TTypes< T, NDIMS >::Tensor tensorflow::Tensor::bit_casted_tensor()` {#TTypes_T_NDIMS_Tensor_tensorflow_Tensor_bit_casted_tensor} - -Return the tensor data to an `Eigen::Tensor` with the same size but a bitwise cast to the specified dtype `T`. - -Using a bitcast is useful for move and copy operations. NOTE: this is the same as `tensor()` except a bitcast is allowed. - -#### `TTypes::Flat tensorflow::Tensor::flat()` {#TTypes_T_Flat_tensorflow_Tensor_flat} - -Return the tensor data as an `Eigen::Tensor` of the data type and a specified shape. - -These methods allow you to access the data with the dimensions and sizes of your choice. You do not need to know the number of dimensions of the Tensor to call them. However, they `CHECK` that the type matches and the dimensions requested creates an `Eigen::Tensor` with the same number of elements as the tensor. - -Example: - -```c++ typedef float T; -Tensor my_ten(...built with Shape{planes: 4, rows: 3, cols: 5}...); -// 1D Eigen::Tensor, size 60: -auto flat = my_ten.flat(); -// 2D Eigen::Tensor 12 x 5: -auto inner = my_ten.flat_inner_dims(); -// 2D Eigen::Tensor 4 x 15: -auto outer = my_ten.shaped({4, 15}); -// CHECK fails, bad num elements: -auto outer = my_ten.shaped({4, 8}); -// 3D Eigen::Tensor 6 x 5 x 2: -auto weird = my_ten.shaped({6, 5, 2}); -// CHECK fails, type mismatch: -auto bad = my_ten.flat(); - -``` - -#### `TTypes::UnalignedFlat tensorflow::Tensor::unaligned_flat()` {#TTypes_T_UnalignedFlat_tensorflow_Tensor_unaligned_flat} - - - - - -#### `TTypes< T, NDIMS >::Tensor tensorflow::Tensor::flat_inner_dims()` {#TTypes_T_NDIMS_Tensor_tensorflow_Tensor_flat_inner_dims} - - - -Returns the data as an Eigen::Tensor with NDIMS dimensions, collapsing all Tensor dimensions but the last NDIMS-1 into the first dimension of the result. If NDIMS > dims() then leading dimensions of size 1 will be added to make the output rank NDIMS. - -#### `TTypes< T, NDIMS >::Tensor tensorflow::Tensor::flat_outer_dims()` {#TTypes_T_NDIMS_Tensor_tensorflow_Tensor_flat_outer_dims} - - - -Returns the data as an Eigen::Tensor with NDIMS dimensions, collapsing all Tensor dimensions but the first NDIMS-1 into the last dimension of the result. If NDIMS > dims() then trailing dimensions of size 1 will be added to make the output rank NDIMS. - -#### `TTypes< T, NDIMS >::Tensor tensorflow::Tensor::shaped(gtl::ArraySlice< int64 > new_sizes)` {#TTypes_T_NDIMS_Tensor_tensorflow_Tensor_shaped} - - - - - -#### `TTypes< T, NDIMS >::Tensor tensorflow::Tensor::bit_casted_shaped(gtl::ArraySlice< int64 > new_sizes)` {#TTypes_T_NDIMS_Tensor_tensorflow_Tensor_bit_casted_shaped} - -Return the tensor data to an `Eigen::Tensor` with the new shape specified in `new_sizes` and cast to a new dtype `T`. - -Using a bitcast is useful for move and copy operations. The allowed bitcast is the only difference from `shaped()`. - -#### `TTypes< T, NDIMS >::UnalignedTensor tensorflow::Tensor::unaligned_shaped(gtl::ArraySlice< int64 > new_sizes)` {#TTypes_T_NDIMS_UnalignedTensor_tensorflow_Tensor_unaligned_shaped} - - - - - -#### `TTypes< T >::Scalar tensorflow::Tensor::scalar()` {#TTypes_T_Scalar_tensorflow_Tensor_scalar} - -Return the Tensor data as a `TensorMap` of fixed size 1: `TensorMap>`. - -Using ` scalar() ` allows the compiler to perform optimizations as the size of the tensor is known at compile time. - -#### `TTypes::ConstVec tensorflow::Tensor::vec() const` {#TTypes_T_ConstVec_tensorflow_Tensor_vec} - -Const versions of all the methods above. - - - -#### `TTypes::ConstMatrix tensorflow::Tensor::matrix() const` {#TTypes_T_ConstMatrix_tensorflow_Tensor_matrix} - - - - - -#### `TTypes< T, NDIMS >::ConstTensor tensorflow::Tensor::tensor() const` {#TTypes_T_NDIMS_ConstTensor_tensorflow_Tensor_tensor} - - - - - -#### `TTypes< T, NDIMS >::ConstTensor tensorflow::Tensor::bit_casted_tensor() const` {#TTypes_T_NDIMS_ConstTensor_tensorflow_Tensor_bit_casted_tensor} - -Return the tensor data to an `Eigen::Tensor` with the same size but a bitwise cast to the specified dtype `T`. - -Using a bitcast is useful for move and copy operations. NOTE: this is the same as `tensor()` except a bitcast is allowed. - -#### `TTypes::ConstFlat tensorflow::Tensor::flat() const` {#TTypes_T_ConstFlat_tensorflow_Tensor_flat} - - - - - -#### `TTypes::UnalignedConstFlat tensorflow::Tensor::unaligned_flat() const` {#TTypes_T_UnalignedConstFlat_tensorflow_Tensor_unaligned_flat} - - - - - -#### `TTypes< T, NDIMS >::ConstTensor tensorflow::Tensor::shaped(gtl::ArraySlice< int64 > new_sizes) const` {#TTypes_T_NDIMS_ConstTensor_tensorflow_Tensor_shaped} - - - - - -#### `TTypes< T, NDIMS >::ConstTensor tensorflow::Tensor::bit_casted_shaped(gtl::ArraySlice< int64 > new_sizes) const` {#TTypes_T_NDIMS_ConstTensor_tensorflow_Tensor_bit_casted_shaped} - -Return the tensor data to an `Eigen::Tensor` with the new shape specified in `new_sizes` and cast to a new dtype `T`. - -Using a bitcast is useful for move and copy operations. The allowed bitcast is the only difference from `shaped()`. - -#### `TTypes< T, NDIMS >::UnalignedConstTensor tensorflow::Tensor::unaligned_shaped(gtl::ArraySlice< int64 > new_sizes) const` {#TTypes_T_NDIMS_UnalignedConstTensor_tensorflow_Tensor_unaligned_shaped} - - - - - -#### `TTypes< T >::ConstScalar tensorflow::Tensor::scalar() const` {#TTypes_T_ConstScalar_tensorflow_Tensor_scalar} - - - - - -#### `TTypes< T, NDIMS >::ConstTensor tensorflow::Tensor::flat_inner_dims() const` {#TTypes_T_NDIMS_ConstTensor_tensorflow_Tensor_flat_inner_dims} - - - - - -#### `TTypes< T, NDIMS >::ConstTensor tensorflow::Tensor::flat_outer_dims() const` {#TTypes_T_NDIMS_ConstTensor_tensorflow_Tensor_flat_outer_dims} - - - - - -#### `string tensorflow::Tensor::SummarizeValue(int64 max_entries) const` {#string_tensorflow_Tensor_SummarizeValue} - -Render the first `max_entries` values in `*this` into a string. - - - -#### `string tensorflow::Tensor::DebugString() const` {#string_tensorflow_Tensor_DebugString} - -A human-readable summary of the tensor suitable for debugging. - - - -#### `void tensorflow::Tensor::FillDescription(TensorDescription *description) const` {#void_tensorflow_Tensor_FillDescription} - - - -Fill in the `TensorDescription` proto with metadata about the tensor that is useful for monitoring and debugging. - -#### `StringPiece tensorflow::Tensor::tensor_data() const` {#StringPiece_tensorflow_Tensor_tensor_data} - -Returns a ` StringPiece ` mapping the current tensor's buffer. - -The returned ` StringPiece ` may point to memory location on devices that the CPU cannot address directly. - -NOTE: The underlying tensor buffer is refcounted, so the lifetime of the contents mapped by the ` StringPiece ` matches the lifetime of the buffer; callers should arrange to make sure the buffer does not get destroyed while the ` StringPiece ` is still used. - -REQUIRES: `DataTypeCanUseMemcpy(dtype())`. - -#### `void tensorflow::Tensor::UnsafeCopyFromInternal(const Tensor &, DataType dtype, const TensorShape &)` {#void_tensorflow_Tensor_UnsafeCopyFromInternal} - - - -Copy the other tensor into this tensor and reshape it and reinterpret the buffer's datatype. - -This tensor shares other's underlying storage. diff --git a/tensorflow/g3doc/api_docs/cc/ClassTensorShape.md b/tensorflow/g3doc/api_docs/cc/ClassTensorShape.md deleted file mode 100644 index 51fad8c2fa..0000000000 --- a/tensorflow/g3doc/api_docs/cc/ClassTensorShape.md +++ /dev/null @@ -1,221 +0,0 @@ -# `class tensorflow::TensorShape` - - - -Represents the shape of a Tensor . - -A tensor's shape is denoted by its number of dimensions and a size for each dimension. For example, a Tensor represented by a 3 x 4 matrix would have a shape of 2-D, [3,4]. - -If you know the exact shape of your Tensor when you create the TensorShape object, you can specify it then, or you can create a TensorShape with zero dimensions and one element, and call AddDim() to add dimensions later. - -###Member Details - -#### `uint8 tensorflow::TensorShape::buf[16][16]` {#uint8_tensorflow_TensorShape_buf_16_} - - - - - -#### `Rep64* tensorflow::TensorShape::unused_aligner` {#Rep64_tensorflow_TensorShape_unused_aligner} - - - - - -#### `tensorflow::TensorShape::TensorShape(gtl::ArraySlice< int64 > dim_sizes)` {#tensorflow_TensorShape_TensorShape} - -Construct a ` TensorShape ` from the provided sizes. REQUIRES: `dim_sizes[i] >= 0` - - - -#### `tensorflow::TensorShape::TensorShape(std::initializer_list< int64 > dim_sizes)` {#tensorflow_TensorShape_TensorShape} - - - - - -#### `tensorflow::TensorShape::TensorShape(const TensorShapeProto &proto)` {#tensorflow_TensorShape_TensorShape} - -REQUIRES: `IsValid(proto)` - - - -#### `tensorflow::TensorShape::TensorShape()` {#tensorflow_TensorShape_TensorShape} - - - -Create a tensor shape with no dimensions and one element, which you can then call ` AddDim() ` on. - -#### `tensorflow::TensorShape::~TensorShape()` {#tensorflow_TensorShape_TensorShape} - - - - - -#### `tensorflow::TensorShape::TensorShape(const TensorShape &b)` {#tensorflow_TensorShape_TensorShape} - -Copy the specified shape. - - - -#### `void tensorflow::TensorShape::operator=(const TensorShape &b)` {#void_tensorflow_TensorShape_operator_} - - - - - -#### `tensorflow::TensorShape::TensorShape(TensorShape &&b)` {#tensorflow_TensorShape_TensorShape} - -Move the specified shape. After moving, is safe for destruction and. - - - -#### `void tensorflow::TensorShape::operator=(TensorShape &&b)` {#void_tensorflow_TensorShape_operator_} - - - - - -#### `void tensorflow::TensorShape::Clear()` {#void_tensorflow_TensorShape_Clear} - -Clear a tensor shape. - - - -#### `void tensorflow::TensorShape::AddDim(int64 size)` {#void_tensorflow_TensorShape_AddDim} - -Add a dimension to the end ("inner-most"). REQUIRES: `size >= 0` - - - -#### `void tensorflow::TensorShape::AppendShape(const TensorShape &shape)` {#void_tensorflow_TensorShape_AppendShape} - -Appends all the dimensions from `shape`. - - - -#### `void tensorflow::TensorShape::InsertDim(int d, int64 size)` {#void_tensorflow_TensorShape_InsertDim} - -Insert a dimension somewhere in the ` TensorShape `. REQUIRES: `0 <= d <= dims() ` REQUIRES: `size >= 0` - - - -#### `void tensorflow::TensorShape::set_dim(int d, int64 size)` {#void_tensorflow_TensorShape_set_dim} - -Modifies the size of the dimension `d` to be `size` REQUIRES: `0 <= d < dims() ` REQUIRES: `size >= 0` - - - -#### `void tensorflow::TensorShape::RemoveDim(int d)` {#void_tensorflow_TensorShape_RemoveDim} - -Removes dimension `d` from the ` TensorShape `. REQUIRES: `0 <= d < dims() ` - - - -#### `int tensorflow::TensorShape::dims() const` {#int_tensorflow_TensorShape_dims} - -Return the number of dimensions in the tensor. - - - -#### `int64 tensorflow::TensorShape::dim_size(int d) const` {#int64_tensorflow_TensorShape_dim_size} - -Returns the number of elements in dimension `d`. REQUIRES: `0 <= d < dims() ` - - - -#### `gtl::InlinedVector< int64, 4 > tensorflow::TensorShape::dim_sizes() const` {#gtl_InlinedVector_int64_4_tensorflow_TensorShape_dim_sizes} - -Returns sizes of all dimensions. - - - -#### `int64 tensorflow::TensorShape::num_elements() const` {#int64_tensorflow_TensorShape_num_elements} - -Returns the number of elements in the tensor. - -We use `int64` and not `size_t` to be compatible with `Eigen::Tensor` which uses `ptrdiff_t`. - -#### `bool tensorflow::TensorShape::IsSameSize(const TensorShape &b) const` {#bool_tensorflow_TensorShape_IsSameSize} - - - -Returns true if `*this` and `b` have the same sizes. Ignores dimension names. - -#### `bool tensorflow::TensorShape::operator==(const TensorShape &b) const` {#bool_tensorflow_TensorShape_operator_} - - - - - -#### `bool tensorflow::TensorShape::operator!=(const TensorShape &b) const` {#bool_tensorflow_TensorShape_operator_} - - - - - -#### `void tensorflow::TensorShape::AsProto(TensorShapeProto *proto) const` {#void_tensorflow_TensorShape_AsProto} - -Fill `*proto` from `*this`. - - - -#### `Eigen::DSizes< Eigen::DenseIndex, NDIMS > tensorflow::TensorShape::AsEigenDSizes() const` {#Eigen_DSizes_Eigen_DenseIndex_NDIMS_tensorflow_TensorShape_AsEigenDSizes} - -Fill `*dsizes` from `*this`. - - - -#### `Eigen::DSizes< Eigen::DenseIndex, NDIMS > tensorflow::TensorShape::AsEigenDSizesWithPadding() const` {#Eigen_DSizes_Eigen_DenseIndex_NDIMS_tensorflow_TensorShape_AsEigenDSizesWithPadding} - - - -Same as ` AsEigenDSizes() ` but allows for `NDIMS > dims() ` in which case we pad the rest of the sizes with 1. - -#### `TensorShapeIter tensorflow::TensorShape::begin() const` {#TensorShapeIter_tensorflow_TensorShape_begin} - -For iterating through the dimensions. - - - -#### `TensorShapeIter tensorflow::TensorShape::end() const` {#TensorShapeIter_tensorflow_TensorShape_end} - - - - - -#### `string tensorflow::TensorShape::DebugString() const` {#string_tensorflow_TensorShape_DebugString} - -For error messages. - - - -#### `void tensorflow::TensorShape::DumpRep() const` {#void_tensorflow_TensorShape_DumpRep} - - - - - -#### `bool tensorflow::TensorShape::IsValid(const TensorShapeProto &proto)` {#bool_tensorflow_TensorShape_IsValid} - -Returns `true` iff `proto` is a valid tensor shape. - - - -#### `Status tensorflow::TensorShape::IsValidShape(const TensorShapeProto &proto)` {#Status_tensorflow_TensorShape_IsValidShape} - - - -Returns `OK` iff `proto` is a valid tensor shape, and a descriptive error status otherwise. - -#### `static constexpr int tensorflow::TensorShape::MaxDimensions()` {#static_constexpr_int_tensorflow_TensorShape_MaxDimensions} - - - - - -#### `string tensorflow::TensorShape::DebugString(const TensorShapeProto &proto)` {#string_tensorflow_TensorShape_DebugString} - - - -Same as `TensorShape(proto). DebugString() ` but doesn't crash for invalid protos. diff --git a/tensorflow/g3doc/api_docs/cc/ClassTensorShapeUtils.md b/tensorflow/g3doc/api_docs/cc/ClassTensorShapeUtils.md deleted file mode 100644 index 7d8c36ddec..0000000000 --- a/tensorflow/g3doc/api_docs/cc/ClassTensorShapeUtils.md +++ /dev/null @@ -1,85 +0,0 @@ -# `class tensorflow::TensorShapeUtils` - -Static helper routines for ` TensorShape `. Includes a few common predicates on a tensor shape. - - - -###Member Details - -#### `static bool tensorflow::TensorShapeUtils::IsScalar(const TensorShape &shape)` {#static_bool_tensorflow_TensorShapeUtils_IsScalar} - - - - - -#### `static bool tensorflow::TensorShapeUtils::IsVector(const TensorShape &shape)` {#static_bool_tensorflow_TensorShapeUtils_IsVector} - - - - - -#### `static bool tensorflow::TensorShapeUtils::IsVectorOrHigher(const TensorShape &shape)` {#static_bool_tensorflow_TensorShapeUtils_IsVectorOrHigher} - - - - - -#### `static bool tensorflow::TensorShapeUtils::IsMatrix(const TensorShape &shape)` {#static_bool_tensorflow_TensorShapeUtils_IsMatrix} - - - - - -#### `static bool tensorflow::TensorShapeUtils::IsSquareMatrix(const TensorShape &shape)` {#static_bool_tensorflow_TensorShapeUtils_IsSquareMatrix} - - - - - -#### `static bool tensorflow::TensorShapeUtils::IsMatrixOrHigher(const TensorShape &shape)` {#static_bool_tensorflow_TensorShapeUtils_IsMatrixOrHigher} - - - - - -#### `static Status tensorflow::TensorShapeUtils::MakeShape(const int32 *dims, int64 n, TensorShape *out)` {#static_Status_tensorflow_TensorShapeUtils_MakeShape} - -Returns a ` TensorShape ` whose dimensions are `dims[0]`, `dims[1]`, ..., `dims[n-1]`. - - - -#### `static Status tensorflow::TensorShapeUtils::MakeShape(const int64 *dims, int64 n, TensorShape *out)` {#static_Status_tensorflow_TensorShapeUtils_MakeShape} - - - - - -#### `static Status tensorflow::TensorShapeUtils::MakeShape(gtl::ArraySlice< int32 > shape, TensorShape *out)` {#static_Status_tensorflow_TensorShapeUtils_MakeShape} - - - - - -#### `static Status tensorflow::TensorShapeUtils::MakeShape(gtl::ArraySlice< int64 > shape, TensorShape *out)` {#static_Status_tensorflow_TensorShapeUtils_MakeShape} - - - - - -#### `string tensorflow::TensorShapeUtils::ShapeListString(const gtl::ArraySlice< TensorShape > &shapes)` {#string_tensorflow_TensorShapeUtils_ShapeListString} - - - - - -#### `bool tensorflow::TensorShapeUtils::StartsWith(const TensorShape &shape, const TensorShape &prefix)` {#bool_tensorflow_TensorShapeUtils_StartsWith} - -Returns true iff `shape` starts with `prefix`. - - - -#### `bool tensorflow::TensorShapeUtils::EndsWith(const TensorShape &shape, const TensorShape &suffix)` {#bool_tensorflow_TensorShapeUtils_EndsWith} - -Returns true iff `shape` ends with `suffix`. - - diff --git a/tensorflow/g3doc/api_docs/cc/ClassThread.md b/tensorflow/g3doc/api_docs/cc/ClassThread.md deleted file mode 100644 index 56127d72ad..0000000000 --- a/tensorflow/g3doc/api_docs/cc/ClassThread.md +++ /dev/null @@ -1,19 +0,0 @@ -# `class tensorflow::Thread` - -Represents a thread used to run a Tensorflow function. - - - -###Member Details - -#### `tensorflow::Thread::Thread()` {#tensorflow_Thread_Thread} - - - - - -#### `tensorflow::Thread::~Thread()` {#tensorflow_Thread_Thread} - -Blocks until the thread of control stops running. - - diff --git a/tensorflow/g3doc/api_docs/cc/ClassWritableFile.md b/tensorflow/g3doc/api_docs/cc/ClassWritableFile.md deleted file mode 100644 index a7e250d697..0000000000 --- a/tensorflow/g3doc/api_docs/cc/ClassWritableFile.md +++ /dev/null @@ -1,43 +0,0 @@ -# `class tensorflow::WritableFile` - -A file abstraction for sequential writing. - -The implementation must provide buffering since callers may append small fragments at a time to the file. - -###Member Details - -#### `tensorflow::WritableFile::WritableFile()` {#tensorflow_WritableFile_WritableFile} - - - - - -#### `tensorflow::WritableFile::~WritableFile()` {#tensorflow_WritableFile_WritableFile} - - - - - -#### `virtual Status tensorflow::WritableFile::Append(const StringPiece &data)=0` {#virtual_Status_tensorflow_WritableFile_Append} - - - - - -#### `virtual Status tensorflow::WritableFile::Close()=0` {#virtual_Status_tensorflow_WritableFile_Close} - - - - - -#### `virtual Status tensorflow::WritableFile::Flush()=0` {#virtual_Status_tensorflow_WritableFile_Flush} - - - - - -#### `virtual Status tensorflow::WritableFile::Sync()=0` {#virtual_Status_tensorflow_WritableFile_Sync} - - - - diff --git a/tensorflow/g3doc/api_docs/cc/StructSessionOptions.md b/tensorflow/g3doc/api_docs/cc/StructSessionOptions.md deleted file mode 100644 index f0dbe1a304..0000000000 --- a/tensorflow/g3doc/api_docs/cc/StructSessionOptions.md +++ /dev/null @@ -1,39 +0,0 @@ -# `struct tensorflow::SessionOptions` - -Configuration information for a Session . - - - -###Member Details - -#### `Env* tensorflow::SessionOptions::env` {#Env_tensorflow_SessionOptions_env} - -The environment to use. - - - -#### `string tensorflow::SessionOptions::target` {#string_tensorflow_SessionOptions_target} - -The TensorFlow runtime to connect to. - -If 'target' is empty or unspecified, the local TensorFlow runtime implementation will be used. Otherwise, the TensorFlow engine defined by 'target' will be used to perform all computations. - -"target" can be either a single entry or a comma separated list of entries. Each entry is a resolvable address of the following format: local ip:port host:port ... other system-specific formats to identify tasks and jobs ... - -NOTE: at the moment 'local' maps to an in-process service-based runtime. - -Upon creation, a single session affines itself to one of the remote processes, with possible load balancing choices when the "target" resolves to a list of possible processes. - -If the session disconnects from the remote process during its lifetime, session calls may fail immediately. - -#### `ConfigProto tensorflow::SessionOptions::config` {#ConfigProto_tensorflow_SessionOptions_config} - -Configuration options. - - - -#### `tensorflow::SessionOptions::SessionOptions()` {#tensorflow_SessionOptions_SessionOptions} - - - - diff --git a/tensorflow/g3doc/api_docs/cc/StructState.md b/tensorflow/g3doc/api_docs/cc/StructState.md deleted file mode 100644 index a0335b20e0..0000000000 --- a/tensorflow/g3doc/api_docs/cc/StructState.md +++ /dev/null @@ -1,19 +0,0 @@ -# `struct tensorflow::Status::State` - - - - - -###Member Details - -#### `tensorflow::error::Code tensorflow::Status::State::code` {#tensorflow_error_Code_tensorflow_Status_State_code} - - - - - -#### `string tensorflow::Status::State::msg` {#string_tensorflow_Status_State_msg} - - - - diff --git a/tensorflow/g3doc/api_docs/cc/StructTensorShapeDim.md b/tensorflow/g3doc/api_docs/cc/StructTensorShapeDim.md deleted file mode 100644 index 509491f27c..0000000000 --- a/tensorflow/g3doc/api_docs/cc/StructTensorShapeDim.md +++ /dev/null @@ -1,19 +0,0 @@ -# `struct tensorflow::TensorShapeDim` - -Represents the value of one dimension in a TensorShape . - - - -###Member Details - -#### `int64 tensorflow::TensorShapeDim::size` {#int64_tensorflow_TensorShapeDim_size} - - - - - -#### `tensorflow::TensorShapeDim::TensorShapeDim(int64 s)` {#tensorflow_TensorShapeDim_TensorShapeDim} - - - - diff --git a/tensorflow/g3doc/api_docs/cc/StructThreadOptions.md b/tensorflow/g3doc/api_docs/cc/StructThreadOptions.md deleted file mode 100644 index 35db265ecd..0000000000 --- a/tensorflow/g3doc/api_docs/cc/StructThreadOptions.md +++ /dev/null @@ -1,19 +0,0 @@ -# `struct tensorflow::ThreadOptions` - -Options to configure a Thread . - -Note that the options are all hints, and the underlying implementation may choose to ignore it. - -###Member Details - -#### `size_t tensorflow::ThreadOptions::stack_size` {#size_t_tensorflow_ThreadOptions_stack_size} - -Thread stack size to use (in bytes). - - - -#### `size_t tensorflow::ThreadOptions::guard_size` {#size_t_tensorflow_ThreadOptions_guard_size} - -Guard area size to use near thread stacks to use (in bytes) - - diff --git a/tensorflow/g3doc/api_docs/cc/index.md b/tensorflow/g3doc/api_docs/cc/index.md deleted file mode 100644 index 2fb0b1c1d2..0000000000 --- a/tensorflow/g3doc/api_docs/cc/index.md +++ /dev/null @@ -1,56 +0,0 @@ -# TensorFlow C++ Session API reference documentation - -TensorFlow's public C++ API includes only the API for executing graphs, as of -version 0.5. To control the execution of a graph from C++: - -1. Build the computation graph using the [Python API](../python/). -1. Use [`tf.train.write_graph()`](../python/train.md#write_graph) to -write the graph to a file. -1. Load the graph using the C++ Session API. For example: - - ```c++ - // Reads a model graph definition from disk, and creates a session object you - // can use to run it. - Status LoadGraph(string graph_file_name, Session** session) { - GraphDef graph_def; - TF_RETURN_IF_ERROR( - ReadBinaryProto(Env::Default(), graph_file_name, &graph_def)); - TF_RETURN_IF_ERROR(NewSession(SessionOptions(), session)); - TF_RETURN_IF_ERROR((*session)->Create(graph_def)); - return Status::OK(); - } -``` - -1. Run the graph with a call to `session->Run()` - -## Env - -* [tensorflow::Env](ClassEnv.md) -* [tensorflow::RandomAccessFile](ClassRandomAccessFile.md) -* [tensorflow::WritableFile](ClassWritableFile.md) -* [tensorflow::EnvWrapper](ClassEnvWrapper.md) - -## Session - -* [tensorflow::Session](ClassSession.md) -* [tensorflow::SessionOptions](StructSessionOptions.md) - -## Status - -* [tensorflow::Status](ClassStatus.md) -* [tensorflow::Status::State](StructState.md) - -## Tensor - -* [tensorflow::Tensor](ClassTensor.md) -* [tensorflow::TensorShape](ClassTensorShape.md) -* [tensorflow::TensorShapeDim](StructTensorShapeDim.md) -* [tensorflow::TensorShapeUtils](ClassTensorShapeUtils.md) -* [tensorflow::PartialTensorShape](ClassPartialTensorShape.md) -* [tensorflow::PartialTensorShapeUtils](ClassPartialTensorShapeUtils.md) - -## Thread - -* [tensorflow::Thread](ClassThread.md) -* [tensorflow::ThreadOptions](StructThreadOptions.md) - diff --git a/tensorflow/g3doc/api_docs/index.md b/tensorflow/g3doc/api_docs/index.md deleted file mode 100644 index a2b4b1c293..0000000000 --- a/tensorflow/g3doc/api_docs/index.md +++ /dev/null @@ -1,21 +0,0 @@ -# API Documentation - -TensorFlow has APIs available in several languages both for constructing and -executing a TensorFlow graph. The Python API is at present the most complete and -the easiest to use, but the C++ API may offer some performance advantages in -graph execution, and supports deployment to small devices such as Android. - -Additionally, the TensorFlow maintainers intend to include APIs for -[Java](https://github.com/tensorflow/tensorflow/issues/5). We hope that -the TensorFlow community will develop front ends for other languages like -JavaScript, Lua, R and perhaps others, building on the [approach recommended by -the TensorFlow maintainers](../how_tos/language_bindings/index.md). - -Note: Many practical aspects of usage are covered in the TUTORIALS and HOW TO -tab, and some additional documentation not specific to any particular language -API is available in the RESOURCES tab. - -* [Python API](python/index.md) -* [C++ API](cc/index.md) -* [Go API](https://godoc.org/github.com/tensorflow/tensorflow/tensorflow/go) - (experimental) diff --git a/tensorflow/g3doc/api_docs/leftnav_files b/tensorflow/g3doc/api_docs/leftnav_files deleted file mode 100644 index b1cf343c0b..0000000000 --- a/tensorflow/g3doc/api_docs/leftnav_files +++ /dev/null @@ -1,60 +0,0 @@ -### [Overview](/api_docs/index.md) -### [Python API](/api_docs/python/index.md) -python/framework.md -python/constant_op.md -python/state_ops.md -python/array_ops.md -python/tensor_array_ops.md -python/math_ops.md -python/string_ops.md -python/control_flow_ops.md -python/check_ops.md -python/image.md -python/sparse_ops.md -python/io_ops.md -python/python_io.md -python/nn.md -python/client.md -python/train.md -python/histogram_ops.md -python/summary.md -python/session_ops.md -python/script_ops.md -python/functional_ops.md -python/test.md -python/contrib.bayesflow.entropy.md -python/contrib.bayesflow.monte_carlo.md -python/contrib.bayesflow.stochastic_graph.md -python/contrib.bayesflow.stochastic_tensor.md -python/contrib.bayesflow.variational_inference.md -python/contrib.copy_graph.md -python/contrib.crf.md -python/contrib.distributions.md -python/contrib.ffmpeg.md -python/contrib.framework.md -python/contrib.graph_editor.md -python/contrib.layers.md -python/contrib.learn.md -python/contrib.learn.monitors.md -python/contrib.losses.md -python/contrib.metrics.md -python/contrib.rnn.md -python/contrib.training.md -python/contrib.util.md ->>> [C++ API](/api_docs/cc/index.md) -cc/ClassEnv.md -cc/ClassRandomAccessFile.md -cc/ClassWritableFile.md -cc/ClassEnvWrapper.md -cc/ClassSession.md -cc/StructSessionOptions.md -cc/ClassStatus.md -cc/StructState.md -cc/ClassTensor.md -cc/ClassTensorShape.md -cc/StructTensorShapeDim.md -cc/ClassTensorShapeUtils.md -cc/ClassPartialTensorShape.md -cc/ClassPartialTensorShapeUtils.md -cc/ClassThread.md -cc/StructThreadOptions.md diff --git a/tensorflow/g3doc/api_docs/python/array_ops.md b/tensorflow/g3doc/api_docs/python/array_ops.md deleted file mode 100644 index 1c7749edfd..0000000000 --- a/tensorflow/g3doc/api_docs/python/array_ops.md +++ /dev/null @@ -1,3168 +0,0 @@ - - -# Tensor Transformations - -Note: Functions taking `Tensor` arguments can also take anything accepted by -[`tf.convert_to_tensor`](framework.md#convert_to_tensor). - -[TOC] - -## Casting - -TensorFlow provides several operations that you can use to cast tensor data -types in your graph. - -- - - - -### `tf.string_to_number(string_tensor, out_type=None, name=None)` {#string_to_number} - -Converts each string in the input Tensor to the specified numeric type. - -(Note that int32 overflow results in an error while float overflow -results in a rounded value.) - -##### Args: - - -* `string_tensor`: A `Tensor` of type `string`. -* `out_type`: An optional `tf.DType` from: `tf.float32, tf.int32`. Defaults to `tf.float32`. - The numeric type to interpret each string in `string_tensor` as. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `out_type`. - A Tensor of the same shape as the input `string_tensor`. - - -- - - - -### `tf.to_double(x, name='ToDouble')` {#to_double} - -Casts a tensor to type `float64`. - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` with same shape as `x` with type `float64`. - -##### Raises: - - -* `TypeError`: If `x` cannot be cast to the `float64`. - - -- - - - -### `tf.to_float(x, name='ToFloat')` {#to_float} - -Casts a tensor to type `float32`. - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` with same shape as `x` with type `float32`. - -##### Raises: - - -* `TypeError`: If `x` cannot be cast to the `float32`. - - -- - - - -### `tf.to_bfloat16(x, name='ToBFloat16')` {#to_bfloat16} - -Casts a tensor to type `bfloat16`. - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` with same shape as `x` with type `bfloat16`. - -##### Raises: - - -* `TypeError`: If `x` cannot be cast to the `bfloat16`. - - -- - - - -### `tf.to_int32(x, name='ToInt32')` {#to_int32} - -Casts a tensor to type `int32`. - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` with same shape as `x` with type `int32`. - -##### Raises: - - -* `TypeError`: If `x` cannot be cast to the `int32`. - - -- - - - -### `tf.to_int64(x, name='ToInt64')` {#to_int64} - -Casts a tensor to type `int64`. - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` with same shape as `x` with type `int64`. - -##### Raises: - - -* `TypeError`: If `x` cannot be cast to the `int64`. - - -- - - - -### `tf.cast(x, dtype, name=None)` {#cast} - -Casts a tensor to a new type. - -The operation casts `x` (in case of `Tensor`) or `x.values` -(in case of `SparseTensor`) to `dtype`. - -For example: - -```python -# tensor `a` is [1.8, 2.2], dtype=tf.float -tf.cast(a, tf.int32) ==> [1, 2] # dtype=tf.int32 -``` - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. -* `dtype`: The destination type. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` with same shape as `x`. - -##### Raises: - - -* `TypeError`: If `x` cannot be cast to the `dtype`. - - -- - - - -### `tf.bitcast(input, type, name=None)` {#bitcast} - -Bitcasts a tensor from one type to another without copying data. - -Given a tensor `input`, this operation returns a tensor that has the same buffer -data as `input` with datatype `type`. - -If the input datatype `T` is larger than the output datatype `type` then the -shape changes from [...] to [..., sizeof(`T`)/sizeof(`type`)]. - -If `T` is smaller than `type`, the operator requires that the rightmost -dimension be equal to sizeof(`type`)/sizeof(`T`). The shape then goes from -[..., sizeof(`type`)/sizeof(`T`)] to [...]. - -*NOTE*: Bitcast is implemented as a low-level cast, so machines with different -endian orderings will give different results. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `type`: A `tf.DType` from: `tf.float32, tf.float64, tf.int64, tf.int32, tf.uint8, tf.uint16, tf.int16, tf.int8, tf.complex64, tf.complex128, tf.qint8, tf.quint8, tf.qint32, tf.half`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `type`. - - -- - - - -### `tf.saturate_cast(value, dtype, name=None)` {#saturate_cast} - -Performs a safe saturating cast of `value` to `dtype`. - -This function casts the input to `dtype` without applying any scaling. If -there is a danger that values would over or underflow in the cast, this op -applies the appropriate clamping before the cast. - -##### Args: - - -* `value`: A `Tensor`. -* `dtype`: The desired output `DType`. -* `name`: A name for the operation (optional). - -##### Returns: - - `value` safely cast to `dtype`. - - - -## Shapes and Shaping - -TensorFlow provides several operations that you can use to determine the shape -of a tensor and change the shape of a tensor. - -- - - - -### `tf.broadcast_dynamic_shape(shape_x, shape_y)` {#broadcast_dynamic_shape} - -Returns the broadcasted dynamic shape between `shape_x` and `shape_y`. - -##### Args: - - -* `shape_x`: A rank 1 integer `Tensor`, representing the shape of x. -* `shape_y`: A rank 1 integer `Tensor`, representing the shape of x. - -##### Returns: - - A rank 1 integer `Tensor` representing the broadcasted shape. - - -- - - - -### `tf.broadcast_static_shape(shape_x, shape_y)` {#broadcast_static_shape} - -Returns the broadcasted static shape between `shape_x` and `shape_y`. - -##### Args: - - -* `shape_x`: A `TensorShape` -* `shape_y`: A `TensorShape` - -##### Returns: - - A `TensorShape` representing the broadcasted shape. - -##### Raises: - - -* `ValueError`: If the two shapes can not be broadcasted. - - -- - - - -### `tf.shape(input, name=None, out_type=tf.int32)` {#shape} - -Returns the shape of a tensor. - -This operation returns a 1-D integer tensor representing the shape of `input`. - -For example: - -```python -# 't' is [[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]] -shape(t) ==> [2, 2, 3] -``` - -##### Args: - - -* `input`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). -* `out_type`: (Optional) The specified output type of the operation - (`int32` or `int64`). Defaults to `tf.int32`. - -##### Returns: - - A `Tensor` of type `out_type`. - - -- - - - -### `tf.shape_n(input, out_type=None, name=None)` {#shape_n} - -Returns shape of tensors. - -This operation returns N 1-D integer tensors representing shape of `input[i]s`. - -##### Args: - - -* `input`: A list of at least 1 `Tensor` objects of the same type. -* `out_type`: An optional `tf.DType` from: `tf.int32, tf.int64`. Defaults to `tf.int32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A list with the same number of `Tensor` objects as `input` of `Tensor` objects of type out_type. - - -- - - - -### `tf.size(input, name=None, out_type=tf.int32)` {#size} - -Returns the size of a tensor. - -This operation returns an integer representing the number of elements in -`input`. - -For example: - -```python -# 't' is [[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]] -size(t) ==> 12 -``` - -##### Args: - - -* `input`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). -* `out_type`: (Optional) The specified output type of the operation - (`int32` or `int64`). Defaults to tf.int32. - -##### Returns: - - A `Tensor` of type `out_type`. Defaults to tf.int32. - - -- - - - -### `tf.rank(input, name=None)` {#rank} - -Returns the rank of a tensor. - -This operation returns an integer representing the rank of `input`. - -For example: - -```python -# 't' is [[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]] -# shape of tensor 't' is [2, 2, 3] -rank(t) ==> 3 -``` - -**Note**: The rank of a tensor is not the same as the rank of a matrix. The -rank of a tensor is the number of indices required to uniquely select each -element of the tensor. Rank is also known as "order", "degree", or "ndims." - -##### Args: - - -* `input`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `int32`. - -@compatibility(numpy) -Equivalent to np.ndim -@end_compatibility - - -- - - - -### `tf.reshape(tensor, shape, name=None)` {#reshape} - -Reshapes a tensor. - -Given `tensor`, this operation returns a tensor that has the same values -as `tensor` with shape `shape`. - -If one component of `shape` is the special value -1, the size of that dimension -is computed so that the total size remains constant. In particular, a `shape` -of `[-1]` flattens into 1-D. At most one component of `shape` can be -1. - -If `shape` is 1-D or higher, then the operation returns a tensor with shape -`shape` filled with the values of `tensor`. In this case, the number of elements -implied by `shape` must be the same as the number of elements in `tensor`. - -For example: - -```prettyprint -# tensor 't' is [1, 2, 3, 4, 5, 6, 7, 8, 9] -# tensor 't' has shape [9] -reshape(t, [3, 3]) ==> [[1, 2, 3], - [4, 5, 6], - [7, 8, 9]] - -# tensor 't' is [[[1, 1], [2, 2]], -# [[3, 3], [4, 4]]] -# tensor 't' has shape [2, 2, 2] -reshape(t, [2, 4]) ==> [[1, 1, 2, 2], - [3, 3, 4, 4]] - -# tensor 't' is [[[1, 1, 1], -# [2, 2, 2]], -# [[3, 3, 3], -# [4, 4, 4]], -# [[5, 5, 5], -# [6, 6, 6]]] -# tensor 't' has shape [3, 2, 3] -# pass '[-1]' to flatten 't' -reshape(t, [-1]) ==> [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6] - -# -1 can also be used to infer the shape - -# -1 is inferred to be 9: -reshape(t, [2, -1]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3], - [4, 4, 4, 5, 5, 5, 6, 6, 6]] -# -1 is inferred to be 2: -reshape(t, [-1, 9]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3], - [4, 4, 4, 5, 5, 5, 6, 6, 6]] -# -1 is inferred to be 3: -reshape(t, [ 2, -1, 3]) ==> [[[1, 1, 1], - [2, 2, 2], - [3, 3, 3]], - [[4, 4, 4], - [5, 5, 5], - [6, 6, 6]]] - -# tensor 't' is [7] -# shape `[]` reshapes to a scalar -reshape(t, []) ==> 7 -``` - -##### Args: - - -* `tensor`: A `Tensor`. -* `shape`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - Defines the shape of the output tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `tensor`. - - -- - - - -### `tf.squeeze(input, axis=None, name=None, squeeze_dims=None)` {#squeeze} - -Removes dimensions of size 1 from the shape of a tensor. - -Given a tensor `input`, this operation returns a tensor of the same type with -all dimensions of size 1 removed. If you don't want to remove all size 1 -dimensions, you can remove specific size 1 dimensions by specifying -`axis`. - -For example: - -```prettyprint -# 't' is a tensor of shape [1, 2, 1, 3, 1, 1] -shape(squeeze(t)) ==> [2, 3] -``` - -Or, to remove specific size 1 dimensions: - -```prettyprint -# 't' is a tensor of shape [1, 2, 1, 3, 1, 1] -shape(squeeze(t, [2, 4])) ==> [1, 2, 3, 1] -``` - -##### Args: - - -* `input`: A `Tensor`. The `input` to squeeze. -* `axis`: An optional list of `ints`. Defaults to `[]`. - If specified, only squeezes the dimensions listed. The dimension - index starts at 0. It is an error to squeeze a dimension that is not 1. -* `name`: A name for the operation (optional). -* `squeeze_dims`: Deprecated keyword argument that is now axis. - -##### Returns: - - A `Tensor`. Has the same type as `input`. - Contains the same data as `input`, but has one or more dimensions of - size 1 removed. - -##### Raises: - - -* `ValueError`: When both `squeeze_dims` and `axis` are specified. - - -- - - - -### `tf.expand_dims(input, axis=None, name=None, dim=None)` {#expand_dims} - -Inserts a dimension of 1 into a tensor's shape. - -Given a tensor `input`, this operation inserts a dimension of 1 at the -dimension index `axis` of `input`'s shape. The dimension index `axis` starts -at zero; if you specify a negative number for `axis` it is counted backward -from the end. - -This operation is useful if you want to add a batch dimension to a single -element. For example, if you have a single image of shape `[height, width, -channels]`, you can make it a batch of 1 image with `expand_dims(image, 0)`, -which will make the shape `[1, height, width, channels]`. - -Other examples: - -```python -# 't' is a tensor of shape [2] -shape(expand_dims(t, 0)) ==> [1, 2] -shape(expand_dims(t, 1)) ==> [2, 1] -shape(expand_dims(t, -1)) ==> [2, 1] - -# 't2' is a tensor of shape [2, 3, 5] -shape(expand_dims(t2, 0)) ==> [1, 2, 3, 5] -shape(expand_dims(t2, 2)) ==> [2, 3, 1, 5] -shape(expand_dims(t2, 3)) ==> [2, 3, 5, 1] -``` - -This operation requires that: - -`-1-input.dims() <= dim <= input.dims()` - -This operation is related to `squeeze()`, which removes dimensions of -size 1. - -##### Args: - - -* `input`: A `Tensor`. -* `axis`: 0-D (scalar). Specifies the dimension index at which to - expand the shape of `input`. -* `name`: The name of the output `Tensor`. -* `dim`: 0-D (scalar). Equivalent to `axis`, to be deprecated. - -##### Returns: - - A `Tensor` with the same data as `input`, but its shape has an additional - dimension of size 1 added. - -##### Raises: - - -* `ValueError`: if both `dim` and `axis` are specified. - - -- - - - -### `tf.meshgrid(*args, **kwargs)` {#meshgrid} - -Broadcasts parameters for evaluation on an N-D grid. - -Given N one-dimensional coordinate arrays `*args`, returns a list `outputs` -of N-D coordinate arrays for evaluating expressions on an N-D grid. - -Notes: - -`meshgrid` supports cartesian ('xy') and matrix ('ij') indexing conventions. -When the `indexing` argument is set to 'xy' (the default), the broadcasting -instructions for the first two dimensions are swapped. - -Examples: - -Calling `X, Y = meshgrid(x, y)` with the tensors - -```prettyprint - x = [1, 2, 3] - y = [4, 5, 6] -``` - -results in - -```prettyprint - X = [[1, 1, 1], - [2, 2, 2], - [3, 3, 3]] - Y = [[4, 5, 6], - [4, 5, 6], - [4, 5, 6]] -``` - -##### Args: - - -* `*args`: `Tensor`s with rank 1 -* `indexing`: Either 'xy' or 'ij' (optional, default: 'xy') -* `name`: A name for the operation (optional). - -##### Returns: - - -* `outputs`: A list of N `Tensor`s with rank N - - - -## Slicing and Joining - -TensorFlow provides several operations to slice or extract parts of a tensor, -or join multiple tensors together. - -- - - - -### `tf.slice(input_, begin, size, name=None)` {#slice} - -Extracts a slice from a tensor. - -This operation extracts a slice of size `size` from a tensor `input` starting -at the location specified by `begin`. The slice `size` is represented as a -tensor shape, where `size[i]` is the number of elements of the 'i'th dimension -of `input` that you want to slice. The starting location (`begin`) for the -slice is represented as an offset in each dimension of `input`. In other -words, `begin[i]` is the offset into the 'i'th dimension of `input` that you -want to slice from. - -`begin` is zero-based; `size` is one-based. If `size[i]` is -1, -all remaining elements in dimension i are included in the -slice. In other words, this is equivalent to setting: - -`size[i] = input.dim_size(i) - begin[i]` - -This operation requires that: - -`0 <= begin[i] <= begin[i] + size[i] <= Di for i in [0, n]` - -For example: - -```python -# 'input' is [[[1, 1, 1], [2, 2, 2]], -# [[3, 3, 3], [4, 4, 4]], -# [[5, 5, 5], [6, 6, 6]]] -tf.slice(input, [1, 0, 0], [1, 1, 3]) ==> [[[3, 3, 3]]] -tf.slice(input, [1, 0, 0], [1, 2, 3]) ==> [[[3, 3, 3], - [4, 4, 4]]] -tf.slice(input, [1, 0, 0], [2, 1, 3]) ==> [[[3, 3, 3]], - [[5, 5, 5]]] -``` - -##### Args: - - -* `input_`: A `Tensor`. -* `begin`: An `int32` or `int64` `Tensor`. -* `size`: An `int32` or `int64` `Tensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` the same type as `input`. - - -- - - - -### `tf.strided_slice(input_, begin, end, strides=None, begin_mask=0, end_mask=0, ellipsis_mask=0, new_axis_mask=0, shrink_axis_mask=0, var=None, name=None)` {#strided_slice} - -Extracts a strided slice from a tensor. - -To a first order, this operation extracts a slice of size `end - begin` -from a tensor `input` -starting at the location specified by `begin`. The slice continues by adding -`stride` to the `begin` index until all dimensions are not less than `end`. -Note that components of stride can be negative, which causes a reverse -slice. - -This operation can be thought of an encoding of a numpy style sliced -range. Given a python slice input[, , ..., ] -this function will be called as follows. - -`begin`, `end`, and `strides` will be all length n. n is in general -not the same dimensionality as `input`. - -For the ith spec, -`begin_mask`, `end_mask`, `ellipsis_mask`, `new_axis_mask`, -and `shrink_axis_mask` will have the ith bit corresponding to -the ith spec. - -If the ith bit of `begin_mask` is non-zero, `begin[i]` is ignored and -the fullest possible range in that dimension is used instead. -`end_mask` works analogously, except with the end range. - -`foo[5:,:,:3]` on a 7x8x9 tensor is equivalent to `foo[5:7,0:8,0:3]`. -`foo[::-1]` reverses a tensor with shape 8. - - -If the ith bit of `ellipsis_mask`, as many unspecified dimensions -as needed will be inserted between other dimensions. Only one -non-zero bit is allowed in `ellipsis_mask`. - -For example `foo[3:5,...,4:5]` on a shape 10x3x3x10 tensor is -equivalent to `foo[3:5,:,:,4:5]` and -`foo[3:5,...]` is equivalent to `foo[3:5,:,:,:]`. - -If the ith bit of `new_axis_mask` is one, then a `begin`, -`end`, and `stride` are ignored and a new length 1 dimension is -added at this point in the output tensor. - -For example `foo[3:5,4]` on a 10x8 tensor produces a shape 2 tensor -whereas `foo[3:5,4:5]` produces a shape 2x1 tensor with shrink_mask -being 1<<1 == 2. - -If the ith bit of `shrink_axis_mask` is one, then `begin`, -`end[i]`, and `stride[i]` are used to do a slice in the appropriate -dimension, but the output tensor will be reduced in dimensionality -by one. This is only valid if the ith entry of slice[i]==1. - -NOTE: `begin` and `end` are zero-indexed`. -`strides` entries must be non-zero. - - -```python -# 'input' is [[[1, 1, 1], [2, 2, 2]], -# [[3, 3, 3], [4, 4, 4]], -# [[5, 5, 5], [6, 6, 6]]] -tf.strided_slice(input, [1, 0, 0], [2, 1, 3], [1, 1, 1]) ==> [[[3, 3, 3]]] -tf.strided_slice(input, [1, 0, 0], [2, 2, 3], [1, 1, 1]) ==> [[[3, 3, 3], - [4, 4, 4]]] -tf.strided_slice(input, [1, 1, 0], [2, -1, 3], [1, -1, 1]) ==>[[[4, 4, 4], - [3, 3, 3]]] -``` - -##### Args: - - -* `input_`: A `Tensor`. -* `begin`: An `int32` or `int64` `Tensor`. -* `end`: An `int32` or `int64` `Tensor`. -* `strides`: An `int32` or `int64` `Tensor`. -* `begin_mask`: An `int32` mask. -* `end_mask`: An `int32` mask. -* `ellipsis_mask`: An `int32` mask. -* `new_axis_mask`: An `int32` mask. -* `shrink_axis_mask`: An `int32` mask. -* `var`: The variable corresponding to `input_` or None -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` the same type as `input`. - - -- - - - -### `tf.split(value, num_or_size_splits, axis=0, num=None, name='split')` {#split} - -Splits a tensor into sub tensors. - -If `num_or_size_splits` is a scalar, `num_split`, then splits `value` along -dimension `axis` into `num_split` smaller tensors. -Requires that `num_split` evenly divides `value.shape[axis]`. - -If `num_or_size_splits` is a tensor, `size_splits`, then splits `value` into -`len(size_splits)` pieces. The shape of the `i`-th piece has the same size as -the `value` except along dimension `axis` where the size is `size_splits[i]`. - -For example: - -```python -# 'value' is a tensor with shape [5, 30] -# Split 'value' into 3 tensors with sizes [4, 15, 11] along dimension 1 -split0, split1, split2 = tf.split(value, [4, 15, 11], 1) -tf.shape(split0) ==> [5, 4] -tf.shape(split1) ==> [5, 15] -tf.shape(split2) ==> [5, 11] -# Split 'value' into 3 tensors along dimension 1 -split0, split1, split2 = tf.split(value, num_or_size_splits=3, axis=1) -tf.shape(split0) ==> [5, 10] -``` - -##### Args: - - -* `value`: The `Tensor` to split. -* `num_or_size_splits`: Either an integer indicating the number of splits along - split_dim or a 1-D Tensor containing the sizes of each output tensor - along split_dim. If an integer then it must evenly divide - `value.shape[axis]`; otherwise the sum of sizes along the split - dimension must match that of the `value`. -* `axis`: A 0-D `int32` `Tensor`. The dimension along which to split. - Must be in the range `[0, rank(value))`. Defaults to 0. -* `num`: Optional, used to specify the number of outputs when it cannot be - inferred from the shape of `size_splits`. -* `name`: A name for the operation (optional). - -##### Returns: - - if `num_or_size_splits` is a scalar returns `num_or_size_splits` `Tensor` - objects; if `num_or_size_splits` is a 1-D Tensor returns - `num_or_size_splits.get_shape[0]` `Tensor` objects resulting from splitting - `value`. - -##### Raises: - - -* `ValueError`: If `num` is unspecified and cannot be inferred. - - -- - - - -### `tf.tile(input, multiples, name=None)` {#tile} - -Constructs a tensor by tiling a given tensor. - -This operation creates a new tensor by replicating `input` `multiples` times. -The output tensor's i'th dimension has `input.dims(i) * multiples[i]` elements, -and the values of `input` are replicated `multiples[i]` times along the 'i'th -dimension. For example, tiling `[a b c d]` by `[2]` produces -`[a b c d a b c d]`. - -##### Args: - - -* `input`: A `Tensor`. 1-D or higher. -* `multiples`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 1-D. Length must be the same as the number of dimensions in `input` -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - - -- - - - -### `tf.pad(tensor, paddings, mode='CONSTANT', name=None)` {#pad} - -Pads a tensor. - -This operation pads a `tensor` according to the `paddings` you specify. -`paddings` is an integer tensor with shape `[n, 2]`, where n is the rank of -`tensor`. For each dimension D of `input`, `paddings[D, 0]` indicates how -many values to add before the contents of `tensor` in that dimension, and -`paddings[D, 1]` indicates how many values to add after the contents of -`tensor` in that dimension. If `mode` is "REFLECT" then both `paddings[D, 0]` -and `paddings[D, 1]` must be no greater than `tensor.dim_size(D) - 1`. If -`mode` is "SYMMETRIC" then both `paddings[D, 0]` and `paddings[D, 1]` must be -no greater than `tensor.dim_size(D)`. - -The padded size of each dimension D of the output is: - -`paddings[D, 0] + tensor.dim_size(D) + paddings[D, 1]` - -For example: - -```python -# 't' is [[1, 2, 3], [4, 5, 6]]. -# 'paddings' is [[1, 1,], [2, 2]]. -# rank of 't' is 2. -pad(t, paddings, "CONSTANT") ==> [[0, 0, 0, 0, 0, 0, 0], - [0, 0, 1, 2, 3, 0, 0], - [0, 0, 4, 5, 6, 0, 0], - [0, 0, 0, 0, 0, 0, 0]] - -pad(t, paddings, "REFLECT") ==> [[6, 5, 4, 5, 6, 5, 4], - [3, 2, 1, 2, 3, 2, 1], - [6, 5, 4, 5, 6, 5, 4], - [3, 2, 1, 2, 3, 2, 1]] - -pad(t, paddings, "SYMMETRIC") ==> [[2, 1, 1, 2, 3, 3, 2], - [2, 1, 1, 2, 3, 3, 2], - [5, 4, 4, 5, 6, 6, 5], - [5, 4, 4, 5, 6, 6, 5]] -``` - -##### Args: - - -* `tensor`: A `Tensor`. -* `paddings`: A `Tensor` of type `int32`. -* `mode`: One of "CONSTANT", "REFLECT", or "SYMMETRIC" (case-insensitive) -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `tensor`. - -##### Raises: - - -* `ValueError`: When mode is not one of "CONSTANT", "REFLECT", or "SYMMETRIC". - - -- - - - -### `tf.concat(values, axis, name='concat')` {#concat} - -Concatenates tensors along one dimension. - -Concatenates the list of tensors `values` along dimension `axis`. If -`values[i].shape = [D0, D1, ... Daxis(i), ...Dn]`, the concatenated -result has shape - - [D0, D1, ... Raxis, ...Dn] - -where - - Raxis = sum(Daxis(i)) - -That is, the data from the input tensors is joined along the `axis` -dimension. - -The number of dimensions of the input tensors must match, and all dimensions -except `axis` must be equal. - -For example: - -```python -t1 = [[1, 2, 3], [4, 5, 6]] -t2 = [[7, 8, 9], [10, 11, 12]] -tf.concat([t1, t2], 0) ==> [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] -tf.concat([t1, t2], 1) ==> [[1, 2, 3, 7, 8, 9], [4, 5, 6, 10, 11, 12]] - -# tensor t3 with shape [2, 3] -# tensor t4 with shape [2, 3] -tf.shape(tf.concat([t3, t4], 0)) ==> [4, 3] -tf.shape(tf.concat([t3, t4], 1)) ==> [2, 6] -``` - -Note: If you are concatenating along a new axis consider using stack. -E.g. - -```python -tf.concat([tf.expand_dims(t, axis) for t in tensors], axis) -``` - -can be rewritten as - -```python -tf.stack(tensors, axis=axis) -``` - -##### Args: - - -* `values`: A list of `Tensor` objects or a single `Tensor`. -* `axis`: 0-D `int32` `Tensor`. Dimension along which to concatenate. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` resulting from concatenation of the input tensors. - - -- - - - -### `tf.stack(values, axis=0, name='stack')` {#stack} - -Stacks a list of rank-`R` tensors into one rank-`(R+1)` tensor. - -Packs the list of tensors in `values` into a tensor with rank one higher than -each tensor in `values`, by packing them along the `axis` dimension. -Given a list of length `N` of tensors of shape `(A, B, C)`; - -if `axis == 0` then the `output` tensor will have the shape `(N, A, B, C)`. -if `axis == 1` then the `output` tensor will have the shape `(A, N, B, C)`. -Etc. - -For example: - -```prettyprint -# 'x' is [1, 4] -# 'y' is [2, 5] -# 'z' is [3, 6] -stack([x, y, z]) => [[1, 4], [2, 5], [3, 6]] # Pack along first dim. -stack([x, y, z], axis=1) => [[1, 2, 3], [4, 5, 6]] -``` - -This is the opposite of unstack. The numpy equivalent is - - tf.stack([x, y, z]) = np.asarray([x, y, z]) - -##### Args: - - -* `values`: A list of `Tensor` objects with the same shape and type. -* `axis`: An `int`. The axis to stack along. Defaults to the first dimension. - Supports negative indexes. -* `name`: A name for this operation (optional). - -##### Returns: - - -* `output`: A stacked `Tensor` with the same type as `values`. - -##### Raises: - - -* `ValueError`: If `axis` is out of the range [-(R+1), R+1). - - -- - - - -### `tf.parallel_stack(values, name='parallel_stack')` {#parallel_stack} - -Stacks a list of rank-`R` tensors into one rank-`(R+1)` tensor in parallel. - -Requires that the shape of inputs be known at graph construction time. - -Packs the list of tensors in `values` into a tensor with rank one higher than -each tensor in `values`, by packing them along the first dimension. -Given a list of length `N` of tensors of shape `(A, B, C)`; the `output` -tensor will have the shape `(N, A, B, C)`. - -For example: - -```prettyprint -# 'x' is [1, 4] -# 'y' is [2, 5] -# 'z' is [3, 6] -parallel_stack([x, y, z]) => [[1, 4], [2, 5], [3, 6]] -``` - -The difference between stack and parallel_stack is that stack requires all -of the inputs be computed before the operation will begin but doesn't require -that the input shapes be known during graph construction. Parallel stack -will copy pieces of the input into the output as they become available, in -some situations this can provide a performance benefit. - -This is the opposite of unstack. The numpy equivalent is - - tf.parallel_stack([x, y, z]) = np.asarray([x, y, z]) - -##### Args: - - -* `values`: A list of `Tensor` objects with the same shape and type. -* `name`: A name for this operation (optional). - -##### Returns: - - -* `output`: A stacked `Tensor` with the same type as `values`. - - -- - - - -### `tf.unstack(value, num=None, axis=0, name='unstack')` {#unstack} - -Unpacks the given dimension of a rank-`R` tensor into rank-`(R-1)` tensors. - -Unpacks `num` tensors from `value` by chipping it along the `axis` dimension. -If `num` is not specified (the default), it is inferred from `value`'s shape. -If `value.shape[axis]` is not known, `ValueError` is raised. - -For example, given a tensor of shape `(A, B, C, D)`; - -If `axis == 0` then the i'th tensor in `output` is the slice - `value[i, :, :, :]` and each tensor in `output` will have shape `(B, C, D)`. - (Note that the dimension unpacked along is gone, unlike `split`). - -If `axis == 1` then the i'th tensor in `output` is the slice - `value[:, i, :, :]` and each tensor in `output` will have shape `(A, C, D)`. -Etc. - -This is the opposite of pack. The numpy equivalent is - - tf.unstack(x, n) = list(x) - -##### Args: - - -* `value`: A rank `R > 0` `Tensor` to be unstacked. -* `num`: An `int`. The length of the dimension `axis`. Automatically inferred - if `None` (the default). -* `axis`: An `int`. The axis to unstack along. Defaults to the first - dimension. Supports negative indexes. -* `name`: A name for the operation (optional). - -##### Returns: - - The list of `Tensor` objects unstacked from `value`. - -##### Raises: - - -* `ValueError`: If `num` is unspecified and cannot be inferred. -* `ValueError`: If `axis` is out of the range [-R, R). - - -- - - - -### `tf.reverse_sequence(input, seq_lengths, seq_axis=None, batch_axis=None, name=None, seq_dim=None, batch_dim=None)` {#reverse_sequence} - -Reverses variable length slices. - -This op first slices `input` along the dimension `batch_axis`, and for each -slice `i`, reverses the first `seq_lengths[i]` elements along -the dimension `seq_axis`. - -The elements of `seq_lengths` must obey `seq_lengths[i] <= input.dims[seq_dim]`, -and `seq_lengths` must be a vector of length `input.dims[batch_dim]`. - -The output slice `i` along dimension `batch_axis` is then given by input -slice `i`, with the first `seq_lengths[i]` slices along dimension -`seq_axis` reversed. - -For example: - -```prettyprint -# Given this: -batch_dim = 0 -seq_dim = 1 -input.dims = (4, 8, ...) -seq_lengths = [7, 2, 3, 5] - -# then slices of input are reversed on seq_dim, but only up to seq_lengths: -output[0, 0:7, :, ...] = input[0, 7:0:-1, :, ...] -output[1, 0:2, :, ...] = input[1, 2:0:-1, :, ...] -output[2, 0:3, :, ...] = input[2, 3:0:-1, :, ...] -output[3, 0:5, :, ...] = input[3, 5:0:-1, :, ...] - -# while entries past seq_lens are copied through: -output[0, 7:, :, ...] = input[0, 7:, :, ...] -output[1, 2:, :, ...] = input[1, 2:, :, ...] -output[2, 3:, :, ...] = input[2, 3:, :, ...] -output[3, 2:, :, ...] = input[3, 2:, :, ...] -``` - -In contrast, if: - -```prettyprint -# Given this: -batch_dim = 2 -seq_dim = 0 -input.dims = (8, ?, 4, ...) -seq_lengths = [7, 2, 3, 5] - -# then slices of input are reversed on seq_dim, but only up to seq_lengths: -output[0:7, :, 0, :, ...] = input[7:0:-1, :, 0, :, ...] -output[0:2, :, 1, :, ...] = input[2:0:-1, :, 1, :, ...] -output[0:3, :, 2, :, ...] = input[3:0:-1, :, 2, :, ...] -output[0:5, :, 3, :, ...] = input[5:0:-1, :, 3, :, ...] - -# while entries past seq_lens are copied through: -output[7:, :, 0, :, ...] = input[7:, :, 0, :, ...] -output[2:, :, 1, :, ...] = input[2:, :, 1, :, ...] -output[3:, :, 2, :, ...] = input[3:, :, 2, :, ...] -output[2:, :, 3, :, ...] = input[2:, :, 3, :, ...] -``` - -##### Args: - - -* `input`: A `Tensor`. The input to reverse. -* `seq_lengths`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 1-D with length `input.dims(batch_dim)` and - `max(seq_lengths) <= input.dims(seq_dim)` -* `seq_axis`: An `int`. The dimension which is partially reversed. -* `batch_axis`: An optional `int`. Defaults to `0`. - The dimension along which reversal is performed. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - The partially reversed input. It has the same shape as `input`. - - -- - - - -### `tf.reverse(tensor, axis, name=None)` {#reverse} - -Reverses specific dimensions of a tensor. - -NOTE `tf.reverse` has now changed behavior in preparation for 1.0. -`tf.reverse_v2` is currently an alias that will be deprecated before TF 1.0. - -Given a `tensor`, and a `int32` tensor `axis` representing the set of -dimensions of `tensor` to reverse. This operation reverses each dimension -`i` for which there exists `j` s.t. `axis[j] == i`. - -`tensor` can have up to 8 dimensions. The number of dimensions specified -in `axis` may be 0 or more entries. If an index is specified more than -once, a InvalidArgument error is raised. - -For example: - -```prettyprint -# tensor 't' is [[[[ 0, 1, 2, 3], -# [ 4, 5, 6, 7], -# [ 8, 9, 10, 11]], -# [[12, 13, 14, 15], -# [16, 17, 18, 19], -# [20, 21, 22, 23]]]] -# tensor 't' shape is [1, 2, 3, 4] - -# 'dims' is [3] or 'dims' is -1 -reverse(t, dims) ==> [[[[ 3, 2, 1, 0], - [ 7, 6, 5, 4], - [ 11, 10, 9, 8]], - [[15, 14, 13, 12], - [19, 18, 17, 16], - [23, 22, 21, 20]]]] - -# 'dims' is '[1]' (or 'dims' is '[-3]') -reverse(t, dims) ==> [[[[12, 13, 14, 15], - [16, 17, 18, 19], - [20, 21, 22, 23] - [[ 0, 1, 2, 3], - [ 4, 5, 6, 7], - [ 8, 9, 10, 11]]]] - -# 'dims' is '[2]' (or 'dims' is '[-2]') -reverse(t, dims) ==> [[[[8, 9, 10, 11], - [4, 5, 6, 7], - [0, 1, 2, 3]] - [[20, 21, 22, 23], - [16, 17, 18, 19], - [12, 13, 14, 15]]]] -``` - -##### Args: - - -* `tensor`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int32`, `int64`, `bool`, `half`, `float32`, `float64`, `complex64`, `complex128`. - Up to 8-D. -* `axis`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 1-D. The indices of the dimensions to reverse. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `tensor`. The same shape as `tensor`. - - -- - - - -### `tf.reverse_v2(tensor, axis, name=None)` {#reverse_v2} - -Reverses specific dimensions of a tensor. - -NOTE `tf.reverse` has now changed behavior in preparation for 1.0. -`tf.reverse_v2` is currently an alias that will be deprecated before TF 1.0. - -Given a `tensor`, and a `int32` tensor `axis` representing the set of -dimensions of `tensor` to reverse. This operation reverses each dimension -`i` for which there exists `j` s.t. `axis[j] == i`. - -`tensor` can have up to 8 dimensions. The number of dimensions specified -in `axis` may be 0 or more entries. If an index is specified more than -once, a InvalidArgument error is raised. - -For example: - -```prettyprint -# tensor 't' is [[[[ 0, 1, 2, 3], -# [ 4, 5, 6, 7], -# [ 8, 9, 10, 11]], -# [[12, 13, 14, 15], -# [16, 17, 18, 19], -# [20, 21, 22, 23]]]] -# tensor 't' shape is [1, 2, 3, 4] - -# 'dims' is [3] or 'dims' is -1 -reverse(t, dims) ==> [[[[ 3, 2, 1, 0], - [ 7, 6, 5, 4], - [ 11, 10, 9, 8]], - [[15, 14, 13, 12], - [19, 18, 17, 16], - [23, 22, 21, 20]]]] - -# 'dims' is '[1]' (or 'dims' is '[-3]') -reverse(t, dims) ==> [[[[12, 13, 14, 15], - [16, 17, 18, 19], - [20, 21, 22, 23] - [[ 0, 1, 2, 3], - [ 4, 5, 6, 7], - [ 8, 9, 10, 11]]]] - -# 'dims' is '[2]' (or 'dims' is '[-2]') -reverse(t, dims) ==> [[[[8, 9, 10, 11], - [4, 5, 6, 7], - [0, 1, 2, 3]] - [[20, 21, 22, 23], - [16, 17, 18, 19], - [12, 13, 14, 15]]]] -``` - -##### Args: - - -* `tensor`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int32`, `int64`, `bool`, `half`, `float32`, `float64`, `complex64`, `complex128`. - Up to 8-D. -* `axis`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 1-D. The indices of the dimensions to reverse. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `tensor`. The same shape as `tensor`. - - -- - - - -### `tf.transpose(a, perm=None, name='transpose')` {#transpose} - -Transposes `a`. Permutes the dimensions according to `perm`. - -The returned tensor's dimension i will correspond to the input dimension -`perm[i]`. If `perm` is not given, it is set to (n-1...0), where n is -the rank of the input tensor. Hence by default, this operation performs a -regular matrix transpose on 2-D input Tensors. - -For example: - -```python -# 'x' is [[1 2 3] -# [4 5 6]] -tf.transpose(x) ==> [[1 4] - [2 5] - [3 6]] - -# Equivalently -tf.transpose(x, perm=[1, 0]) ==> [[1 4] - [2 5] - [3 6]] - -# 'perm' is more useful for n-dimensional tensors, for n > 2 -# 'x' is [[[1 2 3] -# [4 5 6]] -# [[7 8 9] -# [10 11 12]]] -# Take the transpose of the matrices in dimension-0 -tf.transpose(x, perm=[0, 2, 1]) ==> [[[1 4] - [2 5] - [3 6]] - - [[7 10] - [8 11] - [9 12]]] -``` - -##### Args: - - -* `a`: A `Tensor`. -* `perm`: A permutation of the dimensions of `a`. -* `name`: A name for the operation (optional). - -##### Returns: - - A transposed `Tensor`. - - -- - - - -### `tf.extract_image_patches(images, ksizes, strides, rates, padding, name=None)` {#extract_image_patches} - -Extract `patches` from `images` and put them in the "depth" output dimension. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. - 4-D Tensor with shape `[batch, in_rows, in_cols, depth]`. -* `ksizes`: A list of `ints` that has length `>= 4`. - The size of the sliding window for each dimension of `images`. -* `strides`: A list of `ints` that has length `>= 4`. - 1-D of length 4. How far the centers of two consecutive patches are in - the images. Must be: `[1, stride_rows, stride_cols, 1]`. -* `rates`: A list of `ints` that has length `>= 4`. - 1-D of length 4. Must be: `[1, rate_rows, rate_cols, 1]`. This is the - input stride, specifying how far two consecutive patch samples are in the - input. Equivalent to extracting patches with - `patch_sizes_eff = patch_sizes + (patch_sizes - 1) * (rates - 1)`, followed by - subsampling them spatially by a factor of `rates`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. - - We specify the size-related attributes as: - - ```python - ksizes = [1, ksize_rows, ksize_cols, 1] - strides = [1, strides_rows, strides_cols, 1] - rates = [1, rates_rows, rates_cols, 1] - ``` - -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `images`. - 4-D Tensor with shape `[batch, out_rows, out_cols, ksize_rows * - ksize_cols * depth]` containing image patches with size - `ksize_rows x ksize_cols x depth` vectorized in the "depth" dimension. - - -- - - - -### `tf.space_to_batch_nd(input, block_shape, paddings, name=None)` {#space_to_batch_nd} - -SpaceToBatch for N-D tensors of type T. - -This operation divides "spatial" dimensions `[1, ..., M]` of the input into a -grid of blocks of shape `block_shape`, and interleaves these blocks with the -"batch" dimension (0) such that in the output, the spatial dimensions -`[1, ..., M]` correspond to the position within the grid, and the batch -dimension combines both the position within a spatial block and the original -batch position. Prior to division into blocks, the spatial dimensions of the -input are optionally zero padded according to `paddings`. See below for a -precise description. - -##### Args: - - -* `input`: A `Tensor`. - N-D with shape `input_shape = [batch] + spatial_shape + remaining_shape`, - where spatial_shape has `M` dimensions. -* `block_shape`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 1-D with shape `[M]`, all values must be >= 1. -* `paddings`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 2-D with shape `[M, 2]`, all values must be >= 0. - `paddings[i] = [pad_start, pad_end]` specifies the padding for input dimension - `i + 1`, which corresponds to spatial dimension `i`. It is required that - `block_shape[i]` divides `input_shape[i + 1] + pad_start + pad_end`. - - This operation is equivalent to the following steps: - - 1. Zero-pad the start and end of dimensions `[1, ..., M]` of the - input according to `paddings` to produce `padded` of shape `padded_shape`. - - 2. Reshape `padded` to `reshaped_padded` of shape: - - [batch] + - [padded_shape[1] / block_shape[0], - block_shape[0], - ..., - padded_shape[M] / block_shape[M-1], - block_shape[M-1]] + - remaining_shape - - 3. Permute dimensions of `reshaped_padded` to produce - `permuted_reshaped_padded` of shape: - - block_shape + - [batch] + - [padded_shape[1] / block_shape[0], - ..., - padded_shape[M] / block_shape[M-1]] + - remaining_shape - - 4. Reshape `permuted_reshaped_padded` to flatten `block_shape` into the batch - dimension, producing an output tensor of shape: - - [batch * prod(block_shape)] + - [padded_shape[1] / block_shape[0], - ..., - padded_shape[M] / block_shape[M-1]] + - remaining_shape - - Some examples: - - (1) For the following input of shape `[1, 2, 2, 1]`, `block_shape = [2, 2]`, and - `paddings = [[0, 0], [0, 0]]`: - - ```prettyprint - x = [[[[1], [2]], [[3], [4]]]] - ``` - - The output tensor has shape `[4, 1, 1, 1]` and value: - - ```prettyprint - [[[[1]]], [[[2]]], [[[3]]], [[[4]]]] - ``` - - (2) For the following input of shape `[1, 2, 2, 3]`, `block_shape = [2, 2]`, and - `paddings = [[0, 0], [0, 0]]`: - - ```prettyprint - x = [[[[1, 2, 3], [4, 5, 6]], - [[7, 8, 9], [10, 11, 12]]]] - ``` - - The output tensor has shape `[4, 1, 1, 3]` and value: - - ```prettyprint - [[[1, 2, 3]], [[4, 5, 6]], [[7, 8, 9]], [[10, 11, 12]]] - ``` - - (3) For the following input of shape `[1, 4, 4, 1]`, `block_shape = [2, 2]`, and - `paddings = [[0, 0], [0, 0]]`: - - ```prettyprint - x = [[[[1], [2], [3], [4]], - [[5], [6], [7], [8]], - [[9], [10], [11], [12]], - [[13], [14], [15], [16]]]] - ``` - - The output tensor has shape `[4, 2, 2, 1]` and value: - - ```prettyprint - x = [[[[1], [3]], [[9], [11]]], - [[[2], [4]], [[10], [12]]], - [[[5], [7]], [[13], [15]]], - [[[6], [8]], [[14], [16]]]] - ``` - - (4) For the following input of shape `[2, 2, 4, 1]`, block_shape = `[2, 2]`, and - paddings = `[[0, 0], [2, 0]]`: - - ```prettyprint - x = [[[[1], [2], [3], [4]], - [[5], [6], [7], [8]]], - [[[9], [10], [11], [12]], - [[13], [14], [15], [16]]]] - ``` - - The output tensor has shape `[8, 1, 3, 1]` and value: - - ```prettyprint - x = [[[[0], [1], [3]]], [[[0], [9], [11]]], - [[[0], [2], [4]]], [[[0], [10], [12]]], - [[[0], [5], [7]]], [[[0], [13], [15]]], - [[[0], [6], [8]]], [[[0], [14], [16]]]] - ``` - - Among others, this operation is useful for reducing atrous convolution into - regular convolution. - -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - - -- - - - -### `tf.space_to_batch(input, paddings, block_size, name=None)` {#space_to_batch} - -SpaceToBatch for 4-D tensors of type T. - -This is a legacy version of the more general SpaceToBatchND. - -Zero-pads and then rearranges (permutes) blocks of spatial data into batch. -More specifically, this op outputs a copy of the input tensor where values from -the `height` and `width` dimensions are moved to the `batch` dimension. After -the zero-padding, both `height` and `width` of the input must be divisible by the -block size. - -##### Args: - - -* `input`: A `Tensor`. 4-D with shape `[batch, height, width, depth]`. -* `paddings`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 2-D tensor of non-negative integers with shape `[2, 2]`. It specifies - the padding of the input with zeros across the spatial dimensions as follows: - - paddings = [[pad_top, pad_bottom], [pad_left, pad_right]] - - The effective spatial dimensions of the zero-padded input tensor will be: - - height_pad = pad_top + height + pad_bottom - width_pad = pad_left + width + pad_right - - The attr `block_size` must be greater than one. It indicates the block size. - - * Non-overlapping blocks of size `block_size x block size` in the height and - width dimensions are rearranged into the batch dimension at each location. - * The batch of the output tensor is `batch * block_size * block_size`. - * Both height_pad and width_pad must be divisible by block_size. - - The shape of the output will be: - - [batch*block_size*block_size, height_pad/block_size, width_pad/block_size, - depth] - - Some examples: - - (1) For the following input of shape `[1, 2, 2, 1]` and block_size of 2: - - ```prettyprint - x = [[[[1], [2]], [[3], [4]]]] - ``` - - The output tensor has shape `[4, 1, 1, 1]` and value: - - ```prettyprint - [[[[1]]], [[[2]]], [[[3]]], [[[4]]]] - ``` - - (2) For the following input of shape `[1, 2, 2, 3]` and block_size of 2: - - ```prettyprint - x = [[[[1, 2, 3], [4, 5, 6]], - [[7, 8, 9], [10, 11, 12]]]] - ``` - - The output tensor has shape `[4, 1, 1, 3]` and value: - - ```prettyprint - [[[1, 2, 3]], [[4, 5, 6]], [[7, 8, 9]], [[10, 11, 12]]] - ``` - - (3) For the following input of shape `[1, 4, 4, 1]` and block_size of 2: - - ```prettyprint - x = [[[[1], [2], [3], [4]], - [[5], [6], [7], [8]], - [[9], [10], [11], [12]], - [[13], [14], [15], [16]]]] - ``` - - The output tensor has shape `[4, 2, 2, 1]` and value: - - ```prettyprint - x = [[[[1], [3]], [[9], [11]]], - [[[2], [4]], [[10], [12]]], - [[[5], [7]], [[13], [15]]], - [[[6], [8]], [[14], [16]]]] - ``` - - (4) For the following input of shape `[2, 2, 4, 1]` and block_size of 2: - - ```prettyprint - x = [[[[1], [2], [3], [4]], - [[5], [6], [7], [8]]], - [[[9], [10], [11], [12]], - [[13], [14], [15], [16]]]] - ``` - - The output tensor has shape `[8, 1, 2, 1]` and value: - - ```prettyprint - x = [[[[1], [3]]], [[[9], [11]]], [[[2], [4]]], [[[10], [12]]], - [[[5], [7]]], [[[13], [15]]], [[[6], [8]]], [[[14], [16]]]] - ``` - - Among others, this operation is useful for reducing atrous convolution into - regular convolution. - -* `block_size`: An `int` that is `>= 2`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - - -- - - - -### `tf.required_space_to_batch_paddings(input_shape, block_shape, base_paddings=None, name=None)` {#required_space_to_batch_paddings} - -Calculate padding required to make block_shape divide input_shape. - -This function can be used to calculate a suitable paddings argument for use -with space_to_batch_nd and batch_to_space_nd. - -##### Args: - - -* `input_shape`: int32 Tensor of shape [N]. -* `block_shape`: int32 Tensor of shape [N]. -* `base_paddings`: Optional int32 Tensor of shape [N, 2]. Specifies the minimum - amount of padding to use. All elements must be >= 0. If not specified, - defaults to 0. -* `name`: string. Optional name prefix. - -##### Returns: - - (paddings, crops), where: - - `paddings` and `crops` are int32 Tensors of rank 2 and shape [N, 2] - -* `satisfying`: - - paddings[i, 0] = base_paddings[i, 0]. - 0 <= paddings[i, 1] - base_paddings[i, 1] < block_shape[i] - (input_shape[i] + paddings[i, 0] + paddings[i, 1]) % block_shape[i] == 0 - - crops[i, 0] = 0 - crops[i, 1] = paddings[i, 1] - base_paddings[i, 1] - - -* `Raises`: ValueError if called with incompatible shapes. - - -- - - - -### `tf.batch_to_space_nd(input, block_shape, crops, name=None)` {#batch_to_space_nd} - -BatchToSpace for N-D tensors of type T. - -This operation reshapes the "batch" dimension 0 into `M + 1` dimensions of shape -`block_shape + [batch]`, interleaves these blocks back into the grid defined by -the spatial dimensions `[1, ..., M]`, to obtain a result with the same rank as -the input. The spatial dimensions of this intermediate result are then -optionally cropped according to `crops` to produce the output. This is the -reverse of SpaceToBatch. See below for a precise description. - -##### Args: - - -* `input`: A `Tensor`. - N-D with shape `input_shape = [batch] + spatial_shape + remaining_shape`, - where spatial_shape has M dimensions. -* `block_shape`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 1-D with shape `[M]`, all values must be >= 1. -* `crops`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 2-D with shape `[M, 2]`, all values must be >= 0. - `crops[i] = [crop_start, crop_end]` specifies the amount to crop from input - dimension `i + 1`, which corresponds to spatial dimension `i`. It is - required that - `crop_start[i] + crop_end[i] <= block_shape[i] * input_shape[i + 1]`. - - This operation is equivalent to the following steps: - - 1. Reshape `input` to `reshaped` of shape: - [block_shape[0], ..., block_shape[M-1], - batch / prod(block_shape), - input_shape[1], ..., input_shape[N-1]] - - 2. Permute dimensions of `reshaped` to produce `permuted` of shape - [batch / prod(block_shape), - - input_shape[1], block_shape[0], - ..., - input_shape[M], block_shape[M-1], - - input_shape[M+1], ..., input_shape[N-1]] - - 3. Reshape `permuted` to produce `reshaped_permuted` of shape - [batch / prod(block_shape), - - input_shape[1] * block_shape[0], - ..., - input_shape[M] * block_shape[M-1], - - input_shape[M+1], - ..., - input_shape[N-1]] - - 4. Crop the start and end of dimensions `[1, ..., M]` of - `reshaped_permuted` according to `crops` to produce the output of shape: - [batch / prod(block_shape), - - input_shape[1] * block_shape[0] - crops[0,0] - crops[0,1], - ..., - input_shape[M] * block_shape[M-1] - crops[M-1,0] - crops[M-1,1], - - input_shape[M+1], ..., input_shape[N-1]] - - Some examples: - - (1) For the following input of shape `[4, 1, 1, 1]`, `block_shape = [2, 2]`, and - `crops = [[0, 0], [0, 0]]`: - - ```prettyprint - [[[[1]]], [[[2]]], [[[3]]], [[[4]]]] - ``` - - The output tensor has shape `[1, 2, 2, 1]` and value: - - ```prettyprint - x = [[[[1], [2]], [[3], [4]]]] - ``` - - (2) For the following input of shape `[4, 1, 1, 3]`, `block_shape = [2, 2]`, and - `crops = [[0, 0], [0, 0]]`: - - ```prettyprint - [[[1, 2, 3]], [[4, 5, 6]], [[7, 8, 9]], [[10, 11, 12]]] - ``` - - The output tensor has shape `[1, 2, 2, 3]` and value: - - ```prettyprint - x = [[[[1, 2, 3], [4, 5, 6]], - [[7, 8, 9], [10, 11, 12]]]] - ``` - - (3) For the following input of shape `[4, 2, 2, 1]`, `block_shape = [2, 2]`, and - `crops = [[0, 0], [0, 0]]`: - - ```prettyprint - x = [[[[1], [3]], [[9], [11]]], - [[[2], [4]], [[10], [12]]], - [[[5], [7]], [[13], [15]]], - [[[6], [8]], [[14], [16]]]] - ``` - - The output tensor has shape `[1, 4, 4, 1]` and value: - - ```prettyprint - x = [[[1], [2], [3], [4]], - [[5], [6], [7], [8]], - [[9], [10], [11], [12]], - [[13], [14], [15], [16]]] - ``` - - (4) For the following input of shape `[8, 1, 3, 1]`, `block_shape = [2, 2]`, and - `crops = [[0, 0], [2, 0]]`: - - ```prettyprint - x = [[[[0], [1], [3]]], [[[0], [9], [11]]], - [[[0], [2], [4]]], [[[0], [10], [12]]], - [[[0], [5], [7]]], [[[0], [13], [15]]], - [[[0], [6], [8]]], [[[0], [14], [16]]]] - ``` - - The output tensor has shape `[2, 2, 4, 1]` and value: - - ```prettyprint - x = [[[[1], [2], [3], [4]], - [[5], [6], [7], [8]]], - [[[9], [10], [11], [12]], - [[13], [14], [15], [16]]]] - ``` - -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - - -- - - - -### `tf.batch_to_space(input, crops, block_size, name=None)` {#batch_to_space} - -BatchToSpace for 4-D tensors of type T. - -This is a legacy version of the more general BatchToSpaceND. - -Rearranges (permutes) data from batch into blocks of spatial data, followed by -cropping. This is the reverse transformation of SpaceToBatch. More specifically, -this op outputs a copy of the input tensor where values from the `batch` -dimension are moved in spatial blocks to the `height` and `width` dimensions, -followed by cropping along the `height` and `width` dimensions. - -##### Args: - - -* `input`: A `Tensor`. 4-D tensor with shape - `[batch*block_size*block_size, height_pad/block_size, width_pad/block_size, - depth]`. Note that the batch size of the input tensor must be divisible by - `block_size * block_size`. -* `crops`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 2-D tensor of non-negative integers with shape `[2, 2]`. It specifies - how many elements to crop from the intermediate result across the spatial - dimensions as follows: - - crops = [[crop_top, crop_bottom], [crop_left, crop_right]] - -* `block_size`: An `int` that is `>= 2`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - 4-D with shape `[batch, height, width, depth]`, where: - - height = height_pad - crop_top - crop_bottom - width = width_pad - crop_left - crop_right - - The attr `block_size` must be greater than one. It indicates the block size. - - Some examples: - - (1) For the following input of shape `[4, 1, 1, 1]` and block_size of 2: - - ```prettyprint - [[[[1]]], [[[2]]], [[[3]]], [[[4]]]] - ``` - - The output tensor has shape `[1, 2, 2, 1]` and value: - - ```prettyprint - x = [[[[1], [2]], [[3], [4]]]] - ``` - - (2) For the following input of shape `[4, 1, 1, 3]` and block_size of 2: - - ```prettyprint - [[[1, 2, 3]], [[4, 5, 6]], [[7, 8, 9]], [[10, 11, 12]]] - ``` - - The output tensor has shape `[1, 2, 2, 3]` and value: - - ```prettyprint - x = [[[[1, 2, 3], [4, 5, 6]], - [[7, 8, 9], [10, 11, 12]]]] - ``` - - (3) For the following input of shape `[4, 2, 2, 1]` and block_size of 2: - - ```prettyprint - x = [[[[1], [3]], [[9], [11]]], - [[[2], [4]], [[10], [12]]], - [[[5], [7]], [[13], [15]]], - [[[6], [8]], [[14], [16]]]] - ``` - - The output tensor has shape `[1, 4, 4, 1]` and value: - - ```prettyprint - x = [[[1], [2], [3], [4]], - [[5], [6], [7], [8]], - [[9], [10], [11], [12]], - [[13], [14], [15], [16]]] - ``` - - (4) For the following input of shape `[8, 1, 2, 1]` and block_size of 2: - - ```prettyprint - x = [[[[1], [3]]], [[[9], [11]]], [[[2], [4]]], [[[10], [12]]], - [[[5], [7]]], [[[13], [15]]], [[[6], [8]]], [[[14], [16]]]] - ``` - - The output tensor has shape `[2, 2, 4, 1]` and value: - - ```prettyprint - x = [[[[1], [3]], [[5], [7]]], - [[[2], [4]], [[10], [12]]], - [[[5], [7]], [[13], [15]]], - [[[6], [8]], [[14], [16]]]] - ``` - - -- - - - -### `tf.space_to_depth(input, block_size, name=None)` {#space_to_depth} - -SpaceToDepth for tensors of type T. - -Rearranges blocks of spatial data, into depth. More specifically, -this op outputs a copy of the input tensor where values from the `height` -and `width` dimensions are moved to the `depth` dimension. -The attr `block_size` indicates the input block size and how the data is moved. - - * Non-overlapping blocks of size `block_size x block size` are rearranged - into depth at each location. - * The depth of the output tensor is `input_depth * block_size * block_size`. - * The input tensor's height and width must be divisible by block_size. - -That is, assuming the input is in the shape: -`[batch, height, width, depth]`, -the shape of the output will be: -`[batch, height/block_size, width/block_size, depth*block_size*block_size]` - -This operation requires that the input tensor be of rank 4, and that -`block_size` be >=1 and a divisor of both the input `height` and `width`. - -This operation is useful for resizing the activations between convolutions -(but keeping all data), e.g. instead of pooling. It is also useful for training -purely convolutional models. - -For example, given this input of shape `[1, 2, 2, 1]`, and block_size of 2: - -```prettyprint -x = [[[[1], [2]], - [[3], [4]]]] -``` - -This operation will output a tensor of shape `[1, 1, 1, 4]`: - -```prettyprint -[[[[1, 2, 3, 4]]]] -``` - -Here, the input has a batch of 1 and each batch element has shape `[2, 2, 1]`, -the corresponding output will have a single element (i.e. width and height are -both 1) and will have a depth of 4 channels (1 * block_size * block_size). -The output element shape is `[1, 1, 4]`. - -For an input tensor with larger depth, here of shape `[1, 2, 2, 3]`, e.g. - -```prettyprint -x = [[[[1, 2, 3], [4, 5, 6]], - [[7, 8, 9], [10, 11, 12]]]] -``` - -This operation, for block_size of 2, will return the following tensor of shape -`[1, 1, 1, 12]` - -```prettyprint -[[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]] -``` - -Similarly, for the following input of shape `[1 4 4 1]`, and a block size of 2: - -```prettyprint -x = [[[[1], [2], [5], [6]], - [[3], [4], [7], [8]], - [[9], [10], [13], [14]], - [[11], [12], [15], [16]]]] -``` - -the operator will return the following tensor of shape `[1 2 2 4]`: - -```prettyprint -x = [[[[1, 2, 3, 4], - [5, 6, 7, 8]], - [[9, 10, 11, 12], - [13, 14, 15, 16]]]] -``` - -##### Args: - - -* `input`: A `Tensor`. -* `block_size`: An `int` that is `>= 2`. The size of the spatial block. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - - -- - - - -### `tf.depth_to_space(input, block_size, name=None)` {#depth_to_space} - -DepthToSpace for tensors of type T. - -Rearranges data from depth into blocks of spatial data. -This is the reverse transformation of SpaceToDepth. More specifically, -this op outputs a copy of the input tensor where values from the `depth` -dimension are moved in spatial blocks to the `height` and `width` dimensions. -The attr `block_size` indicates the input block size and how the data is moved. - - * Chunks of data of size `block_size * block_size` from depth are rearranged - into non-overlapping blocks of size `block_size x block_size` - * The width the output tensor is `input_depth * block_size`, whereas the - height is `input_height * block_size`. - * The depth of the input tensor must be divisible by - `block_size * block_size`. - -That is, assuming the input is in the shape: -`[batch, height, width, depth]`, -the shape of the output will be: -`[batch, height*block_size, width*block_size, depth/(block_size*block_size)]` - -This operation requires that the input tensor be of rank 4, and that -`block_size` be >=1 and that `block_size * block_size` be a divisor of the -input depth. - -This operation is useful for resizing the activations between convolutions -(but keeping all data), e.g. instead of pooling. It is also useful for training -purely convolutional models. - -For example, given this input of shape `[1, 1, 1, 4]`, and a block size of 2: - -```prettyprint -x = [[[[1, 2, 3, 4]]]] - -``` - -This operation will output a tensor of shape `[1, 2, 2, 1]`: - -```prettyprint - [[[[1], [2]], - [[3], [4]]]] -``` - -Here, the input has a batch of 1 and each batch element has shape `[1, 1, 4]`, -the corresponding output will have 2x2 elements and will have a depth of -1 channel (1 = `4 / (block_size * block_size)`). -The output element shape is `[2, 2, 1]`. - -For an input tensor with larger depth, here of shape `[1, 1, 1, 12]`, e.g. - -```prettyprint -x = [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]] -``` - -This operation, for block size of 2, will return the following tensor of shape -`[1, 2, 2, 3]` - -```prettyprint - [[[[1, 2, 3], [4, 5, 6]], - [[7, 8, 9], [10, 11, 12]]]] - -``` - -Similarly, for the following input of shape `[1 2 2 4]`, and a block size of 2: - -```prettyprint -x = [[[[1, 2, 3, 4], - [5, 6, 7, 8]], - [[9, 10, 11, 12], - [13, 14, 15, 16]]]] -``` - -the operator will return the following tensor of shape `[1 4 4 1]`: - -```prettyprint -x = [[ [1], [2], [5], [6]], - [ [3], [4], [7], [8]], - [ [9], [10], [13], [14]], - [ [11], [12], [15], [16]]] - -``` - -##### Args: - - -* `input`: A `Tensor`. -* `block_size`: An `int` that is `>= 2`. - The size of the spatial block, same as in Space2Depth. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - - -- - - - -### `tf.gather(params, indices, validate_indices=None, name=None)` {#gather} - -Gather slices from `params` according to `indices`. - -`indices` must be an integer tensor of any dimension (usually 0-D or 1-D). -Produces an output tensor with shape `indices.shape + params.shape[1:]` where: - -```python - # Scalar indices - output[:, ..., :] = params[indices, :, ... :] - - # Vector indices - output[i, :, ..., :] = params[indices[i], :, ... :] - - # Higher rank indices - output[i, ..., j, :, ... :] = params[indices[i, ..., j], :, ..., :] -``` - -If `indices` is a permutation and `len(indices) == params.shape[0]` then -this operation will permute `params` accordingly. - -
- -
- -##### Args: - - -* `params`: A `Tensor`. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. -* `validate_indices`: An optional `bool`. Defaults to `True`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `params`. - - -- - - - -### `tf.gather_nd(params, indices, name=None)` {#gather_nd} - -Gather values or slices from `params` according to `indices`. - -`params` is a Tensor of rank `P` and `indices` is a Tensor of rank `Q`. - -`indices` must be integer tensor, containing indices into `params`. -It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. - -The innermost dimension of `indices` (with length `K`) corresponds to -indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th -dimension of `params`. - -Produces an output tensor with shape - -``` -[d_0, ..., d_{Q-2}, params.shape[K], ..., params.shape[P-1]]. -``` - -Some examples below. - -Simple indexing into a matrix: - -```python - indices = [[0, 0], [1, 1]] - params = [['a', 'b'], ['c', 'd']] - output = ['a', 'd'] -``` - -Slice indexing into a matrix: - -```python - indices = [[1], [0]] - params = [['a', 'b'], ['c', 'd']] - output = [['c', 'd'], ['a', 'b']] -``` - -Indexing into a 3-tensor: - -```python - indices = [[1]] - params = [[['a0', 'b0'], ['c0', 'd0']], - [['a1', 'b1'], ['c1', 'd1']]] - output = [[['a1', 'b1'], ['c1', 'd1']]] - - - indices = [[0, 1], [1, 0]] - params = [[['a0', 'b0'], ['c0', 'd0']], - [['a1', 'b1'], ['c1', 'd1']]] - output = [['c0', 'd0'], ['a1', 'b1']] - - - indices = [[0, 0, 1], [1, 0, 1]] - params = [[['a0', 'b0'], ['c0', 'd0']], - [['a1', 'b1'], ['c1', 'd1']]] - output = ['b0', 'b1'] -``` - -Batched indexing into a matrix: - -```python - indices = [[[0, 0]], [[0, 1]]] - params = [['a', 'b'], ['c', 'd']] - output = [['a'], ['b']] -``` - -Batched slice indexing into a matrix: - -```python - indices = [[[1]], [[0]]] - params = [['a', 'b'], ['c', 'd']] - output = [[['c', 'd']], [['a', 'b']]] -``` - -Batched indexing into a 3-tensor: - -```python - indices = [[[1]], [[0]]] - params = [[['a0', 'b0'], ['c0', 'd0']], - [['a1', 'b1'], ['c1', 'd1']]] - output = [[[['a1', 'b1'], ['c1', 'd1']]], - [[['a0', 'b0'], ['c0', 'd0']]]] - - indices = [[[0, 1], [1, 0]], [[0, 0], [1, 1]]] - params = [[['a0', 'b0'], ['c0', 'd0']], - [['a1', 'b1'], ['c1', 'd1']]] - output = [[['c0', 'd0'], ['a1', 'b1']], - [['a0', 'b0'], ['c1', 'd1']]] - - - indices = [[[0, 0, 1], [1, 0, 1]], [[0, 1, 1], [1, 1, 0]]] - params = [[['a0', 'b0'], ['c0', 'd0']], - [['a1', 'b1'], ['c1', 'd1']]] - output = [['b0', 'b1'], ['d0', 'c1']] -``` - -##### Args: - - -* `params`: A `Tensor`. `P-D`. The tensor from which to gather values. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - `Q-D`. Index tensor having shape `[d_0, ..., d_{Q-2}, K]`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `params`. - `(P+Q-K-1)-D`. Values from `params` gathered from indices given by - `indices`. - - -- - - - -### `tf.unique_with_counts(x, out_idx=None, name=None)` {#unique_with_counts} - -Finds unique elements in a 1-D tensor. - -This operation returns a tensor `y` containing all of the unique elements of `x` -sorted in the same order that they occur in `x`. This operation also returns a -tensor `idx` the same size as `x` that contains the index of each value of `x` -in the unique output `y`. Finally, it returns a third tensor `count` that -contains the count of each element of `y` in `x`. In other words: - -`y[idx[i]] = x[i] for i in [0, 1,...,rank(x) - 1]` - -For example: - -```prettyprint -# tensor 'x' is [1, 1, 2, 4, 4, 4, 7, 8, 8] -y, idx, count = unique_with_counts(x) -y ==> [1, 2, 4, 7, 8] -idx ==> [0, 0, 1, 2, 2, 2, 3, 4, 4] -count ==> [2, 1, 3, 1, 2] -``` - -##### Args: - - -* `x`: A `Tensor`. 1-D. -* `out_idx`: An optional `tf.DType` from: `tf.int32, tf.int64`. Defaults to `tf.int32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (y, idx, count). - -* `y`: A `Tensor`. Has the same type as `x`. 1-D. -* `idx`: A `Tensor` of type `out_idx`. 1-D. -* `count`: A `Tensor` of type `out_idx`. 1-D. - - -- - - - -### `tf.scatter_nd(indices, updates, shape, name=None)` {#scatter_nd} - -Creates a new tensor by applying sparse `updates` to individual - -values or slices within a zero tensor of the given `shape` tensor according to -indices. This operator is the inverse of the [tf.gather_nd](#gather_nd) -operator which extracts values or slices from a given tensor. - -TODO(simister): Add a link to Variable.__getitem__ documentation on slice -syntax. - -`shape` is a `TensorShape` with rank `P` and `indices` is a `Tensor` of rank -`Q`. - -`indices` must be integer tensor, containing indices into `shape`. -It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. - -The innermost dimension of `indices` (with length `K`) corresponds to -indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th -dimension of `shape`. - -`updates` is Tensor of rank `Q-1+P-K` with shape: - -``` -[d_0, ..., d_{Q-2}, shape[K], ..., shape[P-1]]. -``` - -The simplest form of scatter is to insert individual elements in a tensor by -index. For example, say we want to insert 4 scattered elements in a rank-1 -tensor with 8 elements. - -
- -
- -In Python, this scatter operation would look like this: - - indices = tf.constant([[4], [3], [1], [7]]) - updates = tf.constant([9, 10, 11, 12]) - shape = tf.constant([8]) - scatter = tf.scatter_nd(indices, updates, shape) - with tf.Session() as sess: - print sess.run(scatter) - -The resulting tensor would look like this: - - [0, 11, 0, 10, 9, 0, 0, 12] - -We can also, insert entire slices of a higher rank tensor all at once. For -example, if we wanted to insert two slices in the first dimension of a -rank-3 tensor with two matrices of new values. - -
- -
- -In Python, this scatter operation would look like this: - - indices = tf.constant([[0], [2]]) - updates = tf.constant([[[5, 5, 5, 5], [6, 6, 6, 6], - [7, 7, 7, 7], [8, 8, 8, 8]], - [[5, 5, 5, 5], [6, 6, 6, 6], - [7, 7, 7, 7], [8, 8, 8, 8]]]) - shape = tf.constant([4, 4, 4]) - scatter = tf.scatter_nd(indices, updates, shape) - with tf.Session() as sess: - print sess.run(scatter) - -The resulting tensor would look like this: - - [[[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]], - [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], - [[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]], - [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]] - -##### Args: - - -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A Tensor. Must be one of the following types: int32, int64. - A tensor of indices into ref. -* `updates`: A `Tensor`. - A Tensor. Must have the same type as tensor. A tensor of updated values - to store in ref. -* `shape`: A `Tensor`. Must have the same type as `indices`. - A vector. The shape of the resulting tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `updates`. - A new tensor with the given shape and updates applied according - to the indices. - - -- - - - -### `tf.dynamic_partition(data, partitions, num_partitions, name=None)` {#dynamic_partition} - -Partitions `data` into `num_partitions` tensors using indices from `partitions`. - -For each index tuple `js` of size `partitions.ndim`, the slice `data[js, ...]` -becomes part of `outputs[partitions[js]]`. The slices with `partitions[js] = i` -are placed in `outputs[i]` in lexicographic order of `js`, and the first -dimension of `outputs[i]` is the number of entries in `partitions` equal to `i`. -In detail, - -```python - outputs[i].shape = [sum(partitions == i)] + data.shape[partitions.ndim:] - - outputs[i] = pack([data[js, ...] for js if partitions[js] == i]) -``` - -`data.shape` must start with `partitions.shape`. - -For example: - -```python - # Scalar partitions. - partitions = 1 - num_partitions = 2 - data = [10, 20] - outputs[0] = [] # Empty with shape [0, 2] - outputs[1] = [[10, 20]] - - # Vector partitions. - partitions = [0, 0, 1, 1, 0] - num_partitions = 2 - data = [10, 20, 30, 40, 50] - outputs[0] = [10, 20, 50] - outputs[1] = [30, 40] -``` - -
- -
- -##### Args: - - -* `data`: A `Tensor`. -* `partitions`: A `Tensor` of type `int32`. - Any shape. Indices in the range `[0, num_partitions)`. -* `num_partitions`: An `int` that is `>= 1`. - The number of partitions to output. -* `name`: A name for the operation (optional). - -##### Returns: - - A list of `num_partitions` `Tensor` objects of the same type as data. - - -- - - - -### `tf.dynamic_stitch(indices, data, name=None)` {#dynamic_stitch} - -Interleave the values from the `data` tensors into a single tensor. - -Builds a merged tensor such that - -```python - merged[indices[m][i, ..., j], ...] = data[m][i, ..., j, ...] -``` - -For example, if each `indices[m]` is scalar or vector, we have - -```python - # Scalar indices: - merged[indices[m], ...] = data[m][...] - - # Vector indices: - merged[indices[m][i], ...] = data[m][i, ...] -``` - -Each `data[i].shape` must start with the corresponding `indices[i].shape`, -and the rest of `data[i].shape` must be constant w.r.t. `i`. That is, we -must have `data[i].shape = indices[i].shape + constant`. In terms of this -`constant`, the output shape is - - merged.shape = [max(indices)] + constant - -Values are merged in order, so if an index appears in both `indices[m][i]` and -`indices[n][j]` for `(m,i) < (n,j)` the slice `data[n][j]` will appear in the -merged result. - -For example: - -```python - indices[0] = 6 - indices[1] = [4, 1] - indices[2] = [[5, 2], [0, 3]] - data[0] = [61, 62] - data[1] = [[41, 42], [11, 12]] - data[2] = [[[51, 52], [21, 22]], [[1, 2], [31, 32]]] - merged = [[1, 2], [11, 12], [21, 22], [31, 32], [41, 42], - [51, 52], [61, 62]] -``` - -
- -
- -##### Args: - - -* `indices`: A list of at least 1 `Tensor` objects of type `int32`. -* `data`: A list with the same number of `Tensor` objects as `indices` of `Tensor` objects of the same type. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - - -- - - - -### `tf.boolean_mask(tensor, mask, name='boolean_mask')` {#boolean_mask} - -Apply boolean mask to tensor. Numpy equivalent is `tensor[mask]`. - -```python -# 1-D example -tensor = [0, 1, 2, 3] -mask = np.array([True, False, True, False]) -boolean_mask(tensor, mask) ==> [0, 2] -``` - -In general, `0 < dim(mask) = K <= dim(tensor)`, and `mask`'s shape must match -the first K dimensions of `tensor`'s shape. We then have: - `boolean_mask(tensor, mask)[i, j1,...,jd] = tensor[i1,...,iK,j1,...,jd]` -where `(i1,...,iK)` is the ith `True` entry of `mask` (row-major order). - -##### Args: - - -* `tensor`: N-D tensor. -* `mask`: K-D boolean tensor, K <= N and K must be known statically. -* `name`: A name for this operation (optional). - -##### Returns: - - (N-K+1)-dimensional tensor populated by entries in `tensor` corresponding - to `True` values in `mask`. - -##### Raises: - - -* `ValueError`: If shapes do not conform. - - -* `Examples`: - -```python -# 2-D example -tensor = [[1, 2], [3, 4], [5, 6]] -mask = np.array([True, False, True]) -boolean_mask(tensor, mask) ==> [[1, 2], [5, 6]] -``` - - -- - - - -### `tf.one_hot(indices, depth, on_value=None, off_value=None, axis=None, dtype=None, name=None)` {#one_hot} - -Returns a one-hot tensor. - -The locations represented by indices in `indices` take value `on_value`, -while all other locations take value `off_value`. - -`on_value` and `off_value` must have matching data types. If `dtype` is also -provided, they must be the same data type as specified by `dtype`. - -If `on_value` is not provided, it will default to the value `1` with type -`dtype` - -If `off_value` is not provided, it will default to the value `0` with type -`dtype` - -If the input `indices` is rank `N`, the output will have rank `N+1`. The -new axis is created at dimension `axis` (default: the new axis is appended -at the end). - -If `indices` is a scalar the output shape will be a vector of length `depth` - -If `indices` is a vector of length `features`, the output shape will be: - -``` - features x depth if axis == -1 - depth x features if axis == 0 -``` - -If `indices` is a matrix (batch) with shape `[batch, features]`, the output -shape will be: - -``` - batch x features x depth if axis == -1 - batch x depth x features if axis == 1 - depth x batch x features if axis == 0 -``` - -If `dtype` is not provided, it will attempt to assume the data type of -`on_value` or `off_value`, if one or both are passed in. If none of -`on_value`, `off_value`, or `dtype` are provided, `dtype` will default to the -value `tf.float32`. - -Note: If a non-numeric data type output is desired (`tf.string`, `tf.bool`, -etc.), both `on_value` and `off_value` _must_ be provided to `one_hot`. - -Examples -========= - -Suppose that - -```python - indices = [0, 2, -1, 1] - depth = 3 - on_value = 5.0 - off_value = 0.0 - axis = -1 -``` - -Then output is `[4 x 3]`: - -```python - output = - [5.0 0.0 0.0] // one_hot(0) - [0.0 0.0 5.0] // one_hot(2) - [0.0 0.0 0.0] // one_hot(-1) - [0.0 5.0 0.0] // one_hot(1) -``` - -Suppose that - -```python - indices = [[0, 2], [1, -1]] - depth = 3 - on_value = 1.0 - off_value = 0.0 - axis = -1 -``` - -Then output is `[2 x 2 x 3]`: - -```python - output = - [ - [1.0, 0.0, 0.0] // one_hot(0) - [0.0, 0.0, 1.0] // one_hot(2) - ][ - [0.0, 1.0, 0.0] // one_hot(1) - [0.0, 0.0, 0.0] // one_hot(-1) - ] -``` - -Using default values for `on_value` and `off_value`: - -```python - indices = [0, 1, 2] - depth = 3 -``` - -The output will be - -```python - output = - [[1., 0., 0.], - [0., 1., 0.], - [0., 0., 1.]] -``` - -##### Args: - - -* `indices`: A `Tensor` of indices. -* `depth`: A scalar defining the depth of the one hot dimension. -* `on_value`: A scalar defining the value to fill in output when `indices[j] - = i`. (default: 1) -* `off_value`: A scalar defining the value to fill in output when `indices[j] - != i`. (default: 0) -* `axis`: The axis to fill (default: -1, a new inner-most axis). -* `dtype`: The data type of the output tensor. - -##### Returns: - - -* `output`: The one-hot tensor. - -##### Raises: - - -* `TypeError`: If dtype of either `on_value` or `off_value` don't match `dtype` -* `TypeError`: If dtype of `on_value` and `off_value` don't match one another - - -- - - - -### `tf.sequence_mask(lengths, maxlen=None, dtype=tf.bool, name=None)` {#sequence_mask} - -Return a mask tensor representing the first N positions of each row. - -Example: - -```python -tf.sequence_mask([1, 3, 2], 5) = - [[True, False, False, False, False], - [True, True, True, False, False], - [True, True, False, False, False]] -``` - -##### Args: - - -* `lengths`: 1D integer tensor, all its values < maxlen. -* `maxlen`: scalar integer tensor, maximum length of each row. Default: use - maximum over lengths. -* `dtype`: output type of the resulting tensor. -* `name`: name of the op. - -##### Returns: - - A 2D mask tensor, as shown in the example above, cast to specified dtype. - -##### Raises: - - -* `ValueError`: if the arguments have invalid rank. - - -- - - - -### `tf.dequantize(input, min_range, max_range, mode=None, name=None)` {#dequantize} - -Dequantize the 'input' tensor into a float Tensor. - -[min_range, max_range] are scalar floats that specify the range for -the 'input' data. The 'mode' attribute controls exactly which calculations are -used to convert the float values to their quantized equivalents. - -In 'MIN_COMBINED' mode, each value of the tensor will undergo the following: - -``` -if T == qint8, in[i] += (range(T) + 1)/ 2.0 -out[i] = min_range + (in[i]* (max_range - min_range) / range(T)) -``` -here `range(T) = numeric_limits::max() - numeric_limits::min()` - -*MIN_COMBINED Mode Example* - -If the input comes from a QuantizedRelu6, the output type is -quint8 (range of 0-255) but the possible range of QuantizedRelu6 is -0-6. The min_range and max_range values are therefore 0.0 and 6.0. -Dequantize on quint8 will take each value, cast to float, and multiply -by 6 / 255. -Note that if quantizedtype is qint8, the operation will additionally add -each value by 128 prior to casting. - -If the mode is 'MIN_FIRST', then this approach is used: - -``` -number_of_steps = 1 << (# of bits in T) -range_adjust = number_of_steps / (number_of_steps - 1) -range = (range_max - range_min) * range_adjust -range_scale = range / number_of_steps -const double offset_input = static_cast(input) - lowest_quantized; -result = range_min + ((input - numeric_limits::min()) * range_scale) -``` - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `qint8`, `quint8`, `qint16`, `quint16`, `qint32`. -* `min_range`: A `Tensor` of type `float32`. - The minimum scalar value possibly produced for the input. -* `max_range`: A `Tensor` of type `float32`. - The maximum scalar value possibly produced for the input. -* `mode`: An optional `string` from: `"MIN_COMBINED", "MIN_FIRST"`. Defaults to `"MIN_COMBINED"`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. - - -- - - - -### `tf.quantize_v2(input, min_range, max_range, T, mode=None, name=None)` {#quantize_v2} - -Quantize the 'input' tensor of type float to 'output' tensor of type 'T'. - -[min_range, max_range] are scalar floats that specify the range for -the 'input' data. The 'mode' attribute controls exactly which calculations are -used to convert the float values to their quantized equivalents. - -In 'MIN_COMBINED' mode, each value of the tensor will undergo the following: - -``` -out[i] = (in[i] - min_range) * range(T) / (max_range - min_range) -if T == qint8, out[i] -= (range(T) + 1) / 2.0 -``` -here `range(T) = numeric_limits::max() - numeric_limits::min()` - -*MIN_COMBINED Mode Example* - -Assume the input is type float and has a possible range of [0.0, 6.0] and the -output type is quint8 ([0, 255]). The min_range and max_range values should be -specified as 0.0 and 6.0. Quantizing from float to quint8 will multiply each -value of the input by 255/6 and cast to quint8. - -If the output type was qint8 ([-128, 127]), the operation will additionally -subtract each value by 128 prior to casting, so that the range of values aligns -with the range of qint8. - -If the mode is 'MIN_FIRST', then this approach is used: - -``` -number_of_steps = 1 << (# of bits in T) -range_adjust = number_of_steps / (number_of_steps - 1) -range = (range_max - range_min) * range_adjust -range_scale = number_of_steps / range -quantized = round(input * range_scale) - round(range_min * range_scale) + - numeric_limits::min() -quantized = max(quantized, numeric_limits::min()) -quantized = min(quantized, numeric_limits::max()) -``` - -The biggest difference between this and MIN_COMBINED is that the minimum range -is rounded first, before it's subtracted from the rounded value. With -MIN_COMBINED, a small bias is introduced where repeated iterations of quantizing -and dequantizing will introduce a larger and larger error. - -One thing to watch out for is that the operator may choose to adjust the -requested minimum and maximum values slightly during the quantization process, -so you should always use the output ports as the range for further calculations. -For example, if the requested minimum and maximum values are close to equal, -they will be separated by a small epsilon value to prevent ill-formed quantized -buffers from being created. Otherwise, you can end up with buffers where all the -quantized values map to the same float value, which causes problems for -operations that have to perform further calculations on them. - -##### Args: - - -* `input`: A `Tensor` of type `float32`. -* `min_range`: A `Tensor` of type `float32`. - The minimum scalar value possibly produced for the input. -* `max_range`: A `Tensor` of type `float32`. - The maximum scalar value possibly produced for the input. -* `T`: A `tf.DType` from: `tf.qint8, tf.quint8, tf.qint16, tf.quint16, tf.qint32`. -* `mode`: An optional `string` from: `"MIN_COMBINED", "MIN_FIRST"`. Defaults to `"MIN_COMBINED"`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, output_min, output_max). - -* `output`: A `Tensor` of type `T`. The quantized data produced from the float input. -* `output_min`: A `Tensor` of type `float32`. The actual minimum scalar value used for the output. -* `output_max`: A `Tensor` of type `float32`. The actual maximum scalar value used for the output. - - -- - - - -### `tf.quantized_concat(concat_dim, values, input_mins, input_maxes, name=None)` {#quantized_concat} - -Concatenates quantized tensors along one dimension. - -##### Args: - - -* `concat_dim`: A `Tensor` of type `int32`. - 0-D. The dimension along which to concatenate. Must be in the - range [0, rank(values)). -* `values`: A list of at least 2 `Tensor` objects of the same type. - The `N` Tensors to concatenate. Their ranks and types must match, - and their sizes must match in all dimensions except `concat_dim`. -* `input_mins`: A list with the same number of `Tensor` objects as `values` of `Tensor` objects of type `float32`. - The minimum scalar values for each of the input tensors. -* `input_maxes`: A list with the same number of `Tensor` objects as `values` of `Tensor` objects of type `float32`. - The maximum scalar values for each of the input tensors. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, output_min, output_max). - -* `output`: A `Tensor`. Has the same type as `values`. A `Tensor` with the concatenation of values stacked along the - `concat_dim` dimension. This tensor's shape matches that of `values` except - in `concat_dim` where it has the sum of the sizes. -* `output_min`: A `Tensor` of type `float32`. The float value that the minimum quantized output value represents. -* `output_max`: A `Tensor` of type `float32`. The float value that the maximum quantized output value represents. - - -- - - - -### `tf.setdiff1d(x, y, index_dtype=tf.int32, name=None)` {#setdiff1d} - -Computes the difference between two lists of numbers or strings. - -Given a list `x` and a list `y`, this operation returns a list `out` that -represents all values that are in `x` but not in `y`. The returned list `out` -is sorted in the same order that the numbers appear in `x` (duplicates are -preserved). This operation also returns a list `idx` that represents the -position of each `out` element in `x`. In other words: - -`out[i] = x[idx[i]] for i in [0, 1, ..., len(out) - 1]` - -For example, given this input: - -```prettyprint -x = [1, 2, 3, 4, 5, 6] -y = [1, 3, 5] -``` - -This operation would return: - -```prettyprint -out ==> [2, 4, 6] -idx ==> [1, 3, 5] -``` - -##### Args: - - -* `x`: A `Tensor`. 1-D. Values to keep. -* `y`: A `Tensor`. Must have the same type as `x`. 1-D. Values to remove. -* `out_idx`: An optional `tf.DType` from: `tf.int32, tf.int64`. Defaults to `tf.int32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (out, idx). - -* `out`: A `Tensor`. Has the same type as `x`. 1-D. Values present in `x` but not in `y`. -* `idx`: A `Tensor` of type `out_idx`. 1-D. Positions of `x` values preserved in `out`. - - - -## Fake quantization -Operations used to help train for better quantization accuracy. - -- - - - -### `tf.fake_quant_with_min_max_args(inputs, min=None, max=None, name=None)` {#fake_quant_with_min_max_args} - -Fake-quantize the 'inputs' tensor, type float to 'outputs' tensor of same type. - -Attributes [min; max] define the clamping range for the 'inputs' data. Op -divides this range into 255 steps (total of 256 values), then replaces each -'inputs' value with the closest of the quantized step values. - -Quantization is called fake since the output is still in floating point. - -##### Args: - - -* `inputs`: A `Tensor` of type `float32`. -* `min`: An optional `float`. Defaults to `-6`. -* `max`: An optional `float`. Defaults to `6`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. - - -- - - - -### `tf.fake_quant_with_min_max_args_gradient(gradients, inputs, min=None, max=None, name=None)` {#fake_quant_with_min_max_args_gradient} - -Compute gradients for a FakeQuantWithMinMaxArgs operation. - -##### Args: - - -* `gradients`: A `Tensor` of type `float32`. - Backpropagated gradients above the FakeQuantWithMinMaxArgs operation. -* `inputs`: A `Tensor` of type `float32`. - Values passed as inputs to the FakeQuantWithMinMaxArgs operation. -* `min`: An optional `float`. Defaults to `-6`. -* `max`: An optional `float`. Defaults to `6`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. - Backpropagated gradients below the FakeQuantWithMinMaxArgs operation: - `gradients * (inputs >= min && inputs <= max)`. - - -- - - - -### `tf.fake_quant_with_min_max_vars(inputs, min, max, name=None)` {#fake_quant_with_min_max_vars} - -Fake-quantize the 'inputs' tensor of type float via global float scalars `min` - -and `max` to 'outputs' tensor of same shape as `inputs`. - -[min; max] is the clamping range for the 'inputs' data. Op divides this range -into 255 steps (total of 256 values), then replaces each 'inputs' value with the -closest of the quantized step values. - -This operation has a gradient and thus allows for training `min` and `max` values. - -##### Args: - - -* `inputs`: A `Tensor` of type `float32`. -* `min`: A `Tensor` of type `float32`. -* `max`: A `Tensor` of type `float32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. - - -- - - - -### `tf.fake_quant_with_min_max_vars_gradient(gradients, inputs, min, max, name=None)` {#fake_quant_with_min_max_vars_gradient} - -Compute gradients for a FakeQuantWithMinMaxVars operation. - -##### Args: - - -* `gradients`: A `Tensor` of type `float32`. - Backpropagated gradients above the FakeQuantWithMinMaxVars operation. -* `inputs`: A `Tensor` of type `float32`. - Values passed as inputs to the FakeQuantWithMinMaxVars operation. - min, max: Quantization interval, scalar floats. -* `min`: A `Tensor` of type `float32`. -* `max`: A `Tensor` of type `float32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (backprops_wrt_input, backprop_wrt_min, backprop_wrt_max). - -* `backprops_wrt_input`: A `Tensor` of type `float32`. Backpropagated gradients w.r.t. inputs: - `gradients * (inputs >= min && inputs <= max)`. -* `backprop_wrt_min`: A `Tensor` of type `float32`. Backpropagated gradients w.r.t. min parameter: - `sum(gradients * (inputs < min))`. -* `backprop_wrt_max`: A `Tensor` of type `float32`. Backpropagated gradients w.r.t. max parameter: - `sum(gradients * (inputs > max))`. - - -- - - - -### `tf.fake_quant_with_min_max_vars_per_channel(inputs, min, max, name=None)` {#fake_quant_with_min_max_vars_per_channel} - -Fake-quantize the 'inputs' tensor of type float and one of the shapes: `[d]`, - -`[b, d]` `[b, h, w, d]` via per-channel floats `min` and `max` of shape `[d]` -to 'outputs' tensor of same shape as `inputs`. - -[min; max] is the clamping range for the 'inputs' data in the corresponding -depth channel. Op divides this range into 255 steps (total of 256 values), then -replaces each 'inputs' value with the closest of the quantized step values. - -This operation has a gradient and thus allows for training `min` and `max` values. - -##### Args: - - -* `inputs`: A `Tensor` of type `float32`. -* `min`: A `Tensor` of type `float32`. -* `max`: A `Tensor` of type `float32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. - - -- - - - -### `tf.fake_quant_with_min_max_vars_per_channel_gradient(gradients, inputs, min, max, name=None)` {#fake_quant_with_min_max_vars_per_channel_gradient} - -Compute gradients for a FakeQuantWithMinMaxVarsPerChannel operation. - -##### Args: - - -* `gradients`: A `Tensor` of type `float32`. - Backpropagated gradients above the FakeQuantWithMinMaxVars operation, - shape one of: `[d]`, `[b, d]`, `[b, h, w, d]`. -* `inputs`: A `Tensor` of type `float32`. - Values passed as inputs to the FakeQuantWithMinMaxVars operation, shape - same as `gradients`. - min, max: Quantization interval, floats of shape `[d]`. -* `min`: A `Tensor` of type `float32`. -* `max`: A `Tensor` of type `float32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (backprops_wrt_input, backprop_wrt_min, backprop_wrt_max). - -* `backprops_wrt_input`: A `Tensor` of type `float32`. Backpropagated gradients w.r.t. inputs, shape same as - `inputs`: - `gradients * (inputs >= min && inputs <= max)`. -* `backprop_wrt_min`: A `Tensor` of type `float32`. Backpropagated gradients w.r.t. min parameter, shape `[d]`: - `sum_per_d(gradients * (inputs < min))`. -* `backprop_wrt_max`: A `Tensor` of type `float32`. Backpropagated gradients w.r.t. max parameter, shape `[d]`: - `sum_per_d(gradients * (inputs > max))`. - - - -## Other Functions and Classes -- - - - -### `tf.contrib.graph_editor.copy(sgv, dst_graph=None, dst_scope='', src_scope='', reuse_dst_scope=False)` {#copy} - -Copy a subgraph. - -##### Args: - - -* `sgv`: the source subgraph-view. This argument is converted to a subgraph - using the same rules than the function subgraph.make_view. -* `dst_graph`: the destination graph. -* `dst_scope`: the destination scope. -* `src_scope`: the source scope. -* `reuse_dst_scope`: if True the dst_scope is re-used if it already exists. - Otherwise, the scope is given a unique name based on the one given - by appending an underscore followed by a digit (default). - -##### Returns: - - A tuple `(sgv, info)` where: - `sgv` is the transformed subgraph view; - `info` is an instance of TransformerInfo containing - information about the transform, including mapping between - original and transformed tensors and operations. - -##### Raises: - - -* `TypeError`: if `dst_graph` is not a `tf.Graph`. -* `StandardError`: if sgv cannot be converted to a SubGraphView using - the same rules than the function subgraph.make_view. - - diff --git a/tensorflow/g3doc/api_docs/python/check_ops.md b/tensorflow/g3doc/api_docs/python/check_ops.md deleted file mode 100644 index 9eec5e20ad..0000000000 --- a/tensorflow/g3doc/api_docs/python/check_ops.md +++ /dev/null @@ -1,510 +0,0 @@ - - -# Asserts and boolean checks. -[TOC] - -## Asserts and Boolean Checks - -- - - - -### `tf.assert_negative(x, data=None, summarize=None, message=None, name=None)` {#assert_negative} - -Assert the condition `x < 0` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_negative(x)]): - output = tf.reduce_sum(x) -``` - -Negative means, for every element `x[i]` of `x`, we have `x[i] < 0`. -If `x` is empty this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_negative". - -##### Returns: - - Op raising `InvalidArgumentError` unless `x` is all negative. - - -- - - - -### `tf.assert_positive(x, data=None, summarize=None, message=None, name=None)` {#assert_positive} - -Assert the condition `x > 0` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_positive(x)]): - output = tf.reduce_sum(x) -``` - -Positive means, for every element `x[i]` of `x`, we have `x[i] > 0`. -If `x` is empty this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_positive". - -##### Returns: - - Op raising `InvalidArgumentError` unless `x` is all positive. - - -- - - - -### `tf.assert_proper_iterable(values)` {#assert_proper_iterable} - -Static assert that values is a "proper" iterable. - -`Ops` that expect iterables of `Tensor` can call this to validate input. -Useful since `Tensor`, `ndarray`, byte/text type are all iterables themselves. - -##### Args: - - -* `values`: Object to be checked. - -##### Raises: - - -* `TypeError`: If `values` is not iterable or is one of - `Tensor`, `SparseTensor`, `np.array`, `tf.compat.bytes_or_text_types`. - - -- - - - -### `tf.assert_non_negative(x, data=None, summarize=None, message=None, name=None)` {#assert_non_negative} - -Assert the condition `x >= 0` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_non_negative(x)]): - output = tf.reduce_sum(x) -``` - -Non-negative means, for every element `x[i]` of `x`, we have `x[i] >= 0`. -If `x` is empty this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). - Defaults to "assert_non_negative". - -##### Returns: - - Op raising `InvalidArgumentError` unless `x` is all non-negative. - - -- - - - -### `tf.assert_non_positive(x, data=None, summarize=None, message=None, name=None)` {#assert_non_positive} - -Assert the condition `x <= 0` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_non_positive(x)]): - output = tf.reduce_sum(x) -``` - -Non-positive means, for every element `x[i]` of `x`, we have `x[i] <= 0`. -If `x` is empty this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). - Defaults to "assert_non_positive". - -##### Returns: - - Op raising `InvalidArgumentError` unless `x` is all non-positive. - - -- - - - -### `tf.assert_equal(x, y, data=None, summarize=None, message=None, name=None)` {#assert_equal} - -Assert the condition `x == y` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_equal(x, y)]): - output = tf.reduce_sum(x) -``` - -This condition holds if for every pair of (possibly broadcast) elements -`x[i]`, `y[i]`, we have `x[i] == y[i]`. -If both `x` and `y` are empty, this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `y`: Numeric `Tensor`, same dtype as and broadcastable to `x`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`, `y`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_equal". - -##### Returns: - - Op that raises `InvalidArgumentError` if `x == y` is False. - - -- - - - -### `tf.assert_integer(x, message=None, name=None)` {#assert_integer} - -Assert that `x` is of integer dtype. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_integer(x)]): - output = tf.reduce_sum(x) -``` - -##### Args: - - -* `x`: `Tensor` whose basetype is integer and is not quantized. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_integer". - -##### Raises: - - -* `TypeError`: If `x.dtype` is anything other than non-quantized integer. - -##### Returns: - - A `no_op` that does nothing. Type can be determined statically. - - -- - - - -### `tf.assert_less(x, y, data=None, summarize=None, message=None, name=None)` {#assert_less} - -Assert the condition `x < y` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_less(x, y)]): - output = tf.reduce_sum(x) -``` - -This condition holds if for every pair of (possibly broadcast) elements -`x[i]`, `y[i]`, we have `x[i] < y[i]`. -If both `x` and `y` are empty, this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `y`: Numeric `Tensor`, same dtype as and broadcastable to `x`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`, `y`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_less". - -##### Returns: - - Op that raises `InvalidArgumentError` if `x < y` is False. - - -- - - - -### `tf.assert_less_equal(x, y, data=None, summarize=None, message=None, name=None)` {#assert_less_equal} - -Assert the condition `x <= y` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_less_equal(x, y)]): - output = tf.reduce_sum(x) -``` - -This condition holds if for every pair of (possibly broadcast) elements -`x[i]`, `y[i]`, we have `x[i] <= y[i]`. -If both `x` and `y` are empty, this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `y`: Numeric `Tensor`, same dtype as and broadcastable to `x`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`, `y`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_less_equal" - -##### Returns: - - Op that raises `InvalidArgumentError` if `x <= y` is False. - - -- - - - -### `tf.assert_greater(x, y, data=None, summarize=None, message=None, name=None)` {#assert_greater} - -Assert the condition `x > y` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_greater(x, y)]): - output = tf.reduce_sum(x) -``` - -This condition holds if for every pair of (possibly broadcast) elements -`x[i]`, `y[i]`, we have `x[i] > y[i]`. -If both `x` and `y` are empty, this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `y`: Numeric `Tensor`, same dtype as and broadcastable to `x`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`, `y`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_greater". - -##### Returns: - - Op that raises `InvalidArgumentError` if `x > y` is False. - - -- - - - -### `tf.assert_greater_equal(x, y, data=None, summarize=None, message=None, name=None)` {#assert_greater_equal} - -Assert the condition `x >= y` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_greater_equal(x, y)]): - output = tf.reduce_sum(x) -``` - -This condition holds if for every pair of (possibly broadcast) elements -`x[i]`, `y[i]`, we have `x[i] >= y[i]`. -If both `x` and `y` are empty, this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `y`: Numeric `Tensor`, same dtype as and broadcastable to `x`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`, `y`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to - "assert_greater_equal" - -##### Returns: - - Op that raises `InvalidArgumentError` if `x >= y` is False. - - -- - - - -### `tf.assert_rank(x, rank, data=None, summarize=None, message=None, name=None)` {#assert_rank} - -Assert `x` has rank equal to `rank`. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_rank(x, 2)]): - output = tf.reduce_sum(x) -``` - -##### Args: - - -* `x`: Numeric `Tensor`. -* `rank`: Scalar integer `Tensor`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_rank". - -##### Returns: - - Op raising `InvalidArgumentError` unless `x` has specified rank. - If static checks determine `x` has correct rank, a `no_op` is returned. - -##### Raises: - - -* `ValueError`: If static checks determine `x` has wrong rank. - - -- - - - -### `tf.assert_rank_at_least(x, rank, data=None, summarize=None, message=None, name=None)` {#assert_rank_at_least} - -Assert `x` has rank equal to `rank` or higher. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_rank_at_least(x, 2)]): - output = tf.reduce_sum(x) -``` - -##### Args: - - -* `x`: Numeric `Tensor`. -* `rank`: Scalar `Tensor`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). - Defaults to "assert_rank_at_least". - -##### Returns: - - Op raising `InvalidArgumentError` unless `x` has specified rank or higher. - If static checks determine `x` has correct rank, a `no_op` is returned. - -##### Raises: - - -* `ValueError`: If static checks determine `x` has wrong rank. - - -- - - - -### `tf.assert_type(tensor, tf_type, message=None, name=None)` {#assert_type} - -Statically asserts that the given `Tensor` is of the specified type. - -##### Args: - - -* `tensor`: A tensorflow `Tensor`. -* `tf_type`: A tensorflow type (`dtypes.float32`, `tf.int64`, `dtypes.bool`, - etc). -* `message`: A string to prefix to the default message. -* `name`: A name to give this `Op`. Defaults to "assert_type" - -##### Raises: - - -* `TypeError`: If the tensors data type doesn't match `tf_type`. - -##### Returns: - - A `no_op` that does nothing. Type can be determined statically. - - -- - - - -### `tf.is_non_decreasing(x, name=None)` {#is_non_decreasing} - -Returns `True` if `x` is non-decreasing. - -Elements of `x` are compared in row-major order. The tensor `[x[0],...]` -is non-decreasing if for every adjacent pair we have `x[i] <= x[i+1]`. -If `x` has less than two elements, it is trivially non-decreasing. - -See also: `is_strictly_increasing` - -##### Args: - - -* `x`: Numeric `Tensor`. -* `name`: A name for this operation (optional). Defaults to "is_non_decreasing" - -##### Returns: - - Boolean `Tensor`, equal to `True` iff `x` is non-decreasing. - -##### Raises: - - -* `TypeError`: if `x` is not a numeric tensor. - - -- - - - -### `tf.is_numeric_tensor(tensor)` {#is_numeric_tensor} - - - - -- - - - -### `tf.is_strictly_increasing(x, name=None)` {#is_strictly_increasing} - -Returns `True` if `x` is strictly increasing. - -Elements of `x` are compared in row-major order. The tensor `[x[0],...]` -is strictly increasing if for every adjacent pair we have `x[i] < x[i+1]`. -If `x` has less than two elements, it is trivially strictly increasing. - -See also: `is_non_decreasing` - -##### Args: - - -* `x`: Numeric `Tensor`. -* `name`: A name for this operation (optional). - Defaults to "is_strictly_increasing" - -##### Returns: - - Boolean `Tensor`, equal to `True` iff `x` is strictly increasing. - -##### Raises: - - -* `TypeError`: if `x` is not a numeric tensor. - - diff --git a/tensorflow/g3doc/api_docs/python/client.md b/tensorflow/g3doc/api_docs/python/client.md deleted file mode 100644 index 19c5b269d5..0000000000 --- a/tensorflow/g3doc/api_docs/python/client.md +++ /dev/null @@ -1,1199 +0,0 @@ - - -# Running Graphs -[TOC] - -This library contains classes for launching graphs and executing operations. - -The [basic usage](../../get_started/index.md#basic-usage) guide has -examples of how a graph is launched in a [`tf.Session`](#Session). - -## Session management - -- - - - -### `class tf.Session` {#Session} - -A class for running TensorFlow operations. - -A `Session` object encapsulates the environment in which `Operation` -objects are executed, and `Tensor` objects are evaluated. For -example: - -```python -# Build a graph. -a = tf.constant(5.0) -b = tf.constant(6.0) -c = a * b - -# Launch the graph in a session. -sess = tf.Session() - -# Evaluate the tensor `c`. -print(sess.run(c)) -``` - -A session may own resources, such as -[variables](../../api_docs/python/state_ops.md#Variable), [queues](../../api_docs/python/io_ops.md#QueueBase), -and [readers](../../api_docs/python/io_ops.md#ReaderBase). It is important to release -these resources when they are no longer required. To do this, either -invoke the [`close()`](#Session.close) method on the session, or use -the session as a context manager. The following two examples are -equivalent: - -```python -# Using the `close()` method. -sess = tf.Session() -sess.run(...) -sess.close() - -# Using the context manager. -with tf.Session() as sess: - sess.run(...) -``` - -The [`ConfigProto`](https://www.tensorflow.org/code/tensorflow/core/protobuf/config.proto) -protocol buffer exposes various configuration options for a -session. For example, to create a session that uses soft constraints -for device placement, and log the resulting placement decisions, -create a session as follows: - -```python -# Launch the graph in a session that allows soft device placement and -# logs the placement decisions. -sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True, - log_device_placement=True)) -``` -- - - - -#### `tf.Session.__del__()` {#Session.__del__} - - - - -- - - - -#### `tf.Session.__enter__()` {#Session.__enter__} - - - - -- - - - -#### `tf.Session.__exit__(exec_type, exec_value, exec_tb)` {#Session.__exit__} - - - - -- - - - -#### `tf.Session.__init__(target='', graph=None, config=None)` {#Session.__init__} - -Creates a new TensorFlow session. - -If no `graph` argument is specified when constructing the session, -the default graph will be launched in the session. If you are -using more than one graph (created with `tf.Graph()` in the same -process, you will have to use different sessions for each graph, -but each graph can be used in multiple sessions. In this case, it -is often clearer to pass the graph to be launched explicitly to -the session constructor. - -##### Args: - - -* `target`: (Optional.) The execution engine to connect to. - Defaults to using an in-process engine. See - [Distributed Tensorflow](https://www.tensorflow.org/how_tos/distributed/index.html) - for more examples. -* `graph`: (Optional.) The `Graph` to be launched (described above). -* `config`: (Optional.) A [`ConfigProto`](https://www.tensorflow.org/code/tensorflow/core/protobuf/config.proto) - protocol buffer with configuration options for the session. - - -- - - - -#### `tf.Session.as_default()` {#Session.as_default} - -Returns a context manager that makes this object the default session. - -Use with the `with` keyword to specify that calls to -[`Operation.run()`](../../api_docs/python/framework.md#Operation.run) or -[`Tensor.eval()`](../../api_docs/python/framework.md#Tensor.eval) should be -executed in this session. - -```python -c = tf.constant(..) -sess = tf.Session() - -with sess.as_default(): - assert tf.get_default_session() is sess - print(c.eval()) -``` - -To get the current default session, use -[`tf.get_default_session()`](#get_default_session). - - -*N.B.* The `as_default` context manager *does not* close the -session when you exit the context, and you must close the session -explicitly. - -```python -c = tf.constant(...) -sess = tf.Session() -with sess.as_default(): - print(c.eval()) -# ... -with sess.as_default(): - print(c.eval()) - -sess.close() -``` - -Alternatively, you can use `with tf.Session():` to create a -session that is automatically closed on exiting the context, -including when an uncaught exception is raised. - -*N.B.* The default graph is a property of the current thread. If you -create a new thread, and wish to use the default session in that -thread, you must explicitly add a `with sess.as_default():` in that -thread's function. - -##### Returns: - - A context manager using this session as the default session. - - -- - - - -#### `tf.Session.close()` {#Session.close} - -Closes this session. - -Calling this method frees all resources associated with the session. - -##### Raises: - - tf.errors.OpError: Or one of its subclasses if an error occurs while - closing the TensorFlow session. - - -- - - - -#### `tf.Session.graph` {#Session.graph} - -The graph that was launched in this session. - - -- - - - -#### `tf.Session.graph_def` {#Session.graph_def} - -A serializable version of the underlying TensorFlow graph. - -##### Returns: - - A graph_pb2.GraphDef proto containing nodes for all of the Operations in - the underlying TensorFlow graph. - - -- - - - -#### `tf.Session.partial_run(handle, fetches, feed_dict=None)` {#Session.partial_run} - -Continues the execution with more feeds and fetches. - -This is EXPERIMENTAL and subject to change. - -To use partial execution, a user first calls `partial_run_setup()` and -then a sequence of `partial_run()`. `partial_run_setup` specifies the -list of feeds and fetches that will be used in the subsequent -`partial_run` calls. - -The optional `feed_dict` argument allows the caller to override -the value of tensors in the graph. See run() for more information. - -Below is a simple example: - -```python -a = array_ops.placeholder(dtypes.float32, shape=[]) -b = array_ops.placeholder(dtypes.float32, shape=[]) -c = array_ops.placeholder(dtypes.float32, shape=[]) -r1 = math_ops.add(a, b) -r2 = math_ops.multiply(r1, c) - -h = sess.partial_run_setup([r1, r2], [a, b, c]) -res = sess.partial_run(h, r1, feed_dict={a: 1, b: 2}) -res = sess.partial_run(h, r2, feed_dict={c: res}) -``` - -##### Args: - - -* `handle`: A handle for a sequence of partial runs. -* `fetches`: A single graph element, a list of graph elements, - or a dictionary whose values are graph elements or lists of graph - elements (see documentation for `run`). -* `feed_dict`: A dictionary that maps graph elements to values - (described above). - -##### Returns: - - Either a single value if `fetches` is a single graph element, or - a list of values if `fetches` is a list, or a dictionary with the - same keys as `fetches` if that is a dictionary - (see documentation for `run`). - -##### Raises: - - tf.errors.OpError: Or one of its subclasses on error. - - -- - - - -#### `tf.Session.partial_run_setup(fetches, feeds=None)` {#Session.partial_run_setup} - -Sets up a graph with feeds and fetches for partial run. - -This is EXPERIMENTAL and subject to change. - -Note that contrary to `run`, `feeds` only specifies the graph elements. -The tensors will be supplied by the subsequent `partial_run` calls. - -##### Args: - - -* `fetches`: A single graph element, or a list of graph elements. -* `feeds`: A single graph element, or a list of graph elements. - -##### Returns: - - A handle for partial run. - -##### Raises: - - -* `RuntimeError`: If this `Session` is in an invalid state (e.g. has been - closed). -* `TypeError`: If `fetches` or `feed_dict` keys are of an inappropriate type. - tf.errors.OpError: Or one of its subclasses if a TensorFlow error happens. - - -- - - - -#### `tf.Session.reset(target, containers=None, config=None)` {#Session.reset} - -Resets resource containers on `target`, and close all connected sessions. - -A resource container is distributed across all workers in the -same cluster as `target`. When a resource container on `target` -is reset, resources associated with that container will be cleared. -In particular, all Variables in the container will become undefined: -they lose their values and shapes. - -NOTE: -(i) reset() is currently only implemented for distributed sessions. -(ii) Any sessions on the master named by `target` will be closed. - -If no resource containers are provided, all containers are reset. - -##### Args: - - -* `target`: The execution engine to connect to. -* `containers`: A list of resource container name strings, or `None` if all of - all the containers are to be reset. -* `config`: (Optional.) Protocol buffer with configuration options. - -##### Raises: - - tf.errors.OpError: Or one of its subclasses if an error occurs while - resetting containers. - - -- - - - -#### `tf.Session.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#Session.run} - -Runs operations and evaluates tensors in `fetches`. - -This method runs one "step" of TensorFlow computation, by -running the necessary graph fragment to execute every `Operation` -and evaluate every `Tensor` in `fetches`, substituting the values in -`feed_dict` for the corresponding input values. - -The `fetches` argument may be a single graph element, or an arbitrarily -nested list, tuple, namedtuple, dict, or OrderedDict containing graph -elements at its leaves. A graph element can be one of the following types: - -* An [`Operation`](../../api_docs/python/framework.md#Operation). - The corresponding fetched value will be `None`. -* A [`Tensor`](../../api_docs/python/framework.md#Tensor). - The corresponding fetched value will be a numpy ndarray containing the - value of that tensor. -* A [`SparseTensor`](../../api_docs/python/sparse_ops.md#SparseTensor). - The corresponding fetched value will be a - [`SparseTensorValue`](../../api_docs/python/sparse_ops.md#SparseTensorValue) - containing the value of that sparse tensor. -* A `get_tensor_handle` op. The corresponding fetched value will be a - numpy ndarray containing the handle of that tensor. -* A `string` which is the name of a tensor or operation in the graph. - -The value returned by `run()` has the same shape as the `fetches` argument, -where the leaves are replaced by the corresponding values returned by -TensorFlow. - -Example: - -```python - a = tf.constant([10, 20]) - b = tf.constant([1.0, 2.0]) - # 'fetches' can be a singleton - v = session.run(a) - # v is the numpy array [10, 20] - # 'fetches' can be a list. - v = session.run([a, b]) - # v a Python list with 2 numpy arrays: the numpy array [10, 20] and the - # 1-D array [1.0, 2.0] - # 'fetches' can be arbitrary lists, tuples, namedtuple, dicts: - MyData = collections.namedtuple('MyData', ['a', 'b']) - v = session.run({'k1': MyData(a, b), 'k2': [b, a]}) - # v is a dict with - # v['k1'] is a MyData namedtuple with 'a' the numpy array [10, 20] and - # 'b' the numpy array [1.0, 2.0] - # v['k2'] is a list with the numpy array [1.0, 2.0] and the numpy array - # [10, 20]. -``` - -The optional `feed_dict` argument allows the caller to override -the value of tensors in the graph. Each key in `feed_dict` can be -one of the following types: - -* If the key is a [`Tensor`](../../api_docs/python/framework.md#Tensor), the - value may be a Python scalar, string, list, or numpy ndarray - that can be converted to the same `dtype` as that - tensor. Additionally, if the key is a - [placeholder](../../api_docs/python/io_ops.md#placeholder), the shape of - the value will be checked for compatibility with the placeholder. -* If the key is a - [`SparseTensor`](../../api_docs/python/sparse_ops.md#SparseTensor), - the value should be a - [`SparseTensorValue`](../../api_docs/python/sparse_ops.md#SparseTensorValue). -* If the key is a nested tuple of `Tensor`s or `SparseTensor`s, the value - should be a nested tuple with the same structure that maps to their - corresponding values as above. - -Each value in `feed_dict` must be convertible to a numpy array of the dtype -of the corresponding key. - -The optional `options` argument expects a [`RunOptions`] proto. The options -allow controlling the behavior of this particular step (e.g. turning tracing -on). - -The optional `run_metadata` argument expects a [`RunMetadata`] proto. When -appropriate, the non-Tensor output of this step will be collected there. For -example, when users turn on tracing in `options`, the profiled info will be -collected into this argument and passed back. - -##### Args: - - -* `fetches`: A single graph element, a list of graph elements, - or a dictionary whose values are graph elements or lists of graph - elements (described above). -* `feed_dict`: A dictionary that maps graph elements to values - (described above). -* `options`: A [`RunOptions`] protocol buffer -* `run_metadata`: A [`RunMetadata`] protocol buffer - -##### Returns: - - Either a single value if `fetches` is a single graph element, or - a list of values if `fetches` is a list, or a dictionary with the - same keys as `fetches` if that is a dictionary (described above). - -##### Raises: - - -* `RuntimeError`: If this `Session` is in an invalid state (e.g. has been - closed). -* `TypeError`: If `fetches` or `feed_dict` keys are of an inappropriate type. -* `ValueError`: If `fetches` or `feed_dict` keys are invalid or refer to a - `Tensor` that doesn't exist. - - -- - - - -#### `tf.Session.sess_str` {#Session.sess_str} - - - - - -- - - - -### `class tf.InteractiveSession` {#InteractiveSession} - -A TensorFlow `Session` for use in interactive contexts, such as a shell. - -The only difference with a regular `Session` is that an `InteractiveSession` -installs itself as the default session on construction. -The methods [`Tensor.eval()`](../../api_docs/python/framework.md#Tensor.eval) -and [`Operation.run()`](../../api_docs/python/framework.md#Operation.run) -will use that session to run ops. - -This is convenient in interactive shells and [IPython -notebooks](http://ipython.org), as it avoids having to pass an explicit -`Session` object to run ops. - -For example: - -```python -sess = tf.InteractiveSession() -a = tf.constant(5.0) -b = tf.constant(6.0) -c = a * b -# We can just use 'c.eval()' without passing 'sess' -print(c.eval()) -sess.close() -``` - -Note that a regular session installs itself as the default session when it -is created in a `with` statement. The common usage in non-interactive -programs is to follow that pattern: - -```python -a = tf.constant(5.0) -b = tf.constant(6.0) -c = a * b -with tf.Session(): - # We can also use 'c.eval()' here. - print(c.eval()) -``` -- - - - -#### `tf.InteractiveSession.__del__()` {#InteractiveSession.__del__} - - - - -- - - - -#### `tf.InteractiveSession.__init__(target='', graph=None, config=None)` {#InteractiveSession.__init__} - -Creates a new interactive TensorFlow session. - -If no `graph` argument is specified when constructing the session, -the default graph will be launched in the session. If you are -using more than one graph (created with `tf.Graph()` in the same -process, you will have to use different sessions for each graph, -but each graph can be used in multiple sessions. In this case, it -is often clearer to pass the graph to be launched explicitly to -the session constructor. - -##### Args: - - -* `target`: (Optional.) The execution engine to connect to. - Defaults to using an in-process engine. -* `graph`: (Optional.) The `Graph` to be launched (described above). -* `config`: (Optional) `ConfigProto` proto used to configure the session. - - -- - - - -#### `tf.InteractiveSession.as_default()` {#InteractiveSession.as_default} - -Returns a context manager that makes this object the default session. - -Use with the `with` keyword to specify that calls to -[`Operation.run()`](../../api_docs/python/framework.md#Operation.run) or -[`Tensor.eval()`](../../api_docs/python/framework.md#Tensor.eval) should be -executed in this session. - -```python -c = tf.constant(..) -sess = tf.Session() - -with sess.as_default(): - assert tf.get_default_session() is sess - print(c.eval()) -``` - -To get the current default session, use -[`tf.get_default_session()`](#get_default_session). - - -*N.B.* The `as_default` context manager *does not* close the -session when you exit the context, and you must close the session -explicitly. - -```python -c = tf.constant(...) -sess = tf.Session() -with sess.as_default(): - print(c.eval()) -# ... -with sess.as_default(): - print(c.eval()) - -sess.close() -``` - -Alternatively, you can use `with tf.Session():` to create a -session that is automatically closed on exiting the context, -including when an uncaught exception is raised. - -*N.B.* The default graph is a property of the current thread. If you -create a new thread, and wish to use the default session in that -thread, you must explicitly add a `with sess.as_default():` in that -thread's function. - -##### Returns: - - A context manager using this session as the default session. - - -- - - - -#### `tf.InteractiveSession.close()` {#InteractiveSession.close} - -Closes an `InteractiveSession`. - - -- - - - -#### `tf.InteractiveSession.graph` {#InteractiveSession.graph} - -The graph that was launched in this session. - - -- - - - -#### `tf.InteractiveSession.graph_def` {#InteractiveSession.graph_def} - -A serializable version of the underlying TensorFlow graph. - -##### Returns: - - A graph_pb2.GraphDef proto containing nodes for all of the Operations in - the underlying TensorFlow graph. - - -- - - - -#### `tf.InteractiveSession.partial_run(handle, fetches, feed_dict=None)` {#InteractiveSession.partial_run} - -Continues the execution with more feeds and fetches. - -This is EXPERIMENTAL and subject to change. - -To use partial execution, a user first calls `partial_run_setup()` and -then a sequence of `partial_run()`. `partial_run_setup` specifies the -list of feeds and fetches that will be used in the subsequent -`partial_run` calls. - -The optional `feed_dict` argument allows the caller to override -the value of tensors in the graph. See run() for more information. - -Below is a simple example: - -```python -a = array_ops.placeholder(dtypes.float32, shape=[]) -b = array_ops.placeholder(dtypes.float32, shape=[]) -c = array_ops.placeholder(dtypes.float32, shape=[]) -r1 = math_ops.add(a, b) -r2 = math_ops.multiply(r1, c) - -h = sess.partial_run_setup([r1, r2], [a, b, c]) -res = sess.partial_run(h, r1, feed_dict={a: 1, b: 2}) -res = sess.partial_run(h, r2, feed_dict={c: res}) -``` - -##### Args: - - -* `handle`: A handle for a sequence of partial runs. -* `fetches`: A single graph element, a list of graph elements, - or a dictionary whose values are graph elements or lists of graph - elements (see documentation for `run`). -* `feed_dict`: A dictionary that maps graph elements to values - (described above). - -##### Returns: - - Either a single value if `fetches` is a single graph element, or - a list of values if `fetches` is a list, or a dictionary with the - same keys as `fetches` if that is a dictionary - (see documentation for `run`). - -##### Raises: - - tf.errors.OpError: Or one of its subclasses on error. - - -- - - - -#### `tf.InteractiveSession.partial_run_setup(fetches, feeds=None)` {#InteractiveSession.partial_run_setup} - -Sets up a graph with feeds and fetches for partial run. - -This is EXPERIMENTAL and subject to change. - -Note that contrary to `run`, `feeds` only specifies the graph elements. -The tensors will be supplied by the subsequent `partial_run` calls. - -##### Args: - - -* `fetches`: A single graph element, or a list of graph elements. -* `feeds`: A single graph element, or a list of graph elements. - -##### Returns: - - A handle for partial run. - -##### Raises: - - -* `RuntimeError`: If this `Session` is in an invalid state (e.g. has been - closed). -* `TypeError`: If `fetches` or `feed_dict` keys are of an inappropriate type. - tf.errors.OpError: Or one of its subclasses if a TensorFlow error happens. - - -- - - - -#### `tf.InteractiveSession.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#InteractiveSession.run} - -Runs operations and evaluates tensors in `fetches`. - -This method runs one "step" of TensorFlow computation, by -running the necessary graph fragment to execute every `Operation` -and evaluate every `Tensor` in `fetches`, substituting the values in -`feed_dict` for the corresponding input values. - -The `fetches` argument may be a single graph element, or an arbitrarily -nested list, tuple, namedtuple, dict, or OrderedDict containing graph -elements at its leaves. A graph element can be one of the following types: - -* An [`Operation`](../../api_docs/python/framework.md#Operation). - The corresponding fetched value will be `None`. -* A [`Tensor`](../../api_docs/python/framework.md#Tensor). - The corresponding fetched value will be a numpy ndarray containing the - value of that tensor. -* A [`SparseTensor`](../../api_docs/python/sparse_ops.md#SparseTensor). - The corresponding fetched value will be a - [`SparseTensorValue`](../../api_docs/python/sparse_ops.md#SparseTensorValue) - containing the value of that sparse tensor. -* A `get_tensor_handle` op. The corresponding fetched value will be a - numpy ndarray containing the handle of that tensor. -* A `string` which is the name of a tensor or operation in the graph. - -The value returned by `run()` has the same shape as the `fetches` argument, -where the leaves are replaced by the corresponding values returned by -TensorFlow. - -Example: - -```python - a = tf.constant([10, 20]) - b = tf.constant([1.0, 2.0]) - # 'fetches' can be a singleton - v = session.run(a) - # v is the numpy array [10, 20] - # 'fetches' can be a list. - v = session.run([a, b]) - # v a Python list with 2 numpy arrays: the numpy array [10, 20] and the - # 1-D array [1.0, 2.0] - # 'fetches' can be arbitrary lists, tuples, namedtuple, dicts: - MyData = collections.namedtuple('MyData', ['a', 'b']) - v = session.run({'k1': MyData(a, b), 'k2': [b, a]}) - # v is a dict with - # v['k1'] is a MyData namedtuple with 'a' the numpy array [10, 20] and - # 'b' the numpy array [1.0, 2.0] - # v['k2'] is a list with the numpy array [1.0, 2.0] and the numpy array - # [10, 20]. -``` - -The optional `feed_dict` argument allows the caller to override -the value of tensors in the graph. Each key in `feed_dict` can be -one of the following types: - -* If the key is a [`Tensor`](../../api_docs/python/framework.md#Tensor), the - value may be a Python scalar, string, list, or numpy ndarray - that can be converted to the same `dtype` as that - tensor. Additionally, if the key is a - [placeholder](../../api_docs/python/io_ops.md#placeholder), the shape of - the value will be checked for compatibility with the placeholder. -* If the key is a - [`SparseTensor`](../../api_docs/python/sparse_ops.md#SparseTensor), - the value should be a - [`SparseTensorValue`](../../api_docs/python/sparse_ops.md#SparseTensorValue). -* If the key is a nested tuple of `Tensor`s or `SparseTensor`s, the value - should be a nested tuple with the same structure that maps to their - corresponding values as above. - -Each value in `feed_dict` must be convertible to a numpy array of the dtype -of the corresponding key. - -The optional `options` argument expects a [`RunOptions`] proto. The options -allow controlling the behavior of this particular step (e.g. turning tracing -on). - -The optional `run_metadata` argument expects a [`RunMetadata`] proto. When -appropriate, the non-Tensor output of this step will be collected there. For -example, when users turn on tracing in `options`, the profiled info will be -collected into this argument and passed back. - -##### Args: - - -* `fetches`: A single graph element, a list of graph elements, - or a dictionary whose values are graph elements or lists of graph - elements (described above). -* `feed_dict`: A dictionary that maps graph elements to values - (described above). -* `options`: A [`RunOptions`] protocol buffer -* `run_metadata`: A [`RunMetadata`] protocol buffer - -##### Returns: - - Either a single value if `fetches` is a single graph element, or - a list of values if `fetches` is a list, or a dictionary with the - same keys as `fetches` if that is a dictionary (described above). - -##### Raises: - - -* `RuntimeError`: If this `Session` is in an invalid state (e.g. has been - closed). -* `TypeError`: If `fetches` or `feed_dict` keys are of an inappropriate type. -* `ValueError`: If `fetches` or `feed_dict` keys are invalid or refer to a - `Tensor` that doesn't exist. - - -- - - - -#### `tf.InteractiveSession.sess_str` {#InteractiveSession.sess_str} - - - - - - -- - - - -### `tf.get_default_session()` {#get_default_session} - -Returns the default session for the current thread. - -The returned `Session` will be the innermost session on which a -`Session` or `Session.as_default()` context has been entered. - -NOTE: The default session is a property of the current thread. If you -create a new thread, and wish to use the default session in that -thread, you must explicitly add a `with sess.as_default():` in that -thread's function. - -##### Returns: - - The default `Session` being used in the current thread. - - - -## Error classes and convenience functions - -- - - - -### `class tf.OpError` {#OpError} - -A generic error that is raised when TensorFlow execution fails. - -Whenever possible, the session will raise a more specific subclass -of `OpError` from the `tf.errors` module. -- - - - -#### `tf.OpError.__init__(node_def, op, message, error_code)` {#OpError.__init__} - -Creates a new `OpError` indicating that a particular op failed. - -##### Args: - - -* `node_def`: The `node_def_pb2.NodeDef` proto representing the op that - failed, if known; otherwise None. -* `op`: The `ops.Operation` that failed, if known; otherwise None. -* `message`: The message string describing the failure. -* `error_code`: The `error_codes_pb2.Code` describing the error. - - -- - - - -#### `tf.OpError.__str__()` {#OpError.__str__} - - - - -- - - - -#### `tf.OpError.error_code` {#OpError.error_code} - -The integer error code that describes the error. - - -- - - - -#### `tf.OpError.message` {#OpError.message} - -The error message that describes the error. - - -- - - - -#### `tf.OpError.node_def` {#OpError.node_def} - -The `NodeDef` proto representing the op that failed. - - -- - - - -#### `tf.OpError.op` {#OpError.op} - -The operation that failed, if known. - -*N.B.* If the failed op was synthesized at runtime, e.g. a `Send` -or `Recv` op, there will be no corresponding -[`Operation`](../../api_docs/python/framework.md#Operation) -object. In that case, this will return `None`, and you should -instead use the [`OpError.node_def`](#OpError.node_def) to -discover information about the op. - -##### Returns: - - The `Operation` that failed, or None. - - - -- - - - -### `class tf.errors.CancelledError` {#CancelledError} - -Raised when an operation or step is cancelled. - -For example, a long-running operation (e.g. -[`queue.enqueue()`](../../api_docs/python/io_ops.md#QueueBase.enqueue) may be -cancelled by running another operation (e.g. -[`queue.close(cancel_pending_enqueues=True)`](../../api_docs/python/io_ops.md#QueueBase.close), -or by [closing the session](../../api_docs/python/client.md#Session.close). -A step that is running such a long-running operation will fail by raising -`CancelledError`. - -- - - - -#### `tf.errors.CancelledError.__init__(node_def, op, message)` {#CancelledError.__init__} - -Creates a `CancelledError`. - - - -- - - - -### `class tf.errors.UnknownError` {#UnknownError} - -Unknown error. - -An example of where this error may be returned is if a Status value -received from another address space belongs to an error-space that -is not known to this address space. Also errors raised by APIs that -do not return enough error information may be converted to this -error. - -- - - - -#### `tf.errors.UnknownError.__init__(node_def, op, message, error_code=2)` {#UnknownError.__init__} - -Creates an `UnknownError`. - - - -- - - - -### `class tf.errors.InvalidArgumentError` {#InvalidArgumentError} - -Raised when an operation receives an invalid argument. - -This may occur, for example, if an operation is receives an input -tensor that has an invalid value or shape. For example, the -[`tf.matmul()`](../../api_docs/python/math_ops.md#matmul) op will raise this -error if it receives an input that is not a matrix, and the -[`tf.reshape()`](../../api_docs/python/array_ops.md#reshape) op will raise -this error if the new shape does not match the number of elements in the input -tensor. - -- - - - -#### `tf.errors.InvalidArgumentError.__init__(node_def, op, message)` {#InvalidArgumentError.__init__} - -Creates an `InvalidArgumentError`. - - - -- - - - -### `class tf.errors.DeadlineExceededError` {#DeadlineExceededError} - -Raised when a deadline expires before an operation could complete. - -This exception is not currently used. - -- - - - -#### `tf.errors.DeadlineExceededError.__init__(node_def, op, message)` {#DeadlineExceededError.__init__} - -Creates a `DeadlineExceededError`. - - - -- - - - -### `class tf.errors.NotFoundError` {#NotFoundError} - -Raised when a requested entity (e.g., a file or directory) was not found. - -For example, running the -[`tf.WholeFileReader.read()`](../../api_docs/python/io_ops.md#WholeFileReader) -operation could raise `NotFoundError` if it receives the name of a file that -does not exist. - -- - - - -#### `tf.errors.NotFoundError.__init__(node_def, op, message)` {#NotFoundError.__init__} - -Creates a `NotFoundError`. - - - -- - - - -### `class tf.errors.AlreadyExistsError` {#AlreadyExistsError} - -Raised when an entity that we attempted to create already exists. - -For example, running an operation that saves a file -(e.g. [`tf.train.Saver.save()`](../../api_docs/python/train.md#Saver.save)) -could potentially raise this exception if an explicit filename for an -existing file was passed. - -- - - - -#### `tf.errors.AlreadyExistsError.__init__(node_def, op, message)` {#AlreadyExistsError.__init__} - -Creates an `AlreadyExistsError`. - - - -- - - - -### `class tf.errors.PermissionDeniedError` {#PermissionDeniedError} - -Raised when the caller does not have permission to run an operation. - -For example, running the -[`tf.WholeFileReader.read()`](../../api_docs/python/io_ops.md#WholeFileReader) -operation could raise `PermissionDeniedError` if it receives the name of a -file for which the user does not have the read file permission. - -- - - - -#### `tf.errors.PermissionDeniedError.__init__(node_def, op, message)` {#PermissionDeniedError.__init__} - -Creates a `PermissionDeniedError`. - - - -- - - - -### `class tf.errors.UnauthenticatedError` {#UnauthenticatedError} - -The request does not have valid authentication credentials. - -This exception is not currently used. - -- - - - -#### `tf.errors.UnauthenticatedError.__init__(node_def, op, message)` {#UnauthenticatedError.__init__} - -Creates an `UnauthenticatedError`. - - - -- - - - -### `class tf.errors.ResourceExhaustedError` {#ResourceExhaustedError} - -Some resource has been exhausted. - -For example, this error might be raised if a per-user quota is -exhausted, or perhaps the entire file system is out of space. - -- - - - -#### `tf.errors.ResourceExhaustedError.__init__(node_def, op, message)` {#ResourceExhaustedError.__init__} - -Creates a `ResourceExhaustedError`. - - - -- - - - -### `class tf.errors.FailedPreconditionError` {#FailedPreconditionError} - -Operation was rejected because the system is not in a state to execute it. - -This exception is most commonly raised when running an operation -that reads a [`tf.Variable`](../../api_docs/python/state_ops.md#Variable) -before it has been initialized. - -- - - - -#### `tf.errors.FailedPreconditionError.__init__(node_def, op, message)` {#FailedPreconditionError.__init__} - -Creates a `FailedPreconditionError`. - - - -- - - - -### `class tf.errors.AbortedError` {#AbortedError} - -The operation was aborted, typically due to a concurrent action. - -For example, running a -[`queue.enqueue()`](../../api_docs/python/io_ops.md#QueueBase.enqueue) -operation may raise `AbortedError` if a -[`queue.close()`](../../api_docs/python/io_ops.md#QueueBase.close) operation -previously ran. - -- - - - -#### `tf.errors.AbortedError.__init__(node_def, op, message)` {#AbortedError.__init__} - -Creates an `AbortedError`. - - - -- - - - -### `class tf.errors.OutOfRangeError` {#OutOfRangeError} - -Raised when an operation iterates past the valid input range. - -This exception is raised in "end-of-file" conditions, such as when a -[`queue.dequeue()`](../../api_docs/python/io_ops.md#QueueBase.dequeue) -operation is blocked on an empty queue, and a -[`queue.close()`](../../api_docs/python/io_ops.md#QueueBase.close) -operation executes. - -- - - - -#### `tf.errors.OutOfRangeError.__init__(node_def, op, message)` {#OutOfRangeError.__init__} - -Creates an `OutOfRangeError`. - - - -- - - - -### `class tf.errors.UnimplementedError` {#UnimplementedError} - -Raised when an operation has not been implemented. - -Some operations may raise this error when passed otherwise-valid -arguments that it does not currently support. For example, running -the [`tf.nn.max_pool()`](../../api_docs/python/nn.md#max_pool) operation -would raise this error if pooling was requested on the batch dimension, -because this is not yet supported. - -- - - - -#### `tf.errors.UnimplementedError.__init__(node_def, op, message)` {#UnimplementedError.__init__} - -Creates an `UnimplementedError`. - - - -- - - - -### `class tf.errors.InternalError` {#InternalError} - -Raised when the system experiences an internal error. - -This exception is raised when some invariant expected by the runtime -has been broken. Catching this exception is not recommended. - -- - - - -#### `tf.errors.InternalError.__init__(node_def, op, message)` {#InternalError.__init__} - -Creates an `InternalError`. - - - -- - - - -### `class tf.errors.UnavailableError` {#UnavailableError} - -Raised when the runtime is currently unavailable. - -This exception is not currently used. - -- - - - -#### `tf.errors.UnavailableError.__init__(node_def, op, message)` {#UnavailableError.__init__} - -Creates an `UnavailableError`. - - - -- - - - -### `class tf.errors.DataLossError` {#DataLossError} - -Raised when unrecoverable data loss or corruption is encountered. - -For example, this may be raised by running a -[`tf.WholeFileReader.read()`](../../api_docs/python/io_ops.md#WholeFileReader) -operation, if the file is truncated while it is being read. - -- - - - -#### `tf.errors.DataLossError.__init__(node_def, op, message)` {#DataLossError.__init__} - -Creates a `DataLossError`. - - - - -- - - - -### `tf.errors.exception_type_from_error_code(error_code)` {#exception_type_from_error_code} - - - - -- - - - -### `tf.errors.error_code_from_exception_type(cls)` {#error_code_from_exception_type} - - - - -- - - - -### `tf.errors.raise_exception_on_not_ok_status()` {#raise_exception_on_not_ok_status} - - - - diff --git a/tensorflow/g3doc/api_docs/python/constant_op.md b/tensorflow/g3doc/api_docs/python/constant_op.md deleted file mode 100644 index 62654874f4..0000000000 --- a/tensorflow/g3doc/api_docs/python/constant_op.md +++ /dev/null @@ -1,775 +0,0 @@ - - -# Constants, Sequences, and Random Values - -Note: Functions taking `Tensor` arguments can also take anything accepted by -[`tf.convert_to_tensor`](framework.md#convert_to_tensor). - -[TOC] - -## Constant Value Tensors - -TensorFlow provides several operations that you can use to generate constants. - -- - - - -### `tf.zeros(shape, dtype=tf.float32, name=None)` {#zeros} - -Creates a tensor with all elements set to zero. - -This operation returns a tensor of type `dtype` with shape `shape` and -all elements set to zero. - -For example: - -```python -tf.zeros([3, 4], tf.int32) ==> [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] -``` - -##### Args: - - -* `shape`: Either a list of integers, or a 1-D `Tensor` of type `int32`. -* `dtype`: The type of an element in the resulting `Tensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` with all elements set to zero. - - -- - - - -### `tf.zeros_like(tensor, dtype=None, name=None, optimize=True)` {#zeros_like} - -Creates a tensor with all elements set to zero. - -Given a single tensor (`tensor`), this operation returns a tensor of the -same type and shape as `tensor` with all elements set to zero. Optionally, -you can use `dtype` to specify a new type for the returned tensor. - -For example: - -```python -# 'tensor' is [[1, 2, 3], [4, 5, 6]] -tf.zeros_like(tensor) ==> [[0, 0, 0], [0, 0, 0]] -``` - -##### Args: - - -* `tensor`: A `Tensor`. -* `dtype`: A type for the returned `Tensor`. Must be `float32`, `float64`, - `int8`, `int16`, `int32`, `int64`, `uint8`, `complex64`, or `complex128`. - -* `name`: A name for the operation (optional). -* `optimize`: if true, attempt to statically determine the shape of 'tensor' - and encode it as a constant. - -##### Returns: - - A `Tensor` with all elements set to zero. - - - -- - - - -### `tf.ones(shape, dtype=tf.float32, name=None)` {#ones} - -Creates a tensor with all elements set to 1. - -This operation returns a tensor of type `dtype` with shape `shape` and all -elements set to 1. - -For example: - -```python -tf.ones([2, 3], tf.int32) ==> [[1, 1, 1], [1, 1, 1]] -``` - -##### Args: - - -* `shape`: Either a list of integers, or a 1-D `Tensor` of type `int32`. -* `dtype`: The type of an element in the resulting `Tensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` with all elements set to 1. - - -- - - - -### `tf.ones_like(tensor, dtype=None, name=None, optimize=True)` {#ones_like} - -Creates a tensor with all elements set to 1. - -Given a single tensor (`tensor`), this operation returns a tensor of the same -type and shape as `tensor` with all elements set to 1. Optionally, you can -specify a new type (`dtype`) for the returned tensor. - -For example: - -```python -# 'tensor' is [[1, 2, 3], [4, 5, 6]] -tf.ones_like(tensor) ==> [[1, 1, 1], [1, 1, 1]] -``` - -##### Args: - - -* `tensor`: A `Tensor`. -* `dtype`: A type for the returned `Tensor`. Must be `float32`, `float64`, - `int8`, `int16`, `int32`, `int64`, `uint8`, `complex64`, `complex128` or - `bool`. -* `name`: A name for the operation (optional). -* `optimize`: if true, attempt to statically determine the shape of 'tensor' - and encode it as a constant. - -##### Returns: - - A `Tensor` with all elements set to 1. - - - -- - - - -### `tf.fill(dims, value, name=None)` {#fill} - -Creates a tensor filled with a scalar value. - -This operation creates a tensor of shape `dims` and fills it with `value`. - -For example: - -```prettyprint -# Output tensor has shape [2, 3]. -fill([2, 3], 9) ==> [[9, 9, 9] - [9, 9, 9]] -``` - -##### Args: - - -* `dims`: A `Tensor` of type `int32`. - 1-D. Represents the shape of the output tensor. -* `value`: A `Tensor`. 0-D (scalar). Value to fill the returned tensor. - - @compatibility(numpy) - Equivalent to np.full - @end_compatibility - -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `value`. - - - -- - - - -### `tf.constant(value, dtype=None, shape=None, name='Const', verify_shape=False)` {#constant} - -Creates a constant tensor. - - The resulting tensor is populated with values of type `dtype`, as - specified by arguments `value` and (optionally) `shape` (see examples - below). - - The argument `value` can be a constant value, or a list of values of type - `dtype`. If `value` is a list, then the length of the list must be less - than or equal to the number of elements implied by the `shape` argument (if - specified). In the case where the list length is less than the number of - elements specified by `shape`, the last element in the list will be used - to fill the remaining entries. - - The argument `shape` is optional. If present, it specifies the dimensions of - the resulting tensor. If not present, the shape of `value` is used. - - If the argument `dtype` is not specified, then the type is inferred from - the type of `value`. - - For example: - - ```python - # Constant 1-D Tensor populated with value list. - tensor = tf.constant([1, 2, 3, 4, 5, 6, 7]) => [1 2 3 4 5 6 7] - - # Constant 2-D tensor populated with scalar value -1. - tensor = tf.constant(-1.0, shape=[2, 3]) => [[-1. -1. -1.] - [-1. -1. -1.]] - ``` - -##### Args: - - -* `value`: A constant value (or list) of output type `dtype`. - - -* `dtype`: The type of the elements of the resulting tensor. - - -* `shape`: Optional dimensions of resulting tensor. - - -* `name`: Optional name for the tensor. - - -* `verify_shape`: Boolean that enables verification of a shape of values. - -##### Returns: - - A Constant Tensor. - - - -## Sequences - -- - - - -### `tf.linspace(start, stop, num, name=None)` {#linspace} - -Generates values in an interval. - -A sequence of `num` evenly-spaced values are generated beginning at `start`. -If `num > 1`, the values in the sequence increase by `stop - start / num - 1`, -so that the last one is exactly `stop`. - -For example: - -``` -tf.linspace(10.0, 12.0, 3, name="linspace") => [ 10.0 11.0 12.0] -``` - -##### Args: - - -* `start`: A `Tensor`. Must be one of the following types: `float32`, `float64`. - First entry in the range. -* `stop`: A `Tensor`. Must have the same type as `start`. - Last entry in the range. -* `num`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - Number of values to generate. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `start`. 1-D. The generated values. - - - -- - - - -### `tf.range(start, limit=None, delta=1, dtype=None, name='range')` {#range} - -Creates a sequence of numbers. - -Creates a sequence of numbers that begins at `start` and extends by -increments of `delta` up to but not including `limit`. - -The dtype of the resulting tensor is inferred from the inputs unless -it is provided explicitly. - -Like the Python builtin `range`, `start` defaults to 0, so that -`range(n) = range(0, n)`. - -For example: - -```python -# 'start' is 3 -# 'limit' is 18 -# 'delta' is 3 -tf.range(start, limit, delta) ==> [3, 6, 9, 12, 15] - -# 'start' is 3 -# 'limit' is 1 -# 'delta' is -0.5 -tf.range(start, limit, delta) ==> [3, 2.5, 2, 1.5] - -# 'limit' is 5 -tf.range(limit) ==> [0, 1, 2, 3, 4] -``` - -##### Args: - - -* `start`: A 0-D `Tensor` (scalar). Acts as first entry in the range if - `limit` is not None; otherwise, acts as range limit and first entry - defaults to 0. -* `limit`: A 0-D `Tensor` (scalar). Upper limit of sequence, - exclusive. If None, defaults to the value of `start` while the first - entry of the range defaults to 0. -* `delta`: A 0-D `Tensor` (scalar). Number that increments - `start`. Defaults to 1. -* `dtype`: The type of the elements of the resulting tensor. -* `name`: A name for the operation. Defaults to "range". - -##### Returns: - - An 1-D `Tensor` of type `dtype`. - -@compatibility(numpy) -Equivalent to np.arange -@end_compatibility - - - -## Random Tensors - -TensorFlow has several ops that create random tensors with different -distributions. The random ops are stateful, and create new random values each -time they are evaluated. - -The `seed` keyword argument in these functions acts in conjunction with -the graph-level random seed. Changing either the graph-level seed using -[`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) or the -op-level seed will change the underlying seed of these operations. Setting -neither graph-level nor op-level seed, results in a random seed for all -operations. -See [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) -for details on the interaction between operation-level and graph-level random -seeds. - -### Examples: - -```python -# Create a tensor of shape [2, 3] consisting of random normal values, with mean -# -1 and standard deviation 4. -norm = tf.random_normal([2, 3], mean=-1, stddev=4) - -# Shuffle the first dimension of a tensor -c = tf.constant([[1, 2], [3, 4], [5, 6]]) -shuff = tf.random_shuffle(c) - -# Each time we run these ops, different results are generated -sess = tf.Session() -print(sess.run(norm)) -print(sess.run(norm)) - -# Set an op-level seed to generate repeatable sequences across sessions. -norm = tf.random_normal([2, 3], seed=1234) -sess = tf.Session() -print(sess.run(norm)) -print(sess.run(norm)) -sess = tf.Session() -print(sess.run(norm)) -print(sess.run(norm)) -``` - -Another common use of random values is the initialization of variables. Also see -the [Variables How To](../../how_tos/variables/index.md). - -```python -# Use random uniform values in [0, 1) as the initializer for a variable of shape -# [2, 3]. The default type is float32. -var = tf.Variable(tf.random_uniform([2, 3]), name="var") -init = tf.global_variables_initializer() - -sess = tf.Session() -sess.run(init) -print(sess.run(var)) -``` - -- - - - -### `tf.random_normal(shape, mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None)` {#random_normal} - -Outputs random values from a normal distribution. - -##### Args: - - -* `shape`: A 1-D integer Tensor or Python array. The shape of the output tensor. -* `mean`: A 0-D Tensor or Python value of type `dtype`. The mean of the normal - distribution. -* `stddev`: A 0-D Tensor or Python value of type `dtype`. The standard deviation - of the normal distribution. -* `dtype`: The type of the output. -* `seed`: A Python integer. Used to create a random seed for the distribution. - See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: A name for the operation (optional). - -##### Returns: - - A tensor of the specified shape filled with random normal values. - - -- - - - -### `tf.truncated_normal(shape, mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None)` {#truncated_normal} - -Outputs random values from a truncated normal distribution. - -The generated values follow a normal distribution with specified mean and -standard deviation, except that values whose magnitude is more than 2 standard -deviations from the mean are dropped and re-picked. - -##### Args: - - -* `shape`: A 1-D integer Tensor or Python array. The shape of the output tensor. -* `mean`: A 0-D Tensor or Python value of type `dtype`. The mean of the - truncated normal distribution. -* `stddev`: A 0-D Tensor or Python value of type `dtype`. The standard deviation - of the truncated normal distribution. -* `dtype`: The type of the output. -* `seed`: A Python integer. Used to create a random seed for the distribution. - See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: A name for the operation (optional). - -##### Returns: - - A tensor of the specified shape filled with random truncated normal values. - - -- - - - -### `tf.random_uniform(shape, minval=0, maxval=None, dtype=tf.float32, seed=None, name=None)` {#random_uniform} - -Outputs random values from a uniform distribution. - -The generated values follow a uniform distribution in the range -`[minval, maxval)`. The lower bound `minval` is included in the range, while -the upper bound `maxval` is excluded. - -For floats, the default range is `[0, 1)`. For ints, at least `maxval` must -be specified explicitly. - -In the integer case, the random integers are slightly biased unless -`maxval - minval` is an exact power of two. The bias is small for values of -`maxval - minval` significantly smaller than the range of the output (either -`2**32` or `2**64`). - -##### Args: - - -* `shape`: A 1-D integer Tensor or Python array. The shape of the output tensor. -* `minval`: A 0-D Tensor or Python value of type `dtype`. The lower bound on the - range of random values to generate. Defaults to 0. -* `maxval`: A 0-D Tensor or Python value of type `dtype`. The upper bound on - the range of random values to generate. Defaults to 1 if `dtype` is - floating point. -* `dtype`: The type of the output: `float32`, `float64`, `int32`, or `int64`. -* `seed`: A Python integer. Used to create a random seed for the distribution. - See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: A name for the operation (optional). - -##### Returns: - - A tensor of the specified shape filled with random uniform values. - -##### Raises: - - -* `ValueError`: If `dtype` is integral and `maxval` is not specified. - - -- - - - -### `tf.random_shuffle(value, seed=None, name=None)` {#random_shuffle} - -Randomly shuffles a tensor along its first dimension. - -The tensor is shuffled along dimension 0, such that each `value[j]` is mapped -to one and only one `output[i]`. For example, a mapping that might occur for a -3x2 tensor is: - -```python -[[1, 2], [[5, 6], - [3, 4], ==> [1, 2], - [5, 6]] [3, 4]] -``` - -##### Args: - - -* `value`: A Tensor to be shuffled. -* `seed`: A Python integer. Used to create a random seed for the distribution. - See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: A name for the operation (optional). - -##### Returns: - - A tensor of same shape and type as `value`, shuffled along its first - dimension. - - -- - - - -### `tf.random_crop(value, size, seed=None, name=None)` {#random_crop} - -Randomly crops a tensor to a given size. - -Slices a shape `size` portion out of `value` at a uniformly chosen offset. -Requires `value.shape >= size`. - -If a dimension should not be cropped, pass the full size of that dimension. -For example, RGB images can be cropped with -`size = [crop_height, crop_width, 3]`. - -##### Args: - - -* `value`: Input tensor to crop. -* `size`: 1-D tensor with size the rank of `value`. -* `seed`: Python integer. Used to create a random seed. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: A name for this operation (optional). - -##### Returns: - - A cropped tensor of the same rank as `value` and shape `size`. - - -- - - - -### `tf.multinomial(logits, num_samples, seed=None, name=None)` {#multinomial} - -Draws samples from a multinomial distribution. - -Example: - -```python -# samples has shape [1, 5], where each value is either 0 or 1 with equal -# probability. -samples = tf.multinomial(tf.log([[10., 10.]]), 5) -``` - -##### Args: - - -* `logits`: 2-D Tensor with shape `[batch_size, num_classes]`. Each slice - `[i, :]` represents the unnormalized log probabilities for all classes. -* `num_samples`: 0-D. Number of independent samples to draw for each row slice. -* `seed`: A Python integer. Used to create a random seed for the distribution. - See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: Optional name for the operation. - -##### Returns: - - The drawn samples of shape `[batch_size, num_samples]`. - - -- - - - -### `tf.random_gamma(shape, alpha, beta=None, dtype=tf.float32, seed=None, name=None)` {#random_gamma} - -Draws `shape` samples from each of the given Gamma distribution(s). - -`alpha` is the shape parameter describing the distribution(s), and `beta` is -the inverse scale parameter(s). - -Example: - - samples = tf.random_gamma([10], [0.5, 1.5]) - # samples has shape [10, 2], where each slice [:, 0] and [:, 1] represents - # the samples drawn from each distribution - - samples = tf.random_gamma([7, 5], [0.5, 1.5]) - # samples has shape [7, 5, 2], where each slice [:, :, 0] and [:, :, 1] - # represents the 7x5 samples drawn from each of the two distributions - - samples = tf.random_gamma([30], [[1.],[3.],[5.]], beta=[[3., 4.]]) - # samples has shape [30, 3, 2], with 30 samples each of 3x2 distributions. - - Note that for small alpha values, there is a chance you will draw a value of - exactly 0, which gets worse for lower-precision dtypes, even though zero is - not in the support of the gamma distribution. - - Relevant cdfs (~chance you will draw a exactly-0 value): - ``` - stats.gamma(.01).cdf(np.finfo(np.float16).tiny) - 0.91269738769897879 - stats.gamma(.01).cdf(np.finfo(np.float32).tiny) - 0.41992668622045726 - stats.gamma(.01).cdf(np.finfo(np.float64).tiny) - 0.00084322740680686662 - stats.gamma(.35).cdf(np.finfo(np.float16).tiny) - 0.037583276135263931 - stats.gamma(.35).cdf(np.finfo(np.float32).tiny) - 5.9514895726818067e-14 - stats.gamma(.35).cdf(np.finfo(np.float64).tiny) - 2.3529843400647272e-108 - ``` - -##### Args: - - -* `shape`: A 1-D integer Tensor or Python array. The shape of the output samples - to be drawn per alpha/beta-parameterized distribution. -* `alpha`: A Tensor or Python value or N-D array of type `dtype`. `alpha` - provides the shape parameter(s) describing the gamma distribution(s) to - sample. Must be broadcastable with `beta`. -* `beta`: A Tensor or Python value or N-D array of type `dtype`. Defaults to 1. - `beta` provides the inverse scale parameter(s) of the gamma - distribution(s) to sample. Must be broadcastable with `alpha`. -* `dtype`: The type of alpha, beta, and the output: `float16`, `float32`, or - `float64`. -* `seed`: A Python integer. Used to create a random seed for the distributions. - See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: Optional name for the operation. - -##### Returns: - - -* `samples`: a `Tensor` of shape `tf.concat(shape, tf.shape(alpha + beta))` - with values of type `dtype`. - - -- - - - -### `tf.random_poisson(lam, shape, dtype=tf.float32, seed=None, name=None)` {#random_poisson} - -Draws `shape` samples from each of the given Poisson distribution(s). - -`lam` is the rate parameter describing the distribution(s). - -Example: - - samples = tf.random_poisson([0.5, 1.5], [10]) - # samples has shape [10, 2], where each slice [:, 0] and [:, 1] represents - # the samples drawn from each distribution - - samples = tf.random_poisson([12.2, 3.3], [7, 5]) - # samples has shape [7, 5, 2], where each slice [:, :, 0] and [:, :, 1] - # represents the 7x5 samples drawn from each of the two distributions - -##### Args: - - -* `lam`: A Tensor or Python value or N-D array of type `dtype`. - `lam` provides the rate parameter(s) describing the poisson - distribution(s) to sample. -* `shape`: A 1-D integer Tensor or Python array. The shape of the output samples - to be drawn per "rate"-parameterized distribution. -* `dtype`: The type of `lam` and the output: `float16`, `float32`, or - `float64`. -* `seed`: A Python integer. Used to create a random seed for the distributions. - See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: Optional name for the operation. - -##### Returns: - - -* `samples`: a `Tensor` of shape `tf.concat(shape, tf.shape(lam))` with - values of type `dtype`. - - -- - - - -### `tf.set_random_seed(seed)` {#set_random_seed} - -Sets the graph-level random seed. - -Operations that rely on a random seed actually derive it from two seeds: -the graph-level and operation-level seeds. This sets the graph-level seed. - -Its interactions with operation-level seeds is as follows: - - 1. If neither the graph-level nor the operation seed is set: - A random seed is used for this op. - 2. If the graph-level seed is set, but the operation seed is not: - The system deterministically picks an operation seed in conjunction - with the graph-level seed so that it gets a unique random sequence. - 3. If the graph-level seed is not set, but the operation seed is set: - A default graph-level seed and the specified operation seed are used to - determine the random sequence. - 4. If both the graph-level and the operation seed are set: - Both seeds are used in conjunction to determine the random sequence. - -To illustrate the user-visible effects, consider these examples: - -To generate different sequences across sessions, set neither -graph-level nor op-level seeds: - -```python -a = tf.random_uniform([1]) -b = tf.random_normal([1]) - -print("Session 1") -with tf.Session() as sess1: - print(sess1.run(a)) # generates 'A1' - print(sess1.run(a)) # generates 'A2' - print(sess1.run(b)) # generates 'B1' - print(sess1.run(b)) # generates 'B2' - -print("Session 2") -with tf.Session() as sess2: - print(sess2.run(a)) # generates 'A3' - print(sess2.run(a)) # generates 'A4' - print(sess2.run(b)) # generates 'B3' - print(sess2.run(b)) # generates 'B4' -``` - -To generate the same repeatable sequence for an op across sessions, set the -seed for the op: - -```python -a = tf.random_uniform([1], seed=1) -b = tf.random_normal([1]) - -# Repeatedly running this block with the same graph will generate the same -# sequence of values for 'a', but different sequences of values for 'b'. -print("Session 1") -with tf.Session() as sess1: - print(sess1.run(a)) # generates 'A1' - print(sess1.run(a)) # generates 'A2' - print(sess1.run(b)) # generates 'B1' - print(sess1.run(b)) # generates 'B2' - -print("Session 2") -with tf.Session() as sess2: - print(sess2.run(a)) # generates 'A1' - print(sess2.run(a)) # generates 'A2' - print(sess2.run(b)) # generates 'B3' - print(sess2.run(b)) # generates 'B4' -``` - -To make the random sequences generated by all ops be repeatable across -sessions, set a graph-level seed: - -```python -tf.set_random_seed(1234) -a = tf.random_uniform([1]) -b = tf.random_normal([1]) - -# Repeatedly running this block with the same graph will generate the same -# sequences of 'a' and 'b'. -print("Session 1") -with tf.Session() as sess1: - print(sess1.run(a)) # generates 'A1' - print(sess1.run(a)) # generates 'A2' - print(sess1.run(b)) # generates 'B1' - print(sess1.run(b)) # generates 'B2' - -print("Session 2") -with tf.Session() as sess2: - print(sess2.run(a)) # generates 'A1' - print(sess2.run(a)) # generates 'A2' - print(sess2.run(b)) # generates 'B1' - print(sess2.run(b)) # generates 'B2' -``` - -##### Args: - - -* `seed`: integer. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.bayesflow.entropy.md b/tensorflow/g3doc/api_docs/python/contrib.bayesflow.entropy.md deleted file mode 100644 index bac58387e8..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.bayesflow.entropy.md +++ /dev/null @@ -1,304 +0,0 @@ - - -# BayesFlow Entropy (contrib) -[TOC] - -Entropy Ops. - -## Background - -Common Shannon entropy, the Evidence Lower BOund (ELBO), KL divergence, and more -all have information theoretic use and interpretations. They are also often -used in variational inference. This library brings together `Ops` for -estimating them, e.g. using Monte Carlo expectations. - -## Examples - -Example of fitting a variational posterior with the ELBO. - -```python -# We start by assuming knowledge of the log of a joint density p(z, x) over -# latent variable z and fixed measurement x. Since x is fixed, the Python -# function does not take x as an argument. -def log_joint(z): - theta = tf.Variable(0.) # Trainable variable that helps define log_joint. - ... - -# Next, define a Normal distribution with trainable parameters. -q = distributions.Normal(mu=tf.Variable(0.), sigma=tf.Variable(1.)) - -# Now, define a loss function (negative ELBO) that, when minimized, will adjust -# mu, sigma, and theta, increasing the ELBO, which we hope will both reduce the -# KL divergence between q(z) and p(z | x), and increase p(x). Note that we -# cannot guarantee both, but in general we expect both to happen. -elbo = entropy.elbo_ratio(log_p, q, n=10) -loss = -elbo - -# Minimize the loss -train_op = tf.train.GradientDescentOptimizer(0.1).minimize(loss) -tf.global_variables_initializer().run() -for step in range(100): - train_op.run() -``` - -## Ops - -- - - - -### `tf.contrib.bayesflow.entropy.elbo_ratio(log_p, q, z=None, n=None, seed=None, form=None, name='elbo_ratio')` {#elbo_ratio} - -Estimate of the ratio appearing in the `ELBO` and `KL` divergence. - -With `p(z) := exp{log_p(z)}`, this `Op` returns an approximation of - -``` -E_q[ Log[p(Z) / q(Z)] ] -``` - -The term `E_q[ Log[p(Z)] ]` is always computed as a sample mean. -The term `E_q[ Log[q(z)] ]` can be computed with samples, or an exact formula -if `q.entropy()` is defined. This is controlled with the kwarg `form`. - -This log-ratio appears in different contexts: - -#### `KL[q || p]` - -If `log_p(z) = Log[p(z)]` for distribution `p`, this `Op` approximates -the negative Kullback-Leibler divergence. - -``` -elbo_ratio(log_p, q, n=100) = -1 * KL[q || p], -KL[q || p] = E[ Log[q(Z)] - Log[p(Z)] ] -``` - -Note that if `p` is a `Distribution`, then `distributions.kl(q, p)` may be -defined and available as an exact result. - -#### ELBO - -If `log_p(z) = Log[p(z, x)]` is the log joint of a distribution `p`, this is -the Evidence Lower BOund (ELBO): - -``` -ELBO ~= E[ Log[p(Z, x)] - Log[q(Z)] ] - = Log[p(x)] - KL[q || p] - <= Log[p(x)] -``` - -User supplies either `Tensor` of samples `z`, or number of samples to draw `n` - -##### Args: - - -* `log_p`: Callable mapping samples from `q` to `Tensors` with - shape broadcastable to `q.batch_shape`. - For example, `log_p` works "just like" `q.log_prob`. -* `q`: `tf.contrib.distributions.Distribution`. -* `z`: `Tensor` of samples from `q`, produced by `q.sample(n)` for some `n`. -* `n`: Integer `Tensor`. Number of samples to generate if `z` is not provided. -* `seed`: Python integer to seed the random number generator. -* `form`: Either `ELBOForms.analytic_entropy` (use formula for entropy of `q`) - or `ELBOForms.sample` (sample estimate of entropy), or `ELBOForms.default` - (attempt analytic entropy, fallback on sample). - Default value is `ELBOForms.default`. -* `name`: A name to give this `Op`. - -##### Returns: - - Scalar `Tensor` holding sample mean KL divergence. `shape` is the batch - shape of `q`, and `dtype` is the same as `q`. - -##### Raises: - - -* `ValueError`: If `form` is not handled by this function. - - -- - - - -### `tf.contrib.bayesflow.entropy.entropy_shannon(p, z=None, n=None, seed=None, form=None, name='entropy_shannon')` {#entropy_shannon} - -Monte Carlo or deterministic computation of Shannon's entropy. - -Depending on the kwarg `form`, this `Op` returns either the analytic entropy -of the distribution `p`, or the sampled entropy: - -``` --n^{-1} sum_{i=1}^n p.log_prob(z_i), where z_i ~ p, - \approx - E_p[ Log[p(Z)] ] - = Entropy[p] -``` - -User supplies either `Tensor` of samples `z`, or number of samples to draw `n` - -##### Args: - - -* `p`: `tf.contrib.distributions.Distribution` -* `z`: `Tensor` of samples from `p`, produced by `p.sample(n)` for some `n`. -* `n`: Integer `Tensor`. Number of samples to generate if `z` is not provided. -* `seed`: Python integer to seed the random number generator. -* `form`: Either `ELBOForms.analytic_entropy` (use formula for entropy of `q`) - or `ELBOForms.sample` (sample estimate of entropy), or `ELBOForms.default` - (attempt analytic entropy, fallback on sample). - Default value is `ELBOForms.default`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with same `dtype` as `p`, and shape equal to `p.batch_shape`. - -##### Raises: - - -* `ValueError`: If `form` not handled by this function. -* `ValueError`: If `form` is `ELBOForms.analytic_entropy` and `n` was provided. - - -- - - - -### `tf.contrib.bayesflow.entropy.renyi_ratio(log_p, q, alpha, z=None, n=None, seed=None, name='renyi_ratio')` {#renyi_ratio} - -Monte Carlo estimate of the ratio appearing in Renyi divergence. - -This can be used to compute the Renyi (alpha) divergence, or a log evidence -approximation based on Renyi divergence. - -#### Definition - -With `z_i` iid samples from `q`, and `exp{log_p(z)} = p(z)`, this `Op` returns -the (biased for finite `n`) estimate: - -``` -(1 - alpha)^{-1} Log[ n^{-1} sum_{i=1}^n ( p(z_i) / q(z_i) )^{1 - alpha}, -\approx (1 - alpha)^{-1} Log[ E_q[ (p(Z) / q(Z))^{1 - alpha} ] ] -``` - -This ratio appears in different contexts: - -#### Renyi divergence - -If `log_p(z) = Log[p(z)]` is the log prob of a distribution, and -`alpha > 0`, `alpha != 1`, this `Op` approximates `-1` times Renyi divergence: - -``` -# Choose reasonably high n to limit bias, see below. -renyi_ratio(log_p, q, alpha, n=100) - \approx -1 * D_alpha[q || p], where -D_alpha[q || p] := (1 - alpha)^{-1} Log E_q[(p(Z) / q(Z))^{1 - alpha}] -``` - -The Renyi (or "alpha") divergence is non-negative and equal to zero iff -`q = p`. Various limits of `alpha` lead to different special case results: - -``` -alpha D_alpha[q || p] ------ --------------- ---> 0 Log[ int_{q > 0} p(z) dz ] -= 0.5, -2 Log[1 - Hel^2[q || p]], (\propto squared Hellinger distance) ---> 1 KL[q || p] -= 2 Log[ 1 + chi^2[q || p] ], (\propto squared Chi-2 divergence) ---> infty Log[ max_z{q(z) / p(z)} ], (min description length principle). -``` - -See "Renyi Divergence Variational Inference", by Li and Turner. - -#### Log evidence approximation - -If `log_p(z) = Log[p(z, x)]` is the log of the joint distribution `p`, this is -an alternative to the ELBO common in variational inference. - -``` -L_alpha(q, p) = Log[p(x)] - D_alpha[q || p] -``` - -If `q` and `p` have the same support, and `0 < a <= b < 1`, one can show -`ELBO <= D_b <= D_a <= Log[p(x)]`. Thus, this `Op` allows a smooth -interpolation between the ELBO and the true evidence. - -#### Stability notes - -Note that when `1 - alpha` is not small, the ratio `(p(z) / q(z))^{1 - alpha}` -is subject to underflow/overflow issues. For that reason, it is evaluated in -log-space after centering. Nonetheless, infinite/NaN results may occur. For -that reason, one may wish to shrink `alpha` gradually. See the `Op` -`renyi_alpha`. Using `float64` will also help. - - -#### Bias for finite sample size - -Due to nonlinearity of the logarithm, for random variables `{X_1,...,X_n}`, -`E[ Log[sum_{i=1}^n X_i] ] != Log[ E[sum_{i=1}^n X_i] ]`. As a result, this -estimate is biased for finite `n`. For `alpha < 1`, it is non-decreasing -with `n` (in expectation). For example, if `n = 1`, this estimator yields the -same result as `elbo_ratio`, and as `n` increases the expected value -of the estimator increases. - -#### Call signature - -User supplies either `Tensor` of samples `z`, or number of samples to draw `n` - -##### Args: - - -* `log_p`: Callable mapping samples from `q` to `Tensors` with - shape broadcastable to `q.batch_shape`. - For example, `log_p` works "just like" `q.log_prob`. -* `q`: `tf.contrib.distributions.Distribution`. - `float64` `dtype` recommended. - `log_p` and `q` should be supported on the same set. -* `alpha`: `Tensor` with shape `q.batch_shape` and values not equal to 1. -* `z`: `Tensor` of samples from `q`, produced by `q.sample` for some `n`. -* `n`: Integer `Tensor`. The number of samples to use if `z` is not provided. - Note that this can be highly biased for small `n`, see docstring. -* `seed`: Python integer to seed the random number generator. -* `name`: A name to give this `Op`. - -##### Returns: - - -* `renyi_result`: The scaled log of sample mean. `Tensor` with `shape` equal - to batch shape of `q`, and `dtype` = `q.dtype`. - - -- - - - -### `tf.contrib.bayesflow.entropy.renyi_alpha(step, decay_time, alpha_min, alpha_max=0.99999, name='renyi_alpha')` {#renyi_alpha} - -Exponentially decaying `Tensor` appropriate for Renyi ratios. - -When minimizing the Renyi divergence for `0 <= alpha < 1` (or maximizing the -Renyi equivalent of elbo) in high dimensions, it is not uncommon to experience -`NaN` and `inf` values when `alpha` is far from `1`. - -For that reason, it is often desirable to start the optimization with `alpha` -very close to 1, and reduce it to a final `alpha_min` according to some -schedule. The user may even want to optimize using `elbo_ratio` for -some fixed time before switching to Renyi based methods. - -This `Op` returns an `alpha` decaying exponentially with step: - -``` -s(step) = (exp{step / decay_time} - 1) / (e - 1) -t(s) = max(0, min(s, 1)), (smooth growth from 0 to 1) -alpha(t) = (1 - t) alpha_min + t alpha_max -``` - -##### Args: - - -* `step`: Non-negative scalar `Tensor`. Typically the global step or an - offset version thereof. -* `decay_time`: Positive scalar `Tensor`. -* `alpha_min`: `float` or `double` `Tensor`. - The minimal, final value of `alpha`, achieved when `step >= decay_time` -* `alpha_max`: `Tensor` of same `dtype` as `alpha_min`. - The maximal, beginning value of `alpha`, achieved when `step == 0` -* `name`: A name to give this `Op`. - -##### Returns: - - -* `alpha`: A `Tensor` of same `dtype` as `alpha_min`. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.bayesflow.monte_carlo.md b/tensorflow/g3doc/api_docs/python/contrib.bayesflow.monte_carlo.md deleted file mode 100644 index 78ed0cb38f..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.bayesflow.monte_carlo.md +++ /dev/null @@ -1,206 +0,0 @@ - - -# BayesFlow Monte Carlo (contrib) -[TOC] - -Monte Carlo integration and helpers. - -## Background - -Monte Carlo integration refers to the practice of estimating an expectation with -a sample mean. For example, given random variable `Z in R^k` with density `p`, -the expectation of function `f` can be approximated like: - -``` -E_p[f(Z)] = \int f(z) p(z) dz - ~ S_n - := n^{-1} \sum_{i=1}^n f(z_i), z_i iid samples from p. -``` - -If `E_p[|f(Z)|] < infinity`, then `S_n --> E_p[f(Z)]` by the strong law of large -numbers. If `E_p[f(Z)^2] < infinity`, then `S_n` is asymptotically normal with -variance `Var[f(Z)] / n`. - -Practitioners of Bayesian statistics often find themselves wanting to estimate -`E_p[f(Z)]` when the distribution `p` is known only up to a constant. For -example, the joint distribution `p(z, x)` may be known, but the evidence -`p(x) = \int p(z, x) dz` may be intractable. In that case, a parameterized -distribution family `q_lambda(z)` may be chosen, and the optimal `lambda` is the -one minimizing the KL divergence between `q_lambda(z)` and -`p(z | x)`. We only know `p(z, x)`, but that is sufficient to find `lambda`. - - -## Log-space evaluation and subtracting the maximum. - -Care must be taken when the random variable lives in a high dimensional space. -For example, the naive importance sample estimate `E_q[f(Z) p(Z) / q(Z)]` -involves the ratio of two terms `p(Z) / q(Z)`, each of which must have tails -dropping off faster than `O(|z|^{-(k + 1)})` in order to have finite integral. -This ratio would often be zero or infinity up to numerical precision. - -For that reason, we write - -``` -Log E_q[ f(Z) p(Z) / q(Z) ] - = Log E_q[ exp{Log[f(Z)] + Log[p(Z)] - Log[q(Z)] - C} ] + C, where -C := Max[ Log[f(Z)] + Log[p(Z)] - Log[q(Z)] ]. -``` - -The maximum value of the exponentiated term will be 0.0, and the expectation -can be evaluated in a stable manner. - -## Ops - -- - - - -### `tf.contrib.bayesflow.monte_carlo.expectation(f, p, z=None, n=None, seed=None, name='expectation')` {#expectation} - -Monte Carlo estimate of an expectation: `E_p[f(Z)]` with sample mean. - -This `Op` returns - -``` -n^{-1} sum_{i=1}^n f(z_i), where z_i ~ p -\approx E_p[f(Z)] -``` - -User supplies either `Tensor` of samples `z`, or number of samples to draw `n` - -##### Args: - - -* `f`: Callable mapping samples from `p` to `Tensors`. -* `p`: `tf.contrib.distributions.Distribution`. -* `z`: `Tensor` of samples from `p`, produced by `p.sample` for some `n`. -* `n`: Integer `Tensor`. Number of samples to generate if `z` is not provided. -* `seed`: Python integer to seed the random number generator. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with the same `dtype` as `p`. - - -* `Example`: - -```python -N_samples = 10000 - -distributions = tf.contrib.distributions - -dist = distributions.Uniform([0.0, 0.0], [1.0, 2.0]) -elementwise_mean = lambda x: x -mean_sum = lambda x: tf.reduce_sum(x, 1) - -estimate_elementwise_mean_tf = monte_carlo.expectation(elementwise_mean, - dist, - n=N_samples) -estimate_mean_sum_tf = monte_carlo.expectation(mean_sum, - dist, - n=N_samples) - -with tf.Session() as sess: - estimate_elementwise_mean, estimate_mean_sum = ( - sess.run([estimate_elementwise_mean_tf, estimate_mean_sum_tf])) -print estimate_elementwise_mean ->>> np.array([ 0.50018013 1.00097895], dtype=np.float32) -print estimate_mean_sum ->>> 1.49571 - -``` - - -- - - - -### `tf.contrib.bayesflow.monte_carlo.expectation_importance_sampler(f, log_p, sampling_dist_q, z=None, n=None, seed=None, name='expectation_importance_sampler')` {#expectation_importance_sampler} - -Monte Carlo estimate of `E_p[f(Z)] = E_q[f(Z) p(Z) / q(Z)]`. - -With `p(z) := exp{log_p(z)}`, this `Op` returns - -``` -n^{-1} sum_{i=1}^n [ f(z_i) p(z_i) / q(z_i) ], z_i ~ q, -\approx E_q[ f(Z) p(Z) / q(Z) ] -= E_p[f(Z)] -``` - -This integral is done in log-space with max-subtraction to better handle the -often extreme values that `f(z) p(z) / q(z)` can take on. - -If `f >= 0`, it is up to 2x more efficient to exponentiate the result of -`expectation_importance_sampler_logspace` applied to `Log[f]`. - -User supplies either `Tensor` of samples `z`, or number of samples to draw `n` - -##### Args: - - -* `f`: Callable mapping samples from `sampling_dist_q` to `Tensors` with shape - broadcastable to `q.batch_shape`. - For example, `f` works "just like" `q.log_prob`. -* `log_p`: Callable mapping samples from `sampling_dist_q` to `Tensors` with - shape broadcastable to `q.batch_shape`. - For example, `log_p` works "just like" `sampling_dist_q.log_prob`. -* `sampling_dist_q`: The sampling distribution. - `tf.contrib.distributions.Distribution`. - `float64` `dtype` recommended. - `log_p` and `q` should be supported on the same set. -* `z`: `Tensor` of samples from `q`, produced by `q.sample` for some `n`. -* `n`: Integer `Tensor`. Number of samples to generate if `z` is not provided. -* `seed`: Python integer to seed the random number generator. -* `name`: A name to give this `Op`. - -##### Returns: - - The importance sampling estimate. `Tensor` with `shape` equal - to batch shape of `q`, and `dtype` = `q.dtype`. - - -- - - - -### `tf.contrib.bayesflow.monte_carlo.expectation_importance_sampler_logspace(log_f, log_p, sampling_dist_q, z=None, n=None, seed=None, name='expectation_importance_sampler_logspace')` {#expectation_importance_sampler_logspace} - -Importance sampling with a positive function, in log-space. - -With `p(z) := exp{log_p(z)}`, and `f(z) = exp{log_f(z)}`, this `Op` -returns - -``` -Log[ n^{-1} sum_{i=1}^n [ f(z_i) p(z_i) / q(z_i) ] ], z_i ~ q, -\approx Log[ E_q[ f(Z) p(Z) / q(Z) ] ] -= Log[E_p[f(Z)]] -``` - -This integral is done in log-space with max-subtraction to better handle the -often extreme values that `f(z) p(z) / q(z)` can take on. - -In contrast to `expectation_importance_sampler`, this `Op` returns values in -log-space. - - -User supplies either `Tensor` of samples `z`, or number of samples to draw `n` - -##### Args: - - -* `log_f`: Callable mapping samples from `sampling_dist_q` to `Tensors` with - shape broadcastable to `q.batch_shape`. - For example, `log_f` works "just like" `sampling_dist_q.log_prob`. -* `log_p`: Callable mapping samples from `sampling_dist_q` to `Tensors` with - shape broadcastable to `q.batch_shape`. - For example, `log_p` works "just like" `q.log_prob`. -* `sampling_dist_q`: The sampling distribution. - `tf.contrib.distributions.Distribution`. - `float64` `dtype` recommended. - `log_p` and `q` should be supported on the same set. -* `z`: `Tensor` of samples from `q`, produced by `q.sample` for some `n`. -* `n`: Integer `Tensor`. Number of samples to generate if `z` is not provided. -* `seed`: Python integer to seed the random number generator. -* `name`: A name to give this `Op`. - -##### Returns: - - Logarithm of the importance sampling estimate. `Tensor` with `shape` equal - to batch shape of `q`, and `dtype` = `q.dtype`. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.bayesflow.stochastic_graph.md b/tensorflow/g3doc/api_docs/python/contrib.bayesflow.stochastic_graph.md deleted file mode 100644 index cd7bba275b..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.bayesflow.stochastic_graph.md +++ /dev/null @@ -1,46 +0,0 @@ - - -# BayesFlow Stochastic Graph (contrib) -[TOC] - -Classes and helper functions for Stochastic Computation Graphs. - -## Stochastic Computation Graph Helper Functions - -- - - - -### `tf.contrib.bayesflow.stochastic_graph.surrogate_loss(sample_losses, stochastic_tensors=None, name='SurrogateLoss')` {#surrogate_loss} - -Surrogate loss for stochastic graphs. - -This function will call `loss_fn` on each `StochasticTensor` -upstream of `sample_losses`, passing the losses that it influenced. - -Note that currently `surrogate_loss` does not work with `StochasticTensor`s -instantiated in `while_loop`s or other control structures. - -##### Args: - - -* `sample_losses`: a list or tuple of final losses. Each loss should be per - example in the batch (and possibly per sample); that is, it should have - dimensionality of 1 or greater. All losses should have the same shape. -* `stochastic_tensors`: a list of `StochasticTensor`s to add loss terms for. - If None, defaults to all `StochasticTensor`s in the graph upstream of - the `Tensor`s in `sample_losses`. -* `name`: the name with which to prepend created ops. - -##### Returns: - - `Tensor` loss, which is the sum of `sample_losses` and the - `loss_fn`s returned by the `StochasticTensor`s. - -##### Raises: - - -* `TypeError`: if `sample_losses` is not a list or tuple, or if its elements - are not `Tensor`s. -* `ValueError`: if any loss in `sample_losses` does not have dimensionality 1 - or greater. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.bayesflow.stochastic_tensor.md b/tensorflow/g3doc/api_docs/python/contrib.bayesflow.stochastic_tensor.md deleted file mode 100644 index a0be205aea..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.bayesflow.stochastic_tensor.md +++ /dev/null @@ -1,467 +0,0 @@ - - -# BayesFlow Stochastic Tensors (contrib) -[TOC] - -Classes and helper functions for creating Stochastic Tensors. - -`StochasticTensor` objects wrap `Distribution` objects. Their -values may be samples from the underlying distribution, or the distribution -mean (as governed by `value_type`). These objects provide a `loss` -method for use when sampling from a non-reparameterized distribution. -The `loss`method is used in conjunction with `stochastic_graph.surrogate_loss` -to produce a single differentiable loss in stochastic graphs having -both continuous and discrete stochastic nodes. - -## Stochastic Tensor Classes - -- - - - -### `class tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor` {#BaseStochasticTensor} - -Base Class for Tensor-like objects that emit stochastic values. -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.__init__()` {#BaseStochasticTensor.__init__} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.dtype` {#BaseStochasticTensor.dtype} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.graph` {#BaseStochasticTensor.graph} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.loss(sample_loss)` {#BaseStochasticTensor.loss} - -Returns the term to add to the surrogate loss. - -This method is called by `surrogate_loss`. The input `sample_loss` should -have already had `stop_gradient` applied to it. This is because the -surrogate_loss usually provides a Monte Carlo sample term of the form -`differentiable_surrogate * sample_loss` where `sample_loss` is considered -constant with respect to the input for purposes of the gradient. - -##### Args: - - -* `sample_loss`: `Tensor`, sample loss downstream of this `StochasticTensor`. - -##### Returns: - - Either `None` or a `Tensor`. - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.name` {#BaseStochasticTensor.name} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.value(name=None)` {#BaseStochasticTensor.value} - - - - - -- - - - -### `class tf.contrib.bayesflow.stochastic_tensor.StochasticTensor` {#StochasticTensor} - -StochasticTensor is a BaseStochasticTensor backed by a distribution. -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.__init__(dist, name='StochasticTensor', dist_value_type=None, loss_fn=score_function)` {#StochasticTensor.__init__} - -Construct a `StochasticTensor`. - -`StochasticTensor` is backed by the `dist` distribution and its `value` -method will return the same value each time it is called. What `value` is -returned is controlled by the `dist_value_type` (defaults to -`SampleValue`). - -Some distributions' sample functions are not differentiable (e.g. a sample -from a discrete distribution like a Bernoulli) and so to differentiate -wrt parameters upstream of the sample requires a gradient estimator like -the score function estimator. This is accomplished by passing a -differentiable `loss_fn` to the `StochasticTensor`, which -defaults to a function whose derivative is the score function estimator. -Calling `stochastic_graph.surrogate_loss(final_losses)` will call -`loss()` on every `StochasticTensor` upstream of final losses. - -`loss()` will return None for `StochasticTensor`s backed by -reparameterized distributions; it will also return None if the value type is -`MeanValueType` or if `loss_fn=None`. - -##### Args: - - -* `dist`: an instance of `Distribution`. -* `name`: a name for this `StochasticTensor` and its ops. -* `dist_value_type`: a `_StochasticValueType`, which will determine what the - `value` of this `StochasticTensor` will be. If not provided, the - value type set with the `value_type` context manager will be used. -* `loss_fn`: callable that takes - `(st, st.value(), influenced_loss)`, where - `st` is this `StochasticTensor`, and returns a `Tensor` loss. By - default, `loss_fn` is the `score_function`, or more precisely, the - integral of the score function, such that when the gradient is taken, - the score function results. See the `stochastic_gradient_estimators` - module for additional loss functions and baselines. - -##### Raises: - - -* `TypeError`: if `dist` is not an instance of `Distribution`. -* `TypeError`: if `loss_fn` is not `callable`. - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.distribution` {#StochasticTensor.distribution} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.dtype` {#StochasticTensor.dtype} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.entropy(name='entropy')` {#StochasticTensor.entropy} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.graph` {#StochasticTensor.graph} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.loss(final_loss, name='Loss')` {#StochasticTensor.loss} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.mean(name='mean')` {#StochasticTensor.mean} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.name` {#StochasticTensor.name} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.value(name='value')` {#StochasticTensor.value} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.value_type` {#StochasticTensor.value_type} - - - - - - -## Stochastic Tensor Value Types - -- - - - -### `class tf.contrib.bayesflow.stochastic_tensor.MeanValue` {#MeanValue} - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.MeanValue.__init__(stop_gradient=False)` {#MeanValue.__init__} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.MeanValue.declare_inputs(unused_stochastic_tensor, unused_inputs_dict)` {#MeanValue.declare_inputs} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.MeanValue.popped_above(unused_value_type)` {#MeanValue.popped_above} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.MeanValue.pushed_above(unused_value_type)` {#MeanValue.pushed_above} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.MeanValue.stop_gradient` {#MeanValue.stop_gradient} - - - - - -- - - - -### `class tf.contrib.bayesflow.stochastic_tensor.SampleValue` {#SampleValue} - -Draw samples, possibly adding new outer dimensions along the way. - -This ValueType draws samples from StochasticTensors run within its -context, increasing the rank according to the requested shape. - -Examples: - -```python -mu = tf.zeros((2,3)) -sigma = tf.ones((2, 3)) -with sg.value_type(sg.SampleValue()): - st = sg.StochasticTensor( - tf.contrib.distributions.Normal, mu=mu, sigma=sigma) -# draws 1 sample and does not reshape -assertEqual(st.value().get_shape(), (2, 3)) -``` - -```python -mu = tf.zeros((2,3)) -sigma = tf.ones((2, 3)) -with sg.value_type(sg.SampleValue(4)): - st = sg.StochasticTensor( - tf.contrib.distributions.Normal, mu=mu, sigma=sigma) -# draws 4 samples each with shape (2, 3) and concatenates -assertEqual(st.value().get_shape(), (4, 2, 3)) -``` -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.SampleValue.__init__(shape=(), stop_gradient=False)` {#SampleValue.__init__} - -Sample according to shape. - -For the given StochasticTensor `st` using this value type, -the shape of `st.value()` will match that of -`st.distribution.sample(shape)`. - -##### Args: - - -* `shape`: A shape tuple or int32 tensor. The sample shape. - Default is a scalar: take one sample and do not change the size. -* `stop_gradient`: If `True`, StochasticTensors' values are wrapped in - `stop_gradient`, to avoid backpropagation through. - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.SampleValue.declare_inputs(unused_stochastic_tensor, unused_inputs_dict)` {#SampleValue.declare_inputs} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.SampleValue.popped_above(unused_value_type)` {#SampleValue.popped_above} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.SampleValue.pushed_above(unused_value_type)` {#SampleValue.pushed_above} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.SampleValue.shape` {#SampleValue.shape} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.SampleValue.stop_gradient` {#SampleValue.stop_gradient} - - - - - - -- - - - -### `tf.contrib.bayesflow.stochastic_tensor.value_type(dist_value_type)` {#value_type} - -Creates a value type context for any StochasticTensor created within. - -Typical usage: - -``` -with sg.value_type(sg.MeanValue(stop_gradients=True)): - st = sg.StochasticTensor(tf.contrib.distributions.Normal, mu=mu, - sigma=sigma) -``` - -In the example above, `st.value()` (or equivalently, `tf.identity(st)`) will -be the mean value of the Normal distribution, i.e., `mu` (possibly -broadcasted to the shape of `sigma`). Furthermore, because the `MeanValue` -was marked with `stop_gradients=True`, this value will have been wrapped -in a `stop_gradients` call to disable any possible backpropagation. - -##### Args: - - -* `dist_value_type`: An instance of `MeanValue`, `SampleValue`, or - any other stochastic value type. - -##### Yields: - - A context for `StochasticTensor` objects that controls the - value created when they are initialized. - -##### Raises: - - -* `TypeError`: if `dist_value_type` is not an instance of a stochastic value - type. - - -- - - - -### `tf.contrib.bayesflow.stochastic_tensor.get_current_value_type()` {#get_current_value_type} - - - - - -## Other Functions and Classes -- - - - -### `class tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor` {#ObservedStochasticTensor} - -A StochasticTensor with an observed value. -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.__init__(dist, value, name=None)` {#ObservedStochasticTensor.__init__} - -Construct an `ObservedStochasticTensor`. - -`ObservedStochasticTensor` is backed by distribution `dist` and uses the -provided value instead of using the current value type to draw a value from -the distribution. The provided value argument must be appropriately shaped -to have come from the distribution. - -##### Args: - - -* `dist`: an instance of `Distribution`. -* `value`: a Tensor containing the observed value -* `name`: a name for this `ObservedStochasticTensor` and its ops. - -##### Raises: - - -* `TypeError`: if `dist` is not an instance of `Distribution`. -* `ValueError`: if `value` is not compatible with the distribution. - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.distribution` {#ObservedStochasticTensor.distribution} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.dtype` {#ObservedStochasticTensor.dtype} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.entropy(name='entropy')` {#ObservedStochasticTensor.entropy} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.graph` {#ObservedStochasticTensor.graph} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.loss(final_loss, name=None)` {#ObservedStochasticTensor.loss} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.mean(name='mean')` {#ObservedStochasticTensor.mean} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.name` {#ObservedStochasticTensor.name} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.value(name='value')` {#ObservedStochasticTensor.value} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.value_type` {#ObservedStochasticTensor.value_type} - - - - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.bayesflow.variational_inference.md b/tensorflow/g3doc/api_docs/python/contrib.bayesflow.variational_inference.md deleted file mode 100644 index 3da4aedcb6..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.bayesflow.variational_inference.md +++ /dev/null @@ -1,171 +0,0 @@ - - -# BayesFlow Variational Inference (contrib) -[TOC] - -Variational inference. - -## Ops - -- - - - -### `tf.contrib.bayesflow.variational_inference.elbo(log_likelihood, variational_with_prior=None, keep_batch_dim=True, form=None, name='ELBO')` {#elbo} - -Evidence Lower BOund. `log p(x) >= ELBO`. - -Optimization objective for inference of hidden variables by variational -inference. - -This function is meant to be used in conjunction with `StochasticTensor`. -The user should build out the inference network, using `StochasticTensor`s -as latent variables, and the generative network. `elbo` at minimum needs -`p(x|Z)` and assumes that all `StochasticTensor`s upstream of `p(x|Z)` are -the variational distributions. Use `register_prior` to register `Distribution` -priors for each `StochasticTensor`. Alternatively, pass in -`variational_with_prior` specifying all variational distributions and their -priors. - -Mathematical details: - -``` -log p(x) = log \int p(x, Z) dZ - = log \int \frac {q(Z)p(x, Z)}{q(Z)} dZ - = log E_q[\frac {p(x, Z)}{q(Z)}] - >= E_q[log \frac {p(x, Z)}{q(Z)}] = L[q; p, x] # ELBO - -L[q; p, x] = E_q[log p(x|Z)p(Z)] - E_q[log q(Z)] - = E_q[log p(x|Z)p(Z)] + H[q] (1) - = E_q[log p(x|Z)] - KL(q || p) (2) - -H - Entropy -KL - Kullback-Leibler divergence -``` - -See section 2.2 of Stochastic Variational Inference by Hoffman et al. for -more, including the ELBO's equivalence to minimizing `KL(q(Z)||p(Z|x))` -in the fully Bayesian setting. https://arxiv.org/pdf/1206.7051.pdf. - -`form` specifies which form of the ELBO is used. `form=ELBOForms.default` -tries, in order of preference: analytic KL, analytic entropy, sampling. - -Multiple entries in the `variational_with_prior` dict implies a factorization. -e.g. `q(Z) = q(z1)q(z2)q(z3)`. - -##### Args: - - -* `log_likelihood`: `Tensor` log p(x|Z). -* `variational_with_prior`: dict from `StochasticTensor` q(Z) to - `Distribution` p(Z). If `None`, defaults to all `StochasticTensor` - objects upstream of `log_likelihood` with priors registered with - `register_prior`. -* `keep_batch_dim`: bool. Whether to keep the batch dimension when summing - entropy/KL term. When the sample is per data point, this should be True; - otherwise (e.g. in a Bayesian NN), this should be False. -* `form`: ELBOForms constant. Controls how the ELBO is computed. Defaults to - ELBOForms.default. -* `name`: name to prefix ops with. - -##### Returns: - - `Tensor` ELBO of the same type and shape as `log_likelihood`. - -##### Raises: - - -* `TypeError`: if variationals in `variational_with_prior` are not - `StochasticTensor`s or if priors are not `Distribution`s. -* `TypeError`: if form is not a valid ELBOForms constant. -* `ValueError`: if `variational_with_prior` is None and there are no - `StochasticTensor`s upstream of `log_likelihood`. -* `ValueError`: if any variational does not have a prior passed or registered. - - -- - - - -### `tf.contrib.bayesflow.variational_inference.elbo_with_log_joint(log_joint, variational=None, keep_batch_dim=True, form=None, name='ELBO')` {#elbo_with_log_joint} - -Evidence Lower BOund. `log p(x) >= ELBO`. - -This method is for models that have computed `p(x,Z)` instead of `p(x|Z)`. -See `elbo` for further details. - -Because only the joint is specified, analytic KL is not available. - -##### Args: - - -* `log_joint`: `Tensor` log p(x, Z). -* `variational`: list of `StochasticTensor` q(Z). If `None`, defaults to all - `StochasticTensor` objects upstream of `log_joint`. -* `keep_batch_dim`: bool. Whether to keep the batch dimension when summing - entropy term. When the sample is per data point, this should be True; - otherwise (e.g. in a Bayesian NN), this should be False. -* `form`: ELBOForms constant. Controls how the ELBO is computed. Defaults to - ELBOForms.default. -* `name`: name to prefix ops with. - -##### Returns: - - `Tensor` ELBO of the same type and shape as `log_joint`. - -##### Raises: - - -* `TypeError`: if variationals in `variational` are not `StochasticTensor`s. -* `TypeError`: if form is not a valid ELBOForms constant. -* `ValueError`: if `variational` is None and there are no `StochasticTensor`s - upstream of `log_joint`. -* `ValueError`: if form is ELBOForms.analytic_kl. - - -- - - - -### `class tf.contrib.bayesflow.variational_inference.ELBOForms` {#ELBOForms} - -Constants to control the `elbo` calculation. - -`analytic_kl` uses the analytic KL divergence between the -variational distribution(s) and the prior(s). - -`analytic_entropy` uses the analytic entropy of the variational -distribution(s). - -`sample` uses the sample KL or the sample entropy is the joint is provided. - -See `elbo` for what is used with `default`. -- - - - -#### `tf.contrib.bayesflow.variational_inference.ELBOForms.check_form(form)` {#ELBOForms.check_form} - - - - - -- - - - -### `tf.contrib.bayesflow.variational_inference.register_prior(variational, prior)` {#register_prior} - -Associate a variational `StochasticTensor` with a `Distribution` prior. - -This is a helper function used in conjunction with `elbo` that allows users -to specify the mapping between variational distributions and their priors -without having to pass in `variational_with_prior` explicitly. - -##### Args: - - -* `variational`: `StochasticTensor` q(Z). Approximating distribution. -* `prior`: `Distribution` p(Z). Prior distribution. - -##### Returns: - - None - -##### Raises: - - -* `ValueError`: if variational is not a `StochasticTensor` or `prior` is not - a `Distribution`. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.copy_graph.md b/tensorflow/g3doc/api_docs/python/contrib.copy_graph.md deleted file mode 100644 index 90c16ce140..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.copy_graph.md +++ /dev/null @@ -1,86 +0,0 @@ - - -# Copying Graph Elements (contrib) -[TOC] - -Functions to copy elements between graphs. - -See the @{$python/contrib.copy_graph} guide. - -## Other Functions and Classes -- - - - -### `tf.contrib.copy_graph.copy_op_to_graph(org_instance, to_graph, variables, scope='')` {#copy_op_to_graph} - -Given an `Operation` 'org_instance` from one `Graph`, -initializes and returns a copy of it from another `Graph`, -under the specified scope (default `""`). - -The copying is done recursively, so any `Operation` whose output -is required to evaluate the `org_instance`, is also copied (unless -already done). - -Since `Variable` instances are copied separately, those required -to evaluate `org_instance` must be provided as input. - -Args: -org_instance: An `Operation` from some `Graph`. Could be a - `Placeholder` as well. -to_graph: The `Graph` to copy `org_instance` to. -variables: An iterable of `Variable` instances to copy `org_instance` to. -scope: A scope for the new `Variable` (default `""`). - -##### Returns: - - The copied `Operation` from `to_graph`. - -##### Raises: - - -* `TypeError`: If `org_instance` is not an `Operation` or `Tensor`. - - -- - - - -### `tf.contrib.copy_graph.copy_variable_to_graph(org_instance, to_graph, scope='')` {#copy_variable_to_graph} - -Given a `Variable` instance from one `Graph`, initializes and returns -a copy of it from another `Graph`, under the specified scope -(default `""`). - -Args: -org_instance: A `Variable` from some `Graph`. -to_graph: The `Graph` to copy the `Variable` to. -scope: A scope for the new `Variable` (default `""`). - -##### Returns: - - The copied `Variable` from `to_graph`. - -##### Raises: - - -* `TypeError`: If `org_instance` is not a `Variable`. - - -- - - - -### `tf.contrib.copy_graph.get_copied_op(org_instance, graph, scope='')` {#get_copied_op} - -Given an `Operation` instance from some `Graph`, returns -its namesake from `graph`, under the specified scope -(default `""`). - -If a copy of `org_instance` is present in `graph` under the given -`scope`, it will be returned. - -Args: -org_instance: An `Operation` from some `Graph`. -graph: The `Graph` to be searched for a copr of `org_instance`. -scope: The scope `org_instance` is present in. - -##### Returns: - - The `Operation` copy from `graph`. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.crf.md b/tensorflow/g3doc/api_docs/python/contrib.crf.md deleted file mode 100644 index 8966bcb38d..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.crf.md +++ /dev/null @@ -1,212 +0,0 @@ - - -# CRF (contrib) -[TOC] - -Linear-chain CRF layer. See the @{$python/contrib.crf} guide. - -- - - - -### `tf.contrib.crf.crf_sequence_score(inputs, tag_indices, sequence_lengths, transition_params)` {#crf_sequence_score} - -Computes the unnormalized score for a tag sequence. - -##### Args: - - -* `inputs`: A [batch_size, max_seq_len, num_tags] tensor of unary potentials - to use as input to the CRF layer. -* `tag_indices`: A [batch_size, max_seq_len] matrix of tag indices for which we - compute the unnormalized score. -* `sequence_lengths`: A [batch_size] vector of true sequence lengths. -* `transition_params`: A [num_tags, num_tags] transition matrix. - -##### Returns: - - -* `sequence_scores`: A [batch_size] vector of unnormalized sequence scores. - - -- - - - -### `tf.contrib.crf.crf_log_norm(inputs, sequence_lengths, transition_params)` {#crf_log_norm} - -Computes the normalization for a CRF. - -##### Args: - - -* `inputs`: A [batch_size, max_seq_len, num_tags] tensor of unary potentials - to use as input to the CRF layer. -* `sequence_lengths`: A [batch_size] vector of true sequence lengths. -* `transition_params`: A [num_tags, num_tags] transition matrix. - -##### Returns: - - -* `log_norm`: A [batch_size] vector of normalizers for a CRF. - - -- - - - -### `tf.contrib.crf.crf_log_likelihood(inputs, tag_indices, sequence_lengths, transition_params=None)` {#crf_log_likelihood} - -Computes the log-likelihood of tag sequences in a CRF. - -##### Args: - - -* `inputs`: A [batch_size, max_seq_len, num_tags] tensor of unary potentials - to use as input to the CRF layer. -* `tag_indices`: A [batch_size, max_seq_len] matrix of tag indices for which we - compute the log-likelihood. -* `sequence_lengths`: A [batch_size] vector of true sequence lengths. -* `transition_params`: A [num_tags, num_tags] transition matrix, if available. - -##### Returns: - - -* `log_likelihood`: A scalar containing the log-likelihood of the given sequence - of tag indices. -* `transition_params`: A [num_tags, num_tags] transition matrix. This is either - provided by the caller or created in this function. - - -- - - - -### `tf.contrib.crf.crf_unary_score(tag_indices, sequence_lengths, inputs)` {#crf_unary_score} - -Computes the unary scores of tag sequences. - -##### Args: - - -* `tag_indices`: A [batch_size, max_seq_len] matrix of tag indices. -* `sequence_lengths`: A [batch_size] vector of true sequence lengths. -* `inputs`: A [batch_size, max_seq_len, num_tags] tensor of unary potentials. - -##### Returns: - - -* `unary_scores`: A [batch_size] vector of unary scores. - - -- - - - -### `tf.contrib.crf.crf_binary_score(tag_indices, sequence_lengths, transition_params)` {#crf_binary_score} - -Computes the binary scores of tag sequences. - -##### Args: - - -* `tag_indices`: A [batch_size, max_seq_len] matrix of tag indices. -* `sequence_lengths`: A [batch_size] vector of true sequence lengths. -* `transition_params`: A [num_tags, num_tags] matrix of binary potentials. - -##### Returns: - - -* `binary_scores`: A [batch_size] vector of binary scores. - - -- - - - -### `class tf.contrib.crf.CrfForwardRnnCell` {#CrfForwardRnnCell} - -Computes the alpha values in a linear-chain CRF. - -See http://www.cs.columbia.edu/~mcollins/fb.pdf for reference. -- - - - -#### `tf.contrib.crf.CrfForwardRnnCell.__call__(inputs, state, scope=None)` {#CrfForwardRnnCell.__call__} - -Build the CrfForwardRnnCell. - -##### Args: - - -* `inputs`: A [batch_size, num_tags] matrix of unary potentials. -* `state`: A [batch_size, num_tags] matrix containing the previous alpha - values. -* `scope`: Unused variable scope of this cell. - -##### Returns: - - new_alphas, new_alphas: A pair of [batch_size, num_tags] matrices - values containing the new alpha values. - - -- - - - -#### `tf.contrib.crf.CrfForwardRnnCell.__init__(transition_params)` {#CrfForwardRnnCell.__init__} - -Initialize the CrfForwardRnnCell. - -##### Args: - - -* `transition_params`: A [num_tags, num_tags] matrix of binary potentials. - This matrix is expanded into a [1, num_tags, num_tags] in preparation - for the broadcast summation occurring within the cell. - - -- - - - -#### `tf.contrib.crf.CrfForwardRnnCell.output_size` {#CrfForwardRnnCell.output_size} - - - - -- - - - -#### `tf.contrib.crf.CrfForwardRnnCell.state_size` {#CrfForwardRnnCell.state_size} - - - - -- - - - -#### `tf.contrib.crf.CrfForwardRnnCell.zero_state(batch_size, dtype)` {#CrfForwardRnnCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `tf.contrib.crf.viterbi_decode(score, transition_params)` {#viterbi_decode} - -Decode the highest scoring sequence of tags outside of TensorFlow. - -This should only be used at test time. - -##### Args: - - -* `score`: A [seq_len, num_tags] matrix of unary potentials. -* `transition_params`: A [num_tags, num_tags] matrix of binary potentials. - -##### Returns: - - -* `viterbi`: A [seq_len] list of integers containing the highest scoring tag - indicies. -* `viterbi_score`: A float containing the score for the Viterbi sequence. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.distributions.bijector.md b/tensorflow/g3doc/api_docs/python/contrib.distributions.bijector.md deleted file mode 100644 index e66fd67d50..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.distributions.bijector.md +++ /dev/null @@ -1,4336 +0,0 @@ - - -# Random variable transformations (contrib) -[TOC] - -Bijector Ops. See the @{$python/contrib.distributions.bijector} guide. - -- - - - -### `class tf.contrib.distributions.bijector.Affine` {#Affine} - -Compute `Y = g(X; shift, scale) = scale @ X + shift`. - -Here `scale = c * I + diag(D1) + tril(L) + V @ diag(D2) @ V.T`. - -In TF parlance, the `scale` term is logically equivalent to: - -```python -scale = ( - scale_identity_multiplier * tf.diag(tf.ones(d)) + - tf.diag(scale_diag) + - scale_tril + - scale_perturb_factor @ diag(scale_perturb_diag) @ - tf.transpose([scale_perturb_factor]) -) -``` - -The `scale` term is applied without necessarily materializing constituent -matrices, i.e., the matmul is [matrix-free]( -https://en.wikipedia.org/wiki/Matrix-free_methods) when possible. - -Examples: - -```python -# Y = X -b = Affine() - -# Y = X + shift -b = Affine(shift=[1., 2, 3]) - -# Y = 2 * I @ X.T + shift -b = Affine(shift=[1., 2, 3], - scale_identity_multiplier=2.) - -# Y = tf.diag(d1) @ X.T + shift -b = Affine(shift=[1., 2, 3], - scale_diag=[-1., 2, 1]) # Implicitly 3x3. - -# Y = (I + v * v.T) @ X.T + shift -b = Affine(shift=[1., 2, 3], - scale_perturb_factor=[[1., 0], - [0, 1], - [1, 1]]) - -# Y = (diag(d1) + v * diag(d2) * v.T) @ X.T + shift -b = Affine(shift=[1., 2, 3], - scale_diag=[1., 3, 3], # Implicitly 3x3. - scale_perturb_diag=[2., 1], # Implicitly 2x2. - scale_perturb_factor=[[1., 0], - [0, 1], - [1, 1]]) - -``` -- - - - -#### `tf.contrib.distributions.bijector.Affine.__init__(shift=None, scale_identity_multiplier=None, scale_diag=None, scale_tril=None, scale_perturb_factor=None, scale_perturb_diag=None, event_ndims=1, validate_args=False, name='affine')` {#Affine.__init__} - -Instantiates the `Affine` bijector. - -This `Bijector` is initialized with `shift` `Tensor` and `scale` arguments, -giving the forward operation: - -```none -Y = g(X) = scale @ X + shift -``` - -where the `scale` term is logically equivalent to: - -```python -scale = ( - scale_identity_multiplier * tf.diag(tf.ones(d)) + - tf.diag(scale_diag) + - scale_tril + - scale_perturb_factor @ diag(scale_perturb_diag) @ - tf.transpose([scale_perturb_factor]) -) -``` - -If none of `scale_identity_multiplier`, `scale_diag`, or `scale_tril` are -specified then `scale += IdentityMatrix`. Otherwise specifying a -`scale` argument has the semantics of `scale += Expand(arg)`, i.e., -`scale_diag != None` means `scale += tf.diag(scale_diag)`. - -##### Args: - - -* `shift`: Floating-point `Tensor`. If this is set to `None`, no shift is - applied. -* `scale_identity_multiplier`: floating point rank 0 `Tensor` representing a - scaling done to the identity matrix. - When `scale_identity_multiplier = scale_diag = scale_tril = None` then - `scale += IdentityMatrix`. Otherwise no scaled-identity-matrix is added - to `scale`. -* `scale_diag`: Floating-point `Tensor` representing the diagonal matrix. - `scale_diag` has shape [N1, N2, ... k], which represents a k x k - diagonal matrix. - When `None` no diagonal term is added to `scale`. -* `scale_tril`: Floating-point `Tensor` representing the diagonal matrix. - `scale_diag` has shape [N1, N2, ... k, k], which represents a k x k - lower triangular matrix. - When `None` no `scale_tril` term is added to `scale`. - The upper triangular elements above the diagonal are ignored. -* `scale_perturb_factor`: Floating-point `Tensor` representing factor matrix - with last two dimensions of shape `(k, r)`. When `None`, no rank-r - update is added to `scale`. -* `scale_perturb_diag`: Floating-point `Tensor` representing the diagonal - matrix. `scale_perturb_diag` has shape [N1, N2, ... r], which - represents an `r x r` diagonal matrix. When `None` low rank updates will - take the form `scale_perturb_factor * scale_perturb_factor.T`. -* `event_ndims`: Scalar `int32` `Tensor` indicating the number of dimensions - associated with a particular draw from the distribution. Must be 0 or 1. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str` name given to ops managed by this object. - -##### Raises: - - -* `ValueError`: if `perturb_diag` is specified but not `perturb_factor`. -* `TypeError`: if `shift` has different `dtype` from `scale` arguments. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.dtype` {#Affine.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.event_ndims` {#Affine.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.forward(x, name='forward')` {#Affine.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.forward_event_shape(input_shape)` {#Affine.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Affine.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Affine.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.graph_parents` {#Affine.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.inverse(y, name='inverse')` {#Affine.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Affine.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.inverse_event_shape(output_shape)` {#Affine.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Affine.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Affine.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.is_constant_jacobian` {#Affine.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.name` {#Affine.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.scale` {#Affine.scale} - -The `scale` `LinearOperator` in `Y = scale @ X + shift`. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.shift` {#Affine.shift} - -The `shift` `Tensor` in `Y = scale @ X + shift`. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.validate_args` {#Affine.validate_args} - -Returns True if Tensor arguments will be validated. - - - -- - - - -### `class tf.contrib.distributions.bijector.AffineLinearOperator` {#AffineLinearOperator} - -Compute `Y = g(X; shift, scale) = scale @ X + shift`. - -`shift` is a numeric `Tensor` and `scale` is a `LinearOperator`. - -If `X` is a scalar then the forward transformation is: `scale * X + shift` -where `*` denotes the scalar product. - -Note: we don't always simply transpose `X` (but write it this way for -brevity). Actually the input `X` undergoes the following transformation -before being premultiplied by `scale`: - -1. If there are no sample dims, we call `X = tf.expand_dims(X, 0)`, i.e., - `new_sample_shape = [1]`. Otherwise do nothing. -2. The sample shape is flattened to have one dimension, i.e., - `new_sample_shape = [n]` where `n = tf.reduce_prod(old_sample_shape)`. -3. The sample dim is cyclically rotated left by 1, i.e., - `new_shape = [B1,...,Bb, k, n]` where `n` is as above, `k` is the - event_shape, and `B1,...,Bb` are the batch shapes for each of `b` batch - dimensions. - -(For more details see `shape.make_batch_of_event_sample_matrices`.) - -The result of the above transformation is that `X` can be regarded as a batch -of matrices where each column is a draw from the distribution. After -premultiplying by `scale`, we take the inverse of this procedure. The input -`Y` also undergoes the same transformation before/after premultiplying by -`inv(scale)`. - -Example Use: - -```python -linalg = tf.contrib.linalg - -x = [1., 2, 3] - -shift = [-1., 0., 1] -diag = [1., 2, 3] -scale = linalg.LinearOperatorDiag(diag) -affine = AffineLinearOperator(shift, scale) -# In this case, `forward` is equivalent to: -# y = scale @ x + shift -y = affine.forward(x) # [0., 4, 10] - -shift = [2., 3, 1] -tril = [[1., 0, 0], - [2, 1, 0], - [3, 2, 1]] -scale = linalg.LinearOperatorTriL(tril) -affine = AffineLinearOperator(shift, scale) -# In this case, `forward` is equivalent to: -# np.squeeze(np.matmul(tril, np.expand_dims(x, -1)), -1) + shift -y = affine.forward(x) # [3., 7, 11] -``` -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.__init__(shift=None, scale=None, event_ndims=1, validate_args=False, name='affine_linear_operator')` {#AffineLinearOperator.__init__} - -Instantiates the `AffineLinearOperator` bijector. - -##### Args: - - -* `shift`: Floating-point `Tensor`. -* `scale`: Subclass of `LinearOperator`. Represents the (batch) positive - definite matrix `M` in `R^{k x k}`. -* `event_ndims`: Scalar `integer` `Tensor` indicating the number of dimensions - associated with a particular draw from the distribution. Must be 0 or 1. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str` name given to ops managed by this object. - -##### Raises: - - -* `ValueError`: if `event_ndims` is not 0 or 1. -* `TypeError`: if `scale` is not a `LinearOperator`. -* `TypeError`: if `shift.dtype` does not match `scale.dtype`. -* `ValueError`: if not `scale.is_non_singular`. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.dtype` {#AffineLinearOperator.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.event_ndims` {#AffineLinearOperator.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.forward(x, name='forward')` {#AffineLinearOperator.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.forward_event_shape(input_shape)` {#AffineLinearOperator.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#AffineLinearOperator.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#AffineLinearOperator.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.graph_parents` {#AffineLinearOperator.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.inverse(y, name='inverse')` {#AffineLinearOperator.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#AffineLinearOperator.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.inverse_event_shape(output_shape)` {#AffineLinearOperator.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#AffineLinearOperator.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#AffineLinearOperator.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.is_constant_jacobian` {#AffineLinearOperator.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.name` {#AffineLinearOperator.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.scale` {#AffineLinearOperator.scale} - -The `scale` `LinearOperator` in `Y = scale @ X + shift`. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.shift` {#AffineLinearOperator.shift} - -The `shift` `Tensor` in `Y = scale @ X + shift`. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.validate_args` {#AffineLinearOperator.validate_args} - -Returns True if Tensor arguments will be validated. - - - -- - - - -### `class tf.contrib.distributions.bijector.Bijector` {#Bijector} - -Interface for transforming a `Distribution` sample. - -A `Bijector` implements a -[diffeomorphism](https://en.wikipedia.org/wiki/Diffeomorphism), i.e., a -bijective, differentiable function. A `Bijector` is used by -`TransformedDistribution` but can be generally used for transforming a -`Distribution` generated `Tensor`. A `Bijector` is characterized by three -operations: - -1. Forward Evaluation - - Useful for turning one random outcome into another random outcome from a - different distribution. - -2. Inverse Evaluation - - Useful for "reversing" a transformation to compute one probability in - terms of another. - -3. (log o det o Jacobian o inverse)(x) - - "The log of the determinant of the matrix of all first-order partial - derivatives of the inverse function." - Useful for inverting a transformation to compute one probability in terms - of another. Geometrically, the det(Jacobian) is the volume of the - transformation and is used to scale the probability. - -By convention, transformations of random variables are named in terms of the -forward transformation. The forward transformation creates samples, the -inverse is useful for computing probabilities. - -Example Use: - - - Basic properties: - - ```python - x = ... # A tensor. - # Evaluate forward transformation. - fwd_x = my_bijector.forward(x) - x == my_bijector.inverse(fwd_x) - x != my_bijector.forward(fwd_x) # Not equal because g(x) != g(g(x)). - ``` - - - Computing a log-likelihood: - - ```python - def transformed_log_prob(bijector, log_prob, x): - return (bijector.inverse_log_det_jacobian(x) + - log_prob(bijector.inverse(x))) - ``` - - - Transforming a random outcome: - - ```python - def transformed_sample(bijector, x): - return bijector.forward(x) - ``` - -Example transformations: - - - "Exponential" - - ``` - Y = g(X) = exp(X) - X ~ Normal(0, 1) # Univariate. - ``` - - Implies: - - ``` - g^{-1}(Y) = log(Y) - |Jacobian(g^{-1})(y)| = 1 / y - Y ~ LogNormal(0, 1), i.e., - prob(Y=y) = |Jacobian(g^{-1})(y)| * prob(X=g^{-1}(y)) - = (1 / y) Normal(log(y); 0, 1) - ``` - - Here is an example of how one might implement the `Exp` bijector: - - ``` - class Exp(Bijector): - def __init__(self, event_ndims=0, validate_args=False, name="exp"): - super(Exp, self).__init__(event_ndims=event_ndims, - validate_args=validate_args, name=name) - def _forward(self, x): - return math_ops.exp(x) - def _inverse_and_inverse_log_det_jacobian(self, y): - x = math_ops.log(y) - return x, -self._forward_log_det_jacobian(x) - def _forward_log_det_jacobian(self, x): - if self.event_ndims is None: - raise ValueError("Jacobian requires known event_ndims.") - event_dims = array_ops.shape(x)[-self.event_ndims:] - return math_ops.reduce_sum(x, axis=event_dims) - ``` - - - "Affine" - - ``` - Y = g(X) = sqrtSigma * X + mu - X ~ MultivariateNormal(0, I_d) - ``` - - Implies: - - ``` - g^{-1}(Y) = inv(sqrtSigma) * (Y - mu) - |Jacobian(g^{-1})(y)| = det(inv(sqrtSigma)) - Y ~ MultivariateNormal(mu, sqrtSigma) , i.e., - prob(Y=y) = |Jacobian(g^{-1})(y)| * prob(X=g^{-1}(y)) - = det(sqrtSigma)^(-d) * - MultivariateNormal(inv(sqrtSigma) * (y - mu); 0, I_d) - ``` - -Example of why a `Bijector` needs to understand sample, batch, event -partitioning: - -- Consider the `Exp` `Bijector` applied to a `Tensor` which has sample, batch, - and event (S, B, E) shape semantics. Suppose the `Tensor`'s - partitioned-shape is `(S=[4], B=[2], E=[3, 3])`. - - For `Exp`, the shape of the `Tensor` returned by `forward` and `inverse` is - unchanged, i.e., `[4, 2, 3, 3]`. However the shape returned by - `inverse_log_det_jacobian` is `[4, 2]` because the Jacobian is a reduction - over the event dimensions. - -Subclass Requirements: - -- Typically subclasses implement `_forward` and one or both of: - - `_inverse`, `_inverse_log_det_jacobian`, - - `_inverse_and_inverse_log_det_jacobian`. - -- If the `Bijector`'s use is limited to `TransformedDistribution` (or friends - like `QuantizedDistribution`) then depending on your use, you may not need - to implement all of `_forward` and `_inverse` functions. Examples: - 1. Sampling (e.g., `sample`) only requires `_forward`. - 2. Probability functions (e.g., `prob`, `cdf`, `survival`) only require - `_inverse` (and related). - 3. Only calling probability functions on the output of `sample` means - `_inverse` can be implemented as a cache lookup. - - See `Example Use` [above] which shows how these functions are used to - transform a distribution. (Note: `_forward` could theoretically be - implemented as a cache lookup but this would require controlling the - underlying sample generation mechanism.) - -- If computation can be shared among `_inverse` and - `_inverse_log_det_jacobian` it is preferable to implement - `_inverse_and_inverse_log_det_jacobian`. This usually reduces - graph-construction overhead because a `Distribution`'s implementation of - `log_prob` will need to evaluate both the inverse Jacobian as well as the - inverse function. - -- If an additional use case needs just `inverse` or just - `inverse_log_det_jacobian` then he or she may also wish to implement these - functions to avoid computing the `inverse_log_det_jacobian` or the - `inverse`, respectively. - -- Subclasses should implement `_forward_event_shape`, - `_forward_event_shape_tensor` (and `inverse` counterparts) if the - transformation is shape-changing. By default the event-shape is assumed - unchanged from input. - -Tips for implementing `_inverse` and `_inverse_log_det_jacobian`: - -- As case 3 [above] indicates, under some circumstances the inverse function - can be implemented as a cache lookup. - -- The inverse `log o det o Jacobian` can be implemented as the negative of the - forward `log o det o Jacobian`. This is useful if the `inverse` is - implemented as a cache or the inverse Jacobian is computationally more - expensive (e.g., `CholeskyOuterProduct` `Bijector`). The following - demonstrates the suggested implementation. - - ```python - def _inverse_and_log_det_jacobian(self, y): - x = ... # implement inverse, possibly via cache. - return x, -self._forward_log_det_jac(x) # Note negation. - ``` - - By overriding the `_inverse_and_log_det_jacobian` function we have access to - the inverse in one call. - - The correctness of this approach can be seen from the following claim. - - - Claim: - - Assume `Y=g(X)` is a bijection whose derivative exists and is nonzero - for its domain, i.e., `d/dX g(X)!=0`. Then: - - ```none - (log o det o jacobian o g^{-1})(Y) = -(log o det o jacobian o g)(X) - ``` - - - Proof: - - From the bijective, nonzero differentiability of `g`, the - [inverse function theorem]( - https://en.wikipedia.org/wiki/Inverse_function_theorem) - implies `g^{-1}` is differentiable in the image of `g`. - Applying the chain rule to `y = g(x) = g(g^{-1}(y))` yields - `I = g'(g^{-1}(y))*g^{-1}'(y)`. - The same theorem also implies `g{-1}'` is non-singular therefore: - `inv[ g'(g^{-1}(y)) ] = g^{-1}'(y)`. - The claim follows from [properties of determinant]( -https://en.wikipedia.org/wiki/Determinant#Multiplicativity_and_matrix_groups). - -- If possible, prefer a direct implementation of the inverse Jacobian. This - should have superior numerical stability and will often share subgraphs with - the `_inverse` implementation. -- - - - -#### `tf.contrib.distributions.bijector.Bijector.__init__(event_ndims=None, graph_parents=None, is_constant_jacobian=False, validate_args=False, dtype=None, name=None)` {#Bijector.__init__} - -Constructs Bijector. - -A `Bijector` transforms random variables into new random variables. - -Examples: - -```python -# Create the Y = g(X) = X transform which operates on vector events. -identity = Identity(event_ndims=1) - -# Create the Y = g(X) = exp(X) transform which operates on matrices. -exp = Exp(event_ndims=2) -``` - -See `Bijector` subclass docstring for more details and specific examples. - -##### Args: - - -* `event_ndims`: number of dimensions associated with event coordinates. -* `graph_parents`: Python list of graph prerequisites of this `Bijector`. -* `is_constant_jacobian`: Python `bool` indicating that the Jacobian is not a - function of the input. -* `validate_args`: Python `bool`, default `False`. Whether to validate input - with asserts. If `validate_args` is `False`, and the inputs are invalid, - correct behavior is not guaranteed. -* `dtype`: `tf.dtype` supported by this `Bijector`. `None` means dtype is not - enforced. -* `name`: The name to give Ops created by the initializer. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.dtype` {#Bijector.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.event_ndims` {#Bijector.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.forward(x, name='forward')` {#Bijector.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.forward_event_shape(input_shape)` {#Bijector.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Bijector.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Bijector.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.graph_parents` {#Bijector.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.inverse(y, name='inverse')` {#Bijector.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Bijector.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.inverse_event_shape(output_shape)` {#Bijector.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Bijector.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Bijector.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.is_constant_jacobian` {#Bijector.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.name` {#Bijector.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.validate_args` {#Bijector.validate_args} - -Returns True if Tensor arguments will be validated. - - - -- - - - -### `class tf.contrib.distributions.bijector.Chain` {#Chain} - -Bijector which applies a sequence of bijectors. - -Example Use: - -```python -chain = Chain([Exp(), Softplus()], name="one_plus_exp") -``` - -Results in: - -* Forward: - - ```python - exp = Exp() - softplus = Softplus() - Chain([exp, softplus]).forward(x) - = exp.forward(softplus.forward(x)) - = tf.exp(tf.log(1. + tf.exp(x))) - = 1. + tf.exp(x) - ``` - -* Inverse: - - ```python - exp = Exp() - softplus = Softplus() - Chain([exp, softplus]).inverse(y) - = softplus.inverse(exp.inverse(y)) - = tf.log(tf.exp(tf.log(y)) - 1.) - = tf.log(y - 1.) - ``` -- - - - -#### `tf.contrib.distributions.bijector.Chain.__init__(bijectors=(), validate_args=False, name=None)` {#Chain.__init__} - -Instantiates `Chain` bijector. - -##### Args: - - -* `bijectors`: Python list of bijector instances. An empty list makes this - bijector equivalent to the `Identity` bijector. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str`, name given to ops managed by this object. Default: - E.g., `Chain([Exp(), Softplus()]).name == "chain_of_exp_of_softplus"`. - -##### Raises: - - -* `ValueError`: if bijectors have different dtypes. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.bijectors` {#Chain.bijectors} - - - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.dtype` {#Chain.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.event_ndims` {#Chain.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.forward(x, name='forward')` {#Chain.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.forward_event_shape(input_shape)` {#Chain.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Chain.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Chain.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.graph_parents` {#Chain.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.inverse(y, name='inverse')` {#Chain.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Chain.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.inverse_event_shape(output_shape)` {#Chain.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Chain.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Chain.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.is_constant_jacobian` {#Chain.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.name` {#Chain.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.validate_args` {#Chain.validate_args} - -Returns True if Tensor arguments will be validated. - - - -- - - - -### `class tf.contrib.distributions.bijector.CholeskyOuterProduct` {#CholeskyOuterProduct} - -Compute `g(X) = X @ X.T`; X is lower-triangular, positive-diagonal matrix. - -`event_ndims` must be 0 or 2, i.e., scalar or matrix. - -Note: the upper-triangular part of X is ignored (whether or not its zero). - -Examples: - -```python -bijector.CholeskyOuterProduct(event_ndims=2).forward(x=[[1., 0], [2, 1]]) -# Result: [[1., 2], [2, 5]], i.e., x @ x.T - -bijector.CholeskyOuterProduct(event_ndims=2).inverse(y=[[1., 2], [2, 5]]) -# Result: [[1., 0], [2, 1]], i.e., cholesky(y). -``` -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.__init__(event_ndims=2, validate_args=False, name='cholesky_outer_product')` {#CholeskyOuterProduct.__init__} - -Instantiates the `CholeskyOuterProduct` bijector. - -##### Args: - - -* `event_ndims`: `constant` `int32` scalar `Tensor` indicating the number of - dimensions associated with a particular draw from the distribution. Must - be 0 or 2. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str` name given to ops managed by this object. - -##### Raises: - - -* `ValueError`: if event_ndims is neither 0 or 2. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.dtype` {#CholeskyOuterProduct.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.event_ndims` {#CholeskyOuterProduct.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.forward(x, name='forward')` {#CholeskyOuterProduct.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.forward_event_shape(input_shape)` {#CholeskyOuterProduct.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#CholeskyOuterProduct.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#CholeskyOuterProduct.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.graph_parents` {#CholeskyOuterProduct.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.inverse(y, name='inverse')` {#CholeskyOuterProduct.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#CholeskyOuterProduct.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.inverse_event_shape(output_shape)` {#CholeskyOuterProduct.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#CholeskyOuterProduct.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#CholeskyOuterProduct.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.is_constant_jacobian` {#CholeskyOuterProduct.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.name` {#CholeskyOuterProduct.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.validate_args` {#CholeskyOuterProduct.validate_args} - -Returns True if Tensor arguments will be validated. - - - -- - - - -### `class tf.contrib.distributions.bijector.Exp` {#Exp} - -Compute `Y = g(X) = exp(X)`. - -Example Use: - -```python -# Create the Y=g(X)=exp(X) transform which works only on Tensors with 1 -# batch ndim and 2 event ndims (i.e., vector of matrices). -exp = Exp(event_ndims=2) -x = [[[1., 2], - [3, 4]], - [[5, 6], - [7, 8]]] -exp(x) == exp.forward(x) -log(x) == exp.inverse(x) -``` - -Note: the exp(.) is applied element-wise but the Jacobian is a reduction -over the event space. -- - - - -#### `tf.contrib.distributions.bijector.Exp.__init__(event_ndims=0, validate_args=False, name='exp')` {#Exp.__init__} - -Instantiates the `Exp` bijector. - -##### Args: - - -* `event_ndims`: Scalar `int32` `Tensor` indicating the number of dimensions - associated with a particular draw from the distribution. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str` name given to ops managed by this object. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.dtype` {#Exp.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.event_ndims` {#Exp.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.forward(x, name='forward')` {#Exp.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.forward_event_shape(input_shape)` {#Exp.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Exp.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Exp.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.graph_parents` {#Exp.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.inverse(y, name='inverse')` {#Exp.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Exp.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.inverse_event_shape(output_shape)` {#Exp.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Exp.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Exp.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.is_constant_jacobian` {#Exp.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.name` {#Exp.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.power` {#Exp.power} - -The `c` in: `Y = g(X) = (1 + X * c)**(1 / c)`. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.validate_args` {#Exp.validate_args} - -Returns True if Tensor arguments will be validated. - - - -- - - - -### `class tf.contrib.distributions.bijector.Identity` {#Identity} - -Compute Y = g(X) = X. - -Example Use: - -```python -# Create the Y=g(X)=X transform which is intended for Tensors with 1 batch -# ndim and 1 event ndim (i.e., vector of vectors). -identity = Identity(event_ndims=1) -x = [[1., 2], - [3, 4]] -x == identity.forward(x) == identity.inverse(x) -``` -- - - - -#### `tf.contrib.distributions.bijector.Identity.__init__(validate_args=False, event_ndims=0, name='identity')` {#Identity.__init__} - - - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.dtype` {#Identity.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.event_ndims` {#Identity.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.forward(x, name='forward')` {#Identity.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.forward_event_shape(input_shape)` {#Identity.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Identity.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Identity.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.graph_parents` {#Identity.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.inverse(y, name='inverse')` {#Identity.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Identity.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.inverse_event_shape(output_shape)` {#Identity.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Identity.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Identity.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.is_constant_jacobian` {#Identity.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.name` {#Identity.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.validate_args` {#Identity.validate_args} - -Returns True if Tensor arguments will be validated. - - - -- - - - -### `class tf.contrib.distributions.bijector.Inline` {#Inline} - -Bijector constructed from custom callables. - -Example Use: - -```python -exp = Inline( - forward_fn=tf.exp, - inverse_fn=tf.log, - inverse_log_det_jacobian_fn=( - lambda y: -tf.reduce_sum(tf.log(y), axis=-1)), - name="exp") -``` - -The above example is equivalent to the `Bijector` `Exp(event_ndims=1)`. -- - - - -#### `tf.contrib.distributions.bijector.Inline.__init__(forward_fn=None, inverse_fn=None, inverse_log_det_jacobian_fn=None, forward_log_det_jacobian_fn=None, forward_event_shape_fn=None, forward_event_shape_tensor_fn=None, inverse_event_shape_fn=None, inverse_event_shape_tensor_fn=None, is_constant_jacobian=False, validate_args=False, name='inline')` {#Inline.__init__} - -Creates a `Bijector` from callables. - -##### Args: - - -* `forward_fn`: Python callable implementing the forward transformation. -* `inverse_fn`: Python callable implementing the inverse transformation. -* `inverse_log_det_jacobian_fn`: Python callable implementing the - log o det o jacobian of the inverse transformation. -* `forward_log_det_jacobian_fn`: Python callable implementing the - log o det o jacobian of the forward transformation. -* `forward_event_shape_fn`: Python callable implementing non-identical - static event shape changes. Default: shape is assumed unchanged. -* `forward_event_shape_tensor_fn`: Python callable implementing non-identical - event shape changes. Default: shape is assumed unchanged. -* `inverse_event_shape_fn`: Python callable implementing non-identical - static event shape changes. Default: shape is assumed unchanged. -* `inverse_event_shape_tensor_fn`: Python callable implementing non-identical - event shape changes. Default: shape is assumed unchanged. -* `is_constant_jacobian`: Python `bool` indicating that the Jacobian is - constant for all input arguments. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str`, name given to ops managed by this object. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.dtype` {#Inline.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.event_ndims` {#Inline.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.forward(x, name='forward')` {#Inline.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.forward_event_shape(input_shape)` {#Inline.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Inline.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Inline.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.graph_parents` {#Inline.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.inverse(y, name='inverse')` {#Inline.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Inline.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.inverse_event_shape(output_shape)` {#Inline.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Inline.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Inline.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.is_constant_jacobian` {#Inline.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.name` {#Inline.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.validate_args` {#Inline.validate_args} - -Returns True if Tensor arguments will be validated. - - - -- - - - -### `class tf.contrib.distributions.bijector.Invert` {#Invert} - -Bijector which inverts another Bijector. - -Example Use: [ExpGammaDistribution (see Background & Context)]( -https://reference.wolfram.com/language/ref/ExpGammaDistribution.html) -models `Y=log(X)` where `X ~ Gamma`. - -```python -exp_gamma_distribution = TransformedDistribution( - distribution=Gamma(concentration=1., rate=2.), - bijector=bijector.Invert(bijector.Exp()) -``` -- - - - -#### `tf.contrib.distributions.bijector.Invert.__init__(bijector, validate_args=False, name=None)` {#Invert.__init__} - -Creates a `Bijector` which swaps the meaning of `inverse` and `forward`. - -Note: An inverted bijector's `inverse_log_det_jacobian` is often more -efficient if the base bijector implements `_forward_log_det_jacobian`. If -`_forward_log_det_jacobian` is not implemented then the following code is -used: - -```python -y = self.inverse(x, **kwargs) -return -self.inverse_log_det_jacobian(y, **kwargs) -``` - -##### Args: - - -* `bijector`: Bijector instance. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str`, name given to ops managed by this object. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.bijector` {#Invert.bijector} - - - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.dtype` {#Invert.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.event_ndims` {#Invert.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.forward(x, name='forward')` {#Invert.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.forward_event_shape(input_shape)` {#Invert.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Invert.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Invert.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.graph_parents` {#Invert.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.inverse(y, name='inverse')` {#Invert.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Invert.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.inverse_event_shape(output_shape)` {#Invert.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Invert.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Invert.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.is_constant_jacobian` {#Invert.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.name` {#Invert.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.validate_args` {#Invert.validate_args} - -Returns True if Tensor arguments will be validated. - - - -- - - - -### `class tf.contrib.distributions.bijector.PowerTransform` {#PowerTransform} - -Compute `Y = g(X) = (1 + X * c)**(1 / c), X >= -1 / c`. - -The [power transform](https://en.wikipedia.org/wiki/Power_transform) maps -inputs from `[0, inf]` to `[-1/c, inf]`; this is equivalent to the `inverse` -of this bijector. - -This bijector is equivalent to the `Exp` bijector when `c=0`. -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.__init__(power=0.0, event_ndims=0, validate_args=False, name='power_transform')` {#PowerTransform.__init__} - -Instantiates the `PowerTransform` bijector. - -##### Args: - - -* `power`: Python `float` scalar indicating the transform power, i.e., - `Y = g(X) = (1 + X * c)**(1 / c)` where `c` is the `power`. -* `event_ndims`: Python scalar indicating the number of dimensions associated - with a particular draw from the distribution. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str` name given to ops managed by this object. - -##### Raises: - - -* `ValueError`: if `power < 0` or is not known statically. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.dtype` {#PowerTransform.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.event_ndims` {#PowerTransform.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.forward(x, name='forward')` {#PowerTransform.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.forward_event_shape(input_shape)` {#PowerTransform.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#PowerTransform.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#PowerTransform.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.graph_parents` {#PowerTransform.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.inverse(y, name='inverse')` {#PowerTransform.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#PowerTransform.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.inverse_event_shape(output_shape)` {#PowerTransform.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#PowerTransform.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#PowerTransform.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.is_constant_jacobian` {#PowerTransform.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.name` {#PowerTransform.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.power` {#PowerTransform.power} - -The `c` in: `Y = g(X) = (1 + X * c)**(1 / c)`. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.validate_args` {#PowerTransform.validate_args} - -Returns True if Tensor arguments will be validated. - - - -- - - - -### `class tf.contrib.distributions.bijector.SigmoidCentered` {#SigmoidCentered} - -Bijector which computes Y = g(X) = exp([X 0]) / (1 + exp(-X)). - -Equivalent to: `bijector.SoftmaxCentered(event_ndims=0)`. - -See `bijector.SoftmaxCentered` for more details. -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.__init__(validate_args=False, name='sigmoid_centered')` {#SigmoidCentered.__init__} - - - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.dtype` {#SigmoidCentered.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.event_ndims` {#SigmoidCentered.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.forward(x, name='forward')` {#SigmoidCentered.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.forward_event_shape(input_shape)` {#SigmoidCentered.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#SigmoidCentered.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#SigmoidCentered.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.graph_parents` {#SigmoidCentered.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.inverse(y, name='inverse')` {#SigmoidCentered.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#SigmoidCentered.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.inverse_event_shape(output_shape)` {#SigmoidCentered.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#SigmoidCentered.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#SigmoidCentered.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.is_constant_jacobian` {#SigmoidCentered.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.name` {#SigmoidCentered.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.validate_args` {#SigmoidCentered.validate_args} - -Returns True if Tensor arguments will be validated. - - - -- - - - -### `class tf.contrib.distributions.bijector.SoftmaxCentered` {#SoftmaxCentered} - -Bijector which computes `Y = g(X) = exp([X 0]) / sum(exp([X 0]))`. - -To implement [softmax](https://en.wikipedia.org/wiki/Softmax_function) as a -bijection, the forward transformation appends a value to the input and the -inverse removes this coordinate. The appended coordinate represents a pivot, -e.g., `softmax(x) = exp(x-c) / sum(exp(x-c))` where `c` is the implicit last -coordinate. - -Because we append a coordinate, this bijector only supports `event_ndim in [0, -1]`, i.e., scalars and vectors. - -Example Use: - -```python -bijector.SoftmaxCentered(event_ndims=1).forward(tf.log([2, 3, 4])) -# Result: [0.2, 0.3, 0.4, 0.1] -# Extra result: 0.1 - -bijector.SoftmaxCentered(event_ndims=1).inverse([0.2, 0.3, 0.4, 0.1]) -# Result: tf.log([2, 3, 4]) -# Extra coordinate removed. -``` - -At first blush it may seem like the [Invariance of domain]( -https://en.wikipedia.org/wiki/Invariance_of_domain) theorem implies this -implementation is not a bijection. However, the appended dimension -makes the (forward) image non-open and the theorem does not directly apply. -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.__init__(event_ndims=0, validate_args=False, name='softmax_centered')` {#SoftmaxCentered.__init__} - - - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.dtype` {#SoftmaxCentered.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.event_ndims` {#SoftmaxCentered.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.forward(x, name='forward')` {#SoftmaxCentered.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.forward_event_shape(input_shape)` {#SoftmaxCentered.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#SoftmaxCentered.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#SoftmaxCentered.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.graph_parents` {#SoftmaxCentered.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.inverse(y, name='inverse')` {#SoftmaxCentered.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#SoftmaxCentered.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.inverse_event_shape(output_shape)` {#SoftmaxCentered.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#SoftmaxCentered.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#SoftmaxCentered.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.is_constant_jacobian` {#SoftmaxCentered.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.name` {#SoftmaxCentered.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.validate_args` {#SoftmaxCentered.validate_args} - -Returns True if Tensor arguments will be validated. - - - -- - - - -### `class tf.contrib.distributions.bijector.Softplus` {#Softplus} - -Bijector which computes `Y = g(X) = Log[1 + exp(X)]`. - -The softplus `Bijector` has the following two useful properties: - -* The domain is the positive real numbers -* `softplus(x) approx x`, for large `x`, so it does not overflow as easily as - the `Exp` `Bijector`. - - Example Use: - - ```python - # Create the Y=g(X)=softplus(X) transform which works only on Tensors with 1 - # batch ndim and 2 event ndims (i.e., vector of matrices). - softplus = Softplus(event_ndims=2) - x = [[[1., 2], - [3, 4]], - [[5, 6], - [7, 8]]] - log(1 + exp(x)) == softplus.forward(x) - log(exp(x) - 1) == softplus.inverse(x) - ``` - - Note: log(.) and exp(.) are applied element-wise but the Jacobian is a - reduction over the event space. -- - - - -#### `tf.contrib.distributions.bijector.Softplus.__init__(event_ndims=0, validate_args=False, name='softplus')` {#Softplus.__init__} - - - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.dtype` {#Softplus.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.event_ndims` {#Softplus.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.forward(x, name='forward')` {#Softplus.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.forward_event_shape(input_shape)` {#Softplus.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Softplus.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Softplus.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.graph_parents` {#Softplus.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.inverse(y, name='inverse')` {#Softplus.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Softplus.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.inverse_event_shape(output_shape)` {#Softplus.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Softplus.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Softplus.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.is_constant_jacobian` {#Softplus.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.name` {#Softplus.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.validate_args` {#Softplus.validate_args} - -Returns True if Tensor arguments will be validated. - - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.distributions.md b/tensorflow/g3doc/api_docs/python/contrib.distributions.md deleted file mode 100644 index b3a7d661db..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.distributions.md +++ /dev/null @@ -1,27438 +0,0 @@ - - -# Statistical Distributions (contrib) -[TOC] - -Classes representing statistical distributions and ops for working with them. - -See the @{$python/contrib.distributions} guide. - -- - - - -### `class tf.contrib.distributions.ReparameterizationType` {#ReparameterizationType} - -Instances of this class represent how sampling is reparameterized. - -Two static instances exist in the distritributions library, signifying -one of two possible properties for samples from a distribution: - -`FULLY_REPARAMETERIZED`: Samples from the distribution are fully - reparameterized, and straight-through gradients are supported. - -`NOT_REPARAMETERIZED`: Samples from the distribution are not fully - reparameterized, and straight-through gradients are either partially - unsupported or are not supported at all. In this case, for purposes of - e.g. RL or variational inference, it is generally safest to wrap the - sample results in a `stop_gradients` call and instead use policy - gradients / surrogate loss instead. -- - - - -#### `tf.contrib.distributions.ReparameterizationType.__eq__(other)` {#ReparameterizationType.__eq__} - -Determine if this `ReparameterizationType` is equal to another. - -Since RepaparameterizationType instances are constant static global -instances, equality checks if two instances' id() values are equal. - -##### Args: - - -* `other`: Object to compare against. - -##### Returns: - - `self is other`. - - -- - - - -#### `tf.contrib.distributions.ReparameterizationType.__init__(rep_type)` {#ReparameterizationType.__init__} - - - - -- - - - -#### `tf.contrib.distributions.ReparameterizationType.__repr__()` {#ReparameterizationType.__repr__} - - - - - -- - - - -### `class tf.contrib.distributions.Distribution` {#Distribution} - -A generic probability distribution base class. - -`Distribution` is a base class for constructing and organizing properties -(e.g., mean, variance) of random variables (e.g, Bernoulli, Gaussian). - -### Subclassing - -Subclasses are expected to implement a leading-underscore version of the -same-named function. The argument signature should be identical except for -the omission of `name="..."`. For example, to enable `log_prob(value, -name="log_prob")` a subclass should implement `_log_prob(value)`. - -Subclasses can append to public-level docstrings by providing -docstrings for their method specializations. For example: - -```python -@distribution_util.AppendDocstring("Some other details.") -def _log_prob(self, value): - ... -``` - -would add the string "Some other details." to the `log_prob` function -docstring. This is implemented as a simple decorator to avoid python -linter complaining about missing Args/Returns/Raises sections in the -partial docstrings. - -### Broadcasting, batching, and shapes - -All distributions support batches of independent distributions of that type. -The batch shape is determined by broadcasting together the parameters. - -The shape of arguments to `__init__`, `cdf`, `log_cdf`, `prob`, and -`log_prob` reflect this broadcasting, as does the return value of `sample` and -`sample_n`. - -`sample_n_shape = [n] + batch_shape + event_shape`, where `sample_n_shape` is -the shape of the `Tensor` returned from `sample_n`, `n` is the number of -samples, `batch_shape` defines how many independent distributions there are, -and `event_shape` defines the shape of samples from each of those independent -distributions. Samples are independent along the `batch_shape` dimensions, but -not necessarily so along the `event_shape` dimensions (depending on the -particulars of the underlying distribution). - -Using the `Uniform` distribution as an example: - -```python -minval = 3.0 -maxval = [[4.0, 6.0], - [10.0, 12.0]] - -# Broadcasting: -# This instance represents 4 Uniform distributions. Each has a lower bound at -# 3.0 as the `minval` parameter was broadcasted to match `maxval`'s shape. -u = Uniform(minval, maxval) - -# `event_shape` is `TensorShape([])`. -event_shape = u.event_shape -# `event_shape_t` is a `Tensor` which will evaluate to []. -event_shape_t = u.event_shape_tensor() - -# Sampling returns a sample per distribution. `samples` has shape -# [5, 2, 2], which is [n] + batch_shape + event_shape, where n=5, -# batch_shape=[2, 2], and event_shape=[]. -samples = u.sample_n(5) - -# The broadcasting holds across methods. Here we use `cdf` as an example. The -# same holds for `log_cdf` and the likelihood functions. - -# `cum_prob` has shape [2, 2] as the `value` argument was broadcasted to the -# shape of the `Uniform` instance. -cum_prob_broadcast = u.cdf(4.0) - -# `cum_prob`'s shape is [2, 2], one per distribution. No broadcasting -# occurred. -cum_prob_per_dist = u.cdf([[4.0, 5.0], - [6.0, 7.0]]) - -# INVALID as the `value` argument is not broadcastable to the distribution's -# shape. -cum_prob_invalid = u.cdf([4.0, 5.0, 6.0]) -``` - -### Parameter values leading to undefined statistics or distributions. - -Some distributions do not have well-defined statistics for all initialization -parameter values. For example, the beta distribution is parameterized by -positive real numbers `concentration1` and `concentration0`, and does not have -well-defined mode if `concentration1 < 1` or `concentration0 < 1`. - -The user is given the option of raising an exception or returning `NaN`. - -```python -a = tf.exp(tf.matmul(logits, weights_a)) -b = tf.exp(tf.matmul(logits, weights_b)) - -# Will raise exception if ANY batch member has a < 1 or b < 1. -dist = distributions.beta(a, b, allow_nan_stats=False) -mode = dist.mode().eval() - -# Will return NaN for batch members with either a < 1 or b < 1. -dist = distributions.beta(a, b, allow_nan_stats=True) # Default behavior -mode = dist.mode().eval() -``` - -In all cases, an exception is raised if *invalid* parameters are passed, e.g. - -```python -# Will raise an exception if any Op is run. -negative_a = -1.0 * a # beta distribution by definition has a > 0. -dist = distributions.beta(negative_a, b, allow_nan_stats=True) -dist.mean().eval() -``` -- - - - -#### `tf.contrib.distributions.Distribution.__init__(dtype, is_continuous, reparameterization_type, validate_args, allow_nan_stats, parameters=None, graph_parents=None, name=None)` {#Distribution.__init__} - -Constructs the `Distribution`. - -**This is a private method for subclass use.** - -##### Args: - - -* `dtype`: The type of the event samples. `None` implies no type-enforcement. -* `is_continuous`: Python `bool`. If `True` this `Distribution` is continuous - over its supported domain. -* `reparameterization_type`: Instance of `ReparameterizationType`. - If `distributions.FULLY_REPARAMETERIZED`, this - `Distribution` can be reparameterized in terms of some standard - distribution with a function whose Jacobian is constant for the support - of the standard distribution. If `distributions.NOT_REPARAMETERIZED`, - then no such reparameterization is available. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `parameters`: Python `dict` of parameters used to instantiate this - `Distribution`. -* `graph_parents`: Python `list` of graph prerequisites of this - `Distribution`. -* `name`: Python `str` name prefixed to Ops created by this class. Default: - subclass name. - -##### Raises: - - -* `ValueError`: if any member of graph_parents is `None` or not a `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Distribution.allow_nan_stats` {#Distribution.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Distribution.batch_shape` {#Distribution.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Distribution.batch_shape_tensor(name='batch_shape_tensor')` {#Distribution.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Distribution.cdf(value, name='cdf')` {#Distribution.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Distribution.copy(**override_parameters_kwargs)` {#Distribution.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Distribution.covariance(name='covariance')` {#Distribution.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Distribution.dtype` {#Distribution.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Distribution.entropy(name='entropy')` {#Distribution.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Distribution.event_shape` {#Distribution.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Distribution.event_shape_tensor(name='event_shape_tensor')` {#Distribution.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Distribution.is_continuous` {#Distribution.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Distribution.is_scalar_batch(name='is_scalar_batch')` {#Distribution.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Distribution.is_scalar_event(name='is_scalar_event')` {#Distribution.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Distribution.log_cdf(value, name='log_cdf')` {#Distribution.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Distribution.log_prob(value, name='log_prob')` {#Distribution.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Distribution.log_survival_function(value, name='log_survival_function')` {#Distribution.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Distribution.mean(name='mean')` {#Distribution.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Distribution.mode(name='mode')` {#Distribution.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Distribution.name` {#Distribution.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Distribution.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Distribution.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Distribution.param_static_shapes(cls, sample_shape)` {#Distribution.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Distribution.parameters` {#Distribution.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Distribution.prob(value, name='prob')` {#Distribution.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Distribution.reparameterization_type` {#Distribution.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Distribution.sample(sample_shape=(), seed=None, name='sample')` {#Distribution.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Distribution.stddev(name='stddev')` {#Distribution.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Distribution.survival_function(value, name='survival_function')` {#Distribution.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Distribution.validate_args` {#Distribution.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Distribution.variance(name='variance')` {#Distribution.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - - -- - - - -### `class tf.contrib.distributions.Binomial` {#Binomial} - -Binomial distribution. - -This distribution is parameterized by `probs`, a (batch of) probabilities for -drawing a `1` and `total_count`, the number of trials per draw from the -Binomial. - -#### Mathematical Details - -The Binomial is a distribution over the number of `1`'s in `total_count` -independent trials, with each trial having the same probability of `1`, i.e., -`probs`. - -The probability mass function (pmf) is, - -```none -pmf(k; n, p) = p**k (1 - p)**(n - k) / Z -Z = k! (n - k)! / n! -``` - -where: -* `total_count = n`, -* `probs = p`, -* `Z` is the normalizaing constant, and, -* `n!` is the factorial of `n`. - -#### Examples - -Create a single distribution, corresponding to 5 coin flips. - -```python -dist = Binomial(total_count=5., probs=.5) -``` - -Create a single distribution (using logits), corresponding to 5 coin flips. - -```python -dist = Binomial(total_count=5., logits=0.) -``` - -Creates 3 distributions with the third distribution most likely to have -successes. - -```python -p = [.2, .3, .8] -# n will be broadcast to [4., 4., 4.], to match p. -dist = Binomial(total_count=4., probs=p) -``` - -The distribution functions can be evaluated on counts. - -```python -# counts same shape as p. -counts = [1., 2, 3] -dist.prob(counts) # Shape [3] - -# p will be broadcast to [[.2, .3, .8], [.2, .3, .8]] to match counts. -counts = [[1., 2, 1], [2, 2, 4]] -dist.prob(counts) # Shape [2, 3] - -# p will be broadcast to shape [5, 7, 3] to match counts. -counts = [[...]] # Shape [5, 7, 3] -dist.prob(counts) # Shape [5, 7, 3] -``` -- - - - -#### `tf.contrib.distributions.Binomial.__init__(total_count, logits=None, probs=None, validate_args=False, allow_nan_stats=True, name='Binomial')` {#Binomial.__init__} - -Initialize a batch of Binomial distributions. - -##### Args: - - -* `total_count`: Non-negative floating point tensor with shape broadcastable - to `[N1,..., Nm]` with `m >= 0` and the same dtype as `probs` or - `logits`. Defines this as a batch of `N1 x ... x Nm` different Binomial - distributions. Its components should be equal to integer values. -* `logits`: Floating point tensor representing the log-odds of a - positive event with shape broadcastable to `[N1,..., Nm]` `m >= 0`, and - the same dtype as `total_count`. Each entry represents logits for the - probability of success for independent Binomial distributions. Only one - of `logits` or `probs` should be passed in. -* `probs`: Positive floating point tensor with shape broadcastable to - `[N1,..., Nm]` `m >= 0`, `probs in [0, 1]`. Each entry represents the - probability of success for independent Binomial distributions. Only one - of `logits` or `probs` should be passed in. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Binomial.allow_nan_stats` {#Binomial.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Binomial.batch_shape` {#Binomial.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Binomial.batch_shape_tensor(name='batch_shape_tensor')` {#Binomial.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Binomial.cdf(value, name='cdf')` {#Binomial.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Binomial.copy(**override_parameters_kwargs)` {#Binomial.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Binomial.covariance(name='covariance')` {#Binomial.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Binomial.dtype` {#Binomial.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Binomial.entropy(name='entropy')` {#Binomial.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Binomial.event_shape` {#Binomial.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Binomial.event_shape_tensor(name='event_shape_tensor')` {#Binomial.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Binomial.is_continuous` {#Binomial.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Binomial.is_scalar_batch(name='is_scalar_batch')` {#Binomial.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Binomial.is_scalar_event(name='is_scalar_event')` {#Binomial.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Binomial.log_cdf(value, name='log_cdf')` {#Binomial.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Binomial.log_prob(value, name='log_prob')` {#Binomial.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Binomial`: - -For each batch member of counts `value`, `P[value]` is the probability that -after sampling `self.total_count` draws from this Binomial distribution, the -number of successes is `value`. Since different sequences of draws can result in -the same counts, the probability includes a combinatorial coefficient. - -Note: `value` must be a non-negative tensor with dtype `dtype` and whose shape -can be broadcast with `self.probs` and `self.total_count`. `value` is only legal -if it is less than or equal to `self.total_count` and its components are equal -to integer values. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Binomial.log_survival_function(value, name='log_survival_function')` {#Binomial.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Binomial.logits` {#Binomial.logits} - -Log-odds of drawing a `1`. - - -- - - - -#### `tf.contrib.distributions.Binomial.mean(name='mean')` {#Binomial.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Binomial.mode(name='mode')` {#Binomial.mode} - -Mode. - -Additional documentation from `Binomial`: - -Note that when `(1 + total_count) * probs` is an integer, there are -actually two modes. Namely, `(1 + total_count) * probs` and -`(1 + total_count) * probs - 1` are both modes. Here we return only the -larger of the two modes. - - -- - - - -#### `tf.contrib.distributions.Binomial.name` {#Binomial.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Binomial.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Binomial.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Binomial.param_static_shapes(cls, sample_shape)` {#Binomial.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Binomial.parameters` {#Binomial.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Binomial.prob(value, name='prob')` {#Binomial.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Binomial`: - -For each batch member of counts `value`, `P[value]` is the probability that -after sampling `self.total_count` draws from this Binomial distribution, the -number of successes is `value`. Since different sequences of draws can result in -the same counts, the probability includes a combinatorial coefficient. - -Note: `value` must be a non-negative tensor with dtype `dtype` and whose shape -can be broadcast with `self.probs` and `self.total_count`. `value` is only legal -if it is less than or equal to `self.total_count` and its components are equal -to integer values. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Binomial.probs` {#Binomial.probs} - -Probability of of drawing a `1`. - - -- - - - -#### `tf.contrib.distributions.Binomial.reparameterization_type` {#Binomial.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Binomial.sample(sample_shape=(), seed=None, name='sample')` {#Binomial.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Binomial.stddev(name='stddev')` {#Binomial.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Binomial.survival_function(value, name='survival_function')` {#Binomial.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Binomial.total_count` {#Binomial.total_count} - -Number of trials. - - -- - - - -#### `tf.contrib.distributions.Binomial.validate_args` {#Binomial.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Binomial.variance(name='variance')` {#Binomial.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.Bernoulli` {#Bernoulli} - -Bernoulli distribution. - -The Bernoulli distribution with `probs` parameter, i.e., the probability of a -`1` outcome (vs a `0` outcome). -- - - - -#### `tf.contrib.distributions.Bernoulli.__init__(logits=None, probs=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='Bernoulli')` {#Bernoulli.__init__} - -Construct Bernoulli distributions. - -##### Args: - - -* `logits`: An N-D `Tensor` representing the log-odds of a `1` event. Each - entry in the `Tensor` parametrizes an independent Bernoulli distribution - where the probability of an event is sigmoid(logits). Only one of - `logits` or `probs` should be passed in. -* `probs`: An N-D `Tensor` representing the probability of a `1` - event. Each entry in the `Tensor` parameterizes an independent - Bernoulli distribution. Only one of `logits` or `probs` should be passed - in. -* `dtype`: The type of the event samples. Default: `int32`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, - statistics (e.g., mean, mode, variance) use the value "`NaN`" to - indicate the result is undefined. When `False`, an exception is raised - if one or more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `ValueError`: If p and logits are passed, or if neither are passed. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.allow_nan_stats` {#Bernoulli.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.batch_shape` {#Bernoulli.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.batch_shape_tensor(name='batch_shape_tensor')` {#Bernoulli.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.cdf(value, name='cdf')` {#Bernoulli.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.copy(**override_parameters_kwargs)` {#Bernoulli.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.covariance(name='covariance')` {#Bernoulli.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.dtype` {#Bernoulli.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.entropy(name='entropy')` {#Bernoulli.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.event_shape` {#Bernoulli.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.event_shape_tensor(name='event_shape_tensor')` {#Bernoulli.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.is_continuous` {#Bernoulli.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Bernoulli.is_scalar_batch(name='is_scalar_batch')` {#Bernoulli.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.is_scalar_event(name='is_scalar_event')` {#Bernoulli.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.log_cdf(value, name='log_cdf')` {#Bernoulli.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.log_prob(value, name='log_prob')` {#Bernoulli.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.log_survival_function(value, name='log_survival_function')` {#Bernoulli.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.logits` {#Bernoulli.logits} - -Log-odds of a `1` outcome (vs `0`). - - -- - - - -#### `tf.contrib.distributions.Bernoulli.mean(name='mean')` {#Bernoulli.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.mode(name='mode')` {#Bernoulli.mode} - -Mode. - -Additional documentation from `Bernoulli`: - -Returns `1` if `prob > 0.5` and `0` otherwise. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.name` {#Bernoulli.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Bernoulli.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.param_static_shapes(cls, sample_shape)` {#Bernoulli.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.parameters` {#Bernoulli.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.prob(value, name='prob')` {#Bernoulli.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.probs` {#Bernoulli.probs} - -Probability of a `1` outcome (vs `0`). - - -- - - - -#### `tf.contrib.distributions.Bernoulli.reparameterization_type` {#Bernoulli.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.sample(sample_shape=(), seed=None, name='sample')` {#Bernoulli.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.stddev(name='stddev')` {#Bernoulli.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.survival_function(value, name='survival_function')` {#Bernoulli.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.validate_args` {#Bernoulli.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.variance(name='variance')` {#Bernoulli.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.BernoulliWithSigmoidProbs` {#BernoulliWithSigmoidProbs} - -Bernoulli with `probs = nn.sigmoid(logits)`. -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.__init__(logits=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='BernoulliWithSigmoidProbs')` {#BernoulliWithSigmoidProbs.__init__} - - - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.allow_nan_stats` {#BernoulliWithSigmoidProbs.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.batch_shape` {#BernoulliWithSigmoidProbs.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.batch_shape_tensor(name='batch_shape_tensor')` {#BernoulliWithSigmoidProbs.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.cdf(value, name='cdf')` {#BernoulliWithSigmoidProbs.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.copy(**override_parameters_kwargs)` {#BernoulliWithSigmoidProbs.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.covariance(name='covariance')` {#BernoulliWithSigmoidProbs.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.dtype` {#BernoulliWithSigmoidProbs.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.entropy(name='entropy')` {#BernoulliWithSigmoidProbs.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.event_shape` {#BernoulliWithSigmoidProbs.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.event_shape_tensor(name='event_shape_tensor')` {#BernoulliWithSigmoidProbs.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.is_continuous` {#BernoulliWithSigmoidProbs.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.is_scalar_batch(name='is_scalar_batch')` {#BernoulliWithSigmoidProbs.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.is_scalar_event(name='is_scalar_event')` {#BernoulliWithSigmoidProbs.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_cdf(value, name='log_cdf')` {#BernoulliWithSigmoidProbs.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_prob(value, name='log_prob')` {#BernoulliWithSigmoidProbs.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_survival_function(value, name='log_survival_function')` {#BernoulliWithSigmoidProbs.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.logits` {#BernoulliWithSigmoidProbs.logits} - -Log-odds of a `1` outcome (vs `0`). - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.mean(name='mean')` {#BernoulliWithSigmoidProbs.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.mode(name='mode')` {#BernoulliWithSigmoidProbs.mode} - -Mode. - -Additional documentation from `Bernoulli`: - -Returns `1` if `prob > 0.5` and `0` otherwise. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.name` {#BernoulliWithSigmoidProbs.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#BernoulliWithSigmoidProbs.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.param_static_shapes(cls, sample_shape)` {#BernoulliWithSigmoidProbs.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.parameters` {#BernoulliWithSigmoidProbs.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.prob(value, name='prob')` {#BernoulliWithSigmoidProbs.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.probs` {#BernoulliWithSigmoidProbs.probs} - -Probability of a `1` outcome (vs `0`). - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.reparameterization_type` {#BernoulliWithSigmoidProbs.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.sample(sample_shape=(), seed=None, name='sample')` {#BernoulliWithSigmoidProbs.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.stddev(name='stddev')` {#BernoulliWithSigmoidProbs.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.survival_function(value, name='survival_function')` {#BernoulliWithSigmoidProbs.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.validate_args` {#BernoulliWithSigmoidProbs.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.variance(name='variance')` {#BernoulliWithSigmoidProbs.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.Beta` {#Beta} - -Beta distribution. - -The Beta distribution is defined over the `(0, 1)` interval using parameters -`concentration1` (aka "alpha") and `concentration0` (aka "beta"). - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; alpha, beta) = x**(alpha - 1) (1 - x)**(beta - 1) / Z -Z = Gamma(alpha) Gamma(beta) / Gamma(alpha + beta) -``` - -where: - -* `concentration1 = alpha`, -* `concentration0 = beta`, -* `Z` is the normalization constant, and, -* `Gamma` is the [gamma function]( - https://en.wikipedia.org/wiki/Gamma_function). - -The concentration parameters represent mean total counts of a `1` or a `0`, -i.e., - -```none -concentration1 = alpha = mean * total_concentration -concentration0 = beta = (1. - mean) * total_concentration -``` - -where `mean` in `(0, 1)` and `total_concentration` is a positive real number -representing a mean `total_count = concentration1 + concentration0`. - -Distribution parameters are automatically broadcast in all functions; see -examples for details. - -#### Examples - -```python -# Create a batch of three Beta distributions. -alpha = [1, 2, 3] -beta = [1, 2, 3] -dist = Beta(alpha, beta) - -dist.sample([4, 5]) # Shape [4, 5, 3] - -# `x` has three batch entries, each with two samples. -x = [[.1, .4, .5], - [.2, .3, .5]] -# Calculate the probability of each pair of samples under the corresponding -# distribution in `dist`. -dist.prob(x) # Shape [2, 3] -``` - -```python -# Create batch_shape=[2, 3] via parameter broadcast: -alpha = [[1.], [2]] # Shape [2, 1] -beta = [3., 4, 5] # Shape [3] -dist = Beta(alpha, beta) - -# alpha broadcast as: [[1., 1, 1,], -# [2, 2, 2]] -# beta broadcast as: [[3., 4, 5], -# [3, 4, 5]] -# batch_Shape [2, 3] -dist.sample([4, 5]) # Shape [4, 5, 2, 3] - -x = [.2, .3, .5] -# x will be broadcast as [[.2, .3, .5], -# [.2, .3, .5]], -# thus matching batch_shape [2, 3]. -dist.prob(x) # Shape [2, 3] -``` -- - - - -#### `tf.contrib.distributions.Beta.__init__(concentration1=None, concentration0=None, validate_args=False, allow_nan_stats=True, name='Beta')` {#Beta.__init__} - -Initialize a batch of Beta distributions. - -##### Args: - - -* `concentration1`: Positive floating-point `Tensor` indicating mean - number of successes; aka "alpha". Implies `self.dtype` and - `self.batch_shape`, i.e., - `concentration1.shape = [N1, N2, ..., Nm] = self.batch_shape`. -* `concentration0`: Positive floating-point `Tensor` indicating mean - number of failures; aka "beta". Otherwise has same semantics as - `concentration1`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Beta.allow_nan_stats` {#Beta.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Beta.batch_shape` {#Beta.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Beta.batch_shape_tensor(name='batch_shape_tensor')` {#Beta.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Beta.cdf(value, name='cdf')` {#Beta.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Beta.concentration0` {#Beta.concentration0} - -Concentration parameter associated with a `0` outcome. - - -- - - - -#### `tf.contrib.distributions.Beta.concentration1` {#Beta.concentration1} - -Concentration parameter associated with a `1` outcome. - - -- - - - -#### `tf.contrib.distributions.Beta.copy(**override_parameters_kwargs)` {#Beta.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Beta.covariance(name='covariance')` {#Beta.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Beta.dtype` {#Beta.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Beta.entropy(name='entropy')` {#Beta.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Beta.event_shape` {#Beta.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Beta.event_shape_tensor(name='event_shape_tensor')` {#Beta.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Beta.is_continuous` {#Beta.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Beta.is_scalar_batch(name='is_scalar_batch')` {#Beta.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Beta.is_scalar_event(name='is_scalar_event')` {#Beta.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Beta.log_cdf(value, name='log_cdf')` {#Beta.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Beta.log_prob(value, name='log_prob')` {#Beta.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Beta.log_survival_function(value, name='log_survival_function')` {#Beta.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Beta.mean(name='mean')` {#Beta.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Beta.mode(name='mode')` {#Beta.mode} - -Mode. - -Additional documentation from `Beta`: - -Note: The mode is undefined when `concentration1 <= 1` or -`concentration0 <= 1`. If `self.allow_nan_stats` is `True`, `NaN` -is used for undefined modes. If `self.allow_nan_stats` is `False` an -exception is raised when one or more modes are undefined. - - -- - - - -#### `tf.contrib.distributions.Beta.name` {#Beta.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Beta.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Beta.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Beta.param_static_shapes(cls, sample_shape)` {#Beta.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Beta.parameters` {#Beta.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Beta.prob(value, name='prob')` {#Beta.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Beta.reparameterization_type` {#Beta.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Beta.sample(sample_shape=(), seed=None, name='sample')` {#Beta.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Beta.stddev(name='stddev')` {#Beta.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Beta.survival_function(value, name='survival_function')` {#Beta.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Beta.total_concentration` {#Beta.total_concentration} - -Sum of concentration parameters. - - -- - - - -#### `tf.contrib.distributions.Beta.validate_args` {#Beta.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Beta.variance(name='variance')` {#Beta.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.BetaWithSoftplusConcentration` {#BetaWithSoftplusConcentration} - -Beta with softplus transform of `concentration1` and `concentration0`. -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.__init__(concentration1, concentration0, validate_args=False, allow_nan_stats=True, name='BetaWithSoftplusConcentration')` {#BetaWithSoftplusConcentration.__init__} - - - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.allow_nan_stats` {#BetaWithSoftplusConcentration.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.batch_shape` {#BetaWithSoftplusConcentration.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.batch_shape_tensor(name='batch_shape_tensor')` {#BetaWithSoftplusConcentration.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.cdf(value, name='cdf')` {#BetaWithSoftplusConcentration.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.concentration0` {#BetaWithSoftplusConcentration.concentration0} - -Concentration parameter associated with a `0` outcome. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.concentration1` {#BetaWithSoftplusConcentration.concentration1} - -Concentration parameter associated with a `1` outcome. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.copy(**override_parameters_kwargs)` {#BetaWithSoftplusConcentration.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.covariance(name='covariance')` {#BetaWithSoftplusConcentration.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.dtype` {#BetaWithSoftplusConcentration.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.entropy(name='entropy')` {#BetaWithSoftplusConcentration.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.event_shape` {#BetaWithSoftplusConcentration.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.event_shape_tensor(name='event_shape_tensor')` {#BetaWithSoftplusConcentration.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.is_continuous` {#BetaWithSoftplusConcentration.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.is_scalar_batch(name='is_scalar_batch')` {#BetaWithSoftplusConcentration.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.is_scalar_event(name='is_scalar_event')` {#BetaWithSoftplusConcentration.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.log_cdf(value, name='log_cdf')` {#BetaWithSoftplusConcentration.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.log_prob(value, name='log_prob')` {#BetaWithSoftplusConcentration.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.log_survival_function(value, name='log_survival_function')` {#BetaWithSoftplusConcentration.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.mean(name='mean')` {#BetaWithSoftplusConcentration.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.mode(name='mode')` {#BetaWithSoftplusConcentration.mode} - -Mode. - -Additional documentation from `Beta`: - -Note: The mode is undefined when `concentration1 <= 1` or -`concentration0 <= 1`. If `self.allow_nan_stats` is `True`, `NaN` -is used for undefined modes. If `self.allow_nan_stats` is `False` an -exception is raised when one or more modes are undefined. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.name` {#BetaWithSoftplusConcentration.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#BetaWithSoftplusConcentration.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.param_static_shapes(cls, sample_shape)` {#BetaWithSoftplusConcentration.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.parameters` {#BetaWithSoftplusConcentration.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.prob(value, name='prob')` {#BetaWithSoftplusConcentration.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.reparameterization_type` {#BetaWithSoftplusConcentration.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.sample(sample_shape=(), seed=None, name='sample')` {#BetaWithSoftplusConcentration.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.stddev(name='stddev')` {#BetaWithSoftplusConcentration.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.survival_function(value, name='survival_function')` {#BetaWithSoftplusConcentration.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.total_concentration` {#BetaWithSoftplusConcentration.total_concentration} - -Sum of concentration parameters. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.validate_args` {#BetaWithSoftplusConcentration.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.variance(name='variance')` {#BetaWithSoftplusConcentration.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.Categorical` {#Categorical} - -Categorical distribution. - -The categorical distribution is parameterized by the log-probabilities -of a set of classes. - -#### Examples - -Creates a 3-class distiribution, with the 2nd class, the most likely to be -drawn from. - -```python -p = [0.1, 0.5, 0.4] -dist = Categorical(probs=p) -``` - -Creates a 3-class distiribution, with the 2nd class the most likely to be -drawn from, using logits. - -```python -logits = [-50, 400, 40] -dist = Categorical(logits=logits) -``` - -Creates a 3-class distribution, with the 3rd class is most likely to be drawn. -The distribution functions can be evaluated on counts. - -```python -# counts is a scalar. -p = [0.1, 0.4, 0.5] -dist = Categorical(probs=p) -dist.prob(0) # Shape [] - -# p will be broadcast to [[0.1, 0.4, 0.5], [0.1, 0.4, 0.5]] to match counts. -counts = [1, 0] -dist.prob(counts) # Shape [2] - -# p will be broadcast to shape [3, 5, 7, 3] to match counts. -counts = [[...]] # Shape [5, 7, 3] -dist.prob(counts) # Shape [5, 7, 3] -``` -- - - - -#### `tf.contrib.distributions.Categorical.__init__(logits=None, probs=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='Categorical')` {#Categorical.__init__} - -Initialize Categorical distributions using class log-probabilities. - -##### Args: - - -* `logits`: An N-D `Tensor`, `N >= 1`, representing the log probabilities - of a set of Categorical distributions. The first `N - 1` dimensions - index into a batch of independent distributions and the last dimension - represents a vector of logits for each class. Only one of `logits` or - `probs` should be passed in. -* `probs`: An N-D `Tensor`, `N >= 1`, representing the probabilities - of a set of Categorical distributions. The first `N - 1` dimensions - index into a batch of independent distributions and the last dimension - represents a vector of probabilities for each class. Only one of - `logits` or `probs` should be passed in. -* `dtype`: The type of the event samples (default: int32). -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Categorical.allow_nan_stats` {#Categorical.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Categorical.batch_shape` {#Categorical.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Categorical.batch_shape_tensor(name='batch_shape_tensor')` {#Categorical.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Categorical.cdf(value, name='cdf')` {#Categorical.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Categorical.copy(**override_parameters_kwargs)` {#Categorical.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Categorical.covariance(name='covariance')` {#Categorical.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Categorical.dtype` {#Categorical.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Categorical.entropy(name='entropy')` {#Categorical.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Categorical.event_shape` {#Categorical.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Categorical.event_shape_tensor(name='event_shape_tensor')` {#Categorical.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Categorical.event_size` {#Categorical.event_size} - -Scalar `int32` tensor: the number of classes. - - -- - - - -#### `tf.contrib.distributions.Categorical.is_continuous` {#Categorical.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Categorical.is_scalar_batch(name='is_scalar_batch')` {#Categorical.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Categorical.is_scalar_event(name='is_scalar_event')` {#Categorical.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Categorical.log_cdf(value, name='log_cdf')` {#Categorical.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Categorical.log_prob(value, name='log_prob')` {#Categorical.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Categorical.log_survival_function(value, name='log_survival_function')` {#Categorical.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Categorical.logits` {#Categorical.logits} - -Vector of coordinatewise logits. - - -- - - - -#### `tf.contrib.distributions.Categorical.mean(name='mean')` {#Categorical.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Categorical.mode(name='mode')` {#Categorical.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Categorical.name` {#Categorical.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Categorical.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Categorical.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Categorical.param_static_shapes(cls, sample_shape)` {#Categorical.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Categorical.parameters` {#Categorical.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Categorical.prob(value, name='prob')` {#Categorical.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Categorical.probs` {#Categorical.probs} - -Vector of coordinatewise probabilities. - - -- - - - -#### `tf.contrib.distributions.Categorical.reparameterization_type` {#Categorical.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Categorical.sample(sample_shape=(), seed=None, name='sample')` {#Categorical.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Categorical.stddev(name='stddev')` {#Categorical.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Categorical.survival_function(value, name='survival_function')` {#Categorical.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Categorical.validate_args` {#Categorical.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Categorical.variance(name='variance')` {#Categorical.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.Chi2` {#Chi2} - -Chi2 distribution. - -The Chi2 distribution is defined over positive real numbers using a degrees of -freedom ("df") parameter. - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; df, x > 0) = x**(0.5 df - 1) exp(-0.5 x) / Z -Z = 2**(0.5 df) Gamma(0.5 df) -``` - -where: - -* `df` denotes the degrees of freedom, -* `Z` is the normalization constant, and, -* `Gamma` is the [gamma function]( - https://en.wikipedia.org/wiki/Gamma_function). - -The Chi2 distribution is a special case of the Gamma distribution, i.e., - -```python -Chi2(df) = Gamma(concentration=0.5 * df, rate=0.5) -``` -- - - - -#### `tf.contrib.distributions.Chi2.__init__(df, validate_args=False, allow_nan_stats=True, name='Chi2')` {#Chi2.__init__} - -Construct Chi2 distributions with parameter `df`. - -##### Args: - - -* `df`: Floating point tensor, the degrees of freedom of the - distribution(s). `df` must contain only positive values. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Chi2.allow_nan_stats` {#Chi2.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Chi2.batch_shape` {#Chi2.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Chi2.batch_shape_tensor(name='batch_shape_tensor')` {#Chi2.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2.cdf(value, name='cdf')` {#Chi2.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2.concentration` {#Chi2.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.Chi2.copy(**override_parameters_kwargs)` {#Chi2.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Chi2.covariance(name='covariance')` {#Chi2.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Chi2.df` {#Chi2.df} - - - - -- - - - -#### `tf.contrib.distributions.Chi2.dtype` {#Chi2.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Chi2.entropy(name='entropy')` {#Chi2.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Chi2.event_shape` {#Chi2.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Chi2.event_shape_tensor(name='event_shape_tensor')` {#Chi2.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2.is_continuous` {#Chi2.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Chi2.is_scalar_batch(name='is_scalar_batch')` {#Chi2.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2.is_scalar_event(name='is_scalar_event')` {#Chi2.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2.log_cdf(value, name='log_cdf')` {#Chi2.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2.log_prob(value, name='log_prob')` {#Chi2.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2.log_survival_function(value, name='log_survival_function')` {#Chi2.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2.mean(name='mean')` {#Chi2.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Chi2.mode(name='mode')` {#Chi2.mode} - -Mode. - -Additional documentation from `Gamma`: - -The mode of a gamma distribution is `(shape - 1) / rate` when -`shape > 1`, and `NaN` otherwise. If `self.allow_nan_stats` is `False`, -an exception will be raised rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.Chi2.name` {#Chi2.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Chi2.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Chi2.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Chi2.param_static_shapes(cls, sample_shape)` {#Chi2.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Chi2.parameters` {#Chi2.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Chi2.prob(value, name='prob')` {#Chi2.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2.rate` {#Chi2.rate} - -Rate parameter. - - -- - - - -#### `tf.contrib.distributions.Chi2.reparameterization_type` {#Chi2.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Chi2.sample(sample_shape=(), seed=None, name='sample')` {#Chi2.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Chi2.stddev(name='stddev')` {#Chi2.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Chi2.survival_function(value, name='survival_function')` {#Chi2.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2.validate_args` {#Chi2.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Chi2.variance(name='variance')` {#Chi2.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.Chi2WithAbsDf` {#Chi2WithAbsDf} - -Chi2 with parameter transform `df = floor(abs(df))`. -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.__init__(df, validate_args=False, allow_nan_stats=True, name='Chi2WithAbsDf')` {#Chi2WithAbsDf.__init__} - - - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.allow_nan_stats` {#Chi2WithAbsDf.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.batch_shape` {#Chi2WithAbsDf.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.batch_shape_tensor(name='batch_shape_tensor')` {#Chi2WithAbsDf.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.cdf(value, name='cdf')` {#Chi2WithAbsDf.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.concentration` {#Chi2WithAbsDf.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.copy(**override_parameters_kwargs)` {#Chi2WithAbsDf.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.covariance(name='covariance')` {#Chi2WithAbsDf.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.df` {#Chi2WithAbsDf.df} - - - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.dtype` {#Chi2WithAbsDf.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.entropy(name='entropy')` {#Chi2WithAbsDf.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.event_shape` {#Chi2WithAbsDf.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.event_shape_tensor(name='event_shape_tensor')` {#Chi2WithAbsDf.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.is_continuous` {#Chi2WithAbsDf.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.is_scalar_batch(name='is_scalar_batch')` {#Chi2WithAbsDf.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.is_scalar_event(name='is_scalar_event')` {#Chi2WithAbsDf.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.log_cdf(value, name='log_cdf')` {#Chi2WithAbsDf.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.log_prob(value, name='log_prob')` {#Chi2WithAbsDf.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.log_survival_function(value, name='log_survival_function')` {#Chi2WithAbsDf.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.mean(name='mean')` {#Chi2WithAbsDf.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.mode(name='mode')` {#Chi2WithAbsDf.mode} - -Mode. - -Additional documentation from `Gamma`: - -The mode of a gamma distribution is `(shape - 1) / rate` when -`shape > 1`, and `NaN` otherwise. If `self.allow_nan_stats` is `False`, -an exception will be raised rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.name` {#Chi2WithAbsDf.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Chi2WithAbsDf.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.param_static_shapes(cls, sample_shape)` {#Chi2WithAbsDf.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.parameters` {#Chi2WithAbsDf.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.prob(value, name='prob')` {#Chi2WithAbsDf.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.rate` {#Chi2WithAbsDf.rate} - -Rate parameter. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.reparameterization_type` {#Chi2WithAbsDf.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.sample(sample_shape=(), seed=None, name='sample')` {#Chi2WithAbsDf.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.stddev(name='stddev')` {#Chi2WithAbsDf.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.survival_function(value, name='survival_function')` {#Chi2WithAbsDf.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.validate_args` {#Chi2WithAbsDf.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.variance(name='variance')` {#Chi2WithAbsDf.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.Exponential` {#Exponential} - -Exponential distribution. - -The Exponential distribution is parameterized by an event `rate` parameter. - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; lambda, x > 0) = exp(-lambda x) / Z -Z = 1 / lambda -``` - -where `rate = lambda` and `Z` is the normalizaing constant. - -The Exponential distribution is a special case of the Gamma distribution, -i.e., - -```python -Exponential(rate) = Gamma(concentration=1., rate) -``` - -The Exponential distribution uses a `rate` parameter, or "inverse scale", -which can be intuited as, - -```none -X ~ Exponential(rate=1) -Y = X / rate -``` -- - - - -#### `tf.contrib.distributions.Exponential.__init__(rate, validate_args=False, allow_nan_stats=True, name='Exponential')` {#Exponential.__init__} - -Construct Exponential distribution with parameter `rate`. - -##### Args: - - -* `rate`: Floating point tensor, equivalent to `1 / mean`. Must contain only - positive values. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Exponential.allow_nan_stats` {#Exponential.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Exponential.batch_shape` {#Exponential.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Exponential.batch_shape_tensor(name='batch_shape_tensor')` {#Exponential.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Exponential.cdf(value, name='cdf')` {#Exponential.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Exponential.concentration` {#Exponential.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.Exponential.copy(**override_parameters_kwargs)` {#Exponential.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Exponential.covariance(name='covariance')` {#Exponential.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Exponential.dtype` {#Exponential.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Exponential.entropy(name='entropy')` {#Exponential.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Exponential.event_shape` {#Exponential.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Exponential.event_shape_tensor(name='event_shape_tensor')` {#Exponential.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Exponential.is_continuous` {#Exponential.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Exponential.is_scalar_batch(name='is_scalar_batch')` {#Exponential.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Exponential.is_scalar_event(name='is_scalar_event')` {#Exponential.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Exponential.log_cdf(value, name='log_cdf')` {#Exponential.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Exponential.log_prob(value, name='log_prob')` {#Exponential.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Exponential.log_survival_function(value, name='log_survival_function')` {#Exponential.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Exponential.mean(name='mean')` {#Exponential.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Exponential.mode(name='mode')` {#Exponential.mode} - -Mode. - -Additional documentation from `Gamma`: - -The mode of a gamma distribution is `(shape - 1) / rate` when -`shape > 1`, and `NaN` otherwise. If `self.allow_nan_stats` is `False`, -an exception will be raised rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.Exponential.name` {#Exponential.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Exponential.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Exponential.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Exponential.param_static_shapes(cls, sample_shape)` {#Exponential.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Exponential.parameters` {#Exponential.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Exponential.prob(value, name='prob')` {#Exponential.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Exponential.rate` {#Exponential.rate} - - - - -- - - - -#### `tf.contrib.distributions.Exponential.reparameterization_type` {#Exponential.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Exponential.sample(sample_shape=(), seed=None, name='sample')` {#Exponential.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Exponential.stddev(name='stddev')` {#Exponential.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Exponential.survival_function(value, name='survival_function')` {#Exponential.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Exponential.validate_args` {#Exponential.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Exponential.variance(name='variance')` {#Exponential.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.ExponentialWithSoftplusRate` {#ExponentialWithSoftplusRate} - -Exponential with softplus transform on `rate`. -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.__init__(rate, validate_args=False, allow_nan_stats=True, name='ExponentialWithSoftplusRate')` {#ExponentialWithSoftplusRate.__init__} - - - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.allow_nan_stats` {#ExponentialWithSoftplusRate.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.batch_shape` {#ExponentialWithSoftplusRate.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.batch_shape_tensor(name='batch_shape_tensor')` {#ExponentialWithSoftplusRate.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.cdf(value, name='cdf')` {#ExponentialWithSoftplusRate.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.concentration` {#ExponentialWithSoftplusRate.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.copy(**override_parameters_kwargs)` {#ExponentialWithSoftplusRate.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.covariance(name='covariance')` {#ExponentialWithSoftplusRate.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.dtype` {#ExponentialWithSoftplusRate.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.entropy(name='entropy')` {#ExponentialWithSoftplusRate.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.event_shape` {#ExponentialWithSoftplusRate.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.event_shape_tensor(name='event_shape_tensor')` {#ExponentialWithSoftplusRate.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.is_continuous` {#ExponentialWithSoftplusRate.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.is_scalar_batch(name='is_scalar_batch')` {#ExponentialWithSoftplusRate.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.is_scalar_event(name='is_scalar_event')` {#ExponentialWithSoftplusRate.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.log_cdf(value, name='log_cdf')` {#ExponentialWithSoftplusRate.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.log_prob(value, name='log_prob')` {#ExponentialWithSoftplusRate.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.log_survival_function(value, name='log_survival_function')` {#ExponentialWithSoftplusRate.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.mean(name='mean')` {#ExponentialWithSoftplusRate.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.mode(name='mode')` {#ExponentialWithSoftplusRate.mode} - -Mode. - -Additional documentation from `Gamma`: - -The mode of a gamma distribution is `(shape - 1) / rate` when -`shape > 1`, and `NaN` otherwise. If `self.allow_nan_stats` is `False`, -an exception will be raised rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.name` {#ExponentialWithSoftplusRate.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#ExponentialWithSoftplusRate.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.param_static_shapes(cls, sample_shape)` {#ExponentialWithSoftplusRate.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.parameters` {#ExponentialWithSoftplusRate.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.prob(value, name='prob')` {#ExponentialWithSoftplusRate.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.rate` {#ExponentialWithSoftplusRate.rate} - - - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.reparameterization_type` {#ExponentialWithSoftplusRate.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.sample(sample_shape=(), seed=None, name='sample')` {#ExponentialWithSoftplusRate.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.stddev(name='stddev')` {#ExponentialWithSoftplusRate.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.survival_function(value, name='survival_function')` {#ExponentialWithSoftplusRate.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.validate_args` {#ExponentialWithSoftplusRate.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.variance(name='variance')` {#ExponentialWithSoftplusRate.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.Gamma` {#Gamma} - -Gamma distribution. - -The Gamma distribution is defined over positive real numbers using -parameters `concentration` (aka "alpha") and `rate` (aka "beta"). - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; alpha, beta, x > 0) = x**(alpha - 1) exp(-x beta) / Z -Z = Gamma(alpha) beta**alpha -``` - -where: - -* `concentration = alpha`, `alpha > 0`, -* `rate = beta`, `beta > 0`, -* `Z` is the normalizing constant, and, -* `Gamma` is the [gamma function]( - https://en.wikipedia.org/wiki/Gamma_function). - -The cumulative density function (cdf) is, - -```none -cdf(x; alpha, beta, x > 0) = GammaInc(alpha, beta x) / Gamma(alpha) -``` - -where `GammaInc` is the [lower incomplete Gamma function]( -https://en.wikipedia.org/wiki/Incomplete_gamma_function). - -The parameters can be intuited via their relationship to mean and stddev, - -```none -concentration = alpha = (mean / stddev)**2 -rate = beta = mean / stddev**2 = concentration / mean -``` - -Distribution parameters are automatically broadcast in all functions; see -examples for details. - -WARNING: This distribution may draw 0-valued samples for small `concentration` -values. See note in `tf.random_gamma` docstring. - -#### Examples - -```python -dist = Gamma(concentration=3.0, rate=2.0) -dist2 = Gamma(concentration=[3.0, 4.0], rate=[2.0, 3.0]) -``` -- - - - -#### `tf.contrib.distributions.Gamma.__init__(concentration, rate, validate_args=False, allow_nan_stats=True, name='Gamma')` {#Gamma.__init__} - -Construct Gamma with `concentration` and `rate` parameters. - -The parameters `concentration` and `rate` must be shaped in a way that -supports broadcasting (e.g. `concentration + rate` is a valid operation). - -##### Args: - - -* `concentration`: Floating point tensor, the concentration params of the - distribution(s). Must contain only positive values. -* `rate`: Floating point tensor, the inverse scale params of the - distribution(s). Must contain only positive values. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `TypeError`: if `concentration` and `rate` are different dtypes. - - -- - - - -#### `tf.contrib.distributions.Gamma.allow_nan_stats` {#Gamma.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Gamma.batch_shape` {#Gamma.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Gamma.batch_shape_tensor(name='batch_shape_tensor')` {#Gamma.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Gamma.cdf(value, name='cdf')` {#Gamma.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Gamma.concentration` {#Gamma.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.Gamma.copy(**override_parameters_kwargs)` {#Gamma.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Gamma.covariance(name='covariance')` {#Gamma.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Gamma.dtype` {#Gamma.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Gamma.entropy(name='entropy')` {#Gamma.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Gamma.event_shape` {#Gamma.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Gamma.event_shape_tensor(name='event_shape_tensor')` {#Gamma.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Gamma.is_continuous` {#Gamma.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Gamma.is_scalar_batch(name='is_scalar_batch')` {#Gamma.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Gamma.is_scalar_event(name='is_scalar_event')` {#Gamma.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Gamma.log_cdf(value, name='log_cdf')` {#Gamma.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Gamma.log_prob(value, name='log_prob')` {#Gamma.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Gamma.log_survival_function(value, name='log_survival_function')` {#Gamma.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Gamma.mean(name='mean')` {#Gamma.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Gamma.mode(name='mode')` {#Gamma.mode} - -Mode. - -Additional documentation from `Gamma`: - -The mode of a gamma distribution is `(shape - 1) / rate` when -`shape > 1`, and `NaN` otherwise. If `self.allow_nan_stats` is `False`, -an exception will be raised rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.Gamma.name` {#Gamma.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Gamma.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Gamma.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Gamma.param_static_shapes(cls, sample_shape)` {#Gamma.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Gamma.parameters` {#Gamma.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Gamma.prob(value, name='prob')` {#Gamma.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Gamma.rate` {#Gamma.rate} - -Rate parameter. - - -- - - - -#### `tf.contrib.distributions.Gamma.reparameterization_type` {#Gamma.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Gamma.sample(sample_shape=(), seed=None, name='sample')` {#Gamma.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Gamma.stddev(name='stddev')` {#Gamma.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Gamma.survival_function(value, name='survival_function')` {#Gamma.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Gamma.validate_args` {#Gamma.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Gamma.variance(name='variance')` {#Gamma.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.GammaWithSoftplusConcentrationRate` {#GammaWithSoftplusConcentrationRate} - -`Gamma` with softplus of `concentration` and `rate`. -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.__init__(concentration, rate, validate_args=False, allow_nan_stats=True, name='GammaWithSoftplusConcentrationRate')` {#GammaWithSoftplusConcentrationRate.__init__} - - - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.allow_nan_stats` {#GammaWithSoftplusConcentrationRate.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.batch_shape` {#GammaWithSoftplusConcentrationRate.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.batch_shape_tensor(name='batch_shape_tensor')` {#GammaWithSoftplusConcentrationRate.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.cdf(value, name='cdf')` {#GammaWithSoftplusConcentrationRate.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.concentration` {#GammaWithSoftplusConcentrationRate.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.copy(**override_parameters_kwargs)` {#GammaWithSoftplusConcentrationRate.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.covariance(name='covariance')` {#GammaWithSoftplusConcentrationRate.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.dtype` {#GammaWithSoftplusConcentrationRate.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.entropy(name='entropy')` {#GammaWithSoftplusConcentrationRate.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.event_shape` {#GammaWithSoftplusConcentrationRate.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.event_shape_tensor(name='event_shape_tensor')` {#GammaWithSoftplusConcentrationRate.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.is_continuous` {#GammaWithSoftplusConcentrationRate.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.is_scalar_batch(name='is_scalar_batch')` {#GammaWithSoftplusConcentrationRate.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.is_scalar_event(name='is_scalar_event')` {#GammaWithSoftplusConcentrationRate.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.log_cdf(value, name='log_cdf')` {#GammaWithSoftplusConcentrationRate.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.log_prob(value, name='log_prob')` {#GammaWithSoftplusConcentrationRate.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.log_survival_function(value, name='log_survival_function')` {#GammaWithSoftplusConcentrationRate.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.mean(name='mean')` {#GammaWithSoftplusConcentrationRate.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.mode(name='mode')` {#GammaWithSoftplusConcentrationRate.mode} - -Mode. - -Additional documentation from `Gamma`: - -The mode of a gamma distribution is `(shape - 1) / rate` when -`shape > 1`, and `NaN` otherwise. If `self.allow_nan_stats` is `False`, -an exception will be raised rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.name` {#GammaWithSoftplusConcentrationRate.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#GammaWithSoftplusConcentrationRate.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.param_static_shapes(cls, sample_shape)` {#GammaWithSoftplusConcentrationRate.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.parameters` {#GammaWithSoftplusConcentrationRate.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.prob(value, name='prob')` {#GammaWithSoftplusConcentrationRate.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.rate` {#GammaWithSoftplusConcentrationRate.rate} - -Rate parameter. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.reparameterization_type` {#GammaWithSoftplusConcentrationRate.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.sample(sample_shape=(), seed=None, name='sample')` {#GammaWithSoftplusConcentrationRate.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.stddev(name='stddev')` {#GammaWithSoftplusConcentrationRate.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.survival_function(value, name='survival_function')` {#GammaWithSoftplusConcentrationRate.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.validate_args` {#GammaWithSoftplusConcentrationRate.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.variance(name='variance')` {#GammaWithSoftplusConcentrationRate.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.InverseGamma` {#InverseGamma} - -InverseGamma distribution. - -The `InverseGamma` distribution is defined over positive real numbers using -parameters `concentration` (aka "alpha") and `rate` (aka "beta"). - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; alpha, beta, x > 0) = x**(-alpha - 1) exp(-beta / x) / Z -Z = Gamma(alpha) beta**-alpha -``` - -where: - -* `concentration = alpha`, -* `rate = beta`, -* `Z` is the normalizing constant, and, -* `Gamma` is the [gamma function]( - https://en.wikipedia.org/wiki/Gamma_function). - -The cumulative density function (cdf) is, - -```none -cdf(x; alpha, beta, x > 0) = GammaInc(alpha, beta / x) / Gamma(alpha) -``` - -where `GammaInc` is the [upper incomplete Gamma function]( -https://en.wikipedia.org/wiki/Incomplete_gamma_function). - -The parameters can be intuited via their relationship to mean and stddev, - -```none -concentration = alpha = (mean / stddev)**2 -rate = beta = mean / stddev**2 -``` - -Distribution parameters are automatically broadcast in all functions; see -examples for details. - -WARNING: This distribution may draw 0-valued samples for small concentration -values. See note in `tf.random_gamma` docstring. - -#### Examples - -```python -dist = InverseGamma(concentration=3.0, rate=2.0) -dist2 = InverseGamma(concentration=[3.0, 4.0], rate=[2.0, 3.0]) -``` -- - - - -#### `tf.contrib.distributions.InverseGamma.__init__(concentration, rate, validate_args=False, allow_nan_stats=True, name='InverseGamma')` {#InverseGamma.__init__} - -Construct InverseGamma with `concentration` and `rate` parameters. - -The parameters `concentration` and `rate` must be shaped in a way that -supports broadcasting (e.g. `concentration + rate` is a valid operation). - -##### Args: - - -* `concentration`: Floating point tensor, the concentration params of the - distribution(s). Must contain only positive values. -* `rate`: Floating point tensor, the inverse scale params of the - distribution(s). Must contain only positive values. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -##### Raises: - - -* `TypeError`: if `concentration` and `rate` are different dtypes. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.allow_nan_stats` {#InverseGamma.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.batch_shape` {#InverseGamma.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.batch_shape_tensor(name='batch_shape_tensor')` {#InverseGamma.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.cdf(value, name='cdf')` {#InverseGamma.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.concentration` {#InverseGamma.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.copy(**override_parameters_kwargs)` {#InverseGamma.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.covariance(name='covariance')` {#InverseGamma.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.dtype` {#InverseGamma.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.entropy(name='entropy')` {#InverseGamma.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.event_shape` {#InverseGamma.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.event_shape_tensor(name='event_shape_tensor')` {#InverseGamma.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.is_continuous` {#InverseGamma.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.InverseGamma.is_scalar_batch(name='is_scalar_batch')` {#InverseGamma.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.is_scalar_event(name='is_scalar_event')` {#InverseGamma.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.log_cdf(value, name='log_cdf')` {#InverseGamma.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.log_prob(value, name='log_prob')` {#InverseGamma.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.log_survival_function(value, name='log_survival_function')` {#InverseGamma.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.mean(name='mean')` {#InverseGamma.mean} - -Mean. - -Additional documentation from `InverseGamma`: - -The mean of an inverse gamma distribution is -`rate / (concentration - 1)`, when `concentration > 1`, and `NaN` -otherwise. If `self.allow_nan_stats` is `False`, an exception will be -raised rather than returning `NaN` - - -- - - - -#### `tf.contrib.distributions.InverseGamma.mode(name='mode')` {#InverseGamma.mode} - -Mode. - -Additional documentation from `InverseGamma`: - -The mode of an inverse gamma distribution is `rate / (concentration + -1)`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.name` {#InverseGamma.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#InverseGamma.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.param_static_shapes(cls, sample_shape)` {#InverseGamma.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.parameters` {#InverseGamma.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.prob(value, name='prob')` {#InverseGamma.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.rate` {#InverseGamma.rate} - -Rate parameter. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.reparameterization_type` {#InverseGamma.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.sample(sample_shape=(), seed=None, name='sample')` {#InverseGamma.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.stddev(name='stddev')` {#InverseGamma.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.survival_function(value, name='survival_function')` {#InverseGamma.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.validate_args` {#InverseGamma.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.variance(name='variance')` {#InverseGamma.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - - -Additional documentation from `InverseGamma`: - -Variance for inverse gamma is defined only for `concentration > 2`. If -`self.allow_nan_stats` is `False`, an exception will be raised rather -than returning `NaN`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate` {#InverseGammaWithSoftplusConcentrationRate} - -`InverseGamma` with softplus of `concentration` and `rate`. -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.__init__(concentration, rate, validate_args=False, allow_nan_stats=True, name='InverseGammaWithSoftplusConcentrationRate')` {#InverseGammaWithSoftplusConcentrationRate.__init__} - - - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.allow_nan_stats` {#InverseGammaWithSoftplusConcentrationRate.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.batch_shape` {#InverseGammaWithSoftplusConcentrationRate.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.batch_shape_tensor(name='batch_shape_tensor')` {#InverseGammaWithSoftplusConcentrationRate.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.cdf(value, name='cdf')` {#InverseGammaWithSoftplusConcentrationRate.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.concentration` {#InverseGammaWithSoftplusConcentrationRate.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.copy(**override_parameters_kwargs)` {#InverseGammaWithSoftplusConcentrationRate.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.covariance(name='covariance')` {#InverseGammaWithSoftplusConcentrationRate.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.dtype` {#InverseGammaWithSoftplusConcentrationRate.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.entropy(name='entropy')` {#InverseGammaWithSoftplusConcentrationRate.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.event_shape` {#InverseGammaWithSoftplusConcentrationRate.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.event_shape_tensor(name='event_shape_tensor')` {#InverseGammaWithSoftplusConcentrationRate.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.is_continuous` {#InverseGammaWithSoftplusConcentrationRate.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.is_scalar_batch(name='is_scalar_batch')` {#InverseGammaWithSoftplusConcentrationRate.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.is_scalar_event(name='is_scalar_event')` {#InverseGammaWithSoftplusConcentrationRate.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.log_cdf(value, name='log_cdf')` {#InverseGammaWithSoftplusConcentrationRate.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.log_prob(value, name='log_prob')` {#InverseGammaWithSoftplusConcentrationRate.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.log_survival_function(value, name='log_survival_function')` {#InverseGammaWithSoftplusConcentrationRate.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.mean(name='mean')` {#InverseGammaWithSoftplusConcentrationRate.mean} - -Mean. - -Additional documentation from `InverseGamma`: - -The mean of an inverse gamma distribution is -`rate / (concentration - 1)`, when `concentration > 1`, and `NaN` -otherwise. If `self.allow_nan_stats` is `False`, an exception will be -raised rather than returning `NaN` - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.mode(name='mode')` {#InverseGammaWithSoftplusConcentrationRate.mode} - -Mode. - -Additional documentation from `InverseGamma`: - -The mode of an inverse gamma distribution is `rate / (concentration + -1)`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.name` {#InverseGammaWithSoftplusConcentrationRate.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#InverseGammaWithSoftplusConcentrationRate.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.param_static_shapes(cls, sample_shape)` {#InverseGammaWithSoftplusConcentrationRate.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.parameters` {#InverseGammaWithSoftplusConcentrationRate.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.prob(value, name='prob')` {#InverseGammaWithSoftplusConcentrationRate.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.rate` {#InverseGammaWithSoftplusConcentrationRate.rate} - -Rate parameter. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.reparameterization_type` {#InverseGammaWithSoftplusConcentrationRate.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.sample(sample_shape=(), seed=None, name='sample')` {#InverseGammaWithSoftplusConcentrationRate.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.stddev(name='stddev')` {#InverseGammaWithSoftplusConcentrationRate.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.survival_function(value, name='survival_function')` {#InverseGammaWithSoftplusConcentrationRate.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.validate_args` {#InverseGammaWithSoftplusConcentrationRate.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.variance(name='variance')` {#InverseGammaWithSoftplusConcentrationRate.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - - -Additional documentation from `InverseGamma`: - -Variance for inverse gamma is defined only for `concentration > 2`. If -`self.allow_nan_stats` is `False`, an exception will be raised rather -than returning `NaN`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.Laplace` {#Laplace} - -The Laplace distribution with location `loc` and `scale` parameters. - -#### Mathematical details - -The probability density function (pdf) of this distribution is, - -```none -pdf(x; mu, sigma) = exp(-|x - mu| / sigma) / Z -Z = 2 sigma -``` - -where `loc = mu`, `scale = sigma`, and `Z` is the normalization constant. - -Note that the Laplace distribution can be thought of two exponential -distributions spliced together "back-to-back." - -The Lpalce distribution is a member of the [location-scale family]( -https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be -constructed as, - -```none -X ~ Laplace(loc=0, scale=1) -Y = loc + scale * X -``` -- - - - -#### `tf.contrib.distributions.Laplace.__init__(loc, scale, validate_args=False, allow_nan_stats=True, name='Laplace')` {#Laplace.__init__} - -Construct Laplace distribution with parameters `loc` and `scale`. - -The parameters `loc` and `scale` must be shaped in a way that supports -broadcasting (e.g., `loc / scale` is a valid operation). - -##### Args: - - -* `loc`: Floating point tensor which characterizes the location (center) - of the distribution. -* `scale`: Positive floating point tensor which characterizes the spread of - the distribution. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, - statistics (e.g., mean, mode, variance) use the value "`NaN`" to - indicate the result is undefined. When `False`, an exception is raised - if one or more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `TypeError`: if `loc` and `scale` are of different dtype. - - -- - - - -#### `tf.contrib.distributions.Laplace.allow_nan_stats` {#Laplace.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Laplace.batch_shape` {#Laplace.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Laplace.batch_shape_tensor(name='batch_shape_tensor')` {#Laplace.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Laplace.cdf(value, name='cdf')` {#Laplace.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Laplace.copy(**override_parameters_kwargs)` {#Laplace.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Laplace.covariance(name='covariance')` {#Laplace.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Laplace.dtype` {#Laplace.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Laplace.entropy(name='entropy')` {#Laplace.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Laplace.event_shape` {#Laplace.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Laplace.event_shape_tensor(name='event_shape_tensor')` {#Laplace.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Laplace.is_continuous` {#Laplace.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Laplace.is_scalar_batch(name='is_scalar_batch')` {#Laplace.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Laplace.is_scalar_event(name='is_scalar_event')` {#Laplace.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Laplace.loc` {#Laplace.loc} - -Distribution parameter for the location. - - -- - - - -#### `tf.contrib.distributions.Laplace.log_cdf(value, name='log_cdf')` {#Laplace.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Laplace.log_prob(value, name='log_prob')` {#Laplace.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Laplace.log_survival_function(value, name='log_survival_function')` {#Laplace.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Laplace.mean(name='mean')` {#Laplace.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Laplace.mode(name='mode')` {#Laplace.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Laplace.name` {#Laplace.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Laplace.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Laplace.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Laplace.param_static_shapes(cls, sample_shape)` {#Laplace.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Laplace.parameters` {#Laplace.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Laplace.prob(value, name='prob')` {#Laplace.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Laplace.reparameterization_type` {#Laplace.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Laplace.sample(sample_shape=(), seed=None, name='sample')` {#Laplace.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Laplace.scale` {#Laplace.scale} - -Distribution parameter for scale. - - -- - - - -#### `tf.contrib.distributions.Laplace.stddev(name='stddev')` {#Laplace.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Laplace.survival_function(value, name='survival_function')` {#Laplace.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Laplace.validate_args` {#Laplace.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Laplace.variance(name='variance')` {#Laplace.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.LaplaceWithSoftplusScale` {#LaplaceWithSoftplusScale} - -Laplace with softplus applied to `scale`. -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.__init__(loc, scale, validate_args=False, allow_nan_stats=True, name='LaplaceWithSoftplusScale')` {#LaplaceWithSoftplusScale.__init__} - - - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.allow_nan_stats` {#LaplaceWithSoftplusScale.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.batch_shape` {#LaplaceWithSoftplusScale.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.batch_shape_tensor(name='batch_shape_tensor')` {#LaplaceWithSoftplusScale.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.cdf(value, name='cdf')` {#LaplaceWithSoftplusScale.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.copy(**override_parameters_kwargs)` {#LaplaceWithSoftplusScale.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.covariance(name='covariance')` {#LaplaceWithSoftplusScale.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.dtype` {#LaplaceWithSoftplusScale.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.entropy(name='entropy')` {#LaplaceWithSoftplusScale.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.event_shape` {#LaplaceWithSoftplusScale.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.event_shape_tensor(name='event_shape_tensor')` {#LaplaceWithSoftplusScale.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.is_continuous` {#LaplaceWithSoftplusScale.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.is_scalar_batch(name='is_scalar_batch')` {#LaplaceWithSoftplusScale.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.is_scalar_event(name='is_scalar_event')` {#LaplaceWithSoftplusScale.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.loc` {#LaplaceWithSoftplusScale.loc} - -Distribution parameter for the location. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.log_cdf(value, name='log_cdf')` {#LaplaceWithSoftplusScale.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.log_prob(value, name='log_prob')` {#LaplaceWithSoftplusScale.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.log_survival_function(value, name='log_survival_function')` {#LaplaceWithSoftplusScale.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.mean(name='mean')` {#LaplaceWithSoftplusScale.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.mode(name='mode')` {#LaplaceWithSoftplusScale.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.name` {#LaplaceWithSoftplusScale.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#LaplaceWithSoftplusScale.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.param_static_shapes(cls, sample_shape)` {#LaplaceWithSoftplusScale.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.parameters` {#LaplaceWithSoftplusScale.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.prob(value, name='prob')` {#LaplaceWithSoftplusScale.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.reparameterization_type` {#LaplaceWithSoftplusScale.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.sample(sample_shape=(), seed=None, name='sample')` {#LaplaceWithSoftplusScale.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.scale` {#LaplaceWithSoftplusScale.scale} - -Distribution parameter for scale. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.stddev(name='stddev')` {#LaplaceWithSoftplusScale.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.survival_function(value, name='survival_function')` {#LaplaceWithSoftplusScale.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.validate_args` {#LaplaceWithSoftplusScale.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.variance(name='variance')` {#LaplaceWithSoftplusScale.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.Logistic` {#Logistic} - -The Logistic distribution with location `loc` and `scale` parameters. - -#### Mathematical details - -The cumulative density function of this distribution is: - -```none -cdf(x; mu, sigma) = 1 / (1 + exp(-(x - mu) / sigma)) -``` - -where `loc = mu` and `scale = sigma`. - -The Logistic distribution is a member of the [location-scale family]( -https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be -constructed as, - -```none -X ~ Logistic(loc=0, scale=1) -Y = loc + scale * X -``` - -#### Examples - -Examples of initialization of one or a batch of distributions. - -```python -# Define a single scalar Logistic distribution. -dist = tf.contrib.distributions.Logistic(loc=0., scale=3.) - -# Evaluate the cdf at 1, returning a scalar. -dist.cdf(1.) - -# Define a batch of two scalar valued Logistics. -# The first has mean 1 and scale 11, the second 2 and 22. -dist = tf.contrib.distributions.Logistic(loc=[1, 2.], scale=[11, 22.]) - -# Evaluate the pdf of the first distribution on 0, and the second on 1.5, -# returning a length two tensor. -dist.prob([0, 1.5]) - -# Get 3 samples, returning a 3 x 2 tensor. -dist.sample([3]) -``` - -Arguments are broadcast when possible. - -```python -# Define a batch of two scalar valued Logistics. -# Both have mean 1, but different scales. -dist = tf.contrib.distributions.Logistic(loc=1., scale=[11, 22.]) - -# Evaluate the pdf of both distributions on the same point, 3.0, -# returning a length 2 tensor. -dist.prob(3.0) -``` -- - - - -#### `tf.contrib.distributions.Logistic.__init__(loc, scale, validate_args=False, allow_nan_stats=True, name='Logistic')` {#Logistic.__init__} - -Construct Logistic distributions with mean and scale `loc` and `scale`. - -The parameters `loc` and `scale` must be shaped in a way that supports -broadcasting (e.g. `loc + scale` is a valid operation). - -##### Args: - - -* `loc`: Floating point tensor, the means of the distribution(s). -* `scale`: Floating point tensor, the scales of the distribution(s). Must - contain only positive values. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: The name to give Ops created by the initializer. - -##### Raises: - - -* `TypeError`: if loc and scale are different dtypes. - - -- - - - -#### `tf.contrib.distributions.Logistic.allow_nan_stats` {#Logistic.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Logistic.batch_shape` {#Logistic.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Logistic.batch_shape_tensor(name='batch_shape_tensor')` {#Logistic.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Logistic.cdf(value, name='cdf')` {#Logistic.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Logistic.copy(**override_parameters_kwargs)` {#Logistic.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Logistic.covariance(name='covariance')` {#Logistic.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Logistic.dtype` {#Logistic.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Logistic.entropy(name='entropy')` {#Logistic.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Logistic.event_shape` {#Logistic.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Logistic.event_shape_tensor(name='event_shape_tensor')` {#Logistic.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Logistic.is_continuous` {#Logistic.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Logistic.is_scalar_batch(name='is_scalar_batch')` {#Logistic.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Logistic.is_scalar_event(name='is_scalar_event')` {#Logistic.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Logistic.loc` {#Logistic.loc} - -Distribution parameter for the location. - - -- - - - -#### `tf.contrib.distributions.Logistic.log_cdf(value, name='log_cdf')` {#Logistic.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Logistic.log_prob(value, name='log_prob')` {#Logistic.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Logistic.log_survival_function(value, name='log_survival_function')` {#Logistic.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Logistic.mean(name='mean')` {#Logistic.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Logistic.mode(name='mode')` {#Logistic.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Logistic.name` {#Logistic.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Logistic.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Logistic.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Logistic.param_static_shapes(cls, sample_shape)` {#Logistic.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Logistic.parameters` {#Logistic.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Logistic.prob(value, name='prob')` {#Logistic.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Logistic.reparameterization_type` {#Logistic.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Logistic.sample(sample_shape=(), seed=None, name='sample')` {#Logistic.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Logistic.scale` {#Logistic.scale} - -Distribution parameter for scale. - - -- - - - -#### `tf.contrib.distributions.Logistic.stddev(name='stddev')` {#Logistic.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Logistic.survival_function(value, name='survival_function')` {#Logistic.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Logistic.validate_args` {#Logistic.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Logistic.variance(name='variance')` {#Logistic.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.Normal` {#Normal} - -The Normal distribution with location `loc` and `scale` parameters. - -#### Mathematical details - -The probability density function (pdf) is, - -```none -pdf(x; mu, sigma) = exp(-0.5 (x - mu)**2 / sigma**2) / Z -Z = (2 pi sigma**2)**0.5 -``` - -where `loc = mu` is the mean, `scale = sigma` is the std. deviation, and, `Z` -is the normalization constant. - -The Normal distribution is a member of the [location-scale family]( -https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be -constructed as, - -```none -X ~ Normal(loc=0, scale=1) -Y = loc + scale * X -``` - -#### Examples - -Examples of initialization of one or a batch of distributions. - -```python -# Define a single scalar Normal distribution. -dist = tf.contrib.distributions.Normal(loc=0., scale=3.) - -# Evaluate the cdf at 1, returning a scalar. -dist.cdf(1.) - -# Define a batch of two scalar valued Normals. -# The first has mean 1 and standard deviation 11, the second 2 and 22. -dist = tf.contrib.distributions.Normal(loc=[1, 2.], scale=[11, 22.]) - -# Evaluate the pdf of the first distribution on 0, and the second on 1.5, -# returning a length two tensor. -dist.prob([0, 1.5]) - -# Get 3 samples, returning a 3 x 2 tensor. -dist.sample([3]) -``` - -Arguments are broadcast when possible. - -```python -# Define a batch of two scalar valued Normals. -# Both have mean 1, but different standard deviations. -dist = tf.contrib.distributions.Normal(loc=1., scale=[11, 22.]) - -# Evaluate the pdf of both distributions on the same point, 3.0, -# returning a length 2 tensor. -dist.prob(3.0) -``` -- - - - -#### `tf.contrib.distributions.Normal.__init__(loc, scale, validate_args=False, allow_nan_stats=True, name='Normal')` {#Normal.__init__} - -Construct Normal distributions with mean and stddev `loc` and `scale`. - -The parameters `loc` and `scale` must be shaped in a way that supports -broadcasting (e.g. `loc + scale` is a valid operation). - -##### Args: - - -* `loc`: Floating point tensor; the means of the distribution(s). -* `scale`: Floating point tensor; the stddevs of the distribution(s). - Must contain only positive values. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, - statistics (e.g., mean, mode, variance) use the value "`NaN`" to - indicate the result is undefined. When `False`, an exception is raised - if one or more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `TypeError`: if `loc` and `scale` have different `dtype`. - - -- - - - -#### `tf.contrib.distributions.Normal.allow_nan_stats` {#Normal.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Normal.batch_shape` {#Normal.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Normal.batch_shape_tensor(name='batch_shape_tensor')` {#Normal.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Normal.cdf(value, name='cdf')` {#Normal.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Normal.copy(**override_parameters_kwargs)` {#Normal.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Normal.covariance(name='covariance')` {#Normal.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Normal.dtype` {#Normal.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Normal.entropy(name='entropy')` {#Normal.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Normal.event_shape` {#Normal.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Normal.event_shape_tensor(name='event_shape_tensor')` {#Normal.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Normal.is_continuous` {#Normal.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Normal.is_scalar_batch(name='is_scalar_batch')` {#Normal.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Normal.is_scalar_event(name='is_scalar_event')` {#Normal.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Normal.loc` {#Normal.loc} - -Distribution parameter for the mean. - - -- - - - -#### `tf.contrib.distributions.Normal.log_cdf(value, name='log_cdf')` {#Normal.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Normal.log_prob(value, name='log_prob')` {#Normal.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Normal.log_survival_function(value, name='log_survival_function')` {#Normal.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Normal.mean(name='mean')` {#Normal.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Normal.mode(name='mode')` {#Normal.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Normal.name` {#Normal.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Normal.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Normal.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Normal.param_static_shapes(cls, sample_shape)` {#Normal.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Normal.parameters` {#Normal.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Normal.prob(value, name='prob')` {#Normal.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Normal.reparameterization_type` {#Normal.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Normal.sample(sample_shape=(), seed=None, name='sample')` {#Normal.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Normal.scale` {#Normal.scale} - -Distribution parameter for standard deviation. - - -- - - - -#### `tf.contrib.distributions.Normal.stddev(name='stddev')` {#Normal.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Normal.survival_function(value, name='survival_function')` {#Normal.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Normal.validate_args` {#Normal.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Normal.variance(name='variance')` {#Normal.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.NormalWithSoftplusScale` {#NormalWithSoftplusScale} - -Normal with softplus applied to `scale`. -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.__init__(loc, scale, validate_args=False, allow_nan_stats=True, name='NormalWithSoftplusScale')` {#NormalWithSoftplusScale.__init__} - - - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.allow_nan_stats` {#NormalWithSoftplusScale.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.batch_shape` {#NormalWithSoftplusScale.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.batch_shape_tensor(name='batch_shape_tensor')` {#NormalWithSoftplusScale.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.cdf(value, name='cdf')` {#NormalWithSoftplusScale.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.copy(**override_parameters_kwargs)` {#NormalWithSoftplusScale.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.covariance(name='covariance')` {#NormalWithSoftplusScale.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.dtype` {#NormalWithSoftplusScale.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.entropy(name='entropy')` {#NormalWithSoftplusScale.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.event_shape` {#NormalWithSoftplusScale.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.event_shape_tensor(name='event_shape_tensor')` {#NormalWithSoftplusScale.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.is_continuous` {#NormalWithSoftplusScale.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.is_scalar_batch(name='is_scalar_batch')` {#NormalWithSoftplusScale.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.is_scalar_event(name='is_scalar_event')` {#NormalWithSoftplusScale.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.loc` {#NormalWithSoftplusScale.loc} - -Distribution parameter for the mean. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.log_cdf(value, name='log_cdf')` {#NormalWithSoftplusScale.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.log_prob(value, name='log_prob')` {#NormalWithSoftplusScale.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.log_survival_function(value, name='log_survival_function')` {#NormalWithSoftplusScale.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.mean(name='mean')` {#NormalWithSoftplusScale.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.mode(name='mode')` {#NormalWithSoftplusScale.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.name` {#NormalWithSoftplusScale.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#NormalWithSoftplusScale.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.param_static_shapes(cls, sample_shape)` {#NormalWithSoftplusScale.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.parameters` {#NormalWithSoftplusScale.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.prob(value, name='prob')` {#NormalWithSoftplusScale.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.reparameterization_type` {#NormalWithSoftplusScale.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.sample(sample_shape=(), seed=None, name='sample')` {#NormalWithSoftplusScale.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.scale` {#NormalWithSoftplusScale.scale} - -Distribution parameter for standard deviation. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.stddev(name='stddev')` {#NormalWithSoftplusScale.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.survival_function(value, name='survival_function')` {#NormalWithSoftplusScale.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.validate_args` {#NormalWithSoftplusScale.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.variance(name='variance')` {#NormalWithSoftplusScale.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.Poisson` {#Poisson} - -Poisson distribution. - -The Poisson distribution is parameterized by an event `rate` parameter. - -#### Mathematical Details - -The probability mass function (pmf) is, - -```none -pmf(k; lambda, k >= 0) = (lambda^k / k!) / Z -Z = exp(lambda). -``` - -where `rate = lambda` and `Z` is the normalizing constant. -- - - - -#### `tf.contrib.distributions.Poisson.__init__(rate, validate_args=False, allow_nan_stats=True, name='Poisson')` {#Poisson.__init__} - -Initialize a batch of Poisson distributions. - -##### Args: - - -* `rate`: Floating point tensor, the rate parameter of the - distribution(s). `rate` must be positive. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Poisson.allow_nan_stats` {#Poisson.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Poisson.batch_shape` {#Poisson.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Poisson.batch_shape_tensor(name='batch_shape_tensor')` {#Poisson.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Poisson.cdf(value, name='cdf')` {#Poisson.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - - -Additional documentation from `Poisson`: - -Note that the input value must be a non-negative floating point tensor with -dtype `dtype` and whose shape can be broadcast with `self.rate`. `x` is only -legal if it is non-negative and its components are equal to integer values. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Poisson.copy(**override_parameters_kwargs)` {#Poisson.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Poisson.covariance(name='covariance')` {#Poisson.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Poisson.dtype` {#Poisson.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Poisson.entropy(name='entropy')` {#Poisson.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Poisson.event_shape` {#Poisson.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Poisson.event_shape_tensor(name='event_shape_tensor')` {#Poisson.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Poisson.is_continuous` {#Poisson.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Poisson.is_scalar_batch(name='is_scalar_batch')` {#Poisson.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Poisson.is_scalar_event(name='is_scalar_event')` {#Poisson.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Poisson.log_cdf(value, name='log_cdf')` {#Poisson.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - - -Additional documentation from `Poisson`: - -Note that the input value must be a non-negative floating point tensor with -dtype `dtype` and whose shape can be broadcast with `self.rate`. `x` is only -legal if it is non-negative and its components are equal to integer values. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Poisson.log_prob(value, name='log_prob')` {#Poisson.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Poisson`: - -Note that the input value must be a non-negative floating point tensor with -dtype `dtype` and whose shape can be broadcast with `self.rate`. `x` is only -legal if it is non-negative and its components are equal to integer values. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Poisson.log_survival_function(value, name='log_survival_function')` {#Poisson.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Poisson.mean(name='mean')` {#Poisson.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Poisson.mode(name='mode')` {#Poisson.mode} - -Mode. - -Additional documentation from `Poisson`: - -Note: when `rate` is an integer, there are actually two modes: `rate` -and `rate - 1`. In this case we return the larger, i.e., `rate`. - - -- - - - -#### `tf.contrib.distributions.Poisson.name` {#Poisson.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Poisson.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Poisson.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Poisson.param_static_shapes(cls, sample_shape)` {#Poisson.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Poisson.parameters` {#Poisson.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Poisson.prob(value, name='prob')` {#Poisson.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Poisson`: - -Note that the input value must be a non-negative floating point tensor with -dtype `dtype` and whose shape can be broadcast with `self.rate`. `x` is only -legal if it is non-negative and its components are equal to integer values. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Poisson.rate` {#Poisson.rate} - -Rate parameter. - - -- - - - -#### `tf.contrib.distributions.Poisson.reparameterization_type` {#Poisson.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Poisson.sample(sample_shape=(), seed=None, name='sample')` {#Poisson.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Poisson.stddev(name='stddev')` {#Poisson.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Poisson.survival_function(value, name='survival_function')` {#Poisson.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Poisson.validate_args` {#Poisson.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Poisson.variance(name='variance')` {#Poisson.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.StudentT` {#StudentT} - -Student's t-distribution with degree of freedom `df`, location `loc`, and `scale` parameters. - -#### Mathematical details - -The probability density function (pdf) is, - -```none -pdf(x; df, mu, sigma) = (1 + y**2 / df)**(-0.5 (df + 1)) / Z -where, -y = (x - mu) / sigma -Z = abs(sigma) sqrt(df pi) Gamma(0.5 df) / Gamma(0.5 (df + 1)) -``` - -where: -* `loc = mu`, -* `scale = sigma`, and, -* `Z` is the normalization constant, and, -* `Gamma` is the [gamma function]( - https://en.wikipedia.org/wiki/Gamma_function). - -The StudentT distribution is a member of the [location-scale family]( -https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be -constructed as, - -```none -X ~ StudentT(df, loc=0, scale=1) -Y = loc + scale * X -``` - -Notice that `scale` has semantics more similar to standard deviation than -variance. However it is not actually the std. deviation; the Student's -t-distribution std. dev. is `scale sqrt(df / (df - 2))` when `df > 2`. - -#### Examples - -Examples of initialization of one or a batch of distributions. - -```python -# Define a single scalar Student t distribution. -single_dist = tf.contrib.distributions.StudentT(df=3) - -# Evaluate the pdf at 1, returning a scalar Tensor. -single_dist.prob(1.) - -# Define a batch of two scalar valued Student t's. -# The first has degrees of freedom 2, mean 1, and scale 11. -# The second 3, 2 and 22. -multi_dist = tf.contrib.distributions.StudentT(df=[2, 3], - loc=[1, 2.], - scale=[11, 22.]) - -# Evaluate the pdf of the first distribution on 0, and the second on 1.5, -# returning a length two tensor. -multi_dist.prob([0, 1.5]) - -# Get 3 samples, returning a 3 x 2 tensor. -multi_dist.sample(3) -``` - -Arguments are broadcast when possible. - -```python -# Define a batch of two Student's t distributions. -# Both have df 2 and mean 1, but different scales. -dist = tf.contrib.distributions.StudentT(df=2, loc=1, scale=[11, 22.]) - -# Evaluate the pdf of both distributions on the same point, 3.0, -# returning a length 2 tensor. -dist.prob(3.0) -``` -- - - - -#### `tf.contrib.distributions.StudentT.__init__(df, loc, scale, validate_args=False, allow_nan_stats=True, name='StudentT')` {#StudentT.__init__} - -Construct Student's t distributions. - -The distributions have degree of freedom `df`, mean `loc`, and scale -`scale`. - -The parameters `df`, `loc`, and `scale` must be shaped in a way that -supports broadcasting (e.g. `df + loc + scale` is a valid operation). - -##### Args: - - -* `df`: Floating-point `Tensor`. The degrees of freedom of the - distribution(s). `df` must contain only positive values. -* `loc`: Floating-point `Tensor`. The mean(s) of the distribution(s). -* `scale`: Floating-point `Tensor`. The scaling factor(s) for the - distribution(s). Note that `scale` is not technically the standard - deviation of this distribution but has semantics more similar to - standard deviation than variance. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, - statistics (e.g., mean, mode, variance) use the value "`NaN`" to - indicate the result is undefined. When `False`, an exception is raised - if one or more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `TypeError`: if loc and scale are different dtypes. - - -- - - - -#### `tf.contrib.distributions.StudentT.allow_nan_stats` {#StudentT.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.StudentT.batch_shape` {#StudentT.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.StudentT.batch_shape_tensor(name='batch_shape_tensor')` {#StudentT.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentT.cdf(value, name='cdf')` {#StudentT.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentT.copy(**override_parameters_kwargs)` {#StudentT.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.StudentT.covariance(name='covariance')` {#StudentT.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.StudentT.df` {#StudentT.df} - -Degrees of freedom in these Student's t distribution(s). - - -- - - - -#### `tf.contrib.distributions.StudentT.dtype` {#StudentT.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.StudentT.entropy(name='entropy')` {#StudentT.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.StudentT.event_shape` {#StudentT.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.StudentT.event_shape_tensor(name='event_shape_tensor')` {#StudentT.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentT.is_continuous` {#StudentT.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.StudentT.is_scalar_batch(name='is_scalar_batch')` {#StudentT.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentT.is_scalar_event(name='is_scalar_event')` {#StudentT.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentT.loc` {#StudentT.loc} - -Locations of these Student's t distribution(s). - - -- - - - -#### `tf.contrib.distributions.StudentT.log_cdf(value, name='log_cdf')` {#StudentT.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentT.log_prob(value, name='log_prob')` {#StudentT.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentT.log_survival_function(value, name='log_survival_function')` {#StudentT.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentT.mean(name='mean')` {#StudentT.mean} - -Mean. - -Additional documentation from `StudentT`: - -The mean of Student's T equals `loc` if `df > 1`, otherwise it is -`NaN`. If `self.allow_nan_stats=True`, then an exception will be raised -rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.StudentT.mode(name='mode')` {#StudentT.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.StudentT.name` {#StudentT.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.StudentT.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#StudentT.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.StudentT.param_static_shapes(cls, sample_shape)` {#StudentT.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.StudentT.parameters` {#StudentT.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.StudentT.prob(value, name='prob')` {#StudentT.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentT.reparameterization_type` {#StudentT.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.StudentT.sample(sample_shape=(), seed=None, name='sample')` {#StudentT.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.StudentT.scale` {#StudentT.scale} - -Scaling factors of these Student's t distribution(s). - - -- - - - -#### `tf.contrib.distributions.StudentT.stddev(name='stddev')` {#StudentT.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.StudentT.survival_function(value, name='survival_function')` {#StudentT.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentT.validate_args` {#StudentT.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.StudentT.variance(name='variance')` {#StudentT.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - - -Additional documentation from `StudentT`: - -The variance for Student's T equals - -``` -df / (df - 2), when df > 2 -infinity, when 1 < df <= 2 -NaN, when df <= 1 -``` - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.StudentTWithAbsDfSoftplusScale` {#StudentTWithAbsDfSoftplusScale} - -StudentT with `df = floor(abs(df))` and `scale = softplus(scale)`. -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.__init__(df, loc, scale, validate_args=False, allow_nan_stats=True, name='StudentTWithAbsDfSoftplusScale')` {#StudentTWithAbsDfSoftplusScale.__init__} - - - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.allow_nan_stats` {#StudentTWithAbsDfSoftplusScale.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.batch_shape` {#StudentTWithAbsDfSoftplusScale.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.batch_shape_tensor(name='batch_shape_tensor')` {#StudentTWithAbsDfSoftplusScale.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.cdf(value, name='cdf')` {#StudentTWithAbsDfSoftplusScale.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.copy(**override_parameters_kwargs)` {#StudentTWithAbsDfSoftplusScale.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.covariance(name='covariance')` {#StudentTWithAbsDfSoftplusScale.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.df` {#StudentTWithAbsDfSoftplusScale.df} - -Degrees of freedom in these Student's t distribution(s). - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.dtype` {#StudentTWithAbsDfSoftplusScale.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.entropy(name='entropy')` {#StudentTWithAbsDfSoftplusScale.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.event_shape` {#StudentTWithAbsDfSoftplusScale.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.event_shape_tensor(name='event_shape_tensor')` {#StudentTWithAbsDfSoftplusScale.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.is_continuous` {#StudentTWithAbsDfSoftplusScale.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.is_scalar_batch(name='is_scalar_batch')` {#StudentTWithAbsDfSoftplusScale.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.is_scalar_event(name='is_scalar_event')` {#StudentTWithAbsDfSoftplusScale.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.loc` {#StudentTWithAbsDfSoftplusScale.loc} - -Locations of these Student's t distribution(s). - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.log_cdf(value, name='log_cdf')` {#StudentTWithAbsDfSoftplusScale.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.log_prob(value, name='log_prob')` {#StudentTWithAbsDfSoftplusScale.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.log_survival_function(value, name='log_survival_function')` {#StudentTWithAbsDfSoftplusScale.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.mean(name='mean')` {#StudentTWithAbsDfSoftplusScale.mean} - -Mean. - -Additional documentation from `StudentT`: - -The mean of Student's T equals `loc` if `df > 1`, otherwise it is -`NaN`. If `self.allow_nan_stats=True`, then an exception will be raised -rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.mode(name='mode')` {#StudentTWithAbsDfSoftplusScale.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.name` {#StudentTWithAbsDfSoftplusScale.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#StudentTWithAbsDfSoftplusScale.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.param_static_shapes(cls, sample_shape)` {#StudentTWithAbsDfSoftplusScale.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.parameters` {#StudentTWithAbsDfSoftplusScale.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.prob(value, name='prob')` {#StudentTWithAbsDfSoftplusScale.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.reparameterization_type` {#StudentTWithAbsDfSoftplusScale.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.sample(sample_shape=(), seed=None, name='sample')` {#StudentTWithAbsDfSoftplusScale.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.scale` {#StudentTWithAbsDfSoftplusScale.scale} - -Scaling factors of these Student's t distribution(s). - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.stddev(name='stddev')` {#StudentTWithAbsDfSoftplusScale.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.survival_function(value, name='survival_function')` {#StudentTWithAbsDfSoftplusScale.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.validate_args` {#StudentTWithAbsDfSoftplusScale.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.variance(name='variance')` {#StudentTWithAbsDfSoftplusScale.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - - -Additional documentation from `StudentT`: - -The variance for Student's T equals - -``` -df / (df - 2), when df > 2 -infinity, when 1 < df <= 2 -NaN, when df <= 1 -``` - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.Uniform` {#Uniform} - -Uniform distribution with `low` and `high` parameters. - -### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; a, b) = I[a <= x < b] / Z -Z = b - a -``` - -where: -* `low = a`, -* `high = b`, -* `Z` is the normalizing constant, and, -* `I[predicate]` is the [indicator function]( - https://en.wikipedia.org/wiki/Indicator_function) for `predicate`. - -The parameters `low` and `high` must be shaped in a way that supports -broadcasting (e.g., `high - low` is a valid operation). - -### Examples - -```python -# Without broadcasting: -u1 = Uniform(low=3.0, high=4.0) # a single uniform distribution [3, 4] -u2 = Uniform(low=[1.0, 2.0], - high=[3.0, 4.0]) # 2 distributions [1, 3], [2, 4] -u3 = Uniform(low=[[1.0, 2.0], - [3.0, 4.0]], - high=[[1.5, 2.5], - [3.5, 4.5]]) # 4 distributions -``` - -```python -# With broadcasting: -u1 = Uniform(low=3.0, high=[5.0, 6.0, 7.0]) # 3 distributions -``` -- - - - -#### `tf.contrib.distributions.Uniform.__init__(low=0.0, high=1.0, validate_args=False, allow_nan_stats=True, name='Uniform')` {#Uniform.__init__} - -Initialize a batch of Uniform distributions. - -##### Args: - - -* `low`: Floating point tensor, lower boundary of the output interval. Must - have `low < high`. -* `high`: Floating point tensor, upper boundary of the output interval. Must - have `low < high`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `InvalidArgumentError`: if `low >= high` and `validate_args=False`. - - -- - - - -#### `tf.contrib.distributions.Uniform.allow_nan_stats` {#Uniform.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Uniform.batch_shape` {#Uniform.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Uniform.batch_shape_tensor(name='batch_shape_tensor')` {#Uniform.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Uniform.cdf(value, name='cdf')` {#Uniform.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Uniform.copy(**override_parameters_kwargs)` {#Uniform.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Uniform.covariance(name='covariance')` {#Uniform.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Uniform.dtype` {#Uniform.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Uniform.entropy(name='entropy')` {#Uniform.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Uniform.event_shape` {#Uniform.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Uniform.event_shape_tensor(name='event_shape_tensor')` {#Uniform.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Uniform.high` {#Uniform.high} - -Upper boundary of the output interval. - - -- - - - -#### `tf.contrib.distributions.Uniform.is_continuous` {#Uniform.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Uniform.is_scalar_batch(name='is_scalar_batch')` {#Uniform.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Uniform.is_scalar_event(name='is_scalar_event')` {#Uniform.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Uniform.log_cdf(value, name='log_cdf')` {#Uniform.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Uniform.log_prob(value, name='log_prob')` {#Uniform.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Uniform.log_survival_function(value, name='log_survival_function')` {#Uniform.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Uniform.low` {#Uniform.low} - -Lower boundary of the output interval. - - -- - - - -#### `tf.contrib.distributions.Uniform.mean(name='mean')` {#Uniform.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Uniform.mode(name='mode')` {#Uniform.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Uniform.name` {#Uniform.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Uniform.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Uniform.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Uniform.param_static_shapes(cls, sample_shape)` {#Uniform.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Uniform.parameters` {#Uniform.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Uniform.prob(value, name='prob')` {#Uniform.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Uniform.range(name='range')` {#Uniform.range} - -`high - low`. - - -- - - - -#### `tf.contrib.distributions.Uniform.reparameterization_type` {#Uniform.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Uniform.sample(sample_shape=(), seed=None, name='sample')` {#Uniform.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Uniform.stddev(name='stddev')` {#Uniform.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Uniform.survival_function(value, name='survival_function')` {#Uniform.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Uniform.validate_args` {#Uniform.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Uniform.variance(name='variance')` {#Uniform.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - - -- - - - -### `class tf.contrib.distributions.MultivariateNormalDiag` {#MultivariateNormalDiag} - -The multivariate normal distribution on `R^k`. - -The Multivariate Normal distribution is defined over `R^k` and parameterized -by a (batch of) length-`k` `loc` vector (aka "mu") and a (batch of) `k x k` -`scale` matrix; `covariance = scale @ scale.T` where `@` denotes -matrix-multiplication. - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; loc, scale) = exp(-0.5 ||y||**2) / Z, -y = inv(scale) @ (x - loc), -Z = (2 pi)**(0.5 k) |det(scale)|, -``` - -where: - -* `loc` is a vector in `R^k`, -* `scale` is a linear operator in `R^{k x k}`, `cov = scale @ scale.T`, -* `Z` denotes the normalization constant, and, -* `||y||**2` denotes the squared Euclidean norm of `y`. - -A (non-batch) `scale` matrix is: - -```none -scale = diag(scale_diag + scale_identity_multiplier * ones(k)) -``` - -where: - -* `scale_diag.shape = [k]`, and, -* `scale_identity_multiplier.shape = []`. - -Additional leading dimensions (if any) will index batches. - -If both `scale_diag` and `scale_identity_multiplier` are `None`, then -`scale` is the Identity matrix. - -The MultivariateNormal distribution is a member of the [location-scale -family](https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be -constructed as, - -```none -X ~ MultivariateNormal(loc=0, scale=1) # Identity scale, zero shift. -Y = scale @ X + loc -``` - -#### Examples - -```python -ds = tf.contrib.distributions - -# Initialize a single 2-variate Gaussian. -mvn = ds.MultivariateNormalDiag( - loc=[1., -1], - scale_diag=[1, 2.]) - -mvn.mean().eval() -# ==> [1., -1] - -mvn.stddev().eval() -# ==> [1., 2] - -# Evaluate this on an observation in `R^2`, returning a scalar. -mvn.prob([-1., 0]).eval() # shape: [] - -# Initialize a 3-batch, 2-variate scaled-identity Gaussian. -mvn = ds.MultivariateNormalDiag( - loc=[1., -1], - scale_identity_multiplier=[1, 2., 3]) - -mvn.mean().eval() # shape: [3, 2] -# ==> [[1., -1] -# [1, -1], -# [1, -1]] - -mvn.stddev().eval() # shape: [3, 2] -# ==> [[1., 1], -# [2, 2], -# [3, 3]] - -# Evaluate this on an observation in `R^2`, returning a length-3 vector. -mvn.prob([-1., 0]).eval() # shape: [3] - -# Initialize a 2-batch of 3-variate Gaussians. -mvn = ds.MultivariateNormalDiag( - loc=[[1., 2, 3], - [11, 22, 33]] # shape: [2, 3] - scale_diag=[[1., 2, 3], - [0.5, 1, 1.5]]) # shape: [2, 3] - -# Evaluate this on a two observations, each in `R^3`, returning a length-2 -# vector. -x = [[-1., 0, 1], - [-11, 0, 11.]] # shape: [2, 3]. -mvn.prob(x).eval() # shape: [2] -``` -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.__init__(loc=None, scale_diag=None, scale_identity_multiplier=None, validate_args=False, allow_nan_stats=True, name='MultivariateNormalDiag')` {#MultivariateNormalDiag.__init__} - -Construct Multivariate Normal distribution on `R^k`. - -The `batch_shape` is the broadcast shape between `loc` and `scale` -arguments. - -The `event_shape` is given by the last dimension of `loc` or the last -dimension of the matrix implied by `scale`. - -Recall that `covariance = scale @ scale.T`. A (non-batch) `scale` matrix is: - -```none -scale = diag(scale_diag + scale_identity_multiplier * ones(k)) -``` - -where: - -* `scale_diag.shape = [k]`, and, -* `scale_identity_multiplier.shape = []`. - -Additional leading dimensions (if any) will index batches. - -If both `scale_diag` and `scale_identity_multiplier` are `None`, then -`scale` is the Identity matrix. - -##### Args: - - -* `loc`: Floating-point `Tensor`. If this is set to `None`, `loc` is - implicitly `0`. When specified, may have shape `[B1, ..., Bb, k]` where - `b >= 0` and `k` is the event size. -* `scale_diag`: Non-zero, floating-point `Tensor` representing a diagonal - matrix added to `scale`. May have shape `[B1, ..., Bb, k]`, `b >= 0`, - and characterizes `b`-batches of `k x k` diagonal matrices added to - `scale`. When both `scale_identity_multiplier` and `scale_diag` are - `None` then `scale` is the `Identity`. -* `scale_identity_multiplier`: Non-zero, floating-point `Tensor` representing - a scaled-identity-matrix added to `scale`. May have shape - `[B1, ..., Bb]`, `b >= 0`, and characterizes `b`-batches of scaled - `k x k` identity matrices added to `scale`. When both - `scale_identity_multiplier` and `scale_diag` are `None` then `scale` is - the `Identity`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, - statistics (e.g., mean, mode, variance) use the value "`NaN`" to - indicate the result is undefined. When `False`, an exception is raised - if one or more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `ValueError`: if at most `scale_identity_multiplier` is specified. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.allow_nan_stats` {#MultivariateNormalDiag.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.batch_shape` {#MultivariateNormalDiag.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.batch_shape_tensor(name='batch_shape_tensor')` {#MultivariateNormalDiag.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.bijector` {#MultivariateNormalDiag.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.cdf(value, name='cdf')` {#MultivariateNormalDiag.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.copy(**override_parameters_kwargs)` {#MultivariateNormalDiag.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.covariance(name='covariance')` {#MultivariateNormalDiag.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.det_covariance(name='det_covariance')` {#MultivariateNormalDiag.det_covariance} - -Determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.distribution` {#MultivariateNormalDiag.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.dtype` {#MultivariateNormalDiag.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.entropy(name='entropy')` {#MultivariateNormalDiag.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.event_shape` {#MultivariateNormalDiag.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.event_shape_tensor(name='event_shape_tensor')` {#MultivariateNormalDiag.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.is_continuous` {#MultivariateNormalDiag.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.is_scalar_batch(name='is_scalar_batch')` {#MultivariateNormalDiag.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.is_scalar_event(name='is_scalar_event')` {#MultivariateNormalDiag.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.loc` {#MultivariateNormalDiag.loc} - -The `loc` `Tensor` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.log_cdf(value, name='log_cdf')` {#MultivariateNormalDiag.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.log_det_covariance(name='log_det_covariance')` {#MultivariateNormalDiag.log_det_covariance} - -Log of determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.log_prob(value, name='log_prob')` {#MultivariateNormalDiag.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalDiag.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.mean(name='mean')` {#MultivariateNormalDiag.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.mode(name='mode')` {#MultivariateNormalDiag.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.name` {#MultivariateNormalDiag.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#MultivariateNormalDiag.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.param_static_shapes(cls, sample_shape)` {#MultivariateNormalDiag.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.parameters` {#MultivariateNormalDiag.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.prob(value, name='prob')` {#MultivariateNormalDiag.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.reparameterization_type` {#MultivariateNormalDiag.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.sample(sample_shape=(), seed=None, name='sample')` {#MultivariateNormalDiag.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.scale` {#MultivariateNormalDiag.scale} - -The `scale` `LinearOperator` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.stddev(name='stddev')` {#MultivariateNormalDiag.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.survival_function(value, name='survival_function')` {#MultivariateNormalDiag.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.validate_args` {#MultivariateNormalDiag.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.variance(name='variance')` {#MultivariateNormalDiag.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.MultivariateNormalTriL` {#MultivariateNormalTriL} - -The multivariate normal distribution on `R^k`. - -The Multivariate Normal distribution is defined over `R^k` and parameterized -by a (batch of) length-`k` `loc` vector (aka "mu") and a (batch of) `k x k` -`scale` matrix; `covariance = scale @ scale.T` where `@` denotes -matrix-multiplication. - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; loc, scale) = exp(-0.5 ||y||**2) / Z, -y = inv(scale) @ (x - loc), -Z = (2 pi)**(0.5 k) |det(scale)|, -``` - -where: - -* `loc` is a vector in `R^k`, -* `scale` is a linear operator in `R^{k x k}`, `cov = scale @ scale.T`, -* `Z` denotes the normalization constant, and, -* `||y||**2` denotes the squared Euclidean norm of `y`. - -A (non-batch) `scale` matrix is: - -```none -scale = scale_tril -``` - -where `scale_tril` is lower-triangular `k x k` matrix with non-zero diagonal, -i.e., `tf.diag_part(scale_tril) != 0`. - -Additional leading dimensions (if any) will index batches. - -The MultivariateNormal distribution is a member of the [location-scale -family](https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be -constructed as, - -```none -X ~ MultivariateNormal(loc=0, scale=1) # Identity scale, zero shift. -Y = scale @ X + loc -``` - -Trainable (batch) lower-triangular matrices can be created with -`ds.matrix_diag_transform()` and/or `ds.fill_lower_triangular()` - -#### Examples - -```python -ds = tf.contrib.distributions - -# Initialize a single 3-variate Gaussian. -mu = [1., 2, 3] -cov = [[ 0.36, 0.12, 0.06], - [ 0.12, 0.29, -0.13], - [ 0.06, -0.13, 0.26]] -scale = tf.cholesky(cov) -# ==> [[ 0.6, 0. , 0. ], -# [ 0.2, 0.5, 0. ], -# [ 0.1, -0.3, 0.4]]) -mvn = ds.MultivariateNormalTriL( - loc=mu, - scale_tril=scale) - -mvn.mean().eval() -# ==> [1., 2, 3] - -# Covariance agrees with cholesky(cov) parameterization. -mvn.covariance().eval() -# ==> [[ 0.36, 0.12, 0.06], -# [ 0.12, 0.29, -0.13], -# [ 0.06, -0.13, 0.26]] - -# Compute the pdf of an observation in `R^3` ; return a scalar. -mvn.prob([-1., 0, 1]).eval() # shape: [] - -# Initialize a 2-batch of 3-variate Gaussians. -mu = [[1., 2, 3], - [11, 22, 33]] # shape: [2, 3] -tril = ... # shape: [2, 3, 3], lower triangular, non-zero diagonal. -mvn = ds.MultivariateNormalTriL( - loc=mu, - scale_tril=tril) - -# Compute the pdf of two `R^3` observations; return a length-2 vector. -x = [[-0.9, 0, 0.1], - [-10, 0, 9]] # shape: [2, 3] -mvn.prob(x).eval() # shape: [2] - -``` -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.__init__(loc=None, scale_tril=None, validate_args=False, allow_nan_stats=True, name='MultivariateNormalTriL')` {#MultivariateNormalTriL.__init__} - -Construct Multivariate Normal distribution on `R^k`. - -The `batch_shape` is the broadcast shape between `loc` and `scale` -arguments. - -The `event_shape` is given by the last dimension of `loc` or the last -dimension of the matrix implied by `scale`. - -Recall that `covariance = scale @ scale.T`. A (non-batch) `scale` matrix is: - -```none -scale = scale_tril -``` - -where `scale_tril` is lower-triangular `k x k` matrix with non-zero -diagonal, i.e., `tf.diag_part(scale_tril) != 0`. - -Additional leading dimensions (if any) will index batches. - -##### Args: - - -* `loc`: Floating-point `Tensor`. If this is set to `None`, `loc` is - implicitly `0`. When specified, may have shape `[B1, ..., Bb, k]` where - `b >= 0` and `k` is the event size. -* `scale_tril`: Floating-point, lower-triangular `Tensor` with non-zero - diagonal elements. `scale_tril` has shape `[B1, ..., Bb, k, k]` where - `b >= 0` and `k` is the event size. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, - statistics (e.g., mean, mode, variance) use the value "`NaN`" to - indicate the result is undefined. When `False`, an exception is raised - if one or more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `ValueError`: if neither `loc` nor `scale_tril` are specified. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.allow_nan_stats` {#MultivariateNormalTriL.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.batch_shape` {#MultivariateNormalTriL.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.batch_shape_tensor(name='batch_shape_tensor')` {#MultivariateNormalTriL.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.bijector` {#MultivariateNormalTriL.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.cdf(value, name='cdf')` {#MultivariateNormalTriL.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.copy(**override_parameters_kwargs)` {#MultivariateNormalTriL.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.covariance(name='covariance')` {#MultivariateNormalTriL.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.det_covariance(name='det_covariance')` {#MultivariateNormalTriL.det_covariance} - -Determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.distribution` {#MultivariateNormalTriL.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.dtype` {#MultivariateNormalTriL.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.entropy(name='entropy')` {#MultivariateNormalTriL.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.event_shape` {#MultivariateNormalTriL.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.event_shape_tensor(name='event_shape_tensor')` {#MultivariateNormalTriL.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.is_continuous` {#MultivariateNormalTriL.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.is_scalar_batch(name='is_scalar_batch')` {#MultivariateNormalTriL.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.is_scalar_event(name='is_scalar_event')` {#MultivariateNormalTriL.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.loc` {#MultivariateNormalTriL.loc} - -The `loc` `Tensor` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.log_cdf(value, name='log_cdf')` {#MultivariateNormalTriL.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.log_det_covariance(name='log_det_covariance')` {#MultivariateNormalTriL.log_det_covariance} - -Log of determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.log_prob(value, name='log_prob')` {#MultivariateNormalTriL.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalTriL.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.mean(name='mean')` {#MultivariateNormalTriL.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.mode(name='mode')` {#MultivariateNormalTriL.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.name` {#MultivariateNormalTriL.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#MultivariateNormalTriL.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.param_static_shapes(cls, sample_shape)` {#MultivariateNormalTriL.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.parameters` {#MultivariateNormalTriL.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.prob(value, name='prob')` {#MultivariateNormalTriL.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.reparameterization_type` {#MultivariateNormalTriL.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.sample(sample_shape=(), seed=None, name='sample')` {#MultivariateNormalTriL.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.scale` {#MultivariateNormalTriL.scale} - -The `scale` `LinearOperator` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.stddev(name='stddev')` {#MultivariateNormalTriL.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.survival_function(value, name='survival_function')` {#MultivariateNormalTriL.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.validate_args` {#MultivariateNormalTriL.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.variance(name='variance')` {#MultivariateNormalTriL.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.MultivariateNormalDiagPlusLowRank` {#MultivariateNormalDiagPlusLowRank} - -The multivariate normal distribution on `R^k`. - -The Multivariate Normal distribution is defined over `R^k` and parameterized -by a (batch of) length-`k` `loc` vector (aka "mu") and a (batch of) `k x k` -`scale` matrix; `covariance = scale @ scale.T` where `@` denotes -matrix-multiplication. - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; loc, scale) = exp(-0.5 ||y||**2) / Z, -y = inv(scale) @ (x - loc), -Z = (2 pi)**(0.5 k) |det(scale)|, -``` - -where: - -* `loc` is a vector in `R^k`, -* `scale` is a linear operator in `R^{k x k}`, `cov = scale @ scale.T`, -* `Z` denotes the normalization constant, and, -* `||y||**2` denotes the squared Euclidean norm of `y`. - -A (non-batch) `scale` matrix is: - -```none -scale = diag(scale_diag + scale_identity_multiplier ones(k)) + - scale_perturb_factor @ diag(scale_perturb_diag) @ scale_perturb_factor.T -``` - -where: - -* `scale_diag.shape = [k]`, -* `scale_identity_multiplier.shape = []`, -* `scale_perturb_factor.shape = [k, r]`, typically `k >> r`, and, -* `scale_perturb_diag.shape = [r]`. - -Additional leading dimensions (if any) will index batches. - -If both `scale_diag` and `scale_identity_multiplier` are `None`, then -`scale` is the Identity matrix. - -The MultivariateNormal distribution is a member of the [location-scale -family](https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be -constructed as, - -```none -X ~ MultivariateNormal(loc=0, scale=1) # Identity scale, zero shift. -Y = scale @ X + loc -``` - -#### Examples - -```python -ds = tf.contrib.distributions - -# Initialize a single 3-variate Gaussian with covariance `cov = S @ S.T`, -# `S = diag(d) + U @ diag(m) @ U.T`. The perturbation, `U @ diag(m) @ U.T`, is -# a rank-2 update. -mu = [-0.5., 0, 0.5] # shape: [3] -d = [1.5, 0.5, 2] # shape: [3] -U = [[1., 2], - [-1, 1], - [2, -0.5]] # shape: [3, 2] -m = [4., 5] # shape: [2] -mvn = ds.MultivariateNormalDiagPlusLowRank( - loc=mu - scale_diag=d - scale_perturb_factor=U, - scale_perturb_diag=m) - -# Evaluate this on an observation in `R^3`, returning a scalar. -mvn.prob([-1, 0, 1]).eval() # shape: [] - -# Initialize a 2-batch of 3-variate Gaussians; `S = diag(d) + U @ U.T`. -mu = [[1., 2, 3], - [11, 22, 33]] # shape: [b, k] = [2, 3] -U = [[[1., 2], - [3, 4], - [5, 6]], - [[0.5, 0.75], - [1,0, 0.25], - [1.5, 1.25]]] # shape: [b, k, r] = [2, 3, 2] -m = [[0.1, 0.2], - [0.4, 0.5]] # shape: [b, r] = [2, 2] - -mvn = ds.MultivariateNormalDiagPlusLowRank( - loc=mu, - scale_perturb_factor=U, - scale_perturb_diag=m) - -mvn.covariance().eval() # shape: [2, 3, 3] -# ==> [[[ 15.63 31.57 48.51] -# [ 31.57 69.31 105.05] -# [ 48.51 105.05 162.59]] -# -# [[ 2.59 1.41 3.35] -# [ 1.41 2.71 3.34] -# [ 3.35 3.34 8.35]]] - -# Compute the pdf of two `R^3` observations (one from each batch); -# return a length-2 vector. -x = [[-0.9, 0, 0.1], - [-10, 0, 9]] # shape: [2, 3] -mvn.prob(x).eval() # shape: [2] -``` -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.__init__(loc=None, scale_diag=None, scale_identity_multiplier=None, scale_perturb_factor=None, scale_perturb_diag=None, validate_args=False, allow_nan_stats=True, name='MultivariateNormalDiagPlusLowRank')` {#MultivariateNormalDiagPlusLowRank.__init__} - -Construct Multivariate Normal distribution on `R^k`. - -The `batch_shape` is the broadcast shape between `loc` and `scale` -arguments. - -The `event_shape` is given by the last dimension of `loc` or the last -dimension of the matrix implied by `scale`. - -Recall that `covariance = scale @ scale.T`. A (non-batch) `scale` matrix is: - -```none -scale = diag(scale_diag + scale_identity_multiplier ones(k)) + - scale_perturb_factor @ diag(scale_perturb_diag) @ scale_perturb_factor.T -``` - -where: - -* `scale_diag.shape = [k]`, -* `scale_identity_multiplier.shape = []`, -* `scale_perturb_factor.shape = [k, r]`, typically `k >> r`, and, -* `scale_perturb_diag.shape = [r]`. - -Additional leading dimensions (if any) will index batches. - -If both `scale_diag` and `scale_identity_multiplier` are `None`, then -`scale` is the Identity matrix. - -##### Args: - - -* `loc`: Floating-point `Tensor`. If this is set to `None`, `loc` is - implicitly `0`. When specified, may have shape `[B1, ..., Bb, k]` where - `b >= 0` and `k` is the event size. -* `scale_diag`: Non-zero, floating-point `Tensor` representing a diagonal - matrix added to `scale`. May have shape `[B1, ..., Bb, k]`, `b >= 0`, - and characterizes `b`-batches of `k x k` diagonal matrices added to - `scale`. When both `scale_identity_multiplier` and `scale_diag` are - `None` then `scale` is the `Identity`. -* `scale_identity_multiplier`: Non-zero, floating-point `Tensor` representing - a scaled-identity-matrix added to `scale`. May have shape - `[B1, ..., Bb]`, `b >= 0`, and characterizes `b`-batches of scaled - `k x k` identity matrices added to `scale`. When both - `scale_identity_multiplier` and `scale_diag` are `None` then `scale` is - the `Identity`. -* `scale_perturb_factor`: Floating-point `Tensor` representing a rank-`r` - perturbation added to `scale`. May have shape `[B1, ..., Bb, k, r]`, - `b >= 0`, and characterizes `b`-batches of rank-`r` updates to `scale`. - When `None`, no rank-`r` update is added to `scale`. -* `scale_perturb_diag`: Floating-point `Tensor` representing a diagonal matrix - inside the rank-`r` perturbation added to `scale`. May have shape - `[B1, ..., Bb, r]`, `b >= 0`, and characterizes `b`-batches of `r x r` - diagonal matrices inside the perturbation added to `scale`. When - `None`, an identity matrix is used inside the perturbation. Can only be - specified if `scale_perturb_factor` is also specified. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, - statistics (e.g., mean, mode, variance) use the value "`NaN`" to - indicate the result is undefined. When `False`, an exception is raised - if one or more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `ValueError`: if at most `scale_identity_multiplier` is specified. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.allow_nan_stats` {#MultivariateNormalDiagPlusLowRank.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.batch_shape` {#MultivariateNormalDiagPlusLowRank.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.batch_shape_tensor(name='batch_shape_tensor')` {#MultivariateNormalDiagPlusLowRank.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.bijector` {#MultivariateNormalDiagPlusLowRank.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.cdf(value, name='cdf')` {#MultivariateNormalDiagPlusLowRank.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.copy(**override_parameters_kwargs)` {#MultivariateNormalDiagPlusLowRank.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.covariance(name='covariance')` {#MultivariateNormalDiagPlusLowRank.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.det_covariance(name='det_covariance')` {#MultivariateNormalDiagPlusLowRank.det_covariance} - -Determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.distribution` {#MultivariateNormalDiagPlusLowRank.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.dtype` {#MultivariateNormalDiagPlusLowRank.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.entropy(name='entropy')` {#MultivariateNormalDiagPlusLowRank.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.event_shape` {#MultivariateNormalDiagPlusLowRank.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.event_shape_tensor(name='event_shape_tensor')` {#MultivariateNormalDiagPlusLowRank.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.is_continuous` {#MultivariateNormalDiagPlusLowRank.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.is_scalar_batch(name='is_scalar_batch')` {#MultivariateNormalDiagPlusLowRank.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.is_scalar_event(name='is_scalar_event')` {#MultivariateNormalDiagPlusLowRank.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.loc` {#MultivariateNormalDiagPlusLowRank.loc} - -The `loc` `Tensor` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.log_cdf(value, name='log_cdf')` {#MultivariateNormalDiagPlusLowRank.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.log_det_covariance(name='log_det_covariance')` {#MultivariateNormalDiagPlusLowRank.log_det_covariance} - -Log of determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.log_prob(value, name='log_prob')` {#MultivariateNormalDiagPlusLowRank.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalDiagPlusLowRank.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.mean(name='mean')` {#MultivariateNormalDiagPlusLowRank.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.mode(name='mode')` {#MultivariateNormalDiagPlusLowRank.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.name` {#MultivariateNormalDiagPlusLowRank.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#MultivariateNormalDiagPlusLowRank.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.param_static_shapes(cls, sample_shape)` {#MultivariateNormalDiagPlusLowRank.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.parameters` {#MultivariateNormalDiagPlusLowRank.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.prob(value, name='prob')` {#MultivariateNormalDiagPlusLowRank.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.reparameterization_type` {#MultivariateNormalDiagPlusLowRank.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.sample(sample_shape=(), seed=None, name='sample')` {#MultivariateNormalDiagPlusLowRank.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.scale` {#MultivariateNormalDiagPlusLowRank.scale} - -The `scale` `LinearOperator` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.stddev(name='stddev')` {#MultivariateNormalDiagPlusLowRank.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.survival_function(value, name='survival_function')` {#MultivariateNormalDiagPlusLowRank.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.validate_args` {#MultivariateNormalDiagPlusLowRank.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.variance(name='variance')` {#MultivariateNormalDiagPlusLowRank.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale` {#MultivariateNormalDiagWithSoftplusScale} - -MultivariateNormalDiag with `diag_stddev = softplus(diag_stddev)`. -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.__init__(loc, scale_diag, validate_args=False, allow_nan_stats=True, name='MultivariateNormalDiagWithSoftplusScale')` {#MultivariateNormalDiagWithSoftplusScale.__init__} - - - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.allow_nan_stats` {#MultivariateNormalDiagWithSoftplusScale.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.batch_shape` {#MultivariateNormalDiagWithSoftplusScale.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.batch_shape_tensor(name='batch_shape_tensor')` {#MultivariateNormalDiagWithSoftplusScale.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.bijector` {#MultivariateNormalDiagWithSoftplusScale.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.cdf(value, name='cdf')` {#MultivariateNormalDiagWithSoftplusScale.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.copy(**override_parameters_kwargs)` {#MultivariateNormalDiagWithSoftplusScale.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.covariance(name='covariance')` {#MultivariateNormalDiagWithSoftplusScale.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.det_covariance(name='det_covariance')` {#MultivariateNormalDiagWithSoftplusScale.det_covariance} - -Determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.distribution` {#MultivariateNormalDiagWithSoftplusScale.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.dtype` {#MultivariateNormalDiagWithSoftplusScale.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.entropy(name='entropy')` {#MultivariateNormalDiagWithSoftplusScale.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.event_shape` {#MultivariateNormalDiagWithSoftplusScale.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.event_shape_tensor(name='event_shape_tensor')` {#MultivariateNormalDiagWithSoftplusScale.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.is_continuous` {#MultivariateNormalDiagWithSoftplusScale.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.is_scalar_batch(name='is_scalar_batch')` {#MultivariateNormalDiagWithSoftplusScale.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.is_scalar_event(name='is_scalar_event')` {#MultivariateNormalDiagWithSoftplusScale.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.loc` {#MultivariateNormalDiagWithSoftplusScale.loc} - -The `loc` `Tensor` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.log_cdf(value, name='log_cdf')` {#MultivariateNormalDiagWithSoftplusScale.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.log_det_covariance(name='log_det_covariance')` {#MultivariateNormalDiagWithSoftplusScale.log_det_covariance} - -Log of determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.log_prob(value, name='log_prob')` {#MultivariateNormalDiagWithSoftplusScale.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalDiagWithSoftplusScale.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.mean(name='mean')` {#MultivariateNormalDiagWithSoftplusScale.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.mode(name='mode')` {#MultivariateNormalDiagWithSoftplusScale.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.name` {#MultivariateNormalDiagWithSoftplusScale.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#MultivariateNormalDiagWithSoftplusScale.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.param_static_shapes(cls, sample_shape)` {#MultivariateNormalDiagWithSoftplusScale.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.parameters` {#MultivariateNormalDiagWithSoftplusScale.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.prob(value, name='prob')` {#MultivariateNormalDiagWithSoftplusScale.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.reparameterization_type` {#MultivariateNormalDiagWithSoftplusScale.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.sample(sample_shape=(), seed=None, name='sample')` {#MultivariateNormalDiagWithSoftplusScale.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.scale` {#MultivariateNormalDiagWithSoftplusScale.scale} - -The `scale` `LinearOperator` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.stddev(name='stddev')` {#MultivariateNormalDiagWithSoftplusScale.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.survival_function(value, name='survival_function')` {#MultivariateNormalDiagWithSoftplusScale.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.validate_args` {#MultivariateNormalDiagWithSoftplusScale.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.variance(name='variance')` {#MultivariateNormalDiagWithSoftplusScale.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - - -- - - - -### `class tf.contrib.distributions.Dirichlet` {#Dirichlet} - -Dirichlet distribution. - -The Dirichlet distribution is defined over the -[`(k-1)`-simplex](https://en.wikipedia.org/wiki/Simplex) using a positive, -length-`k` vector `concentration` (`k > 1`). The Dirichlet is identically the -Beta distribution when `k = 2`. - -#### Mathematical Details - -The Dirichlet is a distribution over the open `(k-1)`-simplex, i.e., - -```none -S^{k-1} = { (x_0, ..., x_{k-1}) in R^k : sum_j x_j = 1 and all_j x_j > 0 }. -``` - -The probability density function (pdf) is, - -```none -pdf(x; alpha) = prod_j x_j**(alpha_j - 1) / Z -Z = prod_j Gamma(alpha_j) / Gamma(sum_j alpha_j) -``` - -where: - -* `x in S^{k-1}`, i.e., the `(k-1)`-simplex, -* `concentration = alpha = [alpha_0, ..., alpha_{k-1}]`, `alpha_j > 0`, -* `Z` is the normalization constant aka the [multivariate beta function]( - https://en.wikipedia.org/wiki/Beta_function#Multivariate_beta_function), - and, -* `Gamma` is the [gamma function]( - https://en.wikipedia.org/wiki/Gamma_function). - -The `concentration` represents mean total counts of class occurrence, i.e., - -```none -concentration = alpha = mean * total_concentration -``` - -where `mean` in `S^{k-1}` and `total_concentration` is a positive real number -representing a mean total count. - -Distribution parameters are automatically broadcast in all functions; see -examples for details. - -#### Examples - -```python -# Create a single trivariate Dirichlet, with the 3rd class being three times -# more frequent than the first. I.e., batch_shape=[], event_shape=[3]. -alpha = [1., 2, 3] -dist = Dirichlet(alpha) - -dist.sample([4, 5]) # shape: [4, 5, 3] - -# x has one sample, one batch, three classes: -x = [.2, .3, .5] # shape: [3] -dist.prob(x) # shape: [] - -# x has two samples from one batch: -x = [[.1, .4, .5], - [.2, .3, .5]] -dist.prob(x) # shape: [2] - -# alpha will be broadcast to shape [5, 7, 3] to match x. -x = [[...]] # shape: [5, 7, 3] -dist.prob(x) # shape: [5, 7] -``` - -```python -# Create batch_shape=[2], event_shape=[3]: -alpha = [[1., 2, 3], - [4, 5, 6]] # shape: [2, 3] -dist = Dirichlet(alpha) - -dist.sample([4, 5]) # shape: [4, 5, 2, 3] - -x = [.2, .3, .5] -# x will be broadcast as [[.2, .3, .5], -# [.2, .3, .5]], -# thus matching batch_shape [2, 3]. -dist.prob(x) # shape: [2] -``` -- - - - -#### `tf.contrib.distributions.Dirichlet.__init__(concentration, validate_args=False, allow_nan_stats=True, name='Dirichlet')` {#Dirichlet.__init__} - -Initialize a batch of Dirichlet distributions. - -##### Args: - - -* `concentration`: Positive floating-point `Tensor` indicating mean number - of class occurrences; aka "alpha". Implies `self.dtype`, and - `self.batch_shape`, `self.event_shape`, i.e., if - `concentration.shape = [N1, N2, ..., Nm, k]` then - `batch_shape = [N1, N2, ..., Nm]` and - `event_shape = [k]`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.allow_nan_stats` {#Dirichlet.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.batch_shape` {#Dirichlet.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.batch_shape_tensor(name='batch_shape_tensor')` {#Dirichlet.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.cdf(value, name='cdf')` {#Dirichlet.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.concentration` {#Dirichlet.concentration} - -Concentration parameter; expected counts for that coordinate. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.copy(**override_parameters_kwargs)` {#Dirichlet.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.covariance(name='covariance')` {#Dirichlet.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.dtype` {#Dirichlet.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.entropy(name='entropy')` {#Dirichlet.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.event_shape` {#Dirichlet.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.event_shape_tensor(name='event_shape_tensor')` {#Dirichlet.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.is_continuous` {#Dirichlet.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Dirichlet.is_scalar_batch(name='is_scalar_batch')` {#Dirichlet.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.is_scalar_event(name='is_scalar_event')` {#Dirichlet.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.log_cdf(value, name='log_cdf')` {#Dirichlet.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.log_prob(value, name='log_prob')` {#Dirichlet.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Dirichlet`: - -Note: `value` must be a non-negative tensor with -dtype `self.dtype` and be in the `(self.event_shape() - 1)`-simplex, i.e., -`tf.reduce_sum(value, -1) = 1`. It must have a shape compatible with -`self.batch_shape() + self.event_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.log_survival_function(value, name='log_survival_function')` {#Dirichlet.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.mean(name='mean')` {#Dirichlet.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.mode(name='mode')` {#Dirichlet.mode} - -Mode. - -Additional documentation from `Dirichlet`: - -Note: The mode is undefined when any `concentration <= 1`. If -`self.allow_nan_stats` is `True`, `NaN` is used for undefined modes. If -`self.allow_nan_stats` is `False` an exception is raised when one or more -modes are undefined. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.name` {#Dirichlet.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Dirichlet.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.param_static_shapes(cls, sample_shape)` {#Dirichlet.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.parameters` {#Dirichlet.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.prob(value, name='prob')` {#Dirichlet.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Dirichlet`: - -Note: `value` must be a non-negative tensor with -dtype `self.dtype` and be in the `(self.event_shape() - 1)`-simplex, i.e., -`tf.reduce_sum(value, -1) = 1`. It must have a shape compatible with -`self.batch_shape() + self.event_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.reparameterization_type` {#Dirichlet.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.sample(sample_shape=(), seed=None, name='sample')` {#Dirichlet.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.stddev(name='stddev')` {#Dirichlet.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.survival_function(value, name='survival_function')` {#Dirichlet.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.total_concentration` {#Dirichlet.total_concentration} - -Sum of last dim of concentration parameter. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.validate_args` {#Dirichlet.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.variance(name='variance')` {#Dirichlet.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.DirichletMultinomial` {#DirichletMultinomial} - -Dirichlet-Multinomial compound distribution. - -The Dirichlet-Multinomial distribution is parameterized by a (batch of) -length-`k` `concentration` vectors (`k > 1`) and a `total_count` number of -trials, i.e., the number of trials per draw from the DirichletMultinomial. It -is defined over a (batch of) length-`k` vector `counts` such that -`tf.reduce_sum(counts, -1) = total_count`. The Dirichlet-Multinomial is -identically the Beta-Binomial distribution when `k = 2`. - -#### Mathematical Details - -The Dirichlet-Multinomial is a distribution over `k`-class counts, i.e., a -length-`k` vector of non-negative integer `counts = n = [n_0, ..., n_{k-1}]`. - -The probability mass function (pmf) is, - -```none -pmf(n; alpha, N) = Beta(alpha + n) / (prod_j n_j!) / Z -Z = Beta(alpha) / N! -``` - -where: - -* `concentration = alpha = [alpha_0, ..., alpha_{k-1}]`, `alpha_j > 0`, -* `total_count = N`, `N` a positive integer, -* `N!` is `N` factorial, and, -* `Beta(x) = prod_j Gamma(x_j) / Gamma(sum_j x_j)` is the - [multivariate beta function]( - https://en.wikipedia.org/wiki/Beta_function#Multivariate_beta_function), - and, -* `Gamma` is the [gamma function]( - https://en.wikipedia.org/wiki/Gamma_function). - -Dirichlet-Multinomial is a [compound distribution]( -https://en.wikipedia.org/wiki/Compound_probability_distribution), i.e., its -samples are generated as follows. - - 1. Choose class probabilities: - `probs = [p_0,...,p_{k-1}] ~ Dir(concentration)` - 2. Draw integers: - `counts = [n_0,...,n_{k-1}] ~ Multinomial(total_count, probs)` - -The last `concentration` dimension parametrizes a single Dirichlet-Multinomial -distribution. When calling distribution functions (e.g., `dist.prob(counts)`), -`concentration`, `total_count` and `counts` are broadcast to the same shape. -The last dimension of of `counts` corresponds single Dirichlet-Multinomial -distributions. - -Distribution parameters are automatically broadcast in all functions; see -examples for details. - -#### Examples - -```python -alpha = [1, 2, 3] -n = 2 -dist = DirichletMultinomial(n, alpha) -``` - -Creates a 3-class distribution, with the 3rd class is most likely to be drawn. -The distribution functions can be evaluated on counts. - -```python -# counts same shape as alpha. -counts = [0, 0, 2] -dist.prob(counts) # Shape [] - -# alpha will be broadcast to [[1, 2, 3], [1, 2, 3]] to match counts. -counts = [[1, 1, 0], [1, 0, 1]] -dist.prob(counts) # Shape [2] - -# alpha will be broadcast to shape [5, 7, 3] to match counts. -counts = [[...]] # Shape [5, 7, 3] -dist.prob(counts) # Shape [5, 7] -``` - -Creates a 2-batch of 3-class distributions. - -```python -alpha = [[1, 2, 3], [4, 5, 6]] # Shape [2, 3] -n = [3, 3] -dist = DirichletMultinomial(n, alpha) - -# counts will be broadcast to [[2, 1, 0], [2, 1, 0]] to match alpha. -counts = [2, 1, 0] -dist.prob(counts) # Shape [2] -``` -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.__init__(total_count, concentration, validate_args=False, allow_nan_stats=True, name='DirichletMultinomial')` {#DirichletMultinomial.__init__} - -Initialize a batch of DirichletMultinomial distributions. - -##### Args: - - -* `total_count`: Non-negative floating point tensor, whose dtype is the same - as `concentration`. The shape is broadcastable to `[N1,..., Nm]` with - `m >= 0`. Defines this as a batch of `N1 x ... x Nm` different - Dirichlet multinomial distributions. Its components should be equal to - integer values. -* `concentration`: Positive floating point tensor, whose dtype is the - same as `n` with shape broadcastable to `[N1,..., Nm, k]` `m >= 0`. - Defines this as a batch of `N1 x ... x Nm` different `k` class Dirichlet - multinomial distributions. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.allow_nan_stats` {#DirichletMultinomial.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.batch_shape` {#DirichletMultinomial.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.batch_shape_tensor(name='batch_shape_tensor')` {#DirichletMultinomial.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.cdf(value, name='cdf')` {#DirichletMultinomial.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.concentration` {#DirichletMultinomial.concentration} - -Concentration parameter; expected prior counts for that coordinate. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.copy(**override_parameters_kwargs)` {#DirichletMultinomial.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.covariance(name='covariance')` {#DirichletMultinomial.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - - -Additional documentation from `DirichletMultinomial`: - -The covariance for each batch member is defined as the following: - -```none -Var(X_j) = n * alpha_j / alpha_0 * (1 - alpha_j / alpha_0) * -(n + alpha_0) / (1 + alpha_0) -``` - -where `concentration = alpha` and -`total_concentration = alpha_0 = sum_j alpha_j`. - -The covariance between elements in a batch is defined as: - -```none -Cov(X_i, X_j) = -n * alpha_i * alpha_j / alpha_0 ** 2 * -(n + alpha_0) / (1 + alpha_0) -``` - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.dtype` {#DirichletMultinomial.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.entropy(name='entropy')` {#DirichletMultinomial.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.event_shape` {#DirichletMultinomial.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.event_shape_tensor(name='event_shape_tensor')` {#DirichletMultinomial.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.is_continuous` {#DirichletMultinomial.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.is_scalar_batch(name='is_scalar_batch')` {#DirichletMultinomial.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.is_scalar_event(name='is_scalar_event')` {#DirichletMultinomial.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.log_cdf(value, name='log_cdf')` {#DirichletMultinomial.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.log_prob(value, name='log_prob')` {#DirichletMultinomial.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `DirichletMultinomial`: - -For each batch of counts, -`value = [n_0, ..., n_{k-1}]`, `P[value]` is the probability that after -sampling `self.total_count` draws from this Dirichlet-Multinomial distribution, -the number of draws falling in class `j` is `n_j`. Since this definition is -[exchangeable](https://en.wikipedia.org/wiki/Exchangeable_random_variables); -different sequences have the same counts so the probability includes a -combinatorial coefficient. - -Note: `value` must be a non-negative tensor with dtype `self.dtype`, have no -fractional components, and such that -`tf.reduce_sum(value, -1) = self.total_count`. Its shape must be broadcastable -with `self.concentration` and `self.total_count`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.log_survival_function(value, name='log_survival_function')` {#DirichletMultinomial.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.mean(name='mean')` {#DirichletMultinomial.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.mode(name='mode')` {#DirichletMultinomial.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.name` {#DirichletMultinomial.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#DirichletMultinomial.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.param_static_shapes(cls, sample_shape)` {#DirichletMultinomial.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.parameters` {#DirichletMultinomial.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.prob(value, name='prob')` {#DirichletMultinomial.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `DirichletMultinomial`: - -For each batch of counts, -`value = [n_0, ..., n_{k-1}]`, `P[value]` is the probability that after -sampling `self.total_count` draws from this Dirichlet-Multinomial distribution, -the number of draws falling in class `j` is `n_j`. Since this definition is -[exchangeable](https://en.wikipedia.org/wiki/Exchangeable_random_variables); -different sequences have the same counts so the probability includes a -combinatorial coefficient. - -Note: `value` must be a non-negative tensor with dtype `self.dtype`, have no -fractional components, and such that -`tf.reduce_sum(value, -1) = self.total_count`. Its shape must be broadcastable -with `self.concentration` and `self.total_count`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.reparameterization_type` {#DirichletMultinomial.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.sample(sample_shape=(), seed=None, name='sample')` {#DirichletMultinomial.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.stddev(name='stddev')` {#DirichletMultinomial.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.survival_function(value, name='survival_function')` {#DirichletMultinomial.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.total_concentration` {#DirichletMultinomial.total_concentration} - -Sum of last dim of concentration parameter. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.total_count` {#DirichletMultinomial.total_count} - -Number of trials used to construct a sample. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.validate_args` {#DirichletMultinomial.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.variance(name='variance')` {#DirichletMultinomial.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.Multinomial` {#Multinomial} - -Multinomial distribution. - -This Multinomial distribution is parameterized by `probs`, a (batch of) -length-`k` `prob` (probability) vectors (`k > 1`) such that -`tf.reduce_sum(probs, -1) = 1`, and a `total_count` number of trials, i.e., -the number of trials per draw from the Multinomial. It is defined over a -(batch of) length-`k` vector `counts` such that -`tf.reduce_sum(counts, -1) = total_count`. The Multinomial is identically the -Binomial distribution when `k = 2`. - -#### Mathematical Details - -The Multinomial is a distribution over `k`-class counts, i.e., a length-`k` -vector of non-negative integer `counts = n = [n_0, ..., n_{k-1}]`. - -The probability mass function (pmf) is, - -```none -pmf(n; pi, N) = prod_j (pi_j)**n_j / Z -Z = (prod_j n_j!) / N! -``` - -where: -* `probs = pi = [pi_0, ..., pi_{k-1}]`, `pi_j > 0`, `sum_j pi_j = 1`, -* `total_count = N`, `N` a positive integer, -* `Z` is the normalization constant, and, -* `N!` denotes `N` factorial. - -Distribution parameters are automatically broadcast in all functions; see -examples for details. - -#### Examples - -Create a 3-class distribution, with the 3rd class is most likely to be drawn, -using logits. - -```python -logits = [-50., -43, 0] -dist = Multinomial(total_count=4., logits=logits) -``` - -Create a 3-class distribution, with the 3rd class is most likely to be drawn. - -```python -p = [.2, .3, .5] -dist = Multinomial(total_count=4., probs=p) -``` - -The distribution functions can be evaluated on counts. - -```python -# counts same shape as p. -counts = [1., 0, 3] -dist.prob(counts) # Shape [] - -# p will be broadcast to [[.2, .3, .5], [.2, .3, .5]] to match counts. -counts = [[1., 2, 1], [2, 2, 0]] -dist.prob(counts) # Shape [2] - -# p will be broadcast to shape [5, 7, 3] to match counts. -counts = [[...]] # Shape [5, 7, 3] -dist.prob(counts) # Shape [5, 7] -``` - -Create a 2-batch of 3-class distributions. - -```python -p = [[.1, .2, .7], [.3, .3, .4]] # Shape [2, 3] -dist = Multinomial(total_count=[4., 5], probs=p) - -counts = [[2., 1, 1], [3, 1, 1]] -dist.prob(counts) # Shape [2] -``` -- - - - -#### `tf.contrib.distributions.Multinomial.__init__(total_count, logits=None, probs=None, validate_args=False, allow_nan_stats=True, name='Multinomial')` {#Multinomial.__init__} - -Initialize a batch of Multinomial distributions. - -##### Args: - - -* `total_count`: Non-negative floating point tensor with shape broadcastable - to `[N1,..., Nm]` with `m >= 0`. Defines this as a batch of - `N1 x ... x Nm` different Multinomial distributions. Its components - should be equal to integer values. -* `logits`: Floating point tensor representing the log-odds of a - positive event with shape broadcastable to `[N1,..., Nm, k], m >= 0`, - and the same dtype as `total_count`. Defines this as a batch of - `N1 x ... x Nm` different `k` class Multinomial distributions. Only one - of `logits` or `probs` should be passed in. -* `probs`: Positive floating point tensor with shape broadcastable to - `[N1,..., Nm, k]` `m >= 0` and same dtype as `total_count`. Defines - this as a batch of `N1 x ... x Nm` different `k` class Multinomial - distributions. `probs`'s components in the last portion of its shape - should sum to `1`. Only one of `logits` or `probs` should be passed in. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Multinomial.allow_nan_stats` {#Multinomial.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.batch_shape` {#Multinomial.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Multinomial.batch_shape_tensor(name='batch_shape_tensor')` {#Multinomial.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.cdf(value, name='cdf')` {#Multinomial.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.copy(**override_parameters_kwargs)` {#Multinomial.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.covariance(name='covariance')` {#Multinomial.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.dtype` {#Multinomial.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.entropy(name='entropy')` {#Multinomial.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Multinomial.event_shape` {#Multinomial.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Multinomial.event_shape_tensor(name='event_shape_tensor')` {#Multinomial.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.is_continuous` {#Multinomial.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Multinomial.is_scalar_batch(name='is_scalar_batch')` {#Multinomial.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.is_scalar_event(name='is_scalar_event')` {#Multinomial.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.log_cdf(value, name='log_cdf')` {#Multinomial.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.log_prob(value, name='log_prob')` {#Multinomial.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Multinomial`: - -For each batch of counts, `value = [n_0, ... -,n_{k-1}]`, `P[value]` is the probability that after sampling `self.total_count` -draws from this Multinomial distribution, the number of draws falling in class -`j` is `n_j`. Since this definition is [exchangeable]( -https://en.wikipedia.org/wiki/Exchangeable_random_variables); different -sequences have the same counts so the probability includes a combinatorial -coefficient. - -Note: `value` must be a non-negative tensor with dtype `self.dtype`, have no -fractional components, and such that -`tf.reduce_sum(value, -1) = self.total_count`. Its shape must be broadcastable -with `self.probs` and `self.total_count`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.log_survival_function(value, name='log_survival_function')` {#Multinomial.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.logits` {#Multinomial.logits} - -Vector of coordinatewise logits. - - -- - - - -#### `tf.contrib.distributions.Multinomial.mean(name='mean')` {#Multinomial.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Multinomial.mode(name='mode')` {#Multinomial.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Multinomial.name` {#Multinomial.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Multinomial.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Multinomial.param_static_shapes(cls, sample_shape)` {#Multinomial.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Multinomial.parameters` {#Multinomial.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.prob(value, name='prob')` {#Multinomial.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Multinomial`: - -For each batch of counts, `value = [n_0, ... -,n_{k-1}]`, `P[value]` is the probability that after sampling `self.total_count` -draws from this Multinomial distribution, the number of draws falling in class -`j` is `n_j`. Since this definition is [exchangeable]( -https://en.wikipedia.org/wiki/Exchangeable_random_variables); different -sequences have the same counts so the probability includes a combinatorial -coefficient. - -Note: `value` must be a non-negative tensor with dtype `self.dtype`, have no -fractional components, and such that -`tf.reduce_sum(value, -1) = self.total_count`. Its shape must be broadcastable -with `self.probs` and `self.total_count`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.probs` {#Multinomial.probs} - -Probability of of drawing a `1` in that coordinate. - - -- - - - -#### `tf.contrib.distributions.Multinomial.reparameterization_type` {#Multinomial.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.sample(sample_shape=(), seed=None, name='sample')` {#Multinomial.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.stddev(name='stddev')` {#Multinomial.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.survival_function(value, name='survival_function')` {#Multinomial.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.total_count` {#Multinomial.total_count} - -Number of trials used to construct a sample. - - -- - - - -#### `tf.contrib.distributions.Multinomial.validate_args` {#Multinomial.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Multinomial.variance(name='variance')` {#Multinomial.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.WishartCholesky` {#WishartCholesky} - -The matrix Wishart distribution on positive definite matrices. - -This distribution is defined by a scalar degrees of freedom `df` and a -lower, triangular Cholesky factor which characterizes the scale matrix. - -Using WishartCholesky is a constant-time improvement over WishartFull. It -saves an O(nbk^3) operation, i.e., a matrix-product operation for sampling -and a Cholesky factorization in log_prob. For most use-cases it often saves -another O(nbk^3) operation since most uses of Wishart will also use the -Cholesky factorization. - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(X; df, scale) = det(X)**(0.5 (df-k-1)) exp(-0.5 tr[inv(scale) X]) / Z -Z = 2**(0.5 df k) |det(scale)|**(0.5 df) Gamma_k(0.5 df) -``` - -where: -* `df >= k` denotes the degrees of freedom, -* `scale` is a symmetric, positive definite, `k x k` matrix, -* `Z` is the normalizing constant, and, -* `Gamma_k` is the [multivariate Gamma function]( - https://en.wikipedia.org/wiki/Multivariate_gamma_function). - - -#### Examples - -```python -# Initialize a single 3x3 Wishart with Cholesky factored scale matrix and 5 -# degrees-of-freedom.(*) -df = 5 -chol_scale = tf.cholesky(...) # Shape is [3, 3]. -dist = tf.contrib.distributions.WishartCholesky(df=df, scale=chol_scale) - -# Evaluate this on an observation in R^3, returning a scalar. -x = ... # A 3x3 positive definite matrix. -dist.prob(x) # Shape is [], a scalar. - -# Evaluate this on a two observations, each in R^{3x3}, returning a length two -# Tensor. -x = [x0, x1] # Shape is [2, 3, 3]. -dist.prob(x) # Shape is [2]. - -# Initialize two 3x3 Wisharts with Cholesky factored scale matrices. -df = [5, 4] -chol_scale = tf.cholesky(...) # Shape is [2, 3, 3]. -dist = tf.contrib.distributions.WishartCholesky(df=df, scale=chol_scale) - -# Evaluate this on four observations. -x = [[x0, x1], [x2, x3]] # Shape is [2, 2, 3, 3]. -dist.prob(x) # Shape is [2, 2]. - -# (*) - To efficiently create a trainable covariance matrix, see the example -# in tf.contrib.distributions.matrix_diag_transform. -``` -- - - - -#### `tf.contrib.distributions.WishartCholesky.__init__(df, scale, cholesky_input_output_matrices=False, validate_args=False, allow_nan_stats=True, name='WishartCholesky')` {#WishartCholesky.__init__} - -Construct Wishart distributions. - -##### Args: - - -* `df`: `float` or `double` `Tensor`. Degrees of freedom, must be greater than - or equal to dimension of the scale matrix. -* `scale`: `float` or `double` `Tensor`. The Cholesky factorization of - the symmetric positive definite scale matrix of the distribution. -* `cholesky_input_output_matrices`: Python `bool`. Any function which whose - input or output is a matrix assumes the input is Cholesky and returns a - Cholesky factored matrix. Example `log_prob` input takes a Cholesky and - `sample_n` returns a Cholesky when - `cholesky_input_output_matrices=True`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.allow_nan_stats` {#WishartCholesky.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.batch_shape` {#WishartCholesky.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.batch_shape_tensor(name='batch_shape_tensor')` {#WishartCholesky.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.cdf(value, name='cdf')` {#WishartCholesky.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.cholesky_input_output_matrices` {#WishartCholesky.cholesky_input_output_matrices} - -Boolean indicating if `Tensor` input/outputs are Cholesky factorized. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.copy(**override_parameters_kwargs)` {#WishartCholesky.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.covariance(name='covariance')` {#WishartCholesky.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.df` {#WishartCholesky.df} - -Wishart distribution degree(s) of freedom. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.dimension` {#WishartCholesky.dimension} - -Dimension of underlying vector space. The `p` in `R^(p*p)`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.dtype` {#WishartCholesky.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.entropy(name='entropy')` {#WishartCholesky.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.event_shape` {#WishartCholesky.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.event_shape_tensor(name='event_shape_tensor')` {#WishartCholesky.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.is_continuous` {#WishartCholesky.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.is_scalar_batch(name='is_scalar_batch')` {#WishartCholesky.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.is_scalar_event(name='is_scalar_event')` {#WishartCholesky.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.log_cdf(value, name='log_cdf')` {#WishartCholesky.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.log_normalization(name='log_normalization')` {#WishartCholesky.log_normalization} - -Computes the log normalizing constant, log(Z). - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.log_prob(value, name='log_prob')` {#WishartCholesky.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.log_survival_function(value, name='log_survival_function')` {#WishartCholesky.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.mean(name='mean')` {#WishartCholesky.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.mean_log_det(name='mean_log_det')` {#WishartCholesky.mean_log_det} - -Computes E[log(det(X))] under this Wishart distribution. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.mode(name='mode')` {#WishartCholesky.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.name` {#WishartCholesky.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#WishartCholesky.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.param_static_shapes(cls, sample_shape)` {#WishartCholesky.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.parameters` {#WishartCholesky.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.prob(value, name='prob')` {#WishartCholesky.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.reparameterization_type` {#WishartCholesky.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.sample(sample_shape=(), seed=None, name='sample')` {#WishartCholesky.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.scale()` {#WishartCholesky.scale} - -Wishart distribution scale matrix. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.scale_operator_pd` {#WishartCholesky.scale_operator_pd} - -Wishart distribution scale matrix as an OperatorPD. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.stddev(name='stddev')` {#WishartCholesky.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.survival_function(value, name='survival_function')` {#WishartCholesky.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.validate_args` {#WishartCholesky.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.variance(name='variance')` {#WishartCholesky.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.WishartFull` {#WishartFull} - -The matrix Wishart distribution on positive definite matrices. - -This distribution is defined by a scalar degrees of freedom `df` and a -symmetric, positive definite scale matrix. - -Evaluation of the pdf, determinant, and sampling are all `O(k^3)` operations -where `(k, k)` is the event space shape. - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(X; df, scale) = det(X)**(0.5 (df-k-1)) exp(-0.5 tr[inv(scale) X]) / Z -Z = 2**(0.5 df k) |det(scale)|**(0.5 df) Gamma_k(0.5 df) -``` - -where: -* `df >= k` denotes the degrees of freedom, -* `scale` is a symmetric, positive definite, `k x k` matrix, -* `Z` is the normalizing constant, and, -* `Gamma_k` is the [multivariate Gamma function]( - https://en.wikipedia.org/wiki/Multivariate_gamma_function). - -#### Examples - -```python -# Initialize a single 3x3 Wishart with Full factored scale matrix and 5 -# degrees-of-freedom.(*) -df = 5 -scale = ... # Shape is [3, 3]; positive definite. -dist = tf.contrib.distributions.WishartFull(df=df, scale=scale) - -# Evaluate this on an observation in R^3, returning a scalar. -x = ... # A 3x3 positive definite matrix. -dist.prob(x) # Shape is [], a scalar. - -# Evaluate this on a two observations, each in R^{3x3}, returning a length two -# Tensor. -x = [x0, x1] # Shape is [2, 3, 3]. -dist.prob(x) # Shape is [2]. - -# Initialize two 3x3 Wisharts with Full factored scale matrices. -df = [5, 4] -scale = ... # Shape is [2, 3, 3]. -dist = tf.contrib.distributions.WishartFull(df=df, scale=scale) - -# Evaluate this on four observations. -x = [[x0, x1], [x2, x3]] # Shape is [2, 2, 3, 3]; xi is positive definite. -dist.prob(x) # Shape is [2, 2]. - -# (*) - To efficiently create a trainable covariance matrix, see the example -# in tf.contrib.distributions.matrix_diag_transform. -``` -- - - - -#### `tf.contrib.distributions.WishartFull.__init__(df, scale, cholesky_input_output_matrices=False, validate_args=False, allow_nan_stats=True, name='WishartFull')` {#WishartFull.__init__} - -Construct Wishart distributions. - -##### Args: - - -* `df`: `float` or `double` `Tensor`. Degrees of freedom, must be greater than - or equal to dimension of the scale matrix. -* `scale`: `float` or `double` `Tensor`. The symmetric positive definite - scale matrix of the distribution. -* `cholesky_input_output_matrices`: Python `bool`. Any function which whose - input or output is a matrix assumes the input is Cholesky and returns a - Cholesky factored matrix. Example `log_prob` input takes a Cholesky and - `sample_n` returns a Cholesky when - `cholesky_input_output_matrices=True`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.WishartFull.allow_nan_stats` {#WishartFull.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.batch_shape` {#WishartFull.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.WishartFull.batch_shape_tensor(name='batch_shape_tensor')` {#WishartFull.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.cdf(value, name='cdf')` {#WishartFull.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.cholesky_input_output_matrices` {#WishartFull.cholesky_input_output_matrices} - -Boolean indicating if `Tensor` input/outputs are Cholesky factorized. - - -- - - - -#### `tf.contrib.distributions.WishartFull.copy(**override_parameters_kwargs)` {#WishartFull.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.covariance(name='covariance')` {#WishartFull.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.df` {#WishartFull.df} - -Wishart distribution degree(s) of freedom. - - -- - - - -#### `tf.contrib.distributions.WishartFull.dimension` {#WishartFull.dimension} - -Dimension of underlying vector space. The `p` in `R^(p*p)`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.dtype` {#WishartFull.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.entropy(name='entropy')` {#WishartFull.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.WishartFull.event_shape` {#WishartFull.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.WishartFull.event_shape_tensor(name='event_shape_tensor')` {#WishartFull.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.is_continuous` {#WishartFull.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.WishartFull.is_scalar_batch(name='is_scalar_batch')` {#WishartFull.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.is_scalar_event(name='is_scalar_event')` {#WishartFull.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.log_cdf(value, name='log_cdf')` {#WishartFull.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.log_normalization(name='log_normalization')` {#WishartFull.log_normalization} - -Computes the log normalizing constant, log(Z). - - -- - - - -#### `tf.contrib.distributions.WishartFull.log_prob(value, name='log_prob')` {#WishartFull.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.log_survival_function(value, name='log_survival_function')` {#WishartFull.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.mean(name='mean')` {#WishartFull.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.WishartFull.mean_log_det(name='mean_log_det')` {#WishartFull.mean_log_det} - -Computes E[log(det(X))] under this Wishart distribution. - - -- - - - -#### `tf.contrib.distributions.WishartFull.mode(name='mode')` {#WishartFull.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.WishartFull.name` {#WishartFull.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#WishartFull.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.WishartFull.param_static_shapes(cls, sample_shape)` {#WishartFull.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.WishartFull.parameters` {#WishartFull.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.prob(value, name='prob')` {#WishartFull.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.reparameterization_type` {#WishartFull.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.sample(sample_shape=(), seed=None, name='sample')` {#WishartFull.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.scale()` {#WishartFull.scale} - -Wishart distribution scale matrix. - - -- - - - -#### `tf.contrib.distributions.WishartFull.scale_operator_pd` {#WishartFull.scale_operator_pd} - -Wishart distribution scale matrix as an OperatorPD. - - -- - - - -#### `tf.contrib.distributions.WishartFull.stddev(name='stddev')` {#WishartFull.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.survival_function(value, name='survival_function')` {#WishartFull.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.validate_args` {#WishartFull.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.WishartFull.variance(name='variance')` {#WishartFull.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - - -- - - - -### `tf.contrib.distributions.matrix_diag_transform(matrix, transform=None, name=None)` {#matrix_diag_transform} - -Transform diagonal of [batch-]matrix, leave rest of matrix unchanged. - -Create a trainable covariance defined by a Cholesky factor: - -```python -# Transform network layer into 2 x 2 array. -matrix_values = tf.contrib.layers.fully_connected(activations, 4) -matrix = tf.reshape(matrix_values, (batch_size, 2, 2)) - -# Make the diagonal positive. If the upper triangle was zero, this would be a -# valid Cholesky factor. -chol = matrix_diag_transform(matrix, transform=tf.nn.softplus) - -# OperatorPDCholesky ignores the upper triangle. -operator = OperatorPDCholesky(chol) -``` - -Example of heteroskedastic 2-D linear regression. - -```python -# Get a trainable Cholesky factor. -matrix_values = tf.contrib.layers.fully_connected(activations, 4) -matrix = tf.reshape(matrix_values, (batch_size, 2, 2)) -chol = matrix_diag_transform(matrix, transform=tf.nn.softplus) - -# Get a trainable mean. -mu = tf.contrib.layers.fully_connected(activations, 2) - -# This is a fully trainable multivariate normal! -dist = tf.contrib.distributions.MVNCholesky(mu, chol) - -# Standard log loss. Minimizing this will "train" mu and chol, and then dist -# will be a distribution predicting labels as multivariate Gaussians. -loss = -1 * tf.reduce_mean(dist.log_prob(labels)) -``` - -##### Args: - - -* `matrix`: Rank `R` `Tensor`, `R >= 2`, where the last two dimensions are - equal. -* `transform`: Element-wise function mapping `Tensors` to `Tensors`. To - be applied to the diagonal of `matrix`. If `None`, `matrix` is returned - unchanged. Defaults to `None`. -* `name`: A name to give created ops. - Defaults to "matrix_diag_transform". - -##### Returns: - - A `Tensor` with same shape and `dtype` as `matrix`. - - - -- - - - -### `class tf.contrib.distributions.TransformedDistribution` {#TransformedDistribution} - -A Transformed Distribution. - -A `TransformedDistribution` models `p(y)` given a base distribution `p(x)`, -and a deterministic, invertible, differentiable transform, `Y = g(X)`. The -transform is typically an instance of the `Bijector` class and the base -distribution is typically an instance of the `Distribution` class. - -A `Bijector` is expected to implement the following functions: -- `forward`, -- `inverse`, -- `inverse_log_det_jacobian`. -The semantics of these functions are outlined in the `Bijector` documentation. - -We now describe how a `TransformedDistribution` alters the input/outputs of a -`Distribution` associated with a random variable (rv) `X`. - -Write `cdf(Y=y)` for an absolutely continuous cumulative distribution function -of random variable `Y`; write the probability density function `pdf(Y=y) := -d^k / (dy_1,...,dy_k) cdf(Y=y)` for its derivative wrt to `Y` evaluated at -`y`. Assume that `Y = g(X)` where `g` is a deterministic diffeomorphism, -i.e., a non-random, continuous, differentiable, and invertible function. -Write the inverse of `g` as `X = g^{-1}(Y)` and `(J o g)(x)` for the Jacobian -of `g` evaluated at `x`. - -A `TransformedDistribution` implements the following operations: - - * `sample`: - - Mathematically: - - ```none - Y = g(X) - ``` - - Programmatically: - - ```python - return bijector.forward(distribution.sample(...)) - ``` - - * `log_prob`: - - Mathematically: - - ```none - (log o pdf)(Y=y) = (log o pdf o g^{-1})(y) + - (log o abs o det o J o g^{-1})(y) - ``` - - Programmatically: - - ```python - return (distribution.log_prob(bijector.inverse(y)) + - bijector.inverse_log_det_jacobian(y)) - ``` - - * `log_cdf`: - - Mathematically: - - ```none - (log o cdf)(Y=y) = (log o cdf o g^{-1})(y) - ``` - - Programmatically: - - ```python - return distribution.log_cdf(bijector.inverse(x)) - ``` - - * and similarly for: `cdf`, `prob`, `log_survival_function`, - `survival_function`. - -A simple example constructing a Log-Normal distribution from a Normal -distribution: - -```python -ds = tf.contrib.distributions -log_normal = ds.TransformedDistribution( - distribution=ds.Normal(loc=mu, scale=sigma), - bijector=ds.bijector.Exp(), - name="LogNormalTransformedDistribution") -``` - -A `LogNormal` made from callables: - -```python -ds = tf.contrib.distributions -log_normal = ds.TransformedDistribution( - distribution=ds.Normal(loc=mu, scale=sigma), - bijector=ds.bijector.Inline( - forward_fn=tf.exp, - inverse_fn=tf.log, - inverse_log_det_jacobian_fn=( - lambda y: -tf.reduce_sum(tf.log(y), axis=-1)), - name="LogNormalTransformedDistribution") -``` - -Another example constructing a Normal from a StandardNormal: - -```python -ds = tf.contrib.distributions -normal = ds.TransformedDistribution( - distribution=ds.Normal(loc=0, scale=1), - bijector=ds.bijector.ScaleAndShift(loc=mu, scale=sigma, event_ndims=0), - name="NormalTransformedDistribution") -``` - -A `TransformedDistribution`'s batch- and event-shape are implied by the base -distribution unless explicitly overridden by `batch_shape` or `event_shape` -arguments. Specifying an overriding `batch_shape` (`event_shape`) is -permitted only if the base distribution has scalar batch-shape (event-shape). -The bijector is applied to the distribution as if the distribution possessed -the overridden shape(s). The following example demonstrates how to construct a -multivariate Normal as a `TransformedDistribution`. - -```python -bs = tf.contrib.distributions.bijector -ds = tf.contrib.distributions -# We will create two MVNs with batch_shape = event_shape = 2. -mean = [[-1., 0], # batch:0 - [0., 1]] # batch:1 -chol_cov = [[[1., 0], - [0, 1]], # batch:0 - [[1, 0], - [2, 2]]] # batch:1 -mvn1 = ds.TransformedDistribution( - distribution=ds.Normal(loc=0., scale=1.), - bijector=bs.Affine(shift=mean, tril=chol_cov), - batch_shape=[2], # Valid because base_distribution.batch_shape == []. - event_shape=[2]) # Valid because base_distribution.event_shape == []. -mvn2 = ds.MultivariateNormalTriL(loc=mean, scale_tril=chol_cov) -# mvn1.log_prob(x) == mvn2.log_prob(x) -``` -- - - - -#### `tf.contrib.distributions.TransformedDistribution.__init__(distribution, bijector=None, batch_shape=None, event_shape=None, validate_args=False, name=None)` {#TransformedDistribution.__init__} - -Construct a Transformed Distribution. - -##### Args: - - -* `distribution`: The base distribution instance to transform. Typically an - instance of `Distribution`. -* `bijector`: The object responsible for calculating the transformation. - Typically an instance of `Bijector`. `None` means `Identity()`. -* `batch_shape`: `integer` vector `Tensor` which overrides `distribution` - `batch_shape`; valid only if `distribution.is_scalar_batch()`. -* `event_shape`: `integer` vector `Tensor` which overrides `distribution` - `event_shape`; valid only if `distribution.is_scalar_event()`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `name`: Python `str` name prefixed to Ops created by this class. Default: - `bijector.name + distribution.name`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.allow_nan_stats` {#TransformedDistribution.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.batch_shape` {#TransformedDistribution.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.batch_shape_tensor(name='batch_shape_tensor')` {#TransformedDistribution.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.bijector` {#TransformedDistribution.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.cdf(value, name='cdf')` {#TransformedDistribution.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.copy(**override_parameters_kwargs)` {#TransformedDistribution.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.covariance(name='covariance')` {#TransformedDistribution.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.distribution` {#TransformedDistribution.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.dtype` {#TransformedDistribution.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.entropy(name='entropy')` {#TransformedDistribution.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.event_shape` {#TransformedDistribution.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.event_shape_tensor(name='event_shape_tensor')` {#TransformedDistribution.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.is_continuous` {#TransformedDistribution.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.is_scalar_batch(name='is_scalar_batch')` {#TransformedDistribution.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.is_scalar_event(name='is_scalar_event')` {#TransformedDistribution.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.log_cdf(value, name='log_cdf')` {#TransformedDistribution.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.log_prob(value, name='log_prob')` {#TransformedDistribution.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.log_survival_function(value, name='log_survival_function')` {#TransformedDistribution.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.mean(name='mean')` {#TransformedDistribution.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.mode(name='mode')` {#TransformedDistribution.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.name` {#TransformedDistribution.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#TransformedDistribution.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.param_static_shapes(cls, sample_shape)` {#TransformedDistribution.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.parameters` {#TransformedDistribution.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.prob(value, name='prob')` {#TransformedDistribution.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.reparameterization_type` {#TransformedDistribution.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.sample(sample_shape=(), seed=None, name='sample')` {#TransformedDistribution.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.stddev(name='stddev')` {#TransformedDistribution.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.survival_function(value, name='survival_function')` {#TransformedDistribution.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.validate_args` {#TransformedDistribution.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.variance(name='variance')` {#TransformedDistribution.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.QuantizedDistribution` {#QuantizedDistribution} - -Distribution representing the quantization `Y = ceiling(X)`. - -#### Definition in terms of sampling. - -``` -1. Draw X -2. Set Y <-- ceiling(X) -3. If Y < low, reset Y <-- low -4. If Y > high, reset Y <-- high -5. Return Y -``` - -#### Definition in terms of the probability mass function. - -Given scalar random variable `X`, we define a discrete random variable `Y` -supported on the integers as follows: - -``` -P[Y = j] := P[X <= low], if j == low, - := P[X > high - 1], j == high, - := 0, if j < low or j > high, - := P[j - 1 < X <= j], all other j. -``` - -Conceptually, without cutoffs, the quantization process partitions the real -line `R` into half open intervals, and identifies an integer `j` with the -right endpoints: - -``` -R = ... (-2, -1](-1, 0](0, 1](1, 2](2, 3](3, 4] ... -j = ... -1 0 1 2 3 4 ... -``` - -`P[Y = j]` is the mass of `X` within the `jth` interval. -If `low = 0`, and `high = 2`, then the intervals are redrawn -and `j` is re-assigned: - -``` -R = (-infty, 0](0, 1](1, infty) -j = 0 1 2 -``` - -`P[Y = j]` is still the mass of `X` within the `jth` interval. - -#### Caveats - -Since evaluation of each `P[Y = j]` involves a cdf evaluation (rather than -a closed form function such as for a Poisson), computations such as mean and -entropy are better done with samples or approximations, and are not -implemented by this class. -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.__init__(distribution, low=None, high=None, validate_args=False, name='QuantizedDistribution')` {#QuantizedDistribution.__init__} - -Construct a Quantized Distribution representing `Y = ceiling(X)`. - -Some properties are inherited from the distribution defining `X`. Example: -`allow_nan_stats` is determined for this `QuantizedDistribution` by reading -the `distribution`. - -##### Args: - - -* `distribution`: The base distribution class to transform. Typically an - instance of `Distribution`. -* `low`: `Tensor` with same `dtype` as this distribution and shape - able to be added to samples. Should be a whole number. Default `None`. - If provided, base distribution's `prob` should be defined at - `low`. -* `high`: `Tensor` with same `dtype` as this distribution and shape - able to be added to samples. Should be a whole number. Default `None`. - If provided, base distribution's `prob` should be defined at - `high - 1`. - `high` must be strictly greater than `low`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `TypeError`: If `dist_cls` is not a subclass of - `Distribution` or continuous. -* `NotImplementedError`: If the base distribution does not implement `cdf`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.allow_nan_stats` {#QuantizedDistribution.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.batch_shape` {#QuantizedDistribution.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.batch_shape_tensor(name='batch_shape_tensor')` {#QuantizedDistribution.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.cdf(value, name='cdf')` {#QuantizedDistribution.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - - -Additional documentation from `QuantizedDistribution`: - -For whole numbers `y`, - -``` -cdf(y) := P[Y <= y] - = 1, if y >= high, - = 0, if y < low, - = P[X <= y], otherwise. -``` - -Since `Y` only has mass at whole numbers, `P[Y <= y] = P[Y <= floor(y)]`. -This dictates that fractional `y` are first floored to a whole number, and -then above definition applies. - -The base distribution's `cdf` method must be defined on `y - 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.copy(**override_parameters_kwargs)` {#QuantizedDistribution.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.covariance(name='covariance')` {#QuantizedDistribution.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.distribution` {#QuantizedDistribution.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.dtype` {#QuantizedDistribution.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.entropy(name='entropy')` {#QuantizedDistribution.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.event_shape` {#QuantizedDistribution.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.event_shape_tensor(name='event_shape_tensor')` {#QuantizedDistribution.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.is_continuous` {#QuantizedDistribution.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.is_scalar_batch(name='is_scalar_batch')` {#QuantizedDistribution.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.is_scalar_event(name='is_scalar_event')` {#QuantizedDistribution.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.log_cdf(value, name='log_cdf')` {#QuantizedDistribution.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - - -Additional documentation from `QuantizedDistribution`: - -For whole numbers `y`, - -``` -cdf(y) := P[Y <= y] - = 1, if y >= high, - = 0, if y < low, - = P[X <= y], otherwise. -``` - -Since `Y` only has mass at whole numbers, `P[Y <= y] = P[Y <= floor(y)]`. -This dictates that fractional `y` are first floored to a whole number, and -then above definition applies. - -The base distribution's `log_cdf` method must be defined on `y - 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.log_prob(value, name='log_prob')` {#QuantizedDistribution.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `QuantizedDistribution`: - -For whole numbers `y`, - -``` -P[Y = y] := P[X <= low], if y == low, - := P[X > high - 1], y == high, - := 0, if j < low or y > high, - := P[y - 1 < X <= y], all other y. -``` - - -The base distribution's `log_cdf` method must be defined on `y - 1`. If the -base distribution has a `log_survival_function` method results will be more -accurate for large values of `y`, and in this case the `log_survival_function` -must also be defined on `y - 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.log_survival_function(value, name='log_survival_function')` {#QuantizedDistribution.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - - -Additional documentation from `QuantizedDistribution`: - -For whole numbers `y`, - -``` -survival_function(y) := P[Y > y] - = 0, if y >= high, - = 1, if y < low, - = P[X <= y], otherwise. -``` - -Since `Y` only has mass at whole numbers, `P[Y <= y] = P[Y <= floor(y)]`. -This dictates that fractional `y` are first floored to a whole number, and -then above definition applies. - -The base distribution's `log_cdf` method must be defined on `y - 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.mean(name='mean')` {#QuantizedDistribution.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.mode(name='mode')` {#QuantizedDistribution.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.name` {#QuantizedDistribution.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#QuantizedDistribution.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.param_static_shapes(cls, sample_shape)` {#QuantizedDistribution.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.parameters` {#QuantizedDistribution.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.prob(value, name='prob')` {#QuantizedDistribution.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `QuantizedDistribution`: - -For whole numbers `y`, - -``` -P[Y = y] := P[X <= low], if y == low, - := P[X > high - 1], y == high, - := 0, if j < low or y > high, - := P[y - 1 < X <= y], all other y. -``` - - -The base distribution's `cdf` method must be defined on `y - 1`. If the -base distribution has a `survival_function` method, results will be more -accurate for large values of `y`, and in this case the `survival_function` must -also be defined on `y - 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.reparameterization_type` {#QuantizedDistribution.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.sample(sample_shape=(), seed=None, name='sample')` {#QuantizedDistribution.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.stddev(name='stddev')` {#QuantizedDistribution.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.survival_function(value, name='survival_function')` {#QuantizedDistribution.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - - -Additional documentation from `QuantizedDistribution`: - -For whole numbers `y`, - -``` -survival_function(y) := P[Y > y] - = 0, if y >= high, - = 1, if y < low, - = P[X <= y], otherwise. -``` - -Since `Y` only has mass at whole numbers, `P[Y <= y] = P[Y <= floor(y)]`. -This dictates that fractional `y` are first floored to a whole number, and -then above definition applies. - -The base distribution's `cdf` method must be defined on `y - 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.validate_args` {#QuantizedDistribution.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.variance(name='variance')` {#QuantizedDistribution.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - - -- - - - -### `class tf.contrib.distributions.Mixture` {#Mixture} - -Mixture distribution. - -The `Mixture` object implements batched mixture distributions. -The mixture model is defined by a `Categorical` distribution (the mixture) -and a python list of `Distribution` objects. - -Methods supported include `log_prob`, `prob`, `mean`, `sample`, and -`entropy_lower_bound`. -- - - - -#### `tf.contrib.distributions.Mixture.__init__(cat, components, validate_args=False, allow_nan_stats=True, name='Mixture')` {#Mixture.__init__} - -Initialize a Mixture distribution. - -A `Mixture` is defined by a `Categorical` (`cat`, representing the -mixture probabilities) and a list of `Distribution` objects -all having matching dtype, batch shape, event shape, and continuity -properties (the components). - -The `num_classes` of `cat` must be possible to infer at graph construction -time and match `len(components)`. - -##### Args: - - -* `cat`: A `Categorical` distribution instance, representing the probabilities - of `distributions`. -* `components`: A list or tuple of `Distribution` instances. - Each instance must have the same type, be defined on the same domain, - and have matching `event_shape` and `batch_shape`. -* `validate_args`: Python `bool`, default `False`. If `True`, raise a runtime - error if batch or event ranks are inconsistent between cat and any of - the distributions. This is only checked if the ranks cannot be - determined statically at graph construction time. -* `allow_nan_stats`: Boolean, default `True`. If `False`, raise an - exception if a statistic (e.g. mean/mode/etc...) is undefined for any - batch member. If `True`, batch members with valid parameters leading to - undefined statistics will return NaN for this statistic. -* `name`: A name for this distribution (optional). - -##### Raises: - - -* `TypeError`: If cat is not a `Categorical`, or `components` is not - a list or tuple, or the elements of `components` are not - instances of `Distribution`, or do not have matching `dtype`. -* `ValueError`: If `components` is an empty list or tuple, or its - elements do not have a statically known event rank. - If `cat.num_classes` cannot be inferred at graph creation time, - or the constant value of `cat.num_classes` is not equal to - `len(components)`, or all `components` and `cat` do not have - matching static batch shapes, or all components do not - have matching static event shapes. - - -- - - - -#### `tf.contrib.distributions.Mixture.allow_nan_stats` {#Mixture.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Mixture.batch_shape` {#Mixture.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Mixture.batch_shape_tensor(name='batch_shape_tensor')` {#Mixture.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Mixture.cat` {#Mixture.cat} - - - - -- - - - -#### `tf.contrib.distributions.Mixture.cdf(value, name='cdf')` {#Mixture.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Mixture.components` {#Mixture.components} - - - - -- - - - -#### `tf.contrib.distributions.Mixture.copy(**override_parameters_kwargs)` {#Mixture.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Mixture.covariance(name='covariance')` {#Mixture.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Mixture.dtype` {#Mixture.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Mixture.entropy(name='entropy')` {#Mixture.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Mixture.entropy_lower_bound(name='entropy_lower_bound')` {#Mixture.entropy_lower_bound} - -A lower bound on the entropy of this mixture model. - -The bound below is not always very tight, and its usefulness depends -on the mixture probabilities and the components in use. - -A lower bound is useful for ELBO when the `Mixture` is the variational -distribution: - -\\( -\log p(x) >= ELBO = \int q(z) \log p(x, z) dz + H[q] -\\) - -where \\( p \\) is the prior distribution, \\( q \\) is the variational, -and \\( H[q] \\) is the entropy of \\( q \\). If there is a lower bound -\\( G[q] \\) such that \\( H[q] \geq G[q] \\) then it can be used in -place of \\( H[q] \\). - -For a mixture of distributions \\( q(Z) = \sum_i c_i q_i(Z) \\) with -\\( \sum_i c_i = 1 \\), by the concavity of \\( f(x) = -x \log x \\), a -simple lower bound is: - -\\( -\begin{align} -H[q] & = - \int q(z) \log q(z) dz \\\ - & = - \int (\sum_i c_i q_i(z)) \log(\sum_i c_i q_i(z)) dz \\\ - & \geq - \sum_i c_i \int q_i(z) \log q_i(z) dz \\\ - & = \sum_i c_i H[q_i] -\end{align} -\\) - -This is the term we calculate below for \\( G[q] \\). - -##### Args: - - -* `name`: A name for this operation (optional). - -##### Returns: - - A lower bound on the Mixture's entropy. - - -- - - - -#### `tf.contrib.distributions.Mixture.event_shape` {#Mixture.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Mixture.event_shape_tensor(name='event_shape_tensor')` {#Mixture.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Mixture.is_continuous` {#Mixture.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Mixture.is_scalar_batch(name='is_scalar_batch')` {#Mixture.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Mixture.is_scalar_event(name='is_scalar_event')` {#Mixture.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Mixture.log_cdf(value, name='log_cdf')` {#Mixture.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Mixture.log_prob(value, name='log_prob')` {#Mixture.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Mixture.log_survival_function(value, name='log_survival_function')` {#Mixture.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Mixture.mean(name='mean')` {#Mixture.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Mixture.mode(name='mode')` {#Mixture.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Mixture.name` {#Mixture.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Mixture.num_components` {#Mixture.num_components} - - - - -- - - - -#### `tf.contrib.distributions.Mixture.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Mixture.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Mixture.param_static_shapes(cls, sample_shape)` {#Mixture.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Mixture.parameters` {#Mixture.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Mixture.prob(value, name='prob')` {#Mixture.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Mixture.reparameterization_type` {#Mixture.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Mixture.sample(sample_shape=(), seed=None, name='sample')` {#Mixture.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Mixture.stddev(name='stddev')` {#Mixture.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Mixture.survival_function(value, name='survival_function')` {#Mixture.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Mixture.validate_args` {#Mixture.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Mixture.variance(name='variance')` {#Mixture.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - - -- - - - -### `tf.contrib.distributions.normal_conjugates_known_scale_posterior(prior, scale, s, n)` {#normal_conjugates_known_scale_posterior} - -Posterior Normal distribution with conjugate prior on the mean. - -This model assumes that `n` observations (with sum `s`) come from a -Normal with unknown mean `loc` (described by the Normal `prior`) -and known variance `scale**2`. The "known scale posterior" is -the distribution of the unknown `loc`. - -Accepts a prior Normal distribution object, having parameters -`loc0` and `scale0`, as well as known `scale` values of the predictive -distribution(s) (also assumed Normal), -and statistical estimates `s` (the sum(s) of the observations) and -`n` (the number(s) of observations). - -Returns a posterior (also Normal) distribution object, with parameters -`(loc', scale'**2)`, where: - -``` -mu ~ N(mu', sigma'**2) -sigma'**2 = 1/(1/sigma0**2 + n/sigma**2), -mu' = (mu0/sigma0**2 + s/sigma**2) * sigma'**2. -``` - -Distribution parameters from `prior`, as well as `scale`, `s`, and `n`. -will broadcast in the case of multidimensional sets of parameters. - -##### Args: - - -* `prior`: `Normal` object of type `dtype`: - the prior distribution having parameters `(loc0, scale0)`. -* `scale`: tensor of type `dtype`, taking values `scale > 0`. - The known stddev parameter(s). -* `s`: Tensor of type `dtype`. The sum(s) of observations. -* `n`: Tensor of type `int`. The number(s) of observations. - -##### Returns: - - A new Normal posterior distribution object for the unknown observation - mean `loc`. - -##### Raises: - - -* `TypeError`: if dtype of `s` does not match `dtype`, or `prior` is not a - Normal object. - - -- - - - -### `tf.contrib.distributions.normal_conjugates_known_scale_predictive(prior, scale, s, n)` {#normal_conjugates_known_scale_predictive} - -Posterior predictive Normal distribution w. conjugate prior on the mean. - -This model assumes that `n` observations (with sum `s`) come from a -Normal with unknown mean `loc` (described by the Normal `prior`) -and known variance `scale**2`. The "known scale predictive" -is the distribution of new observations, conditioned on the existing -observations and our prior. - -Accepts a prior Normal distribution object, having parameters -`loc0` and `scale0`, as well as known `scale` values of the predictive -distribution(s) (also assumed Normal), -and statistical estimates `s` (the sum(s) of the observations) and -`n` (the number(s) of observations). - -Calculates the Normal distribution(s) `p(x | sigma**2)`: - -``` -p(x | sigma**2) = int N(x | mu, sigma**2)N(mu | prior.loc, prior.scale**2) dmu - = N(x | prior.loc, 1 / (sigma**2 + prior.scale**2)) -``` - -Returns the predictive posterior distribution object, with parameters -`(loc', scale'**2)`, where: - -``` -sigma_n**2 = 1/(1/sigma0**2 + n/sigma**2), -mu' = (mu0/sigma0**2 + s/sigma**2) * sigma_n**2. -sigma'**2 = sigma_n**2 + sigma**2, -``` - -Distribution parameters from `prior`, as well as `scale`, `s`, and `n`. -will broadcast in the case of multidimensional sets of parameters. - -##### Args: - - -* `prior`: `Normal` object of type `dtype`: - the prior distribution having parameters `(loc0, scale0)`. -* `scale`: tensor of type `dtype`, taking values `scale > 0`. - The known stddev parameter(s). -* `s`: Tensor of type `dtype`. The sum(s) of observations. -* `n`: Tensor of type `int`. The number(s) of observations. - -##### Returns: - - A new Normal predictive distribution object. - -##### Raises: - - -* `TypeError`: if dtype of `s` does not match `dtype`, or `prior` is not a - Normal object. - - - -- - - - -### `tf.contrib.distributions.kl(dist_a, dist_b, allow_nan=False, name=None)` {#kl} - -Get the KL-divergence KL(dist_a || dist_b). - -If there is no KL method registered specifically for `type(dist_a)` and -`type(dist_b)`, then the class hierarchies of these types are searched. - -If one KL method is registered between any pairs of classes in these two -parent hierarchies, it is used. - -If more than one such registered method exists, the method whose registered -classes have the shortest sum MRO paths to the input types is used. - -If more than one such shortest path exists, the first method -identified in the search is used (favoring a shorter MRO distance to -`type(dist_a)`). - -##### Args: - - -* `dist_a`: The first distribution. -* `dist_b`: The second distribution. -* `allow_nan`: If `False` (default), a runtime error is raised - if the KL returns NaN values for any batch entry of the given - distributions. If `True`, the KL may return a NaN for the given entry. -* `name`: (optional) Name scope to use for created operations. - -##### Returns: - - A Tensor with the batchwise KL-divergence between dist_a and dist_b. - -##### Raises: - - -* `NotImplementedError`: If no KL method is defined for distribution types - of dist_a and dist_b. - - -- - - - -### `class tf.contrib.distributions.RegisterKL` {#RegisterKL} - -Decorator to register a KL divergence implementation function. - -Usage: - -@distributions.RegisterKL(distributions.Normal, distributions.Normal) -def _kl_normal_mvn(norm_a, norm_b): - # Return KL(norm_a || norm_b) -- - - - -#### `tf.contrib.distributions.RegisterKL.__call__(kl_fn)` {#RegisterKL.__call__} - -Perform the KL registration. - -##### Args: - - -* `kl_fn`: The function to use for the KL divergence. - -##### Returns: - - kl_fn - -##### Raises: - - -* `TypeError`: if kl_fn is not a callable. -* `ValueError`: if a KL divergence function has already been registered for - the given argument classes. - - -- - - - -#### `tf.contrib.distributions.RegisterKL.__init__(dist_cls_a, dist_cls_b)` {#RegisterKL.__init__} - -Initialize the KL registrar. - -##### Args: - - -* `dist_cls_a`: the class of the first argument of the KL divergence. -* `dist_cls_b`: the class of the second argument of the KL divergence. - - - - -- - - - -### `tf.contrib.distributions.softplus_inverse(x, name=None)` {#softplus_inverse} - -Computes the inverse softplus, i.e., x = softplus_inverse(softplus(x)). - -Mathematically this op is equivalent to: - -```none -softplus_inverse = log(exp(x) - 1.) -``` - -##### Args: - - -* `x`: `Tensor`. Non-negative (not enforced), floating-point. -* `name`: A name for the operation (optional). - -##### Returns: - - `Tensor`. Has the same type/shape as input `x`. - - - -- - - - -### `class tf.contrib.distributions.ExpRelaxedOneHotCategorical` {#ExpRelaxedOneHotCategorical} - -ExpRelaxedOneHotCategorical distribution with temperature and logits. - -An ExpRelaxedOneHotCategorical distribution is a log-transformed -RelaxedOneHotCategorical distribution. The RelaxedOneHotCategorical is a -distribution over random probability vectors, vectors of positive real -values that sum to one, which continuously approximates a OneHotCategorical. -The degree of approximation is controlled by a temperature: as the temperature -goes to 0 the RelaxedOneHotCategorical becomes discrete with a distribution -described by the logits, as the temperature goes to infinity the -RelaxedOneHotCategorical becomes the constant distribution that is identically -the constant vector of (1/event_size, ..., 1/event_size). - -Because computing log-probabilities of the RelaxedOneHotCategorical can -suffer from underflow issues, this class is one solution for loss -functions that depend on log-probabilities, such as the KL Divergence found -in the variational autoencoder loss. The KL divergence between two -distributions is invariant under invertible transformations, so evaluating -KL divergences of ExpRelaxedOneHotCategorical samples, which are always -followed by a `tf.exp` op, is equivalent to evaluating KL divergences of -RelaxedOneHotCategorical samples. See the appendix of Maddison et al., 2016 -for more mathematical details, where this distribution is called the -ExpConcrete. - -#### Examples - -Creates a continuous distribution, whoe exp approximates a 3-class one-hot -categorical distiribution. The 2nd class is the most likely to be the -largest component in samples drawn from this distribution. If those samples -are followed by a `tf.exp` op, then they are distributed as a relaxed onehot -categorical. - -```python -temperature = 0.5 -p = [0.1, 0.5, 0.4] -dist = ExpRelaxedOneHotCategorical(temperature, probs=p) -samples = dist.sample() -exp_samples = tf.exp(samples) -# exp_samples has the same distribution as samples from -# RelaxedOneHotCategorical(temperature, probs=p) -``` - -Creates a continuous distribution, whose exp approximates a 3-class one-hot -categorical distiribution. The 2nd class is the most likely to be the -largest component in samples drawn from this distribution. - -```python -temperature = 0.5 -logits = [-2, 2, 0] -dist = ExpRelaxedOneHotCategorical(temperature, logits=logits) -samples = dist.sample() -exp_samples = tf.exp(samples) -# exp_samples has the same distribution as samples from -# RelaxedOneHotCategorical(temperature, probs=p) -``` - -Creates a continuous distribution, whose exp approximates a 3-class one-hot -categorical distiribution. Because the temperature is very low, samples from -this distribution are almost discrete, with one component almost 0 and the -others very negative. The 2nd class is the most likely to be the largest -component in samples drawn from this distribution. - -```python -temperature = 1e-5 -logits = [-2, 2, 0] -dist = ExpRelaxedOneHotCategorical(temperature, logits=logits) -samples = dist.sample() -exp_samples = tf.exp(samples) -# exp_samples has the same distribution as samples from -# RelaxedOneHotCategorical(temperature, probs=p) -``` - -Creates a continuous distribution, whose exp approximates a 3-class one-hot -categorical distiribution. Because the temperature is very high, samples from -this distribution are usually close to the (-log(3), -log(3), -log(3)) vector. -The 2nd class is still the most likely to be the largest component -in samples drawn from this distribution. - -```python -temperature = 10 -logits = [-2, 2, 0] -dist = ExpRelaxedOneHotCategorical(temperature, logits=logits) -samples = dist.sample() -exp_samples = tf.exp(samples) -# exp_samples has the same distribution as samples from -# RelaxedOneHotCategorical(temperature, probs=p) -``` - -Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The Concrete Distribution: -A Continuous Relaxation of Discrete Random Variables. 2016. -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.__init__(temperature, logits=None, probs=None, dtype=tf.float32, validate_args=False, allow_nan_stats=True, name='ExpRelaxedOneHotCategorical')` {#ExpRelaxedOneHotCategorical.__init__} - -Initialize ExpRelaxedOneHotCategorical using class log-probabilities. - -##### Args: - - -* `temperature`: An 0-D `Tensor`, representing the temperature - of a set of ExpRelaxedCategorical distributions. The temperature should - be positive. -* `logits`: An N-D `Tensor`, `N >= 1`, representing the log probabilities - of a set of ExpRelaxedCategorical distributions. The first - `N - 1` dimensions index into a batch of independent distributions and - the last dimension represents a vector of logits for each class. Only - one of `logits` or `probs` should be passed in. -* `probs`: An N-D `Tensor`, `N >= 1`, representing the probabilities - of a set of ExpRelaxedCategorical distributions. The first - `N - 1` dimensions index into a batch of independent distributions and - the last dimension represents a vector of probabilities for each - class. Only one of `logits` or `probs` should be passed in. -* `dtype`: The type of the event samples (default: int32). -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.allow_nan_stats` {#ExpRelaxedOneHotCategorical.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.batch_shape` {#ExpRelaxedOneHotCategorical.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.batch_shape_tensor(name='batch_shape_tensor')` {#ExpRelaxedOneHotCategorical.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.cdf(value, name='cdf')` {#ExpRelaxedOneHotCategorical.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.copy(**override_parameters_kwargs)` {#ExpRelaxedOneHotCategorical.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.covariance(name='covariance')` {#ExpRelaxedOneHotCategorical.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.dtype` {#ExpRelaxedOneHotCategorical.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.entropy(name='entropy')` {#ExpRelaxedOneHotCategorical.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.event_shape` {#ExpRelaxedOneHotCategorical.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.event_shape_tensor(name='event_shape_tensor')` {#ExpRelaxedOneHotCategorical.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.event_size` {#ExpRelaxedOneHotCategorical.event_size} - -Scalar `int32` tensor: the number of classes. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.is_continuous` {#ExpRelaxedOneHotCategorical.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.is_scalar_batch(name='is_scalar_batch')` {#ExpRelaxedOneHotCategorical.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.is_scalar_event(name='is_scalar_event')` {#ExpRelaxedOneHotCategorical.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.log_cdf(value, name='log_cdf')` {#ExpRelaxedOneHotCategorical.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.log_prob(value, name='log_prob')` {#ExpRelaxedOneHotCategorical.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.log_survival_function(value, name='log_survival_function')` {#ExpRelaxedOneHotCategorical.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.logits` {#ExpRelaxedOneHotCategorical.logits} - -Vector of coordinatewise logits. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.mean(name='mean')` {#ExpRelaxedOneHotCategorical.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.mode(name='mode')` {#ExpRelaxedOneHotCategorical.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.name` {#ExpRelaxedOneHotCategorical.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#ExpRelaxedOneHotCategorical.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.param_static_shapes(cls, sample_shape)` {#ExpRelaxedOneHotCategorical.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.parameters` {#ExpRelaxedOneHotCategorical.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.prob(value, name='prob')` {#ExpRelaxedOneHotCategorical.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.probs` {#ExpRelaxedOneHotCategorical.probs} - -Vector of probabilities summing to one. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.reparameterization_type` {#ExpRelaxedOneHotCategorical.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.sample(sample_shape=(), seed=None, name='sample')` {#ExpRelaxedOneHotCategorical.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.stddev(name='stddev')` {#ExpRelaxedOneHotCategorical.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.survival_function(value, name='survival_function')` {#ExpRelaxedOneHotCategorical.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.temperature` {#ExpRelaxedOneHotCategorical.temperature} - -Batchwise temperature tensor of a RelaxedCategorical. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.validate_args` {#ExpRelaxedOneHotCategorical.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.variance(name='variance')` {#ExpRelaxedOneHotCategorical.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.OneHotCategorical` {#OneHotCategorical} - -OneHotCategorical distribution. - -The categorical distribution is parameterized by the log-probabilities -of a set of classes. The difference between OneHotCategorical and Categorical -distributions is that OneHotCategorical is a discrete distribution over -one-hot bit vectors whereas Categorical is a discrete distribution over -positive integers. OneHotCategorical is equivalent to Categorical except -Categorical has event_dim=() while OneHotCategorical has event_dim=K, where -K is the number of classes. - -This class provides methods to create indexed batches of OneHotCategorical -distributions. If the provided `logits` or `probs` is rank 2 or higher, for -every fixed set of leading dimensions, the last dimension represents one -single OneHotCategorical distribution. When calling distribution -functions (e.g. `dist.prob(x)`), `logits` and `x` are broadcast to the -same shape (if possible). In all cases, the last dimension of `logits,x` -represents single OneHotCategorical distributions. - -#### Examples - -Creates a 3-class distiribution, with the 2nd class, the most likely to be -drawn from. - -```python -p = [0.1, 0.5, 0.4] -dist = OneHotCategorical(probs=p) -``` - -Creates a 3-class distiribution, with the 2nd class the most likely to be -drawn from, using logits. - -```python -logits = [-2, 2, 0] -dist = OneHotCategorical(logits=logits) -``` - -Creates a 3-class distribution, with the 3rd class is most likely to be drawn. - -```python -# counts is a scalar. -p = [0.1, 0.4, 0.5] -dist = OneHotCategorical(probs=p) -dist.prob([0,1,0]) # Shape [] - -# p will be broadcast to [[0.1, 0.4, 0.5], [0.1, 0.4, 0.5]] to match. -samples = [[0,1,0], [1,0,0]] -dist.prob(samples) # Shape [2] -``` -- - - - -#### `tf.contrib.distributions.OneHotCategorical.__init__(logits=None, probs=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='OneHotCategorical')` {#OneHotCategorical.__init__} - -Initialize OneHotCategorical distributions using class log-probabilities. - -##### Args: - - -* `logits`: An N-D `Tensor`, `N >= 1`, representing the log probabilities of a - set of Categorical distributions. The first `N - 1` dimensions index - into a batch of independent distributions and the last dimension - represents a vector of logits for each class. Only one of `logits` or - `probs` should be passed in. -* `probs`: An N-D `Tensor`, `N >= 1`, representing the probabilities of a set - of Categorical distributions. The first `N - 1` dimensions index into a - batch of independent distributions and the last dimension represents a - vector of probabilities for each class. Only one of `logits` or `probs` - should be passed in. -* `dtype`: The type of the event samples (default: int32). -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.allow_nan_stats` {#OneHotCategorical.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.batch_shape` {#OneHotCategorical.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.batch_shape_tensor(name='batch_shape_tensor')` {#OneHotCategorical.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.cdf(value, name='cdf')` {#OneHotCategorical.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.copy(**override_parameters_kwargs)` {#OneHotCategorical.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.covariance(name='covariance')` {#OneHotCategorical.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.dtype` {#OneHotCategorical.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.entropy(name='entropy')` {#OneHotCategorical.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.event_shape` {#OneHotCategorical.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.event_shape_tensor(name='event_shape_tensor')` {#OneHotCategorical.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.event_size` {#OneHotCategorical.event_size} - -Scalar `int32` tensor: the number of classes. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.is_continuous` {#OneHotCategorical.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.is_scalar_batch(name='is_scalar_batch')` {#OneHotCategorical.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.is_scalar_event(name='is_scalar_event')` {#OneHotCategorical.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.log_cdf(value, name='log_cdf')` {#OneHotCategorical.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.log_prob(value, name='log_prob')` {#OneHotCategorical.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.log_survival_function(value, name='log_survival_function')` {#OneHotCategorical.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.logits` {#OneHotCategorical.logits} - -Vector of coordinatewise logits. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.mean(name='mean')` {#OneHotCategorical.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.mode(name='mode')` {#OneHotCategorical.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.name` {#OneHotCategorical.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#OneHotCategorical.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.param_static_shapes(cls, sample_shape)` {#OneHotCategorical.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.parameters` {#OneHotCategorical.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.prob(value, name='prob')` {#OneHotCategorical.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.probs` {#OneHotCategorical.probs} - -Vector of coordinatewise probabilities. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.reparameterization_type` {#OneHotCategorical.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.sample(sample_shape=(), seed=None, name='sample')` {#OneHotCategorical.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.stddev(name='stddev')` {#OneHotCategorical.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.survival_function(value, name='survival_function')` {#OneHotCategorical.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.validate_args` {#OneHotCategorical.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.variance(name='variance')` {#OneHotCategorical.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.RelaxedBernoulli` {#RelaxedBernoulli} - -RelaxedBernoulli distribution with temperature and logits parameters. - -The RelaxedBernoulli is a distribution over the unit interval (0,1), which -continuously approximates a Bernoulli. The degree of approximation is -controlled by a temperature: as the temperaturegoes to 0 the RelaxedBernoulli -becomes discrete with a distribution described by the `logits` or `probs` -parameters, as the temperature goes to infinity the RelaxedBernoulli -becomes the constant distribution that is identically 0.5. - -The RelaxedBernoulli distribution is a reparameterized continuous -distribution that is the binary special case of the RelaxedOneHotCategorical -distribution (Maddison et al., 2016; Jang et al., 2016). For details on the -binary special case see the appendix of Maddison et al. (2016) where it is -referred to as BinConcrete. If you use this distribution, please cite both -papers. - -Some care needs to be taken for loss functions that depend on the -log-probability of RelaxedBernoullis, because computing log-probabilities of -the RelaxedBernoulli can suffer from underflow issues. In many case loss -functions such as these are invariant under invertible transformations of -the random variables. The KL divergence, found in the variational autoencoder -loss, is an example. Because RelaxedBernoullis are sampled by by a Logistic -random variable followed by a `tf.sigmoid` op, one solution is to treat -the Logistic as the random variable and `tf.sigmoid` as downstream. The -KL divergences of two Logistics, which are always followed by a `tf.sigmoid` -op, is equivalent to evaluating KL divergences of RelaxedBernoulli samples. -See Maddison et al., 2016 for more details where this distribution is called -the BinConcrete. - -An alternative approach is to evaluate Bernoulli log probability or KL -directly on relaxed samples, as done in Jang et al., 2016. In this case, -guarantees on the loss are usually violated. For instance, using a Bernoulli -KL in a relaxed ELBO is no longer a lower bound on the log marginal -probability of the observation. Thus care and early stopping are important. - -#### Examples - -Creates three continuous distributions, which approximate 3 Bernoullis with -probabilities (0.1, 0.5, 0.4). Samples from these distributions will be in -the unit interval (0,1). - -```python -temperature = 0.5 -p = [0.1, 0.5, 0.4] -dist = RelaxedBernoulli(temperature, probs=p) -``` - -Creates three continuous distributions, which approximate 3 Bernoullis with -logits (-2, 2, 0). Samples from these distributions will be in -the unit interval (0,1). - -```python -temperature = 0.5 -logits = [-2, 2, 0] -dist = RelaxedBernoulli(temperature, logits=logits) -``` - -Creates three continuous distributions, whose sigmoid approximate 3 Bernoullis -with logits (-2, 2, 0). - -```python -temperature = 0.5 -logits = [-2, 2, 0] -dist = Logistic(logits/temperature, 1./temperature) -samples = dist.sample() -sigmoid_samples = tf.sigmoid(samples) -# sigmoid_samples has the same distribution as samples from -# RelaxedBernoulli(temperature, logits=logits) -``` - -Creates three continuous distributions, which approximate 3 Bernoullis with -logits (-2, 2, 0). Samples from these distributions will be in -the unit interval (0,1). Because the temperature is very low, samples from -these distributions are almost discrete, usually taking values very close to 0 -or 1. - -```python -temperature = 1e-5 -logits = [-2, 2, 0] -dist = RelaxedBernoulli(temperature, logits=logits) -``` - -Creates three continuous distributions, which approximate 3 Bernoullis with -logits (-2, 2, 0). Samples from these distributions will be in -the unit interval (0,1). Because the temperature is very high, samples from -these distributions are usually close to the (0.5, 0.5, 0.5) vector. - -```python -temperature = 100 -logits = [-2, 2, 0] -dist = RelaxedBernoulli(temperature, logits=logits) -``` - -Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The Concrete Distribution: -A Continuous Relaxation of Discrete Random Variables. 2016. - -Eric Jang, Shixiang Gu, and Ben Poole. Categorical Reparameterization with -Gumbel-Softmax. 2016. -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.__init__(temperature, logits=None, probs=None, validate_args=False, allow_nan_stats=True, name='RelaxedBernoulli')` {#RelaxedBernoulli.__init__} - -Construct RelaxedBernoulli distributions. - -##### Args: - - -* `temperature`: An 0-D `Tensor`, representing the temperature - of a set of RelaxedBernoulli distributions. The temperature should be - positive. -* `logits`: An N-D `Tensor` representing the log-odds - of a positive event. Each entry in the `Tensor` parametrizes - an independent RelaxedBernoulli distribution where the probability of an - event is sigmoid(logits). Only one of `logits` or `probs` should be - passed in. -* `probs`: An N-D `Tensor` representing the probability of a positive event. - Each entry in the `Tensor` parameterizes an independent Bernoulli - distribution. Only one of `logits` or `probs` should be passed in. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `ValueError`: If both `probs` and `logits` are passed, or if neither. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.allow_nan_stats` {#RelaxedBernoulli.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.batch_shape` {#RelaxedBernoulli.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.batch_shape_tensor(name='batch_shape_tensor')` {#RelaxedBernoulli.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.bijector` {#RelaxedBernoulli.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.cdf(value, name='cdf')` {#RelaxedBernoulli.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.copy(**override_parameters_kwargs)` {#RelaxedBernoulli.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.covariance(name='covariance')` {#RelaxedBernoulli.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.distribution` {#RelaxedBernoulli.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.dtype` {#RelaxedBernoulli.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.entropy(name='entropy')` {#RelaxedBernoulli.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.event_shape` {#RelaxedBernoulli.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.event_shape_tensor(name='event_shape_tensor')` {#RelaxedBernoulli.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.is_continuous` {#RelaxedBernoulli.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.is_scalar_batch(name='is_scalar_batch')` {#RelaxedBernoulli.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.is_scalar_event(name='is_scalar_event')` {#RelaxedBernoulli.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.log_cdf(value, name='log_cdf')` {#RelaxedBernoulli.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.log_prob(value, name='log_prob')` {#RelaxedBernoulli.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.log_survival_function(value, name='log_survival_function')` {#RelaxedBernoulli.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.logits` {#RelaxedBernoulli.logits} - -Log-odds of `1`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.mean(name='mean')` {#RelaxedBernoulli.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.mode(name='mode')` {#RelaxedBernoulli.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.name` {#RelaxedBernoulli.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#RelaxedBernoulli.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.param_static_shapes(cls, sample_shape)` {#RelaxedBernoulli.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.parameters` {#RelaxedBernoulli.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.prob(value, name='prob')` {#RelaxedBernoulli.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.probs` {#RelaxedBernoulli.probs} - -Probability of `1`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.reparameterization_type` {#RelaxedBernoulli.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.sample(sample_shape=(), seed=None, name='sample')` {#RelaxedBernoulli.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.stddev(name='stddev')` {#RelaxedBernoulli.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.survival_function(value, name='survival_function')` {#RelaxedBernoulli.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.temperature` {#RelaxedBernoulli.temperature} - -Distribution parameter for the location. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.validate_args` {#RelaxedBernoulli.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.variance(name='variance')` {#RelaxedBernoulli.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.RelaxedOneHotCategorical` {#RelaxedOneHotCategorical} - -RelaxedOneHotCategorical distribution with temperature and logits. - -The RelaxedOneHotCategorical is a distribution over random probability -vectors, vectors of positive real values that sum to one, which continuously -approximates a OneHotCategorical. The degree of approximation is controlled by -a temperature: as the temperaturegoes to 0 the RelaxedOneHotCategorical -becomes discrete with a distribution described by the `logits` or `probs` -parameters, as the temperature goes to infinity the RelaxedOneHotCategorical -becomes the constant distribution that is identically the constant vector of -(1/event_size, ..., 1/event_size). - -The RelaxedOneHotCategorical distribution was concurrently introduced as the -Gumbel-Softmax (Jang et al., 2016) and Concrete (Maddison et al., 2016) -distributions for use as a reparameterized continuous approximation to the -`Categorical` one-hot distribution. If you use this distribution, please cite -both papers. - -#### Examples - -Creates a continuous distribution, which approximates a 3-class one-hot -categorical distiribution. The 2nd class is the most likely to be the -largest component in samples drawn from this distribution. - -```python -temperature = 0.5 -p = [0.1, 0.5, 0.4] -dist = RelaxedOneHotCategorical(temperature, probs=p) -``` - -Creates a continuous distribution, which approximates a 3-class one-hot -categorical distiribution. The 2nd class is the most likely to be the -largest component in samples drawn from this distribution. - -```python -temperature = 0.5 -logits = [-2, 2, 0] -dist = RelaxedOneHotCategorical(temperature, logits=logits) -``` - -Creates a continuous distribution, which approximates a 3-class one-hot -categorical distiribution. Because the temperature is very low, samples from -this distribution are almost discrete, with one component almost 1 and the -others nearly 0. The 2nd class is the most likely to be the largest component -in samples drawn from this distribution. - -```python -temperature = 1e-5 -logits = [-2, 2, 0] -dist = RelaxedOneHotCategorical(temperature, logits=logits) -``` - -Creates a continuous distribution, which approximates a 3-class one-hot -categorical distiribution. Because the temperature is very high, samples from -this distribution are usually close to the (1/3, 1/3, 1/3) vector. The 2nd -class is still the most likely to be the largest component -in samples drawn from this distribution. - -```python -temperature = 10 -logits = [-2, 2, 0] -dist = RelaxedOneHotCategorical(temperature, logits=logits) -``` - -Eric Jang, Shixiang Gu, and Ben Poole. Categorical Reparameterization with -Gumbel-Softmax. 2016. - -Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The Concrete Distribution: -A Continuous Relaxation of Discrete Random Variables. 2016. -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.__init__(temperature, logits=None, probs=None, dtype=tf.float32, validate_args=False, allow_nan_stats=True, name='RelaxedOneHotCategorical')` {#RelaxedOneHotCategorical.__init__} - -Initialize RelaxedOneHotCategorical using class log-probabilities. - -##### Args: - - -* `temperature`: An 0-D `Tensor`, representing the temperature - of a set of RelaxedOneHotCategorical distributions. The temperature - should be positive. -* `logits`: An N-D `Tensor`, `N >= 1`, representing the log probabilities - of a set of RelaxedOneHotCategorical distributions. The first - `N - 1` dimensions index into a batch of independent distributions and - the last dimension represents a vector of logits for each class. Only - one of `logits` or `probs` should be passed in. -* `probs`: An N-D `Tensor`, `N >= 1`, representing the probabilities - of a set of RelaxedOneHotCategorical distributions. The first `N - 1` - dimensions index into a batch of independent distributions and the last - dimension represents a vector of probabilities for each class. Only one - of `logits` or `probs` should be passed in. -* `dtype`: The type of the event samples (default: int32). -* `validate_args`: Unused in this distribution. -* `allow_nan_stats`: Python `bool`, default `True`. If `False`, raise an - exception if a statistic (e.g. mean/mode/etc...) is undefined for any - batch member. If `True`, batch members with valid parameters leading to - undefined statistics will return NaN for this statistic. -* `name`: A name for this distribution (optional). - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.allow_nan_stats` {#RelaxedOneHotCategorical.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.batch_shape` {#RelaxedOneHotCategorical.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.batch_shape_tensor(name='batch_shape_tensor')` {#RelaxedOneHotCategorical.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.bijector` {#RelaxedOneHotCategorical.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.cdf(value, name='cdf')` {#RelaxedOneHotCategorical.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.copy(**override_parameters_kwargs)` {#RelaxedOneHotCategorical.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.covariance(name='covariance')` {#RelaxedOneHotCategorical.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.distribution` {#RelaxedOneHotCategorical.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.dtype` {#RelaxedOneHotCategorical.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.entropy(name='entropy')` {#RelaxedOneHotCategorical.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.event_shape` {#RelaxedOneHotCategorical.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.event_shape_tensor(name='event_shape_tensor')` {#RelaxedOneHotCategorical.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.is_continuous` {#RelaxedOneHotCategorical.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.is_scalar_batch(name='is_scalar_batch')` {#RelaxedOneHotCategorical.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.is_scalar_event(name='is_scalar_event')` {#RelaxedOneHotCategorical.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.log_cdf(value, name='log_cdf')` {#RelaxedOneHotCategorical.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.log_prob(value, name='log_prob')` {#RelaxedOneHotCategorical.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.log_survival_function(value, name='log_survival_function')` {#RelaxedOneHotCategorical.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.mean(name='mean')` {#RelaxedOneHotCategorical.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.mode(name='mode')` {#RelaxedOneHotCategorical.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.name` {#RelaxedOneHotCategorical.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#RelaxedOneHotCategorical.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.param_static_shapes(cls, sample_shape)` {#RelaxedOneHotCategorical.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.parameters` {#RelaxedOneHotCategorical.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.prob(value, name='prob')` {#RelaxedOneHotCategorical.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.reparameterization_type` {#RelaxedOneHotCategorical.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.sample(sample_shape=(), seed=None, name='sample')` {#RelaxedOneHotCategorical.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.stddev(name='stddev')` {#RelaxedOneHotCategorical.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.survival_function(value, name='survival_function')` {#RelaxedOneHotCategorical.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.validate_args` {#RelaxedOneHotCategorical.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.variance(name='variance')` {#RelaxedOneHotCategorical.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - - -## Other Functions and Classes -- - - - -### `class tf.contrib.distributions.ConditionalDistribution` {#ConditionalDistribution} - -Distribution that supports intrinsic parameters (local latents). - -Subclasses of this distribution may have additional keyword arguments passed -to their sample-based methods (i.e. `sample`, `log_prob`, etc.). -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.__init__(dtype, is_continuous, reparameterization_type, validate_args, allow_nan_stats, parameters=None, graph_parents=None, name=None)` {#ConditionalDistribution.__init__} - -Constructs the `Distribution`. - -**This is a private method for subclass use.** - -##### Args: - - -* `dtype`: The type of the event samples. `None` implies no type-enforcement. -* `is_continuous`: Python `bool`. If `True` this `Distribution` is continuous - over its supported domain. -* `reparameterization_type`: Instance of `ReparameterizationType`. - If `distributions.FULLY_REPARAMETERIZED`, this - `Distribution` can be reparameterized in terms of some standard - distribution with a function whose Jacobian is constant for the support - of the standard distribution. If `distributions.NOT_REPARAMETERIZED`, - then no such reparameterization is available. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `parameters`: Python `dict` of parameters used to instantiate this - `Distribution`. -* `graph_parents`: Python `list` of graph prerequisites of this - `Distribution`. -* `name`: Python `str` name prefixed to Ops created by this class. Default: - subclass name. - -##### Raises: - - -* `ValueError`: if any member of graph_parents is `None` or not a `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.allow_nan_stats` {#ConditionalDistribution.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.batch_shape` {#ConditionalDistribution.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.batch_shape_tensor(name='batch_shape_tensor')` {#ConditionalDistribution.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.cdf(*args, **kwargs)` {#ConditionalDistribution.cdf} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.copy(**override_parameters_kwargs)` {#ConditionalDistribution.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.covariance(name='covariance')` {#ConditionalDistribution.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.dtype` {#ConditionalDistribution.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.entropy(name='entropy')` {#ConditionalDistribution.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.event_shape` {#ConditionalDistribution.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.event_shape_tensor(name='event_shape_tensor')` {#ConditionalDistribution.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.is_continuous` {#ConditionalDistribution.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.is_scalar_batch(name='is_scalar_batch')` {#ConditionalDistribution.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.is_scalar_event(name='is_scalar_event')` {#ConditionalDistribution.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.log_cdf(*args, **kwargs)` {#ConditionalDistribution.log_cdf} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.log_prob(*args, **kwargs)` {#ConditionalDistribution.log_prob} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.log_survival_function(*args, **kwargs)` {#ConditionalDistribution.log_survival_function} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.mean(name='mean')` {#ConditionalDistribution.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.mode(name='mode')` {#ConditionalDistribution.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.name` {#ConditionalDistribution.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#ConditionalDistribution.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.param_static_shapes(cls, sample_shape)` {#ConditionalDistribution.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.parameters` {#ConditionalDistribution.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.prob(*args, **kwargs)` {#ConditionalDistribution.prob} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.reparameterization_type` {#ConditionalDistribution.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.sample(*args, **kwargs)` {#ConditionalDistribution.sample} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.stddev(name='stddev')` {#ConditionalDistribution.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.survival_function(*args, **kwargs)` {#ConditionalDistribution.survival_function} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.validate_args` {#ConditionalDistribution.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.variance(name='variance')` {#ConditionalDistribution.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - -- - - - -### `class tf.contrib.distributions.ConditionalTransformedDistribution` {#ConditionalTransformedDistribution} - -A TransformedDistribution that allows intrinsic conditioning. -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.__init__(distribution, bijector=None, batch_shape=None, event_shape=None, validate_args=False, name=None)` {#ConditionalTransformedDistribution.__init__} - -Construct a Transformed Distribution. - -##### Args: - - -* `distribution`: The base distribution instance to transform. Typically an - instance of `Distribution`. -* `bijector`: The object responsible for calculating the transformation. - Typically an instance of `Bijector`. `None` means `Identity()`. -* `batch_shape`: `integer` vector `Tensor` which overrides `distribution` - `batch_shape`; valid only if `distribution.is_scalar_batch()`. -* `event_shape`: `integer` vector `Tensor` which overrides `distribution` - `event_shape`; valid only if `distribution.is_scalar_event()`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `name`: Python `str` name prefixed to Ops created by this class. Default: - `bijector.name + distribution.name`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.allow_nan_stats` {#ConditionalTransformedDistribution.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.batch_shape` {#ConditionalTransformedDistribution.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.batch_shape_tensor(name='batch_shape_tensor')` {#ConditionalTransformedDistribution.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.bijector` {#ConditionalTransformedDistribution.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.cdf(*args, **kwargs)` {#ConditionalTransformedDistribution.cdf} - -Additional documentation from `ConditionalTransformedDistribution`: - -##### `kwargs`: - -* `bijector_kwargs`: Python dictionary of arg names/values forwarded to the bijector. -* `distribution_kwargs`: Python dictionary of arg names/values forwarded to the distribution. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.copy(**override_parameters_kwargs)` {#ConditionalTransformedDistribution.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.covariance(name='covariance')` {#ConditionalTransformedDistribution.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.distribution` {#ConditionalTransformedDistribution.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.dtype` {#ConditionalTransformedDistribution.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.entropy(name='entropy')` {#ConditionalTransformedDistribution.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.event_shape` {#ConditionalTransformedDistribution.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.event_shape_tensor(name='event_shape_tensor')` {#ConditionalTransformedDistribution.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.is_continuous` {#ConditionalTransformedDistribution.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.is_scalar_batch(name='is_scalar_batch')` {#ConditionalTransformedDistribution.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.is_scalar_event(name='is_scalar_event')` {#ConditionalTransformedDistribution.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.log_cdf(*args, **kwargs)` {#ConditionalTransformedDistribution.log_cdf} - -Additional documentation from `ConditionalTransformedDistribution`: - -##### `kwargs`: - -* `bijector_kwargs`: Python dictionary of arg names/values forwarded to the bijector. -* `distribution_kwargs`: Python dictionary of arg names/values forwarded to the distribution. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.log_prob(*args, **kwargs)` {#ConditionalTransformedDistribution.log_prob} - -Additional documentation from `ConditionalTransformedDistribution`: - -##### `kwargs`: - -* `bijector_kwargs`: Python dictionary of arg names/values forwarded to the bijector. -* `distribution_kwargs`: Python dictionary of arg names/values forwarded to the distribution. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.log_survival_function(*args, **kwargs)` {#ConditionalTransformedDistribution.log_survival_function} - -Additional documentation from `ConditionalTransformedDistribution`: - -##### `kwargs`: - -* `bijector_kwargs`: Python dictionary of arg names/values forwarded to the bijector. -* `distribution_kwargs`: Python dictionary of arg names/values forwarded to the distribution. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.mean(name='mean')` {#ConditionalTransformedDistribution.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.mode(name='mode')` {#ConditionalTransformedDistribution.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.name` {#ConditionalTransformedDistribution.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#ConditionalTransformedDistribution.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.param_static_shapes(cls, sample_shape)` {#ConditionalTransformedDistribution.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.parameters` {#ConditionalTransformedDistribution.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.prob(*args, **kwargs)` {#ConditionalTransformedDistribution.prob} - -Additional documentation from `ConditionalTransformedDistribution`: - -##### `kwargs`: - -* `bijector_kwargs`: Python dictionary of arg names/values forwarded to the bijector. -* `distribution_kwargs`: Python dictionary of arg names/values forwarded to the distribution. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.reparameterization_type` {#ConditionalTransformedDistribution.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.sample(*args, **kwargs)` {#ConditionalTransformedDistribution.sample} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.stddev(name='stddev')` {#ConditionalTransformedDistribution.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.survival_function(*args, **kwargs)` {#ConditionalTransformedDistribution.survival_function} - -Additional documentation from `ConditionalTransformedDistribution`: - -##### `kwargs`: - -* `bijector_kwargs`: Python dictionary of arg names/values forwarded to the bijector. -* `distribution_kwargs`: Python dictionary of arg names/values forwarded to the distribution. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.validate_args` {#ConditionalTransformedDistribution.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.variance(name='variance')` {#ConditionalTransformedDistribution.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.ffmpeg.md b/tensorflow/g3doc/api_docs/python/contrib.ffmpeg.md deleted file mode 100644 index e420e4687f..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.ffmpeg.md +++ /dev/null @@ -1,61 +0,0 @@ - - -# FFmpeg (contrib) -[TOC] - -Working with audio using FFmpeg. See the @{$python/contrib.ffmpeg} guide. - -- - - - -### `tf.contrib.ffmpeg.decode_audio(contents, file_format=None, samples_per_second=None, channel_count=None)` {#decode_audio} - -Create an op that decodes the contents of an audio file. - -Note that ffmpeg is free to select the "best" audio track from an mp4. -https://trac.ffmpeg.org/wiki/Map - -##### Args: - - -* `contents`: The binary contents of the audio file to decode. This is a - scalar. -* `file_format`: A string specifying which format the contents will conform - to. This can be mp3, mp4, ogg, or wav. -* `samples_per_second`: The number of samples per second that is assumed. - In some cases, resampling will occur to generate the correct sample - rate. -* `channel_count`: The number of channels that should be created from the - audio contents. If the contents have more than this number, then - some channels will be merged or dropped. If contents has fewer than - this, then additional channels will be created from the existing ones. - -##### Returns: - - A rank 2 tensor that has time along dimension 0 and channels along - dimension 1. Dimension 0 will be `samples_per_second * length` wide, and - dimension 1 will be `channel_count` wide. If ffmpeg fails to decode the - audio then an empty tensor will be returned. - - -- - - - -### `tf.contrib.ffmpeg.encode_audio(audio, file_format=None, samples_per_second=None)` {#encode_audio} - -Creates an op that encodes an audio file using sampled audio from a tensor. - -##### Args: - - -* `audio`: A rank 2 tensor that has time along dimension 0 and channels along - dimension 1. Dimension 0 is `samples_per_second * length` long in - seconds. -* `file_format`: The type of file to encode. "wav" is the only supported format. -* `samples_per_second`: The number of samples in the audio tensor per second of - audio. - -##### Returns: - - A scalar tensor that contains the encoded audio in the specified file - format. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.framework.md b/tensorflow/g3doc/api_docs/python/contrib.framework.md deleted file mode 100644 index 5b00ee590a..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.framework.md +++ /dev/null @@ -1,1205 +0,0 @@ - - -# Framework (contrib) -[TOC] - -Framework utilities. See the @{$python/contrib.framework} guide. - -- - - - -### `tf.contrib.framework.assert_same_float_dtype(tensors=None, dtype=None)` {#assert_same_float_dtype} - -Validate and return float type based on `tensors` and `dtype`. - -For ops such as matrix multiplication, inputs and weights must be of the -same float type. This function validates that all `tensors` are the same type, -validates that type is `dtype` (if supplied), and returns the type. Type must -be `dtypes.float32` or `dtypes.float64`. If neither `tensors` nor -`dtype` is supplied, default to `dtypes.float32`. - -##### Args: - - -* `tensors`: Tensors of input values. Can include `None` elements, which will be - ignored. -* `dtype`: Expected type. - -##### Returns: - - Validated type. - -##### Raises: - - -* `ValueError`: if neither `tensors` nor `dtype` is supplied, or result is not - float. - - -- - - - -### `tf.contrib.framework.assert_scalar(tensor, name=None)` {#assert_scalar} - - - - -- - - - -### `tf.contrib.framework.assert_scalar_int(tensor, name=None)` {#assert_scalar_int} - -Assert `tensor` is 0-D, of type `tf.int32` or `tf.int64`. - -##### Args: - - -* `tensor`: `Tensor` to test. -* `name`: Name of the op and of the new `Tensor` if one is created. - -##### Returns: - - `tensor`, for chaining. - -##### Raises: - - -* `ValueError`: if `tensor` is not 0-D, of type `tf.int32` or `tf.int64`. - - -- - - - -### `tf.convert_to_tensor_or_sparse_tensor(value, dtype=None, name=None)` {#convert_to_tensor_or_sparse_tensor} - -Converts value to a `SparseTensor` or `Tensor`. - -##### Args: - - -* `value`: A `SparseTensor`, `SparseTensorValue`, or an object whose type has a - registered `Tensor` conversion function. -* `dtype`: Optional element type for the returned tensor. If missing, the - type is inferred from the type of `value`. -* `name`: Optional name to use if a new `Tensor` is created. - -##### Returns: - - A `SparseTensor` or `Tensor` based on `value`. - -##### Raises: - - -* `RuntimeError`: If result type is incompatible with `dtype`. - - -- - - - -### `tf.contrib.framework.get_graph_from_inputs(op_input_list, graph=None)` {#get_graph_from_inputs} - -Returns the appropriate graph to use for the given inputs. - -1. If `graph` is provided, we validate that all inputs in `op_input_list` are - from the same graph. -2. Otherwise, we attempt to select a graph from the first Operation- or - Tensor-valued input in `op_input_list`, and validate that all other - such inputs are in the same graph. -3. If the graph was not specified and it could not be inferred from - `op_input_list`, we attempt to use the default graph. - -##### Args: - - -* `op_input_list`: A list of inputs to an operation, which may include `Tensor`, - `Operation`, and other objects that may be converted to a graph element. -* `graph`: (Optional) The explicit graph to use. - -##### Raises: - - -* `TypeError`: If `op_input_list` is not a list or tuple, or if graph is not a - Graph. -* `ValueError`: If a graph is explicitly passed and not all inputs are from it, - or if the inputs are from multiple graphs, or we could not find a graph - and there was no default graph. - -##### Returns: - - The appropriate graph to use for the given inputs. - - -- - - - -### `tf.is_numeric_tensor(tensor)` {#is_numeric_tensor} - - - - -- - - - -### `tf.is_non_decreasing(x, name=None)` {#is_non_decreasing} - -Returns `True` if `x` is non-decreasing. - -Elements of `x` are compared in row-major order. The tensor `[x[0],...]` -is non-decreasing if for every adjacent pair we have `x[i] <= x[i+1]`. -If `x` has less than two elements, it is trivially non-decreasing. - -See also: `is_strictly_increasing` - -##### Args: - - -* `x`: Numeric `Tensor`. -* `name`: A name for this operation (optional). Defaults to "is_non_decreasing" - -##### Returns: - - Boolean `Tensor`, equal to `True` iff `x` is non-decreasing. - -##### Raises: - - -* `TypeError`: if `x` is not a numeric tensor. - - -- - - - -### `tf.is_strictly_increasing(x, name=None)` {#is_strictly_increasing} - -Returns `True` if `x` is strictly increasing. - -Elements of `x` are compared in row-major order. The tensor `[x[0],...]` -is strictly increasing if for every adjacent pair we have `x[i] < x[i+1]`. -If `x` has less than two elements, it is trivially strictly increasing. - -See also: `is_non_decreasing` - -##### Args: - - -* `x`: Numeric `Tensor`. -* `name`: A name for this operation (optional). - Defaults to "is_strictly_increasing" - -##### Returns: - - Boolean `Tensor`, equal to `True` iff `x` is strictly increasing. - -##### Raises: - - -* `TypeError`: if `x` is not a numeric tensor. - - -- - - - -### `tf.contrib.framework.is_tensor(x)` {#is_tensor} - -Check for tensor types. - -Check whether an object is a tensor. Equivalent to -`isinstance(x, [tf.Tensor, tf.SparseTensor, tf.Variable])`. - -##### Args: - - -* `x`: An python object to check. - -##### Returns: - - `True` if `x` is a tensor, `False` if not. - - -- - - - -### `tf.contrib.framework.reduce_sum_n(tensors, name=None)` {#reduce_sum_n} - -Reduce tensors to a scalar sum. - -This reduces each tensor in `tensors` to a scalar via `tf.reduce_sum`, then -adds them via `tf.add_n`. - -##### Args: - - -* `tensors`: List of tensors, all of the same numeric type. -* `name`: Tensor name, and scope for all other ops. - -##### Returns: - - Total loss tensor, or None if no losses have been configured. - -##### Raises: - - -* `ValueError`: if `losses` is missing or empty. - - -- - - - -### `tf.contrib.framework.remove_squeezable_dimensions(predictions, labels, name=None)` {#remove_squeezable_dimensions} - -Squeeze last dim if ranks of `predictions` and `labels` differ by 1. - -This will use static shape if available. Otherwise, it will add graph -operations, which could result in a performance hit. - -##### Args: - - -* `predictions`: Predicted values, a `Tensor` of arbitrary dimensions. -* `labels`: Label values, a `Tensor` whose dimensions match `predictions`. -* `name`: Name of the op. - -##### Returns: - - Tuple of `predictions` and `labels`, possibly with last dim squeezed. - - -- - - - -### `tf.contrib.framework.with_shape(expected_shape, tensor)` {#with_shape} - -Asserts tensor has expected shape. - -If tensor shape and expected_shape, are fully defined, assert they match. -Otherwise, add assert op that will validate the shape when tensor is -evaluated, and set shape on tensor. - -##### Args: - - -* `expected_shape`: Expected shape to assert, as a 1D array of ints, or tensor - of same. -* `tensor`: Tensor whose shape we're validating. - -##### Returns: - - tensor, perhaps with a dependent assert operation. - -##### Raises: - - -* `ValueError`: if tensor has an invalid shape. - - -- - - - -### `tf.contrib.framework.with_same_shape(expected_tensor, tensor)` {#with_same_shape} - -Assert tensors are the same shape, from the same graph. - -##### Args: - - -* `expected_tensor`: Tensor with expected shape. -* `tensor`: Tensor of actual values. - -##### Returns: - - Tuple of (actual_tensor, label_tensor), possibly with assert ops added. - - - -- - - - -### `tf.contrib.framework.deprecated(date, instructions)` {#deprecated} - -Decorator for marking functions or methods deprecated. - -This decorator logs a deprecation warning whenever the decorated function is -called. It has the following format: - - (from ) is deprecated and will be removed after . - Instructions for updating: - - - will include the class name if it is a method. - -It also edits the docstring of the function: ' (deprecated)' is appended -to the first line of the docstring and a deprecation notice is prepended -to the rest of the docstring. - -##### Args: - - -* `date`: String. The date the function is scheduled to be removed. Must be - ISO 8601 (YYYY-MM-DD). -* `instructions`: String. Instructions on how to update code using the - deprecated function. - -##### Returns: - - Decorated function or method. - -##### Raises: - - -* `ValueError`: If date is not in ISO 8601 format, or instructions are empty. - - -- - - - -### `tf.contrib.framework.deprecated_args(date, instructions, *deprecated_arg_names_or_tuples)` {#deprecated_args} - -Decorator for marking specific function arguments as deprecated. - -This decorator logs a deprecation warning whenever the decorated function is -called with the deprecated argument. It has the following format: - - Calling (from ) with is deprecated and will be - removed after . Instructions for updating: - - - will include the class name if it is a method. - -It also edits the docstring of the function: ' (deprecated arguments)' is -appended to the first line of the docstring and a deprecation notice is -prepended to the rest of the docstring. - -##### Args: - - -* `date`: String. The date the function is scheduled to be removed. Must be - ISO 8601 (YYYY-MM-DD). -* `instructions`: String. Instructions on how to update code using the - deprecated function. -* `*deprecated_arg_names_or_tuples`: String. or 2-Tuple(String, - [ok_vals]). The string is the deprecated argument name. - Optionally, an ok-value may be provided. If the user provided - argument equals this value, the warning is suppressed. - -##### Returns: - - Decorated function or method. - -##### Raises: - - -* `ValueError`: If date is not in ISO 8601 format, instructions are - empty, the deprecated arguments are not present in the function - signature, or the second element of a deprecated_tuple is not a - list. - - -- - - - -### `tf.contrib.framework.deprecated_arg_values(date, instructions, **deprecated_kwargs)` {#deprecated_arg_values} - -Decorator for marking specific function argument values as deprecated. - -This decorator logs a deprecation warning whenever the decorated function is -called with the deprecated argument values. It has the following format: - - Calling (from ) with = is deprecated and - will be removed after . Instructions for updating: - - - will include the class name if it is a method. - -It also edits the docstring of the function: ' (deprecated arguments)' is -appended to the first line of the docstring and a deprecation notice is -prepended to the rest of the docstring. - -##### Args: - - -* `date`: String. The date the function is scheduled to be removed. Must be - ISO 8601 (YYYY-MM-DD). -* `instructions`: String. Instructions on how to update code using the - deprecated function. -* `**deprecated_kwargs`: The deprecated argument values. - -##### Returns: - - Decorated function or method. - -##### Raises: - - -* `ValueError`: If date is not in ISO 8601 format, or instructions are empty. - - - -- - - - -### `tf.contrib.framework.arg_scope(list_ops_or_scope, **kwargs)` {#arg_scope} - -Stores the default arguments for the given set of list_ops. - -For usage, please see examples at top of the file. - -##### Args: - - -* `list_ops_or_scope`: List or tuple of operations to set argument scope for or - a dictionary containing the current scope. When list_ops_or_scope is a - dict, kwargs must be empty. When list_ops_or_scope is a list or tuple, - then every op in it need to be decorated with @add_arg_scope to work. -* `**kwargs`: keyword=value that will define the defaults for each op in - list_ops. All the ops need to accept the given set of arguments. - -##### Yields: - - the current_scope, which is a dictionary of {op: {arg: value}} - -##### Raises: - - -* `TypeError`: if list_ops is not a list or a tuple. -* `ValueError`: if any op in list_ops has not be decorated with @add_arg_scope. - - -- - - - -### `tf.contrib.framework.add_arg_scope(func)` {#add_arg_scope} - -Decorates a function with args so it can be used within an arg_scope. - -##### Args: - - -* `func`: function to decorate. - -##### Returns: - - A tuple with the decorated function func_with_args(). - - -- - - - -### `tf.contrib.framework.has_arg_scope(func)` {#has_arg_scope} - -Checks whether a func has been decorated with @add_arg_scope or not. - -##### Args: - - -* `func`: function to check. - -##### Returns: - - a boolean. - - -- - - - -### `tf.contrib.framework.arg_scoped_arguments(func)` {#arg_scoped_arguments} - -Returns the list kwargs that arg_scope can set for a func. - -##### Args: - - -* `func`: function which has been decorated with @add_arg_scope. - -##### Returns: - - a list of kwargs names. - - - -- - - - -### `tf.contrib.framework.add_model_variable(var)` {#add_model_variable} - -Adds a variable to the `GraphKeys.MODEL_VARIABLES` collection. - -##### Args: - - -* `var`: a variable. - - -- - - - -### `tf.train.assert_global_step(global_step_tensor)` {#assert_global_step} - -Asserts `global_step_tensor` is a scalar int `Variable` or `Tensor`. - -##### Args: - - -* `global_step_tensor`: `Tensor` to test. - - -- - - - -### `tf.contrib.framework.assert_or_get_global_step(graph=None, global_step_tensor=None)` {#assert_or_get_global_step} - -Verifies that a global step tensor is valid or gets one if None is given. - -If `global_step_tensor` is not None, check that it is a valid global step -tensor (using `assert_global_step`). Otherwise find a global step tensor using -`get_global_step` and return it. - -##### Args: - - -* `graph`: The graph to find the global step tensor for. -* `global_step_tensor`: The tensor to check for suitability as a global step. - If None is given (the default), find a global step tensor. - -##### Returns: - - A tensor suitable as a global step, or `None` if none was provided and none - was found. - - -- - - - -### `tf.contrib.framework.assign_from_checkpoint(model_path, var_list)` {#assign_from_checkpoint} - -Creates an operation to assign specific variables from a checkpoint. - -##### Args: - - -* `model_path`: The full path to the model checkpoint. To get latest checkpoint - use `model_path = tf.train.latest_checkpoint(checkpoint_dir)` -* `var_list`: A list of (possibly partitioned) `Variable` objects - or a dictionary mapping names in the checkpoint to the - corresponding variables or list of variables to initialize - from that checkpoint value. For partitioned Variables, the - name in the checkpoint must be the full variable, not the - name of the partitioned variable, eg. "my_var" rather than - "my_var/part_4". If empty, returns no_op(), {}. - -##### Returns: - - the restore_op and the feed_dict that need to be run to restore var_list. - -##### Raises: - - -* `ValueError`: If the checkpoint specified at `model_path` is missing one of - the variables in `var_list`. - - -- - - - -### `tf.contrib.framework.assign_from_checkpoint_fn(model_path, var_list, ignore_missing_vars=False, reshape_variables=False)` {#assign_from_checkpoint_fn} - -Returns a function that assigns specific variables from a checkpoint. - -##### Args: - - -* `model_path`: The full path to the model checkpoint. To get latest checkpoint - use `model_path = tf.train.latest_checkpoint(checkpoint_dir)` -* `var_list`: A list of `Variable` objects or a dictionary mapping names in the - checkpoint to the correspoing variables to initialize. If empty or None, - it would return no_op(), None. -* `ignore_missing_vars`: Boolean, if True it would ignore variables missing in - the checkpoint with a warning instead of failing. -* `reshape_variables`: Boolean, if True it would automatically reshape variables - which are of different shape then the ones stored in the checkpoint but - which have the same number of elements. - -##### Returns: - - A function that takes a single argument, a `tf.Session`, that applies the - assignment operation. - -##### Raises: - - -* `ValueError`: If the checkpoint specified at `model_path` is missing one of - the variables in `var_list`. - - -- - - - -### `tf.contrib.framework.assign_from_values(var_names_to_values)` {#assign_from_values} - -Creates an assignment operation from a given mapping. - -This function provides a mechanism for performing assignment of variables -to values in a way that does not fill the graph with large assignment values. - -##### Args: - - -* `var_names_to_values`: A map from variable names to values. - -##### Returns: - - -* `assign_op`: An `Operation` that assigns each of the given variables to the - requested values. -* `feed_dict`: The feed dictionary to use when evaluating `assign_op`. - -##### Raises: - - -* `ValueError`: if any of the given variable names were not found. - - -- - - - -### `tf.contrib.framework.assign_from_values_fn(var_names_to_values)` {#assign_from_values_fn} - -Returns a function that assigns specific variables from the given values. - -This function provides a mechanism for performing assignment of variables -to values in a way that does not fill the graph with large assignment values. - -##### Args: - - -* `var_names_to_values`: A map from variable names to values. - -##### Returns: - - A function that takes a single argument, a `tf.Session`, that applies the - assignment operation. - -##### Raises: - - -* `ValueError`: if any of the given variable names were not found. - - -- - - - -### `tf.contrib.framework.create_global_step(graph=None)` {#create_global_step} - -Create global step tensor in graph. - -##### Args: - - -* `graph`: The graph in which to create the global step. If missing, use default - graph. - -##### Returns: - - Global step tensor. - -##### Raises: - - -* `ValueError`: if global step key is already defined. - - -- - - - -### `tf.contrib.framework.filter_variables(var_list, include_patterns=None, exclude_patterns=None, reg_search=True)` {#filter_variables} - -Filter a list of variables using regular expressions. - -First includes variables according to the list of include_patterns. -Afterwards, eliminates variables according to the list of exclude_patterns. - -For example, one can obtain a list of variables with the weights of all -convolutional layers (depending on the network definition) by: - -```python -variables = tf.contrib.framework.get_model_variables() -conv_weight_variables = tf.contrib.framework.filter_variables( - variables, - include_patterns=['Conv'], - exclude_patterns=['biases', 'Logits']) -``` - -##### Args: - - -* `var_list`: list of variables. -* `include_patterns`: list of regular expressions to include. Defaults to None, - which means all variables are selected according to the include rules. - A variable is included if it matches any of the include_patterns. -* `exclude_patterns`: list of regular expressions to exclude. Defaults to None, - which means all variables are selected according to the exclude rules. - A variable is excluded if it matches any of the exclude_patterns. -* `reg_search`: boolean. If True (default), performs re.search to find matches - (i.e. pattern can match any substring of the variable name). If False, - performs re.match (i.e. regexp should match from the beginning of the - variable name). - -##### Returns: - - filtered list of variables. - - -- - - - -### `tf.train.get_global_step(graph=None)` {#get_global_step} - -Get the global step tensor. - -The global step tensor must be an integer variable. We first try to find it -in the collection `GLOBAL_STEP`, or by name `global_step:0`. - -##### Args: - - -* `graph`: The graph to find the global step in. If missing, use default graph. - -##### Returns: - - The global step variable, or `None` if none was found. - -##### Raises: - - -* `TypeError`: If the global step tensor has a non-integer type, or if it is not - a `Variable`. - - -- - - - -### `tf.contrib.framework.get_or_create_global_step(graph=None)` {#get_or_create_global_step} - -Returns and create (if necessary) the global step variable. - -##### Args: - - -* `graph`: The graph in which to create the global step. If missing, use default - graph. - -##### Returns: - - the tensor representing the global step variable. - - -- - - - -### `tf.contrib.framework.get_local_variables(scope=None, suffix=None)` {#get_local_variables} - -Gets the list of local variables, filtered by scope and/or suffix. - -##### Args: - - -* `scope`: an optional scope for filtering the variables to return. -* `suffix`: an optional suffix for filtering the variables to return. - -##### Returns: - - a list of variables in collection with scope and suffix. - - -- - - - -### `tf.contrib.framework.get_model_variables(scope=None, suffix=None)` {#get_model_variables} - -Gets the list of model variables, filtered by scope and/or suffix. - -##### Args: - - -* `scope`: an optional scope for filtering the variables to return. -* `suffix`: an optional suffix for filtering the variables to return. - -##### Returns: - - a list of variables in collection with scope and suffix. - - -- - - - -### `tf.contrib.framework.get_unique_variable(var_op_name)` {#get_unique_variable} - -Gets the variable uniquely identified by that var_op_name. - -##### Args: - - -* `var_op_name`: the full name of the variable op, including the scope. - -##### Returns: - - a tensorflow variable. - -##### Raises: - - -* `ValueError`: if no variable uniquely identified by the name exists. - - -- - - - -### `tf.contrib.framework.get_variables_by_name(given_name, scope=None)` {#get_variables_by_name} - -Gets the list of variables that were given that name. - -##### Args: - - -* `given_name`: name given to the variable without any scope. -* `scope`: an optional scope for filtering the variables to return. - -##### Returns: - - a copied list of variables with the given name and scope. - - -- - - - -### `tf.contrib.framework.get_variables_by_suffix(suffix, scope=None)` {#get_variables_by_suffix} - -Gets the list of variables that end with the given suffix. - -##### Args: - - -* `suffix`: suffix for filtering the variables to return. -* `scope`: an optional scope for filtering the variables to return. - -##### Returns: - - a copied list of variables with the given name and prefix. - - -- - - - -### `tf.contrib.framework.get_variable_full_name(var)` {#get_variable_full_name} - -Returns the full name of a variable. - -For normal Variables, this is the same as the var.op.name. For -sliced or PartitionedVariables, this name is the same for all the -slices/partitions. In both cases, this is normally the name used in -a checkpoint file. - -##### Args: - - -* `var`: A `Variable` object. - -##### Returns: - - A string that is the full name. - - -- - - - -### `tf.contrib.framework.get_variables_to_restore(include=None, exclude=None)` {#get_variables_to_restore} - -Gets the list of the variables to restore. - -##### Args: - - -* `include`: an optional list/tuple of scope strings for filtering which - variables from the VARIABLES collection to include. None would include all - the variables. -* `exclude`: an optional list/tuple of scope strings for filtering which - variables from the VARIABLES collection to exclude. None it would not - exclude any. - -##### Returns: - - a list of variables to restore. - -##### Raises: - - -* `TypeError`: include or exclude is provided but is not a list or a tuple. - - -- - - - -### `tf.contrib.framework.get_variables(scope=None, suffix=None, collection='variables')` {#get_variables} - -Gets the list of variables, filtered by scope and/or suffix. - -##### Args: - - -* `scope`: an optional scope for filtering the variables to return. Can be a - variable scope or a string. -* `suffix`: an optional suffix for filtering the variables to return. -* `collection`: in which collection search for. Defaults to - `GraphKeys.GLOBAL_VARIABLES`. - -##### Returns: - - a list of variables in collection with scope and suffix. - - -- - - - -### `tf.contrib.framework.local_variable(initial_value, validate_shape=True, name=None)` {#local_variable} - -Create variable and add it to `GraphKeys.LOCAL_VARIABLES` collection. - -##### Args: - - -* `initial_value`: See variables.Variable.__init__. -* `validate_shape`: See variables.Variable.__init__. -* `name`: See variables.Variable.__init__. - -##### Returns: - - New variable. - - -- - - - -### `tf.contrib.framework.model_variable(*args, **kwargs)` {#model_variable} - -Gets an existing model variable with these parameters or creates a new one. - -##### Args: - - -* `name`: the name of the new or existing variable. -* `shape`: shape of the new or existing variable. -* `dtype`: type of the new or existing variable (defaults to `DT_FLOAT`). -* `initializer`: initializer for the variable if one is created. -* `regularizer`: a (Tensor -> Tensor or None) function; the result of - applying it on a newly created variable will be added to the collection - GraphKeys.REGULARIZATION_LOSSES and can be used for regularization. -* `trainable`: If `True` also add the variable to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see `tf.Variable`). -* `collections`: A list of collection names to which the Variable will be added. - Note that the variable is always also added to the - `GraphKeys.GLOBAL_VARIABLES` and `GraphKeys.MODEL_VARIABLES` collections. -* `caching_device`: Optional device string or function describing where the - Variable should be cached for reading. Defaults to the Variable's - device. -* `device`: Optional device to place the variable. It can be an string or a - function that is called to get the device for the variable. -* `partitioner`: Optional callable that accepts a fully defined `TensorShape` - and dtype of the `Variable` to be created, and returns a list of - partitions for each axis (currently only one axis can be partitioned). -* `custom_getter`: Callable that allows overwriting the internal - get_variable method and has to have the same signature. - -##### Returns: - - The created or existing variable. - - -- - - - -### `tf.contrib.framework.variable(*args, **kwargs)` {#variable} - -Gets an existing variable with these parameters or creates a new one. - -##### Args: - - -* `name`: the name of the new or existing variable. -* `shape`: shape of the new or existing variable. -* `dtype`: type of the new or existing variable (defaults to `DT_FLOAT`). -* `initializer`: initializer for the variable if one is created. -* `regularizer`: a (Tensor -> Tensor or None) function; the result of - applying it on a newly created variable will be added to the collection - GraphKeys.REGULARIZATION_LOSSES and can be used for regularization. -* `trainable`: If `True` also add the variable to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see `tf.Variable`). -* `collections`: A list of collection names to which the Variable will be added. - If None it would default to `tf.GraphKeys.GLOBAL_VARIABLES`. -* `caching_device`: Optional device string or function describing where the - Variable should be cached for reading. Defaults to the Variable's - device. -* `device`: Optional device to place the variable. It can be an string or a - function that is called to get the device for the variable. -* `partitioner`: Optional callable that accepts a fully defined `TensorShape` - and dtype of the `Variable` to be created, and returns a list of - partitions for each axis (currently only one axis can be partitioned). -* `custom_getter`: Callable that allows overwriting the internal - get_variable method and has to have the same signature. - -##### Returns: - - The created or existing variable. - - -- - - - -### `class tf.contrib.framework.VariableDeviceChooser` {#VariableDeviceChooser} - -Device chooser for variables. - -When using a parameter server it will assign them in a round-robin fashion. -When not using a parameter server it allows GPU or CPU placement. -- - - - -#### `tf.contrib.framework.VariableDeviceChooser.__call__(op)` {#VariableDeviceChooser.__call__} - - - - -- - - - -#### `tf.contrib.framework.VariableDeviceChooser.__init__(num_tasks=0, job_name='ps', device_type='CPU', device_index=0)` {#VariableDeviceChooser.__init__} - -Initialize VariableDeviceChooser. - -##### Usage: - - To use with 2 parameter servers: - VariableDeviceChooser(2) - - To use without parameter servers: - VariableDeviceChooser() - VariableDeviceChooser(device_type='GPU') # For GPU placement - -##### Args: - - -* `num_tasks`: number of tasks. -* `job_name`: String, a name for the parameter server job. -* `device_type`: Optional device type string (e.g. "CPU" or "GPU") -* `device_index`: int. Optional device index. If left - unspecified, device represents 'any' device_index. - - - -- - - - -### `tf.contrib.framework.zero_initializer(ref, use_locking=True, name='zero_initializer')` {#zero_initializer} - -Initialize 'ref' with all zeros, ref tensor should be uninitialized. -If already initialized, you will get ValueError. This op is intended to -save memory during initialization. - -##### Args: - - -* `ref`: ref of the tensor need to be zero initialized. -* `name`: optional name for this operation. - -##### Returns: - - ref that initialized. - -##### Raises: - - -* `ValueError`: If ref tensor is initialized. - - - -- - - - -### `tf.contrib.framework.load_checkpoint(filepattern)` {#load_checkpoint} - -Returns CheckpointReader for latest checkpoint. - -##### Args: - - -* `filepattern`: Directory with checkpoints file or path to checkpoint. - -##### Returns: - - `CheckpointReader` object. - -##### Raises: - - -* `ValueError`: if checkpoint_dir doesn't have 'checkpoint' file or checkpoints. - - -- - - - -### `tf.contrib.framework.list_variables(checkpoint_dir)` {#list_variables} - -Returns list of all variables in the latest checkpoint. - -##### Args: - - -* `checkpoint_dir`: Directory with checkpoints file or path to checkpoint. - -##### Returns: - - List of tuples `(name, shape)`. - - -- - - - -### `tf.contrib.framework.load_variable(checkpoint_dir, name)` {#load_variable} - -Returns a Tensor with the contents of the given variable in the checkpoint. - -##### Args: - - -* `checkpoint_dir`: Directory with checkpoints file or path to checkpoint. -* `name`: Name of the tensor to return. - -##### Returns: - - `Tensor` object. - - -- - - - -### `tf.contrib.framework.init_from_checkpoint(checkpoint_dir, assignment_map)` {#init_from_checkpoint} - -Using assingment map initializes current variables with loaded tensors. - -Note: This overrides default initialization ops of specified variables and -redefines dtype. - -##### Assignment map supports following syntax: - - `'checkpoint_scope_name/': 'scope_name/'` - will load all variables in - current `scope_name` from `checkpoint_scope_name` with matching variable - names. - `'checkpoint_scope_name/some_other_variable': 'scope_name/variable_name'` - - will initalize `scope_name/variable_name` variable - from `checkpoint_scope_name/some_other_variable`. - `'scope_variable_name': variable` - will initialize given `tf.Variable` - object with variable from the checkpoint. - `'scope_variable_name': list(variable)` - will initialize list of - partitioned variables with variable from the checkpoint. - `'/': 'scope_name/'` - will load all variables in current `scope_name` from - checkpoint's root (e.g. no scope). - -Supports loading into partitioned variables, which are represented as -'/part_'. - - -* `Example`: -```python - # Create variables. - with tf.variable_scope('test'): - m = tf.get_variable('my_var') - with tf.variable_scope('test2'): - var2 = tf.get_variable('my_var') - var3 = tf.get_variable(name="my1", shape=[100, 100], - partitioner=lambda shape, dtype: [5, 1]) - ... - # Specify which variables to intialize from checkpoint. - init_from_checkpoint(checkpoint_dir, { - 'some_var': 'test/my_var', - 'some_scope/': 'test2/'}) - ... - # Or use `Variable` objects to identify what to initialize. - init_from_checkpoint(checkpoint_dir, { - 'some_scope/var2': var2, - }) - # Initialize partitioned variables - init_from_checkpoint(checkpoint_dir, { - 'some_var_from_ckpt': 'part_var', - }) - # Or specifying the list of `Variable` objects. - init_from_checkpoint(checkpoint_dir, { - 'some_var_from_ckpt': var3._get_variable_list(), - }) - ... - # Initialize variables as usual. - session.run(tf.get_all_variables()) -``` - -##### Args: - - -* `checkpoint_dir`: Directory with checkpoints file or path to checkpoint. -* `assignment_map`: Dict, where keys are names of the variables in the - checkpoint and values are current variables or names of current variables - (in default graph). - -##### Raises: - - tf.errors.OpError: If missing checkpoints or tensors in checkpoints. - -* `ValueError`: If missing variables in current graph. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.graph_editor.md b/tensorflow/g3doc/api_docs/python/contrib.graph_editor.md deleted file mode 100644 index 700af31086..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.graph_editor.md +++ /dev/null @@ -1,2054 +0,0 @@ - - -# Graph Editor (contrib) -[TOC] - -TensorFlow Graph Editor. See the @{$python/contrib.graph_editor} guide. - -## Other Functions and Classes -- - - - -### `class tf.contrib.graph_editor.ControlOutputs` {#ControlOutputs} - -The control outputs topology. -- - - - -#### `tf.contrib.graph_editor.ControlOutputs.__init__(graph)` {#ControlOutputs.__init__} - -Create a dictionary of control-output dependencies. - -##### Args: - - -* `graph`: a `tf.Graph`. - -##### Returns: - - A dictionary where a key is a `tf.Operation` instance and the - corresponding value is a list of all the ops which have the key - as one of their control-input dependencies. - -##### Raises: - - -* `TypeError`: graph is not a `tf.Graph`. - - -- - - - -#### `tf.contrib.graph_editor.ControlOutputs.get(op)` {#ControlOutputs.get} - -return the control outputs of op. - - -- - - - -#### `tf.contrib.graph_editor.ControlOutputs.get_all()` {#ControlOutputs.get_all} - - - - -- - - - -#### `tf.contrib.graph_editor.ControlOutputs.graph` {#ControlOutputs.graph} - - - - -- - - - -#### `tf.contrib.graph_editor.ControlOutputs.update()` {#ControlOutputs.update} - -Update the control outputs if the graph has changed. - - - -- - - - -### `class tf.contrib.graph_editor.OpMatcher` {#OpMatcher} - -Graph match class. -- - - - -#### `tf.contrib.graph_editor.OpMatcher.__call__(op)` {#OpMatcher.__call__} - -Evaluate if the op matches or not. - - -- - - - -#### `tf.contrib.graph_editor.OpMatcher.__init__(positive_filter)` {#OpMatcher.__init__} - -Graph match constructor. - - -- - - - -#### `tf.contrib.graph_editor.OpMatcher.control_input_ops(*args)` {#OpMatcher.control_input_ops} - -Add input matches. - - -- - - - -#### `tf.contrib.graph_editor.OpMatcher.input_ops(*args)` {#OpMatcher.input_ops} - -Add input matches. - - -- - - - -#### `tf.contrib.graph_editor.OpMatcher.output_ops(*args)` {#OpMatcher.output_ops} - -Add output matches. - - - -- - - - -### `class tf.contrib.graph_editor.SubGraphView` {#SubGraphView} - -A subgraph view on an existing `tf.Graph`. - -An instance of this class is a subgraph view on an existing `tf.Graph`. -"subgraph" means that it can represent part of the whole `tf.Graph`. -"view" means that it only provides a passive observation and do not to act -on the `tf.Graph`. Note that in this documentation, the term "subgraph" is -often used as substitute to "subgraph view". - -A subgraph contains: - -* a list of input tensors, accessible via the `inputs` property. -* a list of output tensors, accessible via the `outputs` property. -* and the operations in between, accessible via the "ops" property. - -An subgraph can be seen as a function F(i0, i1, ...) -> o0, o1, ... It is a -function which takes as input some input tensors and returns as output some -output tensors. The computation that the function performs is encoded in the -operations of the subgraph. - -The tensors (input or output) can be of two kinds: - -- connected: a connected tensor connects to at least one operation contained -in the subgraph. One example is a subgraph representing a single operation -and its inputs and outputs: all the input and output tensors of the op -are "connected". -- passthrough: a passthrough tensor does not connect to any operation -contained in the subgraph. One example is a subgraph representing a -single tensor: this tensor is passthrough. By default a passthrough tensor is -present both in the input and output tensors of the subgraph. It can however -be remapped to only appear as an input (or output) only. - -The input and output tensors can be remapped. For instance, some input tensor -can be omitted. For instance, a subgraph representing an operation with two -inputs can be remapped to only take one input. Note that this does not change -at all the underlying `tf.Graph` (remember, it is a view). It means that -the other input is being ignored, or is being treated as "given". -The analogy with functions can be extended like this: F(x,y) is the original -function. Remapping the inputs from [x, y] to just [x] means that the subgraph -now represent the function F_y(x) (y is "given"). - -The output tensors can also be remapped. For instance, some output tensor can -be omitted. Other output tensor can be duplicated as well. As mentioned -before, this does not change at all the underlying `tf.Graph`. -The analogy with functions can be extended like this: F(...)->x,y is the -original function. Remapping the outputs from [x, y] to just [y,y] means that -the subgraph now represent the function M(F(...)) where M is the function -M(a,b)->b,b. - -It is useful to describe three other kind of tensors: - -* internal: an internal tensor is a tensor connecting operations contained - in the subgraph. One example in the subgraph representing the two - operations A and B connected sequentially: -> A -> B ->. The middle arrow - is an internal tensor. -* actual input: an input tensor of the subgraph, regardless of whether it is - listed in "inputs" or not (masked-out). -* actual output: an output tensor of the subgraph, regardless of whether it is - listed in "outputs" or not (masked-out). -* hidden input: an actual input which has been masked-out using an - input remapping. In other word, a hidden input is a non-internal tensor - not listed as a input tensor and one of whose consumers belongs to - the subgraph. -* hidden output: a actual output which has been masked-out using an output - remapping. In other word, a hidden output is a non-internal tensor - not listed as an output and one of whose generating operations belongs to - the subgraph. - -Here are some useful guarantees about an instance of a SubGraphView: - -* the input (or output) tensors are not internal. -* the input (or output) tensors are either "connected" or "passthrough". -* the passthrough tensors are not connected to any of the operation of -the subgraph. - -Note that there is no guarantee that an operation in a subgraph contributes -at all to its inputs or outputs. For instance, remapping both the inputs and -outputs to empty lists will produce a subgraph which still contains all the -original operations. However, the remove_unused_ops function can be used to -make a new subgraph view whose operations are connected to at least one of -the input or output tensors. - -An instance of this class is meant to be a lightweight object which is not -modified in-place by the user. Rather, the user can create new modified -instances of a given subgraph. In that sense, the class SubGraphView is meant -to be used like an immutable python object. - -A common problem when using views is that they can get out-of-sync with the -data they observe (in this case, a `tf.Graph`). This is up to the user to -ensure that this doesn't happen. To keep on the safe side, it is recommended -that the life time of subgraph views are kept very short. One way to achieve -this is to use subgraphs within a "with make_sgv(...) as sgv:" Python context. - -To alleviate the out-of-sync problem, some functions are granted the right to -modified subgraph in place. This is typically the case of graph manipulation -functions which, given some subgraphs as arguments, can modify the underlying -`tf.Graph`. Since this modification is likely to render the subgraph view -invalid, those functions can modify the argument in place to reflect the -change. For instance, calling the function swap_inputs(svg0, svg1) will modify -svg0 and svg1 in place to reflect the fact that their inputs have now being -swapped. -- - - - -#### `tf.contrib.graph_editor.SubGraphView.__bool__()` {#SubGraphView.__bool__} - -Allows for implicit boolean conversion. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.__copy__()` {#SubGraphView.__copy__} - -Create a copy of this subgraph. - -Note that this class is a "view", copying it only create another view and -does not copy the underlying part of the `tf.Graph`. - -##### Returns: - - A new identical instance of the original subgraph view. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.__enter__()` {#SubGraphView.__enter__} - -Allow Python context to minimize the life time of a subgraph view. - -A subgraph view is meant to be a lightweight and transient object. A short -lifetime will alleviate the "out-of-sync" issue mentioned earlier. For that -reason, a SubGraphView instance can be used within a Python context. For -example: - -from tensorflow.contrib import graph_editor as ge -with ge.make_sgv(...) as sgv: - print(sgv) - -##### Returns: - - Itself. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.__exit__(exc_type, exc_value, traceback)` {#SubGraphView.__exit__} - - - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.__init__(inside_ops=(), passthrough_ts=())` {#SubGraphView.__init__} - -Create a subgraph containing the given ops and the "passthrough" tensors. - -##### Args: - - -* `inside_ops`: an object convertible to a list of `tf.Operation`. This list - defines all the operations in the subgraph. -* `passthrough_ts`: an object convertible to a list of `tf.Tensor`. This list - define all the "passthrough" tensors. A passthrough tensor is a tensor - which goes directly from the input of the subgraph to it output, without - any intermediate operations. All the non passthrough tensors are - silently ignored. - -##### Raises: - - -* `TypeError`: if inside_ops cannot be converted to a list of `tf.Operation` - or if `passthrough_ts` cannot be converted to a list of `tf.Tensor`. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.__nonzero__()` {#SubGraphView.__nonzero__} - -Allows for implicit boolean conversion. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.__str__()` {#SubGraphView.__str__} - - - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.connected_inputs` {#SubGraphView.connected_inputs} - -The connected input tensors of this subgraph view. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.connected_outputs` {#SubGraphView.connected_outputs} - -The connected output tensors of this subgraph view. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.consumers()` {#SubGraphView.consumers} - -Return a Python set of all the consumers of this subgraph view. - -A consumer of a subgraph view is a tf.Operation which is a consumer -of one of the output tensors and is not in the subgraph. - -##### Returns: - - A list of `tf.Operation` which are the consumers of this subgraph view. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.copy()` {#SubGraphView.copy} - -Return a copy of itself. - -Note that this class is a "view", copying it only create another view and -does not copy the underlying part of the tf.Graph. - -##### Returns: - - A new instance identical to the original one. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.find_op_by_name(op_name)` {#SubGraphView.find_op_by_name} - -Return the op named op_name. - -##### Args: - - -* `op_name`: the name to search for - -##### Returns: - - The op named op_name. - -##### Raises: - - -* `ValueError`: if the op_name could not be found. -* `AssertionError`: if the name was found multiple time. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.graph` {#SubGraphView.graph} - -The underlying `tf.Graph`. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.input_index(t)` {#SubGraphView.input_index} - -Find the input index corresponding to the given input tensor t. - -##### Args: - - -* `t`: the input tensor of this subgraph view. - -##### Returns: - - The index in the self.inputs list. - -##### Raises: - - -* `Error`: if t in not an input tensor. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.inputs` {#SubGraphView.inputs} - -The input tensors of this subgraph view. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.is_passthrough(t)` {#SubGraphView.is_passthrough} - -Check whether a tensor is passthrough. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.op(op_id)` {#SubGraphView.op} - -Get an op by its index. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.ops` {#SubGraphView.ops} - -The operations in this subgraph view. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.output_index(t)` {#SubGraphView.output_index} - -Find the output index corresponding to given output tensor t. - -##### Args: - - -* `t`: the output tensor of this subgraph view. - -##### Returns: - - The index in the self.outputs list. - -##### Raises: - - -* `Error`: if t in not an output tensor. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.outputs` {#SubGraphView.outputs} - -The output tensors of this subgraph view. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.passthroughs` {#SubGraphView.passthroughs} - -The passthrough tensors, going straight from input to output. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.remap(new_input_indices=None, new_output_indices=None)` {#SubGraphView.remap} - -Remap the inputs and outputs of the subgraph. - -Note that this is only modifying the view: the underlying tf.Graph is not -affected. - -##### Args: - - -* `new_input_indices`: an iterable of integers or tf.Tensors - representing a mapping between the old inputs and the new ones. - Integers must be positive and smaller than the number of old inputs. - tf.Tensors must belong to the old list of inputs. - This mapping can be under-complete and must be without repetitions. -* `new_output_indices`: an iterable of integers or tf.Tensors - representing a mapping between the old outputs and the new ones. - Integers must be positive and smaller than the number of old outputs. - tf.Tensors must belong to the old list of outputs. - This mapping can be under-complete and can have repetitions. - -##### Returns: - - A new modified instance of the original subgraph view with remapped - inputs and outputs. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.remap_default(remove_input_map=True, remove_output_map=True)` {#SubGraphView.remap_default} - -Remap the inputs and/or outputs to the default mapping. - -##### Args: - - -* `remove_input_map`: if True the input map is reset to the default one. -* `remove_output_map`: if True the output map is reset to the default one. - -##### Returns: - - A new modified instance of the original subgraph view with its - input and/or output mapping reset to the default one. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.remap_inputs(new_input_indices)` {#SubGraphView.remap_inputs} - -Remap the inputs of the subgraph. - -If the inputs of the original subgraph are [t0, t1, t2], remapping to [2,0] -will create a new instance whose inputs is [t2, t0]. - -Note that this is only modifying the view: the underlying `tf.Graph` is not -affected. - -##### Args: - - -* `new_input_indices`: an iterable of integers or tf.Tensors - representing a mapping between the old inputs and the new ones. - Integers must be positive and smaller than the number of old inputs. - tf.Tensors must belong to the old list of inputs. - This mapping can be under-complete and must be without repetitions. - -##### Returns: - - A new modified instance of the original subgraph view with remapped - inputs. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.remap_outputs(new_output_indices)` {#SubGraphView.remap_outputs} - -Remap the output of the subgraph. - -If the output of the original subgraph are [t0, t1, t2], remapping to -[1,1,0] will create a new instance whose outputs is [t1, t1, t0]. - -Note that this is only modifying the view: the underlying tf.Graph is not -affected. - -##### Args: - - -* `new_output_indices`: an iterable of integers or tf.Tensors - representing a mapping between the old outputs and the new ones. - Integers must be positive and smaller than the number of old outputs. - tf.Tensors must belong to the old list of outputs. - This mapping can be under-complete and can have repetitions. - -##### Returns: - - A new modified instance of the original subgraph view with remapped - outputs. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.remap_outputs_make_unique()` {#SubGraphView.remap_outputs_make_unique} - -Remap the outputs so that all the tensors appears only once. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.remap_outputs_to_consumers()` {#SubGraphView.remap_outputs_to_consumers} - -Remap the outputs to match the number of consumers. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.remove_unused_ops(control_inputs=True)` {#SubGraphView.remove_unused_ops} - -Remove unused ops. - -##### Args: - - -* `control_inputs`: if True, control inputs are used to detect used ops. - -##### Returns: - - A new subgraph view which only contains used operations. - - - -- - - - -### `class tf.contrib.graph_editor.Transformer` {#Transformer} - -Transform a subgraph into another one. - -By default, the constructor create a transform which copy a subgraph and -replaces inputs with placeholders. This behavior can be modified by changing -the handlers. -- - - - -#### `tf.contrib.graph_editor.Transformer.__call__(sgv, dst_graph, dst_scope, src_scope='', reuse_dst_scope=False)` {#Transformer.__call__} - -Execute the transformation. - -##### Args: - - -* `sgv`: the source subgraph-view. -* `dst_graph`: the destination graph. -* `dst_scope`: the destination scope. -* `src_scope`: the source scope, which specify the path from which the - relative path of the transformed nodes are computed. For instance, if - src_scope is a/ and dst_scoped is b/, then the node a/x/y will have a - relative path of x/y and will be transformed into b/x/y. -* `reuse_dst_scope`: if True the dst_scope is re-used if it already exists. - Otherwise, the scope is given a unique name based on the one given - by appending an underscore followed by a digit (default). - -##### Returns: - - A tuple `(sgv, info)` where: - `sgv` is the transformed subgraph view; - `info` is an instance of TransformerInfo containing - information about the transform, including mapping between - original and transformed tensors and operations. - -##### Raises: - - -* `ValueError`: if the arguments are invalid. - - -- - - - -#### `tf.contrib.graph_editor.Transformer.__init__()` {#Transformer.__init__} - -Transformer constructor. - -The following members can be modified: -transform_op_handler: handle the transformation of a `tf.Operation`. - This handler defaults to a simple copy. -assign_collections_handler: handle the assignment of collections. - This handler defaults to assigning new collections created under the - given name-scope. -transform_external_input_handler: handle the transform of the inputs to - the given subgraph. This handler defaults to creating placeholders - instead of the ops just before the input tensors of the subgraph. -transform_external_hidden_input_handler: handle the transform of the - hidden inputs of the subgraph, that is, the inputs which are not listed - in sgv.inputs. This handler defaults to a transform which keep the same - input if the source and destination graphs are the same, otherwise - use placeholders. -transform_original_op_handler: handle the transform of original_op. This - handler defaults to transforming original_op only if they are in the - subgraph, otherwise they are ignored. - - - -- - - - -### `class tf.contrib.graph_editor.TransformerInfo` {#TransformerInfo} - -"Contains information about the result of a transform operation. -- - - - -#### `tf.contrib.graph_editor.TransformerInfo.__init__(info)` {#TransformerInfo.__init__} - -Constructor. - -##### Args: - - -* `info`: an instance of Transformer._TmpInfo containing various internal - information about the transform operation. - - -- - - - -#### `tf.contrib.graph_editor.TransformerInfo.__str__()` {#TransformerInfo.__str__} - - - - -- - - - -#### `tf.contrib.graph_editor.TransformerInfo.original(transformed, missing_fn=None)` {#TransformerInfo.original} - -Return the original op/tensor corresponding to the transformed one. - -Note that the output of this function mimics the hierarchy -of its input argument `transformed`. -Given an iterable, it returns a list. Given an operation or a tensor, -it will return an operation or a tensor. - -##### Args: - - -* `transformed`: the transformed tensor/operation. -* `missing_fn`: function handling the case where the counterpart - cannot be found. By default, None is returned. - -##### Returns: - - the original tensor/operation (or None if no match is found). - - -- - - - -#### `tf.contrib.graph_editor.TransformerInfo.transformed(original, missing_fn=None)` {#TransformerInfo.transformed} - -Return the transformed op/tensor corresponding to the original one. - -Note that the output of this function mimics the hierarchy -of its input argument `original`. -Given an iterable, it returns a list. Given an operation or a tensor, -it will return an operation or a tensor. - -##### Args: - - -* `original`: the original tensor/operation. -* `missing_fn`: function handling the case where the counterpart - cannot be found. By default, None is returned. - -##### Returns: - - the transformed tensor/operation (or None if no match is found). - - - -- - - - -### `tf.contrib.graph_editor.add_control_inputs(op, cops)` {#add_control_inputs} - -Add the control inputs cops to co. - -Warning: this function is directly manipulating the internals of the tf.Graph. - -##### Args: - - -* `op`: a tf.Operation to which the control inputs are added. -* `cops`: an object convertible to a list of `tf.Operation`. - -##### Raises: - - -* `TypeError`: if op is not a tf.Operation -* `ValueError`: if any cop in cops is already a control input of op. - - -- - - - -### `tf.contrib.graph_editor.assign_renamed_collections_handler(info, elem, elem_)` {#assign_renamed_collections_handler} - -Add the transformed elem to the (renamed) collections of elem. - -A collection is renamed only if is not a known key, as described in -`tf.GraphKeys`. - -##### Args: - - -* `info`: Transform._TmpInfo instance. -* `elem`: the original element (`tf.Tensor` or `tf.Operation`) -* `elem_`: the transformed element - - -- - - - -### `tf.contrib.graph_editor.bypass(sgv)` {#bypass} - -Bypass the given subgraph by connecting its inputs to its outputs. - -##### Args: - - -* `sgv`: the subgraph view to be bypassed. This argument is converted to a - subgraph using the same rules than the function subgraph.make_view. - Note that sgv is modified in place. - -##### Returns: - - A tuple `(sgv, detached_inputs)` where: - `sgv` is a new subgraph view of the bypassed subgraph; - `detached_inputs` is a list of the created input placeholders. - -##### Raises: - - -* `StandardError`: if sgv cannot be converted to a SubGraphView using - the same rules than the function subgraph.make_view. - - -- - - - -### `tf.contrib.graph_editor.can_be_regex(obj)` {#can_be_regex} - -Return True if obj can be turned into a regular expression. - - -- - - - -### `tf.contrib.graph_editor.check_cios(control_inputs=False, control_outputs=None, control_ios=None)` {#check_cios} - -Do various check on control_inputs and control_outputs. - -##### Args: - - -* `control_inputs`: A boolean indicating whether control inputs are enabled. -* `control_outputs`: An instance of util.ControlOutputs or None. If not None, - control outputs are enabled. -* `control_ios`: An instance of util.ControlOutputs or None. If not None, both - control inputs and control outputs are enabled. This is equivalent to set - control_inputs to True and control_outputs to the util.ControlOutputs - instance. - -##### Returns: - - A tuple `(control_inputs, control_outputs)` where: - `control_inputs` is a boolean indicating whether to use control inputs. - `control_outputs` is an instance of util.ControlOutputs or None - -##### Raises: - - -* `ValueError`: if control_inputs is an instance of util.ControlOutputs but - control_outputs is not None -* `TypeError`: if control_outputs is not None and is not a util.ControlOutputs. - - -- - - - -### `tf.contrib.graph_editor.compute_boundary_ts(ops)` {#compute_boundary_ts} - -Compute the tensors at the boundary of a set of ops. - -This function looks at all the tensors connected to the given ops (in/out) -and classify them into three categories: -1) input tensors: tensors whose generating operation is not in ops. -2) output tensors: tensors whose consumer operations are not in ops -3) inside tensors: tensors which are neither input nor output tensors. - -Note that a tensor can be both an inside tensor and an output tensor if it is -consumed by operations both outside and inside of `ops`. - -##### Args: - - -* `ops`: an object convertible to a list of tf.Operation. - -##### Returns: - - A tuple `(outside_input_ts, outside_output_ts, inside_ts)` where: - `outside_input_ts` is a Python list of input tensors; - `outside_output_ts` is a python list of output tensors; - `inside_ts` is a python list of inside tensors. - Since a tensor can be both an inside tensor and an output tensor, - `outside_output_ts` and `inside_ts` might intersect. - -##### Raises: - - -* `TypeError`: if ops cannot be converted to a list of tf.Operation. - - -- - - - -### `tf.contrib.graph_editor.connect(sgv0, sgv1, disconnect_first=False)` {#connect} - -Connect the outputs of sgv0 to the inputs of sgv1. - -##### Args: - - -* `sgv0`: the first subgraph to have its outputs swapped. This argument is - converted to a subgraph using the same rules as the function - subgraph.make_view. - Note that sgv0 is modified in place. -* `sgv1`: the second subgraph to have its outputs swapped. This argument is - converted to a subgraph using the same rules as the function - subgraph.make_view. - Note that sgv1 is modified in place. -* `disconnect_first`: if True the current outputs of sgv0 are disconnected. - -##### Returns: - - A tuple `(sgv0, sgv1)` of the now connected subgraphs. - -##### Raises: - - -* `StandardError`: if sgv0 or sgv1 cannot be converted to a SubGraphView using - the same rules than the function subgraph.make_view. - - -- - - - -### `tf.contrib.graph_editor.copy_op_handler(info, op, copy_shape=True)` {#copy_op_handler} - -Copy a `tf.Operation`. - -##### Args: - - -* `info`: Transform._TmpInfo instance. -* `op`: the `tf.Operation` to be copied. -* `copy_shape`: also copy the shape of the tensor - -##### Returns: - - A `(op, op_outputs)` tuple containgin the transformed op and its outputs. - - -- - - - -### `tf.contrib.graph_editor.copy_with_input_replacements(sgv, replacement_ts, dst_graph=None, dst_scope='', src_scope='', reuse_dst_scope=False)` {#copy_with_input_replacements} - -Copy a subgraph, replacing some of its inputs. - -Note a replacement only happens if the tensor to be replaced -is an input of the given subgraph. The inputs of a subgraph can -be queried using sgv.inputs. - -##### Args: - - -* `sgv`: the source subgraph-view. This argument is converted to a subgraph - using the same rules as the function subgraph.make_view. -* `replacement_ts`: dictionary mapping from original tensors to the - replaced one. -* `dst_graph`: the destination graph. -* `dst_scope`: the destination scope. -* `src_scope`: the source scope. -* `reuse_dst_scope`: if True the dst_scope is re-used if it already exists. - Otherwise, the scope is given a unique name based on the one given - by appending an underscore followed by a digit (default). - -##### Returns: - - A tuple `(sgv, info)` where: - `sgv` is the transformed subgraph view; - `info` is an instance of TransformerInfo containing - information about the transform, including mapping between - original and transformed tensors and operations. - -##### Raises: - - -* `TypeError`: if dst_graph is not a tf.Graph. -* `StandardError`: if sgv cannot be converted to a SubGraphView using - the same rules as the function subgraph.make_view. - - -- - - - -### `tf.contrib.graph_editor.detach(sgv, control_inputs=False, control_outputs=None, control_ios=None)` {#detach} - -Detach both the inputs and the outputs of a subgraph view. - -##### Args: - - -* `sgv`: the subgraph view to be detached. This argument is converted to a - subgraph using the same rules as the function subgraph.make_view. - Note that sgv is modified in place. -* `control_inputs`: A boolean indicating whether control inputs are enabled. -* `control_outputs`: An instance of util.ControlOutputs or None. If not None, - control outputs are enabled. -* `control_ios`: An instance of util.ControlOutputs or None. If not None, both - control inputs and control outputs are enabled. This is equivalent to set - control_inputs to True and control_outputs to the util.ControlOutputs - instance. - -##### Returns: - - A tuple `(sgv, detached_inputs, detached_outputs)` where: - `sgv` is a new subgraph view of the detached subgraph; - `detach_inputs` is a list of the created input placeholders; - `detach_outputs` is a list of the created output placeholders. - -##### Raises: - - -* `StandardError`: if sgv cannot be converted to a SubGraphView using - the same rules than the function subgraph.make_view. - - -- - - - -### `tf.contrib.graph_editor.detach_control_inputs(sgv)` {#detach_control_inputs} - -Detach all the external control inputs of the subgraph sgv. - -##### Args: - - -* `sgv`: the subgraph view to be detached. This argument is converted to a - subgraph using the same rules as the function subgraph.make_view. - - -- - - - -### `tf.contrib.graph_editor.detach_control_outputs(sgv, control_outputs)` {#detach_control_outputs} - -Detach all the external control outputs of the subgraph sgv. - -##### Args: - - -* `sgv`: the subgraph view to be detached. This argument is converted to a - subgraph using the same rules as the function subgraph.make_view. -* `control_outputs`: a util.ControlOutputs instance. - - -- - - - -### `tf.contrib.graph_editor.detach_inputs(sgv, control_inputs=False)` {#detach_inputs} - -Detach the inputs of a subgraph view. - -##### Args: - - -* `sgv`: the subgraph view to be detached. This argument is converted to a - subgraph using the same rules as the function subgraph.make_view. - Note that sgv is modified in place. -* `control_inputs`: if True control_inputs are also detached. - -##### Returns: - - A tuple `(sgv, input_placeholders)` where - `sgv` is a new subgraph view of the detached subgraph; - `input_placeholders` is a list of the created input placeholders. - -##### Raises: - - -* `StandardError`: if sgv cannot be converted to a SubGraphView using - the same rules than the function subgraph.make_view. - - -- - - - -### `tf.contrib.graph_editor.detach_outputs(sgv, control_outputs=None)` {#detach_outputs} - -Detach the output of a subgraph view. - -##### Args: - - -* `sgv`: the subgraph view to be detached. This argument is converted to a - subgraph using the same rules as the function subgraph.make_view. - Note that sgv is modified in place. -* `control_outputs`: a util.ControlOutputs instance or None. If not None the - control outputs are also detached. - -##### Returns: - - A tuple `(sgv, output_placeholders)` where - `sgv` is a new subgraph view of the detached subgraph; - `output_placeholders` is a list of the created output placeholders. - -##### Raises: - - -* `StandardError`: if sgv cannot be converted to a SubGraphView using - the same rules than the function subgraph.make_view. - - -- - - - -### `tf.contrib.graph_editor.filter_ops(ops, positive_filter)` {#filter_ops} - -Get the ops passing the given filter. - -##### Args: - - -* `ops`: an object convertible to a list of tf.Operation. -* `positive_filter`: a function deciding where to keep an operation or not. - If True, all the operations are returned. - -##### Returns: - - A list of selected tf.Operation. - -##### Raises: - - -* `TypeError`: if ops cannot be converted to a list of tf.Operation. - - -- - - - -### `tf.contrib.graph_editor.filter_ops_from_regex(ops, regex)` {#filter_ops_from_regex} - -Get all the operations that match the given regex. - -##### Args: - - -* `ops`: an object convertible to a list of `tf.Operation`. -* `regex`: a regular expression matching the operation's name. - For example, `"^foo(/.*)?$"` will match all the operations in the "foo" - scope. - -##### Returns: - - A list of `tf.Operation`. - -##### Raises: - - -* `TypeError`: if ops cannot be converted to a list of `tf.Operation`. - - -- - - - -### `tf.contrib.graph_editor.filter_ts(ops, positive_filter)` {#filter_ts} - -Get all the tensors which are input or output of an op in ops. - -##### Args: - - -* `ops`: an object convertible to a list of `tf.Operation`. -* `positive_filter`: a function deciding whether to keep a tensor or not. - If `True`, all the tensors are returned. - -##### Returns: - - A list of `tf.Tensor`. - -##### Raises: - - -* `TypeError`: if ops cannot be converted to a list of `tf.Operation`. - - -- - - - -### `tf.contrib.graph_editor.filter_ts_from_regex(ops, regex)` {#filter_ts_from_regex} - -Get all the tensors linked to ops that match the given regex. - -##### Args: - - -* `ops`: an object convertible to a list of tf.Operation. -* `regex`: a regular expression matching the tensors' name. - For example, "^foo(/.*)?:\d+$" will match all the tensors in the "foo" - scope. - -##### Returns: - - A list of tf.Tensor. - -##### Raises: - - -* `TypeError`: if ops cannot be converted to a list of tf.Operation. - - -- - - - -### `tf.contrib.graph_editor.get_backward_walk_ops(seed_ops, inclusive=True, within_ops=None, stop_at_ts=(), control_inputs=False)` {#get_backward_walk_ops} - -Do a backward graph walk and return all the visited ops. - -##### Args: - - -* `seed_ops`: an iterable of operations from which the backward graph - walk starts. If a list of tensors is given instead, the seed_ops are set - to be the generators of those tensors. -* `inclusive`: if True the given seed_ops are also part of the resulting set. -* `within_ops`: an iterable of `tf.Operation` within which the search is - restricted. If `within_ops` is `None`, the search is performed within - the whole graph. -* `stop_at_ts`: an iterable of tensors at which the graph walk stops. -* `control_inputs`: if True, control inputs will be used while moving backward. - -##### Returns: - - A Python set of all the `tf.Operation` behind `seed_ops`. - -##### Raises: - - -* `TypeError`: if `seed_ops` or `within_ops` cannot be converted to a list of - `tf.Operation`. - - -- - - - -### `tf.contrib.graph_editor.get_consuming_ops(ts)` {#get_consuming_ops} - -Return all the consuming ops of the tensors in ts. - -##### Args: - - -* `ts`: a list of `tf.Tensor` - -##### Returns: - - A list of all the consuming `tf.Operation` of the tensors in `ts`. - -##### Raises: - - -* `TypeError`: if ts cannot be converted to a list of `tf.Tensor`. - - -- - - - -### `tf.contrib.graph_editor.get_forward_walk_ops(seed_ops, inclusive=True, within_ops=None, stop_at_ts=(), control_outputs=None)` {#get_forward_walk_ops} - -Do a forward graph walk and return all the visited ops. - -##### Args: - - -* `seed_ops`: an iterable of operations from which the forward graph - walk starts. If a list of tensors is given instead, the seed_ops are set - to be the consumers of those tensors. -* `inclusive`: if True the given seed_ops are also part of the resulting set. -* `within_ops`: an iterable of `tf.Operation` within which the search is - restricted. If `within_ops` is `None`, the search is performed within - the whole graph. -* `stop_at_ts`: an iterable of tensors at which the graph walk stops. -* `control_outputs`: a `util.ControlOutputs` instance or None. - If not `None`, it will be used while walking the graph forward. - -##### Returns: - - A Python set of all the `tf.Operation` ahead of `seed_ops`. - -##### Raises: - - -* `TypeError`: if `seed_ops` or `within_ops` cannot be converted to a list of - `tf.Operation`. - - -- - - - -### `tf.contrib.graph_editor.get_generating_ops(ts)` {#get_generating_ops} - -Return all the generating ops of the tensors in `ts`. - -##### Args: - - -* `ts`: a list of `tf.Tensor` - -##### Returns: - - A list of all the generating `tf.Operation` of the tensors in `ts`. - -##### Raises: - - -* `TypeError`: if `ts` cannot be converted to a list of `tf.Tensor`. - - -- - - - -### `tf.contrib.graph_editor.get_name_scope_ops(ops, scope)` {#get_name_scope_ops} - -Get all the operations under the given scope path. - -##### Args: - - -* `ops`: an object convertible to a list of tf.Operation. -* `scope`: a scope path. - -##### Returns: - - A list of tf.Operation. - -##### Raises: - - -* `TypeError`: if ops cannot be converted to a list of tf.Operation. - - -- - - - -### `tf.contrib.graph_editor.get_ops_ios(ops, control_inputs=False, control_outputs=None, control_ios=None)` {#get_ops_ios} - -Return all the `tf.Operation` which are connected to an op in ops. - -##### Args: - - -* `ops`: an object convertible to a list of `tf.Operation`. -* `control_inputs`: A boolean indicating whether control inputs are enabled. -* `control_outputs`: An instance of `util.ControlOutputs` or `None`. If not - `None`, control outputs are enabled. -* `control_ios`: An instance of `util.ControlOutputs` or `None`. If not `None`, - both control inputs and control outputs are enabled. This is equivalent to - set `control_inputs` to `True` and `control_outputs` to the - `util.ControlOutputs` instance. - -##### Returns: - - All the `tf.Operation` surrounding the given ops. - -##### Raises: - - -* `TypeError`: if `ops` cannot be converted to a list of `tf.Operation`. - - -- - - - -### `tf.contrib.graph_editor.get_tensors(graph)` {#get_tensors} - -get all the tensors which are input or output of an op in the graph. - -##### Args: - - -* `graph`: a `tf.Graph`. - -##### Returns: - - A list of `tf.Tensor`. - -##### Raises: - - -* `TypeError`: if graph is not a `tf.Graph`. - - -- - - - -### `tf.contrib.graph_editor.get_walks_intersection_ops(forward_seed_ops, backward_seed_ops, forward_inclusive=True, backward_inclusive=True, within_ops=None, control_inputs=False, control_outputs=None, control_ios=None)` {#get_walks_intersection_ops} - -Return the intersection of a forward and a backward walk. - -##### Args: - - -* `forward_seed_ops`: an iterable of operations from which the forward graph - walk starts. If a list of tensors is given instead, the seed_ops are set - to be the consumers of those tensors. -* `backward_seed_ops`: an iterable of operations from which the backward graph - walk starts. If a list of tensors is given instead, the seed_ops are set - to be the generators of those tensors. -* `forward_inclusive`: if True the given forward_seed_ops are also part of the - resulting set. -* `backward_inclusive`: if True the given backward_seed_ops are also part of the - resulting set. -* `within_ops`: an iterable of tf.Operation within which the search is - restricted. If within_ops is None, the search is performed within - the whole graph. -* `control_inputs`: A boolean indicating whether control inputs are enabled. -* `control_outputs`: An instance of util.ControlOutputs or None. If not None, - control outputs are enabled. -* `control_ios`: An instance of util.ControlOutputs or None. If not None, both - control inputs and control outputs are enabled. This is equivalent to set - control_inputs to True and control_outputs to the util.ControlOutputs - instance. - -##### Returns: - - A Python set of all the tf.Operation in the intersection of a forward and a - backward walk. - -##### Raises: - - -* `TypeError`: if `forward_seed_ops` or `backward_seed_ops` or `within_ops` - cannot be converted to a list of `tf.Operation`. - - -- - - - -### `tf.contrib.graph_editor.get_walks_union_ops(forward_seed_ops, backward_seed_ops, forward_inclusive=True, backward_inclusive=True, within_ops=None, control_inputs=False, control_outputs=None, control_ios=None)` {#get_walks_union_ops} - -Return the union of a forward and a backward walk. - -##### Args: - - -* `forward_seed_ops`: an iterable of operations from which the forward graph - walk starts. If a list of tensors is given instead, the seed_ops are set - to be the consumers of those tensors. -* `backward_seed_ops`: an iterable of operations from which the backward graph - walk starts. If a list of tensors is given instead, the seed_ops are set - to be the generators of those tensors. -* `forward_inclusive`: if True the given forward_seed_ops are also part of the - resulting set. -* `backward_inclusive`: if True the given backward_seed_ops are also part of the - resulting set. -* `within_ops`: restrict the search within those operations. If within_ops is - None, the search is done within the whole graph. -* `control_inputs`: A boolean indicating whether control inputs are enabled. -* `control_outputs`: An instance of util.ControlOutputs or None. If not None, - control outputs are enabled. -* `control_ios`: An instance of util.ControlOutputs or None. If not None, both - control inputs and control outputs are enabled. This is equivalent to set - control_inputs to True and control_outputs to the util.ControlOutputs - instance. - -##### Returns: - - A Python set of all the tf.Operation in the union of a forward and a - backward walk. - -##### Raises: - - -* `TypeError`: if forward_seed_ops or backward_seed_ops or within_ops cannot be - converted to a list of tf.Operation. - - -- - - - -### `tf.contrib.graph_editor.get_within_boundary_ops(ops, seed_ops, boundary_ops=(), inclusive=True, control_inputs=False, control_outputs=None, control_ios=None)` {#get_within_boundary_ops} - -Return all the `tf.Operation` within the given boundary. - -##### Args: - - -* `ops`: an object convertible to a list of `tf.Operation`. those ops define the - set in which to perform the operation (if a `tf.Graph` is given, it - will be converted to the list of all its operations). -* `seed_ops`: the operations from which to start expanding. -* `boundary_ops`: the ops forming the boundary. -* `inclusive`: if `True`, the result will also include the boundary ops. -* `control_inputs`: A boolean indicating whether control inputs are enabled. -* `control_outputs`: An instance of `util.ControlOutputs` or `None`. If not - `None`, control outputs are enabled. -* `control_ios`: An instance of `util.ControlOutputs` or `None`. If not - `None`, both control inputs and control outputs are enabled. This is - equivalent to set control_inputs to True and control_outputs to - the `util.ControlOutputs` instance. - -##### Returns: - - All the `tf.Operation` surrounding the given ops. - -##### Raises: - - -* `TypeError`: if `ops` or `seed_ops` cannot be converted to a list of - `tf.Operation`. -* `ValueError`: if the boundary is intersecting with the seeds. - - -- - - - -### `tf.contrib.graph_editor.graph_replace(target_ts, replacement_ts, dst_scope='', src_scope='', reuse_dst_scope=False)` {#graph_replace} - -Create a new graph which compute the targets from the replaced Tensors. - -##### Args: - - -* `target_ts`: a single tf.Tensor or an iterable of tf.Tensor. -* `replacement_ts`: dictionary mapping from original tensors to replaced tensors -* `dst_scope`: the destination scope. -* `src_scope`: the source scope. -* `reuse_dst_scope`: if True the dst_scope is re-used if it already exists. - Otherwise, the scope is given a unique name based on the one given - by appending an underscore followed by a digit (default). - -##### Returns: - - A single tf.Tensor or a list of target tf.Tensor, depending on - the type of the input argument `target_ts`. - The returned tensors are recomputed using the tensors from replacement_ts. - -##### Raises: - - -* `ValueError`: if the targets are not connected to replacement_ts. - - -- - - - -### `tf.contrib.graph_editor.keep_t_if_possible_handler(info, t)` {#keep_t_if_possible_handler} - -Transform a tensor into itself (identity) if possible. - -This handler transform a tensor into itself if the source and destination -graph are the same. Otherwise it will create a placeholder. -This handler is typically used to transform a hidden input tensors. - -##### Args: - - -* `info`: Transform._TmpInfo instance. -* `t`: tensor whose input must be transformed into a place holder. - -##### Returns: - - The tensor generated by the newly created place holder. - - -- - - - -### `tf.contrib.graph_editor.make_list_of_op(ops, check_graph=True, allow_graph=True, ignore_ts=False)` {#make_list_of_op} - -Convert ops to a list of `tf.Operation`. - -##### Args: - - -* `ops`: can be an iterable of `tf.Operation`, a `tf.Graph` or a single - operation. -* `check_graph`: if `True` check if all the operations belong to the same graph. -* `allow_graph`: if `False` a `tf.Graph` cannot be converted. -* `ignore_ts`: if True, silently ignore `tf.Tensor`. - -##### Returns: - - A newly created list of `tf.Operation`. - -##### Raises: - - -* `TypeError`: if ops cannot be converted to a list of `tf.Operation` or, - if `check_graph` is `True`, if all the ops do not belong to the - same graph. - - -- - - - -### `tf.contrib.graph_editor.make_list_of_t(ts, check_graph=True, allow_graph=True, ignore_ops=False)` {#make_list_of_t} - -Convert ts to a list of `tf.Tensor`. - -##### Args: - - -* `ts`: can be an iterable of `tf.Tensor`, a `tf.Graph` or a single tensor. -* `check_graph`: if `True` check if all the tensors belong to the same graph. -* `allow_graph`: if `False` a `tf.Graph` cannot be converted. -* `ignore_ops`: if `True`, silently ignore `tf.Operation`. - -##### Returns: - - A newly created list of `tf.Tensor`. - -##### Raises: - - -* `TypeError`: if `ts` cannot be converted to a list of `tf.Tensor` or, - if `check_graph` is `True`, if all the ops do not belong to the same graph. - - -- - - - -### `tf.contrib.graph_editor.make_placeholder_from_dtype_and_shape(dtype, shape=None, scope=None)` {#make_placeholder_from_dtype_and_shape} - -Create a tf.placeholder for the Graph Editor. - -Note that the correct graph scope must be set by the calling function. -The placeholder is named using the function placeholder_name (with no -tensor argument). - -##### Args: - - -* `dtype`: the tensor type. -* `shape`: the tensor shape (optional). -* `scope`: absolute scope within which to create the placeholder. None - means that the scope of t is preserved. "" means the root scope. - -##### Returns: - - A newly created tf.placeholder. - - -- - - - -### `tf.contrib.graph_editor.make_placeholder_from_tensor(t, scope=None)` {#make_placeholder_from_tensor} - -Create a `tf.placeholder` for the Graph Editor. - -Note that the correct graph scope must be set by the calling function. - -##### Args: - - -* `t`: a `tf.Tensor` whose name will be used to create the placeholder - (see function placeholder_name). -* `scope`: absolute scope within which to create the placeholder. None - means that the scope of `t` is preserved. `""` means the root scope. - -##### Returns: - - A newly created `tf.placeholder`. - -##### Raises: - - -* `TypeError`: if `t` is not `None` or a `tf.Tensor`. - - -- - - - -### `tf.contrib.graph_editor.make_regex(obj)` {#make_regex} - -Return a compiled regular expression. - -##### Args: - - -* `obj`: a string or a regular expression. - -##### Returns: - - A compiled regular expression. - -##### Raises: - - -* `ValueError`: if obj could not be converted to a regular expression. - - -- - - - -### `tf.contrib.graph_editor.make_view(*args, **kwargs)` {#make_view} - -Create a SubGraphView from selected operations and passthrough tensors. - -##### Args: - - -* `*args`: list of 1) regular expressions (compiled or not) or 2) (array of) - `tf.Operation` 3) (array of) `tf.Tensor`. Those objects will be converted - into a list of operations and a list of candidate for passthrough tensors. -* `**kwargs`: keyword graph is used 1) to check that the ops and ts are from - the correct graph 2) for regular expression query - -##### Returns: - - A subgraph view. - -##### Raises: - - -* `TypeError`: if the optional keyword argument graph is not a `tf.Graph` - or if an argument in args is not an (array of) `tf.Tensor` - or an (array of) `tf.Operation` or a string or a regular expression. -* `ValueError`: if one of the keyword arguments is unexpected. - - -- - - - -### `tf.contrib.graph_editor.make_view_from_scope(scope, graph)` {#make_view_from_scope} - -Make a subgraph from a name scope. - -##### Args: - - -* `scope`: the name of the scope. -* `graph`: the `tf.Graph`. - -##### Returns: - - A subgraph view representing the given scope. - - -- - - - -### `tf.contrib.graph_editor.op_type(op_types, op=None)` {#op_type} - -Check if an op is of the given type. - -##### Args: - - -* `op_types`: tuple of strings containing the types to check against. - For instance: ("Add", "Const") -* `op`: the operation to check (or None). - -##### Returns: - - if op is not None, return True if the op is of the correct type. - if op is None, return a lambda function which does the type checking. - - -- - - - -### `tf.contrib.graph_editor.ph(dtype, shape=None, scope=None)` {#ph} - -Create a tf.placeholder for the Graph Editor. - -Note that the correct graph scope must be set by the calling function. -The placeholder is named using the function placeholder_name (with no -tensor argument). - -##### Args: - - -* `dtype`: the tensor type. -* `shape`: the tensor shape (optional). -* `scope`: absolute scope within which to create the placeholder. None - means that the scope of t is preserved. "" means the root scope. - -##### Returns: - - A newly created tf.placeholder. - - -- - - - -### `tf.contrib.graph_editor.placeholder_name(t=None, scope=None)` {#placeholder_name} - -Create placeholder name for the graph editor. - -##### Args: - - -* `t`: optional tensor on which the placeholder operation's name will be based - on -* `scope`: absolute scope with which to prefix the placeholder's name. None - means that the scope of t is preserved. "" means the root scope. - -##### Returns: - - A new placeholder name prefixed by "geph". Note that "geph" stands for - Graph Editor PlaceHolder. This convention allows to quickly identify the - placeholder generated by the Graph Editor. - -##### Raises: - - -* `TypeError`: if t is not None or a tf.Tensor. - - -- - - - -### `tf.contrib.graph_editor.remove_control_inputs(op, cops)` {#remove_control_inputs} - -Remove the control inputs cops from co. - -Warning: this function is directly manipulating the internals of the -`tf.Graph`. - -##### Args: - - -* `op`: a `tf.Operation` from which to remove the control inputs. -* `cops`: an object convertible to a list of `tf.Operation`. - -##### Raises: - - -* `TypeError`: if op is not a `tf.Operation`. -* `ValueError`: if any cop in cops is not a control input of op. - - -- - - - -### `tf.contrib.graph_editor.replace_t_with_placeholder_handler(info, t)` {#replace_t_with_placeholder_handler} - -Transform a tensor into a placeholder tensor. - -This handler is typically used to transform a subgraph input tensor into a -placeholder. - -##### Args: - - -* `info`: Transform._TmpInfo instance. -* `t`: tensor whose input must be transformed into a place holder. - -##### Returns: - - The tensor generated by the newly created place holder. - - -- - - - -### `tf.contrib.graph_editor.reroute_inputs(sgv0, sgv1)` {#reroute_inputs} - -Re-route all the inputs of sgv0 to sgv1 (see reroute_inputs). - - -- - - - -### `tf.contrib.graph_editor.reroute_ios(sgv0, sgv1)` {#reroute_ios} - -Re-route the inputs and outputs of sgv0 to sgv1 (see _reroute). - - -- - - - -### `tf.contrib.graph_editor.reroute_outputs(sgv0, sgv1)` {#reroute_outputs} - -Re-route all the outputs of sgv0 to sgv1 (see _reroute_outputs). - - -- - - - -### `tf.contrib.graph_editor.reroute_ts(ts0, ts1, can_modify=None, cannot_modify=None)` {#reroute_ts} - -For each tensor's pair, replace the end of t1 by the end of t0. - -B0 B1 B0 B1 -| | => |/ -A0 A1 A0 A1 - -The end of the tensors in ts1 are left dangling. - -##### Args: - - -* `ts0`: an object convertible to a list of `tf.Tensor`. -* `ts1`: an object convertible to a list of `tf.Tensor`. -* `can_modify`: iterable of operations which can be modified. Any operation - outside within_ops will be left untouched by this function. -* `cannot_modify`: iterable of operations which cannot be modified. Any - operation within cannot_modify will be left untouched by this function. - -##### Returns: - - The number of individual modifications made by the function. - -##### Raises: - - -* `TypeError`: if ts0 or ts1 cannot be converted to a list of tf.Tensor. -* `TypeError`: if can_modify or cannot_modify is not None and cannot be - converted to a list of tf.Operation. - - -- - - - -### `tf.contrib.graph_editor.select_ops(*args, **kwargs)` {#select_ops} - -Helper to select operations. - -##### Args: - - -* `*args`: list of 1) regular expressions (compiled or not) or 2) (array of) - `tf.Operation`. `tf.Tensor` instances are silently ignored. -* `**kwargs`: 'graph': `tf.Graph` in which to perform the regex query.This is - required when using regex. - 'positive_filter': an elem if selected only if `positive_filter(elem)` is - `True`. This is optional. - 'restrict_ops_regex': a regular expression is ignored if it doesn't start - with the substring "(?#ops)". - -##### Returns: - - A list of `tf.Operation`. - -##### Raises: - - -* `TypeError`: if the optional keyword argument graph is not a `tf.Graph` - or if an argument in args is not an (array of) `tf.Operation` - or an (array of) `tf.Tensor` (silently ignored) or a string - or a regular expression. -* `ValueError`: if one of the keyword arguments is unexpected or if a regular - expression is used without passing a graph as a keyword argument. - - -- - - - -### `tf.contrib.graph_editor.select_ops_and_ts(*args, **kwargs)` {#select_ops_and_ts} - -Helper to select operations and tensors. - -##### Args: - - -* `*args`: list of 1) regular expressions (compiled or not) or 2) (array of) - `tf.Operation` 3) (array of) tf.Tensor. Regular expressions matching - tensors must start with the comment `"(?#ts)"`, for instance: - `"(?#ts)^foo/.*"`. -* `**kwargs`: 'graph': `tf.Graph` in which to perform the regex query.This is - required when using regex. - 'positive_filter': an elem if selected only if `positive_filter(elem)` is - `True`. This is optional. - -##### Returns: - - A tuple `(ops, ts)` where: - `ops` is a list of `tf.Operation`, and - `ts` is a list of `tf.Tensor` - -##### Raises: - - -* `TypeError`: if the optional keyword argument graph is not a `tf.Graph` - or if an argument in args is not an (array of) `tf.Tensor` - or an (array of) `tf.Operation` or a string or a regular expression. -* `ValueError`: if one of the keyword arguments is unexpected or if a regular - expression is used without passing a graph as a keyword argument. - - -- - - - -### `tf.contrib.graph_editor.select_ts(*args, **kwargs)` {#select_ts} - -Helper to select tensors. - -##### Args: - - -* `*args`: list of 1) regular expressions (compiled or not) or 2) (array of) - `tf.Tensor`. `tf.Operation` instances are silently ignored. -* `**kwargs`: 'graph': `tf.Graph` in which to perform the regex query.This is - required when using regex. - 'positive_filter': an elem if selected only if `positive_filter(elem)` is - `True`. This is optional. - 'restrict_ts_regex': a regular expression is ignored if it doesn't start - with the substring "(?#ts)". - -##### Returns: - - A list of `tf.Tensor`. - -##### Raises: - - -* `TypeError`: if the optional keyword argument graph is not a `tf.Graph` - or if an argument in args is not an (array of) `tf.Tensor` - or an (array of) `tf.Operation` (silently ignored) or a string - or a regular expression. -* `ValueError`: if one of the keyword arguments is unexpected or if a regular - expression is used without passing a graph as a keyword argument. - - -- - - - -### `tf.contrib.graph_editor.sgv(*args, **kwargs)` {#sgv} - -Create a SubGraphView from selected operations and passthrough tensors. - -##### Args: - - -* `*args`: list of 1) regular expressions (compiled or not) or 2) (array of) - `tf.Operation` 3) (array of) `tf.Tensor`. Those objects will be converted - into a list of operations and a list of candidate for passthrough tensors. -* `**kwargs`: keyword graph is used 1) to check that the ops and ts are from - the correct graph 2) for regular expression query - -##### Returns: - - A subgraph view. - -##### Raises: - - -* `TypeError`: if the optional keyword argument graph is not a `tf.Graph` - or if an argument in args is not an (array of) `tf.Tensor` - or an (array of) `tf.Operation` or a string or a regular expression. -* `ValueError`: if one of the keyword arguments is unexpected. - - -- - - - -### `tf.contrib.graph_editor.sgv_scope(scope, graph)` {#sgv_scope} - -Make a subgraph from a name scope. - -##### Args: - - -* `scope`: the name of the scope. -* `graph`: the `tf.Graph`. - -##### Returns: - - A subgraph view representing the given scope. - - -- - - - -### `tf.contrib.graph_editor.swap_inputs(sgv0, sgv1)` {#swap_inputs} - -Swap all the inputs of sgv0 and sgv1 (see reroute_inputs). - - -- - - - -### `tf.contrib.graph_editor.swap_ios(sgv0, sgv1)` {#swap_ios} - -Swap the inputs and outputs of sgv1 to sgv0 (see _reroute). - - -- - - - -### `tf.contrib.graph_editor.swap_outputs(sgv0, sgv1)` {#swap_outputs} - -Swap all the outputs of sgv0 and sgv1 (see _reroute_outputs). - - -- - - - -### `tf.contrib.graph_editor.swap_ts(ts0, ts1, can_modify=None, cannot_modify=None)` {#swap_ts} - -For each tensor's pair, swap the end of (t0,t1). - -B0 B1 B0 B1 -| | => X -A0 A1 A0 A1 - -##### Args: - - -* `ts0`: an object convertible to a list of `tf.Tensor`. -* `ts1`: an object convertible to a list of `tf.Tensor`. -* `can_modify`: iterable of operations which can be modified. Any operation - outside within_ops will be left untouched by this function. -* `cannot_modify`: iterable of operations which cannot be modified. - Any operation within cannot_modify will be left untouched by this - function. - -##### Returns: - - The number of individual modifications made by the function. - -##### Raises: - - -* `TypeError`: if ts0 or ts1 cannot be converted to a list of tf.Tensor. -* `TypeError`: if can_modify or cannot_modify is not None and cannot be - converted to a list of tf.Operation. - - -- - - - -### `tf.contrib.graph_editor.transform_op_if_inside_handler(info, op, keep_if_possible=True)` {#transform_op_if_inside_handler} - -Transform an optional op only if it is inside the subgraph. - -This handler is typically use to handle original op: it is fine to keep them -if they are inside the subgraph, otherwise they are just ignored. - -##### Args: - - -* `info`: Transform._TmpInfo instance. -* `op`: the optional op to transform (or ignore). -* `keep_if_possible`: re-attach to the original op if possible, that is, - if the source graph and the destination graph are the same. - -##### Returns: - - The transformed op or None. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.integrate.md b/tensorflow/g3doc/api_docs/python/contrib.integrate.md deleted file mode 100644 index 5a05662c1f..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.integrate.md +++ /dev/null @@ -1,100 +0,0 @@ - - -# Integrate (contrib) -[TOC] - -Integration and ODE solvers. See the @{$python/contrib.integrate} guide. - -- - - - -### `tf.contrib.integrate.odeint(func, y0, t, rtol=1e-06, atol=1e-12, method=None, options=None, full_output=False, name=None)` {#odeint} - -Integrate a system of ordinary differential equations. - -Solves the initial value problem for a non-stiff system of first order ode-s: - - ``` - dy/dt = func(y, t), y(t[0]) = y0 - ``` - -where y is a Tensor of any shape. - -For example: - - ``` - # solve `dy/dt = -y`, corresponding to exponential decay - tf.contrib.integrate.odeint(lambda y, _: -y, 1.0, [0, 1, 2]) - => [1, exp(-1), exp(-2)] - ``` - -Output dtypes and numerical precision are based on the dtypes of the inputs -`y0` and `t`. - -Currently, implements 5th order Runge-Kutta with adaptive step size control -and dense output, using the Dormand-Prince method. Similar to the 'dopri5' -method of `scipy.integrate.ode` and MATLAB's `ode45`. - -Based on: Shampine, Lawrence F. (1986), "Some Practical Runge-Kutta Formulas", -Mathematics of Computation, American Mathematical Society, 46 (173): 135-150, -doi:10.2307/2008219 - -##### Args: - - -* `func`: Function that maps a Tensor holding the state `y` and a scalar Tensor - `t` into a Tensor of state derivatives with respect to time. -* `y0`: N-D Tensor giving starting value of `y` at time point `t[0]`. May - have any floating point or complex dtype. -* `t`: 1-D Tensor holding a sequence of time points for which to solve for - `y`. The initial time point should be the first element of this sequence, - and each time must be larger than the previous time. May have any floating - point dtype. If not provided as a Tensor, converted to a Tensor with - float64 dtype. -* `rtol`: optional float64 Tensor specifying an upper bound on relative error, - per element of `y`. -* `atol`: optional float64 Tensor specifying an upper bound on absolute error, - per element of `y`. -* `method`: optional string indicating the integration method to use. Currently, - the only valid option is `'dopri5'`. -* `options`: optional dict of configuring options for the indicated integration - method. Can only be provided if a `method` is explicitly set. For - `'dopri5'`, valid options include: - * first_step: an initial guess for the size of the first integration - (current default: 1.0, but may later be changed to use heuristics based - on the gradient). - * safety: safety factor for adaptive step control, generally a constant - in the range 0.8-1 (default: 0.9). - * ifactor: maximum factor by which the adaptive step may be increased - (default: 10.0). - * dfactor: maximum factor by which the adpative step may be decreased - (default: 0.2). - * max_num_steps: integer maximum number of integrate steps between time - points in `t` (default: 1000). -* `full_output`: optional boolean. If True, `odeint` returns a tuple - `(y, info_dict)` describing the integration process. -* `name`: Optional name for this operation. - -##### Returns: - - -* `y`: (N+1)-D tensor, where the first dimension corresponds to different - time points. Contains the solved value of y for each desired time point in - `t`, with the initial value `y0` being the first element along the first - dimension. -* `info_dict`: only if `full_output == True`. A dict with the following values: - * num_func_evals: integer Tensor counting the number of function - evaluations. - * integrate_points: 1D float64 Tensor with the upper bound of each - integration time step. - * error_ratio: 1D float Tensor with the estimated ratio of the integration - error to the error tolerance at each integration step. An ratio greater - than 1 corresponds to rejected steps. - -##### Raises: - - -* `ValueError`: if an invalid `method` is provided. -* `TypeError`: if `options` is supplied without `method`, or if `t` or `y0` has - an invalid dtype. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.layers.md b/tensorflow/g3doc/api_docs/python/contrib.layers.md deleted file mode 100644 index 910cab1cc7..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.layers.md +++ /dev/null @@ -1,2340 +0,0 @@ - - -# Layers (contrib) -[TOC] - -Ops for building neural network layers, regularizers, summaries, etc. - -See the @{$python/contrib.layers} guide. - -- - - - -### `tf.contrib.layers.avg_pool2d(*args, **kwargs)` {#avg_pool2d} - -Adds a 2D average pooling op. - -It is assumed that the pooling is done per image but not in batch or channels. - -##### Args: - - -* `inputs`: A 4-D tensor of shape `[batch_size, height, width, channels]` if - `data_format` is `NHWC`, and `[batch_size, channels, height, width]` if - `data_format` is `NCHW`. -* `kernel_size`: A list of length 2: [kernel_height, kernel_width] of the - pooling kernel over which the op is computed. Can be an int if both - values are the same. -* `stride`: A list of length 2: [stride_height, stride_width]. - Can be an int if both strides are the same. Note that presently - both strides must have the same value. -* `padding`: The padding method, either 'VALID' or 'SAME'. -* `data_format`: A string. `NHWC` (default) and `NCHW` are supported. -* `outputs_collections`: The collections to which the outputs are added. -* `scope`: Optional scope for name_scope. - -##### Returns: - - A `Tensor` representing the results of the pooling operation. - -##### Raises: - - -* `ValueError`: If `data_format` is neither `NHWC` nor `NCHW`. - - -- - - - -### `tf.contrib.layers.batch_norm(*args, **kwargs)` {#batch_norm} - -Adds a Batch Normalization layer from http://arxiv.org/abs/1502.03167. - - "Batch Normalization: Accelerating Deep Network Training by Reducing - Internal Covariate Shift" - - Sergey Ioffe, Christian Szegedy - -Can be used as a normalizer function for conv2d and fully_connected. - -Note: When is_training is True the moving_mean and moving_variance need to be -updated, by default the update_ops are placed in `tf.GraphKeys.UPDATE_OPS` so -they need to be added as a dependency to the `train_op`, example: - - update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS) - if update_ops: - updates = tf.group(*update_ops) - total_loss = control_flow_ops.with_dependencies([updates], total_loss) - -One can set updates_collections=None to force the updates in place, but that -can have speed penalty, especially in distributed settings. - -##### Args: - - -* `inputs`: A tensor with 2 or more dimensions, where the first dimension has - `batch_size`. The normalization is over all but the last dimension if - `data_format` is `NHWC` and the second dimension if `data_format` is - `NCHW`. -* `decay`: Decay for the moving average. Reasonable values for `decay` are close - to 1.0, typically in the multiple-nines range: 0.999, 0.99, 0.9, etc. - Lower `decay` value (recommend trying `decay`=0.9) if model experiences - reasonably good training performance but poor validation and/or test - performance. Try zero_debias_moving_mean=True for improved stability. -* `center`: If True, add offset of `beta` to normalized tensor. If False, `beta` - is ignored. -* `scale`: If True, multiply by `gamma`. If False, `gamma` is - not used. When the next layer is linear (also e.g. `nn.relu`), this can be - disabled since the scaling can be done by the next layer. -* `epsilon`: Small float added to variance to avoid dividing by zero. -* `activation_fn`: Activation function, default set to None to skip it and - maintain a linear activation. -* `param_initializers`: Optional initializers for beta, gamma, moving mean and - moving variance. -* `updates_collections`: Collections to collect the update ops for computation. - The updates_ops need to be executed with the train_op. - If None, a control dependency would be added to make sure the updates are - computed in place. -* `is_training`: Whether or not the layer is in training mode. In training mode - it would accumulate the statistics of the moments into `moving_mean` and - `moving_variance` using an exponential moving average with the given - `decay`. When it is not in training mode then it would use the values of - the `moving_mean` and the `moving_variance`. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional collections for the variables. -* `outputs_collections`: Collections to add the outputs. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see `tf.Variable`). -* `batch_weights`: An optional tensor of shape `[batch_size]`, - containing a frequency weight for each batch item. If present, - then the batch normalization uses weighted mean and - variance. (This can be used to correct for bias in training - example selection.) -* `fused`: Use nn.fused_batch_norm if True, nn.batch_normalization otherwise. -* `data_format`: A string. `NHWC` (default) and `NCHW` are supported. -* `zero_debias_moving_mean`: Use zero_debias for moving_mean. It creates a new - pair of variables 'moving_mean/biased' and 'moving_mean/local_step'. -* `scope`: Optional scope for `variable_scope`. - -##### Returns: - - A `Tensor` representing the output of the operation. - -##### Raises: - - -* `ValueError`: If `batch_weights` is not None and `fused` is True. -* `ValueError`: If `data_format` is neither `NHWC` nor `NCHW`. -* `ValueError`: If the rank of `inputs` is undefined. -* `ValueError`: If rank or channels dimension of `inputs` is undefined. - - -- - - - -### `tf.contrib.layers.convolution2d(*args, **kwargs)` {#convolution2d} - -Adds an N-D convolution followed by an optional batch_norm layer. - -It is required that 1 <= N <= 3. - -`convolution` creates a variable called `weights`, representing the -convolutional kernel, that is convolved (actually cross-correlated) with the -`inputs` to produce a `Tensor` of activations. If a `normalizer_fn` is -provided (such as `batch_norm`), it is then applied. Otherwise, if -`normalizer_fn` is None and a `biases_initializer` is provided then a `biases` -variable would be created and added the activations. Finally, if -`activation_fn` is not `None`, it is applied to the activations as well. - -Performs a'trous convolution with input stride/dilation rate equal to `rate` -if a value > 1 for any dimension of `rate` is specified. In this case -`stride` values != 1 are not supported. - -##### Args: - - -* `inputs`: A Tensor of rank N+2 of shape - `[batch_size] + input_spatial_shape + [in_channels]` if data_format does - not start with "NC" (default), or - `[batch_size, in_channels] + input_spatial_shape` if data_format starts - with "NC". -* `num_outputs`: Integer, the number of output filters. -* `kernel_size`: A sequence of N positive integers specifying the spatial - dimensions of of the filters. Can be a single integer to specify the same - value for all spatial dimensions. -* `stride`: A sequence of N positive integers specifying the stride at which to - compute output. Can be a single integer to specify the same value for all - spatial dimensions. Specifying any `stride` value != 1 is incompatible - with specifying any `rate` value != 1. -* `padding`: One of `"VALID"` or `"SAME"`. -* `data_format`: A string or None. Specifies whether the channel dimension of - the `input` and output is the last dimension (default, or if `data_format` - does not start with "NC"), or the second dimension (if `data_format` - starts with "NC"). For N=1, the valid values are "NWC" (default) and - "NCW". For N=2, the valid values are "NHWC" (default) and "NCHW". For - N=3, currently the only valid value is "NDHWC". -* `rate`: A sequence of N positive integers specifying the dilation rate to use - for a'trous convolution. Can be a single integer to specify the same - value for all spatial dimensions. Specifying any `rate` value != 1 is - incompatible with specifying any `stride` value != 1. -* `activation_fn`: Activation function. The default value is a ReLU function. - Explicitly set it to None to skip it and maintain a linear activation. -* `normalizer_fn`: Normalization function to use instead of `biases`. If - `normalizer_fn` is provided then `biases_initializer` and - `biases_regularizer` are ignored and `biases` are not created nor added. - default set to None for no normalizer function -* `normalizer_params`: Normalization function parameters. -* `weights_initializer`: An initializer for the weights. -* `weights_regularizer`: Optional regularizer for the weights. -* `biases_initializer`: An initializer for the biases. If None skip biases. -* `biases_regularizer`: Optional regularizer for the biases. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional list of collections for all the variables or - a dictionary containing a different list of collection per variable. -* `outputs_collections`: Collection to add the outputs. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for `variable_scope`. - -##### Returns: - - A tensor representing the output of the operation. - -##### Raises: - - -* `ValueError`: If `data_format` is invalid. -* `ValueError`: Both 'rate' and `stride` are not uniformly 1. - - -- - - - -### `tf.contrib.layers.conv2d_in_plane(*args, **kwargs)` {#conv2d_in_plane} - -Performs the same in-plane convolution to each channel independently. - -This is useful for performing various simple channel-independent convolution -operations such as image gradients: - - image = tf.constant(..., shape=(16, 240, 320, 3)) - vert_gradients = layers.conv2d_in_plane(image, - kernel=[1, -1], - kernel_size=[2, 1]) - horz_gradients = layers.conv2d_in_plane(image, - kernel=[1, -1], - kernel_size=[1, 2]) - -##### Args: - - -* `inputs`: A 4-D tensor with dimensions [batch_size, height, width, channels]. -* `kernel_size`: A list of length 2 holding the [kernel_height, kernel_width] of - of the pooling. Can be an int if both values are the same. -* `stride`: A list of length 2 `[stride_height, stride_width]`. - Can be an int if both strides are the same. Note that presently - both strides must have the same value. -* `padding`: The padding type to use, either 'SAME' or 'VALID'. -* `activation_fn`: Activation function. The default value is a ReLU function. - Explicitly set it to None to skip it and maintain a linear activation. -* `normalizer_fn`: Normalization function to use instead of `biases`. If - `normalizer_fn` is provided then `biases_initializer` and - `biases_regularizer` are ignored and `biases` are not created nor added. - default set to None for no normalizer function -* `normalizer_params`: Normalization function parameters. -* `weights_initializer`: An initializer for the weights. -* `weights_regularizer`: Optional regularizer for the weights. -* `biases_initializer`: An initializer for the biases. If None skip biases. -* `biases_regularizer`: Optional regularizer for the biases. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional list of collections for all the variables or - a dictionary containing a different list of collection per variable. -* `outputs_collections`: Collection to add the outputs. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for `variable_scope`. - -##### Returns: - - A `Tensor` representing the output of the operation. - - -- - - - -### `tf.contrib.layers.convolution2d_in_plane(*args, **kwargs)` {#convolution2d_in_plane} - -Performs the same in-plane convolution to each channel independently. - -This is useful for performing various simple channel-independent convolution -operations such as image gradients: - - image = tf.constant(..., shape=(16, 240, 320, 3)) - vert_gradients = layers.conv2d_in_plane(image, - kernel=[1, -1], - kernel_size=[2, 1]) - horz_gradients = layers.conv2d_in_plane(image, - kernel=[1, -1], - kernel_size=[1, 2]) - -##### Args: - - -* `inputs`: A 4-D tensor with dimensions [batch_size, height, width, channels]. -* `kernel_size`: A list of length 2 holding the [kernel_height, kernel_width] of - of the pooling. Can be an int if both values are the same. -* `stride`: A list of length 2 `[stride_height, stride_width]`. - Can be an int if both strides are the same. Note that presently - both strides must have the same value. -* `padding`: The padding type to use, either 'SAME' or 'VALID'. -* `activation_fn`: Activation function. The default value is a ReLU function. - Explicitly set it to None to skip it and maintain a linear activation. -* `normalizer_fn`: Normalization function to use instead of `biases`. If - `normalizer_fn` is provided then `biases_initializer` and - `biases_regularizer` are ignored and `biases` are not created nor added. - default set to None for no normalizer function -* `normalizer_params`: Normalization function parameters. -* `weights_initializer`: An initializer for the weights. -* `weights_regularizer`: Optional regularizer for the weights. -* `biases_initializer`: An initializer for the biases. If None skip biases. -* `biases_regularizer`: Optional regularizer for the biases. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional list of collections for all the variables or - a dictionary containing a different list of collection per variable. -* `outputs_collections`: Collection to add the outputs. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for `variable_scope`. - -##### Returns: - - A `Tensor` representing the output of the operation. - - -- - - - -### `tf.nn.conv2d_transpose(value, filter, output_shape, strides, padding='SAME', data_format='NHWC', name=None)` {#conv2d_transpose} - -The transpose of `conv2d`. - -This operation is sometimes called "deconvolution" after [Deconvolutional -Networks](http://www.matthewzeiler.com/pubs/cvpr2010/cvpr2010.pdf), but is -actually the transpose (gradient) of `conv2d` rather than an actual -deconvolution. - -##### Args: - - -* `value`: A 4-D `Tensor` of type `float` and shape - `[batch, height, width, in_channels]` for `NHWC` data format or - `[batch, in_channels, height, width]` for `NCHW` data format. -* `filter`: A 4-D `Tensor` with the same type as `value` and shape - `[height, width, output_channels, in_channels]`. `filter`'s - `in_channels` dimension must match that of `value`. -* `output_shape`: A 1-D `Tensor` representing the output shape of the - deconvolution op. -* `strides`: A list of ints. The stride of the sliding window for each - dimension of the input tensor. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. - See the [comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `data_format`: A string. 'NHWC' and 'NCHW' are supported. -* `name`: Optional name for the returned tensor. - -##### Returns: - - A `Tensor` with the same type as `value`. - -##### Raises: - - -* `ValueError`: If input/output depth does not match `filter`'s shape, or if - padding is other than `'VALID'` or `'SAME'`. - - -- - - - -### `tf.contrib.layers.convolution2d_transpose(*args, **kwargs)` {#convolution2d_transpose} - -Adds a convolution2d_transpose with an optional batch normalization layer. - -The function creates a variable called `weights`, representing the -kernel, that is convolved with the input. If `batch_norm_params` is `None`, a -second variable called 'biases' is added to the result of the operation. - -##### Args: - - -* `inputs`: A 4-D `Tensor` of type `float` and shape - `[batch, height, width, in_channels]` for `NHWC` data format or - `[batch, in_channels, height, width]` for `NCHW` data format. -* `num_outputs`: Integer, the number of output filters. -* `kernel_size`: A list of length 2 holding the [kernel_height, kernel_width] of - of the filters. Can be an int if both values are the same. -* `stride`: A list of length 2: [stride_height, stride_width]. - Can be an int if both strides are the same. Note that presently - both strides must have the same value. -* `padding`: One of 'VALID' or 'SAME'. -* `data_format`: A string. `NHWC` (default) and `NCHW` are supported. -* `activation_fn`: Activation function. The default value is a ReLU function. - Explicitly set it to None to skip it and maintain a linear activation. -* `normalizer_fn`: Normalization function to use instead of `biases`. If - `normalizer_fn` is provided then `biases_initializer` and - `biases_regularizer` are ignored and `biases` are not created nor added. - default set to None for no normalizer function -* `normalizer_params`: Normalization function parameters. -* `weights_initializer`: An initializer for the weights. -* `weights_regularizer`: Optional regularizer for the weights. -* `biases_initializer`: An initializer for the biases. If None skip biases. -* `biases_regularizer`: Optional regularizer for the biases. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional list of collections for all the variables or - a dictionary containing a different list of collection per variable. -* `outputs_collections`: Collection to add the outputs. -* `trainable`: Whether or not the variables should be trainable or not. -* `scope`: Optional scope for variable_scope. - -##### Returns: - - A tensor representing the output of the operation. - -##### Raises: - - -* `ValueError`: If 'kernel_size' is not a list of length 2. -* `ValueError`: If `data_format` is neither `NHWC` nor `NCHW`. -* `ValueError`: If `C` dimension of `inputs` is None. - - -- - - - -### `tf.nn.dropout(x, keep_prob, noise_shape=None, seed=None, name=None)` {#dropout} - -Computes dropout. - -With probability `keep_prob`, outputs the input element scaled up by -`1 / keep_prob`, otherwise outputs `0`. The scaling is so that the expected -sum is unchanged. - -By default, each element is kept or dropped independently. If `noise_shape` -is specified, it must be -[broadcastable](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) -to the shape of `x`, and only dimensions with `noise_shape[i] == shape(x)[i]` -will make independent decisions. For example, if `shape(x) = [k, l, m, n]` -and `noise_shape = [k, 1, 1, n]`, each batch and channel component will be -kept independently and each row and column will be kept or not kept together. - -##### Args: - - -* `x`: A tensor. -* `keep_prob`: A scalar `Tensor` with the same type as x. The probability - that each element is kept. -* `noise_shape`: A 1-D `Tensor` of type `int32`, representing the - shape for randomly generated keep/drop flags. -* `seed`: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: A name for this operation (optional). - -##### Returns: - - A Tensor of the same shape of `x`. - -##### Raises: - - -* `ValueError`: If `keep_prob` is not in `(0, 1]`. - - -- - - - -### `tf.contrib.layers.flatten(*args, **kwargs)` {#flatten} - -Flattens the input while maintaining the batch_size. - - Assumes that the first dimension represents the batch. - -##### Args: - - -* `inputs`: A tensor of size [batch_size, ...]. -* `outputs_collections`: Collection to add the outputs. -* `scope`: Optional scope for name_scope. - -##### Returns: - - A flattened tensor with shape [batch_size, k]. - -##### Raises: - - -* `ValueError`: If inputs rank is unknown or less than 2. - - -- - - - -### `tf.contrib.layers.fully_connected(*args, **kwargs)` {#fully_connected} - -Adds a fully connected layer. - -`fully_connected` creates a variable called `weights`, representing a fully -connected weight matrix, which is multiplied by the `inputs` to produce a -`Tensor` of hidden units. If a `normalizer_fn` is provided (such as -`batch_norm`), it is then applied. Otherwise, if `normalizer_fn` is -None and a `biases_initializer` is provided then a `biases` variable would be -created and added the hidden units. Finally, if `activation_fn` is not `None`, -it is applied to the hidden units as well. - -Note: that if `inputs` have a rank greater than 2, then `inputs` is flattened -prior to the initial matrix multiply by `weights`. - -##### Args: - - -* `inputs`: A tensor of at least rank 2 and static value for the last dimension; - i.e. `[batch_size, depth]`, `[None, None, None, channels]`. -* `num_outputs`: Integer or long, the number of output units in the layer. -* `activation_fn`: Activation function. The default value is a ReLU function. - Explicitly set it to None to skip it and maintain a linear activation. -* `normalizer_fn`: Normalization function to use instead of `biases`. If - `normalizer_fn` is provided then `biases_initializer` and - `biases_regularizer` are ignored and `biases` are not created nor added. - default set to None for no normalizer function -* `normalizer_params`: Normalization function parameters. -* `weights_initializer`: An initializer for the weights. -* `weights_regularizer`: Optional regularizer for the weights. -* `biases_initializer`: An initializer for the biases. If None skip biases. -* `biases_regularizer`: Optional regularizer for the biases. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional list of collections for all the variables or - a dictionary containing a different list of collections per variable. -* `outputs_collections`: Collection to add the outputs. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for variable_scope. - -##### Returns: - - The tensor variable representing the result of the series of operations. - -##### Raises: - - -* `ValueError`: If x has rank less than 2 or if its last dimension is not set. - - -- - - - -### `tf.contrib.layers.layer_norm(*args, **kwargs)` {#layer_norm} - -Adds a Layer Normalization layer from https://arxiv.org/abs/1607.06450. - - "Layer Normalization" - - Jimmy Lei Ba, Jamie Ryan Kiros, Geoffrey E. Hinton - -Can be used as a normalizer function for conv2d and fully_connected. - -##### Args: - - -* `inputs`: A tensor with 2 or more dimensions. The normalization - occurs over all but the first dimension. -* `center`: If True, add offset of `beta` to normalized tensor. If False, `beta` - is ignored. -* `scale`: If True, multiply by `gamma`. If False, `gamma` is - not used. When the next layer is linear (also e.g. `nn.relu`), this can be - disabled since the scaling can be done by the next layer. -* `activation_fn`: Activation function, default set to None to skip it and - maintain a linear activation. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional collections for the variables. -* `outputs_collections`: Collections to add the outputs. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for `variable_scope`. - -##### Returns: - - A `Tensor` representing the output of the operation. - -##### Raises: - - -* `ValueError`: If rank or last dimension of `inputs` is undefined. - - -- - - - -### `tf.contrib.layers.linear()` {#linear} - -partial(func, *args, **keywords) - new function with partial application -of the given arguments and keywords. - - -- - - - -### `tf.contrib.layers.max_pool2d(*args, **kwargs)` {#max_pool2d} - -Adds a 2D Max Pooling op. - -It is assumed that the pooling is done per image but not in batch or channels. - -##### Args: - - -* `inputs`: A 4-D tensor of shape `[batch_size, height, width, channels]` if - `data_format` is `NHWC`, and `[batch_size, channels, height, width]` if - `data_format` is `NCHW`. -* `kernel_size`: A list of length 2: [kernel_height, kernel_width] of the - pooling kernel over which the op is computed. Can be an int if both - values are the same. -* `stride`: A list of length 2: [stride_height, stride_width]. - Can be an int if both strides are the same. Note that presently - both strides must have the same value. -* `padding`: The padding method, either 'VALID' or 'SAME'. -* `data_format`: A string. `NHWC` (default) and `NCHW` are supported. -* `outputs_collections`: The collections to which the outputs are added. -* `scope`: Optional scope for name_scope. - -##### Returns: - - A `Tensor` representing the results of the pooling operation. - -##### Raises: - - -* `ValueError`: If `data_format` is neither `NHWC` nor `NCHW`. -* `ValueError`: If 'kernel_size' is not a 2-D list - - -- - - - -### `tf.contrib.layers.one_hot_encoding(*args, **kwargs)` {#one_hot_encoding} - -Transform numeric labels into onehot_labels using `tf.one_hot`. - -##### Args: - - -* `labels`: [batch_size] target labels. -* `num_classes`: Total number of classes. -* `on_value`: A scalar defining the on-value. -* `off_value`: A scalar defining the off-value. -* `outputs_collections`: Collection to add the outputs. -* `scope`: Optional scope for name_scope. - -##### Returns: - - One-hot encoding of the labels. - - -- - - - -### `tf.nn.relu(features, name=None)` {#relu} - -Computes rectified linear: `max(features, 0)`. - -##### Args: - - -* `features`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `features`. - - -- - - - -### `tf.nn.relu6(features, name=None)` {#relu6} - -Computes Rectified Linear 6: `min(max(features, 0), 6)`. - -##### Args: - - -* `features`: A `Tensor` with type `float`, `double`, `int32`, `int64`, `uint8`, - `int16`, or `int8`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` with the same type as `features`. - - -- - - - -### `tf.contrib.layers.repeat(inputs, repetitions, layer, *args, **kwargs)` {#repeat} - -Applies the same layer with the same arguments repeatedly. - -```python - y = repeat(x, 3, conv2d, 64, [3, 3], scope='conv1') - # It is equivalent to: - - x = conv2d(x, 64, [3, 3], scope='conv1/conv1_1') - x = conv2d(x, 64, [3, 3], scope='conv1/conv1_2') - y = conv2d(x, 64, [3, 3], scope='conv1/conv1_3') -``` - -If the `scope` argument is not given in `kwargs`, it is set to -`layer.__name__`, or `layer.func.__name__` (for `functools.partial` -objects). If neither `__name__` nor `func.__name__` is available, the -layers are called with `scope='stack'`. - -##### Args: - - -* `inputs`: A `Tensor` suitable for layer. -* `repetitions`: Int, number of repetitions. -* `layer`: A layer with arguments `(inputs, *args, **kwargs)` -* `*args`: Extra args for the layer. -* `**kwargs`: Extra kwargs for the layer. - -##### Returns: - - A tensor result of applying the layer, repetitions times. - -##### Raises: - - -* `ValueError`: If the op is unknown or wrong. - - -- - - - -### `tf.contrib.layers.safe_embedding_lookup_sparse(embedding_weights, sparse_ids, sparse_weights=None, combiner=None, default_id=None, name=None, partition_strategy='div', max_norm=None)` {#safe_embedding_lookup_sparse} - -Lookup embedding results, accounting for invalid IDs and empty features. - -The partitioned embedding in `embedding_weights` must all be the same shape -except for the first dimension. The first dimension is allowed to vary as the -vocabulary size is not necessarily a multiple of `P`. `embedding_weights` -may be a `PartitionedVariable` as returned by using `tf.get_variable()` with a -partitioner. - -Invalid IDs (< 0) are pruned from input IDs and weights, as well as any IDs -with non-positive weight. For an entry with no features, the embedding vector -for `default_id` is returned, or the 0-vector if `default_id` is not supplied. - -The ids and weights may be multi-dimensional. Embeddings are always aggregated -along the last dimension. - -##### Args: - - -* `embedding_weights`: A list of `P` float tensors or values representing - partitioned embedding tensors. Alternatively, a `PartitionedVariable`, - created by partitioning along dimension 0. The total unpartitioned - shape should be `[e_0, e_1, ..., e_m]`, where `e_0` represents the - vocab size and `e_1, ..., e_m` are the embedding dimensions. -* `sparse_ids`: `SparseTensor` of shape `[d_0, d_1, ..., d_n]` containing the - ids. `d_0` is typically batch size. -* `sparse_weights`: `SparseTensor` of same shape as `sparse_ids`, containing - float weights corresponding to `sparse_ids`, or `None` if all weights - are be assumed to be 1.0. -* `combiner`: A string specifying how to combine embedding results for each - entry. Currently "mean", "sqrtn" and "sum" are supported, with "mean" - the default. -* `default_id`: The id to use for an entry with no features. -* `name`: A name for this operation (optional). -* `partition_strategy`: A string specifying the partitioning strategy. - Currently `"div"` and `"mod"` are supported. Default is `"div"`. -* `max_norm`: If not None, all embeddings are l2-normalized to max_norm before - combining. - - -##### Returns: - - Dense tensor of shape `[d_0, d_1, ..., d_{n-1}, e_1, ..., e_m]`. - -##### Raises: - - -* `ValueError`: if `embedding_weights` is empty. - - -- - - - -### `tf.nn.separable_conv2d(input, depthwise_filter, pointwise_filter, strides, padding, rate=None, name=None)` {#separable_conv2d} - -2-D convolution with separable filters. - -Performs a depthwise convolution that acts separately on channels followed by -a pointwise convolution that mixes channels. Note that this is separability -between dimensions `[1, 2]` and `3`, not spatial separability between -dimensions `1` and `2`. - -In detail, - - output[b, i, j, k] = sum_{di, dj, q, r] - input[b, strides[1] * i + di, strides[2] * j + dj, q] * - depthwise_filter[di, dj, q, r] * - pointwise_filter[0, 0, q * channel_multiplier + r, k] - -`strides` controls the strides for the depthwise convolution only, since -the pointwise convolution has implicit strides of `[1, 1, 1, 1]`. Must have -`strides[0] = strides[3] = 1`. For the most common case of the same -horizontal and vertical strides, `strides = [1, stride, stride, 1]`. -If any value in `rate` is greater than 1, we perform atrous depthwise -convolution, in which case all values in the `strides` tensor must be equal -to 1. - -##### Args: - - -* `input`: 4-D `Tensor` with shape `[batch, in_height, in_width, in_channels]`. -* `depthwise_filter`: 4-D `Tensor` with shape - `[filter_height, filter_width, in_channels, channel_multiplier]`. - Contains `in_channels` convolutional filters of depth 1. -* `pointwise_filter`: 4-D `Tensor` with shape - `[1, 1, channel_multiplier * in_channels, out_channels]`. Pointwise - filter to mix channels after `depthwise_filter` has convolved spatially. -* `strides`: 1-D of size 4. The strides for the depthwise convolution for - each dimension of `input`. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. - See the [comment - here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `rate`: 1-D of size 2. The dilation rate in which we sample input values - across the `height` and `width` dimensions in atrous convolution. If it is - greater than 1, then all values of strides must be 1. -* `name`: A name for this operation (optional). - -##### Returns: - - A 4-D `Tensor` of shape `[batch, out_height, out_width, out_channels]`. - -##### Raises: - - -* `ValueError`: If channel_multiplier * in_channels > out_channels, - which means that the separable convolution is overparameterized. - - -- - - - -### `tf.contrib.layers.separable_convolution2d(*args, **kwargs)` {#separable_convolution2d} - -Adds a depth-separable 2D convolution with optional batch_norm layer. - -This op first performs a depthwise convolution that acts separately on -channels, creating a variable called `depthwise_weights`. If `num_outputs` -is not None, it adds a pointwise convolution that mixes channels, creating a -variable called `pointwise_weights`. Then, if `batch_norm_params` is None, -it adds bias to the result, creating a variable called 'biases', otherwise -it adds a batch normalization layer. It finally applies an activation function -to produce the end result. - -##### Args: - - -* `inputs`: A tensor of size [batch_size, height, width, channels]. -* `num_outputs`: The number of pointwise convolution output filters. If is - None, then we skip the pointwise convolution stage. -* `kernel_size`: A list of length 2: [kernel_height, kernel_width] of - of the filters. Can be an int if both values are the same. -* `depth_multiplier`: The number of depthwise convolution output channels for - each input channel. The total number of depthwise convolution output - channels will be equal to `num_filters_in * depth_multiplier`. -* `stride`: A list of length 2: [stride_height, stride_width], specifying the - depthwise convolution stride. Can be an int if both strides are the same. -* `padding`: One of 'VALID' or 'SAME'. -* `rate`: A list of length 2: [rate_height, rate_width], specifying the dilation - rates for a'trous convolution. Can be an int if both rates are the same. - If any value is larger than one, then both stride values need to be one. -* `activation_fn`: Activation function. The default value is a ReLU function. - Explicitly set it to None to skip it and maintain a linear activation. -* `normalizer_fn`: Normalization function to use instead of `biases`. If - `normalizer_fn` is provided then `biases_initializer` and - `biases_regularizer` are ignored and `biases` are not created nor added. - default set to None for no normalizer function -* `normalizer_params`: Normalization function parameters. -* `weights_initializer`: An initializer for the weights. -* `weights_regularizer`: Optional regularizer for the weights. -* `biases_initializer`: An initializer for the biases. If None skip biases. -* `biases_regularizer`: Optional regularizer for the biases. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional list of collections for all the variables or - a dictionay containing a different list of collection per variable. -* `outputs_collections`: Collection to add the outputs. -* `trainable`: Whether or not the variables should be trainable or not. -* `scope`: Optional scope for variable_scope. - -##### Returns: - - A `Tensor` representing the output of the operation. - - -- - - - -### `tf.nn.softmax(logits, dim=-1, name=None)` {#softmax} - -Computes softmax activations. - -For each batch `i` and class `j` we have - - softmax = exp(logits) / reduce_sum(exp(logits), dim) - -##### Args: - - -* `logits`: A non-empty `Tensor`. Must be one of the following types: `half`, - `float32`, `float64`. -* `dim`: The dimension softmax would be performed on. The default is -1 which - indicates the last dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `logits`. Same shape as `logits`. - -##### Raises: - - -* `InvalidArgumentError`: if `logits` is empty or `dim` is beyond the last - dimension of `logits`. - - -- - - - -### `tf.stack(values, axis=0, name='stack')` {#stack} - -Stacks a list of rank-`R` tensors into one rank-`(R+1)` tensor. - -Packs the list of tensors in `values` into a tensor with rank one higher than -each tensor in `values`, by packing them along the `axis` dimension. -Given a list of length `N` of tensors of shape `(A, B, C)`; - -if `axis == 0` then the `output` tensor will have the shape `(N, A, B, C)`. -if `axis == 1` then the `output` tensor will have the shape `(A, N, B, C)`. -Etc. - -For example: - -```prettyprint -# 'x' is [1, 4] -# 'y' is [2, 5] -# 'z' is [3, 6] -stack([x, y, z]) => [[1, 4], [2, 5], [3, 6]] # Pack along first dim. -stack([x, y, z], axis=1) => [[1, 2, 3], [4, 5, 6]] -``` - -This is the opposite of unstack. The numpy equivalent is - - tf.stack([x, y, z]) = np.asarray([x, y, z]) - -##### Args: - - -* `values`: A list of `Tensor` objects with the same shape and type. -* `axis`: An `int`. The axis to stack along. Defaults to the first dimension. - Supports negative indexes. -* `name`: A name for this operation (optional). - -##### Returns: - - -* `output`: A stacked `Tensor` with the same type as `values`. - -##### Raises: - - -* `ValueError`: If `axis` is out of the range [-(R+1), R+1). - - -- - - - -### `tf.contrib.layers.unit_norm(*args, **kwargs)` {#unit_norm} - -Normalizes the given input across the specified dimension to unit length. - -Note that the rank of `input` must be known. - -##### Args: - - -* `inputs`: A `Tensor` of arbitrary size. -* `dim`: The dimension along which the input is normalized. -* `epsilon`: A small value to add to the inputs to avoid dividing by zero. -* `scope`: Optional scope for variable_scope. - -##### Returns: - - The normalized `Tensor`. - -##### Raises: - - -* `ValueError`: If dim is smaller than the number of dimensions in 'inputs'. - - -- - - - -### `tf.contrib.layers.embed_sequence(ids, vocab_size=None, embed_dim=None, unique=False, initializer=None, regularizer=None, trainable=True, scope=None, reuse=None)` {#embed_sequence} - -Maps a sequence of symbols to a sequence of embeddings. - -Typical use case would be reusing embeddings between an encoder and decoder. - -##### Args: - - -* `ids`: `[batch_size, doc_length]` `Tensor` of type `int32` or `int64` - with symbol ids. -* `vocab_size`: Integer number of symbols in vocabulary. -* `embed_dim`: Integer number of dimensions for embedding matrix. -* `unique`: If `True`, will first compute the unique set of indices, and then - lookup each embedding once, repeating them in the output as needed. -* `initializer`: An initializer for the embeddings, if `None` default for - current scope is used. -* `regularizer`: Optional regularizer for the embeddings. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see `tf.Variable`). -* `scope`: Optional string specifying the variable scope for the op, required - if `reuse=True`. -* `reuse`: If `True`, variables inside the op will be reused. - -##### Returns: - - `Tensor` of `[batch_size, doc_length, embed_dim]` with embedded sequences. - -##### Raises: - - -* `ValueError`: if `embed_dim` or `vocab_size` are not specified when not - `reuse` is `None` or `False`. - - - -- - - - -### `tf.contrib.layers.apply_regularization(regularizer, weights_list=None)` {#apply_regularization} - -Returns the summed penalty by applying `regularizer` to the `weights_list`. - -Adding a regularization penalty over the layer weights and embedding weights -can help prevent overfitting the training data. Regularization over layer -biases is less common/useful, but assuming proper data preprocessing/mean -subtraction, it usually shouldn't hurt much either. - -##### Args: - - -* `regularizer`: A function that takes a single `Tensor` argument and returns - a scalar `Tensor` output. -* `weights_list`: List of weights `Tensors` or `Variables` to apply - `regularizer` over. Defaults to the `GraphKeys.WEIGHTS` collection if - `None`. - -##### Returns: - - A scalar representing the overall regularization penalty. - -##### Raises: - - -* `ValueError`: If `regularizer` does not return a scalar output, or if we find - no weights. - - -- - - - -### `tf.contrib.layers.l1_regularizer(scale, scope=None)` {#l1_regularizer} - -Returns a function that can be used to apply L1 regularization to weights. - -L1 regularization encourages sparsity. - -##### Args: - - -* `scale`: A scalar multiplier `Tensor`. 0.0 disables the regularizer. -* `scope`: An optional scope name. - -##### Returns: - - A function with signature `l1(weights)` that apply L1 regularization. - -##### Raises: - - -* `ValueError`: If scale is negative or if scale is not a float. - - -- - - - -### `tf.contrib.layers.l2_regularizer(scale, scope=None)` {#l2_regularizer} - -Returns a function that can be used to apply L2 regularization to weights. - -Small values of L2 can help prevent overfitting the training data. - -##### Args: - - -* `scale`: A scalar multiplier `Tensor`. 0.0 disables the regularizer. -* `scope`: An optional scope name. - -##### Returns: - - A function with signature `l2(weights)` that applies L2 regularization. - -##### Raises: - - -* `ValueError`: If scale is negative or if scale is not a float. - - -- - - - -### `tf.contrib.layers.sum_regularizer(regularizer_list, scope=None)` {#sum_regularizer} - -Returns a function that applies the sum of multiple regularizers. - -##### Args: - - -* `regularizer_list`: A list of regularizers to apply. -* `scope`: An optional scope name - -##### Returns: - - A function with signature `sum_reg(weights)` that applies the - sum of all the input regularizers. - - - -- - - - -### `tf.contrib.layers.xavier_initializer(uniform=True, seed=None, dtype=tf.float32)` {#xavier_initializer} - -Returns an initializer performing "Xavier" initialization for weights. - -This function implements the weight initialization from: - -Xavier Glorot and Yoshua Bengio (2010): - Understanding the difficulty of training deep feedforward neural - networks. International conference on artificial intelligence and - statistics. - -This initializer is designed to keep the scale of the gradients roughly the -same in all layers. In uniform distribution this ends up being the range: -`x = sqrt(6. / (in + out)); [-x, x]` and for normal distribution a standard -deviation of `sqrt(3. / (in + out))` is used. - -##### Args: - - -* `uniform`: Whether to use uniform or normal distributed random initialization. -* `seed`: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `dtype`: The data type. Only floating point types are supported. - -##### Returns: - - An initializer for a weight matrix. - - -- - - - -### `tf.contrib.layers.xavier_initializer_conv2d(uniform=True, seed=None, dtype=tf.float32)` {#xavier_initializer_conv2d} - -Returns an initializer performing "Xavier" initialization for weights. - -This function implements the weight initialization from: - -Xavier Glorot and Yoshua Bengio (2010): - Understanding the difficulty of training deep feedforward neural - networks. International conference on artificial intelligence and - statistics. - -This initializer is designed to keep the scale of the gradients roughly the -same in all layers. In uniform distribution this ends up being the range: -`x = sqrt(6. / (in + out)); [-x, x]` and for normal distribution a standard -deviation of `sqrt(3. / (in + out))` is used. - -##### Args: - - -* `uniform`: Whether to use uniform or normal distributed random initialization. -* `seed`: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `dtype`: The data type. Only floating point types are supported. - -##### Returns: - - An initializer for a weight matrix. - - -- - - - -### `tf.contrib.layers.variance_scaling_initializer(factor=2.0, mode='FAN_IN', uniform=False, seed=None, dtype=tf.float32)` {#variance_scaling_initializer} - -Returns an initializer that generates tensors without scaling variance. - -When initializing a deep network, it is in principle advantageous to keep -the scale of the input variance constant, so it does not explode or diminish -by reaching the final layer. This initializer use the following formula: - -```python - if mode='FAN_IN': # Count only number of input connections. - n = fan_in - elif mode='FAN_OUT': # Count only number of output connections. - n = fan_out - elif mode='FAN_AVG': # Average number of inputs and output connections. - n = (fan_in + fan_out)/2.0 - - truncated_normal(shape, 0.0, stddev=sqrt(factor / n)) -``` - -* To get [Delving Deep into Rectifiers]( - http://arxiv.org/pdf/1502.01852v1.pdf), use (Default):
- `factor=2.0 mode='FAN_IN' uniform=False` -* To get [Convolutional Architecture for Fast Feature Embedding]( - http://arxiv.org/abs/1408.5093), use:
- `factor=1.0 mode='FAN_IN' uniform=True` -* To get [Understanding the difficulty of training deep feedforward neural - networks](http://jmlr.org/proceedings/papers/v9/glorot10a/glorot10a.pdf), - use:
- `factor=1.0 mode='FAN_AVG' uniform=True.` -* To get `xavier_initializer` use either:
- `factor=1.0 mode='FAN_AVG' uniform=True`, or
- `factor=1.0 mode='FAN_AVG' uniform=False`. - -##### Args: - - -* `factor`: Float. A multiplicative factor. -* `mode`: String. 'FAN_IN', 'FAN_OUT', 'FAN_AVG'. -* `uniform`: Whether to use uniform or normal distributed random initialization. -* `seed`: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `dtype`: The data type. Only floating point types are supported. - -##### Returns: - - An initializer that generates tensors with unit variance. - -##### Raises: - - -* `ValueError`: if `dtype` is not a floating point type. -* `TypeError`: if `mode` is not in ['FAN_IN', 'FAN_OUT', 'FAN_AVG']. - - - -- - - - -### `tf.contrib.layers.optimize_loss(loss, global_step, learning_rate, optimizer, gradient_noise_scale=None, gradient_multipliers=None, clip_gradients=None, learning_rate_decay_fn=None, update_ops=None, variables=None, name=None, summaries=None, colocate_gradients_with_ops=False)` {#optimize_loss} - -Given loss and parameters for optimizer, returns a training op. - -Various ways of passing optimizers, include: - -- string, name of the optimizer like 'SGD', 'Adam', see OPTIMIZER_CLS_NAMES - for full list. E.g. `optimize_loss(..., optimizer='Adam')`. -- function, takes learning rate `Tensor` as argument and must return - `Optimizer` instance. E.g. `optimize_loss(..., - optimizer=lambda lr: tf.train.MomentumOptimizer(lr, momentum=0.5))`. - Alternatively, if `learning_rate` is `None`, the function takes no - arguments. E.g. `optimize_loss(..., learning_rate=None, - optimizer=lambda: tf.train.MomentumOptimizer(0.5, momentum=0.5))`. -- class, subclass of `Optimizer` that takes only one required argument - - learning rate, such as AdamOptimizer, AdagradOptimizer. - E.g. `optimize_loss(..., optimizer=tf.train.AdagradOptimizer)`. -- object, instance of subclass of `Optimizer`. - E.g., `optimizer_loss(..., optimizer=tf.train.AdagradOptimizer(0.5))`. - -##### Args: - - -* `loss`: Scalar `Tensor`. -* `global_step`: Scalar int `Tensor`, step counter for each update. If not - supplied, it will be fetched from the default graph (see - `tf.contrib.framework.get_global_step` for details). If it's - not been created, no step will be incremented with each weight - update. `learning_rate_decay_fn` requires `global_step`. -* `learning_rate`: float or `Tensor`, magnitude of update per each training - step. Can be `None`. -* `optimizer`: string, class or optimizer instance, used as trainer. - string should be name of optimizer, like 'SGD', - 'Adam', 'Adagrad'. Full list in OPTIMIZER_CLS_NAMES constant. - class should be sub-class of `tf.Optimizer` that implements - `compute_gradients` and `apply_gradients` functions. - optimizer instance should be instantiation of `tf.Optimizer` - sub-class and have `compute_gradients` and `apply_gradients` - functions. -* `gradient_noise_scale`: float or None, adds 0-mean normal noise scaled by this - value. -* `gradient_multipliers`: dict of variables or variable names to floats. - If present, gradients for specified - variables will be multiplied by given constant. -* `clip_gradients`: float, callable or `None`. If float, is provided, a global - clipping is applied to prevent the norm of the gradient to exceed this - value. Alternatively, a callable can be provided e.g.: adaptive_clipping. - This callable takes a `list` of `(gradients, variables)` `tuple`s and - returns the same thing with the gradients modified. -* `learning_rate_decay_fn`: function, takes `learning_rate` and `global_step` - `Tensor`s, returns `Tensor`. - Can be used to implement any learning rate decay - functions. - For example: `tf.train.exponential_decay`. - Ignored if `learning_rate` is not supplied. -* `update_ops`: list of update `Operation`s to execute at each step. If `None`, - uses elements of UPDATE_OPS collection. The order of execution - between `update_ops` and `loss` is non-deterministic. -* `variables`: list of variables to optimize or - `None` to use all trainable variables. -* `name`: The name for this operation is used to scope operations and summaries. -* `summaries`: List of internal quantities to visualize on tensorboard. If not - set only the loss and the learning rate will be reported. The - complete list is in OPTIMIZER_SUMMARIES. -* `colocate_gradients_with_ops`: If True, try colocating gradients with the - corresponding op. - -##### Returns: - - Training op. - -##### Raises: - - -* `ValueError`: if: - * `loss` is an invalid type or shape. - * `global_step` is an invalid type or shape. - * `learning_rate` is an invalid type or value. - * `optimizer` is wrong type. - * `clip_gradients` is not float or callable. - * `learning_rate` and `learning_rate_decay_fn` are supplied, but no - `global_step` is available. - - - -- - - - -### `tf.contrib.layers.summarize_activation(op)` {#summarize_activation} - -Summarize an activation. - -This applies the given activation and adds useful summaries specific to the -activation. - -##### Args: - - -* `op`: The tensor to summarize (assumed to be a layer activation). - -##### Returns: - - The summary op created to summarize `op`. - - -- - - - -### `tf.contrib.layers.summarize_tensor(tensor, tag=None)` {#summarize_tensor} - -Summarize a tensor using a suitable summary type. - -This function adds a summary op for `tensor`. The type of summary depends on -the shape of `tensor`. For scalars, a `scalar_summary` is created, for all -other tensors, `histogram_summary` is used. - -##### Args: - - -* `tensor`: The tensor to summarize -* `tag`: The tag to use, if None then use tensor's op's name. - -##### Returns: - - The summary op created or None for string tensors. - - -- - - - -### `tf.contrib.layers.summarize_tensors(tensors, summarizer=summarize_tensor)` {#summarize_tensors} - -Summarize a set of tensors. - - -- - - - -### `tf.contrib.layers.summarize_collection(collection, name_filter=None, summarizer=summarize_tensor)` {#summarize_collection} - -Summarize a graph collection of tensors, possibly filtered by name. - - - -- - - - -### `tf.contrib.layers.summarize_activations(name_filter=None, summarizer=summarize_activation)` {#summarize_activations} - -Summarize activations, using `summarize_activation` to summarize. - - - -- - - - -### `tf.contrib.layers.bucketized_column(source_column, boundaries)` {#bucketized_column} - -Creates a _BucketizedColumn for discretizing dense input. - -##### Args: - - -* `source_column`: A _RealValuedColumn defining dense column. -* `boundaries`: A list of floats specifying the boundaries. It has to be sorted. - -##### Returns: - - A _BucketizedColumn. - -##### Raises: - - -* `ValueError`: if 'boundaries' is empty or not sorted. - - -- - - - -### `tf.contrib.layers.check_feature_columns(feature_columns)` {#check_feature_columns} - -Checks the validity of the set of FeatureColumns. - -##### Args: - - -* `feature_columns`: An iterable of instances or subclasses of FeatureColumn. - -##### Raises: - - -* `ValueError`: If `feature_columns` is a dict. -* `ValueError`: If there are duplicate feature column keys. - - -- - - - -### `tf.contrib.layers.create_feature_spec_for_parsing(feature_columns)` {#create_feature_spec_for_parsing} - -Helper that prepares features config from input feature_columns. - -The returned feature config can be used as arg 'features' in tf.parse_example. - -Typical usage example: - -```python -# Define features and transformations -feature_a = sparse_column_with_vocabulary_file(...) -feature_b = real_valued_column(...) -feature_c_bucketized = bucketized_column(real_valued_column("feature_c"), ...) -feature_a_x_feature_c = crossed_column( - columns=[feature_a, feature_c_bucketized], ...) - -feature_columns = set( - [feature_b, feature_c_bucketized, feature_a_x_feature_c]) -batch_examples = tf.parse_example( - serialized=serialized_examples, - features=create_feature_spec_for_parsing(feature_columns)) -``` - -For the above example, create_feature_spec_for_parsing would return the dict: -{ - "feature_a": parsing_ops.VarLenFeature(tf.string), - "feature_b": parsing_ops.FixedLenFeature([1], dtype=tf.float32), - "feature_c": parsing_ops.FixedLenFeature([1], dtype=tf.float32) -} - -##### Args: - - -* `feature_columns`: An iterable containing all the feature columns. All items - should be instances of classes derived from _FeatureColumn, unless - feature_columns is a dict -- in which case, this should be true of all - values in the dict. - -##### Returns: - - A dict mapping feature keys to FixedLenFeature or VarLenFeature values. - - -- - - - -### `tf.contrib.layers.crossed_column(columns, hash_bucket_size, combiner='sum', ckpt_to_load_from=None, tensor_name_in_ckpt=None, hash_key=None)` {#crossed_column} - -Creates a _CrossedColumn for performing feature crosses. - -##### Args: - - -* `columns`: An iterable of _FeatureColumn. Items can be an instance of - _SparseColumn, _CrossedColumn, or _BucketizedColumn. -* `hash_bucket_size`: An int that is > 1. The number of buckets. -* `combiner`: A string specifying how to reduce if there are multiple entries - in a single row. Currently "mean", "sqrtn" and "sum" are supported, with - "sum" the default. "sqrtn" often achieves good accuracy, in particular - with bag-of-words columns. Each of this can be thought as example level - normalizations on the column:: - * "sum": do not normalize - * "mean": do l1 normalization - * "sqrtn": do l2 normalization - For more information: `tf.embedding_lookup_sparse`. -* `ckpt_to_load_from`: (Optional). String representing checkpoint name/pattern - to restore the column weights. Required if `tensor_name_in_ckpt` is not - None. -* `tensor_name_in_ckpt`: (Optional). Name of the `Tensor` in the provided - checkpoint from which to restore the column weights. Required if - `ckpt_to_load_from` is not None. -* `hash_key`: Specify the hash_key that will be used by the `FingerprintCat64` - function to combine the crosses fingerprints on SparseFeatureCrossOp - (optional). - -##### Returns: - - A _CrossedColumn. - -##### Raises: - - -* `TypeError`: if any item in columns is not an instance of _SparseColumn, - _CrossedColumn, or _BucketizedColumn, or - hash_bucket_size is not an int. -* `ValueError`: if hash_bucket_size is not > 1 or - len(columns) is not > 1. - - -- - - - -### `tf.contrib.layers.embedding_column(sparse_id_column, dimension, combiner='mean', initializer=None, ckpt_to_load_from=None, tensor_name_in_ckpt=None, max_norm=None)` {#embedding_column} - -Creates an `_EmbeddingColumn` for feeding sparse data into a DNN. - -##### Args: - - -* `sparse_id_column`: A `_SparseColumn` which is created by for example - `sparse_column_with_*` or crossed_column functions. Note that `combiner` - defined in `sparse_id_column` is ignored. -* `dimension`: An integer specifying dimension of the embedding. -* `combiner`: A string specifying how to reduce if there are multiple entries - in a single row. Currently "mean", "sqrtn" and "sum" are supported, with - "mean" the default. "sqrtn" often achieves good accuracy, in particular - with bag-of-words columns. Each of this can be thought as example level - normalizations on the column: - * "sum": do not normalize - * "mean": do l1 normalization - * "sqrtn": do l2 normalization - For more information: `tf.embedding_lookup_sparse`. -* `initializer`: A variable initializer function to be used in embedding - variable initialization. If not specified, defaults to - `tf.truncated_normal_initializer` with mean 0.0 and standard deviation - 1/sqrt(sparse_id_column.length). -* `ckpt_to_load_from`: (Optional). String representing checkpoint name/pattern - to restore the column weights. Required if `tensor_name_in_ckpt` is not - None. -* `tensor_name_in_ckpt`: (Optional). Name of the `Tensor` in the provided - checkpoint from which to restore the column weights. Required if - `ckpt_to_load_from` is not None. -* `max_norm`: (Optional). If not None, embedding values are l2-normalized to - the value of max_norm. - -##### Returns: - - An `_EmbeddingColumn`. - - -- - - - -### `tf.contrib.layers.scattered_embedding_column(column_name, size, dimension, hash_key, combiner='mean', initializer=None)` {#scattered_embedding_column} - -Creates an embedding column of a sparse feature using parameter hashing. - -The i-th embedding component of a value v is found by retrieving an -embedding weight whose index is a fingerprint of the pair (v,i). - -An embedding column with sparse_column_with_hash_bucket such as - embedding_column( - sparse_column_with_hash_bucket(column_name, bucket_size), - dimension) - -could be replaced by - scattered_embedding_column( - column_name, size=bucket_size * dimension, dimension=dimension, - hash_key=tf.contrib.layers.SPARSE_FEATURE_CROSS_DEFAULT_HASH_KEY) - -for the same number of embedding parameters and hopefully reduced impact of -collisions with a cost of slowing down training. - -##### Args: - - -* `column_name`: A string defining sparse column name. -* `size`: An integer specifying the number of parameters in the embedding layer. -* `dimension`: An integer specifying dimension of the embedding. -* `hash_key`: Specify the hash_key that will be used by the `FingerprintCat64` - function to combine the crosses fingerprints on SparseFeatureCrossOp. -* `combiner`: A string specifying how to reduce if there are multiple entries - in a single row. Currently "mean", "sqrtn" and "sum" are supported, with - "mean" the default. "sqrtn" often achieves good accuracy, in particular - with bag-of-words columns. Each of this can be thought as example level - normalizations on the column: - * "sum": do not normalize features in the column - * "mean": do l1 normalization on features in the column - * "sqrtn": do l2 normalization on features in the column - For more information: `tf.embedding_lookup_sparse`. -* `initializer`: A variable initializer function to be used in embedding - variable initialization. If not specified, defaults to - `tf.truncated_normal_initializer` with mean 0 and standard deviation 0.1. - -##### Returns: - - A _ScatteredEmbeddingColumn. - -##### Raises: - - -* `ValueError`: if dimension or size is not a positive integer; or if combiner - is not supported. - - -- - - - -### `tf.contrib.layers.input_from_feature_columns(columns_to_tensors, feature_columns, weight_collections=None, trainable=True, scope=None)` {#input_from_feature_columns} - -A tf.contrib.layer style input layer builder based on FeatureColumns. - -Generally a single example in training data is described with feature columns. -At the first layer of the model, this column oriented data should be converted -to a single tensor. Each feature column needs a different kind of operation -during this conversion. For example sparse features need a totally different -handling than continuous features. - -Example: - -```python - # Building model for training - columns_to_tensor = tf.parse_example(...) - first_layer = input_from_feature_columns( - columns_to_tensors=columns_to_tensor, - feature_columns=feature_columns) - second_layer = fully_connected(inputs=first_layer, ...) - ... -``` - -where feature_columns can be defined as follows: - -```python - sparse_feature = sparse_column_with_hash_bucket( - column_name="sparse_col", ...) - sparse_feature_emb = embedding_column(sparse_id_column=sparse_feature, ...) - real_valued_feature = real_valued_column(...) - real_valued_buckets = bucketized_column( - source_column=real_valued_feature, ...) - - feature_columns=[sparse_feature_emb, real_valued_buckets] -``` - -##### Args: - - -* `columns_to_tensors`: A mapping from feature column to tensors. 'string' key - means a base feature (not-transformed). It can have FeatureColumn as a - key too. That means that FeatureColumn is already transformed by input - pipeline. For example, `inflow` may have handled transformations. -* `feature_columns`: A set containing all the feature columns. All items in the - set should be instances of classes derived by FeatureColumn. -* `weight_collections`: List of graph collections to which weights are added. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for variable_scope. - -##### Returns: - - A Tensor which can be consumed by hidden layers in the neural network. - -##### Raises: - - -* `ValueError`: if FeatureColumn cannot be consumed by a neural network. - - -- - - - -### `tf.contrib.layers.joint_weighted_sum_from_feature_columns(columns_to_tensors, feature_columns, num_outputs, weight_collections=None, trainable=True, scope=None)` {#joint_weighted_sum_from_feature_columns} - -A restricted linear prediction builder based on FeatureColumns. - -As long as all feature columns are unweighted sparse columns this computes the -prediction of a linear model which stores all weights in a single variable. - -##### Args: - - -* `columns_to_tensors`: A mapping from feature column to tensors. 'string' key - means a base feature (not-transformed). It can have FeatureColumn as a - key too. That means that FeatureColumn is already transformed by input - pipeline. For example, `inflow` may have handled transformations. -* `feature_columns`: A set containing all the feature columns. All items in the - set should be instances of classes derived from FeatureColumn. -* `num_outputs`: An integer specifying number of outputs. Default value is 1. -* `weight_collections`: List of graph collections to which weights are added. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for variable_scope. - -##### Returns: - - A tuple containing: - - * A Tensor which represents predictions of a linear model. - * A list of Variables storing the weights. - * A Variable which is used for bias. - -##### Raises: - - -* `ValueError`: if FeatureColumn cannot be used for linear predictions. - - -- - - - -### `tf.contrib.layers.make_place_holder_tensors_for_base_features(feature_columns)` {#make_place_holder_tensors_for_base_features} - -Returns placeholder tensors for inference. - -##### Args: - - -* `feature_columns`: An iterable containing all the feature columns. All items - should be instances of classes derived from _FeatureColumn. - -##### Returns: - - A dict mapping feature keys to SparseTensors (sparse columns) or - placeholder Tensors (dense columns). - - -- - - - -### `tf.contrib.layers.multi_class_target(*args, **kwargs)` {#multi_class_target} - -Creates a _TargetColumn for multi class single label classification. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-11-12. -Instructions for updating: -This file will be removed after the deprecation date.Please switch to third_party/tensorflow/contrib/learn/python/learn/estimators/head.py - -The target column uses softmax cross entropy loss. - -##### Args: - - -* `n_classes`: Integer, number of classes, must be >= 2 -* `label_name`: String, name of the key in label dict. Can be null if label - is a tensor (single headed models). -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. It - will be multiplied by the loss of the example. - -##### Returns: - - An instance of _MultiClassTargetColumn. - -##### Raises: - - -* `ValueError`: if n_classes is < 2 - - -- - - - -### `tf.contrib.layers.one_hot_column(sparse_id_column)` {#one_hot_column} - -Creates an `_OneHotColumn` for a one-hot or multi-hot repr in a DNN. - -##### Args: - - -* `sparse_id_column`: A _SparseColumn which is created by - `sparse_column_with_*` - or crossed_column functions. Note that `combiner` defined in - `sparse_id_column` is ignored. - -##### Returns: - - An _OneHotColumn. - - -- - - - -### `tf.contrib.layers.parse_feature_columns_from_examples(serialized, feature_columns, name=None, example_names=None)` {#parse_feature_columns_from_examples} - -Parses tf.Examples to extract tensors for given feature_columns. - -This is a wrapper of 'tf.parse_example'. - -Example: - -```python -columns_to_tensor = parse_feature_columns_from_examples( - serialized=my_data, - feature_columns=my_features) - -# Where my_features are: -# Define features and transformations -sparse_feature_a = sparse_column_with_keys( - column_name="sparse_feature_a", keys=["AB", "CD", ...]) - -embedding_feature_a = embedding_column( - sparse_id_column=sparse_feature_a, dimension=3, combiner="sum") - -sparse_feature_b = sparse_column_with_hash_bucket( - column_name="sparse_feature_b", hash_bucket_size=1000) - -embedding_feature_b = embedding_column( - sparse_id_column=sparse_feature_b, dimension=16, combiner="sum") - -crossed_feature_a_x_b = crossed_column( - columns=[sparse_feature_a, sparse_feature_b], hash_bucket_size=10000) - -real_feature = real_valued_column("real_feature") -real_feature_buckets = bucketized_column( - source_column=real_feature, boundaries=[...]) - -my_features = [embedding_feature_b, real_feature_buckets, embedding_feature_a] -``` - -##### Args: - - -* `serialized`: A vector (1-D Tensor) of strings, a batch of binary - serialized `Example` protos. -* `feature_columns`: An iterable containing all the feature columns. All items - should be instances of classes derived from _FeatureColumn. -* `name`: A name for this operation (optional). -* `example_names`: A vector (1-D Tensor) of strings (optional), the names of - the serialized protos in the batch. - -##### Returns: - - A `dict` mapping FeatureColumn to `Tensor` and `SparseTensor` values. - - -- - - - -### `tf.contrib.layers.parse_feature_columns_from_sequence_examples(serialized, context_feature_columns, sequence_feature_columns, name=None, example_name=None)` {#parse_feature_columns_from_sequence_examples} - -Parses tf.SequenceExamples to extract tensors for given `FeatureColumn`s. - -##### Args: - - -* `serialized`: A scalar (0-D Tensor) of type string, a single serialized - `SequenceExample` proto. -* `context_feature_columns`: An iterable containing the feature columns for - context features. All items should be instances of classes derived from - `_FeatureColumn`. Can be `None`. -* `sequence_feature_columns`: An iterable containing the feature columns for - sequence features. All items should be instances of classes derived from - `_FeatureColumn`. Can be `None`. -* `name`: A name for this operation (optional). -* `example_name`: A scalar (0-D Tensor) of type string (optional), the names of - the serialized proto. - -##### Returns: - - A tuple consisting of: - -* `context_features`: a dict mapping `FeatureColumns` from - `context_feature_columns` to their parsed `Tensors`/`SparseTensor`s. -* `sequence_features`: a dict mapping `FeatureColumns` from - `sequence_feature_columns` to their parsed `Tensors`/`SparseTensor`s. - - -- - - - -### `tf.contrib.layers.real_valued_column(column_name, dimension=1, default_value=None, dtype=tf.float32, normalizer=None)` {#real_valued_column} - -Creates a `_RealValuedColumn` for dense numeric data. - -##### Args: - - -* `column_name`: A string defining real valued column name. -* `dimension`: An integer specifying dimension of the real valued column. - The default is 1. When dimension is not None, the Tensor representing - the _RealValuedColumn will have the shape of [batch_size, dimension]. - A None dimension means the feature column should be treat as variable - length and will be parsed as a `SparseTensor`. -* `default_value`: A single value compatible with dtype or a list of values - compatible with dtype which the column takes on during tf.Example parsing - if data is missing. When dimension is not None, a default value of None - will cause tf.parse_example to fail if an example does not contain this - column. If a single value is provided, the same value will be applied as - the default value for every dimension. If a list of values is provided, - the length of the list should be equal to the value of `dimension`. - Only scalar default value is supported in case dimension is not specified. -* `dtype`: defines the type of values. Default value is tf.float32. Must be a - non-quantized, real integer or floating point type. -* `normalizer`: If not None, a function that can be used to normalize the value - of the real valued column after default_value is applied for parsing. - Normalizer function takes the input tensor as its argument, and returns - the output tensor. (e.g. lambda x: (x - 3.0) / 4.2). Note that for - variable length columns, the normalizer should expect an input_tensor of - type `SparseTensor`. - -##### Returns: - - A _RealValuedColumn. - -##### Raises: - - -* `TypeError`: if dimension is not an int -* `ValueError`: if dimension is not a positive integer -* `TypeError`: if default_value is a list but its length is not equal to the - value of `dimension`. -* `TypeError`: if default_value is not compatible with dtype. -* `ValueError`: if dtype is not convertable to tf.float32. - - -- - - - -### `tf.contrib.layers.shared_embedding_columns(sparse_id_columns, dimension, combiner='mean', shared_embedding_name=None, initializer=None, ckpt_to_load_from=None, tensor_name_in_ckpt=None, max_norm=None)` {#shared_embedding_columns} - -Creates a list of `_EmbeddingColumn` sharing the same embedding. - -##### Args: - - -* `sparse_id_columns`: An iterable of `_SparseColumn`, such as those created by - `sparse_column_with_*` or crossed_column functions. Note that `combiner` - defined in each sparse_id_column is ignored. -* `dimension`: An integer specifying dimension of the embedding. -* `combiner`: A string specifying how to reduce if there are multiple entries - in a single row. Currently "mean", "sqrtn" and "sum" are supported, with - "mean" the default. "sqrtn" often achieves good accuracy, in particular - with bag-of-words columns. Each of this can be thought as example level - normalizations on the column: - * "sum": do not normalize - * "mean": do l1 normalization - * "sqrtn": do l2 normalization - For more information: `tf.embedding_lookup_sparse`. -* `shared_embedding_name`: (Optional). A string specifying the name of shared - embedding weights. This will be needed if you want to reference the shared - embedding separately from the generated `_EmbeddingColumn`. -* `initializer`: A variable initializer function to be used in embedding - variable initialization. If not specified, defaults to - `tf.truncated_normal_initializer` with mean 0.0 and standard deviation - 1/sqrt(sparse_id_columns[0].length). -* `ckpt_to_load_from`: (Optional). String representing checkpoint name/pattern - to restore the column weights. Required if `tensor_name_in_ckpt` is not - None. -* `tensor_name_in_ckpt`: (Optional). Name of the `Tensor` in the provided - checkpoint from which to restore the column weights. Required if - `ckpt_to_load_from` is not None. -* `max_norm`: (Optional). If not None, embedding values are l2-normalized to - the value of max_norm. - -##### Returns: - - A tuple of `_EmbeddingColumn` with shared embedding space. - -##### Raises: - - -* `ValueError`: if sparse_id_columns is empty, or its elements are not - compatible with each other. -* `TypeError`: if `sparse_id_columns` is not a sequence or is a string. If at - least one element of `sparse_id_columns` is not a `SparseTensor`. - - -- - - - -### `tf.contrib.layers.sparse_column_with_hash_bucket(column_name, hash_bucket_size, combiner='sum', dtype=tf.string)` {#sparse_column_with_hash_bucket} - -Creates a _SparseColumn with hashed bucket configuration. - -Use this when your sparse features are in string or integer format, but you -don't have a vocab file that maps each value to an integer ID. -output_id = Hash(input_feature_string) % bucket_size - -##### Args: - - -* `column_name`: A string defining sparse column name. -* `hash_bucket_size`: An int that is > 1. The number of buckets. -* `combiner`: A string specifying how to reduce if the sparse column is - multivalent. Currently "mean", "sqrtn" and "sum" are supported, with "sum" - the default. "sqrtn" often achieves good accuracy, in particular with - bag-of-words columns. - * "sum": do not normalize features in the column - * "mean": do l1 normalization on features in the column - * "sqrtn": do l2 normalization on features in the column - For more information: `tf.embedding_lookup_sparse`. -* `dtype`: The type of features. Only string and integer types are supported. - -##### Returns: - - A _SparseColumn with hashed bucket configuration - -##### Raises: - - -* `ValueError`: hash_bucket_size is not greater than 2. -* `ValueError`: dtype is neither string nor integer. - - -- - - - -### `tf.contrib.layers.sparse_column_with_integerized_feature(column_name, bucket_size, combiner='sum', dtype=tf.int64)` {#sparse_column_with_integerized_feature} - -Creates an integerized _SparseColumn. - -Use this when your features are already pre-integerized into int64 IDs, that -is, when the set of values to output is already coming in as what's desired in -the output. Integerized means we can use the feature value itself as id. - -Typically this is used for reading contiguous ranges of integers indexes, but -it doesn't have to be. The output value is simply copied from the -input_feature, whatever it is. Just be aware, however, that if you have large -gaps of unused integers it might affect what you feed those in (for instance, -if you make up a one-hot tensor from these, the unused integers will appear as -values in the tensor which are always zero.) - -##### Args: - - -* `column_name`: A string defining sparse column name. -* `bucket_size`: An int that is > 1. The number of buckets. It should be bigger - than maximum feature. In other words features in this column should be an - int64 in range [0, bucket_size) -* `combiner`: A string specifying how to reduce if the sparse column is - multivalent. Currently "mean", "sqrtn" and "sum" are supported, with "sum" - the default. "sqrtn" often achieves good accuracy, in particular with - bag-of-words columns. - * "sum": do not normalize features in the column - * "mean": do l1 normalization on features in the column - * "sqrtn": do l2 normalization on features in the column - For more information: `tf.embedding_lookup_sparse`. -* `dtype`: Type of features. It should be an integer type. Default value is - dtypes.int64. - -##### Returns: - - An integerized _SparseColumn definition. - -##### Raises: - - -* `ValueError`: bucket_size is not greater than 1. -* `ValueError`: dtype is not integer. - - -- - - - -### `tf.contrib.layers.sparse_column_with_keys(column_name, keys, default_value=-1, combiner='sum')` {#sparse_column_with_keys} - -Creates a _SparseColumn with keys. - -Look up logic is as follows: -lookup_id = index_of_feature_in_keys if feature in keys else default_value - -##### Args: - - -* `column_name`: A string defining sparse column name. -* `keys`: a string list defining vocabulary. -* `default_value`: The value to use for out-of-vocabulary feature values. - Default is -1. -* `combiner`: A string specifying how to reduce if the sparse column is - multivalent. Currently "mean", "sqrtn" and "sum" are supported, with "sum" - the default. "sqrtn" often achieves good accuracy, in particular with - bag-of-words columns. - * "sum": do not normalize features in the column - * "mean": do l1 normalization on features in the column - * "sqrtn": do l2 normalization on features in the column - For more information: `tf.embedding_lookup_sparse`. - -##### Returns: - - A _SparseColumnKeys with keys configuration. - - -- - - - -### `tf.contrib.layers.weighted_sparse_column(sparse_id_column, weight_column_name, dtype=tf.float32)` {#weighted_sparse_column} - -Creates a _SparseColumn by combining sparse_id_column with a weight column. - -Example: - - ```python - sparse_feature = sparse_column_with_hash_bucket(column_name="sparse_col", - hash_bucket_size=1000) - weighted_feature = weighted_sparse_column(sparse_id_column=sparse_feature, - weight_column_name="weights_col") - ``` - - This configuration assumes that input dictionary of model contains the - following two items: - * (key="sparse_col", value=sparse_tensor) where sparse_tensor is - a SparseTensor. - * (key="weights_col", value=weights_tensor) where weights_tensor - is a SparseTensor. - Following are assumed to be true: - * sparse_tensor.indices = weights_tensor.indices - * sparse_tensor.dense_shape = weights_tensor.dense_shape - -##### Args: - - -* `sparse_id_column`: A `_SparseColumn` which is created by - `sparse_column_with_*` functions. -* `weight_column_name`: A string defining a sparse column name which represents - weight or value of the corresponding sparse id feature. -* `dtype`: Type of weights, such as `tf.float32`. Only floating and integer - weights are supported. - -##### Returns: - - A _WeightedSparseColumn composed of two sparse features: one represents id, - the other represents weight (value) of the id feature in that example. - -##### Raises: - - -* `ValueError`: if dtype is not convertible to float. - - -- - - - -### `tf.contrib.layers.weighted_sum_from_feature_columns(columns_to_tensors, feature_columns, num_outputs, weight_collections=None, trainable=True, scope=None)` {#weighted_sum_from_feature_columns} - -A tf.contrib.layer style linear prediction builder based on FeatureColumns. - -Generally a single example in training data is described with feature columns. -This function generates weighted sum for each num_outputs. Weighted sum refers -to logits in classification problems. It refers to prediction itself for -linear regression problems. - -Example: - - ``` - # Building model for training - feature_columns = ( - real_valued_column("my_feature1"), - ... - ) - columns_to_tensor = tf.parse_example(...) - logits = weighted_sum_from_feature_columns( - columns_to_tensors=columns_to_tensor, - feature_columns=feature_columns, - num_outputs=1) - loss = tf.nn.sigmoid_cross_entropy_with_logits(labels=labels, - logits=logits) - ``` - -##### Args: - - -* `columns_to_tensors`: A mapping from feature column to tensors. 'string' key - means a base feature (not-transformed). It can have FeatureColumn as a - key too. That means that FeatureColumn is already transformed by input - pipeline. For example, `inflow` may have handled transformations. -* `feature_columns`: A set containing all the feature columns. All items in the - set should be instances of classes derived from FeatureColumn. -* `num_outputs`: An integer specifying number of outputs. Default value is 1. -* `weight_collections`: List of graph collections to which weights are added. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for variable_scope. - -##### Returns: - - A tuple containing: - - * A Tensor which represents predictions of a linear model. - * A dictionary which maps feature_column to corresponding Variable. - * A Variable which is used for bias. - -##### Raises: - - -* `ValueError`: if FeatureColumn cannot be used for linear predictions. - - -- - - - -### `tf.contrib.layers.infer_real_valued_columns(features)` {#infer_real_valued_columns} - - - - -- - - - -### `tf.contrib.layers.sequence_input_from_feature_columns(*args, **kwargs)` {#sequence_input_from_feature_columns} - -Builds inputs for sequence models from `FeatureColumn`s. (experimental) - -THIS FUNCTION IS EXPERIMENTAL. It may change or be removed at any time, and without warning. - - -See documentation for `input_from_feature_columns`. The following types of -`FeatureColumn` are permitted in `feature_columns`: `_OneHotColumn`, -`_EmbeddingColumn`, `_ScatteredEmbeddingColumn`, `_RealValuedColumn`, -`_DataFrameColumn`. In addition, columns in `feature_columns` may not be -constructed using any of the following: `ScatteredEmbeddingColumn`, -`BucketizedColumn`, `CrossedColumn`. - -##### Args: - - -* `columns_to_tensors`: A mapping from feature column to tensors. 'string' key - means a base feature (not-transformed). It can have FeatureColumn as a - key too. That means that FeatureColumn is already transformed by input - pipeline. For example, `inflow` may have handled transformations. -* `feature_columns`: A set containing all the feature columns. All items in the - set should be instances of classes derived by FeatureColumn. -* `weight_collections`: List of graph collections to which weights are added. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for variable_scope. - -##### Returns: - - A Tensor which can be consumed by hidden layers in the neural network. - -##### Raises: - - -* `ValueError`: if FeatureColumn cannot be consumed by a neural network. - - - -## Other Functions and Classes -- - - - -### `tf.contrib.layers.legacy_fully_connected(x, num_output_units, activation_fn=None, weight_init=_initializer, bias_init=Zeros(), name=None, weight_collections=('weights',), bias_collections=('biases',), output_collections=('activations',), trainable=True, weight_regularizer=None, bias_regularizer=None)` {#legacy_fully_connected} - -Adds the parameters for a fully connected layer and returns the output. - -A fully connected layer is generally defined as a matrix multiply: -`y = f(w * x + b)` where `f` is given by `activation_fn`. If -`activation_fn` is `None`, the result of `y = w * x + b` is -returned. - -If `x` has shape [\\\(\\text{dim}_0, \\text{dim}_1, ..., \\text{dim}_n\\\)] -with more than 2 dimensions (\\\(n > 1\\\)), then we repeat the matrix -multiply along the first dimensions. The result r is a tensor of shape -[\\\(\\text{dim}_0, ..., \\text{dim}_{n-1},\\\) `num_output_units`], -where \\\( r_{i_0, ..., i_{n-1}, k} = -\\sum_{0 \\leq j < \\text{dim}_n} x_{i_0, ... i_{n-1}, j} \cdot w_{j, k}\\\). -This is accomplished by reshaping `x` to 2-D -[\\\(\\text{dim}_0 \\cdot ... \\cdot \\text{dim}_{n-1}, \\text{dim}_n\\\)] -before the matrix multiply and afterwards reshaping it to -[\\\(\\text{dim}_0, ..., \\text{dim}_{n-1},\\\) `num_output_units`]. - -This op creates `w` and optionally `b`. Bias (`b`) can be disabled by setting -`bias_init` to `None`. - -The variable creation is compatible with `tf.variable_scope` and so can be -reused with `tf.variable_scope` or `tf.make_template`. - -Most of the details of variable creation can be controlled by specifying the -initializers (`weight_init` and `bias_init`) and in which collections to place -the created variables (`weight_collections` and `bias_collections`; note that -the variables are always added to the `VARIABLES` collection). The output of -the layer can be placed in custom collections using `output_collections`. -The collections arguments default to `WEIGHTS`, `BIASES` and `ACTIVATIONS`, -respectively. - -A per layer regularization can be specified by setting `weight_regularizer` -and `bias_regularizer`, which are applied to the weights and biases -respectively, and whose output is added to the `REGULARIZATION_LOSSES` -collection. - -##### Args: - - -* `x`: The input `Tensor`. -* `num_output_units`: The size of the output. -* `activation_fn`: Activation function, default set to None to skip it and - maintain a linear activation. -* `weight_init`: An optional weight initialization, defaults to - `xavier_initializer`. -* `bias_init`: An initializer for the bias, defaults to 0. Set to `None` in - order to disable bias. -* `name`: The name for this operation is used to name operations and to find - variables. If specified it must be unique for this scope, otherwise a - unique name starting with "fully_connected" will be created. See - `tf.variable_scope` for details. -* `weight_collections`: List of graph collections to which weights are added. -* `bias_collections`: List of graph collections to which biases are added. -* `output_collections`: List of graph collections to which outputs are added. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `weight_regularizer`: A regularizer like the result of - `l1_regularizer` or `l2_regularizer`. Used for weights. -* `bias_regularizer`: A regularizer like the result of - `l1_regularizer` or `l2_regularizer`. Used for biases. - -##### Returns: - - The output of the fully connected layer. - -##### Raises: - - -* `ValueError`: If x has rank less than 2 or if its last dimension is not set. - - -- - - - -### `tf.contrib.layers.legacy_linear(x, num_output_units, weight_init=_initializer, bias_init=Zeros(), name=None, weight_collections=('weights',), bias_collections=('biases',), output_collections=('activations',), trainable=True, weight_regularizer=None, bias_regularizer=None)` {#legacy_linear} - -partial(func, *args, **keywords) - new function with partial application -of the given arguments and keywords. - - -- - - - -### `tf.contrib.layers.legacy_relu(x, num_output_units, weight_init=_initializer, bias_init=Zeros(), name=None, weight_collections=('weights',), bias_collections=('biases',), output_collections=('activations',), trainable=True, weight_regularizer=None, bias_regularizer=None)` {#legacy_relu} - -partial(func, *args, **keywords) - new function with partial application -of the given arguments and keywords. - - -- - - - -### `tf.contrib.layers.regression_target(*args, **kwargs)` {#regression_target} - -Creates a _TargetColumn for linear regression. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-11-12. -Instructions for updating: -This file will be removed after the deprecation date.Please switch to third_party/tensorflow/contrib/learn/python/learn/estimators/head.py - -##### Args: - - -* `label_name`: String, name of the key in label dict. Can be null if label - is a tensor (single headed models). -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. It - will be multiplied by the loss of the example. -* `label_dimension`: dimension of the target for multilabels. - -##### Returns: - - An instance of _TargetColumn - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.learn.md b/tensorflow/g3doc/api_docs/python/contrib.learn.md deleted file mode 100644 index 12e5bd6da0..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.learn.md +++ /dev/null @@ -1,5510 +0,0 @@ - - -# Learn (contrib) -[TOC] - -High level API for learning. See the @{$python/contrib.learn} guide. - -- - - - -### `class tf.contrib.learn.BaseEstimator` {#BaseEstimator} - -Abstract BaseEstimator class to train and evaluate TensorFlow models. - -Users should not instantiate or subclass this class. Instead, use `Estimator`. -- - - - -#### `tf.contrib.learn.BaseEstimator.__init__(model_dir=None, config=None)` {#BaseEstimator.__init__} - -Initializes a BaseEstimator instance. - -##### Args: - - -* `model_dir`: Directory to save model parameters, graph and etc. This can - also be used to load checkpoints from the directory into a estimator to - continue training a previously saved model. -* `config`: A RunConfig instance. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.__repr__()` {#BaseEstimator.__repr__} - - - - -- - - - -#### `tf.contrib.learn.BaseEstimator.config` {#BaseEstimator.config} - - - - -- - - - -#### `tf.contrib.learn.BaseEstimator.evaluate(*args, **kwargs)` {#BaseEstimator.evaluate} - -See `Evaluable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If at least one of `x` or `y` is provided, and at least one of - `input_fn` or `feed_fn` is provided. - Or if `metrics` is not `None` or `dict`. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.export(*args, **kwargs)` {#BaseEstimator.export} - -Exports inference graph into given dir. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-23. -Instructions for updating: -The signature of the input_fn accepted by export is changing to be consistent with what's used by tf.Learn Estimator's train/evaluate. input_fn (and in most cases, input_feature_key) will become required args, and use_deprecated_input_fn will default to False and be removed altogether. - -##### Args: - - -* `export_dir`: A string containing a directory to write the exported graph - and checkpoints. -* `input_fn`: If `use_deprecated_input_fn` is true, then a function that given - `Tensor` of `Example` strings, parses it into features that are then - passed to the model. Otherwise, a function that takes no argument and - returns a tuple of (features, labels), where features is a dict of - string key to `Tensor` and labels is a `Tensor` that's currently not - used (and so can be `None`). -* `input_feature_key`: Only used if `use_deprecated_input_fn` is false. String - key into the features dict returned by `input_fn` that corresponds to a - the raw `Example` strings `Tensor` that the exported model will take as - input. Can only be `None` if you're using a custom `signature_fn` that - does not use the first arg (examples). -* `use_deprecated_input_fn`: Determines the signature format of `input_fn`. -* `signature_fn`: Function that returns a default signature and a named - signature map, given `Tensor` of `Example` strings, `dict` of `Tensor`s - for features and `Tensor` or `dict` of `Tensor`s for predictions. -* `prediction_key`: The key for a tensor in the `predictions` dict (output - from the `model_fn`) to use as the `predictions` input to the - `signature_fn`. Optional. If `None`, predictions will pass to - `signature_fn` without filtering. -* `default_batch_size`: Default batch size of the `Example` placeholder. -* `exports_to_keep`: Number of exports to keep. -* `checkpoint_path`: the checkpoint path of the model to be exported. If it is - `None` (which is default), will use the latest checkpoint in - export_dir. - -##### Returns: - - The string path to the exported directory. NB: this functionality was - added ca. 2016/09/25; clients that depend on the return value may need - to handle the case where this function returns None because subclasses - are not returning a value. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.fit(*args, **kwargs)` {#BaseEstimator.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.get_params(deep=True)` {#BaseEstimator.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.get_variable_names()` {#BaseEstimator.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.get_variable_value(name)` {#BaseEstimator.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.model_dir` {#BaseEstimator.model_dir} - - - - -- - - - -#### `tf.contrib.learn.BaseEstimator.partial_fit(*args, **kwargs)` {#BaseEstimator.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.predict(*args, **kwargs)` {#BaseEstimator.predict} - -Returns predictions for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x` and 'batch_size' must be `None`. -* `batch_size`: Override default batch size. If set, 'input_fn' must be - 'None'. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns all. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - A numpy array of predicted classes or regression values if the - constructor's `model_fn` returns a `Tensor` for `predictions` or a `dict` - of numpy arrays if `model_fn` returns a `dict`. Returns an iterable of - predictions if as_iterable is True. - -##### Raises: - - -* `ValueError`: If x and input_fn are both provided or both `None`. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.set_params(**params)` {#BaseEstimator.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - - -- - - - -### `class tf.contrib.learn.Estimator` {#Estimator} - -Estimator class is the basic TensorFlow model trainer/evaluator. -- - - - -#### `tf.contrib.learn.Estimator.__init__(model_fn=None, model_dir=None, config=None, params=None, feature_engineering_fn=None)` {#Estimator.__init__} - -Constructs an `Estimator` instance. - -##### Args: - - -* `model_fn`: Model function. Follows the signature: - * Args: - * `features`: single `Tensor` or `dict` of `Tensor`s - (depending on data passed to `fit`), - * `labels`: `Tensor` or `dict` of `Tensor`s (for multi-head - models). If mode is `ModeKeys.INFER`, `labels=None` will be - passed. If the `model_fn`'s signature does not accept - `mode`, the `model_fn` must still be able to handle - `labels=None`. - * `mode`: Optional. Specifies if this training, evaluation or - prediction. See `ModeKeys`. - * `params`: Optional `dict` of hyperparameters. Will receive what - is passed to Estimator in `params` parameter. This allows - to configure Estimators from hyper parameter tuning. - * `config`: Optional configuration object. Will receive what is passed - to Estimator in `config` parameter, or the default `config`. - Allows updating things in your model_fn based on configuration - such as `num_ps_replicas`. - * `model_dir`: Optional directory where model parameters, graph etc - are saved. Will receive what is passed to Estimator in - `model_dir` parameter, or the default `model_dir`. Allows - updating things in your model_fn that expect model_dir, such as - training hooks. - - * Returns: - `ModelFnOps` - - Also supports a legacy signature which returns tuple of: - - * predictions: `Tensor`, `SparseTensor` or dictionary of same. - Can also be any type that is convertible to a `Tensor` or - `SparseTensor`, or dictionary of same. - * loss: Scalar loss `Tensor`. - * train_op: Training update `Tensor` or `Operation`. - - Supports next three signatures for the function: - - * `(features, labels) -> (predictions, loss, train_op)` - * `(features, labels, mode) -> (predictions, loss, train_op)` - * `(features, labels, mode, params) -> (predictions, loss, train_op)` - * `(features, labels, mode, params, config) -> - (predictions, loss, train_op)` - * `(features, labels, mode, params, config, model_dir) -> - (predictions, loss, train_op)` - - -* `model_dir`: Directory to save model parameters, graph and etc. This can - also be used to load checkpoints from the directory into a estimator to - continue training a previously saved model. -* `config`: Configuration object. -* `params`: `dict` of hyper parameters that will be passed into `model_fn`. - Keys are names of parameters, values are basic python types. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into `model_fn`. Please check `model_fn` for - a definition of features and labels. - -##### Raises: - - -* `ValueError`: parameters of `model_fn` don't match `params`. - - -- - - - -#### `tf.contrib.learn.Estimator.__repr__()` {#Estimator.__repr__} - - - - -- - - - -#### `tf.contrib.learn.Estimator.config` {#Estimator.config} - - - - -- - - - -#### `tf.contrib.learn.Estimator.evaluate(*args, **kwargs)` {#Estimator.evaluate} - -See `Evaluable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If at least one of `x` or `y` is provided, and at least one of - `input_fn` or `feed_fn` is provided. - Or if `metrics` is not `None` or `dict`. - - -- - - - -#### `tf.contrib.learn.Estimator.export(*args, **kwargs)` {#Estimator.export} - -Exports inference graph into given dir. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-23. -Instructions for updating: -The signature of the input_fn accepted by export is changing to be consistent with what's used by tf.Learn Estimator's train/evaluate. input_fn (and in most cases, input_feature_key) will become required args, and use_deprecated_input_fn will default to False and be removed altogether. - -##### Args: - - -* `export_dir`: A string containing a directory to write the exported graph - and checkpoints. -* `input_fn`: If `use_deprecated_input_fn` is true, then a function that given - `Tensor` of `Example` strings, parses it into features that are then - passed to the model. Otherwise, a function that takes no argument and - returns a tuple of (features, labels), where features is a dict of - string key to `Tensor` and labels is a `Tensor` that's currently not - used (and so can be `None`). -* `input_feature_key`: Only used if `use_deprecated_input_fn` is false. String - key into the features dict returned by `input_fn` that corresponds to a - the raw `Example` strings `Tensor` that the exported model will take as - input. Can only be `None` if you're using a custom `signature_fn` that - does not use the first arg (examples). -* `use_deprecated_input_fn`: Determines the signature format of `input_fn`. -* `signature_fn`: Function that returns a default signature and a named - signature map, given `Tensor` of `Example` strings, `dict` of `Tensor`s - for features and `Tensor` or `dict` of `Tensor`s for predictions. -* `prediction_key`: The key for a tensor in the `predictions` dict (output - from the `model_fn`) to use as the `predictions` input to the - `signature_fn`. Optional. If `None`, predictions will pass to - `signature_fn` without filtering. -* `default_batch_size`: Default batch size of the `Example` placeholder. -* `exports_to_keep`: Number of exports to keep. -* `checkpoint_path`: the checkpoint path of the model to be exported. If it is - `None` (which is default), will use the latest checkpoint in - export_dir. - -##### Returns: - - The string path to the exported directory. NB: this functionality was - added ca. 2016/09/25; clients that depend on the return value may need - to handle the case where this function returns None because subclasses - are not returning a value. - - -- - - - -#### `tf.contrib.learn.Estimator.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#Estimator.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.Estimator.fit(*args, **kwargs)` {#Estimator.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.Estimator.get_params(deep=True)` {#Estimator.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.Estimator.get_variable_names()` {#Estimator.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.Estimator.get_variable_value(name)` {#Estimator.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.Estimator.model_dir` {#Estimator.model_dir} - - - - -- - - - -#### `tf.contrib.learn.Estimator.partial_fit(*args, **kwargs)` {#Estimator.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.Estimator.predict(*args, **kwargs)` {#Estimator.predict} - -Returns predictions for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x` and 'batch_size' must be `None`. -* `batch_size`: Override default batch size. If set, 'input_fn' must be - 'None'. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns all. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - A numpy array of predicted classes or regression values if the - constructor's `model_fn` returns a `Tensor` for `predictions` or a `dict` - of numpy arrays if `model_fn` returns a `dict`. Returns an iterable of - predictions if as_iterable is True. - -##### Raises: - - -* `ValueError`: If x and input_fn are both provided or both `None`. - - -- - - - -#### `tf.contrib.learn.Estimator.set_params(**params)` {#Estimator.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - - -- - - - -### `class tf.contrib.learn.Trainable` {#Trainable} - -Interface for objects that are trainable by, e.g., `Experiment`. -- - - - -#### `tf.contrib.learn.Trainable.fit(x=None, y=None, input_fn=None, steps=None, batch_size=None, monitors=None, max_steps=None)` {#Trainable.fit} - -Trains a model given training data `x` predictions and `y` labels. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...] or the dictionary of Matrices. - Can be iterator that returns arrays of features or dictionary of arrays of features. - The training input samples for fitting the model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs] or the dictionary of same. - Can be iterator that returns array of labels or dictionary of array of labels. - The training label values (class labels in classification, real numbers in regression). - If set, `input_fn` must be `None`. Note: For classification, label values must - be integers representing the class index (i.e. values from 0 to - n_classes-1). -* `input_fn`: Input function returning a tuple of: - features - `Tensor` or dictionary of string feature name to `Tensor`. - labels - `Tensor` or dictionary of `Tensor` with labels. - If input_fn is set, `x`, `y`, and `batch_size` must be `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. - 'steps' works incrementally. If you call two times fit(steps=10) then - training occurs in total 20 steps. If you don't want to have incremental - behaviour please set `max_steps` instead. If set, `max_steps` must be - `None`. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. -* `max_steps`: Number of total steps for which to train model. If `None`, - train forever. If set, `steps` must be `None`. - - Two calls to `fit(steps=100)` means 200 training - iterations. On the other hand, two calls to `fit(max_steps=100)` means - that the second call will not do any iteration since first call did - all 100 steps. - -##### Returns: - - `self`, for chaining. - - - -- - - - -### `class tf.contrib.learn.Evaluable` {#Evaluable} - -Interface for objects that are evaluatable by, e.g., `Experiment`. -- - - - -#### `tf.contrib.learn.Evaluable.evaluate(x=None, y=None, input_fn=None, feed_fn=None, batch_size=None, steps=None, metrics=None, name=None, checkpoint_path=None, hooks=None)` {#Evaluable.evaluate} - -Evaluates given model with provided evaluation data. - -Stop conditions - we evaluate on the given input data until one of the -following: -- If `steps` is provided, and `steps` batches of size `batch_size` are -processed. -- If `input_fn` is provided, and it raises an end-of-input -exception (`OutOfRangeError` or `StopIteration`). -- If `x` is provided, and all items in `x` have been processed. - -The return value is a dict containing the metrics specified in `metrics`, as -well as an entry `global_step` which contains the value of the global step -for which this evaluation was performed. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...] or dictionary of many matrices - containing the input samples for fitting the model. Can be iterator that returns - arrays of features or dictionary of array of features. If set, `input_fn` must - be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs] containing the - label values (class labels in classification, real numbers in - regression) or dictionary of multiple vectors/matrices. Can be iterator - that returns array of targets or dictionary of array of targets. If set, - `input_fn` must be `None`. Note: For classification, label values must - be integers representing the class index (i.e. values from 0 to - n_classes-1). -* `input_fn`: Input function returning a tuple of: - features - Dictionary of string feature name to `Tensor` or `Tensor`. - labels - `Tensor` or dictionary of `Tensor` with labels. - If input_fn is set, `x`, `y`, and `batch_size` must be `None`. If - `steps` is not provided, this should raise `OutOfRangeError` or - `StopIteration` after the desired amount of data (e.g., one epoch) has - been provided. See "Stop conditions" above for specifics. -* `feed_fn`: Function creating a feed dict every time it is called. Called - once per iteration. Must be `None` if `input_fn` is provided. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`, if specified. Must be `None` if `input_fn` is - provided. -* `steps`: Number of steps for which to evaluate model. If `None`, evaluate - until `x` is consumed or `input_fn` raises an end-of-input exception. - See "Stop conditions" above for specifics. -* `metrics`: Dict of metrics to run. If None, the default metric functions - are used; if {}, no metrics are used. Otherwise, `metrics` should map - friendly names for the metric to a `MetricSpec` object defining which - model outputs to evaluate against which labels with which metric - function. - - Metric ops should support streaming, e.g., returning `update_op` and - `value` tensors. For example, see the options defined in - `../../../metrics/python/ops/metrics_ops.py`. - -* `name`: Name of the evaluation if user needs to run multiple evaluations on - different data sets, such as on training data vs test data. -* `checkpoint_path`: Path of a specific checkpoint to evaluate. If `None`, the - latest checkpoint in `model_dir` is used. -* `hooks`: List of `SessionRunHook` subclass instances. Used for callbacks - inside the evaluation call. - -##### Returns: - - Returns `dict` with evaluation results. - - -- - - - -#### `tf.contrib.learn.Evaluable.model_dir` {#Evaluable.model_dir} - -Returns a path in which the eval process will look for checkpoints. - - - -- - - - -### `class tf.contrib.learn.KMeansClustering` {#KMeansClustering} - -An Estimator for K-Means clustering. -- - - - -#### `tf.contrib.learn.KMeansClustering.__init__(num_clusters, model_dir=None, initial_clusters='random', distance_metric='squared_euclidean', random_seed=0, use_mini_batch=True, mini_batch_steps_per_iteration=1, kmeans_plus_plus_num_retries=2, relative_tolerance=None, config=None)` {#KMeansClustering.__init__} - -Creates a model for running KMeans training and inference. - -##### Args: - - -* `num_clusters`: number of clusters to train. -* `model_dir`: the directory to save the model results and log files. -* `initial_clusters`: specifies how to initialize the clusters for training. - See clustering_ops.kmeans for the possible values. -* `distance_metric`: the distance metric used for clustering. - See clustering_ops.kmeans for the possible values. -* `random_seed`: Python integer. Seed for PRNG used to initialize centers. -* `use_mini_batch`: If true, use the mini-batch k-means algorithm. Else assume - full batch. -* `mini_batch_steps_per_iteration`: number of steps after which the updated - cluster centers are synced back to a master copy. See clustering_ops.py - for more details. -* `kmeans_plus_plus_num_retries`: For each point that is sampled during - kmeans++ initialization, this parameter specifies the number of - additional points to draw from the current distribution before selecting - the best. If a negative value is specified, a heuristic is used to - sample O(log(num_to_sample)) additional points. -* `relative_tolerance`: A relative tolerance of change in the loss between - iterations. Stops learning if the loss changes less than this amount. - Note that this may not work correctly if use_mini_batch=True. -* `config`: See Estimator - - -- - - - -#### `tf.contrib.learn.KMeansClustering.__repr__()` {#KMeansClustering.__repr__} - - - - -- - - - -#### `tf.contrib.learn.KMeansClustering.clusters()` {#KMeansClustering.clusters} - -Returns cluster centers. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.config` {#KMeansClustering.config} - - - - -- - - - -#### `tf.contrib.learn.KMeansClustering.evaluate(*args, **kwargs)` {#KMeansClustering.evaluate} - -See `Evaluable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If at least one of `x` or `y` is provided, and at least one of - `input_fn` or `feed_fn` is provided. - Or if `metrics` is not `None` or `dict`. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.export(*args, **kwargs)` {#KMeansClustering.export} - -Exports inference graph into given dir. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-23. -Instructions for updating: -The signature of the input_fn accepted by export is changing to be consistent with what's used by tf.Learn Estimator's train/evaluate. input_fn (and in most cases, input_feature_key) will become required args, and use_deprecated_input_fn will default to False and be removed altogether. - -##### Args: - - -* `export_dir`: A string containing a directory to write the exported graph - and checkpoints. -* `input_fn`: If `use_deprecated_input_fn` is true, then a function that given - `Tensor` of `Example` strings, parses it into features that are then - passed to the model. Otherwise, a function that takes no argument and - returns a tuple of (features, labels), where features is a dict of - string key to `Tensor` and labels is a `Tensor` that's currently not - used (and so can be `None`). -* `input_feature_key`: Only used if `use_deprecated_input_fn` is false. String - key into the features dict returned by `input_fn` that corresponds to a - the raw `Example` strings `Tensor` that the exported model will take as - input. Can only be `None` if you're using a custom `signature_fn` that - does not use the first arg (examples). -* `use_deprecated_input_fn`: Determines the signature format of `input_fn`. -* `signature_fn`: Function that returns a default signature and a named - signature map, given `Tensor` of `Example` strings, `dict` of `Tensor`s - for features and `Tensor` or `dict` of `Tensor`s for predictions. -* `prediction_key`: The key for a tensor in the `predictions` dict (output - from the `model_fn`) to use as the `predictions` input to the - `signature_fn`. Optional. If `None`, predictions will pass to - `signature_fn` without filtering. -* `default_batch_size`: Default batch size of the `Example` placeholder. -* `exports_to_keep`: Number of exports to keep. -* `checkpoint_path`: the checkpoint path of the model to be exported. If it is - `None` (which is default), will use the latest checkpoint in - export_dir. - -##### Returns: - - The string path to the exported directory. NB: this functionality was - added ca. 2016/09/25; clients that depend on the return value may need - to handle the case where this function returns None because subclasses - are not returning a value. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#KMeansClustering.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.fit(*args, **kwargs)` {#KMeansClustering.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.get_params(deep=True)` {#KMeansClustering.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.get_variable_names()` {#KMeansClustering.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.get_variable_value(name)` {#KMeansClustering.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.model_dir` {#KMeansClustering.model_dir} - - - - -- - - - -#### `tf.contrib.learn.KMeansClustering.partial_fit(*args, **kwargs)` {#KMeansClustering.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.predict(*args, **kwargs)` {#KMeansClustering.predict} - -Returns predictions for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x` and 'batch_size' must be `None`. -* `batch_size`: Override default batch size. If set, 'input_fn' must be - 'None'. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns all. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - A numpy array of predicted classes or regression values if the - constructor's `model_fn` returns a `Tensor` for `predictions` or a `dict` - of numpy arrays if `model_fn` returns a `dict`. Returns an iterable of - predictions if as_iterable is True. - -##### Raises: - - -* `ValueError`: If x and input_fn are both provided or both `None`. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.predict_cluster_idx(input_fn=None)` {#KMeansClustering.predict_cluster_idx} - -Yields predicted cluster indices. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.score(input_fn=None, steps=None)` {#KMeansClustering.score} - -Predict total sum of distances to nearest clusters. - -Note that this function is different from the corresponding one in sklearn -which returns the negative of the sum of distances. - -##### Args: - - -* `input_fn`: see predict. -* `steps`: see predict. - -##### Returns: - - Total sum of distances to nearest clusters. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.set_params(**params)` {#KMeansClustering.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.transform(input_fn=None, as_iterable=False)` {#KMeansClustering.transform} - -Transforms each element to distances to cluster centers. - -Note that this function is different from the corresponding one in sklearn. -For SQUARED_EUCLIDEAN distance metric, sklearn transform returns the -EUCLIDEAN distance, while this function returns the SQUARED_EUCLIDEAN -distance. - -##### Args: - - -* `input_fn`: see predict. -* `as_iterable`: see predict - -##### Returns: - - Array with same number of rows as x, and num_clusters columns, containing - distances to the cluster centers. - - - -- - - - -### `class tf.contrib.learn.ModeKeys` {#ModeKeys} - -Standard names for model modes. - -The following standard keys are defined: - -* `TRAIN`: training mode. -* `EVAL`: evaluation mode. -* `INFER`: inference mode. - -- - - - -### `class tf.contrib.learn.ModelFnOps` {#ModelFnOps} - -Ops returned from a model_fn. -- - - - -#### `tf.contrib.learn.ModelFnOps.__getnewargs__()` {#ModelFnOps.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.contrib.learn.ModelFnOps.__getstate__()` {#ModelFnOps.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.contrib.learn.ModelFnOps.__new__(cls, mode, predictions=None, loss=None, train_op=None, eval_metric_ops=None, output_alternatives=None, training_chief_hooks=None, training_hooks=None, scaffold=None)` {#ModelFnOps.__new__} - -Creates a validated `ModelFnOps` instance. - -For a multi-headed model, the predictions dict here will contain the outputs -of all of the heads. However: at serving time, requests will be made -specifically for one or more heads, and the RPCs used for these requests may -differ by problem type (i.e., regression, classification, other). The -purpose of the output_alternatives dict is to aid in exporting a SavedModel -from which such head-specific queries can be served. These -output_alternatives will be combined with input_alternatives (see -`saved_model_export_utils`) to produce a set of `SignatureDef`s specifying -the valid requests that can be served from this model. - -For a single-headed model, it is still adviseable to provide -output_alternatives with a single entry, because this is how the problem -type is communicated for export and serving. If output_alternatives is not -given, the resulting SavedModel will support only one head of unspecified -type. - -##### Args: - - -* `mode`: One of `ModeKeys`. Specifies if this training, evaluation or - prediction. -* `predictions`: Predictions `Tensor` or dict of `Tensor`. -* `loss`: Training loss `Tensor`. -* `train_op`: Op for the training step. -* `eval_metric_ops`: Dict of metric results keyed by name. The values of the - dict are the results of calling a metric function, such as `Tensor`. -* `output_alternatives`: a dict of - `{submodel_name: (problem_type, {tensor_name: Tensor})}`, where - `submodel_name` is a submodel identifier that should be consistent - across the pipeline (here likely taken from the name of each `Head`, - for models that use them), `problem_type` is a `ProblemType`, - `tensor_name` is a symbolic name for an output Tensor possibly but not - necessarily taken from `PredictionKey`, and `Tensor` is the - corresponding output Tensor itself. -* `training_chief_hooks`: A list of `SessionRunHook` objects that will be - run on the chief worker during training. -* `training_hooks`: A list of `SessionRunHook` objects that will be run on - all workers during training. -* `scaffold`: A `tf.train.Scaffold` object that can be used to set - initialization, saver, and more to be used in training. - -##### Returns: - - A validated `ModelFnOps` object. - -##### Raises: - - -* `ValueError`: If validation fails. - - -- - - - -#### `tf.contrib.learn.ModelFnOps.__repr__()` {#ModelFnOps.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.contrib.learn.ModelFnOps.eval_metric_ops` {#ModelFnOps.eval_metric_ops} - -Alias for field number 3 - - -- - - - -#### `tf.contrib.learn.ModelFnOps.loss` {#ModelFnOps.loss} - -Alias for field number 1 - - -- - - - -#### `tf.contrib.learn.ModelFnOps.output_alternatives` {#ModelFnOps.output_alternatives} - -Alias for field number 4 - - -- - - - -#### `tf.contrib.learn.ModelFnOps.predictions` {#ModelFnOps.predictions} - -Alias for field number 0 - - -- - - - -#### `tf.contrib.learn.ModelFnOps.scaffold` {#ModelFnOps.scaffold} - -Alias for field number 7 - - -- - - - -#### `tf.contrib.learn.ModelFnOps.train_op` {#ModelFnOps.train_op} - -Alias for field number 2 - - -- - - - -#### `tf.contrib.learn.ModelFnOps.training_chief_hooks` {#ModelFnOps.training_chief_hooks} - -Alias for field number 5 - - -- - - - -#### `tf.contrib.learn.ModelFnOps.training_hooks` {#ModelFnOps.training_hooks} - -Alias for field number 6 - - - -- - - - -### `class tf.contrib.learn.MetricSpec` {#MetricSpec} - -MetricSpec connects a model to metric functions. - -The MetricSpec class contains all information necessary to connect the -output of a `model_fn` to the metrics (usually, streaming metrics) that are -used in evaluation. - -It is passed in the `metrics` argument of `Estimator.evaluate`. The -`Estimator` then knows which predictions, labels, and weight to use to call a -given metric function. - -When building the ops to run in evaluation, `Estimator` will call -`create_metric_ops`, which will connect the given `metric_fn` to the model -as detailed in the docstring for `create_metric_ops`, and return the metric. - -Example: - -Assuming a model has an input function which returns inputs containing -(among other things) a tensor with key "input_key", and a labels dictionary -containing "label_key". Let's assume that the `model_fn` for this model -returns a prediction with key "prediction_key". - -In order to compute the accuracy of the "prediction_key" prediction, we -would add - -``` -"prediction accuracy": MetricSpec(metric_fn=prediction_accuracy_fn, - prediction_key="prediction_key", - label_key="label_key") -``` - -to the metrics argument to `evaluate`. `prediction_accuracy_fn` can be either -a predefined function in metric_ops (e.g., `streaming_accuracy`) or a custom -function you define. - -If we would like the accuracy to be weighted by "input_key", we can add that -as the `weight_key` argument. - -``` -"prediction accuracy": MetricSpec(metric_fn=prediction_accuracy_fn, - prediction_key="prediction_key", - label_key="label_key", - weight_key="input_key") -``` - -An end-to-end example is as follows: - -``` -estimator = tf.contrib.learn.Estimator(...) -estimator.fit(...) -_ = estimator.evaluate( - input_fn=input_fn, - steps=1, - metrics={ - 'prediction accuracy': - metric_spec.MetricSpec( - metric_fn=prediction_accuracy_fn, - prediction_key="prediction_key", - label_key="label_key") - }) -``` -- - - - -#### `tf.contrib.learn.MetricSpec.__init__(metric_fn, prediction_key=None, label_key=None, weight_key=None)` {#MetricSpec.__init__} - -Constructor. - -Creates a MetricSpec. - -##### Args: - - -* `metric_fn`: A function to use as a metric. See `_adapt_metric_fn` for - rules on how `predictions`, `labels`, and `weights` are passed to this - function. This must return either a single `Tensor`, which is - interpreted as a value of this metric, or a pair - `(value_op, update_op)`, where `value_op` is the op to call to - obtain the value of the metric, and `update_op` should be run for - each batch to update internal state. -* `prediction_key`: The key for a tensor in the `predictions` dict (output - from the `model_fn`) to use as the `predictions` input to the - `metric_fn`. Optional. If `None`, the `model_fn` must return a single - tensor or a dict with only a single entry as `predictions`. -* `label_key`: The key for a tensor in the `labels` dict (output from the - `input_fn`) to use as the `labels` input to the `metric_fn`. - Optional. If `None`, the `input_fn` must return a single tensor or a - dict with only a single entry as `labels`. -* `weight_key`: The key for a tensor in the `inputs` dict (output from the - `input_fn`) to use as the `weights` input to the `metric_fn`. - Optional. If `None`, no weights will be passed to the `metric_fn`. - - -- - - - -#### `tf.contrib.learn.MetricSpec.__str__()` {#MetricSpec.__str__} - - - - -- - - - -#### `tf.contrib.learn.MetricSpec.create_metric_ops(inputs, labels, predictions)` {#MetricSpec.create_metric_ops} - -Connect our `metric_fn` to the specified members of the given dicts. - -This function will call the `metric_fn` given in our constructor as follows: - -``` - metric_fn(predictions[self.prediction_key], - labels[self.label_key], - weights=weights[self.weight_key]) -``` - -And returns the result. The `weights` argument is only passed if -`self.weight_key` is not `None`. - -`predictions` and `labels` may be single tensors as well as dicts. If -`predictions` is a single tensor, `self.prediction_key` must be `None`. If -`predictions` is a single element dict, `self.prediction_key` is allowed to -be `None`. Conversely, if `labels` is a single tensor, `self.label_key` must -be `None`. If `labels` is a single element dict, `self.label_key` is allowed -to be `None`. - -##### Args: - - -* `inputs`: A dict of inputs produced by the `input_fn` -* `labels`: A dict of labels or a single label tensor produced by the - `input_fn`. -* `predictions`: A dict of predictions or a single tensor produced by the - `model_fn`. - -##### Returns: - - The result of calling `metric_fn`. - -##### Raises: - - -* `ValueError`: If `predictions` or `labels` is a single `Tensor` and - `self.prediction_key` or `self.label_key` is not `None`; or if - `self.label_key` is `None` but `labels` is a dict with more than one - element, or if `self.prediction_key` is `None` but `predictions` is a - dict with more than one element. - - -- - - - -#### `tf.contrib.learn.MetricSpec.label_key` {#MetricSpec.label_key} - - - - -- - - - -#### `tf.contrib.learn.MetricSpec.metric_fn` {#MetricSpec.metric_fn} - -Metric function. - -This function accepts named args: `predictions`, `labels`, `weights`. It -returns a single `Tensor` or `(value_op, update_op)` pair. See `metric_fn` -constructor argument for more details. - -##### Returns: - - Function, see `metric_fn` constructor argument for more details. - - -- - - - -#### `tf.contrib.learn.MetricSpec.prediction_key` {#MetricSpec.prediction_key} - - - - -- - - - -#### `tf.contrib.learn.MetricSpec.weight_key` {#MetricSpec.weight_key} - - - - - -- - - - -### `class tf.contrib.learn.PredictionKey` {#PredictionKey} - - - -- - - - -### `class tf.contrib.learn.DNNClassifier` {#DNNClassifier} - -A classifier for TensorFlow DNN models. - -Example: - -```python -sparse_feature_a = sparse_column_with_hash_bucket(...) -sparse_feature_b = sparse_column_with_hash_bucket(...) - -sparse_feature_a_emb = embedding_column(sparse_id_column=sparse_feature_a, - ...) -sparse_feature_b_emb = embedding_column(sparse_id_column=sparse_feature_b, - ...) - -estimator = DNNClassifier( - feature_columns=[sparse_feature_a_emb, sparse_feature_b_emb], - hidden_units=[1024, 512, 256]) - -# Or estimator using the ProximalAdagradOptimizer optimizer with -# regularization. -estimator = DNNClassifier( - feature_columns=[sparse_feature_a_emb, sparse_feature_b_emb], - hidden_units=[1024, 512, 256], - optimizer=tf.train.ProximalAdagradOptimizer( - learning_rate=0.1, - l1_regularization_strength=0.001 - )) - -# Input builders -def input_fn_train: # returns x, y (where y represents label's class index). - pass -estimator.fit(input_fn=input_fn_train) - -def input_fn_eval: # returns x, y (where y represents label's class index). - pass -estimator.evaluate(input_fn=input_fn_eval) -estimator.predict(x=x) # returns predicted labels (i.e. label's class index). -``` - -Input of `fit` and `evaluate` should have following features, - otherwise there will be a `KeyError`: - -* if `weight_column_name` is not `None`, a feature with - `key=weight_column_name` whose value is a `Tensor`. -* for each `column` in `feature_columns`: - - if `column` is a `SparseColumn`, a feature with `key=column.name` - whose `value` is a `SparseTensor`. - - if `column` is a `WeightedSparseColumn`, two features: the first with - `key` the id column name, the second with `key` the weight column name. - Both features' `value` must be a `SparseTensor`. - - if `column` is a `RealValuedColumn`, a feature with `key=column.name` - whose `value` is a `Tensor`. -- - - - -#### `tf.contrib.learn.DNNClassifier.__init__(hidden_units, feature_columns, model_dir=None, n_classes=2, weight_column_name=None, optimizer=None, activation_fn=relu, dropout=None, gradient_clip_norm=None, enable_centered_bias=False, config=None, feature_engineering_fn=None, embedding_lr_multipliers=None, input_layer_min_slice_size=None)` {#DNNClassifier.__init__} - -Initializes a DNNClassifier instance. - -##### Args: - - -* `hidden_units`: List of hidden units per layer. All layers are fully - connected. Ex. `[64, 32]` means first layer has 64 nodes and second one - has 32. -* `feature_columns`: An iterable containing all the feature columns used by - the model. All items in the set should be instances of classes derived - from `FeatureColumn`. -* `model_dir`: Directory to save model parameters, graph and etc. This can - also be used to load checkpoints from the directory into a estimator to - continue training a previously saved model. -* `n_classes`: number of label classes. Default is binary classification. - It must be greater than 1. Note: Class labels are integers representing - the class index (i.e. values from 0 to n_classes-1). For arbitrary - label values (e.g. string labels), convert to class indices first. -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. It - will be multiplied by the loss of the example. -* `optimizer`: An instance of `tf.Optimizer` used to train the model. If - `None`, will use an Adagrad optimizer. -* `activation_fn`: Activation function applied to each layer. If `None`, will - use `tf.nn.relu`. -* `dropout`: When not `None`, the probability we will drop out a given - coordinate. -* `gradient_clip_norm`: A float > 0. If provided, gradients are - clipped to their global norm with this clipping ratio. See - `tf.clip_by_global_norm` for more details. -* `enable_centered_bias`: A bool. If True, estimator will learn a centered - bias variable for each class. Rest of the model structure learns the - residual after centered bias. -* `config`: `RunConfig` object to configure the runtime settings. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into the model. -* `embedding_lr_multipliers`: Optional. A dictionary from `EmbeddingColumn` to - a `float` multiplier. Multiplier will be used to multiply with - learning rate for the embedding variables. -* `input_layer_min_slice_size`: Optional. The min slice size of input layer - partitions. If not provided, will use the default of 64M. - -##### Returns: - - A `DNNClassifier` estimator. - -##### Raises: - - -* `ValueError`: If `n_classes` < 2. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.__repr__()` {#DNNClassifier.__repr__} - - - - -- - - - -#### `tf.contrib.learn.DNNClassifier.bias_` {#DNNClassifier.bias_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - -- - - - -#### `tf.contrib.learn.DNNClassifier.config` {#DNNClassifier.config} - - - - -- - - - -#### `tf.contrib.learn.DNNClassifier.evaluate(*args, **kwargs)` {#DNNClassifier.evaluate} - -See `Evaluable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If at least one of `x` or `y` is provided, and at least one of - `input_fn` or `feed_fn` is provided. - Or if `metrics` is not `None` or `dict`. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.export(export_dir, input_fn=None, input_feature_key=None, use_deprecated_input_fn=True, signature_fn=None, default_batch_size=1, exports_to_keep=None)` {#DNNClassifier.export} - -See BaseEstimator.export. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#DNNClassifier.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.fit(*args, **kwargs)` {#DNNClassifier.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.get_params(deep=True)` {#DNNClassifier.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.get_variable_names()` {#DNNClassifier.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.get_variable_value(name)` {#DNNClassifier.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.model_dir` {#DNNClassifier.model_dir} - - - - -- - - - -#### `tf.contrib.learn.DNNClassifier.partial_fit(*args, **kwargs)` {#DNNClassifier.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.predict(*args, **kwargs)` {#DNNClassifier.predict} - -Returns predictions for given features. (deprecated arguments) (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2017-03-01. -Instructions for updating: -Please switch to predict_classes, or set `outputs` argument. - -By default, returns predicted classes. But this default will be dropped -soon. Users should either pass `outputs`, or call `predict_classes` method. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns classes. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted classes with shape [batch_size] (or an iterable - of predicted classes if as_iterable is True). Each predicted class is - represented by its class index (i.e. integer from 0 to n_classes-1). - If `outputs` is set, returns a dict of predictions. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.predict_classes(*args, **kwargs)` {#DNNClassifier.predict_classes} - -Returns predicted classes for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted classes with shape [batch_size] (or an iterable - of predicted classes if as_iterable is True). Each predicted class is - represented by its class index (i.e. integer from 0 to n_classes-1). - - -- - - - -#### `tf.contrib.learn.DNNClassifier.predict_proba(*args, **kwargs)` {#DNNClassifier.predict_proba} - -Returns predicted probabilities for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x and y must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted probabilities with shape [batch_size, n_classes] - (or an iterable of predicted probabilities if as_iterable is True). - - -- - - - -#### `tf.contrib.learn.DNNClassifier.set_params(**params)` {#DNNClassifier.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.weights_` {#DNNClassifier.weights_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - - -- - - - -### `class tf.contrib.learn.DNNRegressor` {#DNNRegressor} - -A regressor for TensorFlow DNN models. - -Example: - -```python -sparse_feature_a = sparse_column_with_hash_bucket(...) -sparse_feature_b = sparse_column_with_hash_bucket(...) - -sparse_feature_a_emb = embedding_column(sparse_id_column=sparse_feature_a, - ...) -sparse_feature_b_emb = embedding_column(sparse_id_column=sparse_feature_b, - ...) - -estimator = DNNRegressor( - feature_columns=[sparse_feature_a, sparse_feature_b], - hidden_units=[1024, 512, 256]) - -# Or estimator using the ProximalAdagradOptimizer optimizer with -# regularization. -estimator = DNNRegressor( - feature_columns=[sparse_feature_a, sparse_feature_b], - hidden_units=[1024, 512, 256], - optimizer=tf.train.ProximalAdagradOptimizer( - learning_rate=0.1, - l1_regularization_strength=0.001 - )) - -# Input builders -def input_fn_train: # returns x, y - pass -estimator.fit(input_fn=input_fn_train) - -def input_fn_eval: # returns x, y - pass -estimator.evaluate(input_fn=input_fn_eval) -estimator.predict(x=x) -``` - -Input of `fit` and `evaluate` should have following features, - otherwise there will be a `KeyError`: - -* if `weight_column_name` is not `None`, a feature with - `key=weight_column_name` whose value is a `Tensor`. -* for each `column` in `feature_columns`: - - if `column` is a `SparseColumn`, a feature with `key=column.name` - whose `value` is a `SparseTensor`. - - if `column` is a `WeightedSparseColumn`, two features: the first with - `key` the id column name, the second with `key` the weight column name. - Both features' `value` must be a `SparseTensor`. - - if `column` is a `RealValuedColumn`, a feature with `key=column.name` - whose `value` is a `Tensor`. -- - - - -#### `tf.contrib.learn.DNNRegressor.__init__(hidden_units, feature_columns, model_dir=None, weight_column_name=None, optimizer=None, activation_fn=relu, dropout=None, gradient_clip_norm=None, enable_centered_bias=False, config=None, feature_engineering_fn=None, label_dimension=1, embedding_lr_multipliers=None, input_layer_min_slice_size=None)` {#DNNRegressor.__init__} - -Initializes a `DNNRegressor` instance. - -##### Args: - - -* `hidden_units`: List of hidden units per layer. All layers are fully - connected. Ex. `[64, 32]` means first layer has 64 nodes and second one - has 32. -* `feature_columns`: An iterable containing all the feature columns used by - the model. All items in the set should be instances of classes derived - from `FeatureColumn`. -* `model_dir`: Directory to save model parameters, graph and etc. This can - also be used to load checkpoints from the directory into a estimator to - continue training a previously saved model. -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. It - will be multiplied by the loss of the example. -* `optimizer`: An instance of `tf.Optimizer` used to train the model. If - `None`, will use an Adagrad optimizer. -* `activation_fn`: Activation function applied to each layer. If `None`, will - use `tf.nn.relu`. -* `dropout`: When not `None`, the probability we will drop out a given - coordinate. -* `gradient_clip_norm`: A `float` > 0. If provided, gradients are clipped - to their global norm with this clipping ratio. See - `tf.clip_by_global_norm` for more details. -* `enable_centered_bias`: A bool. If True, estimator will learn a centered - bias variable for each class. Rest of the model structure learns the - residual after centered bias. -* `config`: `RunConfig` object to configure the runtime settings. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into the model. -* `label_dimension`: Number of regression targets per example. This is the - size of the last dimension of the labels and logits `Tensor` objects - (typically, these have shape `[batch_size, label_dimension]`). -* `embedding_lr_multipliers`: Optional. A dictionary from `EbeddingColumn` to - a `float` multiplier. Multiplier will be used to multiply with - learning rate for the embedding variables. -* `input_layer_min_slice_size`: Optional. The min slice size of input layer - partitions. If not provided, will use the default of 64M. - -##### Returns: - - A `DNNRegressor` estimator. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.__repr__()` {#DNNRegressor.__repr__} - - - - -- - - - -#### `tf.contrib.learn.DNNRegressor.config` {#DNNRegressor.config} - - - - -- - - - -#### `tf.contrib.learn.DNNRegressor.evaluate(x=None, y=None, input_fn=None, feed_fn=None, batch_size=None, steps=None, metrics=None, name=None, checkpoint_path=None, hooks=None)` {#DNNRegressor.evaluate} - -See evaluable.Evaluable. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.export(export_dir, input_fn=None, input_feature_key=None, use_deprecated_input_fn=True, signature_fn=None, default_batch_size=1, exports_to_keep=None)` {#DNNRegressor.export} - -See BaseEstimator.export. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#DNNRegressor.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.fit(*args, **kwargs)` {#DNNRegressor.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.get_params(deep=True)` {#DNNRegressor.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.get_variable_names()` {#DNNRegressor.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.get_variable_value(name)` {#DNNRegressor.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.model_dir` {#DNNRegressor.model_dir} - - - - -- - - - -#### `tf.contrib.learn.DNNRegressor.partial_fit(*args, **kwargs)` {#DNNRegressor.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.predict(*args, **kwargs)` {#DNNRegressor.predict} - -Returns predictions for given features. (deprecated arguments) (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2017-03-01. -Instructions for updating: -Please switch to predict_scores, or set `outputs` argument. - -By default, returns predicted scores. But this default will be dropped -soon. Users should either pass `outputs`, or call `predict_scores` method. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns scores. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted scores (or an iterable of predicted scores if - as_iterable is True). If `label_dimension == 1`, the shape of the output - is `[batch_size]`, otherwise the shape is `[batch_size, label_dimension]`. - If `outputs` is set, returns a dict of predictions. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.predict_scores(*args, **kwargs)` {#DNNRegressor.predict_scores} - -Returns predicted scores for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted scores (or an iterable of predicted scores if - as_iterable is True). If `label_dimension == 1`, the shape of the output - is `[batch_size]`, otherwise the shape is `[batch_size, label_dimension]`. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.set_params(**params)` {#DNNRegressor.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - - -- - - - -### `class tf.contrib.learn.DNNLinearCombinedRegressor` {#DNNLinearCombinedRegressor} - -A regressor for TensorFlow Linear and DNN joined training models. - -Example: - -```python -sparse_feature_a = sparse_column_with_hash_bucket(...) -sparse_feature_b = sparse_column_with_hash_bucket(...) - -sparse_feature_a_x_sparse_feature_b = crossed_column(...) - -sparse_feature_a_emb = embedding_column(sparse_id_column=sparse_feature_a, - ...) -sparse_feature_b_emb = embedding_column(sparse_id_column=sparse_feature_b, - ...) - -estimator = DNNLinearCombinedRegressor( - # common settings - weight_column_name=weight_column_name, - # wide settings - linear_feature_columns=[sparse_feature_a_x_sparse_feature_b], - linear_optimizer=tf.train.FtrlOptimizer(...), - # deep settings - dnn_feature_columns=[sparse_feature_a_emb, sparse_feature_b_emb], - dnn_hidden_units=[1000, 500, 100], - dnn_optimizer=tf.train.ProximalAdagradOptimizer(...)) - -# To apply L1 and L2 regularization, you can set optimizers as follows: -tf.train.ProximalAdagradOptimizer( - learning_rate=0.1, - l1_regularization_strength=0.001, - l2_regularization_strength=0.001) -# It is same for FtrlOptimizer. - -# Input builders -def input_fn_train: # returns x, y - ... -def input_fn_eval: # returns x, y - ... -estimator.train(input_fn_train) -estimator.evaluate(input_fn_eval) -estimator.predict(x) -``` - -Input of `fit`, `train`, and `evaluate` should have following features, - otherwise there will be a `KeyError`: - if `weight_column_name` is not `None`, a feature with - `key=weight_column_name` whose value is a `Tensor`. - for each `column` in `dnn_feature_columns` + `linear_feature_columns`: - - if `column` is a `SparseColumn`, a feature with `key=column.name` - whose `value` is a `SparseTensor`. - - if `column` is a `WeightedSparseColumn`, two features: the first with - `key` the id column name, the second with `key` the weight column name. - Both features' `value` must be a `SparseTensor`. - - if `column` is a `RealValuedColumn, a feature with `key=column.name` - whose `value` is a `Tensor`. -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.__init__(model_dir=None, weight_column_name=None, linear_feature_columns=None, linear_optimizer=None, _joint_linear_weights=False, dnn_feature_columns=None, dnn_optimizer=None, dnn_hidden_units=None, dnn_activation_fn=relu, dnn_dropout=None, gradient_clip_norm=None, enable_centered_bias=False, label_dimension=1, config=None, feature_engineering_fn=None, embedding_lr_multipliers=None, input_layer_min_slice_size=None)` {#DNNLinearCombinedRegressor.__init__} - -Initializes a DNNLinearCombinedRegressor instance. - -##### Args: - - -* `model_dir`: Directory to save model parameters, graph and etc. This can - also be used to load checkpoints from the directory into a estimator - to continue training a previously saved model. -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. It - will be multiplied by the loss of the example. -* `linear_feature_columns`: An iterable containing all the feature columns - used by linear part of the model. All items in the set must be - instances of classes derived from `FeatureColumn`. -* `linear_optimizer`: An instance of `tf.Optimizer` used to apply gradients to - the linear part of the model. If `None`, will use a FTRL optimizer. - _joint_linear_weights: If True a single (possibly partitioned) variable - will be used to store the linear model weights. It's faster, but - requires that all columns are sparse and have the 'sum' combiner. - -* `dnn_feature_columns`: An iterable containing all the feature columns used - by deep part of the model. All items in the set must be instances of - classes derived from `FeatureColumn`. -* `dnn_optimizer`: An instance of `tf.Optimizer` used to apply gradients to - the deep part of the model. If `None`, will use an Adagrad optimizer. -* `dnn_hidden_units`: List of hidden units per layer. All layers are fully - connected. -* `dnn_activation_fn`: Activation function applied to each layer. If None, - will use `tf.nn.relu`. -* `dnn_dropout`: When not None, the probability we will drop out - a given coordinate. -* `gradient_clip_norm`: A float > 0. If provided, gradients are clipped - to their global norm with this clipping ratio. See - tf.clip_by_global_norm for more details. -* `enable_centered_bias`: A bool. If True, estimator will learn a centered - bias variable for each class. Rest of the model structure learns the - residual after centered bias. -* `label_dimension`: Number of regression targets per example. This is the - size of the last dimension of the labels and logits `Tensor` objects - (typically, these have shape `[batch_size, label_dimension]`). -* `config`: RunConfig object to configure the runtime settings. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into the model. -* `embedding_lr_multipliers`: Optional. A dictionary from `EmbeddingColumn` to - a `float` multiplier. Multiplier will be used to multiply with - learning rate for the embedding variables. -* `input_layer_min_slice_size`: Optional. The min slice size of input layer - partitions. If not provided, will use the default of 64M. - - -##### Raises: - - -* `ValueError`: If both linear_feature_columns and dnn_features_columns are - empty at the same time. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.__repr__()` {#DNNLinearCombinedRegressor.__repr__} - - - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.config` {#DNNLinearCombinedRegressor.config} - - - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.evaluate(x=None, y=None, input_fn=None, feed_fn=None, batch_size=None, steps=None, metrics=None, name=None, checkpoint_path=None, hooks=None)` {#DNNLinearCombinedRegressor.evaluate} - -See evaluable.Evaluable. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.export(export_dir, input_fn=None, input_feature_key=None, use_deprecated_input_fn=True, signature_fn=None, default_batch_size=1, exports_to_keep=None)` {#DNNLinearCombinedRegressor.export} - -See BaseEstimator.export. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#DNNLinearCombinedRegressor.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.fit(*args, **kwargs)` {#DNNLinearCombinedRegressor.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.get_params(deep=True)` {#DNNLinearCombinedRegressor.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.get_variable_names()` {#DNNLinearCombinedRegressor.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.get_variable_value(name)` {#DNNLinearCombinedRegressor.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.model_dir` {#DNNLinearCombinedRegressor.model_dir} - - - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.partial_fit(*args, **kwargs)` {#DNNLinearCombinedRegressor.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.predict(*args, **kwargs)` {#DNNLinearCombinedRegressor.predict} - -Returns predictions for given features. (deprecated arguments) (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2017-03-01. -Instructions for updating: -Please switch to predict_scores, or set `outputs` argument. - -By default, returns predicted scores. But this default will be dropped -soon. Users should either pass `outputs`, or call `predict_scores` method. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns scores. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted scores (or an iterable of predicted scores if - as_iterable is True). If `label_dimension == 1`, the shape of the output - is `[batch_size]`, otherwise the shape is `[batch_size, label_dimension]`. - If `outputs` is set, returns a dict of predictions. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.predict_scores(*args, **kwargs)` {#DNNLinearCombinedRegressor.predict_scores} - -Returns predicted scores for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted scores (or an iterable of predicted scores if - as_iterable is True). If `label_dimension == 1`, the shape of the output - is `[batch_size]`, otherwise the shape is `[batch_size, label_dimension]`. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.set_params(**params)` {#DNNLinearCombinedRegressor.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - - -- - - - -### `class tf.contrib.learn.DNNLinearCombinedClassifier` {#DNNLinearCombinedClassifier} - -A classifier for TensorFlow Linear and DNN joined training models. - -Example: - -```python -sparse_feature_a = sparse_column_with_hash_bucket(...) -sparse_feature_b = sparse_column_with_hash_bucket(...) - -sparse_feature_a_x_sparse_feature_b = crossed_column(...) - -sparse_feature_a_emb = embedding_column(sparse_id_column=sparse_feature_a, - ...) -sparse_feature_b_emb = embedding_column(sparse_id_column=sparse_feature_b, - ...) - -estimator = DNNLinearCombinedClassifier( - # common settings - n_classes=n_classes, - weight_column_name=weight_column_name, - # wide settings - linear_feature_columns=[sparse_feature_a_x_sparse_feature_b], - linear_optimizer=tf.train.FtrlOptimizer(...), - # deep settings - dnn_feature_columns=[sparse_feature_a_emb, sparse_feature_b_emb], - dnn_hidden_units=[1000, 500, 100], - dnn_optimizer=tf.train.AdagradOptimizer(...)) - -# Input builders -def input_fn_train: # returns x, y (where y represents label's class index). - ... -def input_fn_eval: # returns x, y (where y represents label's class index). - ... -estimator.fit(input_fn=input_fn_train) -estimator.evaluate(input_fn=input_fn_eval) -estimator.predict(x=x) # returns predicted labels (i.e. label's class index). -``` - -Input of `fit` and `evaluate` should have following features, - otherwise there will be a `KeyError`: - if `weight_column_name` is not `None`, a feature with - `key=weight_column_name` whose value is a `Tensor`. - for each `column` in `dnn_feature_columns` + `linear_feature_columns`: - - if `column` is a `SparseColumn`, a feature with `key=column.name` - whose `value` is a `SparseTensor`. - - if `column` is a `WeightedSparseColumn`, two features: the first with - `key` the id column name, the second with `key` the weight column name. - Both features' `value` must be a `SparseTensor`. - - if `column` is a `RealValuedColumn, a feature with `key=column.name` - whose `value` is a `Tensor`. -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.__init__(model_dir=None, n_classes=2, weight_column_name=None, linear_feature_columns=None, linear_optimizer=None, _joint_linear_weights=False, dnn_feature_columns=None, dnn_optimizer=None, dnn_hidden_units=None, dnn_activation_fn=relu, dnn_dropout=None, gradient_clip_norm=None, enable_centered_bias=False, config=None, feature_engineering_fn=None, embedding_lr_multipliers=None, input_layer_min_slice_size=None)` {#DNNLinearCombinedClassifier.__init__} - -Constructs a DNNLinearCombinedClassifier instance. - -##### Args: - - -* `model_dir`: Directory to save model parameters, graph and etc. This can - also be used to load checkpoints from the directory into a estimator - to continue training a previously saved model. -* `n_classes`: number of label classes. Default is binary classification. - Note that class labels are integers representing the class index (i.e. - values from 0 to n_classes-1). For arbitrary label values (e.g. string - labels), convert to class indices first. -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. - It will be multiplied by the loss of the example. -* `linear_feature_columns`: An iterable containing all the feature columns - used by linear part of the model. All items in the set must be - instances of classes derived from `FeatureColumn`. -* `linear_optimizer`: An instance of `tf.Optimizer` used to apply gradients to - the linear part of the model. If `None`, will use a FTRL optimizer. - _joint_linear_weights: If True a single (possibly partitioned) variable - will be used to store the linear model weights. It's faster, but - requires all columns are sparse and have the 'sum' combiner. - -* `dnn_feature_columns`: An iterable containing all the feature columns used - by deep part of the model. All items in the set must be instances of - classes derived from `FeatureColumn`. -* `dnn_optimizer`: An instance of `tf.Optimizer` used to apply gradients to - the deep part of the model. If `None`, will use an Adagrad optimizer. -* `dnn_hidden_units`: List of hidden units per layer. All layers are fully - connected. -* `dnn_activation_fn`: Activation function applied to each layer. If `None`, - will use `tf.nn.relu`. -* `dnn_dropout`: When not None, the probability we will drop out - a given coordinate. -* `gradient_clip_norm`: A float > 0. If provided, gradients are clipped - to their global norm with this clipping ratio. See - tf.clip_by_global_norm for more details. -* `enable_centered_bias`: A bool. If True, estimator will learn a centered - bias variable for each class. Rest of the model structure learns the - residual after centered bias. -* `config`: RunConfig object to configure the runtime settings. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into the model. -* `embedding_lr_multipliers`: Optional. A dictionary from `EmbeddingColumn` to - a `float` multiplier. Multiplier will be used to multiply with - learning rate for the embedding variables. -* `input_layer_min_slice_size`: Optional. The min slice size of input layer - partitions. If not provided, will use the default of 64M. - -##### Raises: - - -* `ValueError`: If `n_classes` < 2. -* `ValueError`: If both `linear_feature_columns` and `dnn_features_columns` - are empty at the same time. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.__repr__()` {#DNNLinearCombinedClassifier.__repr__} - - - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.config` {#DNNLinearCombinedClassifier.config} - - - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.dnn_bias_` {#DNNLinearCombinedClassifier.dnn_bias_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.dnn_weights_` {#DNNLinearCombinedClassifier.dnn_weights_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.evaluate(*args, **kwargs)` {#DNNLinearCombinedClassifier.evaluate} - -See `Evaluable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If at least one of `x` or `y` is provided, and at least one of - `input_fn` or `feed_fn` is provided. - Or if `metrics` is not `None` or `dict`. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.export(export_dir, input_fn=None, input_feature_key=None, use_deprecated_input_fn=True, signature_fn=None, default_batch_size=1, exports_to_keep=None)` {#DNNLinearCombinedClassifier.export} - -See BasEstimator.export. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#DNNLinearCombinedClassifier.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.fit(*args, **kwargs)` {#DNNLinearCombinedClassifier.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.get_params(deep=True)` {#DNNLinearCombinedClassifier.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.get_variable_names()` {#DNNLinearCombinedClassifier.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.get_variable_value(name)` {#DNNLinearCombinedClassifier.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.linear_bias_` {#DNNLinearCombinedClassifier.linear_bias_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.linear_weights_` {#DNNLinearCombinedClassifier.linear_weights_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.model_dir` {#DNNLinearCombinedClassifier.model_dir} - - - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.partial_fit(*args, **kwargs)` {#DNNLinearCombinedClassifier.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.predict(*args, **kwargs)` {#DNNLinearCombinedClassifier.predict} - -Returns predictions for given features. (deprecated arguments) (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2017-03-01. -Instructions for updating: -Please switch to predict_classes, or set `outputs` argument. - -By default, returns predicted classes. But this default will be dropped -soon. Users should either pass `outputs`, or call `predict_classes` method. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns classes. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted classes with shape [batch_size] (or an iterable - of predicted classes if as_iterable is True). Each predicted class is - represented by its class index (i.e. integer from 0 to n_classes-1). - If `outputs` is set, returns a dict of predictions. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.predict_classes(*args, **kwargs)` {#DNNLinearCombinedClassifier.predict_classes} - -Returns predicted classes for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted classes with shape [batch_size] (or an iterable - of predicted classes if as_iterable is True). Each predicted class is - represented by its class index (i.e. integer from 0 to n_classes-1). - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.predict_proba(*args, **kwargs)` {#DNNLinearCombinedClassifier.predict_proba} - -Returns prediction probabilities for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x and y must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted probabilities with shape [batch_size, n_classes] - (or an iterable of predicted probabilities if as_iterable is True). - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.set_params(**params)` {#DNNLinearCombinedClassifier.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - - -- - - - -### `class tf.contrib.learn.LinearClassifier` {#LinearClassifier} - -Linear classifier model. - -Train a linear model to classify instances into one of multiple possible -classes. When number of possible classes is 2, this is binary classification. - -Example: - -```python -sparse_column_a = sparse_column_with_hash_bucket(...) -sparse_column_b = sparse_column_with_hash_bucket(...) - -sparse_feature_a_x_sparse_feature_b = crossed_column(...) - -# Estimator using the default optimizer. -estimator = LinearClassifier( - feature_columns=[sparse_column_a, sparse_feature_a_x_sparse_feature_b]) - -# Or estimator using the FTRL optimizer with regularization. -estimator = LinearClassifier( - feature_columns=[sparse_column_a, sparse_feature_a_x_sparse_feature_b], - optimizer=tf.train.FtrlOptimizer( - learning_rate=0.1, - l1_regularization_strength=0.001 - )) - -# Or estimator using the SDCAOptimizer. -estimator = LinearClassifier( - feature_columns=[sparse_column_a, sparse_feature_a_x_sparse_feature_b], - optimizer=tf.contrib.linear_optimizer.SDCAOptimizer( - example_id_column='example_id', - num_loss_partitions=..., - symmetric_l2_regularization=2.0 - )) - -# Input builders -def input_fn_train: # returns x, y (where y represents label's class index). - ... -def input_fn_eval: # returns x, y (where y represents label's class index). - ... -estimator.fit(input_fn=input_fn_train) -estimator.evaluate(input_fn=input_fn_eval) -estimator.predict(x=x) # returns predicted labels (i.e. label's class index). -``` - -Input of `fit` and `evaluate` should have following features, - otherwise there will be a `KeyError`: - -* if `weight_column_name` is not `None`, a feature with - `key=weight_column_name` whose value is a `Tensor`. -* for each `column` in `feature_columns`: - - if `column` is a `SparseColumn`, a feature with `key=column.name` - whose `value` is a `SparseTensor`. - - if `column` is a `WeightedSparseColumn`, two features: the first with - `key` the id column name, the second with `key` the weight column name. - Both features' `value` must be a `SparseTensor`. - - if `column` is a `RealValuedColumn`, a feature with `key=column.name` - whose `value` is a `Tensor`. -- - - - -#### `tf.contrib.learn.LinearClassifier.__init__(feature_columns, model_dir=None, n_classes=2, weight_column_name=None, optimizer=None, gradient_clip_norm=None, enable_centered_bias=False, _joint_weight=False, config=None, feature_engineering_fn=None)` {#LinearClassifier.__init__} - -Construct a `LinearClassifier` estimator object. - -##### Args: - - -* `feature_columns`: An iterable containing all the feature columns used by - the model. All items in the set should be instances of classes derived - from `FeatureColumn`. -* `model_dir`: Directory to save model parameters, graph and etc. This can - also be used to load checkpoints from the directory into a estimator - to continue training a previously saved model. -* `n_classes`: number of label classes. Default is binary classification. - Note that class labels are integers representing the class index (i.e. - values from 0 to n_classes-1). For arbitrary label values (e.g. string - labels), convert to class indices first. -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. It - will be multiplied by the loss of the example. -* `optimizer`: The optimizer used to train the model. If specified, it should - be either an instance of `tf.Optimizer` or the SDCAOptimizer. If `None`, - the Ftrl optimizer will be used. -* `gradient_clip_norm`: A `float` > 0. If provided, gradients are clipped - to their global norm with this clipping ratio. See - `tf.clip_by_global_norm` for more details. -* `enable_centered_bias`: A bool. If True, estimator will learn a centered - bias variable for each class. Rest of the model structure learns the - residual after centered bias. - _joint_weight: If True, the weights for all columns will be stored in a - single (possibly partitioned) variable. It's more efficient, but it's - incompatible with SDCAOptimizer, and requires all feature columns are - sparse and use the 'sum' combiner. - -* `config`: `RunConfig` object to configure the runtime settings. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into the model. - -##### Returns: - - A `LinearClassifier` estimator. - -##### Raises: - - -* `ValueError`: if n_classes < 2. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.__repr__()` {#LinearClassifier.__repr__} - - - - -- - - - -#### `tf.contrib.learn.LinearClassifier.bias_` {#LinearClassifier.bias_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - -- - - - -#### `tf.contrib.learn.LinearClassifier.config` {#LinearClassifier.config} - - - - -- - - - -#### `tf.contrib.learn.LinearClassifier.evaluate(*args, **kwargs)` {#LinearClassifier.evaluate} - -See `Evaluable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If at least one of `x` or `y` is provided, and at least one of - `input_fn` or `feed_fn` is provided. - Or if `metrics` is not `None` or `dict`. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.export(export_dir, input_fn=None, input_feature_key=None, use_deprecated_input_fn=True, signature_fn=None, default_batch_size=1, exports_to_keep=None)` {#LinearClassifier.export} - -See BaseEstimator.export. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#LinearClassifier.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.fit(*args, **kwargs)` {#LinearClassifier.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.get_params(deep=True)` {#LinearClassifier.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.get_variable_names()` {#LinearClassifier.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.get_variable_value(name)` {#LinearClassifier.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.model_dir` {#LinearClassifier.model_dir} - - - - -- - - - -#### `tf.contrib.learn.LinearClassifier.partial_fit(*args, **kwargs)` {#LinearClassifier.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.predict(*args, **kwargs)` {#LinearClassifier.predict} - -Returns predictions for given features. (deprecated arguments) (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2017-03-01. -Instructions for updating: -Please switch to predict_classes, or set `outputs` argument. - -By default, returns predicted classes. But this default will be dropped -soon. Users should either pass `outputs`, or call `predict_classes` method. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns classes. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted classes with shape [batch_size] (or an iterable - of predicted classes if as_iterable is True). Each predicted class is - represented by its class index (i.e. integer from 0 to n_classes-1). - If `outputs` is set, returns a dict of predictions. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.predict_classes(*args, **kwargs)` {#LinearClassifier.predict_classes} - -Returns predicted classes for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted classes with shape [batch_size] (or an iterable - of predicted classes if as_iterable is True). Each predicted class is - represented by its class index (i.e. integer from 0 to n_classes-1). - - -- - - - -#### `tf.contrib.learn.LinearClassifier.predict_proba(*args, **kwargs)` {#LinearClassifier.predict_proba} - -Returns predicted probabilities for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x and y must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted probabilities with shape [batch_size, n_classes] - (or an iterable of predicted probabilities if as_iterable is True). - - -- - - - -#### `tf.contrib.learn.LinearClassifier.set_params(**params)` {#LinearClassifier.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.weights_` {#LinearClassifier.weights_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - - -- - - - -### `class tf.contrib.learn.LinearRegressor` {#LinearRegressor} - -Linear regressor model. - -Train a linear regression model to predict label value given observation of -feature values. - -Example: - -```python -sparse_column_a = sparse_column_with_hash_bucket(...) -sparse_column_b = sparse_column_with_hash_bucket(...) - -sparse_feature_a_x_sparse_feature_b = crossed_column(...) - -estimator = LinearRegressor( - feature_columns=[sparse_column_a, sparse_feature_a_x_sparse_feature_b]) - -# Input builders -def input_fn_train: # returns x, y - ... -def input_fn_eval: # returns x, y - ... -estimator.fit(input_fn=input_fn_train) -estimator.evaluate(input_fn=input_fn_eval) -estimator.predict(x=x) -``` - -Input of `fit` and `evaluate` should have following features, - otherwise there will be a KeyError: - -* if `weight_column_name` is not `None`: - key=weight_column_name, value=a `Tensor` -* for column in `feature_columns`: - - if isinstance(column, `SparseColumn`): - key=column.name, value=a `SparseTensor` - - if isinstance(column, `WeightedSparseColumn`): - {key=id column name, value=a `SparseTensor`, - key=weight column name, value=a `SparseTensor`} - - if isinstance(column, `RealValuedColumn`): - key=column.name, value=a `Tensor` -- - - - -#### `tf.contrib.learn.LinearRegressor.__init__(feature_columns, model_dir=None, weight_column_name=None, optimizer=None, gradient_clip_norm=None, enable_centered_bias=False, label_dimension=1, _joint_weights=False, config=None, feature_engineering_fn=None)` {#LinearRegressor.__init__} - -Construct a `LinearRegressor` estimator object. - -##### Args: - - -* `feature_columns`: An iterable containing all the feature columns used by - the model. All items in the set should be instances of classes derived - from `FeatureColumn`. -* `model_dir`: Directory to save model parameters, graph, etc. This can - also be used to load checkpoints from the directory into a estimator - to continue training a previously saved model. -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. It - will be multiplied by the loss of the example. -* `optimizer`: An instance of `tf.Optimizer` used to train the model. If - `None`, will use an Ftrl optimizer. -* `gradient_clip_norm`: A `float` > 0. If provided, gradients are clipped - to their global norm with this clipping ratio. See - `tf.clip_by_global_norm` for more details. -* `enable_centered_bias`: A bool. If True, estimator will learn a centered - bias variable for each class. Rest of the model structure learns the - residual after centered bias. -* `label_dimension`: Number of regression targets per example. This is the - size of the last dimension of the labels and logits `Tensor` objects - (typically, these have shape `[batch_size, label_dimension]`). - _joint_weights: If True use a single (possibly partitioned) variable to - store the weights. It's faster, but requires all feature columns are - sparse and have the 'sum' combiner. Incompatible with SDCAOptimizer. - -* `config`: `RunConfig` object to configure the runtime settings. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into the model. - -##### Returns: - - A `LinearRegressor` estimator. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.__repr__()` {#LinearRegressor.__repr__} - - - - -- - - - -#### `tf.contrib.learn.LinearRegressor.bias_` {#LinearRegressor.bias_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - -- - - - -#### `tf.contrib.learn.LinearRegressor.config` {#LinearRegressor.config} - - - - -- - - - -#### `tf.contrib.learn.LinearRegressor.evaluate(*args, **kwargs)` {#LinearRegressor.evaluate} - -See `Evaluable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If at least one of `x` or `y` is provided, and at least one of - `input_fn` or `feed_fn` is provided. - Or if `metrics` is not `None` or `dict`. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.export(export_dir, input_fn=None, input_feature_key=None, use_deprecated_input_fn=True, signature_fn=None, default_batch_size=1, exports_to_keep=None)` {#LinearRegressor.export} - -See BaseEstimator.export. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#LinearRegressor.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.fit(*args, **kwargs)` {#LinearRegressor.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.get_params(deep=True)` {#LinearRegressor.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.get_variable_names()` {#LinearRegressor.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.get_variable_value(name)` {#LinearRegressor.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.model_dir` {#LinearRegressor.model_dir} - - - - -- - - - -#### `tf.contrib.learn.LinearRegressor.partial_fit(*args, **kwargs)` {#LinearRegressor.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.predict(*args, **kwargs)` {#LinearRegressor.predict} - -Returns predictions for given features. (deprecated arguments) (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2017-03-01. -Instructions for updating: -Please switch to predict_scores, or set `outputs` argument. - -By default, returns predicted scores. But this default will be dropped -soon. Users should either pass `outputs`, or call `predict_scores` method. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns scores. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted scores (or an iterable of predicted scores if - as_iterable is True). If `label_dimension == 1`, the shape of the output - is `[batch_size]`, otherwise the shape is `[batch_size, label_dimension]`. - If `outputs` is set, returns a dict of predictions. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.predict_scores(*args, **kwargs)` {#LinearRegressor.predict_scores} - -Returns predicted scores for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted scores (or an iterable of predicted scores if - as_iterable is True). If `label_dimension == 1`, the shape of the output - is `[batch_size]`, otherwise the shape is `[batch_size, label_dimension]`. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.set_params(**params)` {#LinearRegressor.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.weights_` {#LinearRegressor.weights_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - - -- - - - -### `tf.contrib.learn.LogisticRegressor(model_fn, thresholds=None, model_dir=None, config=None, feature_engineering_fn=None)` {#LogisticRegressor} - -Builds a logistic regression Estimator for binary classification. - -This method provides a basic Estimator with some additional metrics for custom -binary classification models, including AUC, precision/recall and accuracy. - -Example: - -```python - # See tf.contrib.learn.Estimator(...) for details on model_fn structure - def my_model_fn(...): - pass - - estimator = LogisticRegressor(model_fn=my_model_fn) - - # Input builders - def input_fn_train: - pass - - estimator.fit(input_fn=input_fn_train) - estimator.predict(x=x) -``` - -##### Args: - - -* `model_fn`: Model function with the signature: - `(features, labels, mode) -> (predictions, loss, train_op)`. - Expects the returned predictions to be probabilities in [0.0, 1.0]. -* `thresholds`: List of floating point thresholds to use for accuracy, - precision, and recall metrics. If `None`, defaults to `[0.5]`. -* `model_dir`: Directory to save model parameters, graphs, etc. This can also - be used to load checkpoints from the directory into a estimator to - continue training a previously saved model. -* `config`: A RunConfig configuration object. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into the model. - -##### Returns: - - A `tf.contrib.learn.Estimator` instance. - - - -- - - - -### `class tf.contrib.learn.Experiment` {#Experiment} - -Experiment is a class containing all information needed to train a model. - -After an experiment is created (by passing an Estimator and inputs for -training and evaluation), an Experiment instance knows how to invoke training -and eval loops in a sensible fashion for distributed training. -- - - - -#### `tf.contrib.learn.Experiment.__init__(*args, **kwargs)` {#Experiment.__init__} - -Constructor for `Experiment`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-10-23. -Instructions for updating: -local_eval_frequency is deprecated as local_run will be renamed to train_and_evaluate. Use min_eval_frequency and call train_and_evaluate instead. Note, however, that the default for min_eval_frequency is 1, meaning models will be evaluated every time a new checkpoint is available. In contrast, the default for local_eval_frequency is None, resulting in evaluation occurring only after training has completed. min_eval_frequency is ignored when calling the deprecated local_run. - -Creates an Experiment instance. None of the functions passed to this -constructor are executed at construction time. They are stored and used -when a method is executed which requires it. - -##### Args: - - -* `estimator`: Object implementing `Trainable` and `Evaluable`. -* `train_input_fn`: function, returns features and labels for training. -* `eval_input_fn`: function, returns features and labels for evaluation. If - `eval_steps` is `None`, this should be configured only to produce for a - finite number of batches (generally, 1 epoch over the evaluation data). -* `eval_metrics`: `dict` of string, metric function. If `None`, default set - is used. -* `train_steps`: Perform this many steps of training. `None`, the default, - means train forever. -* `eval_steps`: `evaluate` runs until input is exhausted (or another exception - is raised), or for `eval_steps` steps, if specified. -* `train_monitors`: A list of monitors to pass to the `Estimator`'s `fit` - function. -* `eval_hooks`: A list of `SessionRunHook` hooks to pass to the - `Estimator`'s `evaluate` function. -* `local_eval_frequency`: Frequency of running eval in steps, - when running locally. If `None`, runs evaluation only at the end of - training. -* `eval_delay_secs`: Start evaluating after waiting for this many seconds. -* `continuous_eval_throttle_secs`: Do not re-evaluate unless the last - evaluation was started at least this many seconds ago for - continuous_eval(). -* `min_eval_frequency`: (applies only to train_and_evaluate). the minimum - number of steps between evaluations. Of course, evaluation does not - occur if no new snapshot is available, hence, this is the minimum. -* `delay_workers_by_global_step`: if `True` delays training workers - based on global step instead of time. -* `export_strategies`: A list of `ExportStrategy`s, or a single one, or None. - -##### Raises: - - -* `ValueError`: if `estimator` does not implement `Evaluable` and `Trainable`, - or if export_strategies has the wrong type. - - -- - - - -#### `tf.contrib.learn.Experiment.continuous_eval(delay_secs=None, throttle_delay_secs=None, evaluate_checkpoint_only_once=True, continuous_eval_predicate_fn=None)` {#Experiment.continuous_eval} - - - - -- - - - -#### `tf.contrib.learn.Experiment.continuous_eval_on_train_data(delay_secs=None, throttle_delay_secs=None, continuous_eval_predicate_fn=None)` {#Experiment.continuous_eval_on_train_data} - - - - -- - - - -#### `tf.contrib.learn.Experiment.estimator` {#Experiment.estimator} - - - - -- - - - -#### `tf.contrib.learn.Experiment.eval_metrics` {#Experiment.eval_metrics} - - - - -- - - - -#### `tf.contrib.learn.Experiment.eval_steps` {#Experiment.eval_steps} - - - - -- - - - -#### `tf.contrib.learn.Experiment.evaluate(delay_secs=None)` {#Experiment.evaluate} - -Evaluate on the evaluation data. - -Runs evaluation on the evaluation data and returns the result. Runs for -`self._eval_steps` steps, or if it's `None`, then run until input is -exhausted or another exception is raised. Start the evaluation after -`delay_secs` seconds, or if it's `None`, defaults to using -`self._eval_delay_secs` seconds. - -##### Args: - - -* `delay_secs`: Start evaluating after this many seconds. If `None`, defaults - to using `self._eval_delays_secs`. - -##### Returns: - - The result of the `evaluate` call to the `Estimator`. - - -- - - - -#### `tf.contrib.learn.Experiment.extend_train_hooks(additional_hooks)` {#Experiment.extend_train_hooks} - -Extends the hooks for training. - - -- - - - -#### `tf.contrib.learn.Experiment.local_run(*args, **kwargs)` {#Experiment.local_run} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-23. -Instructions for updating: -local_run will be renamed to train_and_evaluate and the new default behavior will be to run evaluation every time there is a new checkpoint. - - -- - - - -#### `tf.contrib.learn.Experiment.reset_export_strategies(new_export_strategies=None)` {#Experiment.reset_export_strategies} - -Resets the export strategies with the `new_export_strategies`. - -##### Args: - - -* `new_export_strategies`: A new list of `ExportStrategy`s, or a single one, - or None. - -##### Returns: - - The old export strategies. - - -- - - - -#### `tf.contrib.learn.Experiment.run_std_server()` {#Experiment.run_std_server} - -Starts a TensorFlow server and joins the serving thread. - -Typically used for parameter servers. - -##### Raises: - - -* `ValueError`: if not enough information is available in the estimator's - config to create a server. - - -- - - - -#### `tf.contrib.learn.Experiment.test()` {#Experiment.test} - -Tests training and evaluating the estimator both for a single step. - -##### Returns: - - The result of the `evaluate` call to the `Estimator`. - - -- - - - -#### `tf.contrib.learn.Experiment.train(delay_secs=None)` {#Experiment.train} - -Fit the estimator using the training data. - -Train the estimator for `self._train_steps` steps, after waiting for -`delay_secs` seconds. If `self._train_steps` is `None`, train forever. - -##### Args: - - -* `delay_secs`: Start training after this many seconds. - -##### Returns: - - The trained estimator. - - -- - - - -#### `tf.contrib.learn.Experiment.train_and_evaluate()` {#Experiment.train_and_evaluate} - -Interleaves training and evaluation. - -The frequency of evaluation is controlled by the contructor arg -`min_eval_frequency`. When this parameter is None or 0, evaluation happens -only after training has completed. Note that evaluation cannot happen -more frequently than checkpoints are taken. If no new snapshots are -available when evaluation is supposed to occur, then evaluation doesn't -happen for another `min_eval_frequency` steps (assuming a checkpoint is -available at that point). Thus, settings `min_eval_frequency` to 1 means -that the model will be evaluated everytime there is a new checkpoint. - -This is particular useful for a "Master" task in the cloud, whose -responsibility it is to take checkpoints, evaluate those checkpoints, -and write out summaries. Participating in training as the supervisor -allows such a task to accomplish the first and last items, while -performing evaluation allows for the second. - -##### Returns: - - The result of the `evaluate` call to the `Estimator`. - - -- - - - -#### `tf.contrib.learn.Experiment.train_steps` {#Experiment.train_steps} - - - - - -- - - - -### `class tf.contrib.learn.ExportStrategy` {#ExportStrategy} - -A class representing a type of model export. - -Typically constructed by a utility function specific to the exporter, such as -`saved_model_export_utils.make_export_strategy()`. - -The fields are: - name: The directory name under the export base directory where exports of - this type will be written. - export_fn: A function that writes an export, given an estimator, a - destination path, and optionally a checkpoint path and an evaluation - result for that checkpoint. This export_fn() may be run repeatedly during - continuous training, or just once at the end of fixed-length training. - Note the export_fn() may choose whether or not to export based on the eval - result or based on an internal timer or any other criterion, if exports - are not desired for every checkpoint. - - The signature of this function must be one of: - * (estimator, export_path) -> export_path` - * (estimator, export_path, checkpoint_path) -> export_path` - * (estimator, export_path, checkpoint_path, eval_result) -> export_path` -- - - - -#### `tf.contrib.learn.ExportStrategy.__getnewargs__()` {#ExportStrategy.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.contrib.learn.ExportStrategy.__getstate__()` {#ExportStrategy.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.contrib.learn.ExportStrategy.__new__(_cls, name, export_fn)` {#ExportStrategy.__new__} - -Create new instance of ExportStrategy(name, export_fn) - - -- - - - -#### `tf.contrib.learn.ExportStrategy.__repr__()` {#ExportStrategy.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.contrib.learn.ExportStrategy.export(estimator, export_path, checkpoint_path=None, eval_result=None)` {#ExportStrategy.export} - -Exports the given Estimator to a specific format. - -##### Args: - - -* `estimator`: the Estimator to export. -* `export_path`: A string containing a directory where to write the export. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the strategy may locate a checkpoint (e.g. the most recent) by itself. -* `eval_result`: The output of Estimator.evaluate on this checkpoint. This - should be set only if checkpoint_path is provided (otherwise it is - unclear which checkpoint this eval refers to). - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if the export_fn does not have the required signature - - -- - - - -#### `tf.contrib.learn.ExportStrategy.export_fn` {#ExportStrategy.export_fn} - -Alias for field number 1 - - -- - - - -#### `tf.contrib.learn.ExportStrategy.name` {#ExportStrategy.name} - -Alias for field number 0 - - - -- - - - -### `class tf.contrib.learn.TaskType` {#TaskType} - - - - -- - - - -### `class tf.train.NanLossDuringTrainingError` {#NanLossDuringTrainingError} - - -- - - - -#### `tf.train.NanLossDuringTrainingError.__str__()` {#NanLossDuringTrainingError.__str__} - - - - - -- - - - -### `class tf.contrib.learn.RunConfig` {#RunConfig} - -This class specifies the configurations for an `Estimator` run. - -If you're a Google-internal user using command line flags with -`learn_runner.py` (for instance, to do distributed training or to use -parameter servers), you probably want to use `learn_runner.EstimatorConfig` -instead. -- - - - -#### `tf.contrib.learn.RunConfig.__init__(master=None, num_cores=0, log_device_placement=False, gpu_memory_fraction=1, tf_random_seed=None, save_summary_steps=100, save_checkpoints_secs=600, save_checkpoints_steps=None, keep_checkpoint_max=5, keep_checkpoint_every_n_hours=10000, evaluation_master='')` {#RunConfig.__init__} - -Constructor. - -Note that the superclass `ClusterConfig` may set properties like -`cluster_spec`, `is_chief`, `master` (if `None` in the args), -`num_ps_replicas`, `task_id`, and `task_type` based on the `TF_CONFIG` -environment variable. See `ClusterConfig` for more details. - -##### Args: - - -* `master`: TensorFlow master. Defaults to empty string for local. -* `num_cores`: Number of cores to be used. If 0, the system picks an - appropriate number (default: 0). -* `log_device_placement`: Log the op placement to devices (default: False). -* `gpu_memory_fraction`: Fraction of GPU memory used by the process on - each GPU uniformly on the same machine. -* `tf_random_seed`: Random seed for TensorFlow initializers. - Setting this value allows consistency between reruns. -* `save_summary_steps`: Save summaries every this many steps. -* `save_checkpoints_secs`: Save checkpoints every this many seconds. Can not - be specified with `save_checkpoints_steps`. -* `save_checkpoints_steps`: Save checkpoints every this many steps. Can not be - specified with `save_checkpoints_secs`. -* `keep_checkpoint_max`: The maximum number of recent checkpoint files to - keep. As new files are created, older files are deleted. If None or 0, - all checkpoint files are kept. Defaults to 5 (that is, the 5 most recent - checkpoint files are kept.) -* `keep_checkpoint_every_n_hours`: Number of hours between each checkpoint - to be saved. The default value of 10,000 hours effectively disables - the feature. -* `evaluation_master`: the master on which to perform evaluation. - - -- - - - -#### `tf.contrib.learn.RunConfig.cluster_spec` {#RunConfig.cluster_spec} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.environment` {#RunConfig.environment} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.evaluation_master` {#RunConfig.evaluation_master} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.get_task_id()` {#RunConfig.get_task_id} - -Returns task index from `TF_CONFIG` environmental variable. - -If you have a ClusterConfig instance, you can just access its task_id -property instead of calling this function and re-parsing the environmental -variable. - -##### Returns: - - `TF_CONFIG['task']['index']`. Defaults to 0. - - -- - - - -#### `tf.contrib.learn.RunConfig.is_chief` {#RunConfig.is_chief} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.keep_checkpoint_every_n_hours` {#RunConfig.keep_checkpoint_every_n_hours} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.keep_checkpoint_max` {#RunConfig.keep_checkpoint_max} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.master` {#RunConfig.master} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.num_ps_replicas` {#RunConfig.num_ps_replicas} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.save_checkpoints_secs` {#RunConfig.save_checkpoints_secs} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.save_checkpoints_steps` {#RunConfig.save_checkpoints_steps} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.save_summary_steps` {#RunConfig.save_summary_steps} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.task_id` {#RunConfig.task_id} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.task_type` {#RunConfig.task_type} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.tf_config` {#RunConfig.tf_config} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.tf_random_seed` {#RunConfig.tf_random_seed} - - - - - -- - - - -### `tf.contrib.learn.evaluate(*args, **kwargs)` {#evaluate} - -Evaluate a model loaded from a checkpoint. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-02-15. -Instructions for updating: -graph_actions.py will be deleted. Use tf.train.* utilities instead. You can use learn/estimators/estimator.py as an example. - -Given `graph`, a directory to write summaries to (`output_dir`), a checkpoint -to restore variables from, and a `dict` of `Tensor`s to evaluate, run an eval -loop for `max_steps` steps, or until an exception (generally, an -end-of-input signal from a reader operation) is raised from running -`eval_dict`. - -In each step of evaluation, all tensors in the `eval_dict` are evaluated, and -every `log_every_steps` steps, they are logged. At the very end of evaluation, -a summary is evaluated (finding the summary ops using `Supervisor`'s logic) -and written to `output_dir`. - -##### Args: - - -* `graph`: A `Graph` to train. It is expected that this graph is not in use - elsewhere. -* `output_dir`: A string containing the directory to write a summary to. -* `checkpoint_path`: A string containing the path to a checkpoint to restore. - Can be `None` if the graph doesn't require loading any variables. -* `eval_dict`: A `dict` mapping string names to tensors to evaluate. It is - evaluated in every logging step. The result of the final evaluation is - returned. If `update_op` is None, then it's evaluated in every step. If - `max_steps` is `None`, this should depend on a reader that will raise an - end-of-input exception when the inputs are exhausted. -* `update_op`: A `Tensor` which is run in every step. -* `global_step_tensor`: A `Variable` containing the global step. If `None`, - one is extracted from the graph using the same logic as in `Supervisor`. - Used to place eval summaries on training curves. -* `supervisor_master`: The master string to use when preparing the session. -* `log_every_steps`: Integer. Output logs every `log_every_steps` evaluation - steps. The logs contain the `eval_dict` and timing information. -* `feed_fn`: A function that is called every iteration to produce a `feed_dict` - passed to `session.run` calls. Optional. -* `max_steps`: Integer. Evaluate `eval_dict` this many times. - -##### Returns: - - A tuple `(eval_results, global_step)`: - -* `eval_results`: A `dict` mapping `string` to numeric values (`int`, `float`) - that are the result of running eval_dict in the last step. `None` if no - eval steps were run. -* `global_step`: The global step this evaluation corresponds to. - -##### Raises: - - -* `ValueError`: if `output_dir` is empty. - - -- - - - -### `tf.contrib.learn.infer(*args, **kwargs)` {#infer} - -Restore graph from `restore_checkpoint_path` and run `output_dict` tensors. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-02-15. -Instructions for updating: -graph_actions.py will be deleted. Use tf.train.* utilities instead. You can use learn/estimators/estimator.py as an example. - -If `restore_checkpoint_path` is supplied, restore from checkpoint. Otherwise, -init all variables. - -##### Args: - - -* `restore_checkpoint_path`: A string containing the path to a checkpoint to - restore. -* `output_dict`: A `dict` mapping string names to `Tensor` objects to run. - Tensors must all be from the same graph. -* `feed_dict`: `dict` object mapping `Tensor` objects to input values to feed. - -##### Returns: - - Dict of values read from `output_dict` tensors. Keys are the same as - `output_dict`, values are the results read from the corresponding `Tensor` - in `output_dict`. - -##### Raises: - - -* `ValueError`: if `output_dict` or `feed_dicts` is None or empty. - - -- - - - -### `tf.contrib.learn.run_feeds(*args, **kwargs)` {#run_feeds} - -See run_feeds_iter(). Returns a `list` instead of an iterator. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-02-15. -Instructions for updating: -graph_actions.py will be deleted. Use tf.train.* utilities instead. You can use learn/estimators/estimator.py as an example. - - -- - - - -### `tf.contrib.learn.run_n(*args, **kwargs)` {#run_n} - -Run `output_dict` tensors `n` times, with the same `feed_dict` each run. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-02-15. -Instructions for updating: -graph_actions.py will be deleted. Use tf.train.* utilities instead. You can use learn/estimators/estimator.py as an example. - -##### Args: - - -* `output_dict`: A `dict` mapping string names to tensors to run. Must all be - from the same graph. -* `feed_dict`: `dict` of input values to feed each run. -* `restore_checkpoint_path`: A string containing the path to a checkpoint to - restore. -* `n`: Number of times to repeat. - -##### Returns: - - A list of `n` `dict` objects, each containing values read from `output_dict` - tensors. - - -- - - - -### `tf.contrib.learn.train(*args, **kwargs)` {#train} - -Train a model. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-02-15. -Instructions for updating: -graph_actions.py will be deleted. Use tf.train.* utilities instead. You can use learn/estimators/estimator.py as an example. - -Given `graph`, a directory to write outputs to (`output_dir`), and some ops, -run a training loop. The given `train_op` performs one step of training on the -model. The `loss_op` represents the objective function of the training. It is -expected to increment the `global_step_tensor`, a scalar integer tensor -counting training steps. This function uses `Supervisor` to initialize the -graph (from a checkpoint if one is available in `output_dir`), write summaries -defined in the graph, and write regular checkpoints as defined by -`supervisor_save_model_secs`. - -Training continues until `global_step_tensor` evaluates to `max_steps`, or, if -`fail_on_nan_loss`, until `loss_op` evaluates to `NaN`. In that case the -program is terminated with exit code 1. - -##### Args: - - -* `graph`: A graph to train. It is expected that this graph is not in use - elsewhere. -* `output_dir`: A directory to write outputs to. -* `train_op`: An op that performs one training step when run. -* `loss_op`: A scalar loss tensor. -* `global_step_tensor`: A tensor representing the global step. If none is given, - one is extracted from the graph using the same logic as in `Supervisor`. -* `init_op`: An op that initializes the graph. If `None`, use `Supervisor`'s - default. -* `init_feed_dict`: A dictionary that maps `Tensor` objects to feed values. - This feed dictionary will be used when `init_op` is evaluated. -* `init_fn`: Optional callable passed to Supervisor to initialize the model. -* `log_every_steps`: Output logs regularly. The logs contain timing data and the - current loss. -* `supervisor_is_chief`: Whether the current process is the chief supervisor in - charge of restoring the model and running standard services. -* `supervisor_master`: The master string to use when preparing the session. -* `supervisor_save_model_secs`: Save a checkpoint every - `supervisor_save_model_secs` seconds when training. -* `keep_checkpoint_max`: The maximum number of recent checkpoint files to - keep. As new files are created, older files are deleted. If None or 0, - all checkpoint files are kept. This is simply passed as the max_to_keep - arg to tf.Saver constructor. -* `supervisor_save_summaries_steps`: Save summaries every - `supervisor_save_summaries_steps` seconds when training. -* `feed_fn`: A function that is called every iteration to produce a `feed_dict` - passed to `session.run` calls. Optional. -* `steps`: Trains for this many steps (e.g. current global step + `steps`). -* `fail_on_nan_loss`: If true, raise `NanLossDuringTrainingError` if `loss_op` - evaluates to `NaN`. If false, continue training as if nothing happened. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. -* `max_steps`: Number of total steps for which to train model. If `None`, - train forever. Two calls fit(steps=100) means 200 training iterations. - On the other hand two calls of fit(max_steps=100) means, second call - will not do any iteration since first call did all 100 steps. - -##### Returns: - - The final loss value. - -##### Raises: - - -* `ValueError`: If `output_dir`, `train_op`, `loss_op`, or `global_step_tensor` - is not provided. See `tf.contrib.framework.get_global_step` for how we - look up the latter if not provided explicitly. -* `NanLossDuringTrainingError`: If `fail_on_nan_loss` is `True`, and loss ever - evaluates to `NaN`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - - -- - - - -### `tf.contrib.learn.extract_dask_data(data)` {#extract_dask_data} - -Extract data from dask.Series or dask.DataFrame for predictors. - -Given a distributed dask.DataFrame or dask.Series containing columns or names -for one or more predictors, this operation returns a single dask.DataFrame or -dask.Series that can be iterated over. - -##### Args: - - -* `data`: A distributed dask.DataFrame or dask.Series. - -##### Returns: - - A dask.DataFrame or dask.Series that can be iterated over. - If the supplied argument is neither a dask.DataFrame nor a dask.Series this - operation returns it without modification. - - -- - - - -### `tf.contrib.learn.extract_dask_labels(labels)` {#extract_dask_labels} - -Extract data from dask.Series or dask.DataFrame for labels. - -Given a distributed dask.DataFrame or dask.Series containing exactly one -column or name, this operation returns a single dask.DataFrame or dask.Series -that can be iterated over. - -##### Args: - - -* `labels`: A distributed dask.DataFrame or dask.Series with exactly one - column or name. - -##### Returns: - - A dask.DataFrame or dask.Series that can be iterated over. - If the supplied argument is neither a dask.DataFrame nor a dask.Series this - operation returns it without modification. - -##### Raises: - - -* `ValueError`: If the supplied dask.DataFrame contains more than one - column or the supplied dask.Series contains more than - one name. - - -- - - - -### `tf.contrib.learn.extract_pandas_data(data)` {#extract_pandas_data} - -Extract data from pandas.DataFrame for predictors. - -Given a DataFrame, will extract the values and cast them to float. The -DataFrame is expected to contain values of type int, float or bool. - -##### Args: - - -* `data`: `pandas.DataFrame` containing the data to be extracted. - -##### Returns: - - A numpy `ndarray` of the DataFrame's values as floats. - -##### Raises: - - -* `ValueError`: if data contains types other than int, float or bool. - - -- - - - -### `tf.contrib.learn.extract_pandas_labels(labels)` {#extract_pandas_labels} - -Extract data from pandas.DataFrame for labels. - -##### Args: - - -* `labels`: `pandas.DataFrame` or `pandas.Series` containing one column of - labels to be extracted. - -##### Returns: - - A numpy `ndarray` of labels from the DataFrame. - -##### Raises: - - -* `ValueError`: if more than one column is found or type is not int, float or - bool. - - -- - - - -### `tf.contrib.learn.extract_pandas_matrix(data)` {#extract_pandas_matrix} - -Extracts numpy matrix from pandas DataFrame. - -##### Args: - - -* `data`: `pandas.DataFrame` containing the data to be extracted. - -##### Returns: - - A numpy `ndarray` of the DataFrame's values. - - -- - - - -### `tf.contrib.learn.infer_real_valued_columns_from_input(x)` {#infer_real_valued_columns_from_input} - -Creates `FeatureColumn` objects for inputs defined by input `x`. - -This interprets all inputs as dense, fixed-length float values. - -##### Args: - - -* `x`: Real-valued matrix of shape [n_samples, n_features...]. Can be - iterator that returns arrays of features. - -##### Returns: - - List of `FeatureColumn` objects. - - -- - - - -### `tf.contrib.learn.infer_real_valued_columns_from_input_fn(input_fn)` {#infer_real_valued_columns_from_input_fn} - -Creates `FeatureColumn` objects for inputs defined by `input_fn`. - -This interprets all inputs as dense, fixed-length float values. This creates -a local graph in which it calls `input_fn` to build the tensors, then discards -it. - -##### Args: - - -* `input_fn`: Input function returning a tuple of: - features - Dictionary of string feature name to `Tensor` or `Tensor`. - labels - `Tensor` of label values. - -##### Returns: - - List of `FeatureColumn` objects. - - -- - - - -### `tf.contrib.learn.read_batch_examples(file_pattern, batch_size, reader, randomize_input=True, num_epochs=None, queue_capacity=10000, num_threads=1, read_batch_size=1, parse_fn=None, name=None, seed=None)` {#read_batch_examples} - -Adds operations to read, queue, batch `Example` protos. - -Given file pattern (or list of files), will setup a queue for file names, -read `Example` proto using provided `reader`, use batch queue to create -batches of examples of size `batch_size`. - -All queue runners are added to the queue runners collection, and may be -started via `start_queue_runners`. - -All ops are added to the default graph. - -Use `parse_fn` if you need to do parsing / processing on single examples. - -##### Args: - - -* `file_pattern`: List of files or pattern of file paths containing - `Example` records. See `tf.gfile.Glob` for pattern rules. -* `batch_size`: An int or scalar `Tensor` specifying the batch size to use. -* `reader`: A function or class that returns an object with - `read` method, (filename tensor) -> (example tensor). -* `randomize_input`: Whether the input should be randomized. -* `num_epochs`: Integer specifying the number of times to read through the - dataset. If `None`, cycles through the dataset forever. - NOTE - If specified, creates a variable that must be initialized, so call - `tf.global_variables_initializer()` and run the op in a session. -* `queue_capacity`: Capacity for input queue. -* `num_threads`: The number of threads enqueuing examples. -* `read_batch_size`: An int or scalar `Tensor` specifying the number of - records to read at once -* `parse_fn`: Parsing function, takes `Example` Tensor returns parsed - representation. If `None`, no parsing is done. -* `name`: Name of resulting op. -* `seed`: An integer (optional). Seed used if randomize_input == True. - -##### Returns: - - String `Tensor` of batched `Example` proto. - -##### Raises: - - -* `ValueError`: for invalid inputs. - - -- - - - -### `tf.contrib.learn.read_batch_features(file_pattern, batch_size, features, reader, randomize_input=True, num_epochs=None, queue_capacity=10000, feature_queue_capacity=100, reader_num_threads=1, parse_fn=None, name=None)` {#read_batch_features} - -Adds operations to read, queue, batch and parse `Example` protos. - -Given file pattern (or list of files), will setup a queue for file names, -read `Example` proto using provided `reader`, use batch queue to create -batches of examples of size `batch_size` and parse example given `features` -specification. - -All queue runners are added to the queue runners collection, and may be -started via `start_queue_runners`. - -All ops are added to the default graph. - -##### Args: - - -* `file_pattern`: List of files or pattern of file paths containing - `Example` records. See `tf.gfile.Glob` for pattern rules. -* `batch_size`: An int or scalar `Tensor` specifying the batch size to use. -* `features`: A `dict` mapping feature keys to `FixedLenFeature` or - `VarLenFeature` values. -* `reader`: A function or class that returns an object with - `read` method, (filename tensor) -> (example tensor). -* `randomize_input`: Whether the input should be randomized. -* `num_epochs`: Integer specifying the number of times to read through the - dataset. If None, cycles through the dataset forever. NOTE - If specified, - creates a variable that must be initialized, so call - tf.local_variables_initializer() and run the op in a session. -* `queue_capacity`: Capacity for input queue. -* `feature_queue_capacity`: Capacity of the parsed features queue. Set this - value to a small number, for example 5 if the parsed features are large. -* `reader_num_threads`: The number of threads to read examples. -* `parse_fn`: Parsing function, takes `Example` Tensor returns parsed - representation. If `None`, no parsing is done. -* `name`: Name of resulting op. - -##### Returns: - - A dict of `Tensor` or `SparseTensor` objects for each in `features`. - -##### Raises: - - -* `ValueError`: for invalid inputs. - - -- - - - -### `tf.contrib.learn.read_batch_record_features(file_pattern, batch_size, features, randomize_input=True, num_epochs=None, queue_capacity=10000, reader_num_threads=1, name='dequeue_record_examples')` {#read_batch_record_features} - -Reads TFRecord, queues, batches and parses `Example` proto. - -See more detailed description in `read_examples`. - -##### Args: - - -* `file_pattern`: List of files or pattern of file paths containing - `Example` records. See `tf.gfile.Glob` for pattern rules. -* `batch_size`: An int or scalar `Tensor` specifying the batch size to use. -* `features`: A `dict` mapping feature keys to `FixedLenFeature` or - `VarLenFeature` values. -* `randomize_input`: Whether the input should be randomized. -* `num_epochs`: Integer specifying the number of times to read through the - dataset. If None, cycles through the dataset forever. NOTE - If specified, - creates a variable that must be initialized, so call - tf.local_variables_initializer() and run the op in a session. -* `queue_capacity`: Capacity for input queue. -* `reader_num_threads`: The number of threads to read examples. -* `name`: Name of resulting op. - -##### Returns: - - A dict of `Tensor` or `SparseTensor` objects for each in `features`. - -##### Raises: - - -* `ValueError`: for invalid inputs. - - - -- - - - -### `class tf.contrib.learn.InputFnOps` {#InputFnOps} - -A return type for an input_fn. - -This return type is currently only supported for serving input_fn. -Training and eval input_fn should return a `(features, labels)` tuple. - -The expected return values are: - features: A dict of string to `Tensor` or `SparseTensor`, specifying the - features to be passed to the model. - labels: A `Tensor`, `SparseTensor`, or a dict of string to `Tensor` or - `SparseTensor`, specifying labels for training or eval. For serving, set - `labels` to `None`. - default_inputs: a dict of string to `Tensor` or `SparseTensor`, specifying - the input placeholders (if any) that this input_fn expects to be fed. - Typically, this is used by a serving input_fn, which expects to be fed - serialized `tf.Example` protos. -- - - - -#### `tf.contrib.learn.InputFnOps.__getnewargs__()` {#InputFnOps.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.contrib.learn.InputFnOps.__getstate__()` {#InputFnOps.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.contrib.learn.InputFnOps.__new__(_cls, features, labels, default_inputs)` {#InputFnOps.__new__} - -Create new instance of InputFnOps(features, labels, default_inputs) - - -- - - - -#### `tf.contrib.learn.InputFnOps.__repr__()` {#InputFnOps.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.contrib.learn.InputFnOps.default_inputs` {#InputFnOps.default_inputs} - -Alias for field number 2 - - -- - - - -#### `tf.contrib.learn.InputFnOps.features` {#InputFnOps.features} - -Alias for field number 0 - - -- - - - -#### `tf.contrib.learn.InputFnOps.labels` {#InputFnOps.labels} - -Alias for field number 1 - - - -- - - - -### `class tf.contrib.learn.ProblemType` {#ProblemType} - -Enum-like values for the type of problem that the model solves. - -These values are used when exporting the model to produce the appropriate -signature function for serving. - -The following values are supported: - UNSPECIFIED: Produces a predict signature_fn. - CLASSIFICATION: Produces a classify signature_fn. - LINEAR_REGRESSION: Produces a regression signature_fn. - LOGISTIC_REGRESSION: Produces a classify signature_fn. - -- - - - -### `tf.contrib.learn.build_parsing_serving_input_fn(feature_spec, default_batch_size=None)` {#build_parsing_serving_input_fn} - -Build an input_fn appropriate for serving, expecting fed tf.Examples. - -Creates an input_fn that expects a serialized tf.Example fed into a string -placeholder. The function parses the tf.Example according to the provided -feature_spec, and returns all parsed Tensors as features. This input_fn is -for use at serving time, so the labels return value is always None. - -##### Args: - - -* `feature_spec`: a dict of string to `VarLenFeature`/`FixedLenFeature`. -* `default_batch_size`: the number of query examples expected per batch. - Leave unset for variable batch size (recommended). - -##### Returns: - - An input_fn suitable for use in serving. - - -- - - - -### `tf.contrib.learn.make_export_strategy(serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, exports_to_keep=5)` {#make_export_strategy} - -Create an ExportStrategy for use with Experiment. - -##### Args: - - -* `serving_input_fn`: A function that takes no arguments and returns an - `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when an - incoming serving request does not explicitly request a specific head. - Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `exports_to_keep`: Number of exports to keep. Older exports will be - garbage-collected. Defaults to 5. Set to None to disable garbage - collection. - -##### Returns: - - An ExportStrategy that can be passed to the Experiment constructor. - - - -## Other Functions and Classes -- - - - -### `class tf.contrib.learn.NotFittedError` {#NotFittedError} - -Exception class to raise if estimator is used before fitting. - -This class inherits from both ValueError and AttributeError to help with -exception handling and backward compatibility. - -Examples: ->>> from sklearn.svm import LinearSVC ->>> from sklearn.exceptions import NotFittedError ->>> try: -... LinearSVC().predict([[1, 2], [2, 3], [3, 4]]) -... except NotFittedError as e: -... print(repr(e)) -... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS -NotFittedError('This LinearSVC instance is not fitted yet',) - -Copied from -https://github.com/scikit-learn/scikit-learn/master/sklearn/exceptions.py - diff --git a/tensorflow/g3doc/api_docs/python/contrib.learn.monitors.md b/tensorflow/g3doc/api_docs/python/contrib.learn.monitors.md deleted file mode 100644 index 58b2758c36..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.learn.monitors.md +++ /dev/null @@ -1,2684 +0,0 @@ - - -# Monitors (contrib) -[TOC] - -Monitors instrument the training process. - -See the @{$python/contrib.learn.monitors} guide. - -- - - - -### `tf.contrib.learn.monitors.get_default_monitors(loss_op=None, summary_op=None, save_summary_steps=100, output_dir=None, summary_writer=None)` {#get_default_monitors} - -Returns a default set of typically-used monitors. - -##### Args: - - -* `loss_op`: `Tensor`, the loss tensor. This will be printed using `PrintTensor` - at the default interval. -* `summary_op`: See `SummarySaver`. -* `save_summary_steps`: See `SummarySaver`. -* `output_dir`: See `SummarySaver`. -* `summary_writer`: See `SummarySaver`. - -##### Returns: - - `list` of monitors. - - -- - - - -### `class tf.contrib.learn.monitors.BaseMonitor` {#BaseMonitor} - -Base class for Monitors. - -Defines basic interfaces of Monitors. -Monitors can either be run on all workers or, more commonly, restricted -to run exclusively on the elected chief worker. -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.__init__(*args, **kwargs)` {#BaseMonitor.__init__} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-05. -Instructions for updating: -Monitors are deprecated. Please use tf.train.SessionRunHook. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.begin(max_steps=None)` {#BaseMonitor.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.end(session=None)` {#BaseMonitor.end} - -Callback at the end of training/evaluation. - -##### Args: - - -* `session`: A `tf.Session` object that can be used to run ops. - -##### Raises: - - -* `ValueError`: if we've not begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.epoch_begin(epoch)` {#BaseMonitor.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.epoch_end(epoch)` {#BaseMonitor.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.post_step(step, session)` {#BaseMonitor.post_step} - -Callback after the step is finished. - -Called after step_end and receives session to perform extra session.run -calls. If failure occurred in the process, will be called as well. - -##### Args: - - -* `step`: `int`, global step of the model. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.run_on_all_workers` {#BaseMonitor.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.set_estimator(estimator)` {#BaseMonitor.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.step_begin(step)` {#BaseMonitor.step_begin} - -Callback before training step begins. - -You may use this callback to request evaluation of additional tensors -in the graph. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - List of `Tensor` objects or string tensor names to be run. - -##### Raises: - - -* `ValueError`: if we've already begun a step, or `step` < 0, or - `step` > `max_steps`. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.step_end(step, output)` {#BaseMonitor.step_end} - -Callback after training step finished. - -This callback provides access to the tensors/ops evaluated at this step, -including the additional tensors for which evaluation was requested in -`step_begin`. - -In addition, the callback has the opportunity to stop training by returning -`True`. This is useful for early stopping, for example. - -Note that this method is not called if the call to `Session.run()` that -followed the last call to `step_begin()` failed. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`. True if training should stop. - -##### Raises: - - -* `ValueError`: if we've not begun a step, or `step` number does not match. - - - -- - - - -### `class tf.contrib.learn.monitors.CaptureVariable` {#CaptureVariable} - -Captures a variable's values into a collection. - -This monitor is useful for unit testing. You should exercise caution when -using this monitor in production, since it never discards values. - -This is an `EveryN` monitor and has consistent semantic for `every_n` -and `first_n`. -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.__init__(var_name, every_n=100, first_n=1)` {#CaptureVariable.__init__} - -Initializes a CaptureVariable monitor. - -##### Args: - - -* `var_name`: `string`. The variable name, including suffix (typically ":0"). -* `every_n`: `int`, print every N steps. See `PrintN.` -* `first_n`: `int`, also print the first N steps. See `PrintN.` - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.begin(max_steps=None)` {#CaptureVariable.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.end(session=None)` {#CaptureVariable.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.epoch_begin(epoch)` {#CaptureVariable.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.epoch_end(epoch)` {#CaptureVariable.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.every_n_post_step(step, session)` {#CaptureVariable.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.every_n_step_begin(step)` {#CaptureVariable.every_n_step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.every_n_step_end(step, outputs)` {#CaptureVariable.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.post_step(step, session)` {#CaptureVariable.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.run_on_all_workers` {#CaptureVariable.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.set_estimator(estimator)` {#CaptureVariable.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.step_begin(step)` {#CaptureVariable.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.step_end(step, output)` {#CaptureVariable.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.values` {#CaptureVariable.values} - -Returns the values captured so far. - -##### Returns: - - `dict` mapping `int` step numbers to that values of the variable at the - respective step. - - - -- - - - -### `class tf.contrib.learn.monitors.CheckpointSaver` {#CheckpointSaver} - -Saves checkpoints every N steps or N seconds. -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.__init__(checkpoint_dir, save_secs=None, save_steps=None, saver=None, checkpoint_basename='model.ckpt', scaffold=None)` {#CheckpointSaver.__init__} - -Initialize CheckpointSaver monitor. - -##### Args: - - -* `checkpoint_dir`: `str`, base directory for the checkpoint files. -* `save_secs`: `int`, save every N secs. -* `save_steps`: `int`, save every N steps. -* `saver`: `Saver` object, used for saving. -* `checkpoint_basename`: `str`, base name for the checkpoint files. -* `scaffold`: `Scaffold`, use to get saver object. - -##### Raises: - - -* `ValueError`: If both `save_steps` and `save_secs` are not `None`. -* `ValueError`: If both `save_steps` and `save_secs` are `None`. - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.begin(max_steps=None)` {#CheckpointSaver.begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.end(session=None)` {#CheckpointSaver.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.epoch_begin(epoch)` {#CheckpointSaver.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.epoch_end(epoch)` {#CheckpointSaver.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.post_step(step, session)` {#CheckpointSaver.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.run_on_all_workers` {#CheckpointSaver.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.set_estimator(estimator)` {#CheckpointSaver.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.step_begin(step)` {#CheckpointSaver.step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.step_end(step, output)` {#CheckpointSaver.step_end} - -Callback after training step finished. - -This callback provides access to the tensors/ops evaluated at this step, -including the additional tensors for which evaluation was requested in -`step_begin`. - -In addition, the callback has the opportunity to stop training by returning -`True`. This is useful for early stopping, for example. - -Note that this method is not called if the call to `Session.run()` that -followed the last call to `step_begin()` failed. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`. True if training should stop. - -##### Raises: - - -* `ValueError`: if we've not begun a step, or `step` number does not match. - - - -- - - - -### `class tf.contrib.learn.monitors.EveryN` {#EveryN} - -Base class for monitors that execute callbacks every N steps. - -This class adds three new callbacks: - - every_n_step_begin - - every_n_step_end - - every_n_post_step - -The callbacks are executed every n steps, or optionally every step for the -first m steps, where m and n can both be user-specified. - -When extending this class, note that if you wish to use any of the -`BaseMonitor` callbacks, you must call their respective super implementation: - - def step_begin(self, step): - super(ExampleMonitor, self).step_begin(step) - return [] - -Failing to call the super implementation will cause unpredictable behavior. - -The `every_n_post_step()` callback is also called after the last step if it -was not already called through the regular conditions. Note that -`every_n_step_begin()` and `every_n_step_end()` do not receive that special -treatment. -- - - - -#### `tf.contrib.learn.monitors.EveryN.__init__(every_n_steps=100, first_n_steps=1)` {#EveryN.__init__} - -Initializes an `EveryN` monitor. - -##### Args: - - -* `every_n_steps`: `int`, the number of steps to allow between callbacks. -* `first_n_steps`: `int`, specifying the number of initial steps during - which the callbacks will always be executed, regardless of the value - of `every_n_steps`. Note that this value is relative to the global step - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.begin(max_steps=None)` {#EveryN.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.end(session=None)` {#EveryN.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.epoch_begin(epoch)` {#EveryN.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.epoch_end(epoch)` {#EveryN.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.every_n_post_step(step, session)` {#EveryN.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.every_n_step_begin(step)` {#EveryN.every_n_step_begin} - -Callback before every n'th step begins. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list` of tensors that will be evaluated at this step. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.every_n_step_end(step, outputs)` {#EveryN.every_n_step_end} - -Callback after every n'th step finished. - -This callback provides access to the tensors/ops evaluated at this step, -including the additional tensors for which evaluation was requested in -`step_begin`. - -In addition, the callback has the opportunity to stop training by returning -`True`. This is useful for early stopping, for example. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `outputs`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`. True if training should stop. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.post_step(step, session)` {#EveryN.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.run_on_all_workers` {#EveryN.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.set_estimator(estimator)` {#EveryN.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.step_begin(step)` {#EveryN.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.step_end(step, output)` {#EveryN.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - - -- - - - -### `class tf.contrib.learn.monitors.ExportMonitor` {#ExportMonitor} - -Monitor that exports Estimator every N steps. -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.__init__(*args, **kwargs)` {#ExportMonitor.__init__} - -Initializes ExportMonitor. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-23. -Instructions for updating: -The signature of the input_fn accepted by export is changing to be consistent with what's used by tf.Learn Estimator's train/evaluate. input_fn (and in most cases, input_feature_key) will both become required args. - -##### Args: - - -* `every_n_steps`: Run monitor every N steps. -* `export_dir`: str, folder to export. -* `input_fn`: A function that takes no argument and returns a tuple of - (features, labels), where features is a dict of string key to `Tensor` - and labels is a `Tensor` that's currently not used (and so can be - `None`). -* `input_feature_key`: String key into the features dict returned by - `input_fn` that corresponds to the raw `Example` strings `Tensor` that - the exported model will take as input. Should be `None` if and only if - you're passing in a `signature_fn` that does not use the first arg - (`Tensor` of `Example` strings). -* `exports_to_keep`: int, number of exports to keep. -* `signature_fn`: Function that returns a default signature and a named - signature map, given `Tensor` of `Example` strings, `dict` of `Tensor`s - for features and `dict` of `Tensor`s for predictions. -* `default_batch_size`: Default batch size of the `Example` placeholder. - -##### Raises: - - -* `ValueError`: If `input_fn` and `input_feature_key` are not both defined or - are not both `None`. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.begin(max_steps=None)` {#ExportMonitor.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.end(session=None)` {#ExportMonitor.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.epoch_begin(epoch)` {#ExportMonitor.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.epoch_end(epoch)` {#ExportMonitor.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.every_n_post_step(step, session)` {#ExportMonitor.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.every_n_step_begin(step)` {#ExportMonitor.every_n_step_begin} - -Callback before every n'th step begins. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list` of tensors that will be evaluated at this step. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.every_n_step_end(step, outputs)` {#ExportMonitor.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.export_dir` {#ExportMonitor.export_dir} - - - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.exports_to_keep` {#ExportMonitor.exports_to_keep} - - - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.last_export_dir` {#ExportMonitor.last_export_dir} - -Returns the directory containing the last completed export. - -##### Returns: - - The string path to the exported directory. NB: this functionality was - added on 2016/09/25; clients that depend on the return value may need - to handle the case where this function returns None because the - estimator being fitted does not yet return a value during export. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.post_step(step, session)` {#ExportMonitor.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.run_on_all_workers` {#ExportMonitor.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.set_estimator(estimator)` {#ExportMonitor.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.signature_fn` {#ExportMonitor.signature_fn} - - - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.step_begin(step)` {#ExportMonitor.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.step_end(step, output)` {#ExportMonitor.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - - -- - - - -### `class tf.contrib.learn.monitors.GraphDump` {#GraphDump} - -Dumps almost all tensors in the graph at every step. - -Note, this is very expensive, prefer `PrintTensor` in production. -- - - - -#### `tf.contrib.learn.monitors.GraphDump.__init__(ignore_ops=None)` {#GraphDump.__init__} - -Initializes GraphDump monitor. - -##### Args: - - -* `ignore_ops`: `list` of `string`. Names of ops to ignore. - If None, `GraphDump.IGNORE_OPS` is used. - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.begin(max_steps=None)` {#GraphDump.begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.compare(other_dump, step, atol=1e-06)` {#GraphDump.compare} - -Compares two `GraphDump` monitors and returns differences. - -##### Args: - - -* `other_dump`: Another `GraphDump` monitor. -* `step`: `int`, step to compare on. -* `atol`: `float`, absolute tolerance in comparison of floating arrays. - -##### Returns: - - Returns tuple: - -* `matched`: `list` of keys that matched. -* `non_matched`: `dict` of keys to tuple of 2 mismatched values. - -##### Raises: - - -* `ValueError`: if a key in `data` is missing from `other_dump` at `step`. - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.data` {#GraphDump.data} - - - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.end(session=None)` {#GraphDump.end} - -Callback at the end of training/evaluation. - -##### Args: - - -* `session`: A `tf.Session` object that can be used to run ops. - -##### Raises: - - -* `ValueError`: if we've not begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.epoch_begin(epoch)` {#GraphDump.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.epoch_end(epoch)` {#GraphDump.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.post_step(step, session)` {#GraphDump.post_step} - -Callback after the step is finished. - -Called after step_end and receives session to perform extra session.run -calls. If failure occurred in the process, will be called as well. - -##### Args: - - -* `step`: `int`, global step of the model. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.run_on_all_workers` {#GraphDump.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.set_estimator(estimator)` {#GraphDump.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.step_begin(step)` {#GraphDump.step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.step_end(step, output)` {#GraphDump.step_end} - - - - - -- - - - -### `class tf.contrib.learn.monitors.LoggingTrainable` {#LoggingTrainable} - -Writes trainable variable values into log every N steps. - -Write the tensors in trainable variables `every_n` steps, -starting with the `first_n`th step. -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.__init__(scope=None, every_n=100, first_n=1)` {#LoggingTrainable.__init__} - -Initializes LoggingTrainable monitor. - -##### Args: - - -* `scope`: An optional string to match variable names using re.match. -* `every_n`: Print every N steps. -* `first_n`: Print first N steps. - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.begin(max_steps=None)` {#LoggingTrainable.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.end(session=None)` {#LoggingTrainable.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.epoch_begin(epoch)` {#LoggingTrainable.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.epoch_end(epoch)` {#LoggingTrainable.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.every_n_post_step(step, session)` {#LoggingTrainable.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.every_n_step_begin(step)` {#LoggingTrainable.every_n_step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.every_n_step_end(step, outputs)` {#LoggingTrainable.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.post_step(step, session)` {#LoggingTrainable.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.run_on_all_workers` {#LoggingTrainable.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.set_estimator(estimator)` {#LoggingTrainable.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.step_begin(step)` {#LoggingTrainable.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.step_end(step, output)` {#LoggingTrainable.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - - -- - - - -### `class tf.contrib.learn.monitors.NanLoss` {#NanLoss} - -NaN Loss monitor. - -Monitors loss and stops training if loss is NaN. -Can either fail with exception or just stop training. -- - - - -#### `tf.contrib.learn.monitors.NanLoss.__init__(loss_tensor, every_n_steps=100, fail_on_nan_loss=True)` {#NanLoss.__init__} - -Initializes NanLoss monitor. - -##### Args: - - -* `loss_tensor`: `Tensor`, the loss tensor. -* `every_n_steps`: `int`, run check every this many steps. -* `fail_on_nan_loss`: `bool`, whether to raise exception when loss is NaN. - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.begin(max_steps=None)` {#NanLoss.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.end(session=None)` {#NanLoss.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.epoch_begin(epoch)` {#NanLoss.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.epoch_end(epoch)` {#NanLoss.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.every_n_post_step(step, session)` {#NanLoss.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.every_n_step_begin(step)` {#NanLoss.every_n_step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.every_n_step_end(step, outputs)` {#NanLoss.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.post_step(step, session)` {#NanLoss.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.run_on_all_workers` {#NanLoss.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.set_estimator(estimator)` {#NanLoss.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.step_begin(step)` {#NanLoss.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.step_end(step, output)` {#NanLoss.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - - -- - - - -### `class tf.contrib.learn.monitors.PrintTensor` {#PrintTensor} - -Prints given tensors every N steps. - -This is an `EveryN` monitor and has consistent semantic for `every_n` -and `first_n`. - -The tensors will be printed to the log, with `INFO` severity. -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.__init__(tensor_names, every_n=100, first_n=1)` {#PrintTensor.__init__} - -Initializes a PrintTensor monitor. - -##### Args: - - -* `tensor_names`: `dict` of tag to tensor names or - `iterable` of tensor names (strings). -* `every_n`: `int`, print every N steps. See `PrintN.` -* `first_n`: `int`, also print the first N steps. See `PrintN.` - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.begin(max_steps=None)` {#PrintTensor.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.end(session=None)` {#PrintTensor.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.epoch_begin(epoch)` {#PrintTensor.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.epoch_end(epoch)` {#PrintTensor.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.every_n_post_step(step, session)` {#PrintTensor.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.every_n_step_begin(step)` {#PrintTensor.every_n_step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.every_n_step_end(step, outputs)` {#PrintTensor.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.post_step(step, session)` {#PrintTensor.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.run_on_all_workers` {#PrintTensor.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.set_estimator(estimator)` {#PrintTensor.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.step_begin(step)` {#PrintTensor.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.step_end(step, output)` {#PrintTensor.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - - -- - - - -### `class tf.contrib.learn.monitors.StepCounter` {#StepCounter} - -Steps per second monitor. -- - - - -#### `tf.contrib.learn.monitors.StepCounter.__init__(every_n_steps=100, output_dir=None, summary_writer=None)` {#StepCounter.__init__} - - - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.begin(max_steps=None)` {#StepCounter.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.end(session=None)` {#StepCounter.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.epoch_begin(epoch)` {#StepCounter.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.epoch_end(epoch)` {#StepCounter.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.every_n_post_step(step, session)` {#StepCounter.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.every_n_step_begin(step)` {#StepCounter.every_n_step_begin} - -Callback before every n'th step begins. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list` of tensors that will be evaluated at this step. - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.every_n_step_end(current_step, outputs)` {#StepCounter.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.post_step(step, session)` {#StepCounter.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.run_on_all_workers` {#StepCounter.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.set_estimator(estimator)` {#StepCounter.set_estimator} - - - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.step_begin(step)` {#StepCounter.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.step_end(step, output)` {#StepCounter.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - - -- - - - -### `class tf.contrib.learn.monitors.StopAtStep` {#StopAtStep} - -Monitor to request stop at a specified step. -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.__init__(num_steps=None, last_step=None)` {#StopAtStep.__init__} - -Create a StopAtStep monitor. - -This monitor requests stop after either a number of steps have been -executed or a last step has been reached. Only of the two options can be -specified. - -if `num_steps` is specified, it indicates the number of steps to execute -after `begin()` is called. If instead `last_step` is specified, it -indicates the last step we want to execute, as passed to the `step_begin()` -call. - -##### Args: - - -* `num_steps`: Number of steps to execute. -* `last_step`: Step after which to stop. - -##### Raises: - - -* `ValueError`: If one of the arguments is invalid. - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.begin(max_steps=None)` {#StopAtStep.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.end(session=None)` {#StopAtStep.end} - -Callback at the end of training/evaluation. - -##### Args: - - -* `session`: A `tf.Session` object that can be used to run ops. - -##### Raises: - - -* `ValueError`: if we've not begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.epoch_begin(epoch)` {#StopAtStep.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.epoch_end(epoch)` {#StopAtStep.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.post_step(step, session)` {#StopAtStep.post_step} - -Callback after the step is finished. - -Called after step_end and receives session to perform extra session.run -calls. If failure occurred in the process, will be called as well. - -##### Args: - - -* `step`: `int`, global step of the model. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.run_on_all_workers` {#StopAtStep.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.set_estimator(estimator)` {#StopAtStep.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.step_begin(step)` {#StopAtStep.step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.step_end(step, output)` {#StopAtStep.step_end} - - - - - -- - - - -### `class tf.contrib.learn.monitors.SummarySaver` {#SummarySaver} - -Saves summaries every N steps. -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.__init__(summary_op, save_steps=100, output_dir=None, summary_writer=None, scaffold=None)` {#SummarySaver.__init__} - -Initializes a `SummarySaver` monitor. - -##### Args: - - -* `summary_op`: `Tensor` of type `string`. A serialized `Summary` protocol - buffer, as output by TF summary methods like `summary.scalar` or - `summary.merge_all`. -* `save_steps`: `int`, save summaries every N steps. See `EveryN`. -* `output_dir`: `string`, the directory to save the summaries to. Only used - if no `summary_writer` is supplied. -* `summary_writer`: `SummaryWriter`. If `None` and an `output_dir` was passed, - one will be created accordingly. -* `scaffold`: `Scaffold` to get summary_op if it's not provided. - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.begin(max_steps=None)` {#SummarySaver.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.end(session=None)` {#SummarySaver.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.epoch_begin(epoch)` {#SummarySaver.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.epoch_end(epoch)` {#SummarySaver.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.every_n_post_step(step, session)` {#SummarySaver.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.every_n_step_begin(step)` {#SummarySaver.every_n_step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.every_n_step_end(step, outputs)` {#SummarySaver.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.post_step(step, session)` {#SummarySaver.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.run_on_all_workers` {#SummarySaver.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.set_estimator(estimator)` {#SummarySaver.set_estimator} - - - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.step_begin(step)` {#SummarySaver.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.step_end(step, output)` {#SummarySaver.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - - -- - - - -### `class tf.contrib.learn.monitors.ValidationMonitor` {#ValidationMonitor} - -Runs evaluation of a given estimator, at most every N steps. - -Note that the evaluation is done based on the saved checkpoint, which will -usually be older than the current step. - -Can do early stopping on validation metrics if `early_stopping_rounds` is -provided. -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.__init__(x=None, y=None, input_fn=None, batch_size=None, eval_steps=None, every_n_steps=100, metrics=None, hooks=None, early_stopping_rounds=None, early_stopping_metric='loss', early_stopping_metric_minimize=True, name=None)` {#ValidationMonitor.__init__} - -Initializes a ValidationMonitor. - -##### Args: - - -* `x`: See `BaseEstimator.evaluate`. -* `y`: See `BaseEstimator.evaluate`. -* `input_fn`: See `BaseEstimator.evaluate`. -* `batch_size`: See `BaseEstimator.evaluate`. -* `eval_steps`: See `BaseEstimator.evaluate`. -* `every_n_steps`: Check for new checkpoints to evaluate every N steps. If a - new checkpoint is found, it is evaluated. See `EveryN`. -* `metrics`: See `BaseEstimator.evaluate`. -* `hooks`: A list of `SessionRunHook` hooks to pass to the - `Estimator`'s `evaluate` function. -* `early_stopping_rounds`: `int`. If the metric indicated by - `early_stopping_metric` does not change according to - `early_stopping_metric_minimize` for this many steps, then training - will be stopped. -* `early_stopping_metric`: `string`, name of the metric to check for early - stopping. -* `early_stopping_metric_minimize`: `bool`, True if `early_stopping_metric` is - expected to decrease (thus early stopping occurs when this metric - stops decreasing), False if `early_stopping_metric` is expected to - increase. Typically, `early_stopping_metric_minimize` is True for - loss metrics like mean squared error, and False for performance - metrics like accuracy. -* `name`: See `BaseEstimator.evaluate`. - -##### Raises: - - -* `ValueError`: If both x and input_fn are provided. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.begin(max_steps=None)` {#ValidationMonitor.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.best_step` {#ValidationMonitor.best_step} - -Returns the step at which the best early stopping metric was found. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.best_value` {#ValidationMonitor.best_value} - -Returns the best early stopping metric value found so far. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.early_stopped` {#ValidationMonitor.early_stopped} - -Returns True if this monitor caused an early stop. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.end(session=None)` {#ValidationMonitor.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.epoch_begin(epoch)` {#ValidationMonitor.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.epoch_end(epoch)` {#ValidationMonitor.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.every_n_post_step(step, session)` {#ValidationMonitor.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.every_n_step_begin(step)` {#ValidationMonitor.every_n_step_begin} - -Callback before every n'th step begins. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list` of tensors that will be evaluated at this step. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.every_n_step_end(step, outputs)` {#ValidationMonitor.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.post_step(step, session)` {#ValidationMonitor.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.run_on_all_workers` {#ValidationMonitor.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.set_estimator(estimator)` {#ValidationMonitor.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.step_begin(step)` {#ValidationMonitor.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.step_end(step, output)` {#ValidationMonitor.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - - - -## Other Functions and Classes -- - - - -### `class tf.contrib.learn.monitors.RunHookAdapterForMonitors` {#RunHookAdapterForMonitors} - -Wraps monitors into a SessionRunHook. -- - - - -#### `tf.contrib.learn.monitors.RunHookAdapterForMonitors.__init__(monitors)` {#RunHookAdapterForMonitors.__init__} - - - - -- - - - -#### `tf.contrib.learn.monitors.RunHookAdapterForMonitors.after_create_session(session, coord)` {#RunHookAdapterForMonitors.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.contrib.learn.monitors.RunHookAdapterForMonitors.after_run(run_context, run_values)` {#RunHookAdapterForMonitors.after_run} - - - - -- - - - -#### `tf.contrib.learn.monitors.RunHookAdapterForMonitors.before_run(run_context)` {#RunHookAdapterForMonitors.before_run} - - - - -- - - - -#### `tf.contrib.learn.monitors.RunHookAdapterForMonitors.begin()` {#RunHookAdapterForMonitors.begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.RunHookAdapterForMonitors.end(session)` {#RunHookAdapterForMonitors.end} - - - - - -- - - - -### `class tf.contrib.learn.monitors.SummaryWriterCache` {#SummaryWriterCache} - -Cache for file writers. - -This class caches file writers, one per directory. -- - - - -#### `tf.contrib.learn.monitors.SummaryWriterCache.clear()` {#SummaryWriterCache.clear} - -Clear cached summary writers. Currently only used for unit tests. - - -- - - - -#### `tf.contrib.learn.monitors.SummaryWriterCache.get(logdir)` {#SummaryWriterCache.get} - -Returns the FileWriter for the specified directory. - -##### Args: - - -* `logdir`: str, name of the directory. - -##### Returns: - - A `FileWriter`. - - - -- - - - -### `tf.contrib.learn.monitors.replace_monitors_with_hooks(monitors_or_hooks, estimator)` {#replace_monitors_with_hooks} - -Wraps monitors with a hook. - -`Monitor` is deprecated in favor of `SessionRunHook`. If you're using a -monitor, you can wrap it with a hook using function. It is recommended to -implement hook version of your monitor. - -##### Args: - - -* `monitors_or_hooks`: A `list` may contain both monitors and hooks. -* `estimator`: An `Estimator` that monitor will be used with. - -##### Returns: - - Returns a list of hooks. If there is any monitor in the given list, it is - replaced by a hook. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.legacy_seq2seq.md b/tensorflow/g3doc/api_docs/python/contrib.legacy_seq2seq.md deleted file mode 100644 index 93fc775143..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.legacy_seq2seq.md +++ /dev/null @@ -1,587 +0,0 @@ - - -# Sequence to Sequence (contrib) -[TOC] - -Deprecated library for creating sequence-to-sequence models in TensorFlow. - -- - - - -### `tf.contrib.legacy_seq2seq.attention_decoder(decoder_inputs, initial_state, attention_states, cell, output_size=None, num_heads=1, loop_function=None, dtype=None, scope=None, initial_state_attention=False)` {#attention_decoder} - -RNN decoder with attention for the sequence-to-sequence model. - -In this context "attention" means that, during decoding, the RNN can look up -information in the additional tensor attention_states, and it does this by -focusing on a few entries from the tensor. This model has proven to yield -especially good results in a number of sequence-to-sequence tasks. This -implementation is based on http://arxiv.org/abs/1412.7449 (see below for -details). It is recommended for complex sequence-to-sequence tasks. - -##### Args: - - -* `decoder_inputs`: A list of 2D Tensors [batch_size x input_size]. -* `initial_state`: 2D Tensor [batch_size x cell.state_size]. -* `attention_states`: 3D Tensor [batch_size x attn_length x attn_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function and size. -* `output_size`: Size of the output vectors; if None, we use cell.output_size. -* `num_heads`: Number of attention heads that read from attention_states. -* `loop_function`: If not None, this function will be applied to i-th output - in order to generate i+1-th input, and decoder_inputs will be ignored, - except for the first element ("GO" symbol). This can be used for decoding, - but also for training to emulate http://arxiv.org/abs/1506.03099. - Signature -- loop_function(prev, i) = next - * prev is a 2D Tensor of shape [batch_size x output_size], - * i is an integer, the step number (when advanced control is needed), - * next is a 2D Tensor of shape [batch_size x input_size]. -* `dtype`: The dtype to use for the RNN initial state (default: tf.float32). -* `scope`: VariableScope for the created subgraph; default: "attention_decoder". -* `initial_state_attention`: If False (default), initial attentions are zero. - If True, initialize the attentions from the initial state and attention - states -- useful when we wish to resume decoding from a previously - stored decoder state and attention states. - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors of - shape [batch_size x output_size]. These represent the generated outputs. - Output i is computed from input i (which is either the i-th element - of decoder_inputs or loop_function(output {i-1}, i)) as follows. - First, we run the cell on a combination of the input and previous - attention masks: - cell_output, new_state = cell(linear(input, prev_attn), prev_state). - Then, we calculate new attention masks: - new_attn = softmax(V^T * tanh(W * attention_states + U * new_state)) - and then we calculate the output: - output = linear(cell_output, new_attn). -* `state`: The state of each decoder cell the final time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - -##### Raises: - - -* `ValueError`: when num_heads is not positive, there are no inputs, shapes - of attention_states are not set, or input size cannot be inferred - from the input. - - -- - - - -### `tf.contrib.legacy_seq2seq.basic_rnn_seq2seq(encoder_inputs, decoder_inputs, cell, dtype=tf.float32, scope=None)` {#basic_rnn_seq2seq} - -Basic RNN sequence-to-sequence model. - -This model first runs an RNN to encode encoder_inputs into a state vector, -then runs decoder, initialized with the last encoder state, on decoder_inputs. -Encoder and decoder use the same RNN cell type, but don't share parameters. - -##### Args: - - -* `encoder_inputs`: A list of 2D Tensors [batch_size x input_size]. -* `decoder_inputs`: A list of 2D Tensors [batch_size x input_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function and size. -* `dtype`: The dtype of the initial state of the RNN cell (default: tf.float32). -* `scope`: VariableScope for the created subgraph; default: "basic_rnn_seq2seq". - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors with - shape [batch_size x output_size] containing the generated outputs. -* `state`: The state of each decoder cell in the final time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - - -- - - - -### `tf.contrib.legacy_seq2seq.embedding_attention_decoder(decoder_inputs, initial_state, attention_states, cell, num_symbols, embedding_size, num_heads=1, output_size=None, output_projection=None, feed_previous=False, update_embedding_for_previous=True, dtype=None, scope=None, initial_state_attention=False)` {#embedding_attention_decoder} - -RNN decoder with embedding and attention and a pure-decoding option. - -##### Args: - - -* `decoder_inputs`: A list of 1D batch-sized int32 Tensors (decoder inputs). -* `initial_state`: 2D Tensor [batch_size x cell.state_size]. -* `attention_states`: 3D Tensor [batch_size x attn_length x attn_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function. -* `num_symbols`: Integer, how many symbols come into the embedding. -* `embedding_size`: Integer, the length of the embedding vector for each symbol. -* `num_heads`: Number of attention heads that read from attention_states. -* `output_size`: Size of the output vectors; if None, use output_size. -* `output_projection`: None or a pair (W, B) of output projection weights and - biases; W has shape [output_size x num_symbols] and B has shape - [num_symbols]; if provided and feed_previous=True, each fed previous - output will first be multiplied by W and added B. -* `feed_previous`: Boolean; if True, only the first of decoder_inputs will be - used (the "GO" symbol), and all other decoder inputs will be generated by: - next = embedding_lookup(embedding, argmax(previous_output)), - In effect, this implements a greedy decoder. It can also be used - during training to emulate http://arxiv.org/abs/1506.03099. - If False, decoder_inputs are used as given (the standard decoder case). -* `update_embedding_for_previous`: Boolean; if False and feed_previous=True, - only the embedding for the first symbol of decoder_inputs (the "GO" - symbol) will be updated by back propagation. Embeddings for the symbols - generated from the decoder itself remain unchanged. This parameter has - no effect if feed_previous=False. -* `dtype`: The dtype to use for the RNN initial states (default: tf.float32). -* `scope`: VariableScope for the created subgraph; defaults to - "embedding_attention_decoder". -* `initial_state_attention`: If False (default), initial attentions are zero. - If True, initialize the attentions from the initial state and attention - states -- useful when we wish to resume decoding from a previously - stored decoder state and attention states. - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors with - shape [batch_size x output_size] containing the generated outputs. -* `state`: The state of each decoder cell at the final time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - -##### Raises: - - -* `ValueError`: When output_projection has the wrong shape. - - -- - - - -### `tf.contrib.legacy_seq2seq.embedding_attention_seq2seq(encoder_inputs, decoder_inputs, cell, num_encoder_symbols, num_decoder_symbols, embedding_size, num_heads=1, output_projection=None, feed_previous=False, dtype=None, scope=None, initial_state_attention=False)` {#embedding_attention_seq2seq} - -Embedding sequence-to-sequence model with attention. - -This model first embeds encoder_inputs by a newly created embedding (of shape -[num_encoder_symbols x input_size]). Then it runs an RNN to encode -embedded encoder_inputs into a state vector. It keeps the outputs of this -RNN at every step to use for attention later. Next, it embeds decoder_inputs -by another newly created embedding (of shape [num_decoder_symbols x -input_size]). Then it runs attention decoder, initialized with the last -encoder state, on embedded decoder_inputs and attending to encoder outputs. - -Warning: when output_projection is None, the size of the attention vectors -and variables will be made proportional to num_decoder_symbols, can be large. - -##### Args: - - -* `encoder_inputs`: A list of 1D int32 Tensors of shape [batch_size]. -* `decoder_inputs`: A list of 1D int32 Tensors of shape [batch_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function and size. -* `num_encoder_symbols`: Integer; number of symbols on the encoder side. -* `num_decoder_symbols`: Integer; number of symbols on the decoder side. -* `embedding_size`: Integer, the length of the embedding vector for each symbol. -* `num_heads`: Number of attention heads that read from attention_states. -* `output_projection`: None or a pair (W, B) of output projection weights and - biases; W has shape [output_size x num_decoder_symbols] and B has - shape [num_decoder_symbols]; if provided and feed_previous=True, each - fed previous output will first be multiplied by W and added B. -* `feed_previous`: Boolean or scalar Boolean Tensor; if True, only the first - of decoder_inputs will be used (the "GO" symbol), and all other decoder - inputs will be taken from previous outputs (as in embedding_rnn_decoder). - If False, decoder_inputs are used as given (the standard decoder case). -* `dtype`: The dtype of the initial RNN state (default: tf.float32). -* `scope`: VariableScope for the created subgraph; defaults to - "embedding_attention_seq2seq". -* `initial_state_attention`: If False (default), initial attentions are zero. - If True, initialize the attentions from the initial state and attention - states. - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors with - shape [batch_size x num_decoder_symbols] containing the generated - outputs. -* `state`: The state of each decoder cell at the final time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - - -- - - - -### `tf.contrib.legacy_seq2seq.embedding_rnn_decoder(decoder_inputs, initial_state, cell, num_symbols, embedding_size, output_projection=None, feed_previous=False, update_embedding_for_previous=True, scope=None)` {#embedding_rnn_decoder} - -RNN decoder with embedding and a pure-decoding option. - -##### Args: - - -* `decoder_inputs`: A list of 1D batch-sized int32 Tensors (decoder inputs). -* `initial_state`: 2D Tensor [batch_size x cell.state_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function. -* `num_symbols`: Integer, how many symbols come into the embedding. -* `embedding_size`: Integer, the length of the embedding vector for each symbol. -* `output_projection`: None or a pair (W, B) of output projection weights and - biases; W has shape [output_size x num_symbols] and B has - shape [num_symbols]; if provided and feed_previous=True, each fed - previous output will first be multiplied by W and added B. -* `feed_previous`: Boolean; if True, only the first of decoder_inputs will be - used (the "GO" symbol), and all other decoder inputs will be generated by: - next = embedding_lookup(embedding, argmax(previous_output)), - In effect, this implements a greedy decoder. It can also be used - during training to emulate http://arxiv.org/abs/1506.03099. - If False, decoder_inputs are used as given (the standard decoder case). -* `update_embedding_for_previous`: Boolean; if False and feed_previous=True, - only the embedding for the first symbol of decoder_inputs (the "GO" - symbol) will be updated by back propagation. Embeddings for the symbols - generated from the decoder itself remain unchanged. This parameter has - no effect if feed_previous=False. -* `scope`: VariableScope for the created subgraph; defaults to - "embedding_rnn_decoder". - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors. The - output is of shape [batch_size x cell.output_size] when - output_projection is not None (and represents the dense representation - of predicted tokens). It is of shape [batch_size x num_decoder_symbols] - when output_projection is None. -* `state`: The state of each decoder cell in each time-step. This is a list - with length len(decoder_inputs) -- one item for each time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - -##### Raises: - - -* `ValueError`: When output_projection has the wrong shape. - - -- - - - -### `tf.contrib.legacy_seq2seq.embedding_rnn_seq2seq(encoder_inputs, decoder_inputs, cell, num_encoder_symbols, num_decoder_symbols, embedding_size, output_projection=None, feed_previous=False, dtype=None, scope=None)` {#embedding_rnn_seq2seq} - -Embedding RNN sequence-to-sequence model. - -This model first embeds encoder_inputs by a newly created embedding (of shape -[num_encoder_symbols x input_size]). Then it runs an RNN to encode -embedded encoder_inputs into a state vector. Next, it embeds decoder_inputs -by another newly created embedding (of shape [num_decoder_symbols x -input_size]). Then it runs RNN decoder, initialized with the last -encoder state, on embedded decoder_inputs. - -##### Args: - - -* `encoder_inputs`: A list of 1D int32 Tensors of shape [batch_size]. -* `decoder_inputs`: A list of 1D int32 Tensors of shape [batch_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function and size. -* `num_encoder_symbols`: Integer; number of symbols on the encoder side. -* `num_decoder_symbols`: Integer; number of symbols on the decoder side. -* `embedding_size`: Integer, the length of the embedding vector for each symbol. -* `output_projection`: None or a pair (W, B) of output projection weights and - biases; W has shape [output_size x num_decoder_symbols] and B has - shape [num_decoder_symbols]; if provided and feed_previous=True, each - fed previous output will first be multiplied by W and added B. -* `feed_previous`: Boolean or scalar Boolean Tensor; if True, only the first - of decoder_inputs will be used (the "GO" symbol), and all other decoder - inputs will be taken from previous outputs (as in embedding_rnn_decoder). - If False, decoder_inputs are used as given (the standard decoder case). -* `dtype`: The dtype of the initial state for both the encoder and encoder - rnn cells (default: tf.float32). -* `scope`: VariableScope for the created subgraph; defaults to - "embedding_rnn_seq2seq" - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors. The - output is of shape [batch_size x cell.output_size] when - output_projection is not None (and represents the dense representation - of predicted tokens). It is of shape [batch_size x num_decoder_symbols] - when output_projection is None. -* `state`: The state of each decoder cell in each time-step. This is a list - with length len(decoder_inputs) -- one item for each time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - - -- - - - -### `tf.contrib.legacy_seq2seq.embedding_tied_rnn_seq2seq(encoder_inputs, decoder_inputs, cell, num_symbols, embedding_size, num_decoder_symbols=None, output_projection=None, feed_previous=False, dtype=None, scope=None)` {#embedding_tied_rnn_seq2seq} - -Embedding RNN sequence-to-sequence model with tied (shared) parameters. - -This model first embeds encoder_inputs by a newly created embedding (of shape -[num_symbols x input_size]). Then it runs an RNN to encode embedded -encoder_inputs into a state vector. Next, it embeds decoder_inputs using -the same embedding. Then it runs RNN decoder, initialized with the last -encoder state, on embedded decoder_inputs. The decoder output is over symbols -from 0 to num_decoder_symbols - 1 if num_decoder_symbols is none; otherwise it -is over 0 to num_symbols - 1. - -##### Args: - - -* `encoder_inputs`: A list of 1D int32 Tensors of shape [batch_size]. -* `decoder_inputs`: A list of 1D int32 Tensors of shape [batch_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function and size. -* `num_symbols`: Integer; number of symbols for both encoder and decoder. -* `embedding_size`: Integer, the length of the embedding vector for each symbol. -* `num_decoder_symbols`: Integer; number of output symbols for decoder. If - provided, the decoder output is over symbols 0 to num_decoder_symbols - 1. - Otherwise, decoder output is over symbols 0 to num_symbols - 1. Note that - this assumes that the vocabulary is set up such that the first - num_decoder_symbols of num_symbols are part of decoding. -* `output_projection`: None or a pair (W, B) of output projection weights and - biases; W has shape [output_size x num_symbols] and B has - shape [num_symbols]; if provided and feed_previous=True, each - fed previous output will first be multiplied by W and added B. -* `feed_previous`: Boolean or scalar Boolean Tensor; if True, only the first - of decoder_inputs will be used (the "GO" symbol), and all other decoder - inputs will be taken from previous outputs (as in embedding_rnn_decoder). - If False, decoder_inputs are used as given (the standard decoder case). -* `dtype`: The dtype to use for the initial RNN states (default: tf.float32). -* `scope`: VariableScope for the created subgraph; defaults to - "embedding_tied_rnn_seq2seq". - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors with - shape [batch_size x output_symbols] containing the generated - outputs where output_symbols = num_decoder_symbols if - num_decoder_symbols is not None otherwise output_symbols = num_symbols. -* `state`: The state of each decoder cell at the final time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - -##### Raises: - - -* `ValueError`: When output_projection has the wrong shape. - - -- - - - -### `tf.contrib.legacy_seq2seq.model_with_buckets(encoder_inputs, decoder_inputs, targets, weights, buckets, seq2seq, softmax_loss_function=None, per_example_loss=False, name=None)` {#model_with_buckets} - -Create a sequence-to-sequence model with support for bucketing. - -The seq2seq argument is a function that defines a sequence-to-sequence model, -e.g., seq2seq = lambda x, y: basic_rnn_seq2seq( - x, y, core_rnn_cell.GRUCell(24)) - -##### Args: - - -* `encoder_inputs`: A list of Tensors to feed the encoder; first seq2seq input. -* `decoder_inputs`: A list of Tensors to feed the decoder; second seq2seq input. -* `targets`: A list of 1D batch-sized int32 Tensors (desired output sequence). -* `weights`: List of 1D batch-sized float-Tensors to weight the targets. -* `buckets`: A list of pairs of (input size, output size) for each bucket. -* `seq2seq`: A sequence-to-sequence model function; it takes 2 input that - agree with encoder_inputs and decoder_inputs, and returns a pair - consisting of outputs and states (as, e.g., basic_rnn_seq2seq). -* `softmax_loss_function`: Function (inputs-batch, labels-batch) -> loss-batch - to be used instead of the standard softmax (the default if this is None). -* `per_example_loss`: Boolean. If set, the returned loss will be a batch-sized - tensor of losses for each sequence in the batch. If unset, it will be - a scalar with the averaged loss from all examples. -* `name`: Optional name for this operation, defaults to "model_with_buckets". - -##### Returns: - - A tuple of the form (outputs, losses), where: - -* `outputs`: The outputs for each bucket. Its j'th element consists of a list - of 2D Tensors. The shape of output tensors can be either - [batch_size x output_size] or [batch_size x num_decoder_symbols] - depending on the seq2seq model used. -* `losses`: List of scalar Tensors, representing losses for each bucket, or, - if per_example_loss is set, a list of 1D batch-sized float Tensors. - -##### Raises: - - -* `ValueError`: If length of encoder_inputsut, targets, or weights is smaller - than the largest (last) bucket. - - -- - - - -### `tf.contrib.legacy_seq2seq.one2many_rnn_seq2seq(encoder_inputs, decoder_inputs_dict, enc_cell, dec_cells_dict, num_encoder_symbols, num_decoder_symbols_dict, embedding_size, feed_previous=False, dtype=None, scope=None)` {#one2many_rnn_seq2seq} - -One-to-many RNN sequence-to-sequence model (multi-task). - -This is a multi-task sequence-to-sequence model with one encoder and multiple -decoders. Reference to multi-task sequence-to-sequence learning can be found -here: http://arxiv.org/abs/1511.06114 - -##### Args: - - -* `encoder_inputs`: A list of 1D int32 Tensors of shape [batch_size]. -* `decoder_inputs_dict`: A dictionany mapping decoder name (string) to - the corresponding decoder_inputs; each decoder_inputs is a list of 1D - Tensors of shape [batch_size]; num_decoders is defined as - len(decoder_inputs_dict). -* `enc_cell`: core_rnn_cell.RNNCell defining the encoder cell function and size. -* `dec_cells_dict`: A dictionary mapping encoder name (string) to an - instance of core_rnn_cell.RNNCell. -* `num_encoder_symbols`: Integer; number of symbols on the encoder side. -* `num_decoder_symbols_dict`: A dictionary mapping decoder name (string) to an - integer specifying number of symbols for the corresponding decoder; - len(num_decoder_symbols_dict) must be equal to num_decoders. -* `embedding_size`: Integer, the length of the embedding vector for each symbol. -* `feed_previous`: Boolean or scalar Boolean Tensor; if True, only the first of - decoder_inputs will be used (the "GO" symbol), and all other decoder - inputs will be taken from previous outputs (as in embedding_rnn_decoder). - If False, decoder_inputs are used as given (the standard decoder case). -* `dtype`: The dtype of the initial state for both the encoder and encoder - rnn cells (default: tf.float32). -* `scope`: VariableScope for the created subgraph; defaults to - "one2many_rnn_seq2seq" - -##### Returns: - - A tuple of the form (outputs_dict, state_dict), where: - -* `outputs_dict`: A mapping from decoder name (string) to a list of the same - length as decoder_inputs_dict[name]; each element in the list is a 2D - Tensors with shape [batch_size x num_decoder_symbol_list[name]] - containing the generated outputs. -* `state_dict`: A mapping from decoder name (string) to the final state of the - corresponding decoder RNN; it is a 2D Tensor of shape - [batch_size x cell.state_size]. - -##### Raises: - - -* `TypeError`: if enc_cell or any of the dec_cells are not instances of RNNCell. -* `ValueError`: if len(dec_cells) != len(decoder_inputs_dict). - - -- - - - -### `tf.contrib.legacy_seq2seq.rnn_decoder(decoder_inputs, initial_state, cell, loop_function=None, scope=None)` {#rnn_decoder} - -RNN decoder for the sequence-to-sequence model. - -##### Args: - - -* `decoder_inputs`: A list of 2D Tensors [batch_size x input_size]. -* `initial_state`: 2D Tensor with shape [batch_size x cell.state_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function and size. -* `loop_function`: If not None, this function will be applied to the i-th output - in order to generate the i+1-st input, and decoder_inputs will be ignored, - except for the first element ("GO" symbol). This can be used for decoding, - but also for training to emulate http://arxiv.org/abs/1506.03099. - Signature -- loop_function(prev, i) = next - * prev is a 2D Tensor of shape [batch_size x output_size], - * i is an integer, the step number (when advanced control is needed), - * next is a 2D Tensor of shape [batch_size x input_size]. -* `scope`: VariableScope for the created subgraph; defaults to "rnn_decoder". - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors with - shape [batch_size x output_size] containing generated outputs. -* `state`: The state of each cell at the final time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - (Note that in some cases, like basic RNN cell or GRU cell, outputs and - states can be the same. They are different for LSTM cells though.) - - -- - - - -### `tf.contrib.legacy_seq2seq.sequence_loss(logits, targets, weights, average_across_timesteps=True, average_across_batch=True, softmax_loss_function=None, name=None)` {#sequence_loss} - -Weighted cross-entropy loss for a sequence of logits, batch-collapsed. - -##### Args: - - -* `logits`: List of 2D Tensors of shape [batch_size x num_decoder_symbols]. -* `targets`: List of 1D batch-sized int32 Tensors of the same length as logits. -* `weights`: List of 1D batch-sized float-Tensors of the same length as logits. -* `average_across_timesteps`: If set, divide the returned cost by the total - label weight. -* `average_across_batch`: If set, divide the returned cost by the batch size. -* `softmax_loss_function`: Function (inputs-batch, labels-batch) -> loss-batch - to be used instead of the standard softmax (the default if this is None). -* `name`: Optional name for this operation, defaults to "sequence_loss". - -##### Returns: - - A scalar float Tensor: The average log-perplexity per symbol (weighted). - -##### Raises: - - -* `ValueError`: If len(logits) is different from len(targets) or len(weights). - - -- - - - -### `tf.contrib.legacy_seq2seq.sequence_loss_by_example(logits, targets, weights, average_across_timesteps=True, softmax_loss_function=None, name=None)` {#sequence_loss_by_example} - -Weighted cross-entropy loss for a sequence of logits (per example). - -##### Args: - - -* `logits`: List of 2D Tensors of shape [batch_size x num_decoder_symbols]. -* `targets`: List of 1D batch-sized int32 Tensors of the same length as logits. -* `weights`: List of 1D batch-sized float-Tensors of the same length as logits. -* `average_across_timesteps`: If set, divide the returned cost by the total - label weight. -* `softmax_loss_function`: Function (labels-batch, inputs-batch) -> loss-batch - to be used instead of the standard softmax (the default if this is None). -* `name`: Optional name for this operation, default: "sequence_loss_by_example". - -##### Returns: - - 1D batch-sized float Tensor: The log-perplexity for each sequence. - -##### Raises: - - -* `ValueError`: If len(logits) is different from len(targets) or len(weights). - - -- - - - -### `tf.contrib.legacy_seq2seq.tied_rnn_seq2seq(encoder_inputs, decoder_inputs, cell, loop_function=None, dtype=tf.float32, scope=None)` {#tied_rnn_seq2seq} - -RNN sequence-to-sequence model with tied encoder and decoder parameters. - -This model first runs an RNN to encode encoder_inputs into a state vector, and -then runs decoder, initialized with the last encoder state, on decoder_inputs. -Encoder and decoder use the same RNN cell and share parameters. - -##### Args: - - -* `encoder_inputs`: A list of 2D Tensors [batch_size x input_size]. -* `decoder_inputs`: A list of 2D Tensors [batch_size x input_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function and size. -* `loop_function`: If not None, this function will be applied to i-th output - in order to generate i+1-th input, and decoder_inputs will be ignored, - except for the first element ("GO" symbol), see rnn_decoder for details. -* `dtype`: The dtype of the initial state of the rnn cell (default: tf.float32). -* `scope`: VariableScope for the created subgraph; default: "tied_rnn_seq2seq". - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors with - shape [batch_size x output_size] containing the generated outputs. -* `state`: The state of each decoder cell in each time-step. This is a list - with length len(decoder_inputs) -- one item for each time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.linalg.md b/tensorflow/g3doc/api_docs/python/contrib.linalg.md deleted file mode 100644 index 2060e85211..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.linalg.md +++ /dev/null @@ -1,4413 +0,0 @@ - - -# Linear Algebra (contrib) -[TOC] - -Linear algebra libraries. See the @{$python/contrib.linalg} guide. - -- - - - -### `class tf.contrib.linalg.LinearOperator` {#LinearOperator} - -Base class defining a [batch of] linear operator[s]. - -Subclasses of `LinearOperator` provide a access to common methods on a -(batch) matrix, without the need to materialize the matrix. This allows: - -* Matrix free computations -* Operators that take advantage of special structure, while providing a - consistent API to users. - -#### Subclassing - -To enable a public method, subclasses should implement the leading-underscore -version of the method. The argument signature should be identical except for -the omission of `name="..."`. For example, to enable -`apply(x, adjoint=False, name="apply")` a subclass should implement -`_apply(x, adjoint=False)`. - -#### Performance contract - -Subclasses should implement a method only if it can be done with a reasonable -performance increase over generic dense operations, either in time, parallel -scalability, or memory usage. For example, if the determinant can only be -computed using `tf.matrix_determinant(self.to_dense())`, then determinants -should not be implemented. - -Class docstrings should contain an explanation of computational complexity. -Since this is a high-performance library, attention should be paid to detail, -and explanations can include constants as well as Big-O notation. - -#### Shape compatibility - -`LinearOperator` sub classes should operate on a [batch] matrix with -compatible shape. Class docstrings should define what is meant by compatible -shape. Some sub-classes may not support batching. - -An example is: - -`x` is a batch matrix with compatible shape for `apply` if - -``` -operator.shape = [B1,...,Bb] + [M, N], b >= 0, -x.shape = [B1,...,Bb] + [N, R] -``` - -`rhs` is a batch matrix with compatible shape for `solve` if - -``` -operator.shape = [B1,...,Bb] + [M, N], b >= 0, -rhs.shape = [B1,...,Bb] + [M, R] -``` - -#### Example docstring for subclasses. - -This operator acts like a (batch) matrix `A` with shape -`[B1,...,Bb, M, N]` for some `b >= 0`. The first `b` indices index a -batch member. For every batch index `(i1,...,ib)`, `A[i1,...,ib, : :]` is -an `m x n` matrix. Again, this matrix `A` may not be materialized, but for -purposes of identifying and working with compatible arguments the shape is -relevant. - -Examples: - -```python -some_tensor = ... shape = ???? -operator = MyLinOp(some_tensor) - -operator.shape() -==> [2, 4, 4] - -operator.log_determinant() -==> Shape [2] Tensor - -x = ... Shape [2, 4, 5] Tensor - -operator.apply(x) -==> Shape [2, 4, 5] Tensor -``` - -#### Shape compatibility - -This operator acts on batch matrices with compatible shape. -FILL IN WHAT IS MEANT BY COMPATIBLE SHAPE - -#### Performance - -FILL THIS IN - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite, square`. -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperator.__init__(dtype, graph_parents=None, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, is_square=None, name=None)` {#LinearOperator.__init__} - -Initialize the `LinearOperator`. - -**This is a private method for subclass use.** -**Subclasses should copy-paste this `__init__` documentation.** - -##### Args: - - -* `dtype`: The type of the this `LinearOperator`. Arguments to `apply` and - `solve` will have to be this type. -* `graph_parents`: Python list of graph prerequisites of this `LinearOperator` - Typically tensors that are passed during initialization. -* `is_non_singular`: Expect that this operator is non-singular. -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. If `dtype` is real, this is equivalent to being symmetric. -* `is_positive_definite`: Expect that this operator is positive definite, - meaning the real part of all eigenvalues is positive. We do not require - the operator to be self-adjoint to be positive-definite. See: -* `https`: //en.wikipedia.org/wiki/Positive-definite_matrix\ - #Extension_for_non_symmetric_matrices -* `is_square`: Expect that this operator acts like square [batch] matrices. -* `name`: A name for this `LinearOperator`. - -##### Raises: - - -* `ValueError`: If any member of graph_parents is `None` or not a `Tensor`. -* `ValueError`: If hints are set incorrectly. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.add_to_tensor(x, name='add_to_tensor')` {#LinearOperator.add_to_tensor} - -Add matrix represented by this operator to `x`. Equivalent to `A + x`. - -##### Args: - - -* `x`: `Tensor` with same `dtype` and shape broadcastable to `self.shape`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.apply(x, adjoint=False, name='apply')` {#LinearOperator.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.assert_non_singular(name='assert_non_singular')` {#LinearOperator.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.assert_positive_definite(name='assert_positive_definite')` {#LinearOperator.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperator.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.batch_shape` {#LinearOperator.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperator.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperator.determinant(name='det')` {#LinearOperator.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.diag_part(name='diag_part')` {#LinearOperator.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.domain_dimension` {#LinearOperator.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperator.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperator.dtype` {#LinearOperator.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.graph_parents` {#LinearOperator.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.is_non_singular` {#LinearOperator.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperator.is_positive_definite` {#LinearOperator.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperator.is_self_adjoint` {#LinearOperator.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperator.is_square` {#LinearOperator.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.log_abs_determinant(name='log_abs_det')` {#LinearOperator.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.name` {#LinearOperator.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.range_dimension` {#LinearOperator.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperator.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperator.shape` {#LinearOperator.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.shape_tensor(name='shape_tensor')` {#LinearOperator.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperator.solve(rhs, adjoint=False, name='solve')` {#LinearOperator.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.tensor_rank` {#LinearOperator.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperator.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.to_dense(name='to_dense')` {#LinearOperator.to_dense} - -Return a dense (batch) matrix representing this operator. - - - -- - - - -### `class tf.contrib.linalg.LinearOperatorDiag` {#LinearOperatorDiag} - -`LinearOperator` acting like a [batch] square diagonal matrix. - -This operator acts like a [batch] diagonal matrix `A` with shape -`[B1,...,Bb, N, N]` for some `b >= 0`. The first `b` indices index a -batch member. For every batch index `(i1,...,ib)`, `A[i1,...,ib, : :]` is -an `N x N` matrix. This matrix `A` is not materialized, but for -purposes of broadcasting this shape will be relevant. - -`LinearOperatorDiag` is initialized with a (batch) vector. - -```python -# Create a 2 x 2 diagonal linear operator. -diag = [1., -1.] -operator = LinearOperatorDiag(diag) - -operator.to_dense() -==> [[1., 0.] - [0., -1.]] - -operator.shape -==> [2, 2] - -operator.log_determinant() -==> scalar Tensor - -x = ... Shape [2, 4] Tensor -operator.apply(x) -==> Shape [2, 4] Tensor - -# Create a [2, 3] batch of 4 x 4 linear operators. -diag = tf.random_normal(shape=[2, 3, 4]) -operator = LinearOperatorDiag(diag) - -# Create a shape [2, 1, 4, 2] vector. Note that this shape is compatible -# since the batch dimensions, [2, 1], are brodcast to -# operator.batch_shape = [2, 3]. -y = tf.random_normal(shape=[2, 1, 4, 2]) -x = operator.solve(y) -==> operator.apply(x) = y -``` - -#### Shape compatibility - -This operator acts on [batch] matrix with compatible shape. -`x` is a batch matrix with compatible shape for `apply` and `solve` if - -``` -operator.shape = [B1,...,Bb] + [N, N], with b >= 0 -x.shape = [C1,...,Cc] + [N, R], -and [C1,...,Cc] broadcasts with [B1,...,Bb] to [D1,...,Dd] -``` - -#### Performance - -Suppose `operator` is a `LinearOperatorDiag` of shape `[N, N]`, -and `x.shape = [N, R]`. Then - -* `operator.apply(x)` involves `N * R` multiplications. -* `operator.solve(x)` involves `N` divisions and `N * R` multiplications. -* `operator.determinant()` involves a size `N` `reduce_prod`. - -If instead `operator` and `x` have shape `[B1,...,Bb, N, N]` and -`[B1,...,Bb, N, R]`, every operation increases in complexity by `B1*...*Bb`. - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite`. -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.__init__(diag, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, name='LinearOperatorDiag')` {#LinearOperatorDiag.__init__} - -Initialize a `LinearOperatorDiag`. - -##### Args: - - -* `diag`: Shape `[B1,...,Bb, N]` `Tensor` with `b >= 0` `N >= 0`. - The diagonal of the operator. Allowed dtypes: `float32`, `float64`, - `complex64`, `complex128`. -* `is_non_singular`: Expect that this operator is non-singular. -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. If `diag.dtype` is real, this is auto-set to `True`. -* `is_positive_definite`: Expect that this operator is positive definite, - meaning the real part of all eigenvalues is positive. We do not require - the operator to be self-adjoint to be positive-definite. See: -* `https`: //en.wikipedia.org/wiki/Positive-definite_matrix - #Extension_for_non_symmetric_matrices -* `name`: A name for this `LinearOperator`. - -##### Raises: - - -* `TypeError`: If `diag.dtype` is not an allowed type. -* `ValueError`: If `diag.dtype` is real, and `is_self_adjoint` is not `True`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.add_to_tensor(x, name='add_to_tensor')` {#LinearOperatorDiag.add_to_tensor} - -Add matrix represented by this operator to `x`. Equivalent to `A + x`. - -##### Args: - - -* `x`: `Tensor` with same `dtype` and shape broadcastable to `self.shape`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.apply(x, adjoint=False, name='apply')` {#LinearOperatorDiag.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.assert_non_singular(name='assert_non_singular')` {#LinearOperatorDiag.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.assert_positive_definite(name='assert_positive_definite')` {#LinearOperatorDiag.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperatorDiag.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.batch_shape` {#LinearOperatorDiag.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperatorDiag.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.determinant(name='det')` {#LinearOperatorDiag.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.diag` {#LinearOperatorDiag.diag} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.diag_part(name='diag_part')` {#LinearOperatorDiag.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.domain_dimension` {#LinearOperatorDiag.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperatorDiag.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.dtype` {#LinearOperatorDiag.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.graph_parents` {#LinearOperatorDiag.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.is_non_singular` {#LinearOperatorDiag.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.is_positive_definite` {#LinearOperatorDiag.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.is_self_adjoint` {#LinearOperatorDiag.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.is_square` {#LinearOperatorDiag.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.log_abs_determinant(name='log_abs_det')` {#LinearOperatorDiag.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.name` {#LinearOperatorDiag.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.range_dimension` {#LinearOperatorDiag.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperatorDiag.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.shape` {#LinearOperatorDiag.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.shape_tensor(name='shape_tensor')` {#LinearOperatorDiag.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.solve(rhs, adjoint=False, name='solve')` {#LinearOperatorDiag.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.tensor_rank` {#LinearOperatorDiag.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperatorDiag.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.to_dense(name='to_dense')` {#LinearOperatorDiag.to_dense} - -Return a dense (batch) matrix representing this operator. - - - -- - - - -### `class tf.contrib.linalg.LinearOperatorIdentity` {#LinearOperatorIdentity} - -`LinearOperator` acting like a [batch] square identity matrix. - -This operator acts like a [batch] identity matrix `A` with shape -`[B1,...,Bb, N, N]` for some `b >= 0`. The first `b` indices index a -batch member. For every batch index `(i1,...,ib)`, `A[i1,...,ib, : :]` is -an `N x N` matrix. This matrix `A` is not materialized, but for -purposes of broadcasting this shape will be relevant. - -`LinearOperatorIdentity` is initialized with `num_rows`, and optionally -`batch_shape`, and `dtype` arguments. If `batch_shape` is `None`, this -operator efficiently passes through all arguments. If `batch_shape` is -provided, broadcasting may occur, which will require making copies. - -```python -# Create a 2 x 2 identity matrix. -operator = LinearOperatorIdentity(num_rows=2, dtype=tf.float32) - -operator.to_dense() -==> [[1., 0.] - [0., 1.]] - -operator.shape -==> [2, 2] - -operator.log_determinant() -==> 0. - -x = ... Shape [2, 4] Tensor -operator.apply(x) -==> Shape [2, 4] Tensor, same as x. - -y = tf.random_normal(shape=[3, 2, 4]) -# Note that y.shape is compatible with operator.shape because operator.shape -# is broadcast to [3, 2, 2]. -# This broadcast does NOT require copying data, since we can infer that y -# will be passed through without changing shape. We are always able to infer -# this if the operator has no batch_shape. -x = operator.solve(y) -==> Shape [3, 2, 4] Tensor, same as y. - -# Create a 2-batch of 2x2 identity matrices -operator = LinearOperatorIdentity(num_rows=2, batch_shape=[2]) -operator.to_dense() -==> [[[1., 0.] - [0., 1.]], - [[1., 0.] - [0., 1.]]] - -# Here, even though the operator has a batch shape, the input is the same as -# the output, so x can be passed through without a copy. The operator is able -# to detect that no broadcast is necessary because both x and the operator -# have statically defined shape. -x = ... Shape [2, 2, 3] -operator.apply(x) -==> Shape [2, 2, 3] Tensor, same as x - -# Here the operator and x have different batch_shape, and are broadcast. -# This requires a copy, since the output is different size than the input. -x = ... Shape [1, 2, 3] -operator.apply(x) -==> Shape [2, 2, 3] Tensor, equal to [x, x] -``` - -### Shape compatibility - -This operator acts on [batch] matrix with compatible shape. -`x` is a batch matrix with compatible shape for `apply` and `solve` if - -``` -operator.shape = [B1,...,Bb] + [N, N], with b >= 0 -x.shape = [C1,...,Cc] + [N, R], -and [C1,...,Cc] broadcasts with [B1,...,Bb] to [D1,...,Dd] -``` - -### Performance - -If `batch_shape` initialization arg is `None`: - -* `operator.apply(x)` is `O(1)` -* `operator.solve(x)` is `O(1)` -* `operator.determinant()` is `O(1)` - -If `batch_shape` initialization arg is provided, and static checks cannot -rule out the need to broadcast: - -* `operator.apply(x)` is `O(D1*...*Dd*N*R)` -* `operator.solve(x)` is `O(D1*...*Dd*N*R)` -* `operator.determinant()` is `O(B1*...*Bb)` - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite`. -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.__init__(num_rows, batch_shape=None, dtype=None, is_non_singular=True, is_self_adjoint=True, is_positive_definite=True, assert_proper_shapes=False, name='LinearOperatorIdentity')` {#LinearOperatorIdentity.__init__} - -Initialize a `LinearOperatorIdentity`. - -The `LinearOperatorIdentity` is initialized with arguments defining `dtype` -and shape. - -This operator is able to broadcast the leading (batch) dimensions, which -sometimes requires copying data. If `batch_shape` is `None`, the operator -can take arguments of any batch shape without copying. See examples. - -##### Args: - - -* `num_rows`: Scalar non-negative integer `Tensor`. Number of rows in the - corresponding identity matrix. -* `batch_shape`: Optional `1-D` integer `Tensor`. The shape of the leading - dimensions. If `None`, this operator has no leading dimensions. -* `dtype`: Data type of the matrix that this operator represents. -* `is_non_singular`: Expect that this operator is non-singular. -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. -* `is_positive_definite`: Expect that this operator is positive definite. -* `assert_proper_shapes`: Python `bool`. If `False`, only perform static - checks that initialization and method arguments have proper shape. - If `True`, and static checks are inconclusive, add asserts to the graph. -* `name`: A name for this `LinearOperator` - -##### Raises: - - -* `ValueError`: If `num_rows` is determined statically to be non-scalar, or - negative. -* `ValueError`: If `batch_shape` is determined statically to not be 1-D, or - negative. -* `ValueError`: If any of the following is not `True`: - `{is_self_adjoint, is_non_singular, is_positive_definite}`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.add_to_tensor(mat, name='add_to_tensor')` {#LinearOperatorIdentity.add_to_tensor} - -Add matrix represented by this operator to `mat`. Equiv to `I + mat`. - -##### Args: - - -* `mat`: `Tensor` with same `dtype` and shape broadcastable to `self`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.apply(x, adjoint=False, name='apply')` {#LinearOperatorIdentity.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.assert_non_singular(name='assert_non_singular')` {#LinearOperatorIdentity.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.assert_positive_definite(name='assert_positive_definite')` {#LinearOperatorIdentity.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperatorIdentity.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.batch_shape` {#LinearOperatorIdentity.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperatorIdentity.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.determinant(name='det')` {#LinearOperatorIdentity.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.diag_part(name='diag_part')` {#LinearOperatorIdentity.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.domain_dimension` {#LinearOperatorIdentity.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperatorIdentity.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.dtype` {#LinearOperatorIdentity.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.graph_parents` {#LinearOperatorIdentity.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.is_non_singular` {#LinearOperatorIdentity.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.is_positive_definite` {#LinearOperatorIdentity.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.is_self_adjoint` {#LinearOperatorIdentity.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.is_square` {#LinearOperatorIdentity.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.log_abs_determinant(name='log_abs_det')` {#LinearOperatorIdentity.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.name` {#LinearOperatorIdentity.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.range_dimension` {#LinearOperatorIdentity.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperatorIdentity.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.shape` {#LinearOperatorIdentity.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.shape_tensor(name='shape_tensor')` {#LinearOperatorIdentity.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.solve(rhs, adjoint=False, name='solve')` {#LinearOperatorIdentity.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.tensor_rank` {#LinearOperatorIdentity.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperatorIdentity.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.to_dense(name='to_dense')` {#LinearOperatorIdentity.to_dense} - -Return a dense (batch) matrix representing this operator. - - - -- - - - -### `class tf.contrib.linalg.LinearOperatorScaledIdentity` {#LinearOperatorScaledIdentity} - -`LinearOperator` acting like a scaled [batch] identity matrix `A = c I`. - -This operator acts like a scaled [batch] identity matrix `A` with shape -`[B1,...,Bb, N, N]` for some `b >= 0`. The first `b` indices index a -batch member. For every batch index `(i1,...,ib)`, `A[i1,...,ib, : :]` is -a scaled version of the `N x N` identity matrix. - -`LinearOperatorIdentity` is initialized with `num_rows`, and a `multiplier` -(a `Tensor`) of shape `[B1,...,Bb]`. `N` is set to `num_rows`, and the -`multiplier` determines the scale for each batch member. - -```python -# Create a 2 x 2 scaled identity matrix. -operator = LinearOperatorIdentity(num_rows=2, multiplier=3.) - -operator.to_dense() -==> [[3., 0.] - [0., 3.]] - -operator.shape -==> [2, 2] - -operator.log_determinant() -==> 2 * Log[3] - -x = ... Shape [2, 4] Tensor -operator.apply(x) -==> 3 * x - -y = tf.random_normal(shape=[3, 2, 4]) -# Note that y.shape is compatible with operator.shape because operator.shape -# is broadcast to [3, 2, 2]. -x = operator.solve(y) -==> 3 * x - -# Create a 2-batch of 2x2 identity matrices -operator = LinearOperatorIdentity(num_rows=2, multiplier=5.) -operator.to_dense() -==> [[[5., 0.] - [0., 5.]], - [[5., 0.] - [0., 5.]]] - -x = ... Shape [2, 2, 3] -operator.apply(x) -==> 5 * x - -# Here the operator and x have different batch_shape, and are broadcast. -x = ... Shape [1, 2, 3] -operator.apply(x) -==> 5 * x -``` - -### Shape compatibility - -This operator acts on [batch] matrix with compatible shape. -`x` is a batch matrix with compatible shape for `apply` and `solve` if - -``` -operator.shape = [B1,...,Bb] + [N, N], with b >= 0 -x.shape = [C1,...,Cc] + [N, R], -and [C1,...,Cc] broadcasts with [B1,...,Bb] to [D1,...,Dd] -``` - -### Performance - -* `operator.apply(x)` is `O(D1*...*Dd*N*R)` -* `operator.solve(x)` is `O(D1*...*Dd*N*R)` -* `operator.determinant()` is `O(D1*...*Dd)` - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite`. -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.__init__(num_rows, multiplier, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, assert_proper_shapes=False, name='LinearOperatorScaledIdentity')` {#LinearOperatorScaledIdentity.__init__} - -Initialize a `LinearOperatorScaledIdentity`. - -The `LinearOperatorScaledIdentity` is initialized with `num_rows`, which -determines the size of each identity matrix, and a `multiplier`, -which defines `dtype`, batch shape, and scale of each matrix. - -This operator is able to broadcast the leading (batch) dimensions. - -##### Args: - - -* `num_rows`: Scalar non-negative integer `Tensor`. Number of rows in the - corresponding identity matrix. -* `multiplier`: `Tensor` of shape `[B1,...,Bb]`, or `[]` (a scalar). -* `is_non_singular`: Expect that this operator is non-singular. -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. -* `is_positive_definite`: Expect that this operator is positive definite. -* `assert_proper_shapes`: Python `bool`. If `False`, only perform static - checks that initialization and method arguments have proper shape. - If `True`, and static checks are inconclusive, add asserts to the graph. -* `name`: A name for this `LinearOperator` - -##### Raises: - - -* `ValueError`: If `num_rows` is determined statically to be non-scalar, or - negative. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.add_to_tensor(mat, name='add_to_tensor')` {#LinearOperatorScaledIdentity.add_to_tensor} - -Add matrix represented by this operator to `mat`. Equiv to `I + mat`. - -##### Args: - - -* `mat`: `Tensor` with same `dtype` and shape broadcastable to `self`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.apply(x, adjoint=False, name='apply')` {#LinearOperatorScaledIdentity.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.assert_non_singular(name='assert_non_singular')` {#LinearOperatorScaledIdentity.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.assert_positive_definite(name='assert_positive_definite')` {#LinearOperatorScaledIdentity.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperatorScaledIdentity.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.batch_shape` {#LinearOperatorScaledIdentity.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperatorScaledIdentity.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.determinant(name='det')` {#LinearOperatorScaledIdentity.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.diag_part(name='diag_part')` {#LinearOperatorScaledIdentity.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.domain_dimension` {#LinearOperatorScaledIdentity.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperatorScaledIdentity.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.dtype` {#LinearOperatorScaledIdentity.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.graph_parents` {#LinearOperatorScaledIdentity.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.is_non_singular` {#LinearOperatorScaledIdentity.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.is_positive_definite` {#LinearOperatorScaledIdentity.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.is_self_adjoint` {#LinearOperatorScaledIdentity.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.is_square` {#LinearOperatorScaledIdentity.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.log_abs_determinant(name='log_abs_det')` {#LinearOperatorScaledIdentity.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.multiplier` {#LinearOperatorScaledIdentity.multiplier} - -The [batch] scalar `Tensor`, `c` in `cI`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.name` {#LinearOperatorScaledIdentity.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.range_dimension` {#LinearOperatorScaledIdentity.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperatorScaledIdentity.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.shape` {#LinearOperatorScaledIdentity.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.shape_tensor(name='shape_tensor')` {#LinearOperatorScaledIdentity.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.solve(rhs, adjoint=False, name='solve')` {#LinearOperatorScaledIdentity.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.tensor_rank` {#LinearOperatorScaledIdentity.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperatorScaledIdentity.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.to_dense(name='to_dense')` {#LinearOperatorScaledIdentity.to_dense} - -Return a dense (batch) matrix representing this operator. - - - -- - - - -### `class tf.contrib.linalg.LinearOperatorMatrix` {#LinearOperatorMatrix} - -`LinearOperator` that wraps a [batch] matrix. - -This operator wraps a [batch] matrix `A` (which is a `Tensor`) with shape -`[B1,...,Bb, M, N]` for some `b >= 0`. The first `b` indices index a -batch member. For every batch index `(i1,...,ib)`, `A[i1,...,ib, : :]` is -an `M x N` matrix. - -```python -# Create a 2 x 2 linear operator. -matrix = [[1., 2.], [3., 4.]] -operator = LinearOperatorMatrix(matrix) - -operator.to_dense() -==> [[1., 2.] - [3., 4.]] - -operator.shape -==> [2, 2] - -operator.log_determinant() -==> scalar Tensor - -x = ... Shape [2, 4] Tensor -operator.apply(x) -==> Shape [2, 4] Tensor - -# Create a [2, 3] batch of 4 x 4 linear operators. -matrix = tf.random_normal(shape=[2, 3, 4, 4]) -operator = LinearOperatorMatrix(matrix) -``` - -#### Shape compatibility - -This operator acts on [batch] matrix with compatible shape. -`x` is a batch matrix with compatible shape for `apply` and `solve` if - -``` -operator.shape = [B1,...,Bb] + [M, N], with b >= 0 -x.shape = [B1,...,Bb] + [N, R], with R >= 0. -``` - -#### Performance - -`LinearOperatorMatrix` has exactly the same performance as would be achieved -by using standard `TensorFlow` matrix ops. Intelligent choices are made -based on the following initialization hints. - -* If `dtype` is real, and `is_self_adjoint` and `is_positive_definite`, a - Cholesky factorization is used for the determinant and solve. - -In all cases, suppose `operator` is a `LinearOperatorMatrix` of shape -`[M, N]`, and `x.shape = [N, R]`. Then - -* `operator.apply(x)` is `O(M * N * R)`. -* If `M=N`, `operator.solve(x)` is `O(N^3 * R)`. -* If `M=N`, `operator.determinant()` is `O(N^3)`. - -If instead `operator` and `x` have shape `[B1,...,Bb, M, N]` and -`[B1,...,Bb, N, R]`, every operation increases in complexity by `B1*...*Bb`. - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite`. -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.__init__(matrix, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, name='LinearOperatorMatrix')` {#LinearOperatorMatrix.__init__} - -Initialize a `LinearOperatorMatrix`. - -##### Args: - - -* `matrix`: Shape `[B1,...,Bb, M, N]` with `b >= 0`, `M, N >= 0`. - Allowed dtypes: `float32`, `float64`, `complex64`, `complex128`. -* `is_non_singular`: Expect that this operator is non-singular. -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. -* `is_positive_definite`: Expect that this operator is positive definite, - meaning the real part of all eigenvalues is positive. We do not require - the operator to be self-adjoint to be positive-definite. See: -* `https`: //en.wikipedia.org/wiki/Positive-definite_matrix - #Extension_for_non_symmetric_matrices -* `name`: A name for this `LinearOperator`. - -##### Raises: - - -* `TypeError`: If `diag.dtype` is not an allowed type. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.add_to_tensor(x, name='add_to_tensor')` {#LinearOperatorMatrix.add_to_tensor} - -Add matrix represented by this operator to `x`. Equivalent to `A + x`. - -##### Args: - - -* `x`: `Tensor` with same `dtype` and shape broadcastable to `self.shape`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.apply(x, adjoint=False, name='apply')` {#LinearOperatorMatrix.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.assert_non_singular(name='assert_non_singular')` {#LinearOperatorMatrix.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.assert_positive_definite(name='assert_positive_definite')` {#LinearOperatorMatrix.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperatorMatrix.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.batch_shape` {#LinearOperatorMatrix.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperatorMatrix.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.determinant(name='det')` {#LinearOperatorMatrix.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.diag_part(name='diag_part')` {#LinearOperatorMatrix.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.domain_dimension` {#LinearOperatorMatrix.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperatorMatrix.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.dtype` {#LinearOperatorMatrix.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.graph_parents` {#LinearOperatorMatrix.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.is_non_singular` {#LinearOperatorMatrix.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.is_positive_definite` {#LinearOperatorMatrix.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.is_self_adjoint` {#LinearOperatorMatrix.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.is_square` {#LinearOperatorMatrix.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.log_abs_determinant(name='log_abs_det')` {#LinearOperatorMatrix.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.name` {#LinearOperatorMatrix.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.range_dimension` {#LinearOperatorMatrix.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperatorMatrix.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.shape` {#LinearOperatorMatrix.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.shape_tensor(name='shape_tensor')` {#LinearOperatorMatrix.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.solve(rhs, adjoint=False, name='solve')` {#LinearOperatorMatrix.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.tensor_rank` {#LinearOperatorMatrix.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperatorMatrix.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.to_dense(name='to_dense')` {#LinearOperatorMatrix.to_dense} - -Return a dense (batch) matrix representing this operator. - - - -- - - - -### `class tf.contrib.linalg.LinearOperatorTriL` {#LinearOperatorTriL} - -`LinearOperator` acting like a [batch] square lower triangular matrix. - -This operator acts like a [batch] lower triangular matrix `A` with shape -`[B1,...,Bb, N, N]` for some `b >= 0`. The first `b` indices index a -batch member. For every batch index `(i1,...,ib)`, `A[i1,...,ib, : :]` is -an `N x N` matrix. - -`LinearOperatorTriL` is initialized with a `Tensor` having dimensions -`[B1,...,Bb, N, N]`. The upper triangle of the last two dimensions is ignored. - -```python -# Create a 2 x 2 lower-triangular linear operator. -tril = [[1., 2.], [3., 4.]] -operator = LinearOperatorTriL(tril) - -# The upper triangle is ignored. -operator.to_dense() -==> [[1., 0.] - [3., 4.]] - -operator.shape -==> [2, 2] - -operator.log_determinant() -==> scalar Tensor - -x = ... Shape [2, 4] Tensor -operator.apply(x) -==> Shape [2, 4] Tensor - -# Create a [2, 3] batch of 4 x 4 linear operators. -tril = tf.random_normal(shape=[2, 3, 4, 4]) -operator = LinearOperatorTriL(tril) -``` - -#### Shape compatibility - -This operator acts on [batch] matrix with compatible shape. -`x` is a batch matrix with compatible shape for `apply` and `solve` if - -``` -operator.shape = [B1,...,Bb] + [N, N], with b >= 0 -x.shape = [B1,...,Bb] + [N, R], with R >= 0. -``` - -#### Performance - -Suppose `operator` is a `LinearOperatorTriL` of shape `[N, N]`, -and `x.shape = [N, R]`. Then - -* `operator.apply(x)` involves `N^2 * R` multiplications. -* `operator.solve(x)` involves `N * R` size `N` back-substitutions. -* `operator.determinant()` involves a size `N` `reduce_prod`. - -If instead `operator` and `x` have shape `[B1,...,Bb, N, N]` and -`[B1,...,Bb, N, R]`, every operation increases in complexity by `B1*...*Bb`. - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite`. -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.__init__(tril, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, name='LinearOperatorTriL')` {#LinearOperatorTriL.__init__} - -Initialize a `LinearOperatorTriL`. - -##### Args: - - -* `tril`: Shape `[B1,...,Bb, N, N]` with `b >= 0`, `N >= 0`. - The lower triangular part of `tril` defines this operator. The strictly - upper triangle is ignored. Allowed dtypes: `float32`, `float64`. -* `is_non_singular`: Expect that this operator is non-singular. - This operator is non-singular if and only if its diagonal elements are - all non-zero. -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. This operator is self-adjoint only if it is diagonal with - real-valued diagonal entries. In this case it is advised to use - `LinearOperatorDiag`. -* `is_positive_definite`: Expect that this operator is positive definite, - meaning the real part of all eigenvalues is positive. We do not require - the operator to be self-adjoint to be positive-definite. See: -* `https`: //en.wikipedia.org/wiki/Positive-definite_matrix - #Extension_for_non_symmetric_matrices -* `name`: A name for this `LinearOperator`. - -##### Raises: - - -* `TypeError`: If `diag.dtype` is not an allowed type. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.add_to_tensor(x, name='add_to_tensor')` {#LinearOperatorTriL.add_to_tensor} - -Add matrix represented by this operator to `x`. Equivalent to `A + x`. - -##### Args: - - -* `x`: `Tensor` with same `dtype` and shape broadcastable to `self.shape`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.apply(x, adjoint=False, name='apply')` {#LinearOperatorTriL.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.assert_non_singular(name='assert_non_singular')` {#LinearOperatorTriL.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.assert_positive_definite(name='assert_positive_definite')` {#LinearOperatorTriL.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperatorTriL.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.batch_shape` {#LinearOperatorTriL.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperatorTriL.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.determinant(name='det')` {#LinearOperatorTriL.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.diag_part(name='diag_part')` {#LinearOperatorTriL.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.domain_dimension` {#LinearOperatorTriL.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperatorTriL.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.dtype` {#LinearOperatorTriL.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.graph_parents` {#LinearOperatorTriL.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.is_non_singular` {#LinearOperatorTriL.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.is_positive_definite` {#LinearOperatorTriL.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.is_self_adjoint` {#LinearOperatorTriL.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.is_square` {#LinearOperatorTriL.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.log_abs_determinant(name='log_abs_det')` {#LinearOperatorTriL.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.name` {#LinearOperatorTriL.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.range_dimension` {#LinearOperatorTriL.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperatorTriL.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.shape` {#LinearOperatorTriL.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.shape_tensor(name='shape_tensor')` {#LinearOperatorTriL.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.solve(rhs, adjoint=False, name='solve')` {#LinearOperatorTriL.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.tensor_rank` {#LinearOperatorTriL.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperatorTriL.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.to_dense(name='to_dense')` {#LinearOperatorTriL.to_dense} - -Return a dense (batch) matrix representing this operator. - - - -- - - - -### `class tf.contrib.linalg.LinearOperatorUDVHUpdate` {#LinearOperatorUDVHUpdate} - -Perturb a `LinearOperator` with a rank `K` update. - -This operator acts like a [batch] matrix `A` with shape -`[B1,...,Bb, M, N]` for some `b >= 0`. The first `b` indices index a -batch member. For every batch index `(i1,...,ib)`, `A[i1,...,ib, : :]` is -an `M x N` matrix. - -`LinearOperatorUDVHUpdate` represents `A = L + U D V^H`, where - -``` -L, is a LinearOperator representing [batch] M x N matrices -U, is a [batch] M x K matrix. Typically K << M. -D, is a [batch] K x K matrix. -V, is a [batch] N x K matrix. Typically K << N. -V^H is the Hermitian transpose (adjoint) of V. -``` - -If `M = N`, determinants and solves are done using the matrix determinant -lemma and Woodbury identities, and thus require L and D to be non-singular. - -Solves and determinants will be attempted unless the "is_non_singular" -property of L and D is False. - -In the event that L and D are positive-definite, and U = V, solves and -determinants can be done using a Cholesky factorization. - -```python -# Create a 3 x 3 diagonal linear operator. -diag_operator = LinearOperatorDiag( - diag=[1., 2., 3.], is_non_singular=True, is_self_adjoint=True, - is_positive_definite=True) - -# Perturb with a rank 2 perturbation -operator = LinearOperatorUDVHUpdate( - operator=diag_operator, - u=[[1., 2.], [-1., 3.], [0., 0.]], - diag=[11., 12.], - v=[[1., 2.], [-1., 3.], [10., 10.]]) - -operator.shape -==> [3, 3] - -operator.log_determinant() -==> scalar Tensor - -x = ... Shape [3, 4] Tensor -operator.apply(x) -==> Shape [3, 4] Tensor -``` - -### Shape compatibility - -This operator acts on [batch] matrix with compatible shape. -`x` is a batch matrix with compatible shape for `apply` and `solve` if - -``` -operator.shape = [B1,...,Bb] + [M, N], with b >= 0 -x.shape = [B1,...,Bb] + [N, R], with R >= 0. -``` - -### Performance - -Suppose `operator` is a `LinearOperatorUDVHUpdate` of shape `[M, N]`, -made from a rank `K` update of `base_operator` which performs `.apply(x)` on -`x` having `x.shape = [N, R]` with `O(L_apply*N*R)` complexity (and similarly -for `solve`, `determinant`. Then, if `x.shape = [N, R]`, - -* `operator.apply(x)` is `O(L_apply*N*R + K*N*R)` - -and if `M = N`, - -* `operator.solve(x)` is `O(L_apply*N*R + N*K*R + K^2*R + K^3)` -* `operator.determinant()` is `O(L_determinant + L_solve*N*K + K^2*N + K^3)` - -If instead `operator` and `x` have shape `[B1,...,Bb, M, N]` and -`[B1,...,Bb, N, R]`, every operation increases in complexity by `B1*...*Bb`. - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite, diag_positive, square` -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.__init__(base_operator, u, diag=None, v=None, is_diag_positive=None, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, is_square=None, name='LinearOperatorUDVHUpdate')` {#LinearOperatorUDVHUpdate.__init__} - -Initialize a `LinearOperatorUDVHUpdate`. - -This creates a `LinearOperator` of the form `A = L + U D V^H`, with -`L` a `LinearOperator`, `U, V` both [batch] matrices, and `D` a [batch] -diagonal matrix. - -If `L` is non-singular, solves and determinants are available. -Solves/determinants both involve a solve/determinant of a `K x K` system. -In the event that L and D are self-adjoint positive-definite, and U = V, -this can be done using a Cholesky factorization. The user should set the -`is_X` matrix property hints, which will trigger the appropriate code path. - -##### Args: - - -* `base_operator`: Shape `[B1,...,Bb, M, N]` real `float32` or `float64` - `LinearOperator`. This is `L` above. -* `u`: Shape `[B1,...,Bb, M, K]` `Tensor` of same `dtype` as `base_operator`. - This is `U` above. -* `diag`: Optional shape `[B1,...,Bb, K]` `Tensor` with same `dtype` as - `base_operator`. This is the diagonal of `D` above. - Defaults to `D` being the identity operator. -* `v`: Optional `Tensor` of same `dtype` as `u` and shape `[B1,...,Bb, N, K]` - Defaults to `v = u`, in which case the perturbation is symmetric. - If `M != N`, then `v` must be set since the pertrubation is not square. -* `is_diag_positive`: Python `bool`. If `True`, expect `diag > 0`. -* `is_non_singular`: Expect that this operator is non-singular. - Default is `None`, unless `is_positive_definite` is auto-set to be - `True` (see below). -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. Default is `None`, unless `base_operator` is self-adjoint - and `v = None` (meaning `u=v`), in which case this defaults to `True`. -* `is_positive_definite`: Expect that this operator is positive definite. - Default is `None`, unless `base_operator` is positive-definite - `v = None` (meaning `u=v`), and `is_diag_positive`, in which case this - defaults to `True`. -* `is_square`: Expect that this operator acts like square [batch] matrices. -* `name`: A name for this `LinearOperator`. - -##### Raises: - - -* `ValueError`: If `is_X` flags are set in an inconsistent way. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.add_to_tensor(x, name='add_to_tensor')` {#LinearOperatorUDVHUpdate.add_to_tensor} - -Add matrix represented by this operator to `x`. Equivalent to `A + x`. - -##### Args: - - -* `x`: `Tensor` with same `dtype` and shape broadcastable to `self.shape`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.apply(x, adjoint=False, name='apply')` {#LinearOperatorUDVHUpdate.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.assert_non_singular(name='assert_non_singular')` {#LinearOperatorUDVHUpdate.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.assert_positive_definite(name='assert_positive_definite')` {#LinearOperatorUDVHUpdate.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperatorUDVHUpdate.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.base_operator` {#LinearOperatorUDVHUpdate.base_operator} - -If this operator is `A = L + U D V^H`, this is the `L`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.batch_shape` {#LinearOperatorUDVHUpdate.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperatorUDVHUpdate.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.determinant(name='det')` {#LinearOperatorUDVHUpdate.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.diag_arg` {#LinearOperatorUDVHUpdate.diag_arg} - -If this operator is `A = L + U D V^H`, this is the diagonal of `D`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.diag_operator` {#LinearOperatorUDVHUpdate.diag_operator} - -If this operator is `A = L + U D V^H`, this is `D`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.diag_part(name='diag_part')` {#LinearOperatorUDVHUpdate.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.domain_dimension` {#LinearOperatorUDVHUpdate.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperatorUDVHUpdate.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.dtype` {#LinearOperatorUDVHUpdate.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.graph_parents` {#LinearOperatorUDVHUpdate.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.is_diag_positive` {#LinearOperatorUDVHUpdate.is_diag_positive} - -If this operator is `A = L + U D V^H`, this hints `D > 0` elementwise. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.is_non_singular` {#LinearOperatorUDVHUpdate.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.is_positive_definite` {#LinearOperatorUDVHUpdate.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.is_self_adjoint` {#LinearOperatorUDVHUpdate.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.is_square` {#LinearOperatorUDVHUpdate.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.log_abs_determinant(name='log_abs_det')` {#LinearOperatorUDVHUpdate.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.name` {#LinearOperatorUDVHUpdate.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.range_dimension` {#LinearOperatorUDVHUpdate.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperatorUDVHUpdate.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.shape` {#LinearOperatorUDVHUpdate.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.shape_tensor(name='shape_tensor')` {#LinearOperatorUDVHUpdate.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.solve(rhs, adjoint=False, name='solve')` {#LinearOperatorUDVHUpdate.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.tensor_rank` {#LinearOperatorUDVHUpdate.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperatorUDVHUpdate.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.to_dense(name='to_dense')` {#LinearOperatorUDVHUpdate.to_dense} - -Return a dense (batch) matrix representing this operator. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.u` {#LinearOperatorUDVHUpdate.u} - -If this operator is `A = L + U D V^H`, this is the `U`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.v` {#LinearOperatorUDVHUpdate.v} - -If this operator is `A = L + U D V^H`, this is the `V`. - - - -- - - - -### `class tf.contrib.linalg.LinearOperatorComposition` {#LinearOperatorComposition} - -Composes one or more `LinearOperators`. - -This operator composes one or more linear operators `[op1,...,opJ]`, -building a new `LinearOperator` with action defined by: - -``` -op_composed(x) := op1(op2(...(opJ(x)...)) -``` - -If `opj` acts like [batch] matrix `Aj`, then `op_composed` acts like the -[batch] matrix formed with the multiplication `A1 A2...AJ`. - -If `opj` has shape `batch_shape_j + [M_j, N_j]`, then we must have -`N_j = M_{j+1}`, in which case the composed operator has shape equal to -`broadcast_batch_shape + [M_1, N_J]`, where `broadcast_batch_shape` is the -mutual broadcast of `batch_shape_j`, `j = 1,...,J`, assuming the intermediate -batch shapes broadcast. Even if the composed shape is well defined, the -composed operator's methods may fail due to lack of broadcasting ability in -the defining operators' methods. - -```python -# Create a 2 x 2 linear operator composed of two 2 x 2 operators. -operator_1 = LinearOperatorMatrix([[1., 2.], [3., 4.]]) -operator_2 = LinearOperatorMatrix([[1., 0.], [0., 1.]]) -operator = LinearOperatorComposition([operator_1, operator_2]) - -operator.to_dense() -==> [[1., 2.] - [3., 4.]] - -operator.shape -==> [2, 2] - -operator.log_determinant() -==> scalar Tensor - -x = ... Shape [2, 4] Tensor -operator.apply(x) -==> Shape [2, 4] Tensor - -# Create a [2, 3] batch of 4 x 5 linear operators. -matrix_45 = tf.random_normal(shape=[2, 3, 4, 5]) -operator_45 = LinearOperatorMatrix(matrix) - -# Create a [2, 3] batch of 5 x 6 linear operators. -matrix_56 = tf.random_normal(shape=[2, 3, 5, 6]) -operator_56 = LinearOperatorMatrix(matrix_56) - -# Compose to create a [2, 3] batch of 4 x 6 operators. -opeartor_46 = LinearOperatorComposition([operator_45, operator_56]) - -# Create a shape [2, 3, 6, 2] vector. -x = tf.random_normal(shape=[2, 3, 6, 2]) -operator.apply(x) -==> Shape [2, 3, 4, 2] Tensor -``` - -#### Performance - -The performance of `LinearOperatorComposition` on any operation is equal to -the sum of the individual operators' operations. - - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite`. -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.__init__(operators, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, name=None)` {#LinearOperatorComposition.__init__} - -Initialize a `LinearOperatorComposition`. - -`LinearOperatorComposition` is initialized with a list of operators -`[op_1,...,op_J]`. For the `apply` method to be well defined, the -composition `op_i.apply(op_{i+1}(x))` must be defined. Other methods have -similar constraints. - -##### Args: - - -* `operators`: Iterable of `LinearOperator` objects, each with - the same `dtype` and composible shape. -* `is_non_singular`: Expect that this operator is non-singular. -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. -* `is_positive_definite`: Expect that this operator is positive definite, - meaning the real part of all eigenvalues is positive. We do not require - the operator to be self-adjoint to be positive-definite. See: -* `https`: //en.wikipedia.org/wiki/Positive-definite_matrix - #Extension_for_non_symmetric_matrices -* `name`: A name for this `LinearOperator`. Default is the individual - operators names joined with `_o_`. - -##### Raises: - - -* `TypeError`: If all operators do not have the same `dtype`. -* `ValueError`: If `operators` is empty. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.add_to_tensor(x, name='add_to_tensor')` {#LinearOperatorComposition.add_to_tensor} - -Add matrix represented by this operator to `x`. Equivalent to `A + x`. - -##### Args: - - -* `x`: `Tensor` with same `dtype` and shape broadcastable to `self.shape`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.apply(x, adjoint=False, name='apply')` {#LinearOperatorComposition.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.assert_non_singular(name='assert_non_singular')` {#LinearOperatorComposition.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.assert_positive_definite(name='assert_positive_definite')` {#LinearOperatorComposition.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperatorComposition.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.batch_shape` {#LinearOperatorComposition.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperatorComposition.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.determinant(name='det')` {#LinearOperatorComposition.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.diag_part(name='diag_part')` {#LinearOperatorComposition.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.domain_dimension` {#LinearOperatorComposition.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperatorComposition.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.dtype` {#LinearOperatorComposition.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.graph_parents` {#LinearOperatorComposition.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.is_non_singular` {#LinearOperatorComposition.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.is_positive_definite` {#LinearOperatorComposition.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.is_self_adjoint` {#LinearOperatorComposition.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.is_square` {#LinearOperatorComposition.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.log_abs_determinant(name='log_abs_det')` {#LinearOperatorComposition.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.name` {#LinearOperatorComposition.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.operators` {#LinearOperatorComposition.operators} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.range_dimension` {#LinearOperatorComposition.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperatorComposition.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.shape` {#LinearOperatorComposition.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.shape_tensor(name='shape_tensor')` {#LinearOperatorComposition.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.solve(rhs, adjoint=False, name='solve')` {#LinearOperatorComposition.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.tensor_rank` {#LinearOperatorComposition.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperatorComposition.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.to_dense(name='to_dense')` {#LinearOperatorComposition.to_dense} - -Return a dense (batch) matrix representing this operator. - - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.losses.md b/tensorflow/g3doc/api_docs/python/contrib.losses.md deleted file mode 100644 index eef457bd1a..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.losses.md +++ /dev/null @@ -1,472 +0,0 @@ - - -# Losses (contrib) -[TOC] - -Ops for building neural network losses. See @{$python/contrib.losses}. - -## Other Functions and Classes -- - - - -### `tf.contrib.losses.absolute_difference(*args, **kwargs)` {#absolute_difference} - -Adds an Absolute Difference loss to the training procedure. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.absolute_difference instead. - -`weights` acts as a coefficient for the loss. If a scalar is provided, then -the loss is simply scaled by the given value. If `weights` is a tensor of size -[batch_size], then the total loss for each sample of the batch is rescaled -by the corresponding element in the `weights` vector. If the shape of -`weights` matches the shape of `predictions`, then the loss of each -measurable element of `predictions` is scaled by the corresponding value of -`weights`. - -##### Args: - - -* `predictions`: The predicted outputs. -* `labels`: The ground truth output tensor, same dimensions as 'predictions'. -* `weights`: Coefficients for the loss a scalar, a tensor of shape - [batch_size] or a tensor whose shape matches `predictions`. -* `scope`: The scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the loss value. - -##### Raises: - - -* `ValueError`: If the shape of `predictions` doesn't match that of `labels` or - if the shape of `weights` is invalid. - - -- - - - -### `tf.contrib.losses.add_loss(*args, **kwargs)` {#add_loss} - -Adds a externally defined loss to the collection of losses. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.add_loss instead. - -##### Args: - - -* `loss`: A loss `Tensor`. -* `loss_collection`: Optional collection to add the loss to. - - -- - - - -### `tf.contrib.losses.compute_weighted_loss(*args, **kwargs)` {#compute_weighted_loss} - -Computes the weighted loss. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.compute_weighted_loss instead. - -##### Args: - - -* `losses`: A tensor of size [batch_size, d1, ... dN]. -* `weights`: A tensor of size [1] or [batch_size, d1, ... dK] where K < N. -* `scope`: the scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` that returns the weighted loss. - -##### Raises: - - -* `ValueError`: If `weights` is `None` or the shape is not compatible with - `losses`, or if the number of dimensions (rank) of either `losses` or - `weights` is missing. - - -- - - - -### `tf.contrib.losses.cosine_distance(*args, **kwargs)` {#cosine_distance} - -Adds a cosine-distance loss to the training procedure. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.cosine_distance instead. - -Note that the function assumes that `predictions` and `labels` are already -unit-normalized. - -##### Args: - - -* `predictions`: An arbitrary matrix. -* `labels`: A `Tensor` whose shape matches 'predictions' -* `dim`: The dimension along which the cosine distance is computed. -* `weights`: Coefficients for the loss a scalar, a tensor of shape - [batch_size] or a tensor whose shape matches `predictions`. -* `scope`: The scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the loss value. - -##### Raises: - - -* `ValueError`: If `predictions` shape doesn't match `labels` shape, or - `weights` is `None`. - - -- - - - -### `tf.contrib.losses.get_losses(*args, **kwargs)` {#get_losses} - -Gets the list of losses from the loss_collection. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.get_losses instead. - -##### Args: - - -* `scope`: an optional scope for filtering the losses to return. -* `loss_collection`: Optional losses collection. - -##### Returns: - - a list of loss tensors. - - -- - - - -### `tf.contrib.losses.get_regularization_losses(*args, **kwargs)` {#get_regularization_losses} - -Gets the regularization losses. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.get_regularization_losses instead. - -##### Args: - - -* `scope`: an optional scope for filtering the losses to return. - -##### Returns: - - A list of loss variables. - - -- - - - -### `tf.contrib.losses.get_total_loss(*args, **kwargs)` {#get_total_loss} - -Returns a tensor whose value represents the total loss. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.get_total_loss instead. - -Notice that the function adds the given losses to the regularization losses. - -##### Args: - - -* `add_regularization_losses`: A boolean indicating whether or not to use the - regularization losses in the sum. -* `name`: The name of the returned tensor. - -##### Returns: - - A `Tensor` whose value represents the total loss. - -##### Raises: - - -* `ValueError`: if `losses` is not iterable. - - -- - - - -### `tf.contrib.losses.hinge_loss(*args, **kwargs)` {#hinge_loss} - -Method that returns the loss tensor for hinge loss. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.hinge_loss instead. Note that the order of the predictions and labels arguments were changed. - -##### Args: - - -* `logits`: The logits, a float tensor. -* `labels`: The ground truth output tensor. Its shape should match the shape of - logits. The values of the tensor are expected to be 0.0 or 1.0. -* `scope`: The scope for the operations performed in computing the loss. - -##### Returns: - - A `Tensor` of same shape as `logits` and `labels` representing the loss - values across the batch. - -##### Raises: - - -* `ValueError`: If the shapes of `logits` and `labels` don't match. - - -- - - - -### `tf.contrib.losses.log_loss(*args, **kwargs)` {#log_loss} - -Adds a Log Loss term to the training procedure. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.log_loss instead. Note that the order of the predictions and labels arguments was changed. - -`weights` acts as a coefficient for the loss. If a scalar is provided, then -the loss is simply scaled by the given value. If `weights` is a tensor of size -[batch_size], then the total loss for each sample of the batch is rescaled -by the corresponding element in the `weights` vector. If the shape of -`weights` matches the shape of `predictions`, then the loss of each -measurable element of `predictions` is scaled by the corresponding value of -`weights`. - -##### Args: - - -* `predictions`: The predicted outputs. -* `labels`: The ground truth output tensor, same dimensions as 'predictions'. -* `weights`: Coefficients for the loss a scalar, a tensor of shape - [batch_size] or a tensor whose shape matches `predictions`. -* `epsilon`: A small increment to add to avoid taking a log of zero. -* `scope`: The scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the loss value. - -##### Raises: - - -* `ValueError`: If the shape of `predictions` doesn't match that of `labels` or - if the shape of `weights` is invalid. - - -- - - - -### `tf.contrib.losses.mean_pairwise_squared_error(*args, **kwargs)` {#mean_pairwise_squared_error} - -Adds a pairwise-errors-squared loss to the training procedure. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.mean_pairwise_squared_error instead. Note that the order of the predictions and labels arguments was changed. - -Unlike `mean_squared_error`, which is a measure of the differences between -corresponding elements of `predictions` and `labels`, -`mean_pairwise_squared_error` is a measure of the differences between pairs of -corresponding elements of `predictions` and `labels`. - -For example, if `labels`=[a, b, c] and `predictions`=[x, y, z], there are -three pairs of differences are summed to compute the loss: - loss = [ ((a-b) - (x-y)).^2 + ((a-c) - (x-z)).^2 + ((b-c) - (y-z)).^2 ] / 3 - -Note that since the inputs are of size [batch_size, d0, ... dN], the -corresponding pairs are computed within each batch sample but not across -samples within a batch. For example, if `predictions` represents a batch of -16 grayscale images of dimension [batch_size, 100, 200], then the set of pairs -is drawn from each image, but not across images. - -`weights` acts as a coefficient for the loss. If a scalar is provided, then -the loss is simply scaled by the given value. If `weights` is a tensor of size -[batch_size], then the total loss for each sample of the batch is rescaled -by the corresponding element in the `weights` vector. - -##### Args: - - -* `predictions`: The predicted outputs, a tensor of size [batch_size, d0, .. dN] - where N+1 is the total number of dimensions in `predictions`. -* `labels`: The ground truth output tensor, whose shape must match the shape of - the `predictions` tensor. -* `weights`: Coefficients for the loss a scalar, a tensor of shape [batch_size] - or a tensor whose shape matches `predictions`. -* `scope`: The scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the loss value. - -##### Raises: - - -* `ValueError`: If the shape of `predictions` doesn't match that of `labels` or - if the shape of `weights` is invalid. - - -- - - - -### `tf.contrib.losses.mean_squared_error(*args, **kwargs)` {#mean_squared_error} - -Adds a Sum-of-Squares loss to the training procedure. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.mean_squared_error instead. - -`weights` acts as a coefficient for the loss. If a scalar is provided, then -the loss is simply scaled by the given value. If `weights` is a tensor of size -[batch_size], then the total loss for each sample of the batch is rescaled -by the corresponding element in the `weights` vector. If the shape of -`weights` matches the shape of `predictions`, then the loss of each -measurable element of `predictions` is scaled by the corresponding value of -`weights`. - -##### Args: - - -* `predictions`: The predicted outputs. -* `labels`: The ground truth output tensor, same dimensions as 'predictions'. -* `weights`: Coefficients for the loss a scalar, a tensor of shape - [batch_size] or a tensor whose shape matches `predictions`. -* `scope`: The scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the loss value. - -##### Raises: - - -* `ValueError`: If the shape of `predictions` doesn't match that of `labels` or - if the shape of `weights` is invalid. - - -- - - - -### `tf.contrib.losses.sigmoid_cross_entropy(*args, **kwargs)` {#sigmoid_cross_entropy} - -Creates a cross-entropy loss using tf.nn.sigmoid_cross_entropy_with_logits. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.sigmoid_cross_entropy instead. Note that the order of the predictions and labels arguments was changed. - -`weights` acts as a coefficient for the loss. If a scalar is provided, -then the loss is simply scaled by the given value. If `weights` is a -tensor of size [`batch_size`], then the loss weights apply to each -corresponding sample. - -If `label_smoothing` is nonzero, smooth the labels towards 1/2: - - new_multiclass_labels = multiclass_labels * (1 - label_smoothing) - + 0.5 * label_smoothing - -##### Args: - - -* `logits`: [batch_size, num_classes] logits outputs of the network . -* `multi_class_labels`: [batch_size, num_classes] labels in (0, 1). -* `weights`: Coefficients for the loss. The tensor must be a scalar, a tensor of - shape [batch_size] or shape [batch_size, num_classes]. -* `label_smoothing`: If greater than 0 then smooth the labels. -* `scope`: The scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the loss value. - -##### Raises: - - -* `ValueError`: If the shape of `logits` doesn't match that of - `multi_class_labels` or if the shape of `weights` is invalid, or if - `weights` is None. - - -- - - - -### `tf.contrib.losses.softmax_cross_entropy(*args, **kwargs)` {#softmax_cross_entropy} - -Creates a cross-entropy loss using tf.nn.softmax_cross_entropy_with_logits. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.softmax_cross_entropy instead. Note that the order of the logits and labels arguments has been changed. - -`weights` acts as a coefficient for the loss. If a scalar is provided, -then the loss is simply scaled by the given value. If `weights` is a -tensor of size [`batch_size`], then the loss weights apply to each -corresponding sample. - -If `label_smoothing` is nonzero, smooth the labels towards 1/num_classes: - new_onehot_labels = onehot_labels * (1 - label_smoothing) - + label_smoothing / num_classes - -##### Args: - - -* `logits`: [batch_size, num_classes] logits outputs of the network . -* `onehot_labels`: [batch_size, num_classes] one-hot-encoded labels. -* `weights`: Coefficients for the loss. The tensor must be a scalar or a tensor - of shape [batch_size]. -* `label_smoothing`: If greater than 0 then smooth the labels. -* `scope`: the scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the mean loss value. - -##### Raises: - - -* `ValueError`: If the shape of `logits` doesn't match that of `onehot_labels` - or if the shape of `weights` is invalid or if `weights` is None. - - -- - - - -### `tf.contrib.losses.sparse_softmax_cross_entropy(*args, **kwargs)` {#sparse_softmax_cross_entropy} - -Cross-entropy loss using `tf.nn.sparse_softmax_cross_entropy_with_logits`. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.sparse_softmax_cross_entropy instead. Note that the order of the logits and labels arguments has been changed. - -`weights` acts as a coefficient for the loss. If a scalar is provided, -then the loss is simply scaled by the given value. If `weights` is a -tensor of size [`batch_size`], then the loss weights apply to each -corresponding sample. - -##### Args: - - -* `logits`: [batch_size, num_classes] logits outputs of the network . -* `labels`: [batch_size, 1] or [batch_size] labels of dtype `int32` or `int64` - in the range `[0, num_classes)`. -* `weights`: Coefficients for the loss. The tensor must be a scalar or a tensor - of shape [batch_size] or [batch_size, 1]. -* `scope`: the scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the mean loss value. - -##### Raises: - - -* `ValueError`: If the shapes of `logits`, `labels`, and `weights` are - incompatible, or if `weights` is None. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.metrics.md b/tensorflow/g3doc/api_docs/python/contrib.metrics.md deleted file mode 100644 index f11fd9d193..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.metrics.md +++ /dev/null @@ -1,1971 +0,0 @@ - - -# Metrics (contrib) -[TOC] - -Ops for evaluation metrics and summary statistics. - -See the @{$python/contrib.metrics} guide. - -- - - - -### `tf.contrib.metrics.streaming_accuracy(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_accuracy} - -Calculates how often `predictions` matches `labels`. - -The `streaming_accuracy` function creates two local variables, `total` and -`count` that are used to compute the frequency with which `predictions` -matches `labels`. This frequency is ultimately returned as `accuracy`: an -idempotent operation that simply divides `total` by `count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the `accuracy`. -Internally, an `is_correct` operation computes a `Tensor` with elements 1.0 -where the corresponding elements of `predictions` and `labels` match and 0.0 -otherwise. Then `update_op` increments `total` with the reduced sum of the -product of `weights` and `is_correct`, and it increments `count` with the -reduced sum of `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: The predicted values, a `Tensor` of any shape. -* `labels`: The ground truth values, a `Tensor` whose shape matches - `predictions`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that `accuracy` should - be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `accuracy`: A `Tensor` representing the accuracy, the value of `total` divided - by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `accuracy`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_mean(values, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_mean} - -Computes the (weighted) mean of the given values. - -The `streaming_mean` function creates two local variables, `total` and `count` -that are used to compute the average of `values`. This average is ultimately -returned as `mean` which is an idempotent operation that simply divides -`total` by `count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the `mean`. -`update_op` increments `total` with the reduced sum of the product of `values` -and `weights`, and it increments `count` with the reduced sum of `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `values`: A `Tensor` of arbitrary dimensions. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `values`, and - must be broadcastable to `values` (i.e., all dimensions must be either - `1`, or the same as the corresponding `values` dimension). -* `metrics_collections`: An optional list of collections that `mean` - should be added to. -* `updates_collections`: An optional list of collections that `update_op` - should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `mean`: A `Tensor` representing the current mean, the value of `total` divided - by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `mean_value`. - -##### Raises: - - -* `ValueError`: If `weights` is not `None` and its shape doesn't match `values`, - or if either `metrics_collections` or `updates_collections` are not a list - or tuple. - - -- - - - -### `tf.contrib.metrics.streaming_recall(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_recall} - -Computes the recall of the predictions with respect to the labels. - -The `streaming_recall` function creates two local variables, `true_positives` -and `false_negatives`, that are used to compute the recall. This value is -ultimately returned as `recall`, an idempotent operation that simply divides -`true_positives` by the sum of `true_positives` and `false_negatives`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` that updates these variables and returns the `recall`. `update_op` -weights each prediction by the corresponding value in `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: The predicted values, a `bool` `Tensor` of arbitrary shape. -* `labels`: The ground truth values, a `bool` `Tensor` whose dimensions must - match `predictions`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that `recall` should - be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `recall`: Scalar float `Tensor` with the value of `true_positives` divided - by the sum of `true_positives` and `false_negatives`. -* `update_op`: `Operation` that increments `true_positives` and - `false_negatives` variables appropriately and whose value matches - `recall`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_recall_at_thresholds(predictions, labels, thresholds, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_recall_at_thresholds} - -Computes various recall values for different `thresholds` on `predictions`. - -The `streaming_recall_at_thresholds` function creates four local variables, -`true_positives`, `true_negatives`, `false_positives` and `false_negatives` -for various values of thresholds. `recall[i]` is defined as the total weight -of values in `predictions` above `thresholds[i]` whose corresponding entry in -`labels` is `True`, divided by the total weight of `True` values in `labels` -(`true_positives[i] / (true_positives[i] + false_negatives[i])`). - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the `recall`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A floating point `Tensor` of arbitrary shape and whose values - are in the range `[0, 1]`. -* `labels`: A `bool` `Tensor` whose shape matches `predictions`. -* `thresholds`: A python list or tuple of float thresholds in `[0, 1]`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that `recall` should be - added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `recall`: A float `Tensor` of shape `[len(thresholds)]`. -* `update_op`: An operation that increments the `true_positives`, - `true_negatives`, `false_positives` and `false_negatives` variables that - are used in the computation of `recall`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_precision(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_precision} - -Computes the precision of the predictions with respect to the labels. - -The `streaming_precision` function creates two local variables, -`true_positives` and `false_positives`, that are used to compute the -precision. This value is ultimately returned as `precision`, an idempotent -operation that simply divides `true_positives` by the sum of `true_positives` -and `false_positives`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`precision`. `update_op` weights each prediction by the corresponding value in -`weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: The predicted values, a `bool` `Tensor` of arbitrary shape. -* `labels`: The ground truth values, a `bool` `Tensor` whose dimensions must - match `predictions`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that `precision` should - be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `precision`: Scalar float `Tensor` with the value of `true_positives` - divided by the sum of `true_positives` and `false_positives`. -* `update_op`: `Operation` that increments `true_positives` and - `false_positives` variables appropriately and whose value matches - `precision`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_precision_at_thresholds(predictions, labels, thresholds, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_precision_at_thresholds} - -Computes precision values for different `thresholds` on `predictions`. - -The `streaming_precision_at_thresholds` function creates four local variables, -`true_positives`, `true_negatives`, `false_positives` and `false_negatives` -for various values of thresholds. `precision[i]` is defined as the total -weight of values in `predictions` above `thresholds[i]` whose corresponding -entry in `labels` is `True`, divided by the total weight of values in -`predictions` above `thresholds[i]` (`true_positives[i] / (true_positives[i] + -false_positives[i])`). - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`precision`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A floating point `Tensor` of arbitrary shape and whose values - are in the range `[0, 1]`. -* `labels`: A `bool` `Tensor` whose shape matches `predictions`. -* `thresholds`: A python list or tuple of float thresholds in `[0, 1]`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that `auc` should be - added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `precision`: A float `Tensor` of shape `[len(thresholds)]`. -* `update_op`: An operation that increments the `true_positives`, - `true_negatives`, `false_positives` and `false_negatives` variables that - are used in the computation of `precision`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_auc(predictions, labels, weights=None, num_thresholds=200, metrics_collections=None, updates_collections=None, curve='ROC', name=None)` {#streaming_auc} - -Computes the approximate AUC via a Riemann sum. - -The `streaming_auc` function creates four local variables, `true_positives`, -`true_negatives`, `false_positives` and `false_negatives` that are used to -compute the AUC. To discretize the AUC curve, a linearly spaced set of -thresholds is used to compute pairs of recall and precision values. The area -under the ROC-curve is therefore computed using the height of the recall -values by the false positive rate, while the area under the PR-curve is the -computed using the height of the precision values by the recall. - -This value is ultimately returned as `auc`, an idempotent operation that -computes the area under a discretized curve of precision versus recall values -(computed using the aforementioned variables). The `num_thresholds` variable -controls the degree of discretization with larger numbers of thresholds more -closely approximating the true AUC. The quality of the approximation may vary -dramatically depending on `num_thresholds`. - -For best results, `predictions` should be distributed approximately uniformly -in the range [0, 1] and not peaked around 0 or 1. The quality of the AUC -approximation may be poor if this is not the case. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the `auc`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A floating point `Tensor` of arbitrary shape and whose values - are in the range `[0, 1]`. -* `labels`: A `bool` `Tensor` whose shape matches `predictions`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `num_thresholds`: The number of thresholds to use when discretizing the roc - curve. -* `metrics_collections`: An optional list of collections that `auc` should be - added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `curve`: Specifies the name of the curve to be computed, 'ROC' [default] or - 'PR' for the Precision-Recall-curve. - -* `name`: An optional variable_scope name. - -##### Returns: - - -* `auc`: A scalar `Tensor` representing the current area-under-curve. -* `update_op`: An operation that increments the `true_positives`, - `true_negatives`, `false_positives` and `false_negatives` variables - appropriately and whose value matches `auc`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_recall_at_k(*args, **kwargs)` {#streaming_recall_at_k} - -Computes the recall@k of the predictions with respect to dense labels. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-11-08. -Instructions for updating: -Please use `streaming_sparse_recall_at_k`, and reshape labels from [batch_size] to [batch_size, 1]. - -The `streaming_recall_at_k` function creates two local variables, `total` and -`count`, that are used to compute the recall@k frequency. This frequency is -ultimately returned as `recall_at_`: an idempotent operation that simply -divides `total` by `count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`recall_at_`. Internally, an `in_top_k` operation computes a `Tensor` with -shape [batch_size] whose elements indicate whether or not the corresponding -label is in the top `k` `predictions`. Then `update_op` increments `total` -with the reduced sum of `weights` where `in_top_k` is `True`, and it -increments `count` with the reduced sum of `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A float `Tensor` of dimension [batch_size, num_classes]. -* `labels`: A `Tensor` of dimension [batch_size] whose type is in `int32`, - `int64`. -* `k`: The number of top elements to look at for computing recall. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that `recall_at_k` - should be added to. -* `updates_collections`: An optional list of collections `update_op` should be - added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `recall_at_k`: A `Tensor` representing the recall@k, the fraction of labels - which fall into the top `k` predictions. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `recall_at_k`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_mean_absolute_error(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_mean_absolute_error} - -Computes the mean absolute error between the labels and predictions. - -The `streaming_mean_absolute_error` function creates two local variables, -`total` and `count` that are used to compute the mean absolute error. This -average is weighted by `weights`, and it is ultimately returned as -`mean_absolute_error`: an idempotent operation that simply divides `total` by -`count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`mean_absolute_error`. Internally, an `absolute_errors` operation computes the -absolute value of the differences between `predictions` and `labels`. Then -`update_op` increments `total` with the reduced sum of the product of -`weights` and `absolute_errors`, and it increments `count` with the reduced -sum of `weights` - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A `Tensor` of arbitrary shape. -* `labels`: A `Tensor` of the same shape as `predictions`. -* `weights`: Optional `Tensor` indicating the frequency with which an example is - sampled. Rank must be 0, or the same rank as `labels`, and must be - broadcastable to `labels` (i.e., all dimensions must be either `1`, or - the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that - `mean_absolute_error` should be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `mean_absolute_error`: A `Tensor` representing the current mean, the value of - `total` divided by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `mean_absolute_error`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_mean_iou(predictions, labels, num_classes, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_mean_iou} - -Calculate per-step mean Intersection-Over-Union (mIOU). - -Mean Intersection-Over-Union is a common evaluation metric for -semantic image segmentation, which first computes the IOU for each -semantic class and then computes the average over classes. - -##### IOU is defined as follows: - - IOU = true_positive / (true_positive + false_positive + false_negative). -The predictions are accumulated in a confusion matrix, weighted by `weights`, -and mIOU is then calculated from it. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the `mean_iou`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A `Tensor` of prediction results for semantic labels, whose - shape is [batch size] and type `int32` or `int64`. The tensor will be - flattened, if its rank > 1. -* `labels`: A `Tensor` of ground truth labels with shape [batch size] and of - type `int32` or `int64`. The tensor will be flattened, if its rank > 1. -* `num_classes`: The possible number of labels the prediction task can - have. This value must be provided, since a confusion matrix of - dimension = [num_classes, num_classes] will be allocated. -* `weights`: An optional `Tensor` whose shape is broadcastable to `predictions`. -* `metrics_collections`: An optional list of collections that `mean_iou` - should be added to. -* `updates_collections`: An optional list of collections `update_op` should be - added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `mean_iou`: A `Tensor` representing the mean intersection-over-union. -* `update_op`: An operation that increments the confusion matrix. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_mean_relative_error(predictions, labels, normalizer, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_mean_relative_error} - -Computes the mean relative error by normalizing with the given values. - -The `streaming_mean_relative_error` function creates two local variables, -`total` and `count` that are used to compute the mean relative absolute error. -This average is weighted by `weights`, and it is ultimately returned as -`mean_relative_error`: an idempotent operation that simply divides `total` by -`count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`mean_reative_error`. Internally, a `relative_errors` operation divides the -absolute value of the differences between `predictions` and `labels` by the -`normalizer`. Then `update_op` increments `total` with the reduced sum of the -product of `weights` and `relative_errors`, and it increments `count` with the -reduced sum of `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A `Tensor` of arbitrary shape. -* `labels`: A `Tensor` of the same shape as `predictions`. -* `normalizer`: A `Tensor` of the same shape as `predictions`. -* `weights`: Optional `Tensor` indicating the frequency with which an example is - sampled. Rank must be 0, or the same rank as `labels`, and must be - broadcastable to `labels` (i.e., all dimensions must be either `1`, or - the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that - `mean_relative_error` should be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `mean_relative_error`: A `Tensor` representing the current mean, the value of - `total` divided by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `mean_relative_error`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_mean_squared_error(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_mean_squared_error} - -Computes the mean squared error between the labels and predictions. - -The `streaming_mean_squared_error` function creates two local variables, -`total` and `count` that are used to compute the mean squared error. -This average is weighted by `weights`, and it is ultimately returned as -`mean_squared_error`: an idempotent operation that simply divides `total` by -`count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`mean_squared_error`. Internally, a `squared_error` operation computes the -element-wise square of the difference between `predictions` and `labels`. Then -`update_op` increments `total` with the reduced sum of the product of -`weights` and `squared_error`, and it increments `count` with the reduced sum -of `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A `Tensor` of arbitrary shape. -* `labels`: A `Tensor` of the same shape as `predictions`. -* `weights`: Optional `Tensor` indicating the frequency with which an example is - sampled. Rank must be 0, or the same rank as `labels`, and must be - broadcastable to `labels` (i.e., all dimensions must be either `1`, or - the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that - `mean_squared_error` should be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `mean_squared_error`: A `Tensor` representing the current mean, the value of - `total` divided by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `mean_squared_error`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_mean_tensor(values, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_mean_tensor} - -Computes the element-wise (weighted) mean of the given tensors. - -In contrast to the `streaming_mean` function which returns a scalar with the -mean, this function returns an average tensor with the same shape as the -input tensors. - -The `streaming_mean_tensor` function creates two local variables, -`total_tensor` and `count_tensor` that are used to compute the average of -`values`. This average is ultimately returned as `mean` which is an idempotent -operation that simply divides `total` by `count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the `mean`. -`update_op` increments `total` with the reduced sum of the product of `values` -and `weights`, and it increments `count` with the reduced sum of `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `values`: A `Tensor` of arbitrary dimensions. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `values`, and - must be broadcastable to `values` (i.e., all dimensions must be either - `1`, or the same as the corresponding `values` dimension). -* `metrics_collections`: An optional list of collections that `mean` - should be added to. -* `updates_collections`: An optional list of collections that `update_op` - should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `mean`: A float `Tensor` representing the current mean, the value of `total` - divided by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `mean_value`. - -##### Raises: - - -* `ValueError`: If `weights` is not `None` and its shape doesn't match `values`, - or if either `metrics_collections` or `updates_collections` are not a list - or tuple. - - -- - - - -### `tf.contrib.metrics.streaming_root_mean_squared_error(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_root_mean_squared_error} - -Computes the root mean squared error between the labels and predictions. - -The `streaming_root_mean_squared_error` function creates two local variables, -`total` and `count` that are used to compute the root mean squared error. -This average is weighted by `weights`, and it is ultimately returned as -`root_mean_squared_error`: an idempotent operation that takes the square root -of the division of `total` by `count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`root_mean_squared_error`. Internally, a `squared_error` operation computes -the element-wise square of the difference between `predictions` and `labels`. -Then `update_op` increments `total` with the reduced sum of the product of -`weights` and `squared_error`, and it increments `count` with the reduced sum -of `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A `Tensor` of arbitrary shape. -* `labels`: A `Tensor` of the same shape as `predictions`. -* `weights`: Optional `Tensor` indicating the frequency with which an example is - sampled. Rank must be 0, or the same rank as `labels`, and must be - broadcastable to `labels` (i.e., all dimensions must be either `1`, or - the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that - `root_mean_squared_error` should be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `root_mean_squared_error`: A `Tensor` representing the current mean, the value - of `total` divided by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `root_mean_squared_error`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_covariance(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_covariance} - -Computes the unbiased sample covariance between `predictions` and `labels`. - -The `streaming_covariance` function creates four local variables, -`comoment`, `mean_prediction`, `mean_label`, and `count`, which are used to -compute the sample covariance between predictions and labels across multiple -batches of data. The covariance is ultimately returned as an idempotent -operation that simply divides `comoment` by `count` - 1. We use `count` - 1 -in order to get an unbiased estimate. - -The algorithm used for this online computation is described in -https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance. -Specifically, the formula used to combine two sample comoments is -`C_AB = C_A + C_B + (E[x_A] - E[x_B]) * (E[y_A] - E[y_B]) * n_A * n_B / n_AB` -The comoment for a single batch of data is simply -`sum((x - E[x]) * (y - E[y]))`, optionally weighted. - -If `weights` is not None, then it is used to compute weighted comoments, -means, and count. NOTE: these weights are treated as "frequency weights", as -opposed to "reliability weights". See discussion of the difference on -https://wikipedia.org/wiki/Weighted_arithmetic_mean#Weighted_sample_variance - -To facilitate the computation of covariance across multiple batches of data, -the function creates an `update_op` operation, which updates underlying -variables and returns the updated covariance. - -##### Args: - - -* `predictions`: A `Tensor` of arbitrary size. -* `labels`: A `Tensor` of the same size as `predictions`. -* `weights`: Optional `Tensor` indicating the frequency with which an example is - sampled. Rank must be 0, or the same rank as `labels`, and must be - broadcastable to `labels` (i.e., all dimensions must be either `1`, or - the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `covariance`: A `Tensor` representing the current unbiased sample covariance, - `comoment` / (`count` - 1). -* `update_op`: An operation that updates the local variables appropriately. - -##### Raises: - - -* `ValueError`: If labels and predictions are of different sizes or if either - `metrics_collections` or `updates_collections` are not a list or tuple. - - -- - - - -### `tf.contrib.metrics.streaming_pearson_correlation(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_pearson_correlation} - -Computes Pearson correlation coefficient between `predictions`, `labels`. - -The `streaming_pearson_correlation` function delegates to -`streaming_covariance` the tracking of three [co]variances: - -- `streaming_covariance(predictions, labels)`, i.e. covariance -- `streaming_covariance(predictions, predictions)`, i.e. variance -- `streaming_covariance(labels, labels)`, i.e. variance - -The product-moment correlation ultimately returned is an idempotent operation -`cov(predictions, labels) / sqrt(var(predictions) * var(labels))`. To -facilitate correlation computation across multiple batches, the function -groups the `update_op`s of the underlying streaming_covariance and returns an -`update_op`. - -If `weights` is not None, then it is used to compute a weighted correlation. -NOTE: these weights are treated as "frequency weights", as opposed to -"reliability weights". See discussion of the difference on -https://wikipedia.org/wiki/Weighted_arithmetic_mean#Weighted_sample_variance - -##### Args: - - -* `predictions`: A `Tensor` of arbitrary size. -* `labels`: A `Tensor` of the same size as predictions. -* `weights`: Optional `Tensor` indicating the frequency with which an example is - sampled. Rank must be 0, or the same rank as `labels`, and must be - broadcastable to `labels` (i.e., all dimensions must be either `1`, or - the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `pearson_r`: A `Tensor` representing the current Pearson product-moment - correlation coefficient, the value of - `cov(predictions, labels) / sqrt(var(predictions) * var(labels))`. -* `update_op`: An operation that updates the underlying variables appropriately. - -##### Raises: - - -* `ValueError`: If `labels` and `predictions` are of different sizes, or if - `weights` is the wrong size, or if either `metrics_collections` or - `updates_collections` are not a `list` or `tuple`. - - -- - - - -### `tf.contrib.metrics.streaming_mean_cosine_distance(predictions, labels, dim, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_mean_cosine_distance} - -Computes the cosine distance between the labels and predictions. - -The `streaming_mean_cosine_distance` function creates two local variables, -`total` and `count` that are used to compute the average cosine distance -between `predictions` and `labels`. This average is weighted by `weights`, -and it is ultimately returned as `mean_distance`, which is an idempotent -operation that simply divides `total` by `count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`mean_distance`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A `Tensor` of the same shape as `labels`. -* `labels`: A `Tensor` of arbitrary shape. -* `dim`: The dimension along which the cosine distance is computed. -* `weights`: An optional `Tensor` whose shape is broadcastable to `predictions`, - and whose dimension `dim` is 1. -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `mean_distance`: A `Tensor` representing the current mean, the value of - `total` divided by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_percentage_less(values, threshold, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_percentage_less} - -Computes the percentage of values less than the given threshold. - -The `streaming_percentage_less` function creates two local variables, -`total` and `count` that are used to compute the percentage of `values` that -fall below `threshold`. This rate is weighted by `weights`, and it is -ultimately returned as `percentage` which is an idempotent operation that -simply divides `total` by `count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`percentage`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `values`: A numeric `Tensor` of arbitrary size. -* `threshold`: A scalar threshold. -* `weights`: An optional `Tensor` whose shape is broadcastable to `values`. -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `percentage`: A `Tensor` representing the current mean, the value of `total` - divided by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately. - -##### Raises: - - -* `ValueError`: If `weights` is not `None` and its shape doesn't match `values`, - or if either `metrics_collections` or `updates_collections` are not a list - or tuple. - - -- - - - -### `tf.contrib.metrics.streaming_sensitivity_at_specificity(predictions, labels, specificity, weights=None, num_thresholds=200, metrics_collections=None, updates_collections=None, name=None)` {#streaming_sensitivity_at_specificity} - -Computes the specificity at a given sensitivity. - -The `streaming_sensitivity_at_specificity` function creates four local -variables, `true_positives`, `true_negatives`, `false_positives` and -`false_negatives` that are used to compute the sensitivity at the given -specificity value. The threshold for the given specificity value is computed -and used to evaluate the corresponding sensitivity. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`sensitivity`. `update_op` increments the `true_positives`, `true_negatives`, -`false_positives` and `false_negatives` counts with the weight of each case -found in the `predictions` and `labels`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -For additional information about specificity and sensitivity, see the -following: https://en.wikipedia.org/wiki/Sensitivity_and_specificity - -##### Args: - - -* `predictions`: A floating point `Tensor` of arbitrary shape and whose values - are in the range `[0, 1]`. -* `labels`: A `bool` `Tensor` whose shape matches `predictions`. -* `specificity`: A scalar value in range `[0, 1]`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `num_thresholds`: The number of thresholds to use for matching the given - specificity. -* `metrics_collections`: An optional list of collections that `sensitivity` - should be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `sensitivity`: A scalar `Tensor` representing the sensitivity at the given - `specificity` value. -* `update_op`: An operation that increments the `true_positives`, - `true_negatives`, `false_positives` and `false_negatives` variables - appropriately and whose value matches `sensitivity`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, if - `weights` is not `None` and its shape doesn't match `predictions`, or if - `specificity` is not between 0 and 1, or if either `metrics_collections` - or `updates_collections` are not a list or tuple. - - -- - - - -### `tf.contrib.metrics.streaming_sparse_average_precision_at_k(predictions, labels, k, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_sparse_average_precision_at_k} - -Computes average precision@k of predictions with respect to sparse labels. - -See `sparse_average_precision_at_k` for details on formula. `weights` are -applied to the result of `sparse_average_precision_at_k` - -`streaming_sparse_average_precision_at_k` creates two local variables, -`average_precision_at_/total` and `average_precision_at_/max`, that -are used to compute the frequency. This frequency is ultimately returned as -`average_precision_at_`: an idempotent operation that simply divides -`average_precision_at_/total` by `average_precision_at_/max`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`precision_at_`. Internally, a `top_k` operation computes a `Tensor` -indicating the top `k` `predictions`. Set operations applied to `top_k` and -`labels` calculate the true positives and false positives weighted by -`weights`. Then `update_op` increments `true_positive_at_` and -`false_positive_at_` using these values. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: Float `Tensor` with shape [D1, ... DN, num_classes] where - N >= 1. Commonly, N=1 and `predictions` has shape - [batch size, num_classes]. The final dimension contains the logit values - for each class. [D1, ... DN] must match `labels`. -* `labels`: `int64` `Tensor` or `SparseTensor` with shape - [D1, ... DN, num_labels], where N >= 1 and num_labels is the number of - target classes for the associated prediction. Commonly, N=1 and `labels` - has shape [batch_size, num_labels]. [D1, ... DN] must match - `predictions_`. Values should be in range [0, num_classes), where - num_classes is the last dimension of `predictions`. Values outside this - range are ignored. -* `k`: Integer, k for @k metric. This will calculate an average precision for - range `[1,k]`, as documented above. -* `weights`: `Tensor` whose rank is either 0, or n-1, where n is the rank of - `labels`. If the latter, it must be broadcastable to `labels` (i.e., all - dimensions must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that values should - be added to. -* `updates_collections`: An optional list of collections that updates should - be added to. -* `name`: Name of new update operation, and namespace for other dependent ops. - -##### Returns: - - -* `mean_average_precision`: Scalar `float64` `Tensor` with the mean average - precision values. -* `update`: `Operation` that increments variables appropriately, and whose - value matches `metric`. - - -- - - - -### `tf.contrib.metrics.streaming_sparse_precision_at_k(predictions, labels, k, class_id=None, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_sparse_precision_at_k} - -Computes precision@k of the predictions with respect to sparse labels. - -If `class_id` is not specified, we calculate precision as the ratio of true - positives (i.e., correct predictions, items in the top `k` highest - `predictions` that are found in the corresponding row in `labels`) to - positives (all top `k` `predictions`). -If `class_id` is specified, we calculate precision by considering only the - rows in the batch for which `class_id` is in the top `k` highest - `predictions`, and computing the fraction of them for which `class_id` is - in the corresponding row in `labels`. - -We expect precision to decrease as `k` increases. - -`streaming_sparse_precision_at_k` creates two local variables, -`true_positive_at_` and `false_positive_at_`, that are used to compute -the precision@k frequency. This frequency is ultimately returned as -`precision_at_`: an idempotent operation that simply divides -`true_positive_at_` by total (`true_positive_at_` + -`false_positive_at_`). - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`precision_at_`. Internally, a `top_k` operation computes a `Tensor` -indicating the top `k` `predictions`. Set operations applied to `top_k` and -`labels` calculate the true positives and false positives weighted by -`weights`. Then `update_op` increments `true_positive_at_` and -`false_positive_at_` using these values. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: Float `Tensor` with shape [D1, ... DN, num_classes] where - N >= 1. Commonly, N=1 and predictions has shape [batch size, num_classes]. - The final dimension contains the logit values for each class. [D1, ... DN] - must match `labels`. -* `labels`: `int64` `Tensor` or `SparseTensor` with shape - [D1, ... DN, num_labels], where N >= 1 and num_labels is the number of - target classes for the associated prediction. Commonly, N=1 and `labels` - has shape [batch_size, num_labels]. [D1, ... DN] must match - `predictions`. Values should be in range [0, num_classes), where - num_classes is the last dimension of `predictions`. Values outside this - range are ignored. -* `k`: Integer, k for @k metric. -* `class_id`: Integer class ID for which we want binary metrics. This should be - in range [0, num_classes], where num_classes is the last dimension of - `predictions`. If `class_id` is outside this range, the method returns - NAN. -* `weights`: `Tensor` whose rank is either 0, or n-1, where n is the rank of - `labels`. If the latter, it must be broadcastable to `labels` (i.e., all - dimensions must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that values should - be added to. -* `updates_collections`: An optional list of collections that updates should - be added to. -* `name`: Name of new update operation, and namespace for other dependent ops. - -##### Returns: - - -* `precision`: Scalar `float64` `Tensor` with the value of `true_positives` - divided by the sum of `true_positives` and `false_positives`. -* `update_op`: `Operation` that increments `true_positives` and - `false_positives` variables appropriately, and whose value matches - `precision`. - -##### Raises: - - -* `ValueError`: If `weights` is not `None` and its shape doesn't match - `predictions`, or if either `metrics_collections` or `updates_collections` - are not a list or tuple. - - -- - - - -### `tf.contrib.metrics.streaming_sparse_precision_at_top_k(top_k_predictions, labels, class_id=None, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_sparse_precision_at_top_k} - -Computes precision@k of top-k predictions with respect to sparse labels. - -If `class_id` is not specified, we calculate precision as the ratio of - true positives (i.e., correct predictions, items in `top_k_predictions` - that are found in the corresponding row in `labels`) to positives (all - `top_k_predictions`). -If `class_id` is specified, we calculate precision by considering only the - rows in the batch for which `class_id` is in the top `k` highest - `predictions`, and computing the fraction of them for which `class_id` is - in the corresponding row in `labels`. - -We expect precision to decrease as `k` increases. - -`streaming_sparse_precision_at_top_k` creates two local variables, -`true_positive_at_k` and `false_positive_at_k`, that are used to compute -the precision@k frequency. This frequency is ultimately returned as -`precision_at_k`: an idempotent operation that simply divides -`true_positive_at_k` by total (`true_positive_at_k` + `false_positive_at_k`). - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`precision_at_k`. Internally, set operations applied to `top_k_predictions` -and `labels` calculate the true positives and false positives weighted by -`weights`. Then `update_op` increments `true_positive_at_k` and -`false_positive_at_k` using these values. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `top_k_predictions`: Integer `Tensor` with shape [D1, ... DN, k] where - N >= 1. Commonly, N=1 and top_k_predictions has shape [batch size, k]. - The final dimension contains the indices of top-k labels. [D1, ... DN] - must match `labels`. -* `labels`: `int64` `Tensor` or `SparseTensor` with shape - [D1, ... DN, num_labels], where N >= 1 and num_labels is the number of - target classes for the associated prediction. Commonly, N=1 and `labels` - has shape [batch_size, num_labels]. [D1, ... DN] must match - `top_k_predictions`. Values should be in range [0, num_classes), where - num_classes is the last dimension of `predictions`. Values outside this - range are ignored. -* `class_id`: Integer class ID for which we want binary metrics. This should be - in range [0, num_classes), where num_classes is the last dimension of - `predictions`. If `class_id` is outside this range, the method returns - NAN. -* `weights`: `Tensor` whose rank is either 0, or n-1, where n is the rank of - `labels`. If the latter, it must be broadcastable to `labels` (i.e., all - dimensions must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that values should - be added to. -* `updates_collections`: An optional list of collections that updates should - be added to. -* `name`: Name of new update operation, and namespace for other dependent ops. - -##### Returns: - - -* `precision`: Scalar `float64` `Tensor` with the value of `true_positives` - divided by the sum of `true_positives` and `false_positives`. -* `update_op`: `Operation` that increments `true_positives` and - `false_positives` variables appropriately, and whose value matches - `precision`. - -##### Raises: - - -* `ValueError`: If `weights` is not `None` and its shape doesn't match - `predictions`, or if either `metrics_collections` or `updates_collections` - are not a list or tuple. -* `ValueError`: If `top_k_predictions` has rank < 2. - - -- - - - -### `tf.contrib.metrics.streaming_sparse_recall_at_k(predictions, labels, k, class_id=None, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_sparse_recall_at_k} - -Computes recall@k of the predictions with respect to sparse labels. - -If `class_id` is not specified, we'll calculate recall as the ratio of true - positives (i.e., correct predictions, items in the top `k` highest - `predictions` that are found in the corresponding row in `labels`) to - actual positives (the full `labels` row). -If `class_id` is specified, we calculate recall by considering only the rows - in the batch for which `class_id` is in `labels`, and computing the - fraction of them for which `class_id` is in the corresponding row in - `labels`. - -`streaming_sparse_recall_at_k` creates two local variables, -`true_positive_at_` and `false_negative_at_`, that are used to compute -the recall_at_k frequency. This frequency is ultimately returned as -`recall_at_`: an idempotent operation that simply divides -`true_positive_at_` by total (`true_positive_at_` + -`false_negative_at_`). - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`recall_at_`. Internally, a `top_k` operation computes a `Tensor` -indicating the top `k` `predictions`. Set operations applied to `top_k` and -`labels` calculate the true positives and false negatives weighted by -`weights`. Then `update_op` increments `true_positive_at_` and -`false_negative_at_` using these values. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: Float `Tensor` with shape [D1, ... DN, num_classes] where - N >= 1. Commonly, N=1 and predictions has shape [batch size, num_classes]. - The final dimension contains the logit values for each class. [D1, ... DN] - must match `labels`. -* `labels`: `int64` `Tensor` or `SparseTensor` with shape - [D1, ... DN, num_labels], where N >= 1 and num_labels is the number of - target classes for the associated prediction. Commonly, N=1 and `labels` - has shape [batch_size, num_labels]. [D1, ... DN] must match `predictions`. - Values should be in range [0, num_classes), where num_classes is the last - dimension of `predictions`. Values outside this range always count - towards `false_negative_at_`. -* `k`: Integer, k for @k metric. -* `class_id`: Integer class ID for which we want binary metrics. This should be - in range [0, num_classes), where num_classes is the last dimension of - `predictions`. If class_id is outside this range, the method returns NAN. -* `weights`: `Tensor` whose rank is either 0, or n-1, where n is the rank of - `labels`. If the latter, it must be broadcastable to `labels` (i.e., all - dimensions must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that values should - be added to. -* `updates_collections`: An optional list of collections that updates should - be added to. -* `name`: Name of new update operation, and namespace for other dependent ops. - -##### Returns: - - -* `recall`: Scalar `float64` `Tensor` with the value of `true_positives` divided - by the sum of `true_positives` and `false_negatives`. -* `update_op`: `Operation` that increments `true_positives` and - `false_negatives` variables appropriately, and whose value matches - `recall`. - -##### Raises: - - -* `ValueError`: If `weights` is not `None` and its shape doesn't match - `predictions`, or if either `metrics_collections` or `updates_collections` - are not a list or tuple. - - -- - - - -### `tf.contrib.metrics.streaming_specificity_at_sensitivity(predictions, labels, sensitivity, weights=None, num_thresholds=200, metrics_collections=None, updates_collections=None, name=None)` {#streaming_specificity_at_sensitivity} - -Computes the specificity at a given sensitivity. - -The `streaming_specificity_at_sensitivity` function creates four local -variables, `true_positives`, `true_negatives`, `false_positives` and -`false_negatives` that are used to compute the specificity at the given -sensitivity value. The threshold for the given sensitivity value is computed -and used to evaluate the corresponding specificity. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`specificity`. `update_op` increments the `true_positives`, `true_negatives`, -`false_positives` and `false_negatives` counts with the weight of each case -found in the `predictions` and `labels`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -For additional information about specificity and sensitivity, see the -following: https://en.wikipedia.org/wiki/Sensitivity_and_specificity - -##### Args: - - -* `predictions`: A floating point `Tensor` of arbitrary shape and whose values - are in the range `[0, 1]`. -* `labels`: A `bool` `Tensor` whose shape matches `predictions`. -* `sensitivity`: A scalar value in range `[0, 1]`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `num_thresholds`: The number of thresholds to use for matching the given - sensitivity. -* `metrics_collections`: An optional list of collections that `specificity` - should be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `specificity`: A scalar `Tensor` representing the specificity at the given - `specificity` value. -* `update_op`: An operation that increments the `true_positives`, - `true_negatives`, `false_positives` and `false_negatives` variables - appropriately and whose value matches `specificity`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, if - `weights` is not `None` and its shape doesn't match `predictions`, or if - `sensitivity` is not between 0 and 1, or if either `metrics_collections` - or `updates_collections` are not a list or tuple. - - -- - - - -### `tf.contrib.metrics.streaming_concat(values, axis=0, max_size=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_concat} - -Concatenate values along an axis across batches. - -The function `streaming_concat` creates two local variables, `array` and -`size`, that are used to store concatenated values. Internally, `array` is -used as storage for a dynamic array (if `maxsize` is `None`), which ensures -that updates can be run in amortized constant time. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that appends the values of a tensor and returns the -length of the concatenated axis. - -This op allows for evaluating metrics that cannot be updated incrementally -using the same framework as other streaming metrics. - -##### Args: - - -* `values`: `Tensor` to concatenate. Rank and the shape along all axes other - than the axis to concatenate along must be statically known. -* `axis`: optional integer axis to concatenate along. -* `max_size`: optional integer maximum size of `value` along the given axis. - Once the maximum size is reached, further updates are no-ops. By default, - there is no maximum size: the array is resized as necessary. -* `metrics_collections`: An optional list of collections that `value` - should be added to. -* `updates_collections`: An optional list of collections `update_op` should be - added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `value`: A `Tensor` representing the concatenated values. -* `update_op`: An operation that concatenates the next values. - -##### Raises: - - -* `ValueError`: if `values` does not have a statically known rank, `axis` is - not in the valid range or the size of `values` is not statically known - along any axis other than `axis`. - - -- - - - -### `tf.contrib.metrics.streaming_false_negatives(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_false_negatives} - -Computes the total number of false positives. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: The predicted values, a `Tensor` of arbitrary dimensions. Will - be cast to `bool`. -* `labels`: The ground truth values, a `Tensor` whose dimensions must match - `predictions`. Will be cast to `bool`. -* `weights`: Optional `Tensor` whose rank is either 0, or the same rank as - `labels`, and must be broadcastable to `labels` (i.e., all dimensions - must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `value_tensor`: A `Tensor` representing the current value of the metric. -* `update_op`: An operation that accumulates the error from a batch of data. - -##### Raises: - - -* `ValueError`: If `weights` is not `None` and its shape doesn't match `values`, - or if either `metrics_collections` or `updates_collections` are not a list - or tuple. - - -- - - - -### `tf.contrib.metrics.streaming_false_negatives_at_thresholds(predictions, labels, thresholds, weights=None)` {#streaming_false_negatives_at_thresholds} - - - - -- - - - -### `tf.contrib.metrics.streaming_false_positives(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_false_positives} - -Sum the weights of false positives. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: The predicted values, a `Tensor` of arbitrary dimensions. Will - be cast to `bool`. -* `labels`: The ground truth values, a `Tensor` whose dimensions must match - `predictions`. Will be cast to `bool`. -* `weights`: Optional `Tensor` whose rank is either 0, or the same rank as - `labels`, and must be broadcastable to `labels` (i.e., all dimensions - must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `value_tensor`: A `Tensor` representing the current value of the metric. -* `update_op`: An operation that accumulates the error from a batch of data. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_false_positives_at_thresholds(predictions, labels, thresholds, weights=None)` {#streaming_false_positives_at_thresholds} - - - - -- - - - -### `tf.contrib.metrics.streaming_true_negatives(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_true_negatives} - -Sum the weights of true_negatives. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: The predicted values, a `Tensor` of arbitrary dimensions. Will - be cast to `bool`. -* `labels`: The ground truth values, a `Tensor` whose dimensions must match - `predictions`. Will be cast to `bool`. -* `weights`: Optional `Tensor` whose rank is either 0, or the same rank as - `labels`, and must be broadcastable to `labels` (i.e., all dimensions - must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `value_tensor`: A `Tensor` representing the current value of the metric. -* `update_op`: An operation that accumulates the error from a batch of data. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_true_negatives_at_thresholds(predictions, labels, thresholds, weights=None)` {#streaming_true_negatives_at_thresholds} - - - - -- - - - -### `tf.contrib.metrics.streaming_true_positives(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_true_positives} - -Sum the weights of true_positives. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: The predicted values, a `Tensor` of arbitrary dimensions. Will - be cast to `bool`. -* `labels`: The ground truth values, a `Tensor` whose dimensions must match - `predictions`. Will be cast to `bool`. -* `weights`: Optional `Tensor` whose rank is either 0, or the same rank as - `labels`, and must be broadcastable to `labels` (i.e., all dimensions - must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `value_tensor`: A `Tensor` representing the current value of the metric. -* `update_op`: An operation that accumulates the error from a batch of data. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - - -- - - - -### `tf.contrib.metrics.streaming_true_positives_at_thresholds(predictions, labels, thresholds, weights=None)` {#streaming_true_positives_at_thresholds} - - - - -- - - - -### `tf.contrib.metrics.auc_using_histogram(boolean_labels, scores, score_range, nbins=100, collections=None, check_shape=True, name=None)` {#auc_using_histogram} - -AUC computed by maintaining histograms. - -Rather than computing AUC directly, this Op maintains Variables containing -histograms of the scores associated with `True` and `False` labels. By -comparing these the AUC is generated, with some discretization error. -See: "Efficient AUC Learning Curve Calculation" by Bouckaert. - -This AUC Op updates in `O(batch_size + nbins)` time and works well even with -large class imbalance. The accuracy is limited by discretization error due -to finite number of bins. If scores are concentrated in a fewer bins, -accuracy is lower. If this is a concern, we recommend trying different -numbers of bins and comparing results. - -##### Args: - - -* `boolean_labels`: 1-D boolean `Tensor`. Entry is `True` if the corresponding - record is in class. -* `scores`: 1-D numeric `Tensor`, same shape as boolean_labels. -* `score_range`: `Tensor` of shape `[2]`, same dtype as `scores`. The min/max - values of score that we expect. Scores outside range will be clipped. -* `nbins`: Integer number of bins to use. Accuracy strictly increases as the - number of bins increases. -* `collections`: List of graph collections keys. Internal histogram Variables - are added to these collections. Defaults to `[GraphKeys.LOCAL_VARIABLES]`. -* `check_shape`: Boolean. If `True`, do a runtime shape check on the scores - and labels. -* `name`: A name for this Op. Defaults to "auc_using_histogram". - -##### Returns: - - -* `auc`: `float32` scalar `Tensor`. Fetching this converts internal histograms - to auc value. -* `update_op`: `Op`, when run, updates internal histograms. - - -- - - - -### `tf.contrib.metrics.accuracy(predictions, labels, weights=None)` {#accuracy} - -Computes the percentage of times that predictions matches labels. - -##### Args: - - -* `predictions`: the predicted values, a `Tensor` whose dtype and shape - matches 'labels'. -* `labels`: the ground truth values, a `Tensor` of any shape and - bool, integer, or string dtype. -* `weights`: None or `Tensor` of float values to reweight the accuracy. - -##### Returns: - - Accuracy `Tensor`. - -##### Raises: - - -* `ValueError`: if dtypes don't match or - if dtype is not bool, integer, or string. - - -- - - - -### `tf.contrib.metrics.aggregate_metrics(*value_update_tuples)` {#aggregate_metrics} - -Aggregates the metric value tensors and update ops into two lists. - -##### Args: - - -* `*value_update_tuples`: a variable number of tuples, each of which contain the - pair of (value_tensor, update_op) from a streaming metric. - -##### Returns: - - A list of value `Tensor` objects and a list of update ops. - -##### Raises: - - -* `ValueError`: if `value_update_tuples` is empty. - - -- - - - -### `tf.contrib.metrics.aggregate_metric_map(names_to_tuples)` {#aggregate_metric_map} - -Aggregates the metric names to tuple dictionary. - -This function is useful for pairing metric names with their associated value -and update ops when the list of metrics is long. For example: - -```python - metrics_to_values, metrics_to_updates = slim.metrics.aggregate_metric_map({ - 'Mean Absolute Error': new_slim.metrics.streaming_mean_absolute_error( - predictions, labels, weights), - 'Mean Relative Error': new_slim.metrics.streaming_mean_relative_error( - predictions, labels, labels, weights), - 'RMSE Linear': new_slim.metrics.streaming_root_mean_squared_error( - predictions, labels, weights), - 'RMSE Log': new_slim.metrics.streaming_root_mean_squared_error( - predictions, labels, weights), - }) -``` - -##### Args: - - -* `names_to_tuples`: a map of metric names to tuples, each of which contain the - pair of (value_tensor, update_op) from a streaming metric. - -##### Returns: - - A dictionary from metric names to value ops and a dictionary from metric - names to update ops. - - -- - - - -### `tf.contrib.metrics.confusion_matrix(labels, predictions, num_classes=None, dtype=tf.int32, name=None, weights=None)` {#confusion_matrix} - -Deprecated. Use tf.confusion_matrix instead. - - -- - - - -### `tf.contrib.metrics.set_difference(a, b, aminusb=True, validate_indices=True)` {#set_difference} - -Compute set difference of elements in last dimension of `a` and `b`. - -All but the last dimension of `a` and `b` must match. - -Example: - -```python - a = [ - [ - [ - [1, 2], - [3], - ], - [ - [4], - [5, 6], - ], - ], - ] - b = [ - [ - [ - [1, 3], - [2], - ], - [ - [4, 5], - [5, 6, 7, 8], - ], - ], - ] - set_difference(a, b, aminusb=True) = [ - [ - [ - [2], - [3], - ], - [ - [], - [], - ], - ], - ] -``` - -##### Args: - - -* `a`: `Tensor` or `SparseTensor` of the same type as `b`. If sparse, indices - must be sorted in row-major order. -* `b`: `Tensor` or `SparseTensor` of the same type as `a`. If sparse, indices - must be sorted in row-major order. -* `aminusb`: Whether to subtract `b` from `a`, vs vice versa. -* `validate_indices`: Whether to validate the order and range of sparse indices - in `a` and `b`. - -##### Returns: - - A `SparseTensor` whose shape is the same rank as `a` and `b`, and all but - the last dimension the same. Elements along the last dimension contain the - differences. - - -- - - - -### `tf.contrib.metrics.set_intersection(a, b, validate_indices=True)` {#set_intersection} - -Compute set intersection of elements in last dimension of `a` and `b`. - -All but the last dimension of `a` and `b` must match. - -Example: - -```python - a = [ - [ - [ - [1, 2], - [3], - ], - [ - [4], - [5, 6], - ], - ], - ] - b = [ - [ - [ - [1, 3], - [2], - ], - [ - [4, 5], - [5, 6, 7, 8], - ], - ], - ] - set_intersection(a, b) = [ - [ - [ - [1], - [], - ], - [ - [4], - [5, 6], - ], - ], - ] -``` - -##### Args: - - -* `a`: `Tensor` or `SparseTensor` of the same type as `b`. If sparse, indices - must be sorted in row-major order. -* `b`: `Tensor` or `SparseTensor` of the same type as `a`. If sparse, indices - must be sorted in row-major order. -* `validate_indices`: Whether to validate the order and range of sparse indices - in `a` and `b`. - -##### Returns: - - A `SparseTensor` whose shape is the same rank as `a` and `b`, and all but - the last dimension the same. Elements along the last dimension contain the - intersections. - - -- - - - -### `tf.contrib.metrics.set_size(a, validate_indices=True)` {#set_size} - -Compute number of unique elements along last dimension of `a`. - -##### Args: - - -* `a`: `SparseTensor`, with indices sorted in row-major order. -* `validate_indices`: Whether to validate the order and range of sparse indices - in `a`. - -##### Returns: - - `int32` `Tensor` of set sizes. For `a` ranked `n`, this is a `Tensor` with - rank `n-1`, and the same 1st `n-1` dimensions as `a`. Each value is the - number of unique elements in the corresponding `[0...n-1]` dimension of `a`. - -##### Raises: - - -* `TypeError`: If `a` is an invalid types. - - -- - - - -### `tf.contrib.metrics.set_union(a, b, validate_indices=True)` {#set_union} - -Compute set union of elements in last dimension of `a` and `b`. - -All but the last dimension of `a` and `b` must match. - -Example: - -```python - a = [ - [ - [ - [1, 2], - [3], - ], - [ - [4], - [5, 6], - ], - ], - ] - b = [ - [ - [ - [1, 3], - [2], - ], - [ - [4, 5], - [5, 6, 7, 8], - ], - ], - ] - set_union(a, b) = [ - [ - [ - [1, 2, 3], - [2, 3], - ], - [ - [4, 5], - [5, 6, 7, 8], - ], - ], - ] -``` - -##### Args: - - -* `a`: `Tensor` or `SparseTensor` of the same type as `b`. If sparse, indices - must be sorted in row-major order. -* `b`: `Tensor` or `SparseTensor` of the same type as `a`. If sparse, indices - must be sorted in row-major order. -* `validate_indices`: Whether to validate the order and range of sparse indices - in `a` and `b`. - -##### Returns: - - A `SparseTensor` whose shape is the same rank as `a` and `b`, and all but - the last dimension the same. Elements along the last dimension contain the - unions. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.opt.md b/tensorflow/g3doc/api_docs/python/contrib.opt.md deleted file mode 100644 index e93e3f4571..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.opt.md +++ /dev/null @@ -1,454 +0,0 @@ - - -# Optimization (contrib) -[TOC] - -A module containing optimization routines. - -## Other Functions and Classes -- - - - -### `class tf.contrib.opt.ExternalOptimizerInterface` {#ExternalOptimizerInterface} - -Base class for interfaces with external optimization algorithms. - -Subclass this and implement `_minimize` in order to wrap a new optimization -algorithm. - -`ExternalOptimizerInterface` should not be instantiated directly; instead use -e.g. `ScipyOptimizerInterface`. - -- - - - -#### `tf.contrib.opt.ExternalOptimizerInterface.__init__(loss, var_list=None, equalities=None, inequalities=None, **optimizer_kwargs)` {#ExternalOptimizerInterface.__init__} - -Initialize a new interface instance. - -##### Args: - - -* `loss`: A scalar `Tensor` to be minimized. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `equalities`: Optional list of equality constraint scalar `Tensor`s to be - held equal to zero. -* `inequalities`: Optional list of inequality constraint scalar `Tensor`s - to be kept nonnegative. -* `**optimizer_kwargs`: Other subclass-specific keyword arguments. - - - -- - - - -#### `tf.contrib.opt.ExternalOptimizerInterface.minimize(session=None, feed_dict=None, fetches=None, step_callback=None, loss_callback=None)` {#ExternalOptimizerInterface.minimize} - -Minimize a scalar `Tensor`. - -Variables subject to optimization are updated in-place at the end of -optimization. - -Note that this method does *not* just return a minimization `Op`, unlike -`Optimizer.minimize()`; instead it actually performs minimization by -executing commands to control a `Session`. - -##### Args: - - -* `session`: A `Session` instance. -* `feed_dict`: A feed dict to be passed to calls to `session.run`. -* `fetches`: A list of `Tensor`s to fetch and supply to `loss_callback` - as positional arguments. -* `step_callback`: A function to be called at each optimization step; - arguments are the current values of all optimization variables - flattened into a single vector. -* `loss_callback`: A function to be called every time the loss and gradients - are computed, with evaluated fetches supplied as positional arguments. - - - -- - - - -### `class tf.contrib.opt.MovingAverageOptimizer` {#MovingAverageOptimizer} - -Optimizer that computes a moving average of the variables. - -Empirically it has been found that using the moving average of the trained -parameters of a deep network is better than using its trained parameters -directly. This optimizer allows you to compute this moving average and swap -the variables at save time so that any code outside of the training loop will -use by default the averaged values instead of the original ones. - -Example of usage: - -```python - -// Encapsulate your favorite optimizer (here the momentum one) -// inside the MovingAverageOptimizer. -opt = tf.train.MomentumOptimizer(learning_rate, FLAGS.momentum) -opt = tf.contrib.opt.MovingAverageOptimizer(opt) -// Then create your model and all its variables. -model = build_model() -// Add the training op that optimizes using opt. -// This needs to be called before swapping_saver(). -opt.minimize(cost, var_list) -// Then create your saver like this: -saver = opt.swapping_saver() -// Pass it to your training loop. - slim.learning.train( - model, - ... - saver=saver) -``` - -Note that for evaluation, the normal saver should be used instead of -swapping_saver(). -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.__init__(opt, average_decay=0.9999, num_updates=None, sequential_update=True)` {#MovingAverageOptimizer.__init__} - -Construct a new MovingAverageOptimizer. - -##### Args: - - -* `opt`: A tf.Optimizer that will be used to compute and apply gradients. -* `average_decay`: Float. Decay to use to maintain the moving averages - of trained variables. - See tf.train.ExponentialMovingAverage for details. -* `num_updates`: Optional count of number of updates applied to variables. - See tf.train.ExponentialMovingAverage for details. -* `sequential_update`: Bool. If False, will compute the moving average at the - same time as the model is updated, potentially doing - benign data races. - If True, will update the moving average after gradient - updates. - - -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#MovingAverageOptimizer.apply_gradients} - - - - -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.compute_gradients(loss, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, grad_loss=None)` {#MovingAverageOptimizer.compute_gradients} - -Compute gradients of `loss` for the variables in `var_list`. - -This is the first part of `minimize()`. It returns a list -of (gradient, variable) pairs where "gradient" is the gradient -for "variable". Note that "gradient" can be a `Tensor`, an -`IndexedSlices`, or `None` if there is no gradient for the -given variable. - -##### Args: - - -* `loss`: A Tensor containing the value to minimize. -* `var_list`: Optional list of `tf.Variable` to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKey.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - A list of (gradient, variable) pairs. Variable is always present, but - gradient can be `None`. - -##### Raises: - - -* `TypeError`: If `var_list` contains anything else than `Variable` objects. -* `ValueError`: If some arguments are invalid. - - -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.get_name()` {#MovingAverageOptimizer.get_name} - - - - -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.get_slot(var, name)` {#MovingAverageOptimizer.get_slot} - -Return a slot named `name` created for `var` by the Optimizer. - -Some `Optimizer` subclasses use additional variables. For example -`Momentum` and `Adagrad` use variables to accumulate updates. This method -gives access to these `Variable` objects if for some reason you need them. - -Use `get_slot_names()` to get the list of slot names created by the -`Optimizer`. - -##### Args: - - -* `var`: A variable passed to `minimize()` or `apply_gradients()`. -* `name`: A string. - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.get_slot_names()` {#MovingAverageOptimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -See `get_slot()`. - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.minimize(loss, global_step=None, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, name=None, grad_loss=None)` {#MovingAverageOptimizer.minimize} - -Add operations to minimize `loss` by updating `var_list`. - -This method simply combines calls `compute_gradients()` and -`apply_gradients()`. If you want to process the gradient before applying -them call `compute_gradients()` and `apply_gradients()` explicitly instead -of using this function. - -##### Args: - - -* `loss`: A `Tensor` containing the value to minimize. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `name`: Optional name for the returned operation. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - An Operation that updates the variables in `var_list`. If `global_step` - was not `None`, that operation also increments `global_step`. - -##### Raises: - - -* `ValueError`: If some of the variables are not `Variable` objects. - - -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.swapping_saver(var_list=None, name='swapping_saver', **kwargs)` {#MovingAverageOptimizer.swapping_saver} - -Create a saver swapping moving averages and variables. - -You should use this saver during training. It will save the moving averages -of the trained parameters under the original parameter names. For -evaluations or inference you should use a regular saver and it will -automatically use the moving averages for the trained variable. - -You must call this function after all variables have been created and after -you have called Optimizer.minimize(). - -##### Args: - - -* `var_list`: List of variables to save, as per `Saver()`. - If set to None, will save all the variables that have been - created before this call. -* `name`: The name of the saver. -* `**kwargs`: Keyword arguments of `Saver()`. - -##### Returns: - - A `tf.Saver` object. - -##### Raises: - - -* `RuntimeError`: If apply_gradients or minimize has not been called before. - - - -- - - - -### `class tf.contrib.opt.ScipyOptimizerInterface` {#ScipyOptimizerInterface} - -Wrapper allowing `scipy.optimize.minimize` to operate a `tf.Session`. - -Example: - -```python -vector = tf.Variable([7., 7.], 'vector') - -# Make vector norm as small as possible. -loss = tf.reduce_sum(tf.square(vector)) - -optimizer = ScipyOptimizerInterface(loss, options={'maxiter': 100}) - -with tf.Session() as session: - optimizer.minimize(session) - -# The value of vector should now be [0., 0.]. -``` - -Example with constraints: - -```python -vector = tf.Variable([7., 7.], 'vector') - -# Make vector norm as small as possible. -loss = tf.reduce_sum(tf.square(vector)) -# Ensure the vector's y component is = 1. -equalities = [vector[1] - 1.] -# Ensure the vector's x component is >= 1. -inequalities = [vector[0] - 1.] - -# Our default SciPy optimization algorithm, L-BFGS-B, does not support -# general constraints. Thus we use SLSQP instead. -optimizer = ScipyOptimizerInterface( - loss, equalities=equalities, inequalities=inequalities, method='SLSQP') - -with tf.Session() as session: - optimizer.minimize(session) - -# The value of vector should now be [1., 1.]. -``` -- - - - -#### `tf.contrib.opt.ScipyOptimizerInterface.__init__(loss, var_list=None, equalities=None, inequalities=None, **optimizer_kwargs)` {#ScipyOptimizerInterface.__init__} - -Initialize a new interface instance. - -##### Args: - - -* `loss`: A scalar `Tensor` to be minimized. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `equalities`: Optional list of equality constraint scalar `Tensor`s to be - held equal to zero. -* `inequalities`: Optional list of inequality constraint scalar `Tensor`s - to be kept nonnegative. -* `**optimizer_kwargs`: Other subclass-specific keyword arguments. - - -- - - - -#### `tf.contrib.opt.ScipyOptimizerInterface.minimize(session=None, feed_dict=None, fetches=None, step_callback=None, loss_callback=None)` {#ScipyOptimizerInterface.minimize} - -Minimize a scalar `Tensor`. - -Variables subject to optimization are updated in-place at the end of -optimization. - -Note that this method does *not* just return a minimization `Op`, unlike -`Optimizer.minimize()`; instead it actually performs minimization by -executing commands to control a `Session`. - -##### Args: - - -* `session`: A `Session` instance. -* `feed_dict`: A feed dict to be passed to calls to `session.run`. -* `fetches`: A list of `Tensor`s to fetch and supply to `loss_callback` - as positional arguments. -* `step_callback`: A function to be called at each optimization step; - arguments are the current values of all optimization variables - flattened into a single vector. -* `loss_callback`: A function to be called every time the loss and gradients - are computed, with evaluated fetches supplied as positional arguments. - - - -- - - - -### `class tf.contrib.opt.VariableClippingOptimizer` {#VariableClippingOptimizer} - -Wrapper optimizer that clips the norm of specified variables after update. - -This optimizer delegates all aspects of gradient calculation and application -to an underlying optimizer. After applying gradients, this optimizer then -clips the variable to have a maximum L2 norm along specified dimensions. -NB: this is quite different from clipping the norm of the gradients. - -Multiple instances of `VariableClippingOptimizer` may be chained to specify -different max norms for different subsets of variables. - -This is more efficient at serving-time than using normalization during -embedding lookup, at the expense of more expensive training and fewer -guarantees about the norms. - -- - - - -#### `tf.contrib.opt.VariableClippingOptimizer.__init__(opt, vars_to_clip_dims, max_norm, use_locking=False, colocate_clip_ops_with_vars=False, name='VariableClipping')` {#VariableClippingOptimizer.__init__} - -Construct a new clip-norm optimizer. - -##### Args: - - -* `opt`: The actual optimizer that will be used to compute and apply the - gradients. Must be one of the Optimizer classes. -* `vars_to_clip_dims`: A dict with keys as Variables and values as lists - of dimensions along which to compute the L2-norm. See - `tf.clip_by_norm` for more details. -* `max_norm`: The L2-norm to clip to, for all variables specified. -* `use_locking`: If `True` use locks for clip update operations. -* `colocate_clip_ops_with_vars`: If `True`, try colocating the clip norm - ops with the corresponding variable. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "VariableClipping". - - - -#### Other Methods -- - - - -#### `tf.contrib.opt.VariableClippingOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#VariableClippingOptimizer.apply_gradients} - - - - -- - - - -#### `tf.contrib.opt.VariableClippingOptimizer.compute_gradients(*args, **kwargs)` {#VariableClippingOptimizer.compute_gradients} - - - - -- - - - -#### `tf.contrib.opt.VariableClippingOptimizer.get_slot(*args, **kwargs)` {#VariableClippingOptimizer.get_slot} - - - - -- - - - -#### `tf.contrib.opt.VariableClippingOptimizer.get_slot_names(*args, **kwargs)` {#VariableClippingOptimizer.get_slot_names} - - - - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.rnn.md b/tensorflow/g3doc/api_docs/python/contrib.rnn.md deleted file mode 100644 index 6107639c95..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.rnn.md +++ /dev/null @@ -1,2203 +0,0 @@ - - -# RNN and Cells (contrib) -[TOC] - -RNN Cells and additional RNN operations. See @{$python/contrib.rnn} guide. - -- - - - -### `class tf.contrib.rnn.RNNCell` {#RNNCell} - -Abstract object representing an RNN cell. - -The definition of cell in this package differs from the definition used in the -literature. In the literature, cell refers to an object with a single scalar -output. The definition in this package refers to a horizontal array of such -units. - -An RNN cell, in the most abstract setting, is anything that has -a state and performs some operation that takes a matrix of inputs. -This operation results in an output matrix with `self.output_size` columns. -If `self.state_size` is an integer, this operation also results in a new -state matrix with `self.state_size` columns. If `self.state_size` is a -tuple of integers, then it results in a tuple of `len(state_size)` state -matrices, each with a column size corresponding to values in `state_size`. - -This module provides a number of basic commonly used RNN cells, such as -LSTM (Long Short Term Memory) or GRU (Gated Recurrent Unit), and a number -of operators that allow add dropouts, projections, or embeddings for inputs. -Constructing multi-layer cells is supported by the class `MultiRNNCell`, -or by calling the `rnn` ops several times. Every `RNNCell` must have the -properties below and implement `__call__` with the following signature. -- - - - -#### `tf.contrib.rnn.RNNCell.__call__(inputs, state, scope=None)` {#RNNCell.__call__} - -Run this RNN cell on inputs, starting from the given state. - -##### Args: - - -* `inputs`: `2-D` tensor with shape `[batch_size x input_size]`. -* `state`: if `self.state_size` is an integer, this should be a `2-D Tensor` - with shape `[batch_size x self.state_size]`. Otherwise, if - `self.state_size` is a tuple of integers, this should be a tuple - with shapes `[batch_size x s] for s in self.state_size`. -* `scope`: VariableScope for the created subgraph; defaults to class name. - -##### Returns: - - A pair containing: - - - Output: A `2-D` tensor with shape `[batch_size x self.output_size]`. - - New state: Either a single `2-D` tensor, or a tuple of tensors matching - the arity and shapes of `state`. - - -- - - - -#### `tf.contrib.rnn.RNNCell.output_size` {#RNNCell.output_size} - -Integer or TensorShape: size of outputs produced by this cell. - - -- - - - -#### `tf.contrib.rnn.RNNCell.state_size` {#RNNCell.state_size} - -size(s) of state(s) used by this cell. - -It can be represented by an Integer, a TensorShape or a tuple of Integers -or TensorShapes. - - -- - - - -#### `tf.contrib.rnn.RNNCell.zero_state(batch_size, dtype)` {#RNNCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.BasicRNNCell` {#BasicRNNCell} - -The most basic RNN cell. -- - - - -#### `tf.contrib.rnn.BasicRNNCell.__call__(inputs, state, scope=None)` {#BasicRNNCell.__call__} - -Most basic RNN: output = new_state = act(W * input + U * state + B). - - -- - - - -#### `tf.contrib.rnn.BasicRNNCell.__init__(num_units, input_size=None, activation=tanh)` {#BasicRNNCell.__init__} - - - - -- - - - -#### `tf.contrib.rnn.BasicRNNCell.output_size` {#BasicRNNCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.BasicRNNCell.state_size` {#BasicRNNCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.BasicRNNCell.zero_state(batch_size, dtype)` {#BasicRNNCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.BasicLSTMCell` {#BasicLSTMCell} - -Basic LSTM recurrent network cell. - -The implementation is based on: http://arxiv.org/abs/1409.2329. - -We add forget_bias (default: 1) to the biases of the forget gate in order to -reduce the scale of forgetting in the beginning of the training. - -It does not allow cell clipping, a projection layer, and does not -use peep-hole connections: it is the basic baseline. - -For advanced models, please use the full LSTMCell that follows. -- - - - -#### `tf.contrib.rnn.BasicLSTMCell.__call__(inputs, state, scope=None)` {#BasicLSTMCell.__call__} - -Long short-term memory cell (LSTM). - - -- - - - -#### `tf.contrib.rnn.BasicLSTMCell.__init__(num_units, forget_bias=1.0, input_size=None, state_is_tuple=True, activation=tanh)` {#BasicLSTMCell.__init__} - -Initialize the basic LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell. -* `forget_bias`: float, The bias added to forget gates (see above). -* `input_size`: Deprecated and unused. -* `state_is_tuple`: If True, accepted and returned states are 2-tuples of - the `c_state` and `m_state`. If False, they are concatenated - along the column axis. The latter behavior will soon be deprecated. -* `activation`: Activation function of the inner states. - - -- - - - -#### `tf.contrib.rnn.BasicLSTMCell.output_size` {#BasicLSTMCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.BasicLSTMCell.state_size` {#BasicLSTMCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.BasicLSTMCell.zero_state(batch_size, dtype)` {#BasicLSTMCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.GRUCell` {#GRUCell} - -Gated Recurrent Unit cell (cf. http://arxiv.org/abs/1406.1078). -- - - - -#### `tf.contrib.rnn.GRUCell.__call__(inputs, state, scope=None)` {#GRUCell.__call__} - -Gated recurrent unit (GRU) with nunits cells. - - -- - - - -#### `tf.contrib.rnn.GRUCell.__init__(num_units, input_size=None, activation=tanh)` {#GRUCell.__init__} - - - - -- - - - -#### `tf.contrib.rnn.GRUCell.output_size` {#GRUCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.GRUCell.state_size` {#GRUCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.GRUCell.zero_state(batch_size, dtype)` {#GRUCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.LSTMCell` {#LSTMCell} - -Long short-term memory unit (LSTM) recurrent network cell. - -The default non-peephole implementation is based on: - - http://deeplearning.cs.cmu.edu/pdfs/Hochreiter97_lstm.pdf - -S. Hochreiter and J. Schmidhuber. -"Long Short-Term Memory". Neural Computation, 9(8):1735-1780, 1997. - -The peephole implementation is based on: - - https://research.google.com/pubs/archive/43905.pdf - -Hasim Sak, Andrew Senior, and Francoise Beaufays. -"Long short-term memory recurrent neural network architectures for - large scale acoustic modeling." INTERSPEECH, 2014. - -The class uses optional peep-hole connections, optional cell clipping, and -an optional projection layer. -- - - - -#### `tf.contrib.rnn.LSTMCell.__call__(inputs, state, scope=None)` {#LSTMCell.__call__} - -Run one step of LSTM. - -##### Args: - - -* `inputs`: input Tensor, 2D, batch x num_units. -* `state`: if `state_is_tuple` is False, this must be a state Tensor, - `2-D, batch x state_size`. If `state_is_tuple` is True, this must be a - tuple of state Tensors, both `2-D`, with column sizes `c_state` and - `m_state`. -* `scope`: VariableScope for the created subgraph; defaults to "lstm_cell". - -##### Returns: - - A tuple containing: - - - A `2-D, [batch x output_dim]`, Tensor representing the output of the - LSTM after reading `inputs` when previous state was `state`. - Here output_dim is: - num_proj if num_proj was set, - num_units otherwise. - - Tensor(s) representing the new state of LSTM after reading `inputs` when - the previous state was `state`. Same type and shape(s) as `state`. - -##### Raises: - - -* `ValueError`: If input size cannot be inferred from inputs via - static shape inference. - - -- - - - -#### `tf.contrib.rnn.LSTMCell.__init__(num_units, input_size=None, use_peepholes=False, cell_clip=None, initializer=None, num_proj=None, proj_clip=None, num_unit_shards=None, num_proj_shards=None, forget_bias=1.0, state_is_tuple=True, activation=tanh)` {#LSTMCell.__init__} - -Initialize the parameters for an LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell -* `input_size`: Deprecated and unused. -* `use_peepholes`: bool, set True to enable diagonal/peephole connections. -* `cell_clip`: (optional) A float value, if provided the cell state is clipped - by this value prior to the cell output activation. -* `initializer`: (optional) The initializer to use for the weight and - projection matrices. -* `num_proj`: (optional) int, The output dimensionality for the projection - matrices. If None, no projection is performed. -* `proj_clip`: (optional) A float value. If `num_proj > 0` and `proj_clip` is - provided, then the projected values are clipped elementwise to within - `[-proj_clip, proj_clip]`. -* `num_unit_shards`: Deprecated, will be removed by Jan. 2017. - Use a variable_scope partitioner instead. -* `num_proj_shards`: Deprecated, will be removed by Jan. 2017. - Use a variable_scope partitioner instead. -* `forget_bias`: Biases of the forget gate are initialized by default to 1 - in order to reduce the scale of forgetting at the beginning of - the training. -* `state_is_tuple`: If True, accepted and returned states are 2-tuples of - the `c_state` and `m_state`. If False, they are concatenated - along the column axis. This latter behavior will soon be deprecated. -* `activation`: Activation function of the inner states. - - -- - - - -#### `tf.contrib.rnn.LSTMCell.output_size` {#LSTMCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.LSTMCell.state_size` {#LSTMCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.LSTMCell.zero_state(batch_size, dtype)` {#LSTMCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.LayerNormBasicLSTMCell` {#LayerNormBasicLSTMCell} - -LSTM unit with layer normalization and recurrent dropout. - -This class adds layer normalization and recurrent dropout to a -basic LSTM unit. Layer normalization implementation is based on: - - https://arxiv.org/abs/1607.06450. - -"Layer Normalization" -Jimmy Lei Ba, Jamie Ryan Kiros, Geoffrey E. Hinton - -and is applied before the internal nonlinearities. -Recurrent dropout is base on: - - https://arxiv.org/abs/1603.05118 - -"Recurrent Dropout without Memory Loss" -Stanislau Semeniuta, Aliaksei Severyn, Erhardt Barth. -- - - - -#### `tf.contrib.rnn.LayerNormBasicLSTMCell.__call__(inputs, state, scope=None)` {#LayerNormBasicLSTMCell.__call__} - -LSTM cell with layer normalization and recurrent dropout. - - -- - - - -#### `tf.contrib.rnn.LayerNormBasicLSTMCell.__init__(num_units, forget_bias=1.0, input_size=None, activation=tanh, layer_norm=True, norm_gain=1.0, norm_shift=0.0, dropout_keep_prob=1.0, dropout_prob_seed=None)` {#LayerNormBasicLSTMCell.__init__} - -Initializes the basic LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell. -* `forget_bias`: float, The bias added to forget gates (see above). -* `input_size`: Deprecated and unused. -* `activation`: Activation function of the inner states. -* `layer_norm`: If `True`, layer normalization will be applied. -* `norm_gain`: float, The layer normalization gain initial value. If - `layer_norm` has been set to `False`, this argument will be ignored. -* `norm_shift`: float, The layer normalization shift initial value. If - `layer_norm` has been set to `False`, this argument will be ignored. -* `dropout_keep_prob`: unit Tensor or float between 0 and 1 representing the - recurrent dropout probability value. If float and 1.0, no dropout will - be applied. -* `dropout_prob_seed`: (optional) integer, the randomness seed. - - -- - - - -#### `tf.contrib.rnn.LayerNormBasicLSTMCell.output_size` {#LayerNormBasicLSTMCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.LayerNormBasicLSTMCell.state_size` {#LayerNormBasicLSTMCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.LayerNormBasicLSTMCell.zero_state(batch_size, dtype)` {#LayerNormBasicLSTMCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.LSTMStateTuple` {#LSTMStateTuple} - -Tuple used by LSTM Cells for `state_size`, `zero_state`, and output state. - -Stores two elements: `(c, h)`, in that order. - -Only used when `state_is_tuple=True`. -- - - - -#### `tf.contrib.rnn.LSTMStateTuple.__getnewargs__()` {#LSTMStateTuple.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.contrib.rnn.LSTMStateTuple.__getstate__()` {#LSTMStateTuple.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.contrib.rnn.LSTMStateTuple.__new__(_cls, c, h)` {#LSTMStateTuple.__new__} - -Create new instance of LSTMStateTuple(c, h) - - -- - - - -#### `tf.contrib.rnn.LSTMStateTuple.__repr__()` {#LSTMStateTuple.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.contrib.rnn.LSTMStateTuple.c` {#LSTMStateTuple.c} - -Alias for field number 0 - - -- - - - -#### `tf.contrib.rnn.LSTMStateTuple.dtype` {#LSTMStateTuple.dtype} - - - - -- - - - -#### `tf.contrib.rnn.LSTMStateTuple.h` {#LSTMStateTuple.h} - -Alias for field number 1 - - - -- - - - -### `class tf.contrib.rnn.MultiRNNCell` {#MultiRNNCell} - -RNN cell composed sequentially of multiple simple cells. -- - - - -#### `tf.contrib.rnn.MultiRNNCell.__call__(inputs, state, scope=None)` {#MultiRNNCell.__call__} - -Run this multi-layer cell on inputs, starting from state. - - -- - - - -#### `tf.contrib.rnn.MultiRNNCell.__init__(cells, state_is_tuple=True)` {#MultiRNNCell.__init__} - -Create a RNN cell composed sequentially of a number of RNNCells. - -##### Args: - - -* `cells`: list of RNNCells that will be composed in this order. -* `state_is_tuple`: If True, accepted and returned states are n-tuples, where - `n = len(cells)`. If False, the states are all - concatenated along the column axis. This latter behavior will soon be - deprecated. - -##### Raises: - - -* `ValueError`: if cells is empty (not allowed), or at least one of the cells - returns a state tuple but the flag `state_is_tuple` is `False`. - - -- - - - -#### `tf.contrib.rnn.MultiRNNCell.output_size` {#MultiRNNCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.MultiRNNCell.state_size` {#MultiRNNCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.MultiRNNCell.zero_state(batch_size, dtype)` {#MultiRNNCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.LSTMBlockWrapper` {#LSTMBlockWrapper} - -This is a helper class that provides housekeeping for LSTM cells. - -This may be useful for alternative LSTM and similar type of cells. -The subclasses must implement `_call_cell` method and `num_units` property. -- - - - -#### `tf.contrib.rnn.LSTMBlockWrapper.__call__(inputs, initial_state=None, dtype=None, sequence_length=None, scope=None)` {#LSTMBlockWrapper.__call__} - -Run this LSTM on inputs, starting from the given state. - -##### Args: - - -* `inputs`: `3-D` tensor with shape `[time_len, batch_size, input_size]` - or a list of `time_len` tensors of shape `[batch_size, input_size]`. -* `initial_state`: a tuple `(initial_cell_state, initial_output)` with tensors - of shape `[batch_size, self._num_units]`. If this is not provided, the - cell is expected to create a zero initial state of type `dtype`. -* `dtype`: The data type for the initial state and expected output. Required - if `initial_state` is not provided or RNN state has a heterogeneous - dtype. -* `sequence_length`: Specifies the length of each sequence in inputs. An - `int32` or `int64` vector (tensor) size `[batch_size]`, values in `[0, - time_len).` - Defaults to `time_len` for each element. -* `scope`: `VariableScope` for the created subgraph; defaults to class name. - -##### Returns: - - A pair containing: - - - Output: A `3-D` tensor of shape `[time_len, batch_size, output_size]` - or a list of time_len tensors of shape `[batch_size, output_size]`, - to match the type of the `inputs`. - - Final state: a tuple `(cell_state, output)` matching `initial_state`. - -##### Raises: - - -* `ValueError`: in case of shape mismatches - - -- - - - -#### `tf.contrib.rnn.LSTMBlockWrapper.num_units` {#LSTMBlockWrapper.num_units} - -Number of units in this cell (output dimension). - - - -- - - - -### `class tf.contrib.rnn.DropoutWrapper` {#DropoutWrapper} - -Operator adding dropout to inputs and outputs of the given cell. -- - - - -#### `tf.contrib.rnn.DropoutWrapper.__call__(inputs, state, scope=None)` {#DropoutWrapper.__call__} - -Run the cell with the declared dropouts. - - -- - - - -#### `tf.contrib.rnn.DropoutWrapper.__init__(cell, input_keep_prob=1.0, output_keep_prob=1.0, seed=None)` {#DropoutWrapper.__init__} - -Create a cell with added input and/or output dropout. - -Dropout is never used on the state. - -##### Args: - - -* `cell`: an RNNCell, a projection to output_size is added to it. -* `input_keep_prob`: unit Tensor or float between 0 and 1, input keep - probability; if it is float and 1, no input dropout will be added. -* `output_keep_prob`: unit Tensor or float between 0 and 1, output keep - probability; if it is float and 1, no output dropout will be added. -* `seed`: (optional) integer, the randomness seed. - -##### Raises: - - -* `TypeError`: if cell is not an RNNCell. -* `ValueError`: if keep_prob is not between 0 and 1. - - -- - - - -#### `tf.contrib.rnn.DropoutWrapper.output_size` {#DropoutWrapper.output_size} - - - - -- - - - -#### `tf.contrib.rnn.DropoutWrapper.state_size` {#DropoutWrapper.state_size} - - - - -- - - - -#### `tf.contrib.rnn.DropoutWrapper.zero_state(batch_size, dtype)` {#DropoutWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.EmbeddingWrapper` {#EmbeddingWrapper} - -Operator adding input embedding to the given cell. - -Note: in many cases it may be more efficient to not use this wrapper, -but instead concatenate the whole sequence of your inputs in time, -do the embedding on this batch-concatenated sequence, then split it and -feed into your RNN. -- - - - -#### `tf.contrib.rnn.EmbeddingWrapper.__call__(inputs, state, scope=None)` {#EmbeddingWrapper.__call__} - -Run the cell on embedded inputs. - - -- - - - -#### `tf.contrib.rnn.EmbeddingWrapper.__init__(cell, embedding_classes, embedding_size, initializer=None)` {#EmbeddingWrapper.__init__} - -Create a cell with an added input embedding. - -##### Args: - - -* `cell`: an RNNCell, an embedding will be put before its inputs. -* `embedding_classes`: integer, how many symbols will be embedded. -* `embedding_size`: integer, the size of the vectors we embed into. -* `initializer`: an initializer to use when creating the embedding; - if None, the initializer from variable scope or a default one is used. - -##### Raises: - - -* `TypeError`: if cell is not an RNNCell. -* `ValueError`: if embedding_classes is not positive. - - -- - - - -#### `tf.contrib.rnn.EmbeddingWrapper.output_size` {#EmbeddingWrapper.output_size} - - - - -- - - - -#### `tf.contrib.rnn.EmbeddingWrapper.state_size` {#EmbeddingWrapper.state_size} - - - - -- - - - -#### `tf.contrib.rnn.EmbeddingWrapper.zero_state(batch_size, dtype)` {#EmbeddingWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.InputProjectionWrapper` {#InputProjectionWrapper} - -Operator adding an input projection to the given cell. - -Note: in many cases it may be more efficient to not use this wrapper, -but instead concatenate the whole sequence of your inputs in time, -do the projection on this batch-concatenated sequence, then split it. -- - - - -#### `tf.contrib.rnn.InputProjectionWrapper.__call__(inputs, state, scope=None)` {#InputProjectionWrapper.__call__} - -Run the input projection and then the cell. - - -- - - - -#### `tf.contrib.rnn.InputProjectionWrapper.__init__(cell, num_proj, input_size=None)` {#InputProjectionWrapper.__init__} - -Create a cell with input projection. - -##### Args: - - -* `cell`: an RNNCell, a projection of inputs is added before it. -* `num_proj`: Python integer. The dimension to project to. -* `input_size`: Deprecated and unused. - -##### Raises: - - -* `TypeError`: if cell is not an RNNCell. - - -- - - - -#### `tf.contrib.rnn.InputProjectionWrapper.output_size` {#InputProjectionWrapper.output_size} - - - - -- - - - -#### `tf.contrib.rnn.InputProjectionWrapper.state_size` {#InputProjectionWrapper.state_size} - - - - -- - - - -#### `tf.contrib.rnn.InputProjectionWrapper.zero_state(batch_size, dtype)` {#InputProjectionWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.OutputProjectionWrapper` {#OutputProjectionWrapper} - -Operator adding an output projection to the given cell. - -Note: in many cases it may be more efficient to not use this wrapper, -but instead concatenate the whole sequence of your outputs in time, -do the projection on this batch-concatenated sequence, then split it -if needed or directly feed into a softmax. -- - - - -#### `tf.contrib.rnn.OutputProjectionWrapper.__call__(inputs, state, scope=None)` {#OutputProjectionWrapper.__call__} - -Run the cell and output projection on inputs, starting from state. - - -- - - - -#### `tf.contrib.rnn.OutputProjectionWrapper.__init__(cell, output_size)` {#OutputProjectionWrapper.__init__} - -Create a cell with output projection. - -##### Args: - - -* `cell`: an RNNCell, a projection to output_size is added to it. -* `output_size`: integer, the size of the output after projection. - -##### Raises: - - -* `TypeError`: if cell is not an RNNCell. -* `ValueError`: if output_size is not positive. - - -- - - - -#### `tf.contrib.rnn.OutputProjectionWrapper.output_size` {#OutputProjectionWrapper.output_size} - - - - -- - - - -#### `tf.contrib.rnn.OutputProjectionWrapper.state_size` {#OutputProjectionWrapper.state_size} - - - - -- - - - -#### `tf.contrib.rnn.OutputProjectionWrapper.zero_state(batch_size, dtype)` {#OutputProjectionWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.DeviceWrapper` {#DeviceWrapper} - -Operator that ensures an RNNCell runs on a particular device. -- - - - -#### `tf.contrib.rnn.DeviceWrapper.__call__(inputs, state, scope=None)` {#DeviceWrapper.__call__} - -Run the cell on specified device. - - -- - - - -#### `tf.contrib.rnn.DeviceWrapper.__init__(cell, device)` {#DeviceWrapper.__init__} - -Construct a `DeviceWrapper` for `cell` with device `device`. - -Ensures the wrapped `cell` is called with `tf.device(device)`. - -##### Args: - - -* `cell`: An instance of `RNNCell`. -* `device`: A device string or function, for passing to `tf.device`. - - -- - - - -#### `tf.contrib.rnn.DeviceWrapper.output_size` {#DeviceWrapper.output_size} - -Integer or TensorShape: size of outputs produced by this cell. - - -- - - - -#### `tf.contrib.rnn.DeviceWrapper.state_size` {#DeviceWrapper.state_size} - -size(s) of state(s) used by this cell. - -It can be represented by an Integer, a TensorShape or a tuple of Integers -or TensorShapes. - - -- - - - -#### `tf.contrib.rnn.DeviceWrapper.zero_state(batch_size, dtype)` {#DeviceWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.ResidualWrapper` {#ResidualWrapper} - -RNNCell wrapper that ensures cell inputs are added to the outputs. -- - - - -#### `tf.contrib.rnn.ResidualWrapper.__call__(inputs, state, scope=None)` {#ResidualWrapper.__call__} - -Run the cell and add its inputs to its outputs. - -##### Args: - - -* `inputs`: cell inputs. -* `state`: cell state. -* `scope`: optional cell scope. - -##### Returns: - - Tuple of cell outputs and new state. - -##### Raises: - - -* `TypeError`: If cell inputs and outputs have different structure (type). -* `ValueError`: If cell inputs and outputs have different structure (value). - - -- - - - -#### `tf.contrib.rnn.ResidualWrapper.__init__(cell)` {#ResidualWrapper.__init__} - -Constructs a `ResidualWrapper` for `cell`. - -##### Args: - - -* `cell`: An instance of `RNNCell`. - - -- - - - -#### `tf.contrib.rnn.ResidualWrapper.output_size` {#ResidualWrapper.output_size} - - - - -- - - - -#### `tf.contrib.rnn.ResidualWrapper.state_size` {#ResidualWrapper.state_size} - - - - -- - - - -#### `tf.contrib.rnn.ResidualWrapper.zero_state(batch_size, dtype)` {#ResidualWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.LSTMBlockCell` {#LSTMBlockCell} - -Basic LSTM recurrent network cell. - -The implementation is based on: http://arxiv.org/abs/1409.2329. - -We add `forget_bias` (default: 1) to the biases of the forget gate in order to -reduce the scale of forgetting in the beginning of the training. - -Unlike `core_rnn_cell.LSTMCell`, this is a monolithic op and should be much -faster. The weight and bias matrixes should be compatible as long as the -variable scope matches. -- - - - -#### `tf.contrib.rnn.LSTMBlockCell.__call__(x, states_prev, scope=None)` {#LSTMBlockCell.__call__} - -Long short-term memory cell (LSTM). - - -- - - - -#### `tf.contrib.rnn.LSTMBlockCell.__init__(num_units, forget_bias=1.0, use_peephole=False)` {#LSTMBlockCell.__init__} - -Initialize the basic LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell. -* `forget_bias`: float, The bias added to forget gates (see above). -* `use_peephole`: Whether to use peephole connections or not. - - -- - - - -#### `tf.contrib.rnn.LSTMBlockCell.output_size` {#LSTMBlockCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.LSTMBlockCell.state_size` {#LSTMBlockCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.LSTMBlockCell.zero_state(batch_size, dtype)` {#LSTMBlockCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.GRUBlockCell` {#GRUBlockCell} - -Block GRU cell implementation. - -The implementation is based on: http://arxiv.org/abs/1406.1078 -Computes the LSTM cell forward propagation for 1 time step. - -This kernel op implements the following mathematical equations: - -Biases are initialized with: - -* `b_ru` - constant_initializer(1.0) -* `b_c` - constant_initializer(0.0) - -``` -x_h_prev = [x, h_prev] - -[r_bar u_bar] = x_h_prev * w_ru + b_ru - -r = sigmoid(r_bar) -u = sigmoid(u_bar) - -h_prevr = h_prev \circ r - -x_h_prevr = [x h_prevr] - -c_bar = x_h_prevr * w_c + b_c -c = tanh(c_bar) - -h = (1-u) \circ c + u \circ h_prev -``` -- - - - -#### `tf.contrib.rnn.GRUBlockCell.__call__(x, h_prev, scope=None)` {#GRUBlockCell.__call__} - -GRU cell. - - -- - - - -#### `tf.contrib.rnn.GRUBlockCell.__init__(cell_size)` {#GRUBlockCell.__init__} - -Initialize the Block GRU cell. - -##### Args: - - -* `cell_size`: int, GRU cell size. - - -- - - - -#### `tf.contrib.rnn.GRUBlockCell.output_size` {#GRUBlockCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.GRUBlockCell.state_size` {#GRUBlockCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.GRUBlockCell.zero_state(batch_size, dtype)` {#GRUBlockCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.FusedRNNCell` {#FusedRNNCell} - -Abstract object representing a fused RNN cell. - -A fused RNN cell represents the entire RNN expanded over the time -dimension. In effect, this represents an entire recurrent network. - -Unlike RNN cells which are subclasses of `rnn_cell.RNNCell`, a `FusedRNNCell` -operates on the entire time sequence at once, by putting the loop over time -inside the cell. This usually leads to much more efficient, but more complex -and less flexible implementations. - -Every `FusedRNNCell` must implement `__call__` with the following signature. -- - - - -#### `tf.contrib.rnn.FusedRNNCell.__call__(inputs, initial_state=None, dtype=None, sequence_length=None, scope=None)` {#FusedRNNCell.__call__} - -Run this fused RNN on inputs, starting from the given state. - -##### Args: - - -* `inputs`: `3-D` tensor with shape `[time_len x batch_size x input_size]` - or a list of `time_len` tensors of shape `[batch_size x input_size]`. -* `initial_state`: either a tensor with shape `[batch_size x state_size]` - or a tuple with shapes `[batch_size x s] for s in state_size`, if the - cell takes tuples. If this is not provided, the cell is expected to - create a zero initial state of type `dtype`. -* `dtype`: The data type for the initial state and expected output. Required - if `initial_state` is not provided or RNN state has a heterogeneous - dtype. -* `sequence_length`: Specifies the length of each sequence in inputs. An - `int32` or `int64` vector (tensor) size `[batch_size]`, values in `[0, - time_len)`. - Defaults to `time_len` for each element. -* `scope`: `VariableScope` or `string` for the created subgraph; defaults to - class name. - -##### Returns: - - A pair containing: - - - Output: A `3-D` tensor of shape `[time_len x batch_size x output_size]` - or a list of `time_len` tensors of shape `[batch_size x output_size]`, - to match the type of the `inputs`. - - Final state: Either a single `2-D` tensor, or a tuple of tensors - matching the arity and shapes of `initial_state`. - - - -- - - - -### `class tf.contrib.rnn.FusedRNNCellAdaptor` {#FusedRNNCellAdaptor} - -This is an adaptor for RNNCell classes to be used with `FusedRNNCell`. -- - - - -#### `tf.contrib.rnn.FusedRNNCellAdaptor.__call__(inputs, initial_state=None, dtype=None, sequence_length=None, scope=None)` {#FusedRNNCellAdaptor.__call__} - - - - -- - - - -#### `tf.contrib.rnn.FusedRNNCellAdaptor.__init__(cell, use_dynamic_rnn=False)` {#FusedRNNCellAdaptor.__init__} - -Initialize the adaptor. - -##### Args: - - -* `cell`: an instance of a subclass of a `rnn_cell.RNNCell`. -* `use_dynamic_rnn`: whether to use dynamic (or static) RNN. - - - -- - - - -### `class tf.contrib.rnn.TimeReversedFusedRNN` {#TimeReversedFusedRNN} - -This is an adaptor to time-reverse a FusedRNNCell. - -For example, - -```python -cell = tf.contrib.rnn.BasicRNNCell(10) -fw_lstm = tf.contrib.rnn.FusedRNNCellAdaptor(cell, use_dynamic_rnn=True) -bw_lstm = tf.contrib.rnn.TimeReversedFusedRNN(fw_lstm) -fw_out, fw_state = fw_lstm(inputs) -bw_out, bw_state = bw_lstm(inputs) -``` -- - - - -#### `tf.contrib.rnn.TimeReversedFusedRNN.__call__(inputs, initial_state=None, dtype=None, sequence_length=None, scope=None)` {#TimeReversedFusedRNN.__call__} - - - - -- - - - -#### `tf.contrib.rnn.TimeReversedFusedRNN.__init__(cell)` {#TimeReversedFusedRNN.__init__} - - - - - -- - - - -### `class tf.contrib.rnn.LSTMBlockFusedCell` {#LSTMBlockFusedCell} - -FusedRNNCell implementation of LSTM. - -This is an extremely efficient LSTM implementation, that uses a single TF op -for the entire LSTM. It should be both faster and more memory-efficient than -LSTMBlockCell defined above. - -The implementation is based on: http://arxiv.org/abs/1409.2329. - -We add forget_bias (default: 1) to the biases of the forget gate in order to -reduce the scale of forgetting in the beginning of the training. - -The variable naming is consistent with `core_rnn_cell.LSTMCell`. -- - - - -#### `tf.contrib.rnn.LSTMBlockFusedCell.__call__(inputs, initial_state=None, dtype=None, sequence_length=None, scope=None)` {#LSTMBlockFusedCell.__call__} - -Run this LSTM on inputs, starting from the given state. - -##### Args: - - -* `inputs`: `3-D` tensor with shape `[time_len, batch_size, input_size]` - or a list of `time_len` tensors of shape `[batch_size, input_size]`. -* `initial_state`: a tuple `(initial_cell_state, initial_output)` with tensors - of shape `[batch_size, self._num_units]`. If this is not provided, the - cell is expected to create a zero initial state of type `dtype`. -* `dtype`: The data type for the initial state and expected output. Required - if `initial_state` is not provided or RNN state has a heterogeneous - dtype. -* `sequence_length`: Specifies the length of each sequence in inputs. An - `int32` or `int64` vector (tensor) size `[batch_size]`, values in `[0, - time_len).` - Defaults to `time_len` for each element. -* `scope`: `VariableScope` for the created subgraph; defaults to class name. - -##### Returns: - - A pair containing: - - - Output: A `3-D` tensor of shape `[time_len, batch_size, output_size]` - or a list of time_len tensors of shape `[batch_size, output_size]`, - to match the type of the `inputs`. - - Final state: a tuple `(cell_state, output)` matching `initial_state`. - -##### Raises: - - -* `ValueError`: in case of shape mismatches - - -- - - - -#### `tf.contrib.rnn.LSTMBlockFusedCell.__init__(num_units, forget_bias=1.0, cell_clip=None, use_peephole=False)` {#LSTMBlockFusedCell.__init__} - -Initialize the LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell. -* `forget_bias`: float, The bias added to forget gates (see above). -* `cell_clip`: clip the cell to this value. Defaults to `3`. -* `use_peephole`: Whether to use peephole connections or not. - - -- - - - -#### `tf.contrib.rnn.LSTMBlockFusedCell.num_units` {#LSTMBlockFusedCell.num_units} - -Number of units in this cell (output dimension). - - - -- - - - -### `class tf.contrib.rnn.CoupledInputForgetGateLSTMCell` {#CoupledInputForgetGateLSTMCell} - -Long short-term memory unit (LSTM) recurrent network cell. - -The default non-peephole implementation is based on: - - http://deeplearning.cs.cmu.edu/pdfs/Hochreiter97_lstm.pdf - -S. Hochreiter and J. Schmidhuber. -"Long Short-Term Memory". Neural Computation, 9(8):1735-1780, 1997. - -The peephole implementation is based on: - - https://research.google.com/pubs/archive/43905.pdf - -Hasim Sak, Andrew Senior, and Francoise Beaufays. -"Long short-term memory recurrent neural network architectures for - large scale acoustic modeling." INTERSPEECH, 2014. - -The coupling of input and forget gate is based on: - - http://arxiv.org/pdf/1503.04069.pdf - -Greff et al. "LSTM: A Search Space Odyssey" - -The class uses optional peep-hole connections, and an optional projection -layer. -- - - - -#### `tf.contrib.rnn.CoupledInputForgetGateLSTMCell.__call__(inputs, state, scope=None)` {#CoupledInputForgetGateLSTMCell.__call__} - -Run one step of LSTM. - -##### Args: - - -* `inputs`: input Tensor, 2D, batch x num_units. -* `state`: if `state_is_tuple` is False, this must be a state Tensor, - `2-D, batch x state_size`. If `state_is_tuple` is True, this must be a - tuple of state Tensors, both `2-D`, with column sizes `c_state` and - `m_state`. -* `scope`: VariableScope for the created subgraph; defaults to "LSTMCell". - -##### Returns: - - A tuple containing: - - A `2-D, [batch x output_dim]`, Tensor representing the output of the - LSTM after reading `inputs` when previous state was `state`. - Here output_dim is: - num_proj if num_proj was set, - num_units otherwise. - - Tensor(s) representing the new state of LSTM after reading `inputs` when - the previous state was `state`. Same type and shape(s) as `state`. - -##### Raises: - - -* `ValueError`: If input size cannot be inferred from inputs via - static shape inference. - - -- - - - -#### `tf.contrib.rnn.CoupledInputForgetGateLSTMCell.__init__(num_units, use_peepholes=False, initializer=None, num_proj=None, proj_clip=None, num_unit_shards=1, num_proj_shards=1, forget_bias=1.0, state_is_tuple=False, activation=tanh)` {#CoupledInputForgetGateLSTMCell.__init__} - -Initialize the parameters for an LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell -* `use_peepholes`: bool, set True to enable diagonal/peephole connections. -* `initializer`: (optional) The initializer to use for the weight and - projection matrices. -* `num_proj`: (optional) int, The output dimensionality for the projection - matrices. If None, no projection is performed. -* `proj_clip`: (optional) A float value. If `num_proj > 0` and `proj_clip` is - provided, then the projected values are clipped elementwise to within - `[-proj_clip, proj_clip]`. - -* `num_unit_shards`: How to split the weight matrix. If >1, the weight - matrix is stored across num_unit_shards. -* `num_proj_shards`: How to split the projection matrix. If >1, the - projection matrix is stored across num_proj_shards. -* `forget_bias`: Biases of the forget gate are initialized by default to 1 - in order to reduce the scale of forgetting at the beginning of - the training. -* `state_is_tuple`: If True, accepted and returned states are 2-tuples of - the `c_state` and `m_state`. By default (False), they are concatenated - along the column axis. This default behavior will soon be deprecated. -* `activation`: Activation function of the inner states. - - -- - - - -#### `tf.contrib.rnn.CoupledInputForgetGateLSTMCell.output_size` {#CoupledInputForgetGateLSTMCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.CoupledInputForgetGateLSTMCell.state_size` {#CoupledInputForgetGateLSTMCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.CoupledInputForgetGateLSTMCell.zero_state(batch_size, dtype)` {#CoupledInputForgetGateLSTMCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.TimeFreqLSTMCell` {#TimeFreqLSTMCell} - -Time-Frequency Long short-term memory unit (LSTM) recurrent network cell. - -This implementation is based on: - - Tara N. Sainath and Bo Li - "Modeling Time-Frequency Patterns with LSTM vs. Convolutional Architectures - for LVCSR Tasks." submitted to INTERSPEECH, 2016. - -It uses peep-hole connections and optional cell clipping. -- - - - -#### `tf.contrib.rnn.TimeFreqLSTMCell.__call__(inputs, state, scope=None)` {#TimeFreqLSTMCell.__call__} - -Run one step of LSTM. - -##### Args: - - -* `inputs`: input Tensor, 2D, batch x num_units. -* `state`: state Tensor, 2D, batch x state_size. -* `scope`: VariableScope for the created subgraph; defaults to - "TimeFreqLSTMCell". - -##### Returns: - - A tuple containing: - - A 2D, batch x output_dim, Tensor representing the output of the LSTM - after reading "inputs" when previous state was "state". - Here output_dim is num_units. - - A 2D, batch x state_size, Tensor representing the new state of LSTM - after reading "inputs" when previous state was "state". - -##### Raises: - - -* `ValueError`: if an input_size was specified and the provided inputs have - a different dimension. - - -- - - - -#### `tf.contrib.rnn.TimeFreqLSTMCell.__init__(num_units, use_peepholes=False, cell_clip=None, initializer=None, num_unit_shards=1, forget_bias=1.0, feature_size=None, frequency_skip=None)` {#TimeFreqLSTMCell.__init__} - -Initialize the parameters for an LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell -* `use_peepholes`: bool, set True to enable diagonal/peephole connections. -* `cell_clip`: (optional) A float value, if provided the cell state is clipped - by this value prior to the cell output activation. -* `initializer`: (optional) The initializer to use for the weight and - projection matrices. -* `num_unit_shards`: int, How to split the weight matrix. If >1, the weight - matrix is stored across num_unit_shards. -* `forget_bias`: float, Biases of the forget gate are initialized by default - to 1 in order to reduce the scale of forgetting at the beginning - of the training. -* `feature_size`: int, The size of the input feature the LSTM spans over. -* `frequency_skip`: int, The amount the LSTM filter is shifted by in - frequency. - - -- - - - -#### `tf.contrib.rnn.TimeFreqLSTMCell.output_size` {#TimeFreqLSTMCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.TimeFreqLSTMCell.state_size` {#TimeFreqLSTMCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.TimeFreqLSTMCell.zero_state(batch_size, dtype)` {#TimeFreqLSTMCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.GridLSTMCell` {#GridLSTMCell} - -Grid Long short-term memory unit (LSTM) recurrent network cell. - -The default is based on: - Nal Kalchbrenner, Ivo Danihelka and Alex Graves - "Grid Long Short-Term Memory," Proc. ICLR 2016. - http://arxiv.org/abs/1507.01526 - -When peephole connections are used, the implementation is based on: - Tara N. Sainath and Bo Li - "Modeling Time-Frequency Patterns with LSTM vs. Convolutional Architectures - for LVCSR Tasks." submitted to INTERSPEECH, 2016. - -The code uses optional peephole connections, shared_weights and cell clipping. -- - - - -#### `tf.contrib.rnn.GridLSTMCell.__call__(inputs, state, scope=None)` {#GridLSTMCell.__call__} - -Run one step of LSTM. - -##### Args: - - -* `inputs`: input Tensor, 2D, [batch, feature_size]. -* `state`: Tensor or tuple of Tensors, 2D, [batch, state_size], depends on the - flag self._state_is_tuple. -* `scope`: (optional) VariableScope for the created subgraph; if None, it - defaults to "GridLSTMCell". - -##### Returns: - - A tuple containing: - - A 2D, [batch, output_dim], Tensor representing the output of the LSTM - after reading "inputs" when previous state was "state". - Here output_dim is num_units. - - A 2D, [batch, state_size], Tensor representing the new state of LSTM - after reading "inputs" when previous state was "state". - -##### Raises: - - -* `ValueError`: if an input_size was specified and the provided inputs have - a different dimension. - - -- - - - -#### `tf.contrib.rnn.GridLSTMCell.__init__(num_units, use_peepholes=False, share_time_frequency_weights=False, cell_clip=None, initializer=None, num_unit_shards=1, forget_bias=1.0, feature_size=None, frequency_skip=None, num_frequency_blocks=None, start_freqindex_list=None, end_freqindex_list=None, couple_input_forget_gates=False, state_is_tuple=False)` {#GridLSTMCell.__init__} - -Initialize the parameters for an LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell -* `use_peepholes`: (optional) bool, default False. Set True to enable - diagonal/peephole connections. -* `share_time_frequency_weights`: (optional) bool, default False. Set True to - enable shared cell weights between time and frequency LSTMs. -* `cell_clip`: (optional) A float value, default None, if provided the cell - state is clipped by this value prior to the cell output activation. -* `initializer`: (optional) The initializer to use for the weight and - projection matrices, default None. -* `num_unit_shards`: (optional) int, defualt 1, How to split the weight - matrix. If > 1,the weight matrix is stored across num_unit_shards. -* `forget_bias`: (optional) float, default 1.0, The initial bias of the - forget gates, used to reduce the scale of forgetting at the beginning - of the training. -* `feature_size`: (optional) int, default None, The size of the input feature - the LSTM spans over. -* `frequency_skip`: (optional) int, default None, The amount the LSTM filter - is shifted by in frequency. -* `num_frequency_blocks`: [required] A list of frequency blocks needed to - cover the whole input feature splitting defined by start_freqindex_list - and end_freqindex_list. -* `start_freqindex_list`: [optional], list of ints, default None, The - starting frequency index for each frequency block. -* `end_freqindex_list`: [optional], list of ints, default None. The ending - frequency index for each frequency block. -* `couple_input_forget_gates`: (optional) bool, default False, Whether to - couple the input and forget gates, i.e. f_gate = 1.0 - i_gate, to reduce - model parameters and computation cost. -* `state_is_tuple`: If True, accepted and returned states are 2-tuples of - the `c_state` and `m_state`. By default (False), they are concatenated - along the column axis. This default behavior will soon be deprecated. - -##### Raises: - - -* `ValueError`: if the num_frequency_blocks list is not specified - - -- - - - -#### `tf.contrib.rnn.GridLSTMCell.output_size` {#GridLSTMCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.GridLSTMCell.state_size` {#GridLSTMCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.GridLSTMCell.state_tuple_type` {#GridLSTMCell.state_tuple_type} - - - - -- - - - -#### `tf.contrib.rnn.GridLSTMCell.zero_state(batch_size, dtype)` {#GridLSTMCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.AttentionCellWrapper` {#AttentionCellWrapper} - -Basic attention cell wrapper. - -Implementation based on https://arxiv.org/abs/1409.0473. -- - - - -#### `tf.contrib.rnn.AttentionCellWrapper.__call__(inputs, state, scope=None)` {#AttentionCellWrapper.__call__} - -Long short-term memory cell with attention (LSTMA). - - -- - - - -#### `tf.contrib.rnn.AttentionCellWrapper.__init__(cell, attn_length, attn_size=None, attn_vec_size=None, input_size=None, state_is_tuple=False)` {#AttentionCellWrapper.__init__} - -Create a cell with attention. - -##### Args: - - -* `cell`: an RNNCell, an attention is added to it. -* `attn_length`: integer, the size of an attention window. -* `attn_size`: integer, the size of an attention vector. Equal to - cell.output_size by default. -* `attn_vec_size`: integer, the number of convolutional features calculated - on attention state and a size of the hidden layer built from - base cell state. Equal attn_size to by default. -* `input_size`: integer, the size of a hidden linear layer, - built from inputs and attention. Derived from the input tensor - by default. -* `state_is_tuple`: If True, accepted and returned states are n-tuples, where - `n = len(cells)`. By default (False), the states are all - concatenated along the column axis. - -##### Raises: - - -* `TypeError`: if cell is not an RNNCell. -* `ValueError`: if cell returns a state tuple but the flag - `state_is_tuple` is `False` or if attn_length is zero or less. - - -- - - - -#### `tf.contrib.rnn.AttentionCellWrapper.output_size` {#AttentionCellWrapper.output_size} - - - - -- - - - -#### `tf.contrib.rnn.AttentionCellWrapper.state_size` {#AttentionCellWrapper.state_size} - - - - -- - - - -#### `tf.contrib.rnn.AttentionCellWrapper.zero_state(batch_size, dtype)` {#AttentionCellWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `class tf.contrib.rnn.CompiledWrapper` {#CompiledWrapper} - -Wraps step execution in an XLA JIT scope. -- - - - -#### `tf.contrib.rnn.CompiledWrapper.__call__(inputs, state, scope=None)` {#CompiledWrapper.__call__} - - - - -- - - - -#### `tf.contrib.rnn.CompiledWrapper.__init__(cell, compile_stateful=False)` {#CompiledWrapper.__init__} - -Create CompiledWrapper cell. - -##### Args: - - -* `cell`: Instance of `RNNCell`. -* `compile_stateful`: Whether to compile stateful ops like initializers - and random number generators (default: False). - - -- - - - -#### `tf.contrib.rnn.CompiledWrapper.output_size` {#CompiledWrapper.output_size} - - - - -- - - - -#### `tf.contrib.rnn.CompiledWrapper.state_size` {#CompiledWrapper.state_size} - - - - -- - - - -#### `tf.contrib.rnn.CompiledWrapper.zero_state(batch_size, dtype)` {#CompiledWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - - -- - - - -### `tf.contrib.rnn.static_rnn(cell, inputs, initial_state=None, dtype=None, sequence_length=None, scope=None)` {#static_rnn} - -Creates a recurrent neural network specified by RNNCell `cell`. - -The simplest form of RNN network generated is: - -```python - state = cell.zero_state(...) - outputs = [] - for input_ in inputs: - output, state = cell(input_, state) - outputs.append(output) - return (outputs, state) -``` -However, a few other options are available: - -An initial state can be provided. -If the sequence_length vector is provided, dynamic calculation is performed. -This method of calculation does not compute the RNN steps past the maximum -sequence length of the minibatch (thus saving computational time), -and properly propagates the state at an example's sequence length -to the final state output. - -The dynamic calculation performed is, at time `t` for batch row `b`, - -```python - (output, state)(b, t) = - (t >= sequence_length(b)) - ? (zeros(cell.output_size), states(b, sequence_length(b) - 1)) - : cell(input(b, t), state(b, t - 1)) -``` - -##### Args: - - -* `cell`: An instance of RNNCell. -* `inputs`: A length T list of inputs, each a `Tensor` of shape - `[batch_size, input_size]`, or a nested tuple of such elements. -* `initial_state`: (optional) An initial state for the RNN. - If `cell.state_size` is an integer, this must be - a `Tensor` of appropriate type and shape `[batch_size, cell.state_size]`. - If `cell.state_size` is a tuple, this should be a tuple of - tensors having shapes `[batch_size, s] for s in cell.state_size`. -* `dtype`: (optional) The data type for the initial state and expected output. - Required if initial_state is not provided or RNN state has a heterogeneous - dtype. -* `sequence_length`: Specifies the length of each sequence in inputs. - An int32 or int64 vector (tensor) size `[batch_size]`, values in `[0, T)`. -* `scope`: VariableScope for the created subgraph; defaults to "rnn". - -##### Returns: - - A pair (outputs, state) where: - - - outputs is a length T list of outputs (one for each input), or a nested - tuple of such elements. - - state is the final state - -##### Raises: - - -* `TypeError`: If `cell` is not an instance of RNNCell. -* `ValueError`: If `inputs` is `None` or an empty list, or if the input depth - (column size) cannot be inferred from inputs via shape inference. - - -- - - - -### `tf.contrib.rnn.static_state_saving_rnn(cell, inputs, state_saver, state_name, sequence_length=None, scope=None)` {#static_state_saving_rnn} - -RNN that accepts a state saver for time-truncated RNN calculation. - -##### Args: - - -* `cell`: An instance of `RNNCell`. -* `inputs`: A length T list of inputs, each a `Tensor` of shape - `[batch_size, input_size]`. -* `state_saver`: A state saver object with methods `state` and `save_state`. -* `state_name`: Python string or tuple of strings. The name to use with the - state_saver. If the cell returns tuples of states (i.e., - `cell.state_size` is a tuple) then `state_name` should be a tuple of - strings having the same length as `cell.state_size`. Otherwise it should - be a single string. -* `sequence_length`: (optional) An int32/int64 vector size [batch_size]. - See the documentation for rnn() for more details about sequence_length. -* `scope`: VariableScope for the created subgraph; defaults to "rnn". - -##### Returns: - - A pair (outputs, state) where: - outputs is a length T list of outputs (one for each input) - states is the final state - -##### Raises: - - -* `TypeError`: If `cell` is not an instance of RNNCell. -* `ValueError`: If `inputs` is `None` or an empty list, or if the arity and - type of `state_name` does not match that of `cell.state_size`. - - -- - - - -### `tf.contrib.rnn.static_bidirectional_rnn(cell_fw, cell_bw, inputs, initial_state_fw=None, initial_state_bw=None, dtype=None, sequence_length=None, scope=None)` {#static_bidirectional_rnn} - -Creates a bidirectional recurrent neural network. - -Similar to the unidirectional case above (rnn) but takes input and builds -independent forward and backward RNNs with the final forward and backward -outputs depth-concatenated, such that the output will have the format -[time][batch][cell_fw.output_size + cell_bw.output_size]. The input_size of -forward and backward cell must match. The initial state for both directions -is zero by default (but can be set optionally) and no intermediate states are -ever returned -- the network is fully unrolled for the given (passed in) -length(s) of the sequence(s) or completely unrolled if length(s) is not given. - -##### Args: - - -* `cell_fw`: An instance of RNNCell, to be used for forward direction. -* `cell_bw`: An instance of RNNCell, to be used for backward direction. -* `inputs`: A length T list of inputs, each a tensor of shape - [batch_size, input_size], or a nested tuple of such elements. -* `initial_state_fw`: (optional) An initial state for the forward RNN. - This must be a tensor of appropriate type and shape - `[batch_size, cell_fw.state_size]`. - If `cell_fw.state_size` is a tuple, this should be a tuple of - tensors having shapes `[batch_size, s] for s in cell_fw.state_size`. -* `initial_state_bw`: (optional) Same as for `initial_state_fw`, but using - the corresponding properties of `cell_bw`. -* `dtype`: (optional) The data type for the initial state. Required if - either of the initial states are not provided. -* `sequence_length`: (optional) An int32/int64 vector, size `[batch_size]`, - containing the actual lengths for each of the sequences. -* `scope`: VariableScope for the created subgraph; defaults to - "bidirectional_rnn" - -##### Returns: - - A tuple (outputs, output_state_fw, output_state_bw) where: - outputs is a length `T` list of outputs (one for each input), which - are depth-concatenated forward and backward outputs. - output_state_fw is the final state of the forward rnn. - output_state_bw is the final state of the backward rnn. - -##### Raises: - - -* `TypeError`: If `cell_fw` or `cell_bw` is not an instance of `RNNCell`. -* `ValueError`: If inputs is None or an empty list. - - -- - - - -### `tf.contrib.rnn.stack_bidirectional_dynamic_rnn(cells_fw, cells_bw, inputs, initial_states_fw=None, initial_states_bw=None, dtype=None, sequence_length=None, scope=None)` {#stack_bidirectional_dynamic_rnn} - -Creates a dynamic bidirectional recurrent neural network. - -Stacks several bidirectional rnn layers. The combined forward and backward -layer outputs are used as input of the next layer. tf.bidirectional_rnn -does not allow to share forward and backward information between layers. -The input_size of the first forward and backward cells must match. -The initial state for both directions is zero and no intermediate states -are returned. - -##### Args: - - -* `cells_fw`: List of instances of RNNCell, one per layer, - to be used for forward direction. -* `cells_bw`: List of instances of RNNCell, one per layer, - to be used for backward direction. -* `inputs`: A length T list of inputs, each a tensor of shape - [batch_size, input_size], or a nested tuple of such elements. -* `initial_states_fw`: (optional) A list of the initial states (one per layer) - for the forward RNN. - Each tensor must has an appropriate type and shape - `[batch_size, cell_fw.state_size]`. -* `initial_states_bw`: (optional) Same as for `initial_states_fw`, but using - the corresponding properties of `cells_bw`. -* `dtype`: (optional) The data type for the initial state. Required if - either of the initial states are not provided. -* `sequence_length`: (optional) An int32/int64 vector, size `[batch_size]`, - containing the actual lengths for each of the sequences. -* `scope`: VariableScope for the created subgraph; defaults to None. - -##### Returns: - - A tuple (outputs, output_state_fw, output_state_bw) where: - -* `outputs`: Output `Tensor` shaped: - `batch_size, max_time, layers_output]`. Where layers_output - are depth-concatenated forward and backward outputs. - output_states_fw is the final states, one tensor per layer, - of the forward rnn. - output_states_bw is the final states, one tensor per layer, - of the backward rnn. - -##### Raises: - - -* `TypeError`: If `cell_fw` or `cell_bw` is not an instance of `RNNCell`. -* `ValueError`: If inputs is `None`, not a list or an empty list. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.training.md b/tensorflow/g3doc/api_docs/python/contrib.training.md deleted file mode 100644 index 88ab5e6e23..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.training.md +++ /dev/null @@ -1,1057 +0,0 @@ - - -# Training (contrib) -[TOC] - -Training and input utilities. See @{$python/contrib.training} guide. - -- - - - -### `tf.contrib.training.batch_sequences_with_states(input_key, input_sequences, input_context, input_length, initial_states, num_unroll, batch_size, num_threads=3, capacity=1000, allow_small_batch=True, pad=True, make_keys_unique=False, make_keys_unique_seed=None, name=None)` {#batch_sequences_with_states} - -Creates batches of segments of sequential input. - -This method creates a `SequenceQueueingStateSaver` (SQSS) and adds it to -the queuerunners. It returns a `NextQueuedSequenceBatch`. - -It accepts one example at a time identified by a unique `input_key`. -`input_sequence` is a dict with values that are tensors with time as first -dimension. This time dimension must be the same across those tensors of an -example. It can vary across examples. Although it always has to be a multiple -of `num_unroll`. Hence, padding may be necessary and it is turned on by -default by `pad=True`. - -`input_length` is a Tensor scalar or an int recording the time dimension prior -to padding. It should be between 0 and the time dimension. One reason we want -to keep track of it is so that we can take it into consideration when -computing the loss. If `pad=True` then `input_length` can be `None` and will -be inferred. - -This methods segments `input_sequence` into segments of length `num_unroll`. -It batches input sequences from `batch_size` many examples. These mini-batches -are available through the `sequence` property of the output. Moreover, for -each entry in the batch we can access its original `input_key` in `key` and -its input length in `total_length`. `length` records within this segment how -many non-padded time steps there are. - -Static features of an example that do not vary across time can be part of the -`input_context`, a dict with Tensor values. This method copies the context for -each segment and makes it available in the `context` of the output. - -This method can maintain and update a state for each example. It accepts some -initial_states as a dict with Tensor values. The first mini-batch an example -is contained has initial_states as entry of the `state`. If save_state is -called then the next segment will have the updated entry of the `state`. -See `NextQueuedSequenceBatch` for a complete list of properties and methods. - -Example usage: - -```python -batch_size = 32 -num_unroll = 20 -num_enqueue_threads = 3 -lstm_size = 8 -cell = tf.contrib.rnn.BasicLSTMCell(num_units=lstm_size) - -key, sequences, context = my_parser(raw_data) -initial_state_values = tf.zeros((state_size,), dtype=tf.float32) -initial_states = {"lstm_state": initial_state_values} -batch = tf.batch_sequences_with_states( - input_key=key, - input_sequences=sequences, - input_context=context, - initial_states=initial_states, - num_unroll=num_unroll, - batch_size=batch_size, - num_threads=num_enqueue_threads, - capacity=batch_size * num_enqueue_threads * 2) - -inputs = batch.sequences["input"] -context_label = batch.context["label"] - -inputs_by_time = tf.split(value=inputs, num_or_size_splits=num_unroll, axis=1) -assert len(inputs_by_time) == num_unroll - -lstm_output, _ = tf.contrib.rnn.static_state_saving_rnn( - cell, - inputs_by_time, - state_saver=batch, - state_name="lstm_state") - -# Start a prefetcher in the background -sess = tf.Session() - -tf.train.start_queue_runners(sess=session) - -while True: - # Step through batches, perform training or inference... - session.run([lstm_output]) -``` - -##### Args: - - -* `input_key`: A string scalar `Tensor`, the **unique** key for the given - input example. This is used to keep track of the split minibatch elements - of this input. Batched keys of the current iteration are made - accessible via the `key` property. The shape of `input_key` (scalar) must - be fully specified. Consider setting `make_keys_unique` to True when - iterating over the same input multiple times. - - **Note**: if `make_keys_unique=False` then `input_key`s must be unique. - -* `input_sequences`: A dict mapping string names to `Tensor` values. The values - must all have matching first dimension, called `value_length`. They may - vary from input to input. The remainder of the shape (other than the first - dimension) must be fully specified. - The `SequenceQueueingStateSaver` will split these tensors along - this first dimension into minibatch elements of dimension `num_unrolled`. - Batched and segmented sequences of the current iteration are made - accessible via the `sequences` property. - - **Note**: if `pad=False`, then `value_length` must always be a multiple - of `num_unroll`. - -* `input_context`: A dict mapping string names to `Tensor` values. The values - are treated as "global" across all time splits of the given input example, - and will be copied across for all minibatch elements accordingly. - Batched and copied context of the current iteration are made - accessible via the `context` property. - - **Note**: All input_context values must have fully defined shapes. - -* `input_length`: None or an int32 scalar `Tensor`, the length of the sequence - prior to padding. If `input_length=None` and `pad=True` then the length - will be inferred and will be equal to `value_length`. If `pad=False` then - `input_length` cannot be `None`: `input_length` must be specified. Its - shape of `input_length` (scalar) must be fully specified. Its value may be - at most `value_length` for any given input (see above for the definition - of `value_length`). Batched and total lengths of the current iteration are - made accessible via the `length` and `total_length` properties. -* `initial_states`: A dict mapping string state names to multi-dimensional - values (e.g. constants or tensors). This input defines the set of - states that will be kept track of during computing iterations, and - which can be accessed via the `state` and `save_state` methods. - - **Note**: All initial_state values must have fully defined shapes. - -* `num_unroll`: Python integer, how many time steps to unroll at a time. - The input sequences of length k are then split into k / num_unroll many - segments. -* `batch_size`: int or int32 scalar `Tensor`, how large minibatches should - be when accessing the `state()` method and `context`, `sequences`, etc, - properties. -* `num_threads`: The int number of threads enqueuing input examples into a - queue. -* `capacity`: The max capacity of the queue in number of examples. Needs to be - at least `batch_size`. Defaults to 1000. When iterating over the same - input example multiple times reusing their keys the `capacity` must be - smaller than the number of examples. -* `allow_small_batch`: If true, the queue will return smaller batches when - there aren't enough input examples to fill a whole batch and the end of - the input has been reached. -* `pad`: If `True`, `input_sequences` will be padded to multiple of - `num_unroll`. In that case `input_length` may be `None` and is assumed to - be the length of first dimension of values in `input_sequences` - (i.e. `value_length`). -* `make_keys_unique`: Whether to append a random integer to the `input_key` in - an effort to make it unique. The seed can be set via - `make_keys_unique_seed`. -* `make_keys_unique_seed`: If `make_keys_unique=True` this fixes the seed with - which a random postfix is generated. -* `name`: An op name string (optional). - -##### Returns: - - A NextQueuedSequenceBatch with segmented and batched inputs and their - states. - -##### Raises: - - -* `TypeError`: if any of the inputs is not an expected type. -* `ValueError`: if any of the input values is inconsistent, e.g. if - not enough shape information is available from inputs to build - the state saver. - - -- - - - -### `class tf.contrib.training.NextQueuedSequenceBatch` {#NextQueuedSequenceBatch} - -NextQueuedSequenceBatch stores deferred SequenceQueueingStateSaver data. - -This class is instantiated by `SequenceQueueingStateSaver` and is accessible -via its `next_batch` property. -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.__init__(state_saver)` {#NextQueuedSequenceBatch.__init__} - - - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.batch_size` {#NextQueuedSequenceBatch.batch_size} - -The batch_size of the given batch. - -Usually, this is the batch_size requested when initializing the SQSS, but -if allow_small_batch=True this will become smaller when inputs are -exhausted. - -##### Returns: - - A scalar integer tensor, the batch_size - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.context` {#NextQueuedSequenceBatch.context} - -A dict mapping keys of `input_context` to batched context. - -##### Returns: - - A dict mapping keys of `input_context` to tensors. - If we had at input: - - ```python - context["name"].get_shape() == [d1, d2, ...] - ``` - - then for this property: - - ```python - context["name"].get_shape() == [batch_size, d1, d2, ...] - ``` - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.insertion_index` {#NextQueuedSequenceBatch.insertion_index} - -The insertion indices of the examples (when they were first added). - -These indices start with the value -2**63 and increase with every -call to the prefetch op. Each whole example gets its own insertion -index, and this is used to prioritize the example so that its truncated -segments appear in adjacent iterations, even if new examples are inserted -by the prefetch op between iterations. - -##### Returns: - - An int64 vector of length `batch_size`, the insertion indices. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.key` {#NextQueuedSequenceBatch.key} - -The key names of the given truncated unrolled examples. - -The format of the key is: - -```python -"%05d_of_%05d:%s" % (sequence, sequence_count, original_key) -``` - -where `original_key` is the unique key read in by the prefetcher. - -##### Returns: - - A string vector of length `batch_size`, the keys. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.length` {#NextQueuedSequenceBatch.length} - -The lengths of the given truncated unrolled examples. - -For initial iterations, for which `sequence * num_unroll < length`, -this number is `num_unroll`. For the remainder, -this number is between `0` and `num_unroll`. - -##### Returns: - - An integer vector of length `batch_size`, the lengths. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.next_key` {#NextQueuedSequenceBatch.next_key} - -The key names of the next (in iteration) truncated unrolled examples. - -The format of the key is: - -```python -"%05d_of_%05d:%s" % (sequence + 1, sequence_count, original_key) -``` - -if `sequence + 1 < sequence_count`, otherwise: - -```python -"STOP:%s" % original_key -``` - -where `original_key` is the unique key read in by the prefetcher. - -##### Returns: - - A string vector of length `batch_size`, the keys. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.save_state(state_name, value, name=None)` {#NextQueuedSequenceBatch.save_state} - -Returns an op to save the current batch of state `state_name`. - -##### Args: - - -* `state_name`: string, matches a key provided in `initial_states`. -* `value`: A `Tensor`. - Its type must match that of `initial_states[state_name].dtype`. - If we had at input: - - ```python - initial_states[state_name].get_shape() == [d1, d2, ...] - ``` - - then the shape of `value` must match: - - ```python - tf.shape(value) == [batch_size, d1, d2, ...] - ``` - - -* `name`: string (optional). The name scope for newly created ops. - -##### Returns: - - A control flow op that stores the new state of each entry into - the state saver. This op must be run for every iteration that - accesses data from the state saver (otherwise the state saver - will never progress through its states and run out of capacity). - -##### Raises: - - -* `KeyError`: if `state_name` does not match any of the initial states - declared in `initial_states`. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.sequence` {#NextQueuedSequenceBatch.sequence} - -An int32 vector, length `batch_size`: the sequence index of each entry. - -When an input is split up, the sequence values -``` -0, 1, ..., sequence_count - 1 -``` -are assigned to each split. - -##### Returns: - - An int32 vector `Tensor`. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.sequence_count` {#NextQueuedSequenceBatch.sequence_count} - -An int32 vector, length `batch_size`: the sequence count of each entry. - -When an input is split up, the number of splits is equal to: -`padded_length / num_unroll`. This is the sequence_count. - -##### Returns: - - An int32 vector `Tensor`. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.sequences` {#NextQueuedSequenceBatch.sequences} - -A dict mapping keys of `input_sequences` to split and rebatched data. - -##### Returns: - - A dict mapping keys of `input_sequences` to tensors. - If we had at input: - - ```python - sequences["name"].get_shape() == [None, d1, d2, ...] - ``` - - where `None` meant the sequence time was dynamic, then for this property: - - ```python - sequences["name"].get_shape() == [batch_size, num_unroll, d1, d2, ...]. - ``` - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.state(state_name)` {#NextQueuedSequenceBatch.state} - -Returns batched state tensors. - -##### Args: - - -* `state_name`: string, matches a key provided in `initial_states`. - -##### Returns: - - A `Tensor`: a batched set of states, either initial states (if this is - the first run of the given example), or a value as stored during - a previous iteration via `save_state` control flow. - Its type is the same as `initial_states["state_name"].dtype`. - If we had at input: - - ```python - initial_states[state_name].get_shape() == [d1, d2, ...], - ``` - - then - - ```python - state(state_name).get_shape() == [batch_size, d1, d2, ...] - ``` - -##### Raises: - - -* `KeyError`: if `state_name` does not match any of the initial states - declared in `initial_states`. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.total_length` {#NextQueuedSequenceBatch.total_length} - -The lengths of the original (non-truncated) unrolled examples. - -##### Returns: - - An integer vector of length `batch_size`, the total lengths. - - - -- - - - -### `class tf.contrib.training.SequenceQueueingStateSaver` {#SequenceQueueingStateSaver} - -SequenceQueueingStateSaver provides access to stateful values from input. - -This class is meant to be used instead of, e.g., a `Queue`, for splitting -variable-length sequence inputs into segments of sequences with fixed length -and batching them into mini-batches. It maintains contexts and state for a -sequence across the segments. It can be used in conjunction with a -`QueueRunner` (see the example below). - -The `SequenceQueueingStateSaver` (SQSS) accepts one example at a time via the -inputs `input_length`, `input_key`, `input_sequences` (a dict), -`input_context` (a dict), and `initial_states` (a dict). -The sequences, values in `input_sequences`, may have variable first dimension -(the `padded_length`), though this dimension must always be a multiple of -`num_unroll`. All other dimensions must be fixed and accessible via -`get_shape` calls. The length prior to padding can be recorded in -`input_length`. The context values in `input_context` must all have fixed and -well defined dimensions. The initial state values must all have fixed and -well defined dimensions. - -The SQSS splits the sequences of an input example into segments of length -`num_unroll`. Across examples minibatches of size `batch_size` are formed. -These minibatches contain a segment of the sequences, copy the context values, -and maintain state, length, and key information of the original input -examples. In the first segment of an example the state is still the initial -state. It can then be updated; and updated state values are accessible in -subsequent segments of the same example. After each segment -`batch.save_state()` must be called which is done by the state_saving_rnn. -Without this call, the dequeue op associated with the SQSS will not run. -Internally, SQSS has a queue for the input examples. Its `capacity` is -configurable. If set smaller than `batch_size` then the dequeue op will block -indefinitely. A small multiple of `batch_size` is a good rule of thumb to -prevent that queue from becoming a bottleneck and slowing down training. -If set too large (and note that it defaults to unbounded) memory consumption -goes up. Moreover, when iterating over the same input examples multiple times -reusing the same `key` the `capacity` must be smaller than the number of -examples. - -The prefetcher, which reads one unrolled, variable-length input sequence at -a time, is accessible via `prefetch_op`. The underlying `Barrier` object -is accessible via `barrier`. Processed minibatches, as well as -state read and write capabilities are accessible via `next_batch`. -Specifically, `next_batch` provides access to all of the minibatched -data, including the following, see `NextQueuedSequenceBatch` for details: - -* `total_length`, `length`, `insertion_index`, `key`, `next_key`, -* `sequence` (the index each minibatch entry's time segment index), -* `sequence_count` (the total time segment count for each minibatch entry), -* `context` (a dict of the copied minibatched context values), -* `sequences` (a dict of the split minibatched variable-length sequences), -* `state` (to access the states of the current segments of these entries) -* `save_state` (to save the states for the next segments of these entries) - -Example usage: - -```python -batch_size = 32 -num_unroll = 20 -lstm_size = 8 -cell = tf.contrib.rnn.BasicLSTMCell(num_units=lstm_size) -initial_state_values = tf.zeros(cell.state_size, dtype=tf.float32) - -raw_data = get_single_input_from_input_reader() -length, key, sequences, context = my_parser(raw_data) -assert "input" in sequences.keys() -assert "label" in context.keys() -initial_states = {"lstm_state": initial_state_value} - -stateful_reader = tf.SequenceQueueingStateSaver( - batch_size, num_unroll, - length=length, input_key=key, input_sequences=sequences, - input_context=context, initial_states=initial_states, - capacity=batch_size*100) - -batch = stateful_reader.next_batch -inputs = batch.sequences["input"] -context_label = batch.context["label"] - -inputs_by_time = tf.split(value=inputs, num_or_size_splits=num_unroll, axis=1) -assert len(inputs_by_time) == num_unroll - -lstm_output, _ = tf.contrib.rnn.static_state_saving_rnn( - cell, - inputs_by_time, - state_saver=batch, - state_name="lstm_state") - -# Start a prefetcher in the background -sess = tf.Session() -num_threads = 3 -queue_runner = tf.train.QueueRunner( - stateful_reader, [stateful_reader.prefetch_op] * num_threads) -tf.train.add_queue_runner(queue_runner) -tf.train.start_queue_runners(sess=session) - -while True: - # Step through batches, perform training or inference... - session.run([lstm_output]) -``` - -**Note**: Usually the barrier is given to a QueueRunner as in the - examples above. The QueueRunner will close the barrier if the prefetch_op - receives an OutOfRange Error from upstream input queues (i.e., reaches - the end of the input). If the barrier is closed no further new examples - are added to the SQSS. The underlying barrier might, however, still - contain further unroll-steps of examples that have not undergone all - iterations. To gracefully finish all examples, the flag - `allow_small_batch` must be set to true, which causes the SQSS to issue - progressively smaller mini-batches with the remaining examples. -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.__init__(batch_size, num_unroll, input_length, input_key, input_sequences, input_context, initial_states, capacity=None, allow_small_batch=False, name=None)` {#SequenceQueueingStateSaver.__init__} - -Creates the SequenceQueueingStateSaver. - -##### Args: - - -* `batch_size`: int or int32 scalar `Tensor`, how large minibatches should - be when accessing the `state()` method and `context`, `sequences`, etc, - properties. -* `num_unroll`: Python integer, how many time steps to unroll at a time. - The input sequences of length `k` are then split into `k / num_unroll` - many segments. -* `input_length`: An int32 scalar `Tensor`, the length of the sequence prior - to padding. This value may be at most `padded_length` for any given - input (see below for the definition of `padded_length`). - Batched and total lengths of the current iteration are made accessible - via the `length` and `total_length` properties. The shape of - input_length (scalar) must be fully specified. -* `input_key`: A string scalar `Tensor`, the **unique** key for the given - input. This is used to keep track of the split minibatch elements - of this input. Batched keys of the current iteration are made - accessible via the `key` property. The shape of `input_key` (scalar) - must be fully specified. -* `input_sequences`: A dict mapping string names to `Tensor` values. The - values must all have matching first dimension, called `padded_length`. - The `SequenceQueueingStateSaver` will split these tensors along - this first dimension into minibatch elements of dimension - `num_unroll`. Batched and segmented sequences of the current iteration - are made accessible via the `sequences` property. - - **Note**: `padded_length` may be dynamic, and may vary from input - to input, but must always be a multiple of `num_unroll`. The remainder - of the shape (other than the first dimension) must be fully specified. - -* `input_context`: A dict mapping string names to `Tensor` values. The values - are treated as "global" across all time splits of the given input, - and will be copied across for all minibatch elements accordingly. - Batched and copied context of the current iteration are made - accessible via the `context` property. - - **Note**: All input_context values must have fully defined shapes. - -* `initial_states`: A dict mapping string state names to multi-dimensional - values (e.g. constants or tensors). This input defines the set of - states that will be kept track of during computing iterations, and - which can be accessed via the `state` and `save_state` methods. - - **Note**: All initial_state values must have fully defined shapes. - -* `capacity`: The max capacity of the SQSS in number of examples. Needs to be - at least `batch_size`. Defaults to unbounded. -* `allow_small_batch`: If true, the SQSS will return smaller batches when - there aren't enough input examples to fill a whole batch and the end of - the input has been reached (i.e., the underlying barrier has been - closed). -* `name`: An op name string (optional). - -##### Raises: - - -* `TypeError`: if any of the inputs is not an expected type. -* `ValueError`: if any of the input values is inconsistent, e.g. if - not enough shape information is available from inputs to build - the state saver. - - -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.barrier` {#SequenceQueueingStateSaver.barrier} - - - - -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.batch_size` {#SequenceQueueingStateSaver.batch_size} - - - - -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.close(cancel_pending_enqueues=False, name=None)` {#SequenceQueueingStateSaver.close} - -Closes the barrier and the FIFOQueue. - -This operation signals that no more segments of new sequences will be -enqueued. New segments of already inserted sequences may still be enqueued -and dequeued if there is a sufficient number filling a batch or -allow_small_batch is true. Otherwise dequeue operations will fail -immediately. - -##### Args: - - -* `cancel_pending_enqueues`: (Optional.) A boolean, defaulting to - `False`. If `True`, all pending enqueues to the underlying queues will - be cancelled, and completing already started sequences is not possible. -* `name`: Optional name for the op. - -##### Returns: - - The operation that closes the barrier and the FIFOQueue. - - -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.name` {#SequenceQueueingStateSaver.name} - - - - -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.next_batch` {#SequenceQueueingStateSaver.next_batch} - -The `NextQueuedSequenceBatch` providing access to batched output data. - -Also provides access to the `state` and `save_state` methods. -The first time this gets called, it additionally prepares barrier reads -and creates `NextQueuedSequenceBatch` / next_batch objects. Subsequent -calls simply return the previously created `next_batch`. - -In order to access data in `next_batch` without blocking, the `prefetch_op` -must have been run at least `batch_size` times (ideally in a separate -thread, or launched via a `QueueRunner`). After processing a segment in -`next_batch()`, `batch.save_state()` must be called which is done by the -state_saving_rnn. Without this call, the dequeue op associated with the SQSS -will not run. - -##### Returns: - - A cached `NextQueuedSequenceBatch` instance. - - -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.num_unroll` {#SequenceQueueingStateSaver.num_unroll} - - - - -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.prefetch_op` {#SequenceQueueingStateSaver.prefetch_op} - -The op used to prefetch new data into the state saver. - -Running it once enqueues one new input example into the state saver. -The first time this gets called, it additionally creates the prefetch_op. -Subsequent calls simply return the previously created `prefetch_op`. - -It should be run in a separate thread via e.g. a `QueueRunner`. - -##### Returns: - - An `Operation` that performs prefetching. - - - -- - - - -### `tf.contrib.training.rejection_sample(tensors, accept_prob_fn, batch_size, queue_threads=1, enqueue_many=False, prebatch_capacity=16, prebatch_threads=1, runtime_checks=False, name=None)` {#rejection_sample} - -Stochastically creates batches by rejection sampling. - -Each list of non-batched tensors is evaluated by `accept_prob_fn`, to produce -a scalar tensor between 0 and 1. This tensor corresponds to the probability of -being accepted. When `batch_size` tensor groups have been accepted, the batch -queue will return a mini-batch. - -##### Args: - - -* `tensors`: List of tensors for data. All tensors are either one item or a - batch, according to enqueue_many. -* `accept_prob_fn`: A python lambda that takes a non-batch tensor from each - item in `tensors`, and produces a scalar tensor. -* `batch_size`: Size of batch to be returned. -* `queue_threads`: The number of threads for the queue that will hold the final - batch. -* `enqueue_many`: Bool. If true, interpret input tensors as having a batch - dimension. -* `prebatch_capacity`: Capacity for the large queue that is used to convert - batched tensors to single examples. -* `prebatch_threads`: Number of threads for the large queue that is used to - convert batched tensors to single examples. -* `runtime_checks`: Bool. If true, insert runtime checks on the output of - `accept_prob_fn`. Using `True` might have a performance impact. -* `name`: Optional prefix for ops created by this function. - -##### Raises: - - -* `ValueError`: enqueue_many is True and labels doesn't have a batch - dimension, or if enqueue_many is False and labels isn't a scalar. -* `ValueError`: enqueue_many is True, and batch dimension on data and labels - don't match. -* `ValueError`: if a zero initial probability class has a nonzero target - probability. - -##### Returns: - - A list of tensors of the same length as `tensors`, with batch dimension - `batch_size`. - -##### Example: - - # Get tensor for a single data and label example. - data, label = data_provider.Get(['data', 'label']) - - # Get stratified batch according to data tensor. - accept_prob_fn = lambda x: (tf.tanh(x[0]) + 1) / 2 - data_batch = tf.contrib.training.rejection_sample( - [data, label], accept_prob_fn, 16) - - # Run batch through network. - ... - - -- - - - -### `tf.contrib.training.resample_at_rate(inputs, rates, scope=None, seed=None, back_prop=False)` {#resample_at_rate} - -Given `inputs` tensors, stochastically resamples each at a given rate. - -For example, if the inputs are `[[a1, a2], [b1, b2]]` and the rates -tensor contains `[3, 1]`, then the return value may look like `[[a1, -a2, a1, a1], [b1, b2, b1, b1]]`. However, many other outputs are -possible, since this is stochastic -- averaged over many repeated -calls, each set of inputs should appear in the output `rate` times -the number of invocations. - -Uses Knuth's method to generate samples from the poisson -distribution (but instead of just incrementing a count, actually -emits the input); this is described at -https://en.wikipedia.org/wiki/Poisson_distribution in the section on -generating Poisson-distributed random variables. - -Note that this method is not appropriate for large rate values: with -float16 it will stop performing correctly for rates above 9.17; -float32, 87; and float64, 708. (These are the base-e versions of the -minimum representable exponent for each type.) - -##### Args: - - -* `inputs`: A list of tensors, each of which has a shape of `[batch_size, ...]` -* `rates`: A tensor of shape `[batch_size]` contiaining the resampling rates - for each input. -* `scope`: Scope for the op. -* `seed`: Random seed to use. -* `back_prop`: Whether to allow back-propagation through this op. - -##### Returns: - - Selections from the input tensors. - - -- - - - -### `tf.contrib.training.stratified_sample(tensors, labels, target_probs, batch_size, init_probs=None, enqueue_many=False, queue_capacity=16, threads_per_queue=1, name=None)` {#stratified_sample} - -Stochastically creates batches based on per-class probabilities. - -This method discards examples. Internally, it creates one queue to amortize -the cost of disk reads, and one queue to hold the properly-proportioned -batch. - -##### Args: - - -* `tensors`: List of tensors for data. All tensors are either one item or a - batch, according to enqueue_many. -* `labels`: Tensor for label of data. Label is a single integer or a batch, - depending on enqueue_many. It is not a one-hot vector. -* `target_probs`: Target class proportions in batch. An object whose type has a - registered Tensor conversion function. -* `batch_size`: Size of batch to be returned. -* `init_probs`: Class proportions in the data. An object whose type has a - registered Tensor conversion function, or `None` for estimating the - initial distribution. -* `enqueue_many`: Bool. If true, interpret input tensors as having a batch - dimension. -* `queue_capacity`: Capacity of the large queue that holds input examples. -* `threads_per_queue`: Number of threads for the large queue that holds input - examples and for the final queue with the proper class proportions. -* `name`: Optional prefix for ops created by this function. - -##### Raises: - - -* `ValueError`: enqueue_many is True and labels doesn't have a batch - dimension, or if enqueue_many is False and labels isn't a scalar. -* `ValueError`: enqueue_many is True, and batch dimension on data and labels - don't match. -* `ValueError`: if probs don't sum to one. -* `ValueError`: if a zero initial probability class has a nonzero target - probability. -* `TFAssertion`: if labels aren't integers in [0, num classes). - -##### Returns: - - (data_batch, label_batch), where data_batch is a list of tensors of the same - length as `tensors` - -##### Example: - - # Get tensor for a single data and label example. - data, label = data_provider.Get(['data', 'label']) - - # Get stratified batch according to per-class probabilities. - target_probs = [...distribution you want...] - [data_batch], labels = tf.contrib.training.stratified_sample( - [data], label, target_probs) - - # Run batch through network. - ... - - -- - - - -### `tf.contrib.training.weighted_resample(inputs, weights, overall_rate, scope=None, mean_decay=0.999, seed=None)` {#weighted_resample} - -Performs an approximate weighted resampling of `inputs`. - -This method chooses elements from `inputs` where each item's rate of -selection is proportional to its value in `weights`, and the average -rate of selection across all inputs (and many invocations!) is -`overall_rate`. - -##### Args: - - -* `inputs`: A list of tensors whose first dimension is `batch_size`. -* `weights`: A `[batch_size]`-shaped tensor with each batch member's weight. -* `overall_rate`: Desired overall rate of resampling. -* `scope`: Scope to use for the op. -* `mean_decay`: How quickly to decay the running estimate of the mean weight. -* `seed`: Random seed. - -##### Returns: - - A list of tensors exactly like `inputs`, but with an unknown (and - possibly zero) first dimension. - A tensor containing the effective resampling rate used for each output. - - -- - - - -### `tf.contrib.training.bucket(tensors, which_bucket, batch_size, num_buckets, num_threads=1, capacity=32, shapes=None, dynamic_pad=False, allow_smaller_final_batch=False, keep_input=True, shared_name=None, name=None)` {#bucket} - -Lazy bucketing of input tensors according to `which_bucket`. - -The argument `tensors` can be a list or a dictionary of tensors. -The value returned by the function will be of the same type -as `tensors`. - -The tensors entering this function are put into the bucket given by -`which_bucket`. Each bucket has its own queue. When a bucket contains -`batch_size` elements, this minibatch is pushed onto a top queue. The -tensors returned from this function are a the result of dequeueing the -next minibatch from this top queue. - -This function is implemented using several queues. A `QueueRunner` for the -queues is added to the current `Graph`'s `QUEUE_RUNNER` collection. - -As the returned tensors are the result of of a dequeue operation, evaluating -them will throw a `tf.errors.OutOfRangeError` when the input queue is -exhausted. If these tensors are feeding another input queue, its queue runner -will catch this exception, however, if they are used in your main thread -you are responsible for catching this yourself. - -*N.B.:* If `dynamic_pad` is `False`, you must ensure that either -(i) the `shapes` argument is passed, or (ii) all of the tensors in -`tensors` must have fully-defined shapes. `ValueError` will be -raised if neither of these conditions holds. - -If `dynamic_pad` is `True`, it is sufficient that the *rank* of the -tensors is known, but individual dimensions may have shape `None`. -In this case, for each enqueue the dimensions with value `None` -may have a variable length; upon dequeue, the output tensors will be padded -on the right to the maximum shape of the tensors in the current minibatch. -For numbers, this padding takes value 0. For strings, this padding is -the empty string. See `PaddingFIFOQueue` for more info. - -If `allow_smaller_final_batch` is `True`, a smaller batch value than -`batch_size` is returned when the queues are closed and there are not enough -elements to fill the batch, otherwise the pending elements are discarded. -In addition, all output tensors' static shapes, as accessed via the -`get_shape()` method will have a 0th `Dimension` value of `None`, and -operations that depend on fixed batch_size would fail. - -##### Args: - - -* `tensors`: The list or dictionary of tensors, representing a single element, - to bucket. Nested lists are not supported. -* `which_bucket`: An `int32` scalar Tensor taking a value in `[0, num_buckets)`. -* `batch_size`: The new batch size pulled from the queue (all queues will have - the same size). If a list is passed in then each bucket will have a - different batch_size. - (python int, int32 scalar or iterable of integers of length num_buckets). -* `num_buckets`: A python integer, the number of buckets. -* `num_threads`: An integer. The number of threads enqueuing `tensors`. -* `capacity`: An integer. The maximum number of minibatches in the top queue, - and also the maximum number of elements within each bucket. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensors`. -* `dynamic_pad`: Boolean. Allow variable dimensions in input shapes. - The given dimensions are padded upon dequeue so that tensors within a - batch have the same shapes. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batches to be smaller if there are insufficient items left in the queues. -* `keep_input`: A `bool` scalar Tensor. If provided, this tensor controls - whether the input is added to the queue or not. If it evaluates `True`, - then `tensors` are added to the bucket; otherwise they are dropped. This - tensor essentially acts as a filtering mechanism. -* `shared_name`: (Optional). If set, the queues will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A tuple `(bucket, outputs)` where `bucket` is - a `int32` scalar tensor and `outputs` is a list or - dictionary of batched outputs corresponding to elements of `tensors`. - Every step will receive a new bucket of outputs. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensors` or if batch_size is a sequence - but it's length != num_buckets. - - -- - - - -### `tf.contrib.training.bucket_by_sequence_length(input_length, tensors, batch_size, bucket_boundaries, num_threads=1, capacity=32, shapes=None, dynamic_pad=False, allow_smaller_final_batch=False, keep_input=True, shared_name=None, name=None)` {#bucket_by_sequence_length} - -Lazy bucketing of inputs according to their length. - -This method calls `tf.contrib.training.bucket` under the hood, after first -subdividing the bucket boundaries into separate buckets and identifying which -bucket the given `input_length` belongs to. See the documentation for -`which_bucket` for details of the other arguments. - -##### Args: - - -* `input_length`: `int32` scalar `Tensor`, the sequence length of tensors. -* `tensors`: The list or dictionary of tensors, representing a single element, - to bucket. Nested lists are not supported. -* `batch_size`: The new batch size pulled from the queue (all queues will have - the same size). If a list is passed in then each bucket will have a - different batch_size. - (python int, int32 scalar or iterable of integers of length num_buckets). -* `bucket_boundaries`: int list, increasing non-negative numbers. - The edges of the buckets to use when bucketing tensors. Two extra buckets - are created, one for `input_length < bucket_boundaries[0]` and - one for `input_length >= bucket_boundaries[-1]`. -* `num_threads`: An integer. The number of threads enqueuing `tensors`. -* `capacity`: An integer. The maximum number of minibatches in the top queue, - and also the maximum number of elements within each bucket. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensors`. -* `dynamic_pad`: Boolean. Allow variable dimensions in input shapes. - The given dimensions are padded upon dequeue so that tensors within a - batch have the same shapes. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batches to be smaller if there are insufficient items left in the queues. -* `keep_input`: A `bool` scalar Tensor. If provided, this tensor controls - whether the input is added to the queue or not. If it evaluates `True`, - then `tensors` are added to the bucket; otherwise they are dropped. This - tensor essentially acts as a filtering mechanism. -* `shared_name`: (Optional). If set, the queues will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A tuple `(sequence_length, outputs)` where `sequence_length` is - a 1-D `Tensor` of size `batch_size` and `outputs` is a list or dictionary - of batched, bucketed, outputs corresponding to elements of `tensors`. - -##### Raises: - - -* `TypeError`: if `bucket_boundaries` is not a list of python integers. -* `ValueError`: if `bucket_boundaries` is empty or contains non-increasing - values or if batch_size is a list and it's length doesn't equal the number - of buckets. - - diff --git a/tensorflow/g3doc/api_docs/python/contrib.util.md b/tensorflow/g3doc/api_docs/python/contrib.util.md deleted file mode 100644 index a5a22eb27d..0000000000 --- a/tensorflow/g3doc/api_docs/python/contrib.util.md +++ /dev/null @@ -1,157 +0,0 @@ - - -# Utilities (contrib) -[TOC] - -Utilities for dealing with Tensors. See @{$python/contrib.util} guide. - -- - - - -### `tf.contrib.util.constant_value(tensor)` {#constant_value} - -Returns the constant value of the given tensor, if efficiently calculable. - -This function attempts to partially evaluate the given tensor, and -returns its value as a numpy ndarray if this succeeds. - -TODO(mrry): Consider whether this function should use a registration -mechanism like gradients and ShapeFunctions, so that it is easily -extensible. - -NOTE: If `constant_value(tensor)` returns a non-`None` result, it will no -longer be possible to feed a different value for `tensor`. This allows the -result of this function to influence the graph that is constructed, and -permits static shape optimizations. - -##### Args: - - -* `tensor`: The Tensor to be evaluated. - -##### Returns: - - A numpy ndarray containing the constant value of the given `tensor`, - or None if it cannot be calculated. - -##### Raises: - - -* `TypeError`: if tensor is not an ops.Tensor. - - -- - - - -### `tf.contrib.util.make_tensor_proto(values, dtype=None, shape=None, verify_shape=False)` {#make_tensor_proto} - -Create a TensorProto. - -##### Args: - - -* `values`: Values to put in the TensorProto. -* `dtype`: Optional tensor_pb2 DataType value. -* `shape`: List of integers representing the dimensions of tensor. -* `verify_shape`: Boolean that enables verification of a shape of values. - -##### Returns: - - A TensorProto. Depending on the type, it may contain data in the - "tensor_content" attribute, which is not directly useful to Python programs. - To access the values you should convert the proto back to a numpy ndarray - with tensor_util.MakeNdarray(proto). - -##### Raises: - - -* `TypeError`: if unsupported types are provided. -* `ValueError`: if arguments have inappropriate values or if verify_shape is - True and shape of values is not equals to a shape from the argument. - -make_tensor_proto accepts "values" of a python scalar, a python list, a -numpy ndarray, or a numpy scalar. - -If "values" is a python scalar or a python list, make_tensor_proto -first convert it to numpy ndarray. If dtype is None, the -conversion tries its best to infer the right numpy data -type. Otherwise, the resulting numpy array has a compatible data -type with the given dtype. - -In either case above, the numpy ndarray (either the caller provided -or the auto converted) must have the compatible type with dtype. - -make_tensor_proto then converts the numpy array to a tensor proto. - -If "shape" is None, the resulting tensor proto represents the numpy -array precisely. - -Otherwise, "shape" specifies the tensor's shape and the numpy array -can not have more elements than what "shape" specifies. - - -- - - - -### `tf.contrib.util.make_ndarray(tensor)` {#make_ndarray} - -Create a numpy ndarray from a tensor. - -Create a numpy ndarray with the same shape and data as the tensor. - -##### Args: - - -* `tensor`: A TensorProto. - -##### Returns: - - A numpy array with the tensor contents. - -##### Raises: - - -* `TypeError`: if tensor has unsupported type. - - -- - - - -### `tf.contrib.util.ops_used_by_graph_def(graph_def)` {#ops_used_by_graph_def} - -Collect the list of ops used by a graph. - -Does not validate that the ops are all registered. - -##### Args: - - -* `graph_def`: A `GraphDef` proto, as from `graph.as_graph_def()`. - -##### Returns: - - A list of strings, each naming an op used by the graph. - - -- - - - -### `tf.contrib.util.stripped_op_list_for_graph(graph_def)` {#stripped_op_list_for_graph} - -Collect the stripped OpDefs for ops used by a graph. - -This function computes the `stripped_op_list` field of `MetaGraphDef` and -similar protos. The result can be communicated from the producer to the -consumer, which can then use the C++ function -`RemoveNewDefaultAttrsFromGraphDef` to improve forwards compatibility. - -##### Args: - - -* `graph_def`: A `GraphDef` proto, as from `graph.as_graph_def()`. - -##### Returns: - - An `OpList` of ops used by the graph. - -##### Raises: - - -* `ValueError`: If an unregistered op is used. - - diff --git a/tensorflow/g3doc/api_docs/python/control_flow_ops.md b/tensorflow/g3doc/api_docs/python/control_flow_ops.md deleted file mode 100644 index cffc790d60..0000000000 --- a/tensorflow/g3doc/api_docs/python/control_flow_ops.md +++ /dev/null @@ -1,808 +0,0 @@ - - -# Control Flow - -Note: Functions taking `Tensor` arguments can also take anything accepted by -[`tf.convert_to_tensor`](framework.md#convert_to_tensor). - -[TOC] - -Control Flow Operations. See the @{python/control_flow_ops} guide. - -- - - - -### `tf.identity(input, name=None)` {#identity} - -Return a tensor with the same shape and contents as the input tensor or value. - -##### Args: - - -* `input`: A `Tensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - - -- - - - -### `tf.tuple(tensors, name=None, control_inputs=None)` {#tuple} - -Group tensors together. - -This creates a tuple of tensors with the same values as the `tensors` -argument, except that the value of each tensor is only returned after the -values of all tensors have been computed. - -`control_inputs` contains additional ops that have to finish before this op -finishes, but whose outputs are not returned. - -This can be used as a "join" mechanism for parallel computations: all the -argument tensors can be computed in parallel, but the values of any tensor -returned by `tuple` are only available after all the parallel computations -are done. - -See also `group` and `with_dependencies`. - -##### Args: - - -* `tensors`: A list of `Tensor`s or `IndexedSlices`, some entries can be `None`. -* `name`: (optional) A name to use as a `name_scope` for the operation. -* `control_inputs`: List of additional ops to finish before returning. - -##### Returns: - - Same as `tensors`. - -##### Raises: - - -* `ValueError`: If `tensors` does not contain any `Tensor` or `IndexedSlices`. -* `TypeError`: If `control_inputs` is not a list of `Operation` or `Tensor` - objects. - - -- - - - -### `tf.group(*inputs, **kwargs)` {#group} - -Create an op that groups multiple operations. - -When this op finishes, all ops in `input` have finished. This op has no -output. - -See also `tuple` and `with_dependencies`. - -##### Args: - - -* `*inputs`: Zero or more tensors to group. -* `**kwargs`: Optional parameters to pass when constructing the NodeDef. -* `name`: A name for this operation (optional). - -##### Returns: - - An Operation that executes all its inputs. - -##### Raises: - - -* `ValueError`: If an unknown keyword argument is provided. - - -- - - - -### `tf.no_op(name=None)` {#no_op} - -Does nothing. Only useful as a placeholder for control edges. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -### `tf.count_up_to(ref, limit, name=None)` {#count_up_to} - -Increments 'ref' until it reaches 'limit'. - -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: `int32`, `int64`. - Should be from a scalar `Variable` node. -* `limit`: An `int`. - If incrementing ref would bring it above limit, instead generates an - 'OutOfRange' error. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `ref`. - A copy of the input before increment. If nothing else modifies the - input, the values produced will all be distinct. - - -- - - - -### `tf.cond(pred, fn1, fn2, name=None)` {#cond} - -Return either fn1() or fn2() based on the boolean predicate `pred`. - -`fn1` and `fn2` both return lists of output tensors. `fn1` and `fn2` must have -the same non-zero number and type of outputs. - -Note that the conditional execution applies only to the operations defined in -fn1 and fn2. Consider the following simple program: - -```python -z = tf.multiply(a, b) -result = tf.cond(x < y, lambda: tf.add(x, z), lambda: tf.square(y)) -``` - -If x < y, the `tf.add` operation will be executed and `tf.square` -operation will not be executed. Since z is needed for at least one -branch of the cond, the `tf.multiply` operation is always executed, unconditionally. -Although this behavior is consistent with the dataflow model of TensorFlow, -it has occasionally surprised some users who expected a lazier semantics. - -##### Args: - - -* `pred`: A scalar determining whether to return the result of `fn1` or `fn2`. -* `fn1`: The callable to be performed if pred is true. -* `fn2`: The callable to be performed if pref is false. -* `name`: Optional name prefix for the returned tensors. - -##### Returns: - - Tensors returned by the call to either `fn1` or `fn2`. If the callables - return a singleton list, the element is extracted from the list. - -##### Raises: - - -* `TypeError`: if `fn1` or `fn2` is not callable. -* `ValueError`: if `fn1` and `fn2` do not return the same number of tensors, or - return tensors of different types. - - -* `Example`: - -```python - x = tf.constant(2) - y = tf.constant(5) - def f1(): return tf.multiply(x, 17) - def f2(): return tf.add(y, 23) - r = tf.cond(tf.less(x, y), f1, f2) - # r is set to f1(). - # Operations in f2 (e.g., tf.add) are not executed. -``` - - -- - - - -### `tf.case(pred_fn_pairs, default, exclusive=False, name='case')` {#case} - -Create a case operation. - -The `pred_fn_pairs` parameter is a dict or list of pairs of size N. -Each pair contains a boolean scalar tensor and a python callable that -creates the tensors to be returned if the boolean evaluates to True. -`default` is a callable generating a list of tensors. All the callables -in `pred_fn_pairs` as well as `default` should return the same number -and types of tensors. - -If `exclusive==True`, all predicates are evaluated, and an exception is -thrown if more than one of the predicates evaluates to `True`. -If `exclusive==False`, execution stops are the first predicate which -evaluates to True, and the tensors generated by the corresponding function -are returned immediately. If none of the predicates evaluate to True, this -operation returns the tensors generated by `default`. - -Example 1: - Pseudocode: - ``` - if (x < y) return 17; - else return 23; - ``` - - Expressions: - ``` - f1 = lambda: tf.constant(17) - f2 = lambda: tf.constant(23) - r = case([(tf.less(x, y), f1)], default=f2) - ``` - -Example 2: - Pseudocode: - ``` - if (x < y && x > z) raise OpError("Only one predicate may evaluate true"); - if (x < y) return 17; - else if (x > z) return 23; - else return -1; - ``` - - Expressions: - ``` - x = tf.constant(0) - y = tf.constant(1) - z = tf.constant(2) - def f1(): return tf.constant(17) - def f2(): return tf.constant(23) - def f3(): return tf.constant(-1) - r = case({tf.less(x, y): f1, tf.greater(x, z): f2}, - default=f3, exclusive=True) - ``` - -##### Args: - - -* `pred_fn_pairs`: Dict or list of pairs of a boolean scalar tensor and a - callable which returns a list of tensors. -* `default`: A callable that returns a list of tensors. -* `exclusive`: True iff at most one predicate is allowed to evaluate to `True`. -* `name`: A name for this operation (optional). - -##### Returns: - - The tensors returned by the first pair whose predicate evaluated to True, or - those returned by `default` if none does. - -##### Raises: - - -* `TypeError`: If `pred_fn_pairs` is not a list/dictionary. -* `TypeError`: If `pred_fn_pairs` is a list but does not contain 2-tuples. -* `TypeError`: If `fns[i]` is not callable for any i, or `default` is not - callable. - - -- - - - -### `tf.while_loop(cond, body, loop_vars, shape_invariants=None, parallel_iterations=10, back_prop=True, swap_memory=False, name=None)` {#while_loop} - -Repeat `body` while the condition `cond` is true. - -`cond` is a callable returning a boolean scalar tensor. `body` is a callable -returning a (possibly nested) tuple, namedtuple or list of tensors of the same -arity (length and structure) and types as `loop_vars`. `loop_vars` is a -(possibly nested) tuple, namedtuple or list of tensors that is passed to both -`cond` and `body`. `cond` and `body` both take as many arguments as there are -`loop_vars`. - -While `cond` evaluates to true, `body` is executed. - -In addition to regular Tensors or IndexedSlices, the body may accept and -return TensorArray objects. The flows of the TensorArray objects will -be appropriately forwarded between loops and during gradient calculations. - -For correctness, `tf.while_loop()` strictly enforces shape invariants for -the loop variables. A shape invariant is a (possibly partial) shape that -is unchanged across the iterations of the loop. An error will be raised -if the shape of a loop variable after an iteration is determined to be more -general than or incompatible with its shape invariant. For example, a shape -of [11, None] is more general than a shape of [11, 17], and [11, 21] is not -compatible with [11, 17]. By default (if the argument `shape_invariants` is -not specified), it is assumed that the initial shape of each tensor in -`loop_vars` is the same in every iteration. The `shape_invariants` argument -allows the caller to specify a less specific shape invariant for each loop -variable, which is needed if the shape varies between iterations. The -[`Tensor.set_shape()`](../../api_docs/python/framework.md#Tensor.set_shape) -function may also be used in the `body` function to indicate that -the output loop variable has a particular shape. The shape invariant for -SparseTensor and IndexedSlices are treated specially as follows: - -a) If a loop variable is a SparseTensor, the shape invariant must be -TensorShape([r]) where r is the rank of the dense tensor represented -by the sparse tensor. It means the shapes of the three tensors of the -SparseTensor are ([None], [None, r], [r]). NOTE: The shape invariant here -is the shape of the SparseTensor.dense_shape property. It must be the shape of -a vector. - -b) If a loop variable is an IndexedSlices, the shape invariant must be -a shape invariant of the values tensor of the IndexedSlices. It means -the shapes of the three tensors of the IndexedSlices are (shape, [shape[0]], -[shape.ndims]). - -`while_loop` implements non-strict semantics, enabling multiple iterations -to run in parallel. The maximum number of parallel iterations can be -controlled by `parallel_iterations`, which gives users some control over -memory consumption and execution order. For correct programs, `while_loop` -should return the same result for any parallel_iterations > 0. - -For training, TensorFlow remembers the tensors that are produced in the -forward inference but needed in back propagation. These tensors can be a -main source of memory consumption and often cause OOM problems when training -on GPUs. When the flag swap_memory is true, we swap out these tensors from -GPU to CPU. This for example allows us to train RNN models with very long -sequences and large batches. - -##### Args: - - -* `cond`: A callable that represents the termination condition of the loop. -* `body`: A callable that represents the loop body. -* `loop_vars`: A (possibly nested) tuple, namedtuple or list of numpy array, - `Tensor`, and `TensorArray` objects. -* `shape_invariants`: The shape invariants for the loop variables. -* `parallel_iterations`: The number of iterations allowed to run in parallel. - It must be a positive integer. -* `back_prop`: Whether backprop is enabled for this while loop. -* `swap_memory`: Whether GPU-CPU memory swap is enabled for this loop. -* `name`: Optional name prefix for the returned tensors. - -##### Returns: - - The output tensors for the loop variables after the loop. When the length - of `loop_vars` is 1 this is a Tensor, TensorArray or IndexedSlice and when - the length of `loop_vars` is greater than 1 it returns a list. - -##### Raises: - - -* `TypeError`: if `cond` or `body` is not callable. -* `ValueError`: if `loop_vars` is empty. - - -* `Example`: - - ```python - i = tf.constant(0) - c = lambda i: tf.less(i, 10) - b = lambda i: tf.add(i, 1) - r = tf.while_loop(c, b, [i]) - ``` - -Example with nesting and a namedtuple: - - ```python - import collections - Pair = collections.namedtuple('Pair', 'j, k') - ijk_0 = (tf.constant(0), Pair(tf.constant(1), tf.constant(2))) - c = lambda i, p: i < 10 - b = lambda i, p: (i + 1, Pair((p.j + p.k), (p.j - p.k))) - ijk_final = tf.while_loop(c, b, ijk_0) - ``` - -Example using shape_invariants: - - ```python - i0 = tf.constant(0) - m0 = tf.ones([2, 2]) - c = lambda i, m: i < 10 - b = lambda i, m: [i+1, tf.concat([m, m], axis=0)] - tf.while_loop( - c, b, loop_vars=[i0, m0], - shape_invariants=[i0.get_shape(), tf.TensorShape([None, 2])]) - ``` - - -- - - - -### `tf.logical_and(x, y, name=None)` {#logical_and} - -Returns the truth value of x AND y element-wise. - -*NOTE*: `LogicalAnd` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -### `tf.logical_not(x, name=None)` {#logical_not} - -Returns the truth value of NOT x element-wise. - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -### `tf.logical_or(x, y, name=None)` {#logical_or} - -Returns the truth value of x OR y element-wise. - -*NOTE*: `LogicalOr` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -### `tf.logical_xor(x, y, name='LogicalXor')` {#logical_xor} - -x ^ y = (x | y) & ~(x & y). - - -- - - - -### `tf.equal(x, y, name=None)` {#equal} - -Returns the truth value of (x == y) element-wise. - -*NOTE*: `Equal` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`, `complex64`, `quint8`, `qint8`, `qint32`, `string`, `bool`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -### `tf.not_equal(x, y, name=None)` {#not_equal} - -Returns the truth value of (x != y) element-wise. - -*NOTE*: `NotEqual` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`, `complex64`, `quint8`, `qint8`, `qint32`, `string`, `bool`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -### `tf.less(x, y, name=None)` {#less} - -Returns the truth value of (x < y) element-wise. - -*NOTE*: `Less` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -### `tf.less_equal(x, y, name=None)` {#less_equal} - -Returns the truth value of (x <= y) element-wise. - -*NOTE*: `LessEqual` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -### `tf.greater(x, y, name=None)` {#greater} - -Returns the truth value of (x > y) element-wise. - -*NOTE*: `Greater` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -### `tf.greater_equal(x, y, name=None)` {#greater_equal} - -Returns the truth value of (x >= y) element-wise. - -*NOTE*: `GreaterEqual` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -### `tf.where(condition, x=None, y=None, name=None)` {#where} - -Return the elements, either from `x` or `y`, depending on the `condition`. - -If both `x` and `y` are None, then this operation returns the coordinates of -true elements of `condition`. The coordinates are returned in a 2-D tensor -where the first dimension (rows) represents the number of true elements, and -the second dimension (columns) represents the coordinates of the true -elements. Keep in mind, the shape of the output tensor can vary depending on -how many true values there are in input. Indices are output in row-major -order. - -If both non-None, `x` and `y` must have the same shape. -The `condition` tensor must be a scalar if `x` and `y` are scalar. -If `x` and `y` are vectors or higher rank, then `condition` must be either a -vector with size matching the first dimension of `x`, or must have the same -shape as `x`. - -The `condition` tensor acts as a mask that chooses, based on the value at each -element, whether the corresponding element / row in the output should be taken -from `x` (if true) or `y` (if false). - -If `condition` is a vector and `x` and `y` are higher rank matrices, then it -chooses which row (outer dimension) to copy from `x` and `y`. If `condition` -has the same shape as `x` and `y`, then it chooses which element to copy from -`x` and `y`. - -##### Args: - - -* `condition`: A `Tensor` of type `bool` -* `x`: A Tensor which may have the same shape as `condition`. If `condition` is - rank 1, `x` may have higher rank, but its first dimension must match the - size of `condition`. -* `y`: A `tensor` with the same shape and type as `x`. -* `name`: A name of the operation (optional) - -##### Returns: - - A `Tensor` with the same type and shape as `x`, `y` if they are non-None. - A `Tensor` with shape `(num_true, dim_size(condition))`. - -##### Raises: - - -* `ValueError`: When exactly one of `x` or `y` is non-None. - - -- - - - -### `tf.is_finite(x, name=None)` {#is_finite} - -Returns which elements of x are finite. - -@compatibility(numpy) -Equivalent to np.isfinite -@end_compatibility - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -### `tf.is_inf(x, name=None)` {#is_inf} - -Returns which elements of x are Inf. - -@compatibility(numpy) -Equivalent to np.isinf -@end_compatibility - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -### `tf.is_nan(x, name=None)` {#is_nan} - -Returns which elements of x are NaN. - -@compatibility(numpy) -Equivalent to np.isnan -@end_compatibility - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -### `tf.verify_tensor_all_finite(t, msg, name=None)` {#verify_tensor_all_finite} - -Assert that the tensor does not contain any NaN's or Inf's. - -##### Args: - - -* `t`: Tensor to check. -* `msg`: Message to log on failure. -* `name`: A name for this operation (optional). - -##### Returns: - - Same tensor as `t`. - - -- - - - -### `tf.check_numerics(tensor, message, name=None)` {#check_numerics} - -Checks a tensor for NaN and Inf values. - -When run, reports an `InvalidArgument` error if `tensor` has any values -that are not a number (NaN) or infinity (Inf). Otherwise, passes `tensor` as-is. - -##### Args: - - -* `tensor`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `message`: A `string`. Prefix of the error message. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `tensor`. - - -- - - - -### `tf.add_check_numerics_ops()` {#add_check_numerics_ops} - -Connect a `check_numerics` to every floating point tensor. - -`check_numerics` operations themselves are added for each `half`, `float`, -or `double` tensor in the graph. For all ops in the graph, the -`check_numerics` op for all of its (`half`, `float`, or `double`) inputs -is guaranteed to run before the `check_numerics` op on any of its outputs. - -##### Returns: - - A `group` op depending on all `check_numerics` ops added. - - -- - - - -### `tf.Assert(condition, data, summarize=None, name=None)` {#Assert} - -Asserts that the given condition is true. - -If `condition` evaluates to false, print the list of tensors in `data`. -`summarize` determines how many entries of the tensors to print. - -NOTE: To ensure that Assert executes, one usually attaches a dependency: - -```python -# Ensure maximum element of x is smaller or equal to 1 -assert_op = tf.Assert(tf.less_equal(tf.reduce_max(x), 1.), [x]) -with tf.control_dependencies([assert_op]): - ... code using x ... -``` - -##### Args: - - -* `condition`: The condition to evaluate. -* `data`: The tensors to print out when condition is false. -* `summarize`: Print this many entries of each tensor. -* `name`: A name for this operation (optional). - -##### Returns: - - -* `assert_op`: An `Operation` that, when executed, raises a - `tf.errors.InvalidArgumentError` if `condition` is not true. - - -- - - - -### `tf.Print(input_, data, message=None, first_n=None, summarize=None, name=None)` {#Print} - -Prints a list of tensors. - -This is an identity op with the side effect of printing `data` when -evaluating. - -##### Args: - - -* `input_`: A tensor passed through this op. -* `data`: A list of tensors to print out when op is evaluated. -* `message`: A string, prefix of the error message. -* `first_n`: Only log `first_n` number of times. Negative numbers log always; - this is the default. -* `summarize`: Only print this many entries of each tensor. If None, then a - maximum of 3 elements are printed per input tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - Same tensor as `input_`. - - diff --git a/tensorflow/g3doc/api_docs/python/framework.md b/tensorflow/g3doc/api_docs/python/framework.md deleted file mode 100644 index c3362bd254..0000000000 --- a/tensorflow/g3doc/api_docs/python/framework.md +++ /dev/null @@ -1,3969 +0,0 @@ - - -# Building Graphs -[TOC] - -Classes and functions for building TensorFlow graphs. - -## Core graph data structures - -- - - - -### `class tf.Graph` {#Graph} - -A TensorFlow computation, represented as a dataflow graph. - -A `Graph` contains a set of -[`Operation`](../../api_docs/python/framework.md#Operation) objects, -which represent units of computation; and -[`Tensor`](../../api_docs/python/framework.md#Tensor) objects, which represent -the units of data that flow between operations. - -A default `Graph` is always registered, and accessible by calling -[`tf.get_default_graph()`](../../api_docs/python/framework.md#get_default_graph). -To add an operation to the default graph, simply call one of the functions -that defines a new `Operation`: - -```python -c = tf.constant(4.0) -assert c.graph is tf.get_default_graph() -``` - -Another typical usage involves the -[`Graph.as_default()`](../../api_docs/python/framework.md#Graph.as_default) -context manager, which overrides the current default graph for the -lifetime of the context: - -```python -g = tf.Graph() -with g.as_default(): - # Define operations and tensors in `g`. - c = tf.constant(30.0) - assert c.graph is g -``` - -Important note: This class *is not* thread-safe for graph construction. All -operations should be created from a single thread, or external -synchronization must be provided. Unless otherwise specified, all methods -are not thread-safe. - -- - - - -#### `tf.Graph.__init__()` {#Graph.__init__} - -Creates a new, empty Graph. - - -- - - - -#### `tf.Graph.as_default()` {#Graph.as_default} - -Returns a context manager that makes this `Graph` the default graph. - -This method should be used if you want to create multiple graphs -in the same process. For convenience, a global default graph is -provided, and all ops will be added to this graph if you do not -create a new graph explicitly. Use this method with the `with` keyword -to specify that ops created within the scope of a block should be -added to this graph. - -The default graph is a property of the current thread. If you -create a new thread, and wish to use the default graph in that -thread, you must explicitly add a `with g.as_default():` in that -thread's function. - -The following code examples are equivalent: - -```python -# 1. Using Graph.as_default(): -g = tf.Graph() -with g.as_default(): - c = tf.constant(5.0) - assert c.graph is g - -# 2. Constructing and making default: -with tf.Graph().as_default() as g: - c = tf.constant(5.0) - assert c.graph is g -``` - -##### Returns: - - A context manager for using this graph as the default graph. - - -- - - - -#### `tf.Graph.as_graph_def(from_version=None, add_shapes=False)` {#Graph.as_graph_def} - -Returns a serialized `GraphDef` representation of this graph. - -The serialized `GraphDef` can be imported into another `Graph` -(using [`import_graph_def()`](#import_graph_def)) or used with the -[C++ Session API](../../api_docs/cc/index.md). - -This method is thread-safe. - -##### Args: - - -* `from_version`: Optional. If this is set, returns a `GraphDef` - containing only the nodes that were added to this graph since - its `version` property had the given value. -* `add_shapes`: If true, adds an "_output_shapes" list attr to each - node with the inferred shapes of each of its outputs. - -##### Returns: - - A [`GraphDef`](https://www.tensorflow.org/code/tensorflow/core/framework/graph.proto) - protocol buffer. - -##### Raises: - - -* `ValueError`: If the `graph_def` would be too large. - - -- - - - -#### `tf.Graph.finalize()` {#Graph.finalize} - -Finalizes this graph, making it read-only. - -After calling `g.finalize()`, no new operations can be added to -`g`. This method is used to ensure that no operations are added -to a graph when it is shared between multiple threads, for example -when using a [`QueueRunner`](../../api_docs/python/train.md#QueueRunner). - - -- - - - -#### `tf.Graph.finalized` {#Graph.finalized} - -True if this graph has been finalized. - - - -- - - - -#### `tf.Graph.control_dependencies(control_inputs)` {#Graph.control_dependencies} - -Returns a context manager that specifies control dependencies. - -Use with the `with` keyword to specify that all operations constructed -within the context should have control dependencies on -`control_inputs`. For example: - -```python -with g.control_dependencies([a, b, c]): - # `d` and `e` will only run after `a`, `b`, and `c` have executed. - d = ... - e = ... -``` - -Multiple calls to `control_dependencies()` can be nested, and in -that case a new `Operation` will have control dependencies on the union -of `control_inputs` from all active contexts. - -```python -with g.control_dependencies([a, b]): - # Ops constructed here run after `a` and `b`. - with g.control_dependencies([c, d]): - # Ops constructed here run after `a`, `b`, `c`, and `d`. -``` - -You can pass None to clear the control dependencies: - -```python -with g.control_dependencies([a, b]): - # Ops constructed here run after `a` and `b`. - with g.control_dependencies(None): - # Ops constructed here run normally, not waiting for either `a` or `b`. - with g.control_dependencies([c, d]): - # Ops constructed here run after `c` and `d`, also not waiting - # for either `a` or `b`. -``` - -*N.B.* The control dependencies context applies *only* to ops that -are constructed within the context. Merely using an op or tensor -in the context does not add a control dependency. The following -example illustrates this point: - -```python -# WRONG -def my_func(pred, tensor): - t = tf.matmul(tensor, tensor) - with tf.control_dependencies([pred]): - # The matmul op is created outside the context, so no control - # dependency will be added. - return t - -# RIGHT -def my_func(pred, tensor): - with tf.control_dependencies([pred]): - # The matmul op is created in the context, so a control dependency - # will be added. - return tf.matmul(tensor, tensor) -``` - -##### Args: - - -* `control_inputs`: A list of `Operation` or `Tensor` objects which - must be executed or computed before running the operations - defined in the context. Can also be `None` to clear the control - dependencies. - -##### Returns: - - A context manager that specifies control dependencies for all - operations constructed within the context. - -##### Raises: - - -* `TypeError`: If `control_inputs` is not a list of `Operation` or - `Tensor` objects. - - -- - - - -#### `tf.Graph.device(device_name_or_function)` {#Graph.device} - -Returns a context manager that specifies the default device to use. - -The `device_name_or_function` argument may either be a device name -string, a device function, or None: - -* If it is a device name string, all operations constructed in - this context will be assigned to the device with that name, unless - overridden by a nested `device()` context. -* If it is a function, it will be treated as a function from - Operation objects to device name strings, and invoked each time - a new Operation is created. The Operation will be assigned to - the device with the returned name. -* If it is None, all `device()` invocations from the enclosing context - will be ignored. - -For information about the valid syntax of device name strings, see -the documentation in -[`DeviceNameUtils`](https://www.tensorflow.org/code/tensorflow/core/util/device_name_utils.h). - -For example: - -```python -with g.device('/gpu:0'): - # All operations constructed in this context will be placed - # on GPU 0. - with g.device(None): - # All operations constructed in this context will have no - # assigned device. - -# Defines a function from `Operation` to device string. -def matmul_on_gpu(n): - if n.type == "MatMul": - return "/gpu:0" - else: - return "/cpu:0" - -with g.device(matmul_on_gpu): - # All operations of type "MatMul" constructed in this context - # will be placed on GPU 0; all other operations will be placed - # on CPU 0. -``` - -**N.B.** The device scope may be overridden by op wrappers or -other library code. For example, a variable assignment op -`v.assign()` must be colocated with the `tf.Variable` `v`, and -incompatible device scopes will be ignored. - -##### Args: - - -* `device_name_or_function`: The device name or function to use in - the context. - -##### Returns: - - A context manager that specifies the default device to use for newly - created ops. - - -- - - - -#### `tf.Graph.name_scope(name)` {#Graph.name_scope} - -Returns a context manager that creates hierarchical names for operations. - -A graph maintains a stack of name scopes. A `with name_scope(...):` -statement pushes a new name onto the stack for the lifetime of the context. - -The `name` argument will be interpreted as follows: - -* A string (not ending with '/') will create a new name scope, in which - `name` is appended to the prefix of all operations created in the - context. If `name` has been used before, it will be made unique by - calling `self.unique_name(name)`. -* A scope previously captured from a `with g.name_scope(...) as - scope:` statement will be treated as an "absolute" name scope, which - makes it possible to re-enter existing scopes. -* A value of `None` or the empty string will reset the current name scope - to the top-level (empty) name scope. - -For example: - -```python -with tf.Graph().as_default() as g: - c = tf.constant(5.0, name="c") - assert c.op.name == "c" - c_1 = tf.constant(6.0, name="c") - assert c_1.op.name == "c_1" - - # Creates a scope called "nested" - with g.name_scope("nested") as scope: - nested_c = tf.constant(10.0, name="c") - assert nested_c.op.name == "nested/c" - - # Creates a nested scope called "inner". - with g.name_scope("inner"): - nested_inner_c = tf.constant(20.0, name="c") - assert nested_inner_c.op.name == "nested/inner/c" - - # Create a nested scope called "inner_1". - with g.name_scope("inner"): - nested_inner_1_c = tf.constant(30.0, name="c") - assert nested_inner_1_c.op.name == "nested/inner_1/c" - - # Treats `scope` as an absolute name scope, and - # switches to the "nested/" scope. - with g.name_scope(scope): - nested_d = tf.constant(40.0, name="d") - assert nested_d.op.name == "nested/d" - - with g.name_scope(""): - e = tf.constant(50.0, name="e") - assert e.op.name == "e" -``` - -The name of the scope itself can be captured by `with -g.name_scope(...) as scope:`, which stores the name of the scope -in the variable `scope`. This value can be used to name an -operation that represents the overall result of executing the ops -in a scope. For example: - -```python -inputs = tf.constant(...) -with g.name_scope('my_layer') as scope: - weights = tf.Variable(..., name="weights") - biases = tf.Variable(..., name="biases") - affine = tf.matmul(inputs, weights) + biases - output = tf.nn.relu(affine, name=scope) -``` - -NOTE: This constructor validates the given `name`. Valid scope -names match one of the following regular expressions: - - [A-Za-z0-9.][A-Za-z0-9_.\\-/]* (for scopes at the root) - [A-Za-z0-9_.\\-/]* (for other scopes) - -##### Args: - - -* `name`: A name for the scope. - -##### Returns: - - A context manager that installs `name` as a new name scope. - -##### Raises: - - -* `ValueError`: If `name` is not a valid scope name, according to the rules - above. - - - -A `Graph` instance supports an arbitrary number of "collections" -that are identified by name. For convenience when building a large -graph, collections can store groups of related objects: for -example, the `tf.Variable` uses a collection (named -[`tf.GraphKeys.GLOBAL_VARIABLES`](../../api_docs/python/framework.md#GraphKeys)) for -all variables that are created during the construction of a graph. The caller -may define additional collections by specifying a new name. - -- - - - -#### `tf.Graph.add_to_collection(name, value)` {#Graph.add_to_collection} - -Stores `value` in the collection with the given `name`. - -Note that collections are not sets, so it is possible to add a value to -a collection several times. - -##### Args: - - -* `name`: The key for the collection. The `GraphKeys` class - contains many standard names for collections. -* `value`: The value to add to the collection. - - -- - - - -#### `tf.Graph.add_to_collections(names, value)` {#Graph.add_to_collections} - -Stores `value` in the collections given by `names`. - -Note that collections are not sets, so it is possible to add a value to -a collection several times. This function makes sure that duplicates in -`names` are ignored, but it will not check for pre-existing membership of -`value` in any of the collections in `names`. - -`names` can be any iterable, but if `names` is a string, it is treated as a -single collection name. - -##### Args: - - -* `names`: The keys for the collections to add to. The `GraphKeys` class - contains many standard names for collections. -* `value`: The value to add to the collections. - - -- - - - -#### `tf.Graph.get_collection(name, scope=None)` {#Graph.get_collection} - -Returns a list of values in the collection with the given `name`. - -This is different from `get_collection_ref()` which always returns the -actual collection list if it exists in that it returns a new list each time -it is called. - -##### Args: - - -* `name`: The key for the collection. For example, the `GraphKeys` class - contains many standard names for collections. -* `scope`: (Optional.) If supplied, the resulting list is filtered to include - only items whose `name` attribute matches using `re.match`. Items - without a `name` attribute are never returned if a scope is supplied and - the choice or `re.match` means that a `scope` without special tokens - filters by prefix. - -##### Returns: - - The list of values in the collection with the given `name`, or - an empty list if no value has been added to that collection. The - list contains the values in the order under which they were - collected. - - -- - - - -#### `tf.Graph.get_collection_ref(name)` {#Graph.get_collection_ref} - -Returns a list of values in the collection with the given `name`. - -If the collection exists, this returns the list itself, which can -be modified in place to change the collection. If the collection does -not exist, it is created as an empty list and the list is returned. - -This is different from `get_collection()` which always returns a copy of -the collection list if it exists and never creates an empty collection. - -##### Args: - - -* `name`: The key for the collection. For example, the `GraphKeys` class - contains many standard names for collections. - -##### Returns: - - The list of values in the collection with the given `name`, or an empty - list if no value has been added to that collection. - - - -- - - - -#### `tf.Graph.as_graph_element(obj, allow_tensor=True, allow_operation=True)` {#Graph.as_graph_element} - -Returns the object referred to by `obj`, as an `Operation` or `Tensor`. - -This function validates that `obj` represents an element of this -graph, and gives an informative error message if it is not. - -This function is the canonical way to get/validate an object of -one of the allowed types from an external argument reference in the -Session API. - -This method may be called concurrently from multiple threads. - -##### Args: - - -* `obj`: A `Tensor`, an `Operation`, or the name of a tensor or operation. - Can also be any object with an `_as_graph_element()` method that returns - a value of one of these types. -* `allow_tensor`: If true, `obj` may refer to a `Tensor`. -* `allow_operation`: If true, `obj` may refer to an `Operation`. - -##### Returns: - - The `Tensor` or `Operation` in the Graph corresponding to `obj`. - -##### Raises: - - -* `TypeError`: If `obj` is not a type we support attempting to convert - to types. -* `ValueError`: If `obj` is of an appropriate type but invalid. For - example, an invalid string. -* `KeyError`: If `obj` is not an object in the graph. - - -- - - - -#### `tf.Graph.get_operation_by_name(name)` {#Graph.get_operation_by_name} - -Returns the `Operation` with the given `name`. - -This method may be called concurrently from multiple threads. - -##### Args: - - -* `name`: The name of the `Operation` to return. - -##### Returns: - - The `Operation` with the given `name`. - -##### Raises: - - -* `TypeError`: If `name` is not a string. -* `KeyError`: If `name` does not correspond to an operation in this graph. - - -- - - - -#### `tf.Graph.get_tensor_by_name(name)` {#Graph.get_tensor_by_name} - -Returns the `Tensor` with the given `name`. - -This method may be called concurrently from multiple threads. - -##### Args: - - -* `name`: The name of the `Tensor` to return. - -##### Returns: - - The `Tensor` with the given `name`. - -##### Raises: - - -* `TypeError`: If `name` is not a string. -* `KeyError`: If `name` does not correspond to a tensor in this graph. - - -- - - - -#### `tf.Graph.get_operations()` {#Graph.get_operations} - -Return the list of operations in the graph. - -You can modify the operations in place, but modifications -to the list such as inserts/delete have no effect on the -list of operations known to the graph. - -This method may be called concurrently from multiple threads. - -##### Returns: - - A list of Operations. - - - -- - - - -#### `tf.Graph.seed` {#Graph.seed} - -The graph-level random seed of this graph. - - -- - - - -#### `tf.Graph.unique_name(name, mark_as_used=True)` {#Graph.unique_name} - -Return a unique operation name for `name`. - -Note: You rarely need to call `unique_name()` directly. Most of -the time you just need to create `with g.name_scope()` blocks to -generate structured names. - -`unique_name` is used to generate structured names, separated by -`"/"`, to help identify operations when debugging a graph. -Operation names are displayed in error messages reported by the -TensorFlow runtime, and in various visualization tools such as -TensorBoard. - -If `mark_as_used` is set to `True`, which is the default, a new -unique name is created and marked as in use. If it's set to `False`, -the unique name is returned without actually being marked as used. -This is useful when the caller simply wants to know what the name -to be created will be. - -##### Args: - - -* `name`: The name for an operation. -* `mark_as_used`: Whether to mark this name as being used. - -##### Returns: - - A string to be passed to `create_op()` that will be used - to name the operation being created. - - -- - - - -#### `tf.Graph.version` {#Graph.version} - -Returns a version number that increases as ops are added to the graph. - -Note that this is unrelated to the -[GraphDef version](#Graph.graph_def_version). - - -- - - - -#### `tf.Graph.graph_def_versions` {#Graph.graph_def_versions} - -The GraphDef version information of this graph. - -For details on the meaning of each version, see -[`GraphDef`](https://www.tensorflow.org/code/tensorflow/core/framework/graph.proto). - -##### Returns: - - A `VersionDef`. - - - -- - - - -#### `tf.Graph.create_op(op_type, inputs, dtypes, input_types=None, name=None, attrs=None, op_def=None, compute_shapes=True, compute_device=True)` {#Graph.create_op} - -Creates an `Operation` in this graph. - -This is a low-level interface for creating an `Operation`. Most -programs will not call this method directly, and instead use the -Python op constructors, such as `tf.constant()`, which add ops to -the default graph. - -##### Args: - - -* `op_type`: The `Operation` type to create. This corresponds to the - `OpDef.name` field for the proto that defines the operation. -* `inputs`: A list of `Tensor` objects that will be inputs to the `Operation`. -* `dtypes`: A list of `DType` objects that will be the types of the tensors - that the operation produces. -* `input_types`: (Optional.) A list of `DType`s that will be the types of - the tensors that the operation consumes. By default, uses the base - `DType` of each input in `inputs`. Operations that expect - reference-typed inputs must specify `input_types` explicitly. -* `name`: (Optional.) A string name for the operation. If not specified, a - name is generated based on `op_type`. -* `attrs`: (Optional.) A dictionary where the key is the attribute name (a - string) and the value is the respective `attr` attribute of the - `NodeDef` proto that will represent the operation (an `AttrValue` - proto). -* `op_def`: (Optional.) The `OpDef` proto that describes the `op_type` that - the operation will have. -* `compute_shapes`: (Optional.) If True, shape inference will be performed - to compute the shapes of the outputs. -* `compute_device`: (Optional.) If True, device functions will be executed - to compute the device property of the Operation. - -##### Raises: - - -* `TypeError`: if any of the inputs is not a `Tensor`. -* `ValueError`: if colocation conflicts with existing device assignment. - -##### Returns: - - An `Operation` object. - - -- - - - -#### `tf.Graph.gradient_override_map(op_type_map)` {#Graph.gradient_override_map} - -EXPERIMENTAL: A context manager for overriding gradient functions. - -This context manager can be used to override the gradient function -that will be used for ops within the scope of the context. - -For example: - -```python -@tf.RegisterGradient("CustomSquare") -def _custom_square_grad(op, grad): - # ... - -with tf.Graph().as_default() as g: - c = tf.constant(5.0) - s_1 = tf.square(c) # Uses the default gradient for tf.square. - with g.gradient_override_map({"Square": "CustomSquare"}): - s_2 = tf.square(s_2) # Uses _custom_square_grad to compute the - # gradient of s_2. -``` - -##### Args: - - -* `op_type_map`: A dictionary mapping op type strings to alternative op - type strings. - -##### Returns: - - A context manager that sets the alternative op type to be used for one - or more ops created in that context. - -##### Raises: - - -* `TypeError`: If `op_type_map` is not a dictionary mapping strings to - strings. - - - -#### Other Methods -- - - - -#### `tf.Graph.building_function` {#Graph.building_function} - -Returns True iff this graph represents a function. - - -- - - - -#### `tf.Graph.clear_collection(name)` {#Graph.clear_collection} - -Clears all values in a collection. - -##### Args: - - -* `name`: The key for the collection. The `GraphKeys` class contains many - standard names for collections. - - -- - - - -#### `tf.Graph.colocate_with(op, ignore_existing=False)` {#Graph.colocate_with} - -Returns a context manager that specifies an op to colocate with. - -Note: this function is not for public use, only for internal libraries. - -For example: - -```python -a = tf.Variable([1.0]) -with g.colocate_with(a): - b = tf.constant(1.0) - c = tf.add(a, b) -``` - -`b` and `c` will always be colocated with `a`, no matter where `a` -is eventually placed. - -**NOTE** Using a colocation scope resets any existing device constraints. - -If `op` is `None` then `ignore_existing` must be `True` and the new -scope resets all colocation and device constraints. - -##### Args: - - -* `op`: The op to colocate all created ops with, or `None`. -* `ignore_existing`: If true, only applies colocation of this op within - the context, rather than applying all colocation properties - on the stack. If `op` is `None`, this value must be `True`. - -##### Raises: - - -* `ValueError`: if op is None but ignore_existing is False. - -##### Yields: - - A context manager that specifies the op with which to colocate - newly created ops. - - -- - - - -#### `tf.Graph.container(container_name)` {#Graph.container} - -Returns a context manager that specifies the resource container to use. - -Stateful operations, such as variables and queues, can maintain their -states on devices so that they can be shared by multiple processes. -A resource container is a string name under which these stateful -operations are tracked. These resources can be released or cleared -with `tf.Session.reset()`. - -For example: - -```python -with g.container('experiment0'): - # All stateful Operations constructed in this context will be placed - # in resource container "experiment0". - v1 = tf.Variable([1.0]) - v2 = tf.Variable([2.0]) - with g.container("experiment1"): - # All stateful Operations constructed in this context will be - # placed in resource container "experiment1". - v3 = tf.Variable([3.0]) - q1 = tf.FIFOQueue(10, tf.float32) - # All stateful Operations constructed in this context will be - # be created in the "experiment0". - v4 = tf.Variable([4.0]) - q1 = tf.FIFOQueue(20, tf.float32) - with g.container(""): - # All stateful Operations constructed in this context will be - # be placed in the default resource container. - v5 = tf.Variable([5.0]) - q3 = tf.FIFOQueue(30, tf.float32) - -# Resets container "experiment0", after which the state of v1, v2, v4, q1 -# will become undefined (such as uninitialized). -tf.Session.reset(target, ["experiment0"]) -``` - -##### Args: - - -* `container_name`: container name string. - -##### Returns: - - A context manager for defining resource containers for stateful ops, - yields the container name. - - -- - - - -#### `tf.Graph.get_all_collection_keys()` {#Graph.get_all_collection_keys} - -Returns a list of collections used in this graph. - - -- - - - -#### `tf.Graph.is_feedable(tensor)` {#Graph.is_feedable} - -Returns `True` if and only if `tensor` is feedable. - - -- - - - -#### `tf.Graph.is_fetchable(tensor_or_op)` {#Graph.is_fetchable} - -Returns `True` if and only if `tensor_or_op` is fetchable. - - -- - - - -#### `tf.Graph.prevent_feeding(tensor)` {#Graph.prevent_feeding} - -Marks the given `tensor` as unfeedable in this graph. - - -- - - - -#### `tf.Graph.prevent_fetching(op)` {#Graph.prevent_fetching} - -Marks the given `op` as unfetchable in this graph. - - - -- - - - -### `class tf.Operation` {#Operation} - -Represents a graph node that performs computation on tensors. - -An `Operation` is a node in a TensorFlow `Graph` that takes zero or -more `Tensor` objects as input, and produces zero or more `Tensor` -objects as output. Objects of type `Operation` are created by -calling a Python op constructor (such as -[`tf.matmul()`](../../api_docs/python/math_ops.md#matmul)) -or [`Graph.create_op()`](../../api_docs/python/framework.md#Graph.create_op). - -For example `c = tf.matmul(a, b)` creates an `Operation` of type -"MatMul" that takes tensors `a` and `b` as input, and produces `c` -as output. - -After the graph has been launched in a session, an `Operation` can -be executed by passing it to -[`Session.run()`](../../api_docs/python/client.md#Session.run). -`op.run()` is a shortcut for calling `tf.get_default_session().run(op)`. -- - - - -#### `tf.Operation.__init__(node_def, g, inputs=None, output_types=None, control_inputs=None, input_types=None, original_op=None, op_def=None)` {#Operation.__init__} - -Creates an `Operation`. - -NOTE: This constructor validates the name of the `Operation` (passed -as `node_def.name`). Valid `Operation` names match the following -regular expression: - - [A-Za-z0-9.][A-Za-z0-9_.\\-/]* - -##### Args: - - -* `node_def`: `node_def_pb2.NodeDef`. `NodeDef` for the `Operation`. - Used for attributes of `node_def_pb2.NodeDef`, typically `name`, - `op`, and `device`. The `input` attribute is irrelevant here - as it will be computed when generating the model. -* `g`: `Graph`. The parent graph. -* `inputs`: list of `Tensor` objects. The inputs to this `Operation`. -* `output_types`: list of `DType` objects. List of the types of the - `Tensors` computed by this operation. The length of this list indicates - the number of output endpoints of the `Operation`. -* `control_inputs`: list of operations or tensors from which to have a - control dependency. -* `input_types`: List of `DType` objects representing the - types of the tensors accepted by the `Operation`. By default - uses `[x.dtype.base_dtype for x in inputs]`. Operations that expect - reference-typed inputs must specify these explicitly. -* `original_op`: Optional. Used to associate the new `Operation` with an - existing `Operation` (for example, a replica with the op that was - replicated). -* `op_def`: Optional. The `op_def_pb2.OpDef` proto that describes the - op type that this `Operation` represents. - -##### Raises: - - -* `TypeError`: if control inputs are not Operations or Tensors, - or if `node_def` is not a `NodeDef`, - or if `g` is not a `Graph`, - or if `inputs` are not tensors, - or if `inputs` and `input_types` are incompatible. -* `ValueError`: if the `node_def` name is not valid. - - -- - - - -#### `tf.Operation.__repr__()` {#Operation.__repr__} - - - - -- - - - -#### `tf.Operation.__str__()` {#Operation.__str__} - - - - -- - - - -#### `tf.Operation.colocation_groups()` {#Operation.colocation_groups} - -Returns the list of colocation groups of the op. - - -- - - - -#### `tf.Operation.control_inputs` {#Operation.control_inputs} - -The `Operation` objects on which this op has a control dependency. - -Before this op is executed, TensorFlow will ensure that the -operations in `self.control_inputs` have finished executing. This -mechanism can be used to run ops sequentially for performance -reasons, or to ensure that the side effects of an op are observed -in the correct order. - -##### Returns: - - A list of `Operation` objects. - - -- - - - -#### `tf.Operation.device` {#Operation.device} - -The name of the device to which this op has been assigned, if any. - -##### Returns: - - The string name of the device to which this op has been - assigned, or an empty string if it has not been assigned to a - device. - - -- - - - -#### `tf.Operation.get_attr(name)` {#Operation.get_attr} - -Returns the value of the attr of this op with the given `name`. - -##### Args: - - -* `name`: The name of the attr to fetch. - -##### Returns: - - The value of the attr, as a Python object. - -##### Raises: - - -* `ValueError`: If this op does not have an attr with the given `name`. - - -- - - - -#### `tf.Operation.graph` {#Operation.graph} - -The `Graph` that contains this operation. - - -- - - - -#### `tf.Operation.inputs` {#Operation.inputs} - -The list of `Tensor` objects representing the data inputs of this op. - - -- - - - -#### `tf.Operation.name` {#Operation.name} - -The full name of this operation. - - -- - - - -#### `tf.Operation.node_def` {#Operation.node_def} - -Returns a serialized `NodeDef` representation of this operation. - -##### Returns: - - A - [`NodeDef`](https://www.tensorflow.org/code/tensorflow/core/framework/node_def.proto) - protocol buffer. - - -- - - - -#### `tf.Operation.op_def` {#Operation.op_def} - -Returns the `OpDef` proto that represents the type of this op. - -##### Returns: - - An - [`OpDef`](https://www.tensorflow.org/code/tensorflow/core/framework/op_def.proto) - protocol buffer. - - -- - - - -#### `tf.Operation.outputs` {#Operation.outputs} - -The list of `Tensor` objects representing the outputs of this op. - - -- - - - -#### `tf.Operation.run(feed_dict=None, session=None)` {#Operation.run} - -Runs this operation in a `Session`. - -Calling this method will execute all preceding operations that -produce the inputs needed for this operation. - -*N.B.* Before invoking `Operation.run()`, its graph must have been -launched in a session, and either a default session must be -available, or `session` must be specified explicitly. - -##### Args: - - -* `feed_dict`: A dictionary that maps `Tensor` objects to feed values. - See [`Session.run()`](../../api_docs/python/client.md#Session.run) - for a description of the valid feed values. -* `session`: (Optional.) The `Session` to be used to run to this operation. If - none, the default session will be used. - - -- - - - -#### `tf.Operation.traceback` {#Operation.traceback} - -Returns the call stack from when this operation was constructed. - - -- - - - -#### `tf.Operation.type` {#Operation.type} - -The type of the op (e.g. `"MatMul"`). - - -- - - - -#### `tf.Operation.values()` {#Operation.values} - -DEPRECATED: Use outputs. - - - -- - - - -### `class tf.Tensor` {#Tensor} - -Represents one of the outputs of an `Operation`. - -A `Tensor` is a symbolic handle to one of the outputs of an -`Operation`. It does not hold the values of that operation's output, -but instead provides a means of computing those values in a -TensorFlow [`Session`](../../api_docs/python/client.md#Session). - -This class has two primary purposes: - -1. A `Tensor` can be passed as an input to another `Operation`. - This builds a dataflow connection between operations, which - enables TensorFlow to execute an entire `Graph` that represents a - large, multi-step computation. - -2. After the graph has been launched in a session, the value of the - `Tensor` can be computed by passing it to - [`Session.run()`](../../api_docs/python/client.md#Session.run). - `t.eval()` is a shortcut for calling - `tf.get_default_session().run(t)`. - -In the following example, `c`, `d`, and `e` are symbolic `Tensor` -objects, whereas `result` is a numpy array that stores a concrete -value: - -```python -# Build a dataflow graph. -c = tf.constant([[1.0, 2.0], [3.0, 4.0]]) -d = tf.constant([[1.0, 1.0], [0.0, 1.0]]) -e = tf.matmul(c, d) - -# Construct a `Session` to execute the graph. -sess = tf.Session() - -# Execute the graph and store the value that `e` represents in `result`. -result = sess.run(e) -``` -- - - - -#### `tf.Tensor.__abs__(x, name=None)` {#Tensor.__abs__} - -Computes the absolute value of a tensor. - -Given a tensor of real numbers `x`, this operation returns a tensor -containing the absolute value of each element in `x`. For example, if x is -an input element and y is an output element, this operation computes -\\(y = |x|\\). - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor` of type `float32`, `float64`, `int32`, or - `int64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` the same size and type as `x` with absolute - values. - - -- - - - -#### `tf.Tensor.__add__(x, y)` {#Tensor.__add__} - -Returns x + y element-wise. - -*NOTE*: `Add` supports broadcasting. `AddN` does not. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`, `complex64`, `complex128`, `string`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Tensor.__and__(x, y)` {#Tensor.__and__} - -Returns the truth value of x AND y element-wise. - -*NOTE*: `LogicalAnd` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__bool__()` {#Tensor.__bool__} - -Dummy method to prevent a tensor from being used as a Python `bool`. - -This overload raises a `TypeError` when the user inadvertently -treats a `Tensor` as a boolean (e.g. in an `if` statement). For -example: - -```python -if tf.constant(True): # Will raise. - # ... - -if tf.constant(5) < tf.constant(7): # Will raise. - # ... -``` - -This disallows ambiguities between testing the Python value vs testing the -dynamic condition of the `Tensor`. - -##### Raises: - - `TypeError`. - - -- - - - -#### `tf.Tensor.__div__(x, y)` {#Tensor.__div__} - -Divide two values using Python 2 semantics. Used for Tensor.__div__. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` returns the quotient of x and y. - - -- - - - -#### `tf.Tensor.__eq__(other)` {#Tensor.__eq__} - - - - -- - - - -#### `tf.Tensor.__floordiv__(x, y)` {#Tensor.__floordiv__} - -Divides `x / y` elementwise, rounding toward the most negative integer. - -The same as `tf.div(x,y)` for integers, but uses `tf.floor(tf.div(x,y))` for -floating point arguments so that the result is always an integer (though -possibly an integer represented as floating point). This op is generated by -`x // y` floor division in Python 3 and in Python 2.7 with -`from __future__ import division`. - -Note that for efficiency, `floordiv` uses C semantics for negative numbers -(unlike Python and Numpy). - -`x` and `y` must have the same type, and the result will have the same type -as well. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` rounded down (except possibly towards zero for negative integers). - -##### Raises: - - -* `TypeError`: If the inputs are complex. - - -- - - - -#### `tf.Tensor.__ge__(x, y, name=None)` {#Tensor.__ge__} - -Returns the truth value of (x >= y) element-wise. - -*NOTE*: `GreaterEqual` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__getitem__(tensor, slice_spec, var=None)` {#Tensor.__getitem__} - -Overload for Tensor.__getitem__. - -This operation extracts the specified region from the tensor. -The notation is similar to NumPy with the restriction that -currently only support basic indexing. That means that -using a tensor as input is not currently allowed - -Some useful examples: - -```python -# strip leading and trailing 2 elements -foo = tf.constant([1,2,3,4,5,6]) -print(foo[2:-2].eval()) # => [3,4] - -# skip every row and reverse every column -foo = tf.constant([[1,2,3], [4,5,6], [7,8,9]]) -print(foo[::2,::-1].eval()) # => [[3,2,1], [9,8,7]] - -# Insert another dimension -foo = tf.constant([[1,2,3], [4,5,6], [7,8,9]]) -print(foo[tf.newaxis, :, :].eval()) # => [[[3,2,1], [9,8,7]]] -print(foo[:, tf.newaxis, :].eval()) # => [[[3,2,1]], [[9,8,7]]] -print(foo[:, :, tf.newaxis].eval()) # => [[[3],[2],[1]], [[9],[8],[7]]] - -# Ellipses (3 equivalent operations) -print(foo[tf.newaxis, :, :].eval()) # => [[[3,2,1], [9,8,7]]] -print(foo[tf.newaxis, ...].eval()) # => [[[3,2,1], [9,8,7]]] -print(foo[tf.newaxis].eval()) # => [[[3,2,1], [9,8,7]]] -``` - -##### Notes: - - - `tf.newaxis` is `None` as in NumPy. - - An implicit ellipsis is placed at the end of the `slice_spec` - - NumPy advanced indexing is currently not supported. - -##### Args: - - -* `tensor`: An ops.Tensor object. -* `slice_spec`: The arguments to Tensor.__getitem__. -* `var`: In the case of variable slice assignment, the Variable - object to slice (i.e. tensor is the read-only view of this - variable). - -##### Returns: - - The appropriate slice of "tensor", based on "slice_spec". - -##### Raises: - - -* `ValueError`: If a slice range is negative size. -* `TypeError`: If the slice indices aren't int, slice, or Ellipsis. - - -- - - - -#### `tf.Tensor.__gt__(x, y, name=None)` {#Tensor.__gt__} - -Returns the truth value of (x > y) element-wise. - -*NOTE*: `Greater` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__hash__()` {#Tensor.__hash__} - - - - -- - - - -#### `tf.Tensor.__init__(op, value_index, dtype)` {#Tensor.__init__} - -Creates a new `Tensor`. - -##### Args: - - -* `op`: An `Operation`. `Operation` that computes this tensor. -* `value_index`: An `int`. Index of the operation's endpoint that produces - this tensor. -* `dtype`: A `DType`. Type of elements stored in this tensor. - -##### Raises: - - -* `TypeError`: If the op is not an `Operation`. - - -- - - - -#### `tf.Tensor.__invert__(x, name=None)` {#Tensor.__invert__} - -Returns the truth value of NOT x element-wise. - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__iter__()` {#Tensor.__iter__} - -Dummy method to prevent iteration. Do not call. - -NOTE(mrry): If we register __getitem__ as an overloaded operator, -Python will valiantly attempt to iterate over the Tensor from 0 to -infinity. Declaring this method prevents this unintended -behavior. - -##### Raises: - - -* `TypeError`: when invoked. - - -- - - - -#### `tf.Tensor.__le__(x, y, name=None)` {#Tensor.__le__} - -Returns the truth value of (x <= y) element-wise. - -*NOTE*: `LessEqual` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__lt__(x, y, name=None)` {#Tensor.__lt__} - -Returns the truth value of (x < y) element-wise. - -*NOTE*: `Less` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__mod__(x, y)` {#Tensor.__mod__} - -Returns element-wise remainder of division. When `x < 0` xor `y < 0` is - -true, this follows Python semantics in that the result here is consistent -with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. - -*NOTE*: `FloorMod` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `float32`, `float64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Tensor.__mul__(x, y)` {#Tensor.__mul__} - -Dispatches cwise mul for "Dense*Dense" and "Dense*Sparse". - - -- - - - -#### `tf.Tensor.__neg__(x, name=None)` {#Tensor.__neg__} - -Computes numerical negative value element-wise. - -I.e., \\(y = -x\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Tensor.__nonzero__()` {#Tensor.__nonzero__} - -Dummy method to prevent a tensor from being used as a Python `bool`. - -This is the Python 2.x counterpart to `__bool__()` above. - -##### Raises: - - `TypeError`. - - -- - - - -#### `tf.Tensor.__or__(x, y)` {#Tensor.__or__} - -Returns the truth value of x OR y element-wise. - -*NOTE*: `LogicalOr` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__pow__(x, y)` {#Tensor.__pow__} - -Computes the power of one value to another. - -Given a tensor `x` and a tensor `y`, this operation computes \\(x^y\\) for -corresponding elements in `x` and `y`. For example: - -``` -# tensor 'x' is [[2, 2], [3, 3]] -# tensor 'y' is [[8, 16], [2, 3]] -tf.pow(x, y) ==> [[256, 65536], [9, 27]] -``` - -##### Args: - - -* `x`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `y`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. - - -- - - - -#### `tf.Tensor.__radd__(y, x)` {#Tensor.__radd__} - -Returns x + y element-wise. - -*NOTE*: `Add` supports broadcasting. `AddN` does not. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`, `complex64`, `complex128`, `string`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Tensor.__rand__(y, x)` {#Tensor.__rand__} - -Returns the truth value of x AND y element-wise. - -*NOTE*: `LogicalAnd` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__rdiv__(y, x)` {#Tensor.__rdiv__} - -Divide two values using Python 2 semantics. Used for Tensor.__div__. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` returns the quotient of x and y. - - -- - - - -#### `tf.Tensor.__repr__()` {#Tensor.__repr__} - - - - -- - - - -#### `tf.Tensor.__rfloordiv__(y, x)` {#Tensor.__rfloordiv__} - -Divides `x / y` elementwise, rounding toward the most negative integer. - -The same as `tf.div(x,y)` for integers, but uses `tf.floor(tf.div(x,y))` for -floating point arguments so that the result is always an integer (though -possibly an integer represented as floating point). This op is generated by -`x // y` floor division in Python 3 and in Python 2.7 with -`from __future__ import division`. - -Note that for efficiency, `floordiv` uses C semantics for negative numbers -(unlike Python and Numpy). - -`x` and `y` must have the same type, and the result will have the same type -as well. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` rounded down (except possibly towards zero for negative integers). - -##### Raises: - - -* `TypeError`: If the inputs are complex. - - -- - - - -#### `tf.Tensor.__rmod__(y, x)` {#Tensor.__rmod__} - -Returns element-wise remainder of division. When `x < 0` xor `y < 0` is - -true, this follows Python semantics in that the result here is consistent -with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. - -*NOTE*: `FloorMod` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `float32`, `float64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Tensor.__rmul__(y, x)` {#Tensor.__rmul__} - -Dispatches cwise mul for "Dense*Dense" and "Dense*Sparse". - - -- - - - -#### `tf.Tensor.__ror__(y, x)` {#Tensor.__ror__} - -Returns the truth value of x OR y element-wise. - -*NOTE*: `LogicalOr` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__rpow__(y, x)` {#Tensor.__rpow__} - -Computes the power of one value to another. - -Given a tensor `x` and a tensor `y`, this operation computes \\(x^y\\) for -corresponding elements in `x` and `y`. For example: - -``` -# tensor 'x' is [[2, 2], [3, 3]] -# tensor 'y' is [[8, 16], [2, 3]] -tf.pow(x, y) ==> [[256, 65536], [9, 27]] -``` - -##### Args: - - -* `x`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `y`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. - - -- - - - -#### `tf.Tensor.__rsub__(y, x)` {#Tensor.__rsub__} - -Returns x - y element-wise. - -*NOTE*: `Sub` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Tensor.__rtruediv__(y, x)` {#Tensor.__rtruediv__} - - - - -- - - - -#### `tf.Tensor.__rxor__(y, x)` {#Tensor.__rxor__} - -x ^ y = (x | y) & ~(x & y). - - -- - - - -#### `tf.Tensor.__str__()` {#Tensor.__str__} - - - - -- - - - -#### `tf.Tensor.__sub__(x, y)` {#Tensor.__sub__} - -Returns x - y element-wise. - -*NOTE*: `Sub` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Tensor.__truediv__(x, y)` {#Tensor.__truediv__} - - - - -- - - - -#### `tf.Tensor.__xor__(x, y)` {#Tensor.__xor__} - -x ^ y = (x | y) & ~(x & y). - - -- - - - -#### `tf.Tensor.consumers()` {#Tensor.consumers} - -Returns a list of `Operation`s that consume this tensor. - -##### Returns: - - A list of `Operation`s. - - -- - - - -#### `tf.Tensor.device` {#Tensor.device} - -The name of the device on which this tensor will be produced, or None. - - -- - - - -#### `tf.Tensor.dtype` {#Tensor.dtype} - -The `DType` of elements in this tensor. - - -- - - - -#### `tf.Tensor.eval(feed_dict=None, session=None)` {#Tensor.eval} - -Evaluates this tensor in a `Session`. - -Calling this method will execute all preceding operations that -produce the inputs needed for the operation that produces this -tensor. - -*N.B.* Before invoking `Tensor.eval()`, its graph must have been -launched in a session, and either a default session must be -available, or `session` must be specified explicitly. - -##### Args: - - -* `feed_dict`: A dictionary that maps `Tensor` objects to feed values. - See [`Session.run()`](../../api_docs/python/client.md#Session.run) for a - description of the valid feed values. -* `session`: (Optional.) The `Session` to be used to evaluate this tensor. If - none, the default session will be used. - -##### Returns: - - A numpy array corresponding to the value of this tensor. - - -- - - - -#### `tf.Tensor.get_shape()` {#Tensor.get_shape} - -Alias of Tensor.shape. - - -- - - - -#### `tf.Tensor.graph` {#Tensor.graph} - -The `Graph` that contains this tensor. - - -- - - - -#### `tf.Tensor.name` {#Tensor.name} - -The string name of this tensor. - - -- - - - -#### `tf.Tensor.op` {#Tensor.op} - -The `Operation` that produces this tensor as an output. - - -- - - - -#### `tf.Tensor.set_shape(shape)` {#Tensor.set_shape} - -Updates the shape of this tensor. - -This method can be called multiple times, and will merge the given -`shape` with the current shape of this tensor. It can be used to -provide additional information about the shape of this tensor that -cannot be inferred from the graph alone. For example, this can be used -to provide additional information about the shapes of images: - -```python -_, image_data = tf.TFRecordReader(...).read(...) -image = tf.image.decode_png(image_data, channels=3) - -# The height and width dimensions of `image` are data dependent, and -# cannot be computed without executing the op. -print(image.shape) -==> TensorShape([Dimension(None), Dimension(None), Dimension(3)]) - -# We know that each image in this dataset is 28 x 28 pixels. -image.set_shape([28, 28, 3]) -print(image.shape) -==> TensorShape([Dimension(28), Dimension(28), Dimension(3)]) -``` - -##### Args: - - -* `shape`: A `TensorShape` representing the shape of this tensor. - -##### Raises: - - -* `ValueError`: If `shape` is not compatible with the current shape of - this tensor. - - -- - - - -#### `tf.Tensor.shape` {#Tensor.shape} - -Returns the `TensorShape` that represents the shape of this tensor. - -The shape is computed using shape inference functions that are -registered in the Op for each `Operation`. See -[`TensorShape`](../../api_docs/python/framework.md#TensorShape) -for more details of what a shape represents. - -The inferred shape of a tensor is used to provide shape -information without having to launch the graph in a session. This -can be used for debugging, and providing early error messages. For -example: - -```python -c = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]) - -print(c.shape) -==> TensorShape([Dimension(2), Dimension(3)]) - -d = tf.constant([[1.0, 0.0], [0.0, 1.0], [1.0, 0.0], [0.0, 1.0]]) - -print(d.shape) -==> TensorShape([Dimension(4), Dimension(2)]) - -# Raises a ValueError, because `c` and `d` do not have compatible -# inner dimensions. -e = tf.matmul(c, d) - -f = tf.matmul(c, d, transpose_a=True, transpose_b=True) - -print(f.shape) -==> TensorShape([Dimension(3), Dimension(4)]) -``` - -In some cases, the inferred shape may have unknown dimensions. If -the caller has additional information about the values of these -dimensions, `Tensor.set_shape()` can be used to augment the -inferred shape. - -##### Returns: - - A `TensorShape` representing the shape of this tensor. - - -- - - - -#### `tf.Tensor.value_index` {#Tensor.value_index} - -The index of this tensor in the outputs of its `Operation`. - - - - -## Tensor types - -- - - - -### `class tf.DType` {#DType} - -Represents the type of the elements in a `Tensor`. - -The following `DType` objects are defined: - -* `tf.float16`: 16-bit half-precision floating-point. -* `tf.float32`: 32-bit single-precision floating-point. -* `tf.float64`: 64-bit double-precision floating-point. -* `tf.bfloat16`: 16-bit truncated floating-point. -* `tf.complex64`: 64-bit single-precision complex. -* `tf.complex128`: 128-bit double-precision complex. -* `tf.int8`: 8-bit signed integer. -* `tf.uint8`: 8-bit unsigned integer. -* `tf.uint16`: 16-bit unsigned integer. -* `tf.int16`: 16-bit signed integer. -* `tf.int32`: 32-bit signed integer. -* `tf.int64`: 64-bit signed integer. -* `tf.bool`: Boolean. -* `tf.string`: String. -* `tf.qint8`: Quantized 8-bit signed integer. -* `tf.quint8`: Quantized 8-bit unsigned integer. -* `tf.qint16`: Quantized 16-bit signed integer. -* `tf.quint16`: Quantized 16-bit unsigned integer. -* `tf.qint32`: Quantized 32-bit signed integer. -* `tf.resource`: Handle to a mutable resource. - -In addition, variants of these types with the `_ref` suffix are -defined for reference-typed tensors. - -The `tf.as_dtype()` function converts numpy types and string type -names to a `DType` object. -- - - - -#### `tf.DType.__eq__(other)` {#DType.__eq__} - -Returns True iff this DType refers to the same type as `other`. - - -- - - - -#### `tf.DType.__hash__()` {#DType.__hash__} - - - - -- - - - -#### `tf.DType.__init__(type_enum)` {#DType.__init__} - -Creates a new `DataType`. - -NOTE(mrry): In normal circumstances, you should not need to -construct a `DataType` object directly. Instead, use the -`tf.as_dtype()` function. - -##### Args: - - -* `type_enum`: A `types_pb2.DataType` enum value. - -##### Raises: - - -* `TypeError`: If `type_enum` is not a value `types_pb2.DataType`. - - -- - - - -#### `tf.DType.__ne__(other)` {#DType.__ne__} - -Returns True iff self != other. - - -- - - - -#### `tf.DType.__repr__()` {#DType.__repr__} - - - - -- - - - -#### `tf.DType.__str__()` {#DType.__str__} - - - - -- - - - -#### `tf.DType.as_datatype_enum` {#DType.as_datatype_enum} - -Returns a `types_pb2.DataType` enum value based on this `DType`. - - -- - - - -#### `tf.DType.as_numpy_dtype` {#DType.as_numpy_dtype} - -Returns a `numpy.dtype` based on this `DType`. - - -- - - - -#### `tf.DType.base_dtype` {#DType.base_dtype} - -Returns a non-reference `DType` based on this `DType`. - - -- - - - -#### `tf.DType.is_bool` {#DType.is_bool} - -Returns whether this is a boolean data type - - -- - - - -#### `tf.DType.is_compatible_with(other)` {#DType.is_compatible_with} - -Returns True if the `other` DType will be converted to this DType. - -The conversion rules are as follows: - -```python -DType(T) .is_compatible_with(DType(T)) == True -DType(T) .is_compatible_with(DType(T).as_ref) == True -DType(T).as_ref.is_compatible_with(DType(T)) == False -DType(T).as_ref.is_compatible_with(DType(T).as_ref) == True -``` - -##### Args: - - -* `other`: A `DType` (or object that may be converted to a `DType`). - -##### Returns: - - True if a Tensor of the `other` `DType` will be implicitly converted to - this `DType`. - - -- - - - -#### `tf.DType.is_complex` {#DType.is_complex} - -Returns whether this is a complex floating point type. - - -- - - - -#### `tf.DType.is_floating` {#DType.is_floating} - -Returns whether this is a (non-quantized, real) floating point type. - - -- - - - -#### `tf.DType.is_integer` {#DType.is_integer} - -Returns whether this is a (non-quantized) integer type. - - -- - - - -#### `tf.DType.is_numpy_compatible` {#DType.is_numpy_compatible} - - - - -- - - - -#### `tf.DType.is_quantized` {#DType.is_quantized} - -Returns whether this is a quantized data type. - - -- - - - -#### `tf.DType.is_unsigned` {#DType.is_unsigned} - -Returns whether this type is unsigned. - -Non-numeric, unordered, and quantized types are not considered unsigned, and -this function returns `False`. - -##### Returns: - - Whether a `DType` is unsigned. - - -- - - - -#### `tf.DType.limits` {#DType.limits} - -Return intensity limits, i.e. (min, max) tuple, of the dtype. - -##### Args: - - clip_negative : bool, optional - If True, clip the negative range (i.e. return 0 for min intensity) - even if the image dtype allows negative values. -Returns - min, max : tuple - Lower and upper intensity limits. - - -- - - - -#### `tf.DType.max` {#DType.max} - -Returns the maximum representable value in this data type. - -##### Raises: - - -* `TypeError`: if this is a non-numeric, unordered, or quantized type. - - -- - - - -#### `tf.DType.min` {#DType.min} - -Returns the minimum representable value in this data type. - -##### Raises: - - -* `TypeError`: if this is a non-numeric, unordered, or quantized type. - - -- - - - -#### `tf.DType.name` {#DType.name} - -Returns the string name for this `DType`. - - -- - - - -#### `tf.DType.real_dtype` {#DType.real_dtype} - -Returns the dtype correspond to this dtype's real part. - - -- - - - -#### `tf.DType.size` {#DType.size} - - - - - -- - - - -### `tf.as_dtype(type_value)` {#as_dtype} - -Converts the given `type_value` to a `DType`. - -##### Args: - - -* `type_value`: A value that can be converted to a `tf.DType` - object. This may currently be a `tf.DType` object, a - [`DataType` enum](https://www.tensorflow.org/code/tensorflow/core/framework/types.proto), - a string type name, or a `numpy.dtype`. - -##### Returns: - - A `DType` corresponding to `type_value`. - -##### Raises: - - -* `TypeError`: If `type_value` cannot be converted to a `DType`. - - - -## Utility functions - -- - - - -### `tf.device(device_name_or_function)` {#device} - -Wrapper for `Graph.device()` using the default graph. - -See -[`Graph.device()`](../../api_docs/python/framework.md#Graph.device) -for more details. - -##### Args: - - -* `device_name_or_function`: The device name or function to use in - the context. - -##### Returns: - - A context manager that specifies the default device to use for newly - created ops. - - -- - - - -### `tf.container(container_name)` {#container} - -Wrapper for `Graph.container()` using the default graph. - -##### Args: - - -* `container_name`: The container string to use in the context. - -##### Returns: - - A context manager that specifies the default container to use for newly - created stateful ops. - - -- - - - -### `tf.name_scope(name, default_name=None, values=None)` {#name_scope} - -Returns a context manager for use when defining a Python op. - -This context manager validates that the given `values` are from the -same graph, makes that graph the default graph, and pushes a -name scope in that graph (see -[`Graph.name_scope()`](../../api_docs/python/framework.md#Graph.name_scope) -for more details on that). - -For example, to define a new Python op called `my_op`: - -```python -def my_op(a, b, c, name=None): - with tf.name_scope(name, "MyOp", [a, b, c]) as scope: - a = tf.convert_to_tensor(a, name="a") - b = tf.convert_to_tensor(b, name="b") - c = tf.convert_to_tensor(c, name="c") - # Define some computation that uses `a`, `b`, and `c`. - return foo_op(..., name=scope) -``` - -##### Args: - - -* `name`: The name argument that is passed to the op function. -* `default_name`: The default name to use if the `name` argument is `None`. -* `values`: The list of `Tensor` arguments that are passed to the op function. - -##### Returns: - - A context manager for use in defining Python ops. Yields the name scope. - -##### Raises: - - -* `ValueError`: if neither `name` nor `default_name` is provided - but `values` are. - - -- - - - -### `tf.control_dependencies(control_inputs)` {#control_dependencies} - -Wrapper for `Graph.control_dependencies()` using the default graph. - -See [`Graph.control_dependencies()`](../../api_docs/python/framework.md#Graph.control_dependencies) -for more details. - -##### Args: - - -* `control_inputs`: A list of `Operation` or `Tensor` objects which - must be executed or computed before running the operations - defined in the context. Can also be `None` to clear the control - dependencies. - -##### Returns: - - A context manager that specifies control dependencies for all - operations constructed within the context. - - -- - - - -### `tf.convert_to_tensor(value, dtype=None, name=None, preferred_dtype=None)` {#convert_to_tensor} - -Converts the given `value` to a `Tensor`. - -This function converts Python objects of various types to `Tensor` -objects. It accepts `Tensor` objects, numpy arrays, Python lists, -and Python scalars. For example: - -```python -import numpy as np - -def my_func(arg): - arg = tf.convert_to_tensor(arg, dtype=tf.float32) - return tf.matmul(arg, arg) + arg - -# The following calls are equivalent. -value_1 = my_func(tf.constant([[1.0, 2.0], [3.0, 4.0]])) -value_2 = my_func([[1.0, 2.0], [3.0, 4.0]]) -value_3 = my_func(np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32)) -``` - -This function can be useful when composing a new operation in Python -(such as `my_func` in the example above). All standard Python op -constructors apply this function to each of their Tensor-valued -inputs, which allows those ops to accept numpy arrays, Python lists, -and scalars in addition to `Tensor` objects. - -##### Args: - - -* `value`: An object whose type has a registered `Tensor` conversion function. -* `dtype`: Optional element type for the returned tensor. If missing, the - type is inferred from the type of `value`. -* `name`: Optional name to use if a new `Tensor` is created. -* `preferred_dtype`: Optional element type for the returned tensor, - used when dtype is None. In some cases, a caller may not have a - dtype in mind when converting to a tensor, so preferred_dtype - can be used as a soft preference. If the conversion to - `preferred_dtype` is not possible, this argument has no effect. - -##### Returns: - - An `Output` based on `value`. - -##### Raises: - - -* `TypeError`: If no conversion function is registered for `value`. -* `RuntimeError`: If a registered conversion function returns an invalid value. - - -- - - - -### `tf.convert_to_tensor_or_indexed_slices(value, dtype=None, name=None)` {#convert_to_tensor_or_indexed_slices} - -Converts the given object to a `Tensor` or an `IndexedSlices`. - -If `value` is an `IndexedSlices` or `SparseTensor` it is returned -unmodified. Otherwise, it is converted to a `Tensor` using -`convert_to_tensor()`. - -##### Args: - - -* `value`: An `IndexedSlices`, `SparseTensor`, or an object that can be consumed - by `convert_to_tensor()`. -* `dtype`: (Optional.) The required `DType` of the returned `Tensor` or - `IndexedSlices`. -* `name`: (Optional.) A name to use if a new `Tensor` is created. - -##### Returns: - - An `Tensor`, `IndexedSlices`, or `SparseTensor` based on `value`. - -##### Raises: - - -* `ValueError`: If `dtype` does not match the element type of `value`. - - -- - - - -### `tf.convert_to_tensor_or_sparse_tensor(value, dtype=None, name=None)` {#convert_to_tensor_or_sparse_tensor} - -Converts value to a `SparseTensor` or `Tensor`. - -##### Args: - - -* `value`: A `SparseTensor`, `SparseTensorValue`, or an object whose type has a - registered `Tensor` conversion function. -* `dtype`: Optional element type for the returned tensor. If missing, the - type is inferred from the type of `value`. -* `name`: Optional name to use if a new `Tensor` is created. - -##### Returns: - - A `SparseTensor` or `Tensor` based on `value`. - -##### Raises: - - -* `RuntimeError`: If result type is incompatible with `dtype`. - - -- - - - -### `tf.get_default_graph()` {#get_default_graph} - -Returns the default graph for the current thread. - -The returned graph will be the innermost graph on which a -`Graph.as_default()` context has been entered, or a global default -graph if none has been explicitly created. - -NOTE: The default graph is a property of the current thread. If you -create a new thread, and wish to use the default graph in that -thread, you must explicitly add a `with g.as_default():` in that -thread's function. - -##### Returns: - - The default `Graph` being used in the current thread. - - -- - - - -### `tf.reset_default_graph()` {#reset_default_graph} - -Clears the default graph stack and resets the global default graph. - -NOTE: The default graph is a property of the current thread. This -function applies only to the current thread. Calling this function while -a `tf.Session` or `tf.InteractiveSession` is active will result in undefined -behavior. Using any previously created `tf.Operation` or `tf.Tensor` objects -after calling this function will result in undefined behavior. - - -- - - - -### `tf.import_graph_def(graph_def, input_map=None, return_elements=None, name=None, op_dict=None, producer_op_list=None)` {#import_graph_def} - -Imports the graph from `graph_def` into the current default `Graph`. - -This function provides a way to import a serialized TensorFlow -[`GraphDef`](https://www.tensorflow.org/code/tensorflow/core/framework/graph.proto) -protocol buffer, and extract individual objects in the `GraphDef` as -[`Tensor`](#Tensor) and [`Operation`](#Operation) objects. Once extracted, -these objects are placed into the current default `Graph`. See -[`Graph.as_graph_def()`](#Graph.as_graph_def) for a way to create a `GraphDef` -proto. - -##### Args: - - -* `graph_def`: A `GraphDef` proto containing operations to be imported into - the default graph. -* `input_map`: A dictionary mapping input names (as strings) in `graph_def` - to `Tensor` objects. The values of the named input tensors in the - imported graph will be re-mapped to the respective `Tensor` values. -* `return_elements`: A list of strings containing operation names in - `graph_def` that will be returned as `Operation` objects; and/or - tensor names in `graph_def` that will be returned as `Tensor` objects. -* `name`: (Optional.) A prefix that will be prepended to the names in - `graph_def`. Defaults to `"import"`. -* `op_dict`: (Optional.) A dictionary mapping op type names to `OpDef` protos. - Must contain an `OpDef` proto for each op type named in `graph_def`. - If omitted, uses the `OpDef` protos registered in the global registry. -* `producer_op_list`: (Optional.) An `OpList` proto with the (possibly stripped) - list of `OpDef`s used by the producer of the graph. If provided, attrs - for ops in `graph_def` that are not in `op_dict` that have their default - value according to `producer_op_list` will be removed. This will allow - some more `GraphDef`s produced by later binaries to be accepted by - earlier binaries. - -##### Returns: - - A list of `Operation` and/or `Tensor` objects from the imported graph, - corresponding to the names in `return_elements`. - -##### Raises: - - -* `TypeError`: If `graph_def` is not a `GraphDef` proto, - `input_map` is not a dictionary mapping strings to `Tensor` objects, - or `return_elements` is not a list of strings. -* `ValueError`: If `input_map`, or `return_elements` contains names that - do not appear in `graph_def`, or `graph_def` is not well-formed (e.g. - it refers to an unknown tensor). - - -- - - - -### `tf.load_file_system_library(library_filename)` {#load_file_system_library} - -Loads a TensorFlow plugin, containing file system implementation. - -Pass `library_filename` to a platform-specific mechanism for dynamically -loading a library. The rules for determining the exact location of the -library are platform-specific and are not documented here. - -##### Args: - - -* `library_filename`: Path to the plugin. - Relative or absolute filesystem path to a dynamic library file. - -##### Returns: - - None. - -##### Raises: - - -* `RuntimeError`: when unable to load the library. - - -- - - - -### `tf.load_op_library(library_filename)` {#load_op_library} - -Loads a TensorFlow plugin, containing custom ops and kernels. - -Pass "library_filename" to a platform-specific mechanism for dynamically -loading a library. The rules for determining the exact location of the -library are platform-specific and are not documented here. When the -library is loaded, ops and kernels registered in the library via the -`REGISTER_*` macros are made available in the TensorFlow process. Note -that ops with the same name as an existing op are rejected and not -registered with the process. - -##### Args: - - -* `library_filename`: Path to the plugin. - Relative or absolute filesystem path to a dynamic library file. - -##### Returns: - - A python module containing the Python wrappers for Ops defined in - the plugin. - -##### Raises: - - -* `RuntimeError`: when unable to load the library or get the python wrappers. - - - -## Graph collections - -- - - - -### `tf.add_to_collection(name, value)` {#add_to_collection} - -Wrapper for `Graph.add_to_collection()` using the default graph. - -See [`Graph.add_to_collection()`](../../api_docs/python/framework.md#Graph.add_to_collection) -for more details. - -##### Args: - - -* `name`: The key for the collection. For example, the `GraphKeys` class - contains many standard names for collections. -* `value`: The value to add to the collection. - - -- - - - -### `tf.get_collection(key, scope=None)` {#get_collection} - -Wrapper for `Graph.get_collection()` using the default graph. - -See [`Graph.get_collection()`](../../api_docs/python/framework.md#Graph.get_collection) -for more details. - -##### Args: - - -* `key`: The key for the collection. For example, the `GraphKeys` class - contains many standard names for collections. -* `scope`: (Optional.) If supplied, the resulting list is filtered to include - only items whose `name` attribute matches using `re.match`. Items - without a `name` attribute are never returned if a scope is supplied and - the choice or `re.match` means that a `scope` without special tokens - filters by prefix. - -##### Returns: - - The list of values in the collection with the given `name`, or - an empty list if no value has been added to that collection. The - list contains the values in the order under which they were - collected. - - -- - - - -### `tf.get_collection_ref(key)` {#get_collection_ref} - -Wrapper for `Graph.get_collection_ref()` using the default graph. - -See [`Graph.get_collection_ref()`](../../api_docs/python/framework.md#Graph.get_collection_ref) -for more details. - -##### Args: - - -* `key`: The key for the collection. For example, the `GraphKeys` class - contains many standard names for collections. - -##### Returns: - - The list of values in the collection with the given `name`, or an empty - list if no value has been added to that collection. Note that this returns - the collection list itself, which can be modified in place to change the - collection. - - -- - - - -### `class tf.GraphKeys` {#GraphKeys} - -Standard names to use for graph collections. - -The standard library uses various well-known names to collect and -retrieve values associated with a graph. For example, the -`tf.Optimizer` subclasses default to optimizing the variables -collected under `tf.GraphKeys.TRAINABLE_VARIABLES` if none is -specified, but it is also possible to pass an explicit list of -variables. - -The following standard keys are defined: - -* `GLOBAL_VARIABLES`: the default collection of `Variable` objects, shared - across distributed environment (model variables are subset of these). See - [`tf.global_variables()`](../../api_docs/python/state_ops.md#global_variables) - for more details. - Commonly, all `TRAINABLE_VARIABLES` variables will be in `MODEL_VARIABLES`, - and all `MODEL_VARIABLES` variables will be in `GLOBAL_VARIABLES`. -* `LOCAL_VARIABLES`: the subset of `Variable` objects that are local to each - machine. Usually used for temporarily variables, like counters. - Note: use `tf.contrib.framework.local_variable` to add to this collection. -* `MODEL_VARIABLES`: the subset of `Variable` objects that are used in the - model for inference (feed forward). Note: use - `tf.contrib.framework.model_variable` to add to this collection. -* `TRAINABLE_VARIABLES`: the subset of `Variable` objects that will - be trained by an optimizer. See - [`tf.trainable_variables()`](../../api_docs/python/state_ops.md#trainable_variables) - for more details. -* `SUMMARIES`: the summary `Tensor` objects that have been created in the - graph. See - [`tf.summary.merge_all()`](../../api_docs/python/summary.md#merge_all) - for more details. -* `QUEUE_RUNNERS`: the `QueueRunner` objects that are used to - produce input for a computation. See - [`tf.start_queue_runners()`](../../api_docs/python/train.md#start_queue_runners) - for more details. -* `MOVING_AVERAGE_VARIABLES`: the subset of `Variable` objects that will also - keep moving averages. See - [`tf.moving_average_variables()`](../../api_docs/python/state_ops.md#moving_average_variables) - for more details. -* `REGULARIZATION_LOSSES`: regularization losses collected during graph - construction. -* `WEIGHTS`: weights inside neural network layers -* `BIASES`: biases inside neural network layers -* `ACTIVATIONS`: activations of neural network layers - - -## Defining new operations - -- - - - -### `class tf.RegisterGradient` {#RegisterGradient} - -A decorator for registering the gradient function for an op type. - -This decorator is only used when defining a new op type. For an op -with `m` inputs and `n` outputs, the gradient function is a function -that takes the original `Operation` and `n` `Tensor` objects -(representing the gradients with respect to each output of the op), -and returns `m` `Tensor` objects (representing the partial gradients -with respect to each input of the op). - -For example, assuming that operations of type `"Sub"` take two -inputs `x` and `y`, and return a single output `x - y`, the -following gradient function would be registered: - -```python -@tf.RegisterGradient("Sub") -def _sub_grad(unused_op, grad): - return grad, tf.negative(grad) -``` - -The decorator argument `op_type` is the string type of an -operation. This corresponds to the `OpDef.name` field for the proto -that defines the operation. - -- - - - -#### `tf.RegisterGradient.__init__(op_type)` {#RegisterGradient.__init__} - -Creates a new decorator with `op_type` as the Operation type. - -##### Args: - - -* `op_type`: The string type of an operation. This corresponds to the - `OpDef.name` field for the proto that defines the operation. - - - -#### Other Methods -- - - - -#### `tf.RegisterGradient.__call__(f)` {#RegisterGradient.__call__} - -Registers the function `f` as gradient function for `op_type`. - - - -- - - - -### `tf.NotDifferentiable(op_type)` {#NotDifferentiable} - -Specifies that ops of type `op_type` is not differentiable. - -This function should *not* be used for operations that have a -well-defined gradient that is not yet implemented. - -This function is only used when defining a new op type. It may be -used for ops such as `tf.size()` that are not differentiable. For -example: - -```python -tf.NotDifferentiable("Size") -``` - -The gradient computed for 'op_type' will then propagate zeros. - -For ops that have a well-defined gradient but are not yet implemented, -no declaration should be made, and an error *must* be thrown if -an attempt to request its gradient is made. - -##### Args: - - -* `op_type`: The string type of an operation. This corresponds to the - `OpDef.name` field for the proto that defines the operation. - -##### Raises: - - -* `TypeError`: If `op_type` is not a string. - - -- - - - -### `tf.NoGradient(op_type)` {#NoGradient} - -Specifies that ops of type `op_type` is not differentiable. - -This function should *not* be used for operations that have a -well-defined gradient that is not yet implemented. - -This function is only used when defining a new op type. It may be -used for ops such as `tf.size()` that are not differentiable. For -example: - -```python -tf.NotDifferentiable("Size") -``` - -The gradient computed for 'op_type' will then propagate zeros. - -For ops that have a well-defined gradient but are not yet implemented, -no declaration should be made, and an error *must* be thrown if -an attempt to request its gradient is made. - -##### Args: - - -* `op_type`: The string type of an operation. This corresponds to the - `OpDef.name` field for the proto that defines the operation. - -##### Raises: - - -* `TypeError`: If `op_type` is not a string. - - -- - - - -### `class tf.TensorShape` {#TensorShape} - -Represents the shape of a `Tensor`. - -A `TensorShape` represents a possibly-partial shape specification for a -`Tensor`. It may be one of the following: - -* *Fully-known shape:* has a known number of dimensions and a known size - for each dimension. -* *Partially-known shape:* has a known number of dimensions, and an unknown - size for one or more dimension. -* *Unknown shape:* has an unknown number of dimensions, and an unknown - size in all dimensions. - -If a tensor is produced by an operation of type `"Foo"`, its shape -may be inferred if there is a registered shape function for -`"Foo"`. See [`Shape functions in -C++`](../../how_tos/adding_an_op/index.md#shape-functions-in-c) for -details of shape functions and how to register them. Alternatively, -the shape may be set explicitly using -[`Tensor.set_shape()`](../../api_docs/python/framework.md#Tensor.set_shape). -- - - - -#### `tf.TensorShape.__bool__()` {#TensorShape.__bool__} - -Returns True if this shape contains non-zero information. - - -- - - - -#### `tf.TensorShape.__eq__(other)` {#TensorShape.__eq__} - -Returns True if `self` is equivalent to `other`. - - -- - - - -#### `tf.TensorShape.__getitem__(key)` {#TensorShape.__getitem__} - -Returns the value of a dimension or a shape, depending on the key. - -##### Args: - - -* `key`: If `key` is an integer, returns the dimension at that index; - otherwise if `key` is a slice, returns a TensorShape whose - dimensions are those selected by the slice from `self`. - -##### Returns: - - A dimension if `key` is an integer, or a `TensorShape` if `key` is a - slice. - -##### Raises: - - -* `ValueError`: If `key` is a slice, and any of its elements are negative, or - if `self` is completely unknown and the step is set. - - -- - - - -#### `tf.TensorShape.__init__(dims)` {#TensorShape.__init__} - -Creates a new TensorShape with the given dimensions. - -##### Args: - - -* `dims`: A list of Dimensions, or None if the shape is unspecified. -* `DEPRECATED`: A single integer is treated as a singleton list. - -##### Raises: - - -* `TypeError`: If dims cannot be converted to a list of dimensions. - - -- - - - -#### `tf.TensorShape.__iter__()` {#TensorShape.__iter__} - -Returns `self.dims` if the rank is known, otherwise raises ValueError. - - -- - - - -#### `tf.TensorShape.__len__()` {#TensorShape.__len__} - -Returns the rank of this shape, or raises ValueError if unspecified. - - -- - - - -#### `tf.TensorShape.__ne__(other)` {#TensorShape.__ne__} - -Returns True if `self` is known to be different from `other`. - - -- - - - -#### `tf.TensorShape.__nonzero__()` {#TensorShape.__nonzero__} - -Returns True if this shape contains non-zero information. - - -- - - - -#### `tf.TensorShape.__repr__()` {#TensorShape.__repr__} - - - - -- - - - -#### `tf.TensorShape.__str__()` {#TensorShape.__str__} - - - - -- - - - -#### `tf.TensorShape.as_list()` {#TensorShape.as_list} - -Returns a list of integers or `None` for each dimension. - -##### Returns: - - A list of integers or `None` for each dimension. - -##### Raises: - - -* `ValueError`: If `self` is an unknown shape with an unknown rank. - - -- - - - -#### `tf.TensorShape.as_proto()` {#TensorShape.as_proto} - -Returns this shape as a `TensorShapeProto`. - - -- - - - -#### `tf.TensorShape.assert_has_rank(rank)` {#TensorShape.assert_has_rank} - -Raises an exception if `self` is not compatible with the given `rank`. - -##### Args: - - -* `rank`: An integer. - -##### Raises: - - -* `ValueError`: If `self` does not represent a shape with the given `rank`. - - -- - - - -#### `tf.TensorShape.assert_is_compatible_with(other)` {#TensorShape.assert_is_compatible_with} - -Raises exception if `self` and `other` do not represent the same shape. - -This method can be used to assert that there exists a shape that both -`self` and `other` represent. - -##### Args: - - -* `other`: Another TensorShape. - -##### Raises: - - -* `ValueError`: If `self` and `other` do not represent the same shape. - - -- - - - -#### `tf.TensorShape.assert_is_fully_defined()` {#TensorShape.assert_is_fully_defined} - -Raises an exception if `self` is not fully defined in every dimension. - -##### Raises: - - -* `ValueError`: If `self` does not have a known value for every dimension. - - -- - - - -#### `tf.TensorShape.assert_same_rank(other)` {#TensorShape.assert_same_rank} - -Raises an exception if `self` and `other` do not have compatible ranks. - -##### Args: - - -* `other`: Another `TensorShape`. - -##### Raises: - - -* `ValueError`: If `self` and `other` do not represent shapes with the - same rank. - - -- - - - -#### `tf.TensorShape.concatenate(other)` {#TensorShape.concatenate} - -Returns the concatenation of the dimension in `self` and `other`. - -*N.B.* If either `self` or `other` is completely unknown, -concatenation will discard information about the other shape. In -future, we might support concatenation that preserves this -information for use with slicing. - -##### Args: - - -* `other`: Another `TensorShape`. - -##### Returns: - - A `TensorShape` whose dimensions are the concatenation of the - dimensions in `self` and `other`. - - -- - - - -#### `tf.TensorShape.dims` {#TensorShape.dims} - -Returns a list of Dimensions, or None if the shape is unspecified. - - -- - - - -#### `tf.TensorShape.is_compatible_with(other)` {#TensorShape.is_compatible_with} - -Returns True iff `self` is compatible with `other`. - -Two possibly-partially-defined shapes are compatible if there -exists a fully-defined shape that both shapes can represent. Thus, -compatibility allows the shape inference code to reason about -partially-defined shapes. For example: - -* TensorShape(None) is compatible with all shapes. - -* TensorShape([None, None]) is compatible with all two-dimensional - shapes, such as TensorShape([32, 784]), and also TensorShape(None). It is - not compatible with, for example, TensorShape([None]) or - TensorShape([None, None, None]). - -* TensorShape([32, None]) is compatible with all two-dimensional shapes - with size 32 in the 0th dimension, and also TensorShape([None, None]) - and TensorShape(None). It is not compatible with, for example, - TensorShape([32]), TensorShape([32, None, 1]) or TensorShape([64, None]). - -* TensorShape([32, 784]) is compatible with itself, and also - TensorShape([32, None]), TensorShape([None, 784]), TensorShape([None, - None]) and TensorShape(None). It is not compatible with, for example, - TensorShape([32, 1, 784]) or TensorShape([None]). - -The compatibility relation is reflexive and symmetric, but not -transitive. For example, TensorShape([32, 784]) is compatible with -TensorShape(None), and TensorShape(None) is compatible with -TensorShape([4, 4]), but TensorShape([32, 784]) is not compatible with -TensorShape([4, 4]). - -##### Args: - - -* `other`: Another TensorShape. - -##### Returns: - - True iff `self` is compatible with `other`. - - -- - - - -#### `tf.TensorShape.is_fully_defined()` {#TensorShape.is_fully_defined} - -Returns True iff `self` is fully defined in every dimension. - - -- - - - -#### `tf.TensorShape.merge_with(other)` {#TensorShape.merge_with} - -Returns a `TensorShape` combining the information in `self` and `other`. - -The dimensions in `self` and `other` are merged elementwise, -according to the rules defined for `Dimension.merge_with()`. - -##### Args: - - -* `other`: Another `TensorShape`. - -##### Returns: - - A `TensorShape` containing the combined information of `self` and - `other`. - -##### Raises: - - -* `ValueError`: If `self` and `other` are not compatible. - - -- - - - -#### `tf.TensorShape.ndims` {#TensorShape.ndims} - -Returns the rank of this shape, or None if it is unspecified. - - -- - - - -#### `tf.TensorShape.num_elements()` {#TensorShape.num_elements} - -Returns the total number of elements, or none for incomplete shapes. - - -- - - - -#### `tf.TensorShape.with_rank(rank)` {#TensorShape.with_rank} - -Returns a shape based on `self` with the given rank. - -This method promotes a completely unknown shape to one with a -known rank. - -##### Args: - - -* `rank`: An integer. - -##### Returns: - - A shape that is at least as specific as `self` with the given rank. - -##### Raises: - - -* `ValueError`: If `self` does not represent a shape with the given `rank`. - - -- - - - -#### `tf.TensorShape.with_rank_at_least(rank)` {#TensorShape.with_rank_at_least} - -Returns a shape based on `self` with at least the given rank. - -##### Args: - - -* `rank`: An integer. - -##### Returns: - - A shape that is at least as specific as `self` with at least the given - rank. - -##### Raises: - - -* `ValueError`: If `self` does not represent a shape with at least the given - `rank`. - - -- - - - -#### `tf.TensorShape.with_rank_at_most(rank)` {#TensorShape.with_rank_at_most} - -Returns a shape based on `self` with at most the given rank. - -##### Args: - - -* `rank`: An integer. - -##### Returns: - - A shape that is at least as specific as `self` with at most the given - rank. - -##### Raises: - - -* `ValueError`: If `self` does not represent a shape with at most the given - `rank`. - - - -- - - - -### `class tf.Dimension` {#Dimension} - -Represents the value of one dimension in a TensorShape. -- - - - -#### `tf.Dimension.__add__(other)` {#Dimension.__add__} - -Returns the sum of `self` and `other`. - -Dimensions are summed as follows: - - Dimension(m) + Dimension(n) == Dimension(m + n) - Dimension(m) + Dimension(None) == Dimension(None) - Dimension(None) + Dimension(n) == Dimension(None) - Dimension(None) + Dimension(None) == Dimension(None) - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - A Dimension whose value is the sum of `self` and `other`. - - -- - - - -#### `tf.Dimension.__div__(other)` {#Dimension.__div__} - -DEPRECATED: Use `__floordiv__` via `x // y` instead. - -This function exists only for backwards compatibility purposes; new code -should use `__floordiv__` via the syntax `x // y`. Using `x // y` -communicates clearly that the result rounds down, and is forward compatible -to Python 3. - -##### Args: - - -* `other`: Another `Dimension`. - -##### Returns: - - A `Dimension` whose value is the integer quotient of `self` and `other`. - - -- - - - -#### `tf.Dimension.__eq__(other)` {#Dimension.__eq__} - -Returns true if `other` has the same known value as this Dimension. - - -- - - - -#### `tf.Dimension.__floordiv__(other)` {#Dimension.__floordiv__} - -Returns the quotient of `self` and `other` rounded down. - -Dimensions are divided as follows: - - Dimension(m) // Dimension(n) == Dimension(m // n) - Dimension(m) // Dimension(None) == Dimension(None) - Dimension(None) // Dimension(n) == Dimension(None) - Dimension(None) // Dimension(None) == Dimension(None) - -##### Args: - - -* `other`: Another `Dimension`. - -##### Returns: - - A `Dimension` whose value is the integer quotient of `self` and `other`. - - -- - - - -#### `tf.Dimension.__ge__(other)` {#Dimension.__ge__} - -Returns True if `self` is known to be greater than or equal to `other`. - -Dimensions are compared as follows: - - Dimension(m) >= Dimension(n) == m >= n - Dimension(m) >= Dimension(None) == None - Dimension(None) >= Dimension(n) == None - Dimension(None) >= Dimension(None) == None - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - The value of `self.value >= other.value` if both are known, otherwise - None. - - -- - - - -#### `tf.Dimension.__gt__(other)` {#Dimension.__gt__} - -Returns True if `self` is known to be greater than `other`. - -Dimensions are compared as follows: - - Dimension(m) > Dimension(n) == m > n - Dimension(m) > Dimension(None) == None - Dimension(None) > Dimension(n) == None - Dimension(None) > Dimension(None) == None - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - The value of `self.value > other.value` if both are known, otherwise - None. - - -- - - - -#### `tf.Dimension.__index__()` {#Dimension.__index__} - - - - -- - - - -#### `tf.Dimension.__init__(value)` {#Dimension.__init__} - -Creates a new Dimension with the given value. - - -- - - - -#### `tf.Dimension.__int__()` {#Dimension.__int__} - - - - -- - - - -#### `tf.Dimension.__le__(other)` {#Dimension.__le__} - -Returns True if `self` is known to be less than or equal to `other`. - -Dimensions are compared as follows: - - Dimension(m) <= Dimension(n) == m <= n - Dimension(m) <= Dimension(None) == None - Dimension(None) <= Dimension(n) == None - Dimension(None) <= Dimension(None) == None - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - The value of `self.value <= other.value` if both are known, otherwise - None. - - -- - - - -#### `tf.Dimension.__lt__(other)` {#Dimension.__lt__} - -Returns True if `self` is known to be less than `other`. - -Dimensions are compared as follows: - - Dimension(m) < Dimension(n) == m < n - Dimension(m) < Dimension(None) == None - Dimension(None) < Dimension(n) == None - Dimension(None) < Dimension(None) == None - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - The value of `self.value < other.value` if both are known, otherwise - None. - - -- - - - -#### `tf.Dimension.__mod__(other)` {#Dimension.__mod__} - -Returns `self` modulo `other. - -Dimension moduli are computed as follows: - - Dimension(m) % Dimension(n) == Dimension(m % n) - Dimension(m) % Dimension(None) == Dimension(None) - Dimension(None) % Dimension(n) == Dimension(None) - Dimension(None) % Dimension(None) == Dimension(None) - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - A Dimension whose value is `self` modulo `other`. - - -- - - - -#### `tf.Dimension.__mul__(other)` {#Dimension.__mul__} - -Returns the product of `self` and `other`. - -Dimensions are summed as follows: - -``` - Dimension(m) * Dimension(n) == Dimension(m * n) - Dimension(m) * Dimension(None) == Dimension(None) - Dimension(None) * Dimension(n) == Dimension(None) - Dimension(None) * Dimension(None) == Dimension(None) -``` - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - A Dimension whose value is the product of `self` and `other`. - - -- - - - -#### `tf.Dimension.__ne__(other)` {#Dimension.__ne__} - -Returns true if `other` has a different known value from `self`. - - -- - - - -#### `tf.Dimension.__repr__()` {#Dimension.__repr__} - - - - -- - - - -#### `tf.Dimension.__str__()` {#Dimension.__str__} - - - - -- - - - -#### `tf.Dimension.__sub__(other)` {#Dimension.__sub__} - -Returns the subtraction of `other` from `self`. - -Dimensions are subtracted as follows: - - Dimension(m) - Dimension(n) == Dimension(m - n) - Dimension(m) - Dimension(None) == Dimension(None) - Dimension(None) - Dimension(n) == Dimension(None) - Dimension(None) - Dimension(None) == Dimension(None) - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - A Dimension whose value is the subtraction of sum of `other` from `self`. - - -- - - - -#### `tf.Dimension.assert_is_compatible_with(other)` {#Dimension.assert_is_compatible_with} - -Raises an exception if `other` is not compatible with this Dimension. - -##### Args: - - -* `other`: Another Dimension. - -##### Raises: - - -* `ValueError`: If `self` and `other` are not compatible (see - is_compatible_with). - - -- - - - -#### `tf.Dimension.is_compatible_with(other)` {#Dimension.is_compatible_with} - -Returns true if `other` is compatible with this Dimension. - -Two known Dimensions are compatible if they have the same value. -An unknown Dimension is compatible with all other Dimensions. - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - True if this Dimension and `other` are compatible. - - -- - - - -#### `tf.Dimension.merge_with(other)` {#Dimension.merge_with} - -Returns a Dimension that combines the information in `self` and `other`. - -Dimensions are combined as follows: - -```python - Dimension(n) .merge_with(Dimension(n)) == Dimension(n) - Dimension(n) .merge_with(Dimension(None)) == Dimension(n) - Dimension(None).merge_with(Dimension(n)) == Dimension(n) - Dimension(None).merge_with(Dimension(None)) == Dimension(None) - Dimension(n) .merge_with(Dimension(m)) raises ValueError for n != m -``` - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - A Dimension containing the combined information of `self` and - `other`. - -##### Raises: - - -* `ValueError`: If `self` and `other` are not compatible (see - is_compatible_with). - - -- - - - -#### `tf.Dimension.value` {#Dimension.value} - -The value of this dimension, or None if it is unknown. - - - -- - - - -### `tf.op_scope(values, name, default_name=None)` {#op_scope} - -DEPRECATED. Same as name_scope above, just different argument order. - - -- - - - -### `tf.get_seed(op_seed)` {#get_seed} - -Returns the local seeds an operation should use given an op-specific seed. - -Given operation-specific seed, `op_seed`, this helper function returns two -seeds derived from graph-level and op-level seeds. Many random operations -internally use the two seeds to allow user to change the seed globally for a -graph, or for only specific operations. - -For details on how the graph-level seed interacts with op seeds, see -@{tf.set_random_seed}. - -##### Args: - - -* `op_seed`: integer. - -##### Returns: - - A tuple of two integers that should be used for the local seed of this - operation. - - - -## For libraries building on TensorFlow - -- - - - -### `tf.register_tensor_conversion_function(base_type, conversion_func, priority=100)` {#register_tensor_conversion_function} - -Registers a function for converting objects of `base_type` to `Tensor`. - -The conversion function must have the following signature: - -```python - def conversion_func(value, dtype=None, name=None, as_ref=False): - # ... -``` - -It must return a `Tensor` with the given `dtype` if specified. If the -conversion function creates a new `Tensor`, it should use the given -`name` if specified. All exceptions will be propagated to the caller. - -The conversion function may return `NotImplemented` for some -inputs. In this case, the conversion process will continue to try -subsequent conversion functions. - -If `as_ref` is true, the function must return a `Tensor` reference, -such as a `Variable`. - -NOTE: The conversion functions will execute in order of priority, -followed by order of registration. To ensure that a conversion function -`F` runs before another conversion function `G`, ensure that `F` is -registered with a smaller priority than `G`. - -##### Args: - - -* `base_type`: The base type or tuple of base types for all objects that - `conversion_func` accepts. -* `conversion_func`: A function that converts instances of `base_type` to - `Tensor`. -* `priority`: Optional integer that indicates the priority for applying this - conversion function. Conversion functions with smaller priority values - run earlier than conversion functions with larger priority values. - Defaults to 100. - -##### Raises: - - -* `TypeError`: If the arguments do not have the appropriate type. - - - -## Other Functions and Classes -- - - - -### `class tf.DeviceSpec` {#DeviceSpec} - -Represents a (possibly partial) specification for a TensorFlow device. - -`DeviceSpec`s are used throughout TensorFlow to describe where state is stored -and computations occur. Using `DeviceSpec` allows you to parse device spec -strings to verify their validity, merge them or compose them programmatically. - -Example: - -```python -# Place the operations on device "GPU:0" in the "ps" job. -device_spec = DeviceSpec(job="ps", device_type="GPU", device_index=0) -with tf.device(device_spec): - # Both my_var and squared_var will be placed on /job:ps/device:GPU:0. - my_var = tf.Variable(..., name="my_variable") - squared_var = tf.square(my_var) -``` - -If a `DeviceSpec` is partially specified, it will be merged with other -`DeviceSpec`s according to the scope in which it is defined. `DeviceSpec` -components defined in inner scopes take precedence over those defined in -outer scopes. - -```python -with tf.device(DeviceSpec(job="train", )): - with tf.device(DeviceSpec(job="ps", device_type="GPU", device_index=0): - # Nodes created here will be assigned to /job:ps/device:GPU:0. - with tf.device(DeviceSpec(device_type="GPU", device_index=1): - # Nodes created here will be assigned to /job:train/device:GPU:1. -``` - -A `DeviceSpec` consists of 5 components -- each of -which is optionally specified: - -* Job: The job name. -* Replica: The replica index. -* Task: The task index. -* Device type: The device type string (e.g. "CPU" or "GPU"). -* Device index: The device index. -- - - - -#### `tf.DeviceSpec.__init__(job=None, replica=None, task=None, device_type=None, device_index=None)` {#DeviceSpec.__init__} - -Create a new `DeviceSpec` object. - -##### Args: - - -* `job`: string. Optional job name. -* `replica`: int. Optional replica index. -* `task`: int. Optional task index. -* `device_type`: Optional device type string (e.g. "CPU" or "GPU") -* `device_index`: int. Optional device index. If left - unspecified, device represents 'any' device_index. - - -- - - - -#### `tf.DeviceSpec.from_string(spec)` {#DeviceSpec.from_string} - -Construct a `DeviceSpec` from a string. - -##### Args: - - -* `spec`: a string of the form - /job:/replica:/task:/device:CPU: - or - /job:/replica:/task:/device:GPU: - as cpu and gpu are mutually exclusive. - All entries are optional. - -##### Returns: - - A DeviceSpec. - - -- - - - -#### `tf.DeviceSpec.job` {#DeviceSpec.job} - - - - -- - - - -#### `tf.DeviceSpec.merge_from(dev)` {#DeviceSpec.merge_from} - -Merge the properties of "dev" into this `DeviceSpec`. - -##### Args: - - -* `dev`: a `DeviceSpec`. - - -- - - - -#### `tf.DeviceSpec.parse_from_string(spec)` {#DeviceSpec.parse_from_string} - -Parse a `DeviceSpec` name into its components. - -##### Args: - - -* `spec`: a string of the form - /job:/replica:/task:/device:CPU: - or - /job:/replica:/task:/device:GPU: - as cpu and gpu are mutually exclusive. - All entries are optional. - -##### Returns: - - The `DeviceSpec`. - -##### Raises: - - -* `ValueError`: if the spec was not valid. - - -- - - - -#### `tf.DeviceSpec.replica` {#DeviceSpec.replica} - - - - -- - - - -#### `tf.DeviceSpec.task` {#DeviceSpec.task} - - - - -- - - - -#### `tf.DeviceSpec.to_string()` {#DeviceSpec.to_string} - -Return a string representation of this `DeviceSpec`. - -##### Returns: - - a string of the form - /job:/replica:/task:/device::. - - - diff --git a/tensorflow/g3doc/api_docs/python/functional_ops.md b/tensorflow/g3doc/api_docs/python/functional_ops.md deleted file mode 100644 index f81af171b1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functional_ops.md +++ /dev/null @@ -1,299 +0,0 @@ - - -# Higher Order Functions - -Note: Functions taking `Tensor` arguments can also take anything accepted by -[`tf.convert_to_tensor`](framework.md#convert_to_tensor). - -[TOC] - -Functional operations. See the @{$python/functional_ops} guide. - -- - - - -### `tf.map_fn(fn, elems, dtype=None, parallel_iterations=10, back_prop=True, swap_memory=False, infer_shape=True, name=None)` {#map_fn} - -map on the list of tensors unpacked from `elems` on dimension 0. - -The simplest version of `map` repeatedly applies the callable `fn` to a -sequence of elements from first to last. The elements are made of the -tensors unpacked from `elems`. `dtype` is the data type of the return -value of `fn`. Users must provide `dtype` if it is different from -the data type of `elems`. - -Suppose that `elems` is unpacked into `values`, a list of tensors. The shape -of the result tensor is `[values.shape[0]] + fn(values[0]).shape`. - -This method also allows multi-arity `elems` and output of `fn`. If `elems` -is a (possibly nested) list or tuple of tensors, then each of these tensors -must have a matching first (unpack) dimension. The signature of `fn` may -match the structure of `elems`. That is, if `elems` is -`(t1, [t2, t3, [t4, t5]])`, then an appropriate signature for `fn` is: -`fn = lambda (t1, [t2, t3, [t4, t5]]):`. - -Furthermore, `fn` may emit a different structure than its input. For example, -`fn` may look like: `fn = lambda t1: return (t1 + 1, t1 - 1)`. In this case, -the `dtype` parameter is not optional: `dtype` must be a type or (possibly -nested) tuple of types matching the output of `fn`. - -To apply a functional operation to the nonzero elements of a SparseTensor -one of the following methods is recommended. First, if the function is -expressible as TensorFlow ops, use - -```python - result = SparseTensor(input.indices, fn(input.values), input.dense_shape) -``` - -If, however, the function is not expressible as a TensorFlow op, then use - -```python -result = SparseTensor( - input.indices, map_fn(fn, input.values), input.dense_shape) -``` - -instead. - -##### Args: - - -* `fn`: The callable to be performed. It accepts one argument, which will - have the same (possibly nested) structure as `elems`. Its output - must have the same structure as `dtype` if one is provided, otherwise - it must have the same structure as `elems`. -* `elems`: A tensor or (possibly nested) sequence of tensors, each of which - will be unpacked along their first dimension. The nested sequence - of the resulting slices will be applied to `fn`. -* `dtype`: (optional) The output type(s) of `fn`. If `fn` returns a structure - of Tensors differing from the structure of `elems`, then `dtype` is not - optional and must have the same structure as the output of `fn`. -* `parallel_iterations`: (optional) The number of iterations allowed to run - in parallel. -* `back_prop`: (optional) True enables support for back propagation. -* `swap_memory`: (optional) True enables GPU-CPU memory swapping. -* `infer_shape`: (optional) False disables tests for consistent output shapes. -* `name`: (optional) Name prefix for the returned tensors. - -##### Returns: - - A tensor or (possibly nested) sequence of tensors. Each tensor packs the - results of applying `fn` to tensors unpacked from `elems` along the first - dimension, from first to last. - -##### Raises: - - -* `TypeError`: if `fn` is not callable or the structure of the output of - `fn` and `dtype` do not match, or if elems is a SparseTensor. -* `ValueError`: if the lengths of the output of `fn` and `dtype` do not match. - -##### Examples: - - ```python - elems = np.array([1, 2, 3, 4, 5, 6]) - squares = map_fn(lambda x: x * x, elems) - # squares == [1, 4, 9, 16, 25, 36] - ``` - - ```python - elems = (np.array([1, 2, 3]), np.array([-1, 1, -1])) - alternate = map_fn(lambda x: x[0] * x[1], elems, dtype=tf.int64) - # alternate == [-1, 2, -3] - ``` - - ```python - elems = np.array([1, 2, 3]) - alternates = map_fn(lambda x: (x, -x), elems, dtype=(tf.int64, tf.int64)) - # alternates[0] == [1, 2, 3] - # alternates[1] == [-1, -2, -3] - ``` - - -- - - - -### `tf.foldl(fn, elems, initializer=None, parallel_iterations=10, back_prop=True, swap_memory=False, name=None)` {#foldl} - -foldl on the list of tensors unpacked from `elems` on dimension 0. - -This foldl operator repeatedly applies the callable `fn` to a sequence -of elements from first to last. The elements are made of the tensors -unpacked from `elems` on dimension 0. The callable fn takes two tensors as -arguments. The first argument is the accumulated value computed from the -preceding invocation of fn. If `initializer` is None, `elems` must contain -at least one element, and its first element is used as the initializer. - -Suppose that `elems` is unpacked into `values`, a list of tensors. The shape -of the result tensor is fn(initializer, values[0]).shape`. - -##### Args: - - -* `fn`: The callable to be performed. -* `elems`: A tensor to be unpacked on dimension 0. -* `initializer`: (optional) The initial value for the accumulator. -* `parallel_iterations`: (optional) The number of iterations allowed to run - in parallel. -* `back_prop`: (optional) True enables support for back propagation. -* `swap_memory`: (optional) True enables GPU-CPU memory swapping. -* `name`: (optional) Name prefix for the returned tensors. - -##### Returns: - - A tensor resulting from applying `fn` consecutively to the list of tensors - unpacked from `elems`, from first to last. - -##### Raises: - - -* `TypeError`: if `fn` is not callable. - -##### Example: - - ```python - elems = [1, 2, 3, 4, 5, 6] - sum = foldl(lambda a, x: a + x, elems) - # sum == 21 - ``` - - -- - - - -### `tf.foldr(fn, elems, initializer=None, parallel_iterations=10, back_prop=True, swap_memory=False, name=None)` {#foldr} - -foldr on the list of tensors unpacked from `elems` on dimension 0. - -This foldr operator repeatedly applies the callable `fn` to a sequence -of elements from last to first. The elements are made of the tensors -unpacked from `elems`. The callable fn takes two tensors as arguments. -The first argument is the accumulated value computed from the preceding -invocation of fn. If `initializer` is None, `elems` must contain at least -one element, and its first element is used as the initializer. - -Suppose that `elems` is unpacked into `values`, a list of tensors. The shape -of the result tensor is `fn(initializer, values[0]).shape`. - -##### Args: - - -* `fn`: The callable to be performed. -* `elems`: A tensor that is unpacked into a sequence of tensors to apply `fn`. -* `initializer`: (optional) The initial value for the accumulator. -* `parallel_iterations`: (optional) The number of iterations allowed to run - in parallel. -* `back_prop`: (optional) True enables support for back propagation. -* `swap_memory`: (optional) True enables GPU-CPU memory swapping. -* `name`: (optional) Name prefix for the returned tensors. - -##### Returns: - - A tensor resulting from applying `fn` consecutively to the list of tensors - unpacked from `elems`, from last to first. - -##### Raises: - - -* `TypeError`: if `fn` is not callable. - -##### Example: - - ```python - elems = [1, 2, 3, 4, 5, 6] - sum = foldr(lambda a, x: a + x, elems) - # sum == 21 - ``` - - -- - - - -### `tf.scan(fn, elems, initializer=None, parallel_iterations=10, back_prop=True, swap_memory=False, infer_shape=True, name=None)` {#scan} - -scan on the list of tensors unpacked from `elems` on dimension 0. - -The simplest version of `scan` repeatedly applies the callable `fn` to a -sequence of elements from first to last. The elements are made of the tensors -unpacked from `elems` on dimension 0. The callable fn takes two tensors as -arguments. The first argument is the accumulated value computed from the -preceding invocation of fn. If `initializer` is None, `elems` must contain -at least one element, and its first element is used as the initializer. - -Suppose that `elems` is unpacked into `values`, a list of tensors. The shape -of the result tensor is `[len(values)] + fn(initializer, values[0]).shape`. - -This method also allows multi-arity `elems` and accumulator. If `elems` -is a (possibly nested) list or tuple of tensors, then each of these tensors -must have a matching first (unpack) dimension. The second argument of -`fn` must match the structure of `elems`. - -If no `initializer` is provided, the output structure and dtypes of `fn` -are assumed to be the same as its input; and in this case, the first -argument of `fn` must match the structure of `elems`. - -If an `initializer` is provided, then the output of `fn` must have the same -structure as `initializer`; and the first argument of `fn` must match -this structure. - -For example, if `elems` is `(t1, [t2, t3])` and `initializer` is -`[i1, i2]` then an appropriate signature for `fn` in `python2` is: -`fn = lambda (acc_p1, acc_p2), (t1 [t2, t3]):` and `fn` must return a list, -`[acc_n1, acc_n2]`. An alternative correct signature for `fn`, and the - one that works in `python3`, is: -`fn = lambda a, t:`, where `a` and `t` correspond to the input tuples. - -##### Args: - - -* `fn`: The callable to be performed. It accepts two arguments. The first - will have the same structure as `initializer` if one is provided, - otherwise it will have the same structure as `elems`. The second - will have the same (possibly nested) structure as `elems`. Its output - must have the same structure as `initializer` if one is provided, - otherwise it must have the same structure as `elems`. -* `elems`: A tensor or (possibly nested) sequence of tensors, each of which - will be unpacked along their first dimension. The nested sequence - of the resulting slices will be the first argument to `fn`. -* `initializer`: (optional) A tensor or (possibly nested) sequence of tensors, - initial value for the accumulator, and the expected output type of `fn`. -* `parallel_iterations`: (optional) The number of iterations allowed to run - in parallel. -* `back_prop`: (optional) True enables support for back propagation. -* `swap_memory`: (optional) True enables GPU-CPU memory swapping. -* `infer_shape`: (optional) False disables tests for consistent output shapes. -* `name`: (optional) Name prefix for the returned tensors. - -##### Returns: - - A tensor or (possibly nested) sequence of tensors. Each tensor packs the - results of applying `fn` to tensors unpacked from `elems` along the first - dimension, and the previous accumulator value(s), from first to last. - -##### Raises: - - -* `TypeError`: if `fn` is not callable or the structure of the output of - `fn` and `initializer` do not match. -* `ValueError`: if the lengths of the output of `fn` and `initializer` - do not match. - -##### Examples: - - ```python - elems = np.array([1, 2, 3, 4, 5, 6]) - sum = scan(lambda a, x: a + x, elems) - # sum == [1, 3, 6, 10, 15, 21] - ``` - - ```python - elems = np.array([1, 2, 3, 4, 5, 6]) - initializer = np.array(0) - sum_one = scan( - lambda a, x: x[0] - x[1] + a, (elems + 1, elems), initializer) - # sum_one == [1, 2, 3, 4, 5, 6] - ``` - - ```python - elems = np.array([1, 0, 0, 0, 0, 0]) - initializer = (np.array(0), np.array(1)) - fibonaccis = scan(lambda a, _: (a[1], a[0] + a[1]), elems, initializer) - # fibonaccis == ([1, 1, 2, 3, 5, 8], [1, 2, 3, 5, 8, 13]) - ``` - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.PriorityQueue.from_list.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.PriorityQueue.from_list.md deleted file mode 100644 index 1fbd1a6f03..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.PriorityQueue.from_list.md +++ /dev/null @@ -1,21 +0,0 @@ -#### `tf.PriorityQueue.from_list(index, queues)` {#PriorityQueue.from_list} - -Create a queue using the queue reference from `queues[index]`. - -##### Args: - - -* `index`: An integer scalar tensor that determines the input that gets - selected. -* `queues`: A list of `QueueBase` objects. - -##### Returns: - - A `QueueBase` object. - -##### Raises: - - -* `TypeError`: When `queues` is not a list of `QueueBase` objects, - or when the data types of `queues` are not all the same. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.ReaderBase.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.ReaderBase.md deleted file mode 100644 index 68a60bc33a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.ReaderBase.md +++ /dev/null @@ -1,183 +0,0 @@ -Base class for different Reader types, that produce a record every step. - -Conceptually, Readers convert string 'work units' into records (key, -value pairs). Typically the 'work units' are filenames and the -records are extracted from the contents of those files. We want a -single record produced per step, but a work unit can correspond to -many records. - -Therefore we introduce some decoupling using a queue. The queue -contains the work units and the Reader dequeues from the queue when -it is asked to produce a record (via Read()) but it has finished the -last work unit. -- - - - -#### `tf.ReaderBase.__init__(reader_ref, supports_serialize=False)` {#ReaderBase.__init__} - -Creates a new ReaderBase. - -##### Args: - - -* `reader_ref`: The operation that implements the reader. -* `supports_serialize`: True if the reader implementation can - serialize its state. - - -- - - - -#### `tf.ReaderBase.num_records_produced(name=None)` {#ReaderBase.num_records_produced} - -Returns the number of records this reader has produced. - -This is the same as the number of Read executions that have -succeeded. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.ReaderBase.num_work_units_completed(name=None)` {#ReaderBase.num_work_units_completed} - -Returns the number of work units this reader has finished processing. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.ReaderBase.read(queue, name=None)` {#ReaderBase.read} - -Returns the next record (key, value pair) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g. when the -Reader needs to start reading from a new file since it has -finished with the previous file). - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (key, value). - -* `key`: A string scalar Tensor. -* `value`: A string scalar Tensor. - - -- - - - -#### `tf.ReaderBase.read_up_to(queue, num_records, name=None)` {#ReaderBase.read_up_to} - -Returns up to num_records (key, value pairs) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g., when the -Reader needs to start reading from a new file since it has -finished with the previous file). -It may return less than num_records even before the last batch. - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `num_records`: Number of records to read. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (keys, values). - -* `keys`: A 1-D string Tensor. -* `values`: A 1-D string Tensor. - - -- - - - -#### `tf.ReaderBase.reader_ref` {#ReaderBase.reader_ref} - -Op that implements the reader. - - -- - - - -#### `tf.ReaderBase.reset(name=None)` {#ReaderBase.reset} - -Restore a reader to its initial clean state. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.ReaderBase.restore_state(state, name=None)` {#ReaderBase.restore_state} - -Restore a reader to a previously saved state. - -Not all Readers support being restored, so this can produce an -Unimplemented error. - -##### Args: - - -* `state`: A string Tensor. - Result of a SerializeState of a Reader with matching type. -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.ReaderBase.serialize_state(name=None)` {#ReaderBase.serialize_state} - -Produce a string tensor that encodes the state of a reader. - -Not all Readers support being serialized, so this can produce an -Unimplemented error. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A string Tensor. - - -- - - - -#### `tf.ReaderBase.supports_serialize` {#ReaderBase.supports_serialize} - -Whether the Reader implementation can serialize its state. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.SparseFeature.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.SparseFeature.md deleted file mode 100644 index fd0950c328..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.SparseFeature.md +++ /dev/null @@ -1,78 +0,0 @@ -Configuration for parsing a sparse input feature. - -Fields: - index_key: Name of index feature. The underlying feature's type must - be `int64` and its length must always match that of the `value_key` - feature. - value_key: Name of value feature. The underlying feature's type must - be `dtype` and its length must always match that of the `index_key` - feature. - dtype: Data type of the `value_key` feature. - size: A Python int to specify a dimension of the dense shape. Each value in - the `index_key` feature must be in `[0, size)`. - already_sorted: A Python boolean to specify whether the values in - `index_key` are already sorted. If so skip sorting. - False by default (optional). -- - - - -#### `tf.SparseFeature.__getnewargs__()` {#SparseFeature.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.SparseFeature.__getstate__()` {#SparseFeature.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.SparseFeature.__new__(_cls, index_key, value_key, dtype, size, already_sorted=False)` {#SparseFeature.__new__} - -Create new instance of SparseFeature(index_key, value_key, dtype, size, already_sorted) - - -- - - - -#### `tf.SparseFeature.__repr__()` {#SparseFeature.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.SparseFeature.already_sorted` {#SparseFeature.already_sorted} - -Alias for field number 4 - - -- - - - -#### `tf.SparseFeature.dtype` {#SparseFeature.dtype} - -Alias for field number 2 - - -- - - - -#### `tf.SparseFeature.index_key` {#SparseFeature.index_key} - -Alias for field number 0 - - -- - - - -#### `tf.SparseFeature.size` {#SparseFeature.size} - -Alias for field number 3 - - -- - - - -#### `tf.SparseFeature.value_key` {#SparseFeature.value_key} - -Alias for field number 1 - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.SparseTensorValue.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.SparseTensorValue.md deleted file mode 100644 index 7454442559..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.SparseTensorValue.md +++ /dev/null @@ -1,50 +0,0 @@ -SparseTensorValue(indices, values, dense_shape) -- - - - -#### `tf.SparseTensorValue.__getnewargs__()` {#SparseTensorValue.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.SparseTensorValue.__getstate__()` {#SparseTensorValue.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.SparseTensorValue.__new__(_cls, indices, values, dense_shape)` {#SparseTensorValue.__new__} - -Create new instance of SparseTensorValue(indices, values, dense_shape) - - -- - - - -#### `tf.SparseTensorValue.__repr__()` {#SparseTensorValue.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.SparseTensorValue.dense_shape` {#SparseTensorValue.dense_shape} - -Alias for field number 2 - - -- - - - -#### `tf.SparseTensorValue.indices` {#SparseTensorValue.indices} - -Alias for field number 0 - - -- - - - -#### `tf.SparseTensorValue.values` {#SparseTensorValue.values} - -Alias for field number 1 - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.TensorArray.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.TensorArray.md deleted file mode 100644 index 240628114e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.TensorArray.md +++ /dev/null @@ -1,281 +0,0 @@ -Class wrapping dynamic-sized, per-time-step, write-once Tensor arrays. - -This class is meant to be used with dynamic iteration primitives such as -`while_loop` and `map_fn`. It supports gradient back-propagation via special -"flow" control flow dependencies. -- - - - -#### `tf.TensorArray.__init__(dtype, size=None, dynamic_size=None, clear_after_read=None, tensor_array_name=None, handle=None, flow=None, infer_shape=True, element_shape=None, name=None)` {#TensorArray.__init__} - -Construct a new TensorArray or wrap an existing TensorArray handle. - -A note about the parameter `name`: - -The name of the `TensorArray` (even if passed in) is uniquified: each time -a new `TensorArray` is created at runtime it is assigned its own name for -the duration of the run. This avoids name collisions if a `TensorArray` -is created within a `while_loop`. - -##### Args: - - -* `dtype`: (required) data type of the TensorArray. -* `size`: (optional) int32 scalar `Tensor`: the size of the TensorArray. - Required if handle is not provided. -* `dynamic_size`: (optional) Python bool: If true, writes to the TensorArray - can grow the TensorArray past its initial size. Default: False. -* `clear_after_read`: Boolean (optional, default: True). If True, clear - TensorArray values after reading them. This disables read-many - semantics, but allows early release of memory. -* `tensor_array_name`: (optional) Python string: the name of the TensorArray. - This is used when creating the TensorArray handle. If this value is - set, handle should be None. -* `handle`: (optional) A `Tensor` handle to an existing TensorArray. If this - is set, tensor_array_name should be None. -* `flow`: (optional) A float `Tensor` scalar coming from an existing - `TensorArray.flow`. -* `infer_shape`: (optional, default: True) If True, shape inference - is enabled. In this case, all elements must have the same shape. -* `element_shape`: (optional, default: None) A `TensorShape` object specifying - the shape constraints of each of the elements of the TensorArray. - Need not be fully defined. -* `name`: A name for the operation (optional). - -##### Raises: - - -* `ValueError`: if both handle and tensor_array_name are provided. -* `TypeError`: if handle is provided but is not a Tensor. - - -- - - - -#### `tf.TensorArray.close(name=None)` {#TensorArray.close} - -Close the current TensorArray. - - -- - - - -#### `tf.TensorArray.concat(name=None)` {#TensorArray.concat} - -Return the values in the TensorArray as a concatenated `Tensor`. - -All of the values must have been written, their ranks must match, and -and their shapes must all match for all dimensions except the first. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - All the tensors in the TensorArray concatenated into one tensor. - - -- - - - -#### `tf.TensorArray.dtype` {#TensorArray.dtype} - -The data type of this TensorArray. - - -- - - - -#### `tf.TensorArray.flow` {#TensorArray.flow} - -The flow `Tensor` forcing ops leading to this TensorArray state. - - -- - - - -#### `tf.TensorArray.gather(indices, name=None)` {#TensorArray.gather} - -Return selected values in the TensorArray as a packed `Tensor`. - -All of selected values must have been written and their shapes -must all match. - -##### Args: - - -* `indices`: A `1-D` `Tensor` taking values in `[0, max_value)`. If - the `TensorArray` is not dynamic, `max_value=size()`. -* `name`: A name for the operation (optional). - -##### Returns: - - The in the `TensorArray` selected by `indices`, packed into one tensor. - - -- - - - -#### `tf.TensorArray.grad(source, flow=None, name=None)` {#TensorArray.grad} - - - - -- - - - -#### `tf.TensorArray.handle` {#TensorArray.handle} - -The reference to the TensorArray. - - -- - - - -#### `tf.TensorArray.identity()` {#TensorArray.identity} - -Returns a TensorArray with the same content and properties. - -##### Returns: - - A new TensorArray object with flow that ensures the control dependencies - from the contexts will become control dependencies for writes, reads, etc. - Use this object all for subsequent operations. - - -- - - - -#### `tf.TensorArray.read(index, name=None)` {#TensorArray.read} - -Read the value at location `index` in the TensorArray. - -##### Args: - - -* `index`: 0-D. int32 tensor with the index to read from. -* `name`: A name for the operation (optional). - -##### Returns: - - The tensor at index `index`. - - -- - - - -#### `tf.TensorArray.scatter(indices, value, name=None)` {#TensorArray.scatter} - -Scatter the values of a `Tensor` in specific indices of a `TensorArray`. - -##### Args: - - -* `indices`: A `1-D` `Tensor` taking values in `[0, max_value)`. If - the `TensorArray` is not dynamic, `max_value=size()`. -* `value`: (N+1)-D. Tensor of type `dtype`. The Tensor to unpack. -* `name`: A name for the operation (optional). - -##### Returns: - - A new TensorArray object with flow that ensures the scatter occurs. - Use this object all for subsequent operations. - -##### Raises: - - -* `ValueError`: if the shape inference fails. - - -- - - - -#### `tf.TensorArray.size(name=None)` {#TensorArray.size} - -Return the size of the TensorArray. - - -- - - - -#### `tf.TensorArray.split(value, lengths, name=None)` {#TensorArray.split} - -Split the values of a `Tensor` into the TensorArray. - -##### Args: - - -* `value`: (N+1)-D. Tensor of type `dtype`. The Tensor to split. -* `lengths`: 1-D. int32 vector with the lengths to use when splitting - `value` along its first dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A new TensorArray object with flow that ensures the split occurs. - Use this object all for subsequent operations. - -##### Raises: - - -* `ValueError`: if the shape inference fails. - - -- - - - -#### `tf.TensorArray.stack(name=None)` {#TensorArray.stack} - -Return the values in the TensorArray as a stacked `Tensor`. - -All of the values must have been written and their shapes must all match. -If input shapes have rank-`R`, then output shape will have rank-`(R+1)`. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - All the tensors in the TensorArray stacked into one tensor. - - -- - - - -#### `tf.TensorArray.unstack(value, name=None)` {#TensorArray.unstack} - -Unstack the values of a `Tensor` in the TensorArray. - -If input value shapes have rank-`R`, then the output TensorArray will -contain elements whose shapes are rank-`(R-1)`. - -##### Args: - - -* `value`: (N+1)-D. Tensor of type `dtype`. The Tensor to unstack. -* `name`: A name for the operation (optional). - -##### Returns: - - A new TensorArray object with flow that ensures the unstack occurs. - Use this object all for subsequent operations. - -##### Raises: - - -* `ValueError`: if the shape inference fails. - - -- - - - -#### `tf.TensorArray.write(index, value, name=None)` {#TensorArray.write} - -Write `value` into index `index` of the TensorArray. - -##### Args: - - -* `index`: 0-D. int32 scalar with the index to write to. -* `value`: N-D. Tensor of type `dtype`. The Tensor to write to this index. -* `name`: A name for the operation (optional). - -##### Returns: - - A new TensorArray object with flow that ensures the write occurs. - Use this object all for subsequent operations. - -##### Raises: - - -* `ValueError`: if there are more writers than specified. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.TensorShape.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.TensorShape.md deleted file mode 100644 index 0ff6c80e23..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.TensorShape.md +++ /dev/null @@ -1,397 +0,0 @@ -Represents the shape of a `Tensor`. - -A `TensorShape` represents a possibly-partial shape specification for a -`Tensor`. It may be one of the following: - -* *Fully-known shape:* has a known number of dimensions and a known size - for each dimension. -* *Partially-known shape:* has a known number of dimensions, and an unknown - size for one or more dimension. -* *Unknown shape:* has an unknown number of dimensions, and an unknown - size in all dimensions. - -If a tensor is produced by an operation of type `"Foo"`, its shape -may be inferred if there is a registered shape function for -`"Foo"`. See [`Shape functions in -C++`](../../how_tos/adding_an_op/index.md#shape-functions-in-c) for -details of shape functions and how to register them. Alternatively, -the shape may be set explicitly using -[`Tensor.set_shape()`](../../api_docs/python/framework.md#Tensor.set_shape). -- - - - -#### `tf.TensorShape.__bool__()` {#TensorShape.__bool__} - -Returns True if this shape contains non-zero information. - - -- - - - -#### `tf.TensorShape.__eq__(other)` {#TensorShape.__eq__} - -Returns True if `self` is equivalent to `other`. - - -- - - - -#### `tf.TensorShape.__getitem__(key)` {#TensorShape.__getitem__} - -Returns the value of a dimension or a shape, depending on the key. - -##### Args: - - -* `key`: If `key` is an integer, returns the dimension at that index; - otherwise if `key` is a slice, returns a TensorShape whose - dimensions are those selected by the slice from `self`. - -##### Returns: - - A dimension if `key` is an integer, or a `TensorShape` if `key` is a - slice. - -##### Raises: - - -* `ValueError`: If `key` is a slice, and any of its elements are negative, or - if `self` is completely unknown and the step is set. - - -- - - - -#### `tf.TensorShape.__init__(dims)` {#TensorShape.__init__} - -Creates a new TensorShape with the given dimensions. - -##### Args: - - -* `dims`: A list of Dimensions, or None if the shape is unspecified. -* `DEPRECATED`: A single integer is treated as a singleton list. - -##### Raises: - - -* `TypeError`: If dims cannot be converted to a list of dimensions. - - -- - - - -#### `tf.TensorShape.__iter__()` {#TensorShape.__iter__} - -Returns `self.dims` if the rank is known, otherwise raises ValueError. - - -- - - - -#### `tf.TensorShape.__len__()` {#TensorShape.__len__} - -Returns the rank of this shape, or raises ValueError if unspecified. - - -- - - - -#### `tf.TensorShape.__ne__(other)` {#TensorShape.__ne__} - -Returns True if `self` is known to be different from `other`. - - -- - - - -#### `tf.TensorShape.__nonzero__()` {#TensorShape.__nonzero__} - -Returns True if this shape contains non-zero information. - - -- - - - -#### `tf.TensorShape.__repr__()` {#TensorShape.__repr__} - - - - -- - - - -#### `tf.TensorShape.__str__()` {#TensorShape.__str__} - - - - -- - - - -#### `tf.TensorShape.as_list()` {#TensorShape.as_list} - -Returns a list of integers or `None` for each dimension. - -##### Returns: - - A list of integers or `None` for each dimension. - -##### Raises: - - -* `ValueError`: If `self` is an unknown shape with an unknown rank. - - -- - - - -#### `tf.TensorShape.as_proto()` {#TensorShape.as_proto} - -Returns this shape as a `TensorShapeProto`. - - -- - - - -#### `tf.TensorShape.assert_has_rank(rank)` {#TensorShape.assert_has_rank} - -Raises an exception if `self` is not compatible with the given `rank`. - -##### Args: - - -* `rank`: An integer. - -##### Raises: - - -* `ValueError`: If `self` does not represent a shape with the given `rank`. - - -- - - - -#### `tf.TensorShape.assert_is_compatible_with(other)` {#TensorShape.assert_is_compatible_with} - -Raises exception if `self` and `other` do not represent the same shape. - -This method can be used to assert that there exists a shape that both -`self` and `other` represent. - -##### Args: - - -* `other`: Another TensorShape. - -##### Raises: - - -* `ValueError`: If `self` and `other` do not represent the same shape. - - -- - - - -#### `tf.TensorShape.assert_is_fully_defined()` {#TensorShape.assert_is_fully_defined} - -Raises an exception if `self` is not fully defined in every dimension. - -##### Raises: - - -* `ValueError`: If `self` does not have a known value for every dimension. - - -- - - - -#### `tf.TensorShape.assert_same_rank(other)` {#TensorShape.assert_same_rank} - -Raises an exception if `self` and `other` do not have compatible ranks. - -##### Args: - - -* `other`: Another `TensorShape`. - -##### Raises: - - -* `ValueError`: If `self` and `other` do not represent shapes with the - same rank. - - -- - - - -#### `tf.TensorShape.concatenate(other)` {#TensorShape.concatenate} - -Returns the concatenation of the dimension in `self` and `other`. - -*N.B.* If either `self` or `other` is completely unknown, -concatenation will discard information about the other shape. In -future, we might support concatenation that preserves this -information for use with slicing. - -##### Args: - - -* `other`: Another `TensorShape`. - -##### Returns: - - A `TensorShape` whose dimensions are the concatenation of the - dimensions in `self` and `other`. - - -- - - - -#### `tf.TensorShape.dims` {#TensorShape.dims} - -Returns a list of Dimensions, or None if the shape is unspecified. - - -- - - - -#### `tf.TensorShape.is_compatible_with(other)` {#TensorShape.is_compatible_with} - -Returns True iff `self` is compatible with `other`. - -Two possibly-partially-defined shapes are compatible if there -exists a fully-defined shape that both shapes can represent. Thus, -compatibility allows the shape inference code to reason about -partially-defined shapes. For example: - -* TensorShape(None) is compatible with all shapes. - -* TensorShape([None, None]) is compatible with all two-dimensional - shapes, such as TensorShape([32, 784]), and also TensorShape(None). It is - not compatible with, for example, TensorShape([None]) or - TensorShape([None, None, None]). - -* TensorShape([32, None]) is compatible with all two-dimensional shapes - with size 32 in the 0th dimension, and also TensorShape([None, None]) - and TensorShape(None). It is not compatible with, for example, - TensorShape([32]), TensorShape([32, None, 1]) or TensorShape([64, None]). - -* TensorShape([32, 784]) is compatible with itself, and also - TensorShape([32, None]), TensorShape([None, 784]), TensorShape([None, - None]) and TensorShape(None). It is not compatible with, for example, - TensorShape([32, 1, 784]) or TensorShape([None]). - -The compatibility relation is reflexive and symmetric, but not -transitive. For example, TensorShape([32, 784]) is compatible with -TensorShape(None), and TensorShape(None) is compatible with -TensorShape([4, 4]), but TensorShape([32, 784]) is not compatible with -TensorShape([4, 4]). - -##### Args: - - -* `other`: Another TensorShape. - -##### Returns: - - True iff `self` is compatible with `other`. - - -- - - - -#### `tf.TensorShape.is_fully_defined()` {#TensorShape.is_fully_defined} - -Returns True iff `self` is fully defined in every dimension. - - -- - - - -#### `tf.TensorShape.merge_with(other)` {#TensorShape.merge_with} - -Returns a `TensorShape` combining the information in `self` and `other`. - -The dimensions in `self` and `other` are merged elementwise, -according to the rules defined for `Dimension.merge_with()`. - -##### Args: - - -* `other`: Another `TensorShape`. - -##### Returns: - - A `TensorShape` containing the combined information of `self` and - `other`. - -##### Raises: - - -* `ValueError`: If `self` and `other` are not compatible. - - -- - - - -#### `tf.TensorShape.ndims` {#TensorShape.ndims} - -Returns the rank of this shape, or None if it is unspecified. - - -- - - - -#### `tf.TensorShape.num_elements()` {#TensorShape.num_elements} - -Returns the total number of elements, or none for incomplete shapes. - - -- - - - -#### `tf.TensorShape.with_rank(rank)` {#TensorShape.with_rank} - -Returns a shape based on `self` with the given rank. - -This method promotes a completely unknown shape to one with a -known rank. - -##### Args: - - -* `rank`: An integer. - -##### Returns: - - A shape that is at least as specific as `self` with the given rank. - -##### Raises: - - -* `ValueError`: If `self` does not represent a shape with the given `rank`. - - -- - - - -#### `tf.TensorShape.with_rank_at_least(rank)` {#TensorShape.with_rank_at_least} - -Returns a shape based on `self` with at least the given rank. - -##### Args: - - -* `rank`: An integer. - -##### Returns: - - A shape that is at least as specific as `self` with at least the given - rank. - -##### Raises: - - -* `ValueError`: If `self` does not represent a shape with at least the given - `rank`. - - -- - - - -#### `tf.TensorShape.with_rank_at_most(rank)` {#TensorShape.with_rank_at_most} - -Returns a shape based on `self` with at most the given rank. - -##### Args: - - -* `rank`: An integer. - -##### Returns: - - A shape that is at least as specific as `self` with at most the given - rank. - -##### Raises: - - -* `ValueError`: If `self` does not represent a shape with at most the given - `rank`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.VarLenFeature.__new__.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.VarLenFeature.__new__.md deleted file mode 100644 index 282ca37e0b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.VarLenFeature.__new__.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.VarLenFeature.__new__(_cls, dtype)` {#VarLenFeature.__new__} - -Create new instance of VarLenFeature(dtype,) - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.VariableScope.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.VariableScope.md deleted file mode 100644 index c6fd98dd98..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.VariableScope.md +++ /dev/null @@ -1,159 +0,0 @@ -Variable scope object to carry defaults to provide to `get_variable`. - -Many of the arguments we need for `get_variable` in a variable store are most -easily handled with a context. This object is used for the defaults. - -Attributes: - name: name of the current scope, used as prefix in get_variable. - initializer: default initializer passed to get_variable. - regularizer: default regularizer passed to get_variable. - reuse: Boolean or None, setting the reuse in get_variable. - caching_device: string, callable, or None: the caching device passed to - get_variable. - partitioner: callable or `None`: the partitioner passed to `get_variable`. - custom_getter: default custom getter passed to get_variable. - name_scope: The name passed to `tf.name_scope`. - dtype: default type passed to get_variable (defaults to DT_FLOAT). - use_resource: if False, create a normal Variable; if True create an - experimental ResourceVariable with well-defined semantics. Defaults - to False (will later change to True). -- - - - -#### `tf.VariableScope.__init__(reuse, name='', initializer=None, regularizer=None, caching_device=None, partitioner=None, custom_getter=None, name_scope='', dtype=tf.float32, use_resource=None)` {#VariableScope.__init__} - -Creates a new VariableScope with the given properties. - - -- - - - -#### `tf.VariableScope.caching_device` {#VariableScope.caching_device} - - - - -- - - - -#### `tf.VariableScope.custom_getter` {#VariableScope.custom_getter} - - - - -- - - - -#### `tf.VariableScope.dtype` {#VariableScope.dtype} - - - - -- - - - -#### `tf.VariableScope.get_variable(var_store, name, shape=None, dtype=None, initializer=None, regularizer=None, trainable=True, collections=None, caching_device=None, partitioner=None, validate_shape=True, use_resource=None, custom_getter=None)` {#VariableScope.get_variable} - -Gets an existing variable with this name or create a new one. - - -- - - - -#### `tf.VariableScope.initializer` {#VariableScope.initializer} - - - - -- - - - -#### `tf.VariableScope.name` {#VariableScope.name} - - - - -- - - - -#### `tf.VariableScope.original_name_scope` {#VariableScope.original_name_scope} - - - - -- - - - -#### `tf.VariableScope.partitioner` {#VariableScope.partitioner} - - - - -- - - - -#### `tf.VariableScope.regularizer` {#VariableScope.regularizer} - - - - -- - - - -#### `tf.VariableScope.reuse` {#VariableScope.reuse} - - - - -- - - - -#### `tf.VariableScope.reuse_variables()` {#VariableScope.reuse_variables} - -Reuse variables in this scope. - - -- - - - -#### `tf.VariableScope.set_caching_device(caching_device)` {#VariableScope.set_caching_device} - -Set caching_device for this scope. - - -- - - - -#### `tf.VariableScope.set_custom_getter(custom_getter)` {#VariableScope.set_custom_getter} - -Set custom getter for this scope. - - -- - - - -#### `tf.VariableScope.set_dtype(dtype)` {#VariableScope.set_dtype} - -Set data type for this scope. - - -- - - - -#### `tf.VariableScope.set_initializer(initializer)` {#VariableScope.set_initializer} - -Set initializer for this scope. - - -- - - - -#### `tf.VariableScope.set_partitioner(partitioner)` {#VariableScope.set_partitioner} - -Set partitioner for this scope. - - -- - - - -#### `tf.VariableScope.set_regularizer(regularizer)` {#VariableScope.set_regularizer} - -Set regularizer for this scope. - - -- - - - -#### `tf.VariableScope.set_use_resource(use_resource)` {#VariableScope.set_use_resource} - -Sets whether to use ResourceVariables for this scope. - - -- - - - -#### `tf.VariableScope.use_resource` {#VariableScope.use_resource} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.add_check_numerics_ops.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.add_check_numerics_ops.md deleted file mode 100644 index 5895f744b8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.add_check_numerics_ops.md +++ /dev/null @@ -1,13 +0,0 @@ -### `tf.add_check_numerics_ops()` {#add_check_numerics_ops} - -Connect a `check_numerics` to every floating point tensor. - -`check_numerics` operations themselves are added for each `half`, `float`, -or `double` tensor in the graph. For all ops in the graph, the -`check_numerics` op for all of its (`half`, `float`, or `double`) inputs -is guaranteed to run before the `check_numerics` op on any of its outputs. - -##### Returns: - - A `group` op depending on all `check_numerics` ops added. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.add_n.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.add_n.md deleted file mode 100644 index 306aaf4ddd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.add_n.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.add_n(inputs, name=None)` {#add_n} - -Adds all input tensors element-wise. - -##### Args: - - -* `inputs`: A list of `Tensor` objects, each with same shape and type. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of same shape and type as the elements of `inputs`. - -##### Raises: - - -* `ValueError`: If `inputs` don't all have same shape and dtype or the shape - cannot be inferred. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.add_to_collection.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.add_to_collection.md deleted file mode 100644 index 1d8d752917..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.add_to_collection.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.add_to_collection(name, value)` {#add_to_collection} - -Wrapper for `Graph.add_to_collection()` using the default graph. - -See [`Graph.add_to_collection()`](../../api_docs/python/framework.md#Graph.add_to_collection) -for more details. - -##### Args: - - -* `name`: The key for the collection. For example, the `GraphKeys` class - contains many standard names for collections. -* `value`: The value to add to the collection. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.assert_greater_equal.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.assert_greater_equal.md deleted file mode 100644 index 3674f530e7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.assert_greater_equal.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.assert_greater_equal(x, y, data=None, summarize=None, message=None, name=None)` {#assert_greater_equal} - -Assert the condition `x >= y` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_greater_equal(x, y)]): - output = tf.reduce_sum(x) -``` - -This condition holds if for every pair of (possibly broadcast) elements -`x[i]`, `y[i]`, we have `x[i] >= y[i]`. -If both `x` and `y` are empty, this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `y`: Numeric `Tensor`, same dtype as and broadcastable to `x`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`, `y`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to - "assert_greater_equal" - -##### Returns: - - Op that raises `InvalidArgumentError` if `x >= y` is False. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.assert_non_positive.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.assert_non_positive.md deleted file mode 100644 index 7f9547f39d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.assert_non_positive.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.assert_non_positive(x, data=None, summarize=None, message=None, name=None)` {#assert_non_positive} - -Assert the condition `x <= 0` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_non_positive(x)]): - output = tf.reduce_sum(x) -``` - -Non-positive means, for every element `x[i]` of `x`, we have `x[i] <= 0`. -If `x` is empty this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). - Defaults to "assert_non_positive". - -##### Returns: - - Op raising `InvalidArgumentError` unless `x` is all non-positive. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.case.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.case.md deleted file mode 100644 index 02bae13a15..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.case.md +++ /dev/null @@ -1,75 +0,0 @@ -### `tf.case(pred_fn_pairs, default, exclusive=False, name='case')` {#case} - -Create a case operation. - -The `pred_fn_pairs` parameter is a dict or list of pairs of size N. -Each pair contains a boolean scalar tensor and a python callable that -creates the tensors to be returned if the boolean evaluates to True. -`default` is a callable generating a list of tensors. All the callables -in `pred_fn_pairs` as well as `default` should return the same number -and types of tensors. - -If `exclusive==True`, all predicates are evaluated, and an exception is -thrown if more than one of the predicates evaluates to `True`. -If `exclusive==False`, execution stops are the first predicate which -evaluates to True, and the tensors generated by the corresponding function -are returned immediately. If none of the predicates evaluate to True, this -operation returns the tensors generated by `default`. - -Example 1: - Pseudocode: - ``` - if (x < y) return 17; - else return 23; - ``` - - Expressions: - ``` - f1 = lambda: tf.constant(17) - f2 = lambda: tf.constant(23) - r = case([(tf.less(x, y), f1)], default=f2) - ``` - -Example 2: - Pseudocode: - ``` - if (x < y && x > z) raise OpError("Only one predicate may evaluate true"); - if (x < y) return 17; - else if (x > z) return 23; - else return -1; - ``` - - Expressions: - ``` - x = tf.constant(0) - y = tf.constant(1) - z = tf.constant(2) - def f1(): return tf.constant(17) - def f2(): return tf.constant(23) - def f3(): return tf.constant(-1) - r = case({tf.less(x, y): f1, tf.greater(x, z): f2}, - default=f3, exclusive=True) - ``` - -##### Args: - - -* `pred_fn_pairs`: Dict or list of pairs of a boolean scalar tensor and a - callable which returns a list of tensors. -* `default`: A callable that returns a list of tensors. -* `exclusive`: True iff at most one predicate is allowed to evaluate to `True`. -* `name`: A name for this operation (optional). - -##### Returns: - - The tensors returned by the first pair whose predicate evaluated to True, or - those returned by `default` if none does. - -##### Raises: - - -* `TypeError`: If `pred_fn_pairs` is not a list/dictionary. -* `TypeError`: If `pred_fn_pairs` is a list but does not contain 2-tuples. -* `TypeError`: If `fns[i]` is not callable for any i, or `default` is not - callable. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.cholesky.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.cholesky.md deleted file mode 100644 index 046c443925..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.cholesky.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.cholesky(input, name=None)` {#cholesky} - -Computes the Cholesky decomposition of one or more square matrices. - -The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions -form square matrices, with the same constraints as the single matrix Cholesky -decomposition above. The output is a tensor of the same shape as the input -containing the Cholesky decompositions for all input submatrices `[..., :, :]`. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float64`, `float32`. - Shape is `[..., M, M]`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. Shape is `[..., M, M]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.cond.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.cond.md deleted file mode 100644 index bb94a0610a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.cond.md +++ /dev/null @@ -1,54 +0,0 @@ -### `tf.cond(pred, fn1, fn2, name=None)` {#cond} - -Return either fn1() or fn2() based on the boolean predicate `pred`. - -`fn1` and `fn2` both return lists of output tensors. `fn1` and `fn2` must have -the same non-zero number and type of outputs. - -Note that the conditional execution applies only to the operations defined in -fn1 and fn2. Consider the following simple program: - -```python -z = tf.multiply(a, b) -result = tf.cond(x < y, lambda: tf.add(x, z), lambda: tf.square(y)) -``` - -If x < y, the `tf.add` operation will be executed and `tf.square` -operation will not be executed. Since z is needed for at least one -branch of the cond, the `tf.multiply` operation is always executed, unconditionally. -Although this behavior is consistent with the dataflow model of TensorFlow, -it has occasionally surprised some users who expected a lazier semantics. - -##### Args: - - -* `pred`: A scalar determining whether to return the result of `fn1` or `fn2`. -* `fn1`: The callable to be performed if pred is true. -* `fn2`: The callable to be performed if pref is false. -* `name`: Optional name prefix for the returned tensors. - -##### Returns: - - Tensors returned by the call to either `fn1` or `fn2`. If the callables - return a singleton list, the element is extracted from the list. - -##### Raises: - - -* `TypeError`: if `fn1` or `fn2` is not callable. -* `ValueError`: if `fn1` and `fn2` do not return the same number of tensors, or - return tensors of different types. - - -* `Example`: - -```python - x = tf.constant(2) - y = tf.constant(5) - def f1(): return tf.multiply(x, 17) - def f2(): return tf.add(y, 23) - r = tf.cond(tf.less(x, y), f1, f2) - # r is set to f1(). - # Operations in f2 (e.g., tf.add) are not executed. -``` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.md deleted file mode 100644 index da7082ffb6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.md +++ /dev/null @@ -1,89 +0,0 @@ -A StochasticTensor with an observed value. -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.__init__(dist, value, name=None)` {#ObservedStochasticTensor.__init__} - -Construct an `ObservedStochasticTensor`. - -`ObservedStochasticTensor` is backed by distribution `dist` and uses the -provided value instead of using the current value type to draw a value from -the distribution. The provided value argument must be appropriately shaped -to have come from the distribution. - -##### Args: - - -* `dist`: an instance of `Distribution`. -* `value`: a Tensor containing the observed value -* `name`: a name for this `ObservedStochasticTensor` and its ops. - -##### Raises: - - -* `TypeError`: if `dist` is not an instance of `Distribution`. -* `ValueError`: if `value` is not compatible with the distribution. - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.distribution` {#ObservedStochasticTensor.distribution} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.dtype` {#ObservedStochasticTensor.dtype} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.entropy(name='entropy')` {#ObservedStochasticTensor.entropy} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.graph` {#ObservedStochasticTensor.graph} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.loss(final_loss, name=None)` {#ObservedStochasticTensor.loss} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.mean(name='mean')` {#ObservedStochasticTensor.mean} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.name` {#ObservedStochasticTensor.name} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.value(name='value')` {#ObservedStochasticTensor.value} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.ObservedStochasticTensor.value_type` {#ObservedStochasticTensor.value_type} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Bernoulli.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Bernoulli.md deleted file mode 100644 index 0a5bca5052..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Bernoulli.md +++ /dev/null @@ -1,593 +0,0 @@ -Bernoulli distribution. - -The Bernoulli distribution with `probs` parameter, i.e., the probability of a -`1` outcome (vs a `0` outcome). -- - - - -#### `tf.contrib.distributions.Bernoulli.__init__(logits=None, probs=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='Bernoulli')` {#Bernoulli.__init__} - -Construct Bernoulli distributions. - -##### Args: - - -* `logits`: An N-D `Tensor` representing the log-odds of a `1` event. Each - entry in the `Tensor` parametrizes an independent Bernoulli distribution - where the probability of an event is sigmoid(logits). Only one of - `logits` or `probs` should be passed in. -* `probs`: An N-D `Tensor` representing the probability of a `1` - event. Each entry in the `Tensor` parameterizes an independent - Bernoulli distribution. Only one of `logits` or `probs` should be passed - in. -* `dtype`: The type of the event samples. Default: `int32`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, - statistics (e.g., mean, mode, variance) use the value "`NaN`" to - indicate the result is undefined. When `False`, an exception is raised - if one or more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `ValueError`: If p and logits are passed, or if neither are passed. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.allow_nan_stats` {#Bernoulli.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.batch_shape` {#Bernoulli.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.batch_shape_tensor(name='batch_shape_tensor')` {#Bernoulli.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.cdf(value, name='cdf')` {#Bernoulli.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.copy(**override_parameters_kwargs)` {#Bernoulli.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.covariance(name='covariance')` {#Bernoulli.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.dtype` {#Bernoulli.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.entropy(name='entropy')` {#Bernoulli.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.event_shape` {#Bernoulli.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.event_shape_tensor(name='event_shape_tensor')` {#Bernoulli.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.is_continuous` {#Bernoulli.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Bernoulli.is_scalar_batch(name='is_scalar_batch')` {#Bernoulli.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.is_scalar_event(name='is_scalar_event')` {#Bernoulli.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.log_cdf(value, name='log_cdf')` {#Bernoulli.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.log_prob(value, name='log_prob')` {#Bernoulli.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.log_survival_function(value, name='log_survival_function')` {#Bernoulli.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.logits` {#Bernoulli.logits} - -Log-odds of a `1` outcome (vs `0`). - - -- - - - -#### `tf.contrib.distributions.Bernoulli.mean(name='mean')` {#Bernoulli.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.mode(name='mode')` {#Bernoulli.mode} - -Mode. - -Additional documentation from `Bernoulli`: - -Returns `1` if `prob > 0.5` and `0` otherwise. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.name` {#Bernoulli.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Bernoulli.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.param_static_shapes(cls, sample_shape)` {#Bernoulli.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.parameters` {#Bernoulli.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.prob(value, name='prob')` {#Bernoulli.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.probs` {#Bernoulli.probs} - -Probability of a `1` outcome (vs `0`). - - -- - - - -#### `tf.contrib.distributions.Bernoulli.reparameterization_type` {#Bernoulli.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.sample(sample_shape=(), seed=None, name='sample')` {#Bernoulli.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.stddev(name='stddev')` {#Bernoulli.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.survival_function(value, name='survival_function')` {#Bernoulli.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.validate_args` {#Bernoulli.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Bernoulli.variance(name='variance')` {#Bernoulli.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Chi2WithAbsDf.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Chi2WithAbsDf.md deleted file mode 100644 index a6b66f8560..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Chi2WithAbsDf.md +++ /dev/null @@ -1,572 +0,0 @@ -Chi2 with parameter transform `df = floor(abs(df))`. -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.__init__(df, validate_args=False, allow_nan_stats=True, name='Chi2WithAbsDf')` {#Chi2WithAbsDf.__init__} - - - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.allow_nan_stats` {#Chi2WithAbsDf.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.batch_shape` {#Chi2WithAbsDf.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.batch_shape_tensor(name='batch_shape_tensor')` {#Chi2WithAbsDf.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.cdf(value, name='cdf')` {#Chi2WithAbsDf.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.concentration` {#Chi2WithAbsDf.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.copy(**override_parameters_kwargs)` {#Chi2WithAbsDf.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.covariance(name='covariance')` {#Chi2WithAbsDf.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.df` {#Chi2WithAbsDf.df} - - - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.dtype` {#Chi2WithAbsDf.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.entropy(name='entropy')` {#Chi2WithAbsDf.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.event_shape` {#Chi2WithAbsDf.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.event_shape_tensor(name='event_shape_tensor')` {#Chi2WithAbsDf.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.is_continuous` {#Chi2WithAbsDf.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.is_scalar_batch(name='is_scalar_batch')` {#Chi2WithAbsDf.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.is_scalar_event(name='is_scalar_event')` {#Chi2WithAbsDf.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.log_cdf(value, name='log_cdf')` {#Chi2WithAbsDf.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.log_prob(value, name='log_prob')` {#Chi2WithAbsDf.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.log_survival_function(value, name='log_survival_function')` {#Chi2WithAbsDf.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.mean(name='mean')` {#Chi2WithAbsDf.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.mode(name='mode')` {#Chi2WithAbsDf.mode} - -Mode. - -Additional documentation from `Gamma`: - -The mode of a gamma distribution is `(shape - 1) / rate` when -`shape > 1`, and `NaN` otherwise. If `self.allow_nan_stats` is `False`, -an exception will be raised rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.name` {#Chi2WithAbsDf.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Chi2WithAbsDf.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.param_static_shapes(cls, sample_shape)` {#Chi2WithAbsDf.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.parameters` {#Chi2WithAbsDf.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.prob(value, name='prob')` {#Chi2WithAbsDf.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.rate` {#Chi2WithAbsDf.rate} - -Rate parameter. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.reparameterization_type` {#Chi2WithAbsDf.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.sample(sample_shape=(), seed=None, name='sample')` {#Chi2WithAbsDf.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.stddev(name='stddev')` {#Chi2WithAbsDf.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.survival_function(value, name='survival_function')` {#Chi2WithAbsDf.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.validate_args` {#Chi2WithAbsDf.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Chi2WithAbsDf.variance(name='variance')` {#Chi2WithAbsDf.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Dirichlet.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Dirichlet.md deleted file mode 100644 index 3d6690ab9a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Dirichlet.md +++ /dev/null @@ -1,682 +0,0 @@ -Dirichlet distribution. - -The Dirichlet distribution is defined over the -[`(k-1)`-simplex](https://en.wikipedia.org/wiki/Simplex) using a positive, -length-`k` vector `concentration` (`k > 1`). The Dirichlet is identically the -Beta distribution when `k = 2`. - -#### Mathematical Details - -The Dirichlet is a distribution over the open `(k-1)`-simplex, i.e., - -```none -S^{k-1} = { (x_0, ..., x_{k-1}) in R^k : sum_j x_j = 1 and all_j x_j > 0 }. -``` - -The probability density function (pdf) is, - -```none -pdf(x; alpha) = prod_j x_j**(alpha_j - 1) / Z -Z = prod_j Gamma(alpha_j) / Gamma(sum_j alpha_j) -``` - -where: - -* `x in S^{k-1}`, i.e., the `(k-1)`-simplex, -* `concentration = alpha = [alpha_0, ..., alpha_{k-1}]`, `alpha_j > 0`, -* `Z` is the normalization constant aka the [multivariate beta function]( - https://en.wikipedia.org/wiki/Beta_function#Multivariate_beta_function), - and, -* `Gamma` is the [gamma function]( - https://en.wikipedia.org/wiki/Gamma_function). - -The `concentration` represents mean total counts of class occurrence, i.e., - -```none -concentration = alpha = mean * total_concentration -``` - -where `mean` in `S^{k-1}` and `total_concentration` is a positive real number -representing a mean total count. - -Distribution parameters are automatically broadcast in all functions; see -examples for details. - -#### Examples - -```python -# Create a single trivariate Dirichlet, with the 3rd class being three times -# more frequent than the first. I.e., batch_shape=[], event_shape=[3]. -alpha = [1., 2, 3] -dist = Dirichlet(alpha) - -dist.sample([4, 5]) # shape: [4, 5, 3] - -# x has one sample, one batch, three classes: -x = [.2, .3, .5] # shape: [3] -dist.prob(x) # shape: [] - -# x has two samples from one batch: -x = [[.1, .4, .5], - [.2, .3, .5]] -dist.prob(x) # shape: [2] - -# alpha will be broadcast to shape [5, 7, 3] to match x. -x = [[...]] # shape: [5, 7, 3] -dist.prob(x) # shape: [5, 7] -``` - -```python -# Create batch_shape=[2], event_shape=[3]: -alpha = [[1., 2, 3], - [4, 5, 6]] # shape: [2, 3] -dist = Dirichlet(alpha) - -dist.sample([4, 5]) # shape: [4, 5, 2, 3] - -x = [.2, .3, .5] -# x will be broadcast as [[.2, .3, .5], -# [.2, .3, .5]], -# thus matching batch_shape [2, 3]. -dist.prob(x) # shape: [2] -``` -- - - - -#### `tf.contrib.distributions.Dirichlet.__init__(concentration, validate_args=False, allow_nan_stats=True, name='Dirichlet')` {#Dirichlet.__init__} - -Initialize a batch of Dirichlet distributions. - -##### Args: - - -* `concentration`: Positive floating-point `Tensor` indicating mean number - of class occurrences; aka "alpha". Implies `self.dtype`, and - `self.batch_shape`, `self.event_shape`, i.e., if - `concentration.shape = [N1, N2, ..., Nm, k]` then - `batch_shape = [N1, N2, ..., Nm]` and - `event_shape = [k]`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.allow_nan_stats` {#Dirichlet.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.batch_shape` {#Dirichlet.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.batch_shape_tensor(name='batch_shape_tensor')` {#Dirichlet.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.cdf(value, name='cdf')` {#Dirichlet.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.concentration` {#Dirichlet.concentration} - -Concentration parameter; expected counts for that coordinate. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.copy(**override_parameters_kwargs)` {#Dirichlet.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.covariance(name='covariance')` {#Dirichlet.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.dtype` {#Dirichlet.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.entropy(name='entropy')` {#Dirichlet.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.event_shape` {#Dirichlet.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.event_shape_tensor(name='event_shape_tensor')` {#Dirichlet.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.is_continuous` {#Dirichlet.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Dirichlet.is_scalar_batch(name='is_scalar_batch')` {#Dirichlet.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.is_scalar_event(name='is_scalar_event')` {#Dirichlet.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.log_cdf(value, name='log_cdf')` {#Dirichlet.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.log_prob(value, name='log_prob')` {#Dirichlet.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Dirichlet`: - -Note: `value` must be a non-negative tensor with -dtype `self.dtype` and be in the `(self.event_shape() - 1)`-simplex, i.e., -`tf.reduce_sum(value, -1) = 1`. It must have a shape compatible with -`self.batch_shape() + self.event_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.log_survival_function(value, name='log_survival_function')` {#Dirichlet.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.mean(name='mean')` {#Dirichlet.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.mode(name='mode')` {#Dirichlet.mode} - -Mode. - -Additional documentation from `Dirichlet`: - -Note: The mode is undefined when any `concentration <= 1`. If -`self.allow_nan_stats` is `True`, `NaN` is used for undefined modes. If -`self.allow_nan_stats` is `False` an exception is raised when one or more -modes are undefined. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.name` {#Dirichlet.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Dirichlet.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.param_static_shapes(cls, sample_shape)` {#Dirichlet.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.parameters` {#Dirichlet.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.prob(value, name='prob')` {#Dirichlet.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Dirichlet`: - -Note: `value` must be a non-negative tensor with -dtype `self.dtype` and be in the `(self.event_shape() - 1)`-simplex, i.e., -`tf.reduce_sum(value, -1) = 1`. It must have a shape compatible with -`self.batch_shape() + self.event_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.reparameterization_type` {#Dirichlet.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.sample(sample_shape=(), seed=None, name='sample')` {#Dirichlet.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.stddev(name='stddev')` {#Dirichlet.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.survival_function(value, name='survival_function')` {#Dirichlet.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.total_concentration` {#Dirichlet.total_concentration} - -Sum of last dim of concentration parameter. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.validate_args` {#Dirichlet.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Dirichlet.variance(name='variance')` {#Dirichlet.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Distribution.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Distribution.md deleted file mode 100644 index 0076cdc4ff..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.Distribution.md +++ /dev/null @@ -1,690 +0,0 @@ -A generic probability distribution base class. - -`Distribution` is a base class for constructing and organizing properties -(e.g., mean, variance) of random variables (e.g, Bernoulli, Gaussian). - -### Subclassing - -Subclasses are expected to implement a leading-underscore version of the -same-named function. The argument signature should be identical except for -the omission of `name="..."`. For example, to enable `log_prob(value, -name="log_prob")` a subclass should implement `_log_prob(value)`. - -Subclasses can append to public-level docstrings by providing -docstrings for their method specializations. For example: - -```python -@distribution_util.AppendDocstring("Some other details.") -def _log_prob(self, value): - ... -``` - -would add the string "Some other details." to the `log_prob` function -docstring. This is implemented as a simple decorator to avoid python -linter complaining about missing Args/Returns/Raises sections in the -partial docstrings. - -### Broadcasting, batching, and shapes - -All distributions support batches of independent distributions of that type. -The batch shape is determined by broadcasting together the parameters. - -The shape of arguments to `__init__`, `cdf`, `log_cdf`, `prob`, and -`log_prob` reflect this broadcasting, as does the return value of `sample` and -`sample_n`. - -`sample_n_shape = [n] + batch_shape + event_shape`, where `sample_n_shape` is -the shape of the `Tensor` returned from `sample_n`, `n` is the number of -samples, `batch_shape` defines how many independent distributions there are, -and `event_shape` defines the shape of samples from each of those independent -distributions. Samples are independent along the `batch_shape` dimensions, but -not necessarily so along the `event_shape` dimensions (depending on the -particulars of the underlying distribution). - -Using the `Uniform` distribution as an example: - -```python -minval = 3.0 -maxval = [[4.0, 6.0], - [10.0, 12.0]] - -# Broadcasting: -# This instance represents 4 Uniform distributions. Each has a lower bound at -# 3.0 as the `minval` parameter was broadcasted to match `maxval`'s shape. -u = Uniform(minval, maxval) - -# `event_shape` is `TensorShape([])`. -event_shape = u.event_shape -# `event_shape_t` is a `Tensor` which will evaluate to []. -event_shape_t = u.event_shape_tensor() - -# Sampling returns a sample per distribution. `samples` has shape -# [5, 2, 2], which is [n] + batch_shape + event_shape, where n=5, -# batch_shape=[2, 2], and event_shape=[]. -samples = u.sample_n(5) - -# The broadcasting holds across methods. Here we use `cdf` as an example. The -# same holds for `log_cdf` and the likelihood functions. - -# `cum_prob` has shape [2, 2] as the `value` argument was broadcasted to the -# shape of the `Uniform` instance. -cum_prob_broadcast = u.cdf(4.0) - -# `cum_prob`'s shape is [2, 2], one per distribution. No broadcasting -# occurred. -cum_prob_per_dist = u.cdf([[4.0, 5.0], - [6.0, 7.0]]) - -# INVALID as the `value` argument is not broadcastable to the distribution's -# shape. -cum_prob_invalid = u.cdf([4.0, 5.0, 6.0]) -``` - -### Parameter values leading to undefined statistics or distributions. - -Some distributions do not have well-defined statistics for all initialization -parameter values. For example, the beta distribution is parameterized by -positive real numbers `concentration1` and `concentration0`, and does not have -well-defined mode if `concentration1 < 1` or `concentration0 < 1`. - -The user is given the option of raising an exception or returning `NaN`. - -```python -a = tf.exp(tf.matmul(logits, weights_a)) -b = tf.exp(tf.matmul(logits, weights_b)) - -# Will raise exception if ANY batch member has a < 1 or b < 1. -dist = distributions.beta(a, b, allow_nan_stats=False) -mode = dist.mode().eval() - -# Will return NaN for batch members with either a < 1 or b < 1. -dist = distributions.beta(a, b, allow_nan_stats=True) # Default behavior -mode = dist.mode().eval() -``` - -In all cases, an exception is raised if *invalid* parameters are passed, e.g. - -```python -# Will raise an exception if any Op is run. -negative_a = -1.0 * a # beta distribution by definition has a > 0. -dist = distributions.beta(negative_a, b, allow_nan_stats=True) -dist.mean().eval() -``` -- - - - -#### `tf.contrib.distributions.Distribution.__init__(dtype, is_continuous, reparameterization_type, validate_args, allow_nan_stats, parameters=None, graph_parents=None, name=None)` {#Distribution.__init__} - -Constructs the `Distribution`. - -**This is a private method for subclass use.** - -##### Args: - - -* `dtype`: The type of the event samples. `None` implies no type-enforcement. -* `is_continuous`: Python `bool`. If `True` this `Distribution` is continuous - over its supported domain. -* `reparameterization_type`: Instance of `ReparameterizationType`. - If `distributions.FULLY_REPARAMETERIZED`, this - `Distribution` can be reparameterized in terms of some standard - distribution with a function whose Jacobian is constant for the support - of the standard distribution. If `distributions.NOT_REPARAMETERIZED`, - then no such reparameterization is available. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `parameters`: Python `dict` of parameters used to instantiate this - `Distribution`. -* `graph_parents`: Python `list` of graph prerequisites of this - `Distribution`. -* `name`: Python `str` name prefixed to Ops created by this class. Default: - subclass name. - -##### Raises: - - -* `ValueError`: if any member of graph_parents is `None` or not a `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Distribution.allow_nan_stats` {#Distribution.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Distribution.batch_shape` {#Distribution.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Distribution.batch_shape_tensor(name='batch_shape_tensor')` {#Distribution.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Distribution.cdf(value, name='cdf')` {#Distribution.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Distribution.copy(**override_parameters_kwargs)` {#Distribution.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Distribution.covariance(name='covariance')` {#Distribution.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Distribution.dtype` {#Distribution.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Distribution.entropy(name='entropy')` {#Distribution.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Distribution.event_shape` {#Distribution.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Distribution.event_shape_tensor(name='event_shape_tensor')` {#Distribution.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Distribution.is_continuous` {#Distribution.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Distribution.is_scalar_batch(name='is_scalar_batch')` {#Distribution.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Distribution.is_scalar_event(name='is_scalar_event')` {#Distribution.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Distribution.log_cdf(value, name='log_cdf')` {#Distribution.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Distribution.log_prob(value, name='log_prob')` {#Distribution.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Distribution.log_survival_function(value, name='log_survival_function')` {#Distribution.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Distribution.mean(name='mean')` {#Distribution.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Distribution.mode(name='mode')` {#Distribution.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Distribution.name` {#Distribution.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Distribution.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Distribution.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Distribution.param_static_shapes(cls, sample_shape)` {#Distribution.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Distribution.parameters` {#Distribution.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Distribution.prob(value, name='prob')` {#Distribution.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Distribution.reparameterization_type` {#Distribution.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Distribution.sample(sample_shape=(), seed=None, name='sample')` {#Distribution.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Distribution.stddev(name='stddev')` {#Distribution.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Distribution.survival_function(value, name='survival_function')` {#Distribution.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Distribution.validate_args` {#Distribution.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Distribution.variance(name='variance')` {#Distribution.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.GammaWithSoftplusConcentrationRate.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.GammaWithSoftplusConcentrationRate.md deleted file mode 100644 index 059ab2b546..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.GammaWithSoftplusConcentrationRate.md +++ /dev/null @@ -1,565 +0,0 @@ -`Gamma` with softplus of `concentration` and `rate`. -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.__init__(concentration, rate, validate_args=False, allow_nan_stats=True, name='GammaWithSoftplusConcentrationRate')` {#GammaWithSoftplusConcentrationRate.__init__} - - - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.allow_nan_stats` {#GammaWithSoftplusConcentrationRate.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.batch_shape` {#GammaWithSoftplusConcentrationRate.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.batch_shape_tensor(name='batch_shape_tensor')` {#GammaWithSoftplusConcentrationRate.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.cdf(value, name='cdf')` {#GammaWithSoftplusConcentrationRate.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.concentration` {#GammaWithSoftplusConcentrationRate.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.copy(**override_parameters_kwargs)` {#GammaWithSoftplusConcentrationRate.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.covariance(name='covariance')` {#GammaWithSoftplusConcentrationRate.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.dtype` {#GammaWithSoftplusConcentrationRate.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.entropy(name='entropy')` {#GammaWithSoftplusConcentrationRate.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.event_shape` {#GammaWithSoftplusConcentrationRate.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.event_shape_tensor(name='event_shape_tensor')` {#GammaWithSoftplusConcentrationRate.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.is_continuous` {#GammaWithSoftplusConcentrationRate.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.is_scalar_batch(name='is_scalar_batch')` {#GammaWithSoftplusConcentrationRate.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.is_scalar_event(name='is_scalar_event')` {#GammaWithSoftplusConcentrationRate.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.log_cdf(value, name='log_cdf')` {#GammaWithSoftplusConcentrationRate.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.log_prob(value, name='log_prob')` {#GammaWithSoftplusConcentrationRate.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.log_survival_function(value, name='log_survival_function')` {#GammaWithSoftplusConcentrationRate.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.mean(name='mean')` {#GammaWithSoftplusConcentrationRate.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.mode(name='mode')` {#GammaWithSoftplusConcentrationRate.mode} - -Mode. - -Additional documentation from `Gamma`: - -The mode of a gamma distribution is `(shape - 1) / rate` when -`shape > 1`, and `NaN` otherwise. If `self.allow_nan_stats` is `False`, -an exception will be raised rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.name` {#GammaWithSoftplusConcentrationRate.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#GammaWithSoftplusConcentrationRate.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.param_static_shapes(cls, sample_shape)` {#GammaWithSoftplusConcentrationRate.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.parameters` {#GammaWithSoftplusConcentrationRate.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.prob(value, name='prob')` {#GammaWithSoftplusConcentrationRate.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.rate` {#GammaWithSoftplusConcentrationRate.rate} - -Rate parameter. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.reparameterization_type` {#GammaWithSoftplusConcentrationRate.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.sample(sample_shape=(), seed=None, name='sample')` {#GammaWithSoftplusConcentrationRate.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.stddev(name='stddev')` {#GammaWithSoftplusConcentrationRate.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.survival_function(value, name='survival_function')` {#GammaWithSoftplusConcentrationRate.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.validate_args` {#GammaWithSoftplusConcentrationRate.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.GammaWithSoftplusConcentrationRate.variance(name='variance')` {#GammaWithSoftplusConcentrationRate.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.md deleted file mode 100644 index e99645559c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.md +++ /dev/null @@ -1,578 +0,0 @@ -`InverseGamma` with softplus of `concentration` and `rate`. -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.__init__(concentration, rate, validate_args=False, allow_nan_stats=True, name='InverseGammaWithSoftplusConcentrationRate')` {#InverseGammaWithSoftplusConcentrationRate.__init__} - - - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.allow_nan_stats` {#InverseGammaWithSoftplusConcentrationRate.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.batch_shape` {#InverseGammaWithSoftplusConcentrationRate.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.batch_shape_tensor(name='batch_shape_tensor')` {#InverseGammaWithSoftplusConcentrationRate.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.cdf(value, name='cdf')` {#InverseGammaWithSoftplusConcentrationRate.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.concentration` {#InverseGammaWithSoftplusConcentrationRate.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.copy(**override_parameters_kwargs)` {#InverseGammaWithSoftplusConcentrationRate.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.covariance(name='covariance')` {#InverseGammaWithSoftplusConcentrationRate.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.dtype` {#InverseGammaWithSoftplusConcentrationRate.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.entropy(name='entropy')` {#InverseGammaWithSoftplusConcentrationRate.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.event_shape` {#InverseGammaWithSoftplusConcentrationRate.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.event_shape_tensor(name='event_shape_tensor')` {#InverseGammaWithSoftplusConcentrationRate.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.is_continuous` {#InverseGammaWithSoftplusConcentrationRate.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.is_scalar_batch(name='is_scalar_batch')` {#InverseGammaWithSoftplusConcentrationRate.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.is_scalar_event(name='is_scalar_event')` {#InverseGammaWithSoftplusConcentrationRate.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.log_cdf(value, name='log_cdf')` {#InverseGammaWithSoftplusConcentrationRate.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.log_prob(value, name='log_prob')` {#InverseGammaWithSoftplusConcentrationRate.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.log_survival_function(value, name='log_survival_function')` {#InverseGammaWithSoftplusConcentrationRate.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.mean(name='mean')` {#InverseGammaWithSoftplusConcentrationRate.mean} - -Mean. - -Additional documentation from `InverseGamma`: - -The mean of an inverse gamma distribution is -`rate / (concentration - 1)`, when `concentration > 1`, and `NaN` -otherwise. If `self.allow_nan_stats` is `False`, an exception will be -raised rather than returning `NaN` - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.mode(name='mode')` {#InverseGammaWithSoftplusConcentrationRate.mode} - -Mode. - -Additional documentation from `InverseGamma`: - -The mode of an inverse gamma distribution is `rate / (concentration + -1)`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.name` {#InverseGammaWithSoftplusConcentrationRate.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#InverseGammaWithSoftplusConcentrationRate.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.param_static_shapes(cls, sample_shape)` {#InverseGammaWithSoftplusConcentrationRate.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.parameters` {#InverseGammaWithSoftplusConcentrationRate.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.prob(value, name='prob')` {#InverseGammaWithSoftplusConcentrationRate.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.rate` {#InverseGammaWithSoftplusConcentrationRate.rate} - -Rate parameter. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.reparameterization_type` {#InverseGammaWithSoftplusConcentrationRate.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.sample(sample_shape=(), seed=None, name='sample')` {#InverseGammaWithSoftplusConcentrationRate.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.stddev(name='stddev')` {#InverseGammaWithSoftplusConcentrationRate.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.survival_function(value, name='survival_function')` {#InverseGammaWithSoftplusConcentrationRate.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.validate_args` {#InverseGammaWithSoftplusConcentrationRate.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.InverseGammaWithSoftplusConcentrationRate.variance(name='variance')` {#InverseGammaWithSoftplusConcentrationRate.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - - -Additional documentation from `InverseGamma`: - -Variance for inverse gamma is defined only for `concentration > 2`. If -`self.allow_nan_stats` is `False`, an exception will be raised rather -than returning `NaN`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.RegisterKL.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.RegisterKL.md deleted file mode 100644 index 07fe04d122..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.RegisterKL.md +++ /dev/null @@ -1,43 +0,0 @@ -Decorator to register a KL divergence implementation function. - -Usage: - -@distributions.RegisterKL(distributions.Normal, distributions.Normal) -def _kl_normal_mvn(norm_a, norm_b): - # Return KL(norm_a || norm_b) -- - - - -#### `tf.contrib.distributions.RegisterKL.__call__(kl_fn)` {#RegisterKL.__call__} - -Perform the KL registration. - -##### Args: - - -* `kl_fn`: The function to use for the KL divergence. - -##### Returns: - - kl_fn - -##### Raises: - - -* `TypeError`: if kl_fn is not a callable. -* `ValueError`: if a KL divergence function has already been registered for - the given argument classes. - - -- - - - -#### `tf.contrib.distributions.RegisterKL.__init__(dist_cls_a, dist_cls_b)` {#RegisterKL.__init__} - -Initialize the KL registrar. - -##### Args: - - -* `dist_cls_a`: the class of the first argument of the KL divergence. -* `dist_cls_b`: the class of the second argument of the KL divergence. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.RelaxedOneHotCategorical.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.RelaxedOneHotCategorical.md deleted file mode 100644 index acd76a6fa6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.RelaxedOneHotCategorical.md +++ /dev/null @@ -1,650 +0,0 @@ -RelaxedOneHotCategorical distribution with temperature and logits. - -The RelaxedOneHotCategorical is a distribution over random probability -vectors, vectors of positive real values that sum to one, which continuously -approximates a OneHotCategorical. The degree of approximation is controlled by -a temperature: as the temperaturegoes to 0 the RelaxedOneHotCategorical -becomes discrete with a distribution described by the `logits` or `probs` -parameters, as the temperature goes to infinity the RelaxedOneHotCategorical -becomes the constant distribution that is identically the constant vector of -(1/event_size, ..., 1/event_size). - -The RelaxedOneHotCategorical distribution was concurrently introduced as the -Gumbel-Softmax (Jang et al., 2016) and Concrete (Maddison et al., 2016) -distributions for use as a reparameterized continuous approximation to the -`Categorical` one-hot distribution. If you use this distribution, please cite -both papers. - -#### Examples - -Creates a continuous distribution, which approximates a 3-class one-hot -categorical distiribution. The 2nd class is the most likely to be the -largest component in samples drawn from this distribution. - -```python -temperature = 0.5 -p = [0.1, 0.5, 0.4] -dist = RelaxedOneHotCategorical(temperature, probs=p) -``` - -Creates a continuous distribution, which approximates a 3-class one-hot -categorical distiribution. The 2nd class is the most likely to be the -largest component in samples drawn from this distribution. - -```python -temperature = 0.5 -logits = [-2, 2, 0] -dist = RelaxedOneHotCategorical(temperature, logits=logits) -``` - -Creates a continuous distribution, which approximates a 3-class one-hot -categorical distiribution. Because the temperature is very low, samples from -this distribution are almost discrete, with one component almost 1 and the -others nearly 0. The 2nd class is the most likely to be the largest component -in samples drawn from this distribution. - -```python -temperature = 1e-5 -logits = [-2, 2, 0] -dist = RelaxedOneHotCategorical(temperature, logits=logits) -``` - -Creates a continuous distribution, which approximates a 3-class one-hot -categorical distiribution. Because the temperature is very high, samples from -this distribution are usually close to the (1/3, 1/3, 1/3) vector. The 2nd -class is still the most likely to be the largest component -in samples drawn from this distribution. - -```python -temperature = 10 -logits = [-2, 2, 0] -dist = RelaxedOneHotCategorical(temperature, logits=logits) -``` - -Eric Jang, Shixiang Gu, and Ben Poole. Categorical Reparameterization with -Gumbel-Softmax. 2016. - -Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The Concrete Distribution: -A Continuous Relaxation of Discrete Random Variables. 2016. -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.__init__(temperature, logits=None, probs=None, dtype=tf.float32, validate_args=False, allow_nan_stats=True, name='RelaxedOneHotCategorical')` {#RelaxedOneHotCategorical.__init__} - -Initialize RelaxedOneHotCategorical using class log-probabilities. - -##### Args: - - -* `temperature`: An 0-D `Tensor`, representing the temperature - of a set of RelaxedOneHotCategorical distributions. The temperature - should be positive. -* `logits`: An N-D `Tensor`, `N >= 1`, representing the log probabilities - of a set of RelaxedOneHotCategorical distributions. The first - `N - 1` dimensions index into a batch of independent distributions and - the last dimension represents a vector of logits for each class. Only - one of `logits` or `probs` should be passed in. -* `probs`: An N-D `Tensor`, `N >= 1`, representing the probabilities - of a set of RelaxedOneHotCategorical distributions. The first `N - 1` - dimensions index into a batch of independent distributions and the last - dimension represents a vector of probabilities for each class. Only one - of `logits` or `probs` should be passed in. -* `dtype`: The type of the event samples (default: int32). -* `validate_args`: Unused in this distribution. -* `allow_nan_stats`: Python `bool`, default `True`. If `False`, raise an - exception if a statistic (e.g. mean/mode/etc...) is undefined for any - batch member. If `True`, batch members with valid parameters leading to - undefined statistics will return NaN for this statistic. -* `name`: A name for this distribution (optional). - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.allow_nan_stats` {#RelaxedOneHotCategorical.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.batch_shape` {#RelaxedOneHotCategorical.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.batch_shape_tensor(name='batch_shape_tensor')` {#RelaxedOneHotCategorical.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.bijector` {#RelaxedOneHotCategorical.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.cdf(value, name='cdf')` {#RelaxedOneHotCategorical.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.copy(**override_parameters_kwargs)` {#RelaxedOneHotCategorical.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.covariance(name='covariance')` {#RelaxedOneHotCategorical.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.distribution` {#RelaxedOneHotCategorical.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.dtype` {#RelaxedOneHotCategorical.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.entropy(name='entropy')` {#RelaxedOneHotCategorical.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.event_shape` {#RelaxedOneHotCategorical.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.event_shape_tensor(name='event_shape_tensor')` {#RelaxedOneHotCategorical.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.is_continuous` {#RelaxedOneHotCategorical.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.is_scalar_batch(name='is_scalar_batch')` {#RelaxedOneHotCategorical.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.is_scalar_event(name='is_scalar_event')` {#RelaxedOneHotCategorical.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.log_cdf(value, name='log_cdf')` {#RelaxedOneHotCategorical.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.log_prob(value, name='log_prob')` {#RelaxedOneHotCategorical.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.log_survival_function(value, name='log_survival_function')` {#RelaxedOneHotCategorical.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.mean(name='mean')` {#RelaxedOneHotCategorical.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.mode(name='mode')` {#RelaxedOneHotCategorical.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.name` {#RelaxedOneHotCategorical.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#RelaxedOneHotCategorical.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.param_static_shapes(cls, sample_shape)` {#RelaxedOneHotCategorical.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.parameters` {#RelaxedOneHotCategorical.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.prob(value, name='prob')` {#RelaxedOneHotCategorical.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.reparameterization_type` {#RelaxedOneHotCategorical.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.sample(sample_shape=(), seed=None, name='sample')` {#RelaxedOneHotCategorical.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.stddev(name='stddev')` {#RelaxedOneHotCategorical.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.survival_function(value, name='survival_function')` {#RelaxedOneHotCategorical.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.validate_args` {#RelaxedOneHotCategorical.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.RelaxedOneHotCategorical.variance(name='variance')` {#RelaxedOneHotCategorical.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.bijector.CholeskyOuterProduct.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.bijector.CholeskyOuterProduct.md deleted file mode 100644 index 78a9703bba..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.bijector.CholeskyOuterProduct.md +++ /dev/null @@ -1,301 +0,0 @@ -Compute `g(X) = X @ X.T`; X is lower-triangular, positive-diagonal matrix. - -`event_ndims` must be 0 or 2, i.e., scalar or matrix. - -Note: the upper-triangular part of X is ignored (whether or not its zero). - -Examples: - -```python -bijector.CholeskyOuterProduct(event_ndims=2).forward(x=[[1., 0], [2, 1]]) -# Result: [[1., 2], [2, 5]], i.e., x @ x.T - -bijector.CholeskyOuterProduct(event_ndims=2).inverse(y=[[1., 2], [2, 5]]) -# Result: [[1., 0], [2, 1]], i.e., cholesky(y). -``` -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.__init__(event_ndims=2, validate_args=False, name='cholesky_outer_product')` {#CholeskyOuterProduct.__init__} - -Instantiates the `CholeskyOuterProduct` bijector. - -##### Args: - - -* `event_ndims`: `constant` `int32` scalar `Tensor` indicating the number of - dimensions associated with a particular draw from the distribution. Must - be 0 or 2. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str` name given to ops managed by this object. - -##### Raises: - - -* `ValueError`: if event_ndims is neither 0 or 2. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.dtype` {#CholeskyOuterProduct.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.event_ndims` {#CholeskyOuterProduct.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.forward(x, name='forward')` {#CholeskyOuterProduct.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.forward_event_shape(input_shape)` {#CholeskyOuterProduct.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#CholeskyOuterProduct.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#CholeskyOuterProduct.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.graph_parents` {#CholeskyOuterProduct.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.inverse(y, name='inverse')` {#CholeskyOuterProduct.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#CholeskyOuterProduct.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.inverse_event_shape(output_shape)` {#CholeskyOuterProduct.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#CholeskyOuterProduct.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#CholeskyOuterProduct.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.is_constant_jacobian` {#CholeskyOuterProduct.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.name` {#CholeskyOuterProduct.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.CholeskyOuterProduct.validate_args` {#CholeskyOuterProduct.validate_args} - -Returns True if Tensor arguments will be validated. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.bijector.SigmoidCentered.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.bijector.SigmoidCentered.md deleted file mode 100644 index 0d85d1e9e4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.distributions.bijector.SigmoidCentered.md +++ /dev/null @@ -1,276 +0,0 @@ -Bijector which computes Y = g(X) = exp([X 0]) / (1 + exp(-X)). - -Equivalent to: `bijector.SoftmaxCentered(event_ndims=0)`. - -See `bijector.SoftmaxCentered` for more details. -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.__init__(validate_args=False, name='sigmoid_centered')` {#SigmoidCentered.__init__} - - - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.dtype` {#SigmoidCentered.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.event_ndims` {#SigmoidCentered.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.forward(x, name='forward')` {#SigmoidCentered.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.forward_event_shape(input_shape)` {#SigmoidCentered.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#SigmoidCentered.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#SigmoidCentered.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.graph_parents` {#SigmoidCentered.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.inverse(y, name='inverse')` {#SigmoidCentered.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#SigmoidCentered.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.inverse_event_shape(output_shape)` {#SigmoidCentered.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#SigmoidCentered.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#SigmoidCentered.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.is_constant_jacobian` {#SigmoidCentered.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.name` {#SigmoidCentered.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.SigmoidCentered.validate_args` {#SigmoidCentered.validate_args} - -Returns True if Tensor arguments will be validated. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.framework.assign_from_checkpoint.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.framework.assign_from_checkpoint.md deleted file mode 100644 index 1ab8d563e1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.framework.assign_from_checkpoint.md +++ /dev/null @@ -1,27 +0,0 @@ -### `tf.contrib.framework.assign_from_checkpoint(model_path, var_list)` {#assign_from_checkpoint} - -Creates an operation to assign specific variables from a checkpoint. - -##### Args: - - -* `model_path`: The full path to the model checkpoint. To get latest checkpoint - use `model_path = tf.train.latest_checkpoint(checkpoint_dir)` -* `var_list`: A list of (possibly partitioned) `Variable` objects - or a dictionary mapping names in the checkpoint to the - corresponding variables or list of variables to initialize - from that checkpoint value. For partitioned Variables, the - name in the checkpoint must be the full variable, not the - name of the partitioned variable, eg. "my_var" rather than - "my_var/part_4". If empty, returns no_op(), {}. - -##### Returns: - - the restore_op and the feed_dict that need to be run to restore var_list. - -##### Raises: - - -* `ValueError`: If the checkpoint specified at `model_path` is missing one of - the variables in `var_list`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.framework.deprecated_args.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.framework.deprecated_args.md deleted file mode 100644 index 3f81ac9fc1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.framework.deprecated_args.md +++ /dev/null @@ -1,41 +0,0 @@ -### `tf.contrib.framework.deprecated_args(date, instructions, *deprecated_arg_names_or_tuples)` {#deprecated_args} - -Decorator for marking specific function arguments as deprecated. - -This decorator logs a deprecation warning whenever the decorated function is -called with the deprecated argument. It has the following format: - - Calling (from ) with is deprecated and will be - removed after . Instructions for updating: - - - will include the class name if it is a method. - -It also edits the docstring of the function: ' (deprecated arguments)' is -appended to the first line of the docstring and a deprecation notice is -prepended to the rest of the docstring. - -##### Args: - - -* `date`: String. The date the function is scheduled to be removed. Must be - ISO 8601 (YYYY-MM-DD). -* `instructions`: String. Instructions on how to update code using the - deprecated function. -* `*deprecated_arg_names_or_tuples`: String. or 2-Tuple(String, - [ok_vals]). The string is the deprecated argument name. - Optionally, an ok-value may be provided. If the user provided - argument equals this value, the warning is suppressed. - -##### Returns: - - Decorated function or method. - -##### Raises: - - -* `ValueError`: If date is not in ISO 8601 format, instructions are - empty, the deprecated arguments are not present in the function - signature, or the second element of a deprecated_tuple is not a - list. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.add_control_inputs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.add_control_inputs.md deleted file mode 100644 index 18aa510a32..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.add_control_inputs.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.contrib.graph_editor.add_control_inputs(op, cops)` {#add_control_inputs} - -Add the control inputs cops to co. - -Warning: this function is directly manipulating the internals of the tf.Graph. - -##### Args: - - -* `op`: a tf.Operation to which the control inputs are added. -* `cops`: an object convertible to a list of `tf.Operation`. - -##### Raises: - - -* `TypeError`: if op is not a tf.Operation -* `ValueError`: if any cop in cops is already a control input of op. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.detach_inputs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.detach_inputs.md deleted file mode 100644 index 56b381f85f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.detach_inputs.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.contrib.graph_editor.detach_inputs(sgv, control_inputs=False)` {#detach_inputs} - -Detach the inputs of a subgraph view. - -##### Args: - - -* `sgv`: the subgraph view to be detached. This argument is converted to a - subgraph using the same rules as the function subgraph.make_view. - Note that sgv is modified in place. -* `control_inputs`: if True control_inputs are also detached. - -##### Returns: - - A tuple `(sgv, input_placeholders)` where - `sgv` is a new subgraph view of the detached subgraph; - `input_placeholders` is a list of the created input placeholders. - -##### Raises: - - -* `StandardError`: if sgv cannot be converted to a SubGraphView using - the same rules than the function subgraph.make_view. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.filter_ops.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.filter_ops.md deleted file mode 100644 index a5a24d54cf..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.filter_ops.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.contrib.graph_editor.filter_ops(ops, positive_filter)` {#filter_ops} - -Get the ops passing the given filter. - -##### Args: - - -* `ops`: an object convertible to a list of tf.Operation. -* `positive_filter`: a function deciding where to keep an operation or not. - If True, all the operations are returned. - -##### Returns: - - A list of selected tf.Operation. - -##### Raises: - - -* `TypeError`: if ops cannot be converted to a list of tf.Operation. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.make_placeholder_from_tensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.make_placeholder_from_tensor.md deleted file mode 100644 index d645695577..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.make_placeholder_from_tensor.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.contrib.graph_editor.make_placeholder_from_tensor(t, scope=None)` {#make_placeholder_from_tensor} - -Create a `tf.placeholder` for the Graph Editor. - -Note that the correct graph scope must be set by the calling function. - -##### Args: - - -* `t`: a `tf.Tensor` whose name will be used to create the placeholder - (see function placeholder_name). -* `scope`: absolute scope within which to create the placeholder. None - means that the scope of `t` is preserved. `""` means the root scope. - -##### Returns: - - A newly created `tf.placeholder`. - -##### Raises: - - -* `TypeError`: if `t` is not `None` or a `tf.Tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.placeholder_name.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.placeholder_name.md deleted file mode 100644 index 6d7a8facc4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.placeholder_name.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.contrib.graph_editor.placeholder_name(t=None, scope=None)` {#placeholder_name} - -Create placeholder name for the graph editor. - -##### Args: - - -* `t`: optional tensor on which the placeholder operation's name will be based - on -* `scope`: absolute scope with which to prefix the placeholder's name. None - means that the scope of t is preserved. "" means the root scope. - -##### Returns: - - A new placeholder name prefixed by "geph". Note that "geph" stands for - Graph Editor PlaceHolder. This convention allows to quickly identify the - placeholder generated by the Graph Editor. - -##### Raises: - - -* `TypeError`: if t is not None or a tf.Tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.select_ops.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.select_ops.md deleted file mode 100644 index 513a7cf472..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.select_ops.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.contrib.graph_editor.select_ops(*args, **kwargs)` {#select_ops} - -Helper to select operations. - -##### Args: - - -* `*args`: list of 1) regular expressions (compiled or not) or 2) (array of) - `tf.Operation`. `tf.Tensor` instances are silently ignored. -* `**kwargs`: 'graph': `tf.Graph` in which to perform the regex query.This is - required when using regex. - 'positive_filter': an elem if selected only if `positive_filter(elem)` is - `True`. This is optional. - 'restrict_ops_regex': a regular expression is ignored if it doesn't start - with the substring "(?#ops)". - -##### Returns: - - A list of `tf.Operation`. - -##### Raises: - - -* `TypeError`: if the optional keyword argument graph is not a `tf.Graph` - or if an argument in args is not an (array of) `tf.Operation` - or an (array of) `tf.Tensor` (silently ignored) or a string - or a regular expression. -* `ValueError`: if one of the keyword arguments is unexpected or if a regular - expression is used without passing a graph as a keyword argument. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.swap_inputs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.swap_inputs.md deleted file mode 100644 index bd18c89d6b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.swap_inputs.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.graph_editor.swap_inputs(sgv0, sgv1)` {#swap_inputs} - -Swap all the inputs of sgv0 and sgv1 (see reroute_inputs). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.swap_ios.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.swap_ios.md deleted file mode 100644 index aa18c7e0f0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.graph_editor.swap_ios.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.graph_editor.swap_ios(sgv0, sgv1)` {#swap_ios} - -Swap the inputs and outputs of sgv1 to sgv0 (see _reroute). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.convolution2d_in_plane.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.convolution2d_in_plane.md deleted file mode 100644 index ff9c0f77b2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.convolution2d_in_plane.md +++ /dev/null @@ -1,49 +0,0 @@ -### `tf.contrib.layers.convolution2d_in_plane(*args, **kwargs)` {#convolution2d_in_plane} - -Performs the same in-plane convolution to each channel independently. - -This is useful for performing various simple channel-independent convolution -operations such as image gradients: - - image = tf.constant(..., shape=(16, 240, 320, 3)) - vert_gradients = layers.conv2d_in_plane(image, - kernel=[1, -1], - kernel_size=[2, 1]) - horz_gradients = layers.conv2d_in_plane(image, - kernel=[1, -1], - kernel_size=[1, 2]) - -##### Args: - - -* `inputs`: A 4-D tensor with dimensions [batch_size, height, width, channels]. -* `kernel_size`: A list of length 2 holding the [kernel_height, kernel_width] of - of the pooling. Can be an int if both values are the same. -* `stride`: A list of length 2 `[stride_height, stride_width]`. - Can be an int if both strides are the same. Note that presently - both strides must have the same value. -* `padding`: The padding type to use, either 'SAME' or 'VALID'. -* `activation_fn`: Activation function. The default value is a ReLU function. - Explicitly set it to None to skip it and maintain a linear activation. -* `normalizer_fn`: Normalization function to use instead of `biases`. If - `normalizer_fn` is provided then `biases_initializer` and - `biases_regularizer` are ignored and `biases` are not created nor added. - default set to None for no normalizer function -* `normalizer_params`: Normalization function parameters. -* `weights_initializer`: An initializer for the weights. -* `weights_regularizer`: Optional regularizer for the weights. -* `biases_initializer`: An initializer for the biases. If None skip biases. -* `biases_regularizer`: Optional regularizer for the biases. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional list of collections for all the variables or - a dictionary containing a different list of collection per variable. -* `outputs_collections`: Collection to add the outputs. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for `variable_scope`. - -##### Returns: - - A `Tensor` representing the output of the operation. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.l2_regularizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.l2_regularizer.md deleted file mode 100644 index 60791e81f3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.l2_regularizer.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.contrib.layers.l2_regularizer(scale, scope=None)` {#l2_regularizer} - -Returns a function that can be used to apply L2 regularization to weights. - -Small values of L2 can help prevent overfitting the training data. - -##### Args: - - -* `scale`: A scalar multiplier `Tensor`. 0.0 disables the regularizer. -* `scope`: An optional scope name. - -##### Returns: - - A function with signature `l2(weights)` that applies L2 regularization. - -##### Raises: - - -* `ValueError`: If scale is negative or if scale is not a float. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.real_valued_column.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.real_valued_column.md deleted file mode 100644 index 61b4c76318..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.real_valued_column.md +++ /dev/null @@ -1,44 +0,0 @@ -### `tf.contrib.layers.real_valued_column(column_name, dimension=1, default_value=None, dtype=tf.float32, normalizer=None)` {#real_valued_column} - -Creates a `_RealValuedColumn` for dense numeric data. - -##### Args: - - -* `column_name`: A string defining real valued column name. -* `dimension`: An integer specifying dimension of the real valued column. - The default is 1. When dimension is not None, the Tensor representing - the _RealValuedColumn will have the shape of [batch_size, dimension]. - A None dimension means the feature column should be treat as variable - length and will be parsed as a `SparseTensor`. -* `default_value`: A single value compatible with dtype or a list of values - compatible with dtype which the column takes on during tf.Example parsing - if data is missing. When dimension is not None, a default value of None - will cause tf.parse_example to fail if an example does not contain this - column. If a single value is provided, the same value will be applied as - the default value for every dimension. If a list of values is provided, - the length of the list should be equal to the value of `dimension`. - Only scalar default value is supported in case dimension is not specified. -* `dtype`: defines the type of values. Default value is tf.float32. Must be a - non-quantized, real integer or floating point type. -* `normalizer`: If not None, a function that can be used to normalize the value - of the real valued column after default_value is applied for parsing. - Normalizer function takes the input tensor as its argument, and returns - the output tensor. (e.g. lambda x: (x - 3.0) / 4.2). Note that for - variable length columns, the normalizer should expect an input_tensor of - type `SparseTensor`. - -##### Returns: - - A _RealValuedColumn. - -##### Raises: - - -* `TypeError`: if dimension is not an int -* `ValueError`: if dimension is not a positive integer -* `TypeError`: if default_value is a list but its length is not equal to the - value of `dimension`. -* `TypeError`: if default_value is not compatible with dtype. -* `ValueError`: if dtype is not convertable to tf.float32. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.sparse_column_with_keys.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.sparse_column_with_keys.md deleted file mode 100644 index b32b62cc28..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.sparse_column_with_keys.md +++ /dev/null @@ -1,27 +0,0 @@ -### `tf.contrib.layers.sparse_column_with_keys(column_name, keys, default_value=-1, combiner='sum')` {#sparse_column_with_keys} - -Creates a _SparseColumn with keys. - -Look up logic is as follows: -lookup_id = index_of_feature_in_keys if feature in keys else default_value - -##### Args: - - -* `column_name`: A string defining sparse column name. -* `keys`: a string list defining vocabulary. -* `default_value`: The value to use for out-of-vocabulary feature values. - Default is -1. -* `combiner`: A string specifying how to reduce if the sparse column is - multivalent. Currently "mean", "sqrtn" and "sum" are supported, with "sum" - the default. "sqrtn" often achieves good accuracy, in particular with - bag-of-words columns. - * "sum": do not normalize features in the column - * "mean": do l1 normalization on features in the column - * "sqrtn": do l2 normalization on features in the column - For more information: `tf.embedding_lookup_sparse`. - -##### Returns: - - A _SparseColumnKeys with keys configuration. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.weighted_sparse_column.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.weighted_sparse_column.md deleted file mode 100644 index 1223ea2d77..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.layers.weighted_sparse_column.md +++ /dev/null @@ -1,43 +0,0 @@ -### `tf.contrib.layers.weighted_sparse_column(sparse_id_column, weight_column_name, dtype=tf.float32)` {#weighted_sparse_column} - -Creates a _SparseColumn by combining sparse_id_column with a weight column. - -Example: - - ```python - sparse_feature = sparse_column_with_hash_bucket(column_name="sparse_col", - hash_bucket_size=1000) - weighted_feature = weighted_sparse_column(sparse_id_column=sparse_feature, - weight_column_name="weights_col") - ``` - - This configuration assumes that input dictionary of model contains the - following two items: - * (key="sparse_col", value=sparse_tensor) where sparse_tensor is - a SparseTensor. - * (key="weights_col", value=weights_tensor) where weights_tensor - is a SparseTensor. - Following are assumed to be true: - * sparse_tensor.indices = weights_tensor.indices - * sparse_tensor.dense_shape = weights_tensor.dense_shape - -##### Args: - - -* `sparse_id_column`: A `_SparseColumn` which is created by - `sparse_column_with_*` functions. -* `weight_column_name`: A string defining a sparse column name which represents - weight or value of the corresponding sparse id feature. -* `dtype`: Type of weights, such as `tf.float32`. Only floating and integer - weights are supported. - -##### Returns: - - A _WeightedSparseColumn composed of two sparse features: one represents id, - the other represents weight (value) of the id feature in that example. - -##### Raises: - - -* `ValueError`: if dtype is not convertible to float. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.LinearRegressor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.LinearRegressor.md deleted file mode 100644 index 2f12a6f277..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.LinearRegressor.md +++ /dev/null @@ -1,412 +0,0 @@ -Linear regressor model. - -Train a linear regression model to predict label value given observation of -feature values. - -Example: - -```python -sparse_column_a = sparse_column_with_hash_bucket(...) -sparse_column_b = sparse_column_with_hash_bucket(...) - -sparse_feature_a_x_sparse_feature_b = crossed_column(...) - -estimator = LinearRegressor( - feature_columns=[sparse_column_a, sparse_feature_a_x_sparse_feature_b]) - -# Input builders -def input_fn_train: # returns x, y - ... -def input_fn_eval: # returns x, y - ... -estimator.fit(input_fn=input_fn_train) -estimator.evaluate(input_fn=input_fn_eval) -estimator.predict(x=x) -``` - -Input of `fit` and `evaluate` should have following features, - otherwise there will be a KeyError: - -* if `weight_column_name` is not `None`: - key=weight_column_name, value=a `Tensor` -* for column in `feature_columns`: - - if isinstance(column, `SparseColumn`): - key=column.name, value=a `SparseTensor` - - if isinstance(column, `WeightedSparseColumn`): - {key=id column name, value=a `SparseTensor`, - key=weight column name, value=a `SparseTensor`} - - if isinstance(column, `RealValuedColumn`): - key=column.name, value=a `Tensor` -- - - - -#### `tf.contrib.learn.LinearRegressor.__init__(feature_columns, model_dir=None, weight_column_name=None, optimizer=None, gradient_clip_norm=None, enable_centered_bias=False, label_dimension=1, _joint_weights=False, config=None, feature_engineering_fn=None)` {#LinearRegressor.__init__} - -Construct a `LinearRegressor` estimator object. - -##### Args: - - -* `feature_columns`: An iterable containing all the feature columns used by - the model. All items in the set should be instances of classes derived - from `FeatureColumn`. -* `model_dir`: Directory to save model parameters, graph, etc. This can - also be used to load checkpoints from the directory into a estimator - to continue training a previously saved model. -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. It - will be multiplied by the loss of the example. -* `optimizer`: An instance of `tf.Optimizer` used to train the model. If - `None`, will use an Ftrl optimizer. -* `gradient_clip_norm`: A `float` > 0. If provided, gradients are clipped - to their global norm with this clipping ratio. See - `tf.clip_by_global_norm` for more details. -* `enable_centered_bias`: A bool. If True, estimator will learn a centered - bias variable for each class. Rest of the model structure learns the - residual after centered bias. -* `label_dimension`: Number of regression targets per example. This is the - size of the last dimension of the labels and logits `Tensor` objects - (typically, these have shape `[batch_size, label_dimension]`). - _joint_weights: If True use a single (possibly partitioned) variable to - store the weights. It's faster, but requires all feature columns are - sparse and have the 'sum' combiner. Incompatible with SDCAOptimizer. - -* `config`: `RunConfig` object to configure the runtime settings. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into the model. - -##### Returns: - - A `LinearRegressor` estimator. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.__repr__()` {#LinearRegressor.__repr__} - - - - -- - - - -#### `tf.contrib.learn.LinearRegressor.bias_` {#LinearRegressor.bias_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - -- - - - -#### `tf.contrib.learn.LinearRegressor.config` {#LinearRegressor.config} - - - - -- - - - -#### `tf.contrib.learn.LinearRegressor.evaluate(*args, **kwargs)` {#LinearRegressor.evaluate} - -See `Evaluable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If at least one of `x` or `y` is provided, and at least one of - `input_fn` or `feed_fn` is provided. - Or if `metrics` is not `None` or `dict`. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.export(export_dir, input_fn=None, input_feature_key=None, use_deprecated_input_fn=True, signature_fn=None, default_batch_size=1, exports_to_keep=None)` {#LinearRegressor.export} - -See BaseEstimator.export. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#LinearRegressor.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.fit(*args, **kwargs)` {#LinearRegressor.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.get_params(deep=True)` {#LinearRegressor.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.get_variable_names()` {#LinearRegressor.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.get_variable_value(name)` {#LinearRegressor.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.model_dir` {#LinearRegressor.model_dir} - - - - -- - - - -#### `tf.contrib.learn.LinearRegressor.partial_fit(*args, **kwargs)` {#LinearRegressor.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.predict(*args, **kwargs)` {#LinearRegressor.predict} - -Returns predictions for given features. (deprecated arguments) (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2017-03-01. -Instructions for updating: -Please switch to predict_scores, or set `outputs` argument. - -By default, returns predicted scores. But this default will be dropped -soon. Users should either pass `outputs`, or call `predict_scores` method. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns scores. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted scores (or an iterable of predicted scores if - as_iterable is True). If `label_dimension == 1`, the shape of the output - is `[batch_size]`, otherwise the shape is `[batch_size, label_dimension]`. - If `outputs` is set, returns a dict of predictions. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.predict_scores(*args, **kwargs)` {#LinearRegressor.predict_scores} - -Returns predicted scores for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted scores (or an iterable of predicted scores if - as_iterable is True). If `label_dimension == 1`, the shape of the output - is `[batch_size]`, otherwise the shape is `[batch_size, label_dimension]`. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.set_params(**params)` {#LinearRegressor.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - -- - - - -#### `tf.contrib.learn.LinearRegressor.weights_` {#LinearRegressor.weights_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.ModelFnOps.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.ModelFnOps.md deleted file mode 100644 index 85371ec084..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.ModelFnOps.md +++ /dev/null @@ -1,135 +0,0 @@ -Ops returned from a model_fn. -- - - - -#### `tf.contrib.learn.ModelFnOps.__getnewargs__()` {#ModelFnOps.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.contrib.learn.ModelFnOps.__getstate__()` {#ModelFnOps.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.contrib.learn.ModelFnOps.__new__(cls, mode, predictions=None, loss=None, train_op=None, eval_metric_ops=None, output_alternatives=None, training_chief_hooks=None, training_hooks=None, scaffold=None)` {#ModelFnOps.__new__} - -Creates a validated `ModelFnOps` instance. - -For a multi-headed model, the predictions dict here will contain the outputs -of all of the heads. However: at serving time, requests will be made -specifically for one or more heads, and the RPCs used for these requests may -differ by problem type (i.e., regression, classification, other). The -purpose of the output_alternatives dict is to aid in exporting a SavedModel -from which such head-specific queries can be served. These -output_alternatives will be combined with input_alternatives (see -`saved_model_export_utils`) to produce a set of `SignatureDef`s specifying -the valid requests that can be served from this model. - -For a single-headed model, it is still adviseable to provide -output_alternatives with a single entry, because this is how the problem -type is communicated for export and serving. If output_alternatives is not -given, the resulting SavedModel will support only one head of unspecified -type. - -##### Args: - - -* `mode`: One of `ModeKeys`. Specifies if this training, evaluation or - prediction. -* `predictions`: Predictions `Tensor` or dict of `Tensor`. -* `loss`: Training loss `Tensor`. -* `train_op`: Op for the training step. -* `eval_metric_ops`: Dict of metric results keyed by name. The values of the - dict are the results of calling a metric function, such as `Tensor`. -* `output_alternatives`: a dict of - `{submodel_name: (problem_type, {tensor_name: Tensor})}`, where - `submodel_name` is a submodel identifier that should be consistent - across the pipeline (here likely taken from the name of each `Head`, - for models that use them), `problem_type` is a `ProblemType`, - `tensor_name` is a symbolic name for an output Tensor possibly but not - necessarily taken from `PredictionKey`, and `Tensor` is the - corresponding output Tensor itself. -* `training_chief_hooks`: A list of `SessionRunHook` objects that will be - run on the chief worker during training. -* `training_hooks`: A list of `SessionRunHook` objects that will be run on - all workers during training. -* `scaffold`: A `tf.train.Scaffold` object that can be used to set - initialization, saver, and more to be used in training. - -##### Returns: - - A validated `ModelFnOps` object. - -##### Raises: - - -* `ValueError`: If validation fails. - - -- - - - -#### `tf.contrib.learn.ModelFnOps.__repr__()` {#ModelFnOps.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.contrib.learn.ModelFnOps.eval_metric_ops` {#ModelFnOps.eval_metric_ops} - -Alias for field number 3 - - -- - - - -#### `tf.contrib.learn.ModelFnOps.loss` {#ModelFnOps.loss} - -Alias for field number 1 - - -- - - - -#### `tf.contrib.learn.ModelFnOps.output_alternatives` {#ModelFnOps.output_alternatives} - -Alias for field number 4 - - -- - - - -#### `tf.contrib.learn.ModelFnOps.predictions` {#ModelFnOps.predictions} - -Alias for field number 0 - - -- - - - -#### `tf.contrib.learn.ModelFnOps.scaffold` {#ModelFnOps.scaffold} - -Alias for field number 7 - - -- - - - -#### `tf.contrib.learn.ModelFnOps.train_op` {#ModelFnOps.train_op} - -Alias for field number 2 - - -- - - - -#### `tf.contrib.learn.ModelFnOps.training_chief_hooks` {#ModelFnOps.training_chief_hooks} - -Alias for field number 5 - - -- - - - -#### `tf.contrib.learn.ModelFnOps.training_hooks` {#ModelFnOps.training_hooks} - -Alias for field number 6 - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.extract_pandas_matrix.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.extract_pandas_matrix.md deleted file mode 100644 index a5efd4f09b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.extract_pandas_matrix.md +++ /dev/null @@ -1,13 +0,0 @@ -### `tf.contrib.learn.extract_pandas_matrix(data)` {#extract_pandas_matrix} - -Extracts numpy matrix from pandas DataFrame. - -##### Args: - - -* `data`: `pandas.DataFrame` containing the data to be extracted. - -##### Returns: - - A numpy `ndarray` of the DataFrame's values. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.make_export_strategy.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.make_export_strategy.md deleted file mode 100644 index ab4b3a86c6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.make_export_strategy.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.contrib.learn.make_export_strategy(serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, exports_to_keep=5)` {#make_export_strategy} - -Create an ExportStrategy for use with Experiment. - -##### Args: - - -* `serving_input_fn`: A function that takes no arguments and returns an - `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when an - incoming serving request does not explicitly request a specific head. - Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `exports_to_keep`: Number of exports to keep. Older exports will be - garbage-collected. Defaults to 5. Set to None to disable garbage - collection. - -##### Returns: - - An ExportStrategy that can be passed to the Experiment constructor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.monitors.replace_monitors_with_hooks.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.monitors.replace_monitors_with_hooks.md deleted file mode 100644 index de84ecb361..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.monitors.replace_monitors_with_hooks.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.contrib.learn.monitors.replace_monitors_with_hooks(monitors_or_hooks, estimator)` {#replace_monitors_with_hooks} - -Wraps monitors with a hook. - -`Monitor` is deprecated in favor of `SessionRunHook`. If you're using a -monitor, you can wrap it with a hook using function. It is recommended to -implement hook version of your monitor. - -##### Args: - - -* `monitors_or_hooks`: A `list` may contain both monitors and hooks. -* `estimator`: An `Estimator` that monitor will be used with. - -##### Returns: - - Returns a list of hooks. If there is any monitor in the given list, it is - replaced by a hook. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.read_batch_record_features.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.read_batch_record_features.md deleted file mode 100644 index 2a114a25c2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.learn.read_batch_record_features.md +++ /dev/null @@ -1,32 +0,0 @@ -### `tf.contrib.learn.read_batch_record_features(file_pattern, batch_size, features, randomize_input=True, num_epochs=None, queue_capacity=10000, reader_num_threads=1, name='dequeue_record_examples')` {#read_batch_record_features} - -Reads TFRecord, queues, batches and parses `Example` proto. - -See more detailed description in `read_examples`. - -##### Args: - - -* `file_pattern`: List of files or pattern of file paths containing - `Example` records. See `tf.gfile.Glob` for pattern rules. -* `batch_size`: An int or scalar `Tensor` specifying the batch size to use. -* `features`: A `dict` mapping feature keys to `FixedLenFeature` or - `VarLenFeature` values. -* `randomize_input`: Whether the input should be randomized. -* `num_epochs`: Integer specifying the number of times to read through the - dataset. If None, cycles through the dataset forever. NOTE - If specified, - creates a variable that must be initialized, so call - tf.local_variables_initializer() and run the op in a session. -* `queue_capacity`: Capacity for input queue. -* `reader_num_threads`: The number of threads to read examples. -* `name`: Name of resulting op. - -##### Returns: - - A dict of `Tensor` or `SparseTensor` objects for each in `features`. - -##### Raises: - - -* `ValueError`: for invalid inputs. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.attention_decoder.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.attention_decoder.md deleted file mode 100644 index 022ac6fefa..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.attention_decoder.md +++ /dev/null @@ -1,60 +0,0 @@ -### `tf.contrib.legacy_seq2seq.attention_decoder(decoder_inputs, initial_state, attention_states, cell, output_size=None, num_heads=1, loop_function=None, dtype=None, scope=None, initial_state_attention=False)` {#attention_decoder} - -RNN decoder with attention for the sequence-to-sequence model. - -In this context "attention" means that, during decoding, the RNN can look up -information in the additional tensor attention_states, and it does this by -focusing on a few entries from the tensor. This model has proven to yield -especially good results in a number of sequence-to-sequence tasks. This -implementation is based on http://arxiv.org/abs/1412.7449 (see below for -details). It is recommended for complex sequence-to-sequence tasks. - -##### Args: - - -* `decoder_inputs`: A list of 2D Tensors [batch_size x input_size]. -* `initial_state`: 2D Tensor [batch_size x cell.state_size]. -* `attention_states`: 3D Tensor [batch_size x attn_length x attn_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function and size. -* `output_size`: Size of the output vectors; if None, we use cell.output_size. -* `num_heads`: Number of attention heads that read from attention_states. -* `loop_function`: If not None, this function will be applied to i-th output - in order to generate i+1-th input, and decoder_inputs will be ignored, - except for the first element ("GO" symbol). This can be used for decoding, - but also for training to emulate http://arxiv.org/abs/1506.03099. - Signature -- loop_function(prev, i) = next - * prev is a 2D Tensor of shape [batch_size x output_size], - * i is an integer, the step number (when advanced control is needed), - * next is a 2D Tensor of shape [batch_size x input_size]. -* `dtype`: The dtype to use for the RNN initial state (default: tf.float32). -* `scope`: VariableScope for the created subgraph; default: "attention_decoder". -* `initial_state_attention`: If False (default), initial attentions are zero. - If True, initialize the attentions from the initial state and attention - states -- useful when we wish to resume decoding from a previously - stored decoder state and attention states. - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors of - shape [batch_size x output_size]. These represent the generated outputs. - Output i is computed from input i (which is either the i-th element - of decoder_inputs or loop_function(output {i-1}, i)) as follows. - First, we run the cell on a combination of the input and previous - attention masks: - cell_output, new_state = cell(linear(input, prev_attn), prev_state). - Then, we calculate new attention masks: - new_attn = softmax(V^T * tanh(W * attention_states + U * new_state)) - and then we calculate the output: - output = linear(cell_output, new_attn). -* `state`: The state of each decoder cell the final time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - -##### Raises: - - -* `ValueError`: when num_heads is not positive, there are no inputs, shapes - of attention_states are not set, or input size cannot be inferred - from the input. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.embedding_rnn_decoder.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.embedding_rnn_decoder.md deleted file mode 100644 index 11a5e81298..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.embedding_rnn_decoder.md +++ /dev/null @@ -1,48 +0,0 @@ -### `tf.contrib.legacy_seq2seq.embedding_rnn_decoder(decoder_inputs, initial_state, cell, num_symbols, embedding_size, output_projection=None, feed_previous=False, update_embedding_for_previous=True, scope=None)` {#embedding_rnn_decoder} - -RNN decoder with embedding and a pure-decoding option. - -##### Args: - - -* `decoder_inputs`: A list of 1D batch-sized int32 Tensors (decoder inputs). -* `initial_state`: 2D Tensor [batch_size x cell.state_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function. -* `num_symbols`: Integer, how many symbols come into the embedding. -* `embedding_size`: Integer, the length of the embedding vector for each symbol. -* `output_projection`: None or a pair (W, B) of output projection weights and - biases; W has shape [output_size x num_symbols] and B has - shape [num_symbols]; if provided and feed_previous=True, each fed - previous output will first be multiplied by W and added B. -* `feed_previous`: Boolean; if True, only the first of decoder_inputs will be - used (the "GO" symbol), and all other decoder inputs will be generated by: - next = embedding_lookup(embedding, argmax(previous_output)), - In effect, this implements a greedy decoder. It can also be used - during training to emulate http://arxiv.org/abs/1506.03099. - If False, decoder_inputs are used as given (the standard decoder case). -* `update_embedding_for_previous`: Boolean; if False and feed_previous=True, - only the embedding for the first symbol of decoder_inputs (the "GO" - symbol) will be updated by back propagation. Embeddings for the symbols - generated from the decoder itself remain unchanged. This parameter has - no effect if feed_previous=False. -* `scope`: VariableScope for the created subgraph; defaults to - "embedding_rnn_decoder". - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors. The - output is of shape [batch_size x cell.output_size] when - output_projection is not None (and represents the dense representation - of predicted tokens). It is of shape [batch_size x num_decoder_symbols] - when output_projection is None. -* `state`: The state of each decoder cell in each time-step. This is a list - with length len(decoder_inputs) -- one item for each time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - -##### Raises: - - -* `ValueError`: When output_projection has the wrong shape. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.embedding_rnn_seq2seq.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.embedding_rnn_seq2seq.md deleted file mode 100644 index 5c69dbee40..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.embedding_rnn_seq2seq.md +++ /dev/null @@ -1,46 +0,0 @@ -### `tf.contrib.legacy_seq2seq.embedding_rnn_seq2seq(encoder_inputs, decoder_inputs, cell, num_encoder_symbols, num_decoder_symbols, embedding_size, output_projection=None, feed_previous=False, dtype=None, scope=None)` {#embedding_rnn_seq2seq} - -Embedding RNN sequence-to-sequence model. - -This model first embeds encoder_inputs by a newly created embedding (of shape -[num_encoder_symbols x input_size]). Then it runs an RNN to encode -embedded encoder_inputs into a state vector. Next, it embeds decoder_inputs -by another newly created embedding (of shape [num_decoder_symbols x -input_size]). Then it runs RNN decoder, initialized with the last -encoder state, on embedded decoder_inputs. - -##### Args: - - -* `encoder_inputs`: A list of 1D int32 Tensors of shape [batch_size]. -* `decoder_inputs`: A list of 1D int32 Tensors of shape [batch_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function and size. -* `num_encoder_symbols`: Integer; number of symbols on the encoder side. -* `num_decoder_symbols`: Integer; number of symbols on the decoder side. -* `embedding_size`: Integer, the length of the embedding vector for each symbol. -* `output_projection`: None or a pair (W, B) of output projection weights and - biases; W has shape [output_size x num_decoder_symbols] and B has - shape [num_decoder_symbols]; if provided and feed_previous=True, each - fed previous output will first be multiplied by W and added B. -* `feed_previous`: Boolean or scalar Boolean Tensor; if True, only the first - of decoder_inputs will be used (the "GO" symbol), and all other decoder - inputs will be taken from previous outputs (as in embedding_rnn_decoder). - If False, decoder_inputs are used as given (the standard decoder case). -* `dtype`: The dtype of the initial state for both the encoder and encoder - rnn cells (default: tf.float32). -* `scope`: VariableScope for the created subgraph; defaults to - "embedding_rnn_seq2seq" - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors. The - output is of shape [batch_size x cell.output_size] when - output_projection is not None (and represents the dense representation - of predicted tokens). It is of shape [batch_size x num_decoder_symbols] - when output_projection is None. -* `state`: The state of each decoder cell in each time-step. This is a list - with length len(decoder_inputs) -- one item for each time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.sequence_loss.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.sequence_loss.md deleted file mode 100644 index c0beb1541e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.legacy_seq2seq.sequence_loss.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.contrib.legacy_seq2seq.sequence_loss(logits, targets, weights, average_across_timesteps=True, average_across_batch=True, softmax_loss_function=None, name=None)` {#sequence_loss} - -Weighted cross-entropy loss for a sequence of logits, batch-collapsed. - -##### Args: - - -* `logits`: List of 2D Tensors of shape [batch_size x num_decoder_symbols]. -* `targets`: List of 1D batch-sized int32 Tensors of the same length as logits. -* `weights`: List of 1D batch-sized float-Tensors of the same length as logits. -* `average_across_timesteps`: If set, divide the returned cost by the total - label weight. -* `average_across_batch`: If set, divide the returned cost by the batch size. -* `softmax_loss_function`: Function (inputs-batch, labels-batch) -> loss-batch - to be used instead of the standard softmax (the default if this is None). -* `name`: Optional name for this operation, defaults to "sequence_loss". - -##### Returns: - - A scalar float Tensor: The average log-perplexity per symbol (weighted). - -##### Raises: - - -* `ValueError`: If len(logits) is different from len(targets) or len(weights). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.linalg.LinearOperatorDiag.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.linalg.LinearOperatorDiag.md deleted file mode 100644 index f4796c04c1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.linalg.LinearOperatorDiag.md +++ /dev/null @@ -1,532 +0,0 @@ -`LinearOperator` acting like a [batch] square diagonal matrix. - -This operator acts like a [batch] diagonal matrix `A` with shape -`[B1,...,Bb, N, N]` for some `b >= 0`. The first `b` indices index a -batch member. For every batch index `(i1,...,ib)`, `A[i1,...,ib, : :]` is -an `N x N` matrix. This matrix `A` is not materialized, but for -purposes of broadcasting this shape will be relevant. - -`LinearOperatorDiag` is initialized with a (batch) vector. - -```python -# Create a 2 x 2 diagonal linear operator. -diag = [1., -1.] -operator = LinearOperatorDiag(diag) - -operator.to_dense() -==> [[1., 0.] - [0., -1.]] - -operator.shape -==> [2, 2] - -operator.log_determinant() -==> scalar Tensor - -x = ... Shape [2, 4] Tensor -operator.apply(x) -==> Shape [2, 4] Tensor - -# Create a [2, 3] batch of 4 x 4 linear operators. -diag = tf.random_normal(shape=[2, 3, 4]) -operator = LinearOperatorDiag(diag) - -# Create a shape [2, 1, 4, 2] vector. Note that this shape is compatible -# since the batch dimensions, [2, 1], are brodcast to -# operator.batch_shape = [2, 3]. -y = tf.random_normal(shape=[2, 1, 4, 2]) -x = operator.solve(y) -==> operator.apply(x) = y -``` - -#### Shape compatibility - -This operator acts on [batch] matrix with compatible shape. -`x` is a batch matrix with compatible shape for `apply` and `solve` if - -``` -operator.shape = [B1,...,Bb] + [N, N], with b >= 0 -x.shape = [C1,...,Cc] + [N, R], -and [C1,...,Cc] broadcasts with [B1,...,Bb] to [D1,...,Dd] -``` - -#### Performance - -Suppose `operator` is a `LinearOperatorDiag` of shape `[N, N]`, -and `x.shape = [N, R]`. Then - -* `operator.apply(x)` involves `N * R` multiplications. -* `operator.solve(x)` involves `N` divisions and `N * R` multiplications. -* `operator.determinant()` involves a size `N` `reduce_prod`. - -If instead `operator` and `x` have shape `[B1,...,Bb, N, N]` and -`[B1,...,Bb, N, R]`, every operation increases in complexity by `B1*...*Bb`. - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite`. -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.__init__(diag, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, name='LinearOperatorDiag')` {#LinearOperatorDiag.__init__} - -Initialize a `LinearOperatorDiag`. - -##### Args: - - -* `diag`: Shape `[B1,...,Bb, N]` `Tensor` with `b >= 0` `N >= 0`. - The diagonal of the operator. Allowed dtypes: `float32`, `float64`, - `complex64`, `complex128`. -* `is_non_singular`: Expect that this operator is non-singular. -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. If `diag.dtype` is real, this is auto-set to `True`. -* `is_positive_definite`: Expect that this operator is positive definite, - meaning the real part of all eigenvalues is positive. We do not require - the operator to be self-adjoint to be positive-definite. See: -* `https`: //en.wikipedia.org/wiki/Positive-definite_matrix - #Extension_for_non_symmetric_matrices -* `name`: A name for this `LinearOperator`. - -##### Raises: - - -* `TypeError`: If `diag.dtype` is not an allowed type. -* `ValueError`: If `diag.dtype` is real, and `is_self_adjoint` is not `True`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.add_to_tensor(x, name='add_to_tensor')` {#LinearOperatorDiag.add_to_tensor} - -Add matrix represented by this operator to `x`. Equivalent to `A + x`. - -##### Args: - - -* `x`: `Tensor` with same `dtype` and shape broadcastable to `self.shape`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.apply(x, adjoint=False, name='apply')` {#LinearOperatorDiag.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.assert_non_singular(name='assert_non_singular')` {#LinearOperatorDiag.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.assert_positive_definite(name='assert_positive_definite')` {#LinearOperatorDiag.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperatorDiag.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.batch_shape` {#LinearOperatorDiag.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperatorDiag.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.determinant(name='det')` {#LinearOperatorDiag.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.diag` {#LinearOperatorDiag.diag} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.diag_part(name='diag_part')` {#LinearOperatorDiag.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.domain_dimension` {#LinearOperatorDiag.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperatorDiag.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.dtype` {#LinearOperatorDiag.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.graph_parents` {#LinearOperatorDiag.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.is_non_singular` {#LinearOperatorDiag.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.is_positive_definite` {#LinearOperatorDiag.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.is_self_adjoint` {#LinearOperatorDiag.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.is_square` {#LinearOperatorDiag.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.log_abs_determinant(name='log_abs_det')` {#LinearOperatorDiag.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.name` {#LinearOperatorDiag.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.range_dimension` {#LinearOperatorDiag.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperatorDiag.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.shape` {#LinearOperatorDiag.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.shape_tensor(name='shape_tensor')` {#LinearOperatorDiag.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.solve(rhs, adjoint=False, name='solve')` {#LinearOperatorDiag.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.tensor_rank` {#LinearOperatorDiag.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperatorDiag.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorDiag.to_dense(name='to_dense')` {#LinearOperatorDiag.to_dense} - -Return a dense (batch) matrix representing this operator. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.losses.get_losses.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.losses.get_losses.md deleted file mode 100644 index da8e3ed5bb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.losses.get_losses.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.contrib.losses.get_losses(*args, **kwargs)` {#get_losses} - -Gets the list of losses from the loss_collection. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.get_losses instead. - -##### Args: - - -* `scope`: an optional scope for filtering the losses to return. -* `loss_collection`: Optional losses collection. - -##### Returns: - - a list of loss tensors. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.metrics.set_size.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.metrics.set_size.md deleted file mode 100644 index 0a33afb229..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.metrics.set_size.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.contrib.metrics.set_size(a, validate_indices=True)` {#set_size} - -Compute number of unique elements along last dimension of `a`. - -##### Args: - - -* `a`: `SparseTensor`, with indices sorted in row-major order. -* `validate_indices`: Whether to validate the order and range of sparse indices - in `a`. - -##### Returns: - - `int32` `Tensor` of set sizes. For `a` ranked `n`, this is a `Tensor` with - rank `n-1`, and the same 1st `n-1` dimensions as `a`. Each value is the - number of unique elements in the corresponding `[0...n-1]` dimension of `a`. - -##### Raises: - - -* `TypeError`: If `a` is an invalid types. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.metrics.streaming_mean_tensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.metrics.streaming_mean_tensor.md deleted file mode 100644 index dbaf38c5cc..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.metrics.streaming_mean_tensor.md +++ /dev/null @@ -1,48 +0,0 @@ -### `tf.contrib.metrics.streaming_mean_tensor(values, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_mean_tensor} - -Computes the element-wise (weighted) mean of the given tensors. - -In contrast to the `streaming_mean` function which returns a scalar with the -mean, this function returns an average tensor with the same shape as the -input tensors. - -The `streaming_mean_tensor` function creates two local variables, -`total_tensor` and `count_tensor` that are used to compute the average of -`values`. This average is ultimately returned as `mean` which is an idempotent -operation that simply divides `total` by `count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the `mean`. -`update_op` increments `total` with the reduced sum of the product of `values` -and `weights`, and it increments `count` with the reduced sum of `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `values`: A `Tensor` of arbitrary dimensions. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `values`, and - must be broadcastable to `values` (i.e., all dimensions must be either - `1`, or the same as the corresponding `values` dimension). -* `metrics_collections`: An optional list of collections that `mean` - should be added to. -* `updates_collections`: An optional list of collections that `update_op` - should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `mean`: A float `Tensor` representing the current mean, the value of `total` - divided by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `mean_value`. - -##### Raises: - - -* `ValueError`: If `weights` is not `None` and its shape doesn't match `values`, - or if either `metrics_collections` or `updates_collections` are not a list - or tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.AttentionCellWrapper.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.AttentionCellWrapper.md deleted file mode 100644 index 607aea1f1d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.AttentionCellWrapper.md +++ /dev/null @@ -1,77 +0,0 @@ -Basic attention cell wrapper. - -Implementation based on https://arxiv.org/abs/1409.0473. -- - - - -#### `tf.contrib.rnn.AttentionCellWrapper.__call__(inputs, state, scope=None)` {#AttentionCellWrapper.__call__} - -Long short-term memory cell with attention (LSTMA). - - -- - - - -#### `tf.contrib.rnn.AttentionCellWrapper.__init__(cell, attn_length, attn_size=None, attn_vec_size=None, input_size=None, state_is_tuple=False)` {#AttentionCellWrapper.__init__} - -Create a cell with attention. - -##### Args: - - -* `cell`: an RNNCell, an attention is added to it. -* `attn_length`: integer, the size of an attention window. -* `attn_size`: integer, the size of an attention vector. Equal to - cell.output_size by default. -* `attn_vec_size`: integer, the number of convolutional features calculated - on attention state and a size of the hidden layer built from - base cell state. Equal attn_size to by default. -* `input_size`: integer, the size of a hidden linear layer, - built from inputs and attention. Derived from the input tensor - by default. -* `state_is_tuple`: If True, accepted and returned states are n-tuples, where - `n = len(cells)`. By default (False), the states are all - concatenated along the column axis. - -##### Raises: - - -* `TypeError`: if cell is not an RNNCell. -* `ValueError`: if cell returns a state tuple but the flag - `state_is_tuple` is `False` or if attn_length is zero or less. - - -- - - - -#### `tf.contrib.rnn.AttentionCellWrapper.output_size` {#AttentionCellWrapper.output_size} - - - - -- - - - -#### `tf.contrib.rnn.AttentionCellWrapper.state_size` {#AttentionCellWrapper.state_size} - - - - -- - - - -#### `tf.contrib.rnn.AttentionCellWrapper.zero_state(batch_size, dtype)` {#AttentionCellWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.MultiRNNCell.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.MultiRNNCell.md deleted file mode 100644 index 47c1855010..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.MultiRNNCell.md +++ /dev/null @@ -1,66 +0,0 @@ -RNN cell composed sequentially of multiple simple cells. -- - - - -#### `tf.contrib.rnn.MultiRNNCell.__call__(inputs, state, scope=None)` {#MultiRNNCell.__call__} - -Run this multi-layer cell on inputs, starting from state. - - -- - - - -#### `tf.contrib.rnn.MultiRNNCell.__init__(cells, state_is_tuple=True)` {#MultiRNNCell.__init__} - -Create a RNN cell composed sequentially of a number of RNNCells. - -##### Args: - - -* `cells`: list of RNNCells that will be composed in this order. -* `state_is_tuple`: If True, accepted and returned states are n-tuples, where - `n = len(cells)`. If False, the states are all - concatenated along the column axis. This latter behavior will soon be - deprecated. - -##### Raises: - - -* `ValueError`: if cells is empty (not allowed), or at least one of the cells - returns a state tuple but the flag `state_is_tuple` is `False`. - - -- - - - -#### `tf.contrib.rnn.MultiRNNCell.output_size` {#MultiRNNCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.MultiRNNCell.state_size` {#MultiRNNCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.MultiRNNCell.zero_state(batch_size, dtype)` {#MultiRNNCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.OutputProjectionWrapper.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.OutputProjectionWrapper.md deleted file mode 100644 index 87e1024613..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.OutputProjectionWrapper.md +++ /dev/null @@ -1,68 +0,0 @@ -Operator adding an output projection to the given cell. - -Note: in many cases it may be more efficient to not use this wrapper, -but instead concatenate the whole sequence of your outputs in time, -do the projection on this batch-concatenated sequence, then split it -if needed or directly feed into a softmax. -- - - - -#### `tf.contrib.rnn.OutputProjectionWrapper.__call__(inputs, state, scope=None)` {#OutputProjectionWrapper.__call__} - -Run the cell and output projection on inputs, starting from state. - - -- - - - -#### `tf.contrib.rnn.OutputProjectionWrapper.__init__(cell, output_size)` {#OutputProjectionWrapper.__init__} - -Create a cell with output projection. - -##### Args: - - -* `cell`: an RNNCell, a projection to output_size is added to it. -* `output_size`: integer, the size of the output after projection. - -##### Raises: - - -* `TypeError`: if cell is not an RNNCell. -* `ValueError`: if output_size is not positive. - - -- - - - -#### `tf.contrib.rnn.OutputProjectionWrapper.output_size` {#OutputProjectionWrapper.output_size} - - - - -- - - - -#### `tf.contrib.rnn.OutputProjectionWrapper.state_size` {#OutputProjectionWrapper.state_size} - - - - -- - - - -#### `tf.contrib.rnn.OutputProjectionWrapper.zero_state(batch_size, dtype)` {#OutputProjectionWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.stack_bidirectional_dynamic_rnn.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.stack_bidirectional_dynamic_rnn.md deleted file mode 100644 index 3ced8eb13f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.rnn.stack_bidirectional_dynamic_rnn.md +++ /dev/null @@ -1,50 +0,0 @@ -### `tf.contrib.rnn.stack_bidirectional_dynamic_rnn(cells_fw, cells_bw, inputs, initial_states_fw=None, initial_states_bw=None, dtype=None, sequence_length=None, scope=None)` {#stack_bidirectional_dynamic_rnn} - -Creates a dynamic bidirectional recurrent neural network. - -Stacks several bidirectional rnn layers. The combined forward and backward -layer outputs are used as input of the next layer. tf.bidirectional_rnn -does not allow to share forward and backward information between layers. -The input_size of the first forward and backward cells must match. -The initial state for both directions is zero and no intermediate states -are returned. - -##### Args: - - -* `cells_fw`: List of instances of RNNCell, one per layer, - to be used for forward direction. -* `cells_bw`: List of instances of RNNCell, one per layer, - to be used for backward direction. -* `inputs`: A length T list of inputs, each a tensor of shape - [batch_size, input_size], or a nested tuple of such elements. -* `initial_states_fw`: (optional) A list of the initial states (one per layer) - for the forward RNN. - Each tensor must has an appropriate type and shape - `[batch_size, cell_fw.state_size]`. -* `initial_states_bw`: (optional) Same as for `initial_states_fw`, but using - the corresponding properties of `cells_bw`. -* `dtype`: (optional) The data type for the initial state. Required if - either of the initial states are not provided. -* `sequence_length`: (optional) An int32/int64 vector, size `[batch_size]`, - containing the actual lengths for each of the sequences. -* `scope`: VariableScope for the created subgraph; defaults to None. - -##### Returns: - - A tuple (outputs, output_state_fw, output_state_bw) where: - -* `outputs`: Output `Tensor` shaped: - `batch_size, max_time, layers_output]`. Where layers_output - are depth-concatenated forward and backward outputs. - output_states_fw is the final states, one tensor per layer, - of the forward rnn. - output_states_bw is the final states, one tensor per layer, - of the backward rnn. - -##### Raises: - - -* `TypeError`: If `cell_fw` or `cell_bw` is not an instance of `RNNCell`. -* `ValueError`: If inputs is `None`, not a list or an empty list. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.training.weighted_resample.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.training.weighted_resample.md deleted file mode 100644 index 903cad838b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.training.weighted_resample.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.contrib.training.weighted_resample(inputs, weights, overall_rate, scope=None, mean_decay=0.999, seed=None)` {#weighted_resample} - -Performs an approximate weighted resampling of `inputs`. - -This method chooses elements from `inputs` where each item's rate of -selection is proportional to its value in `weights`, and the average -rate of selection across all inputs (and many invocations!) is -`overall_rate`. - -##### Args: - - -* `inputs`: A list of tensors whose first dimension is `batch_size`. -* `weights`: A `[batch_size]`-shaped tensor with each batch member's weight. -* `overall_rate`: Desired overall rate of resampling. -* `scope`: Scope to use for the op. -* `mean_decay`: How quickly to decay the running estimate of the mean weight. -* `seed`: Random seed. - -##### Returns: - - A list of tensors exactly like `inputs`, but with an unknown (and - possibly zero) first dimension. - A tensor containing the effective resampling rate used for each output. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.util.ops_used_by_graph_def.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.util.ops_used_by_graph_def.md deleted file mode 100644 index 38a9cc4f43..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.contrib.util.ops_used_by_graph_def.md +++ /dev/null @@ -1,15 +0,0 @@ -### `tf.contrib.util.ops_used_by_graph_def(graph_def)` {#ops_used_by_graph_def} - -Collect the list of ops used by a graph. - -Does not validate that the ops are all registered. - -##### Args: - - -* `graph_def`: A `GraphDef` proto, as from `graph.as_graph_def()`. - -##### Returns: - - A list of strings, each naming an op used by the graph. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.convert_to_tensor_or_sparse_tensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.convert_to_tensor_or_sparse_tensor.md deleted file mode 100644 index 1999e71180..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.convert_to_tensor_or_sparse_tensor.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.convert_to_tensor_or_sparse_tensor(value, dtype=None, name=None)` {#convert_to_tensor_or_sparse_tensor} - -Converts value to a `SparseTensor` or `Tensor`. - -##### Args: - - -* `value`: A `SparseTensor`, `SparseTensorValue`, or an object whose type has a - registered `Tensor` conversion function. -* `dtype`: Optional element type for the returned tensor. If missing, the - type is inferred from the type of `value`. -* `name`: Optional name to use if a new `Tensor` is created. - -##### Returns: - - A `SparseTensor` or `Tensor` based on `value`. - -##### Raises: - - -* `RuntimeError`: If result type is incompatible with `dtype`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.cumprod.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.cumprod.md deleted file mode 100644 index 0275374f03..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.cumprod.md +++ /dev/null @@ -1,44 +0,0 @@ -### `tf.cumprod(x, axis=0, exclusive=False, reverse=False, name=None)` {#cumprod} - -Compute the cumulative product of the tensor `x` along `axis`. - -By default, this op performs an inclusive cumprod, which means that the -first -element of the input is identical to the first element of the output: -```prettyprint -tf.cumprod([a, b, c]) ==> [a, a * b, a * b * c] -``` - -By setting the `exclusive` kwarg to `True`, an exclusive cumprod is -performed -instead: -```prettyprint -tf.cumprod([a, b, c], exclusive=True) ==> [1, a, a * b] -``` - -By setting the `reverse` kwarg to `True`, the cumprod is performed in the -opposite direction: -```prettyprint -tf.cumprod([a, b, c], reverse=True) ==> [a * b * c, b * c, c] -``` -This is more efficient than using separate `tf.reverse` ops. - -The `reverse` and `exclusive` kwargs can also be combined: -```prettyprint -tf.cumprod([a, b, c], exclusive=True, reverse=True) ==> [b * c, c, 1] -``` - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, - `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, - `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `axis`: A `Tensor` of type `int32` (default: 0). -* `reverse`: A `bool` (default: False). -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.delete_session_tensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.delete_session_tensor.md deleted file mode 100644 index 7a43e917ce..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.delete_session_tensor.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.delete_session_tensor(handle, name=None)` {#delete_session_tensor} - -Delete the tensor for the given tensor handle. - -This is EXPERIMENTAL and subject to change. - -Delete the tensor of a given tensor handle. The tensor is produced -in a previous run() and stored in the state of the session. - -##### Args: - - -* `handle`: The string representation of a persistent tensor handle. -* `name`: Optional name prefix for the return tensor. - -##### Returns: - - A pair of graph elements. The first is a placeholder for feeding a - tensor handle and the second is a deletion operation. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.depth_to_space.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.depth_to_space.md deleted file mode 100644 index 03dc6bb3b0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.depth_to_space.md +++ /dev/null @@ -1,95 +0,0 @@ -### `tf.depth_to_space(input, block_size, name=None)` {#depth_to_space} - -DepthToSpace for tensors of type T. - -Rearranges data from depth into blocks of spatial data. -This is the reverse transformation of SpaceToDepth. More specifically, -this op outputs a copy of the input tensor where values from the `depth` -dimension are moved in spatial blocks to the `height` and `width` dimensions. -The attr `block_size` indicates the input block size and how the data is moved. - - * Chunks of data of size `block_size * block_size` from depth are rearranged - into non-overlapping blocks of size `block_size x block_size` - * The width the output tensor is `input_depth * block_size`, whereas the - height is `input_height * block_size`. - * The depth of the input tensor must be divisible by - `block_size * block_size`. - -That is, assuming the input is in the shape: -`[batch, height, width, depth]`, -the shape of the output will be: -`[batch, height*block_size, width*block_size, depth/(block_size*block_size)]` - -This operation requires that the input tensor be of rank 4, and that -`block_size` be >=1 and that `block_size * block_size` be a divisor of the -input depth. - -This operation is useful for resizing the activations between convolutions -(but keeping all data), e.g. instead of pooling. It is also useful for training -purely convolutional models. - -For example, given this input of shape `[1, 1, 1, 4]`, and a block size of 2: - -```prettyprint -x = [[[[1, 2, 3, 4]]]] - -``` - -This operation will output a tensor of shape `[1, 2, 2, 1]`: - -```prettyprint - [[[[1], [2]], - [[3], [4]]]] -``` - -Here, the input has a batch of 1 and each batch element has shape `[1, 1, 4]`, -the corresponding output will have 2x2 elements and will have a depth of -1 channel (1 = `4 / (block_size * block_size)`). -The output element shape is `[2, 2, 1]`. - -For an input tensor with larger depth, here of shape `[1, 1, 1, 12]`, e.g. - -```prettyprint -x = [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]] -``` - -This operation, for block size of 2, will return the following tensor of shape -`[1, 2, 2, 3]` - -```prettyprint - [[[[1, 2, 3], [4, 5, 6]], - [[7, 8, 9], [10, 11, 12]]]] - -``` - -Similarly, for the following input of shape `[1 2 2 4]`, and a block size of 2: - -```prettyprint -x = [[[[1, 2, 3, 4], - [5, 6, 7, 8]], - [[9, 10, 11, 12], - [13, 14, 15, 16]]]] -``` - -the operator will return the following tensor of shape `[1 4 4 1]`: - -```prettyprint -x = [[ [1], [2], [5], [6]], - [ [3], [4], [7], [8]], - [ [9], [10], [13], [14]], - [ [11], [12], [15], [16]]] - -``` - -##### Args: - - -* `input`: A `Tensor`. -* `block_size`: An `int` that is `>= 2`. - The size of the spatial block, same as in Space2Depth. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.device.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.device.md deleted file mode 100644 index 2a5e33203d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.device.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.device(device_name_or_function)` {#device} - -Wrapper for `Graph.device()` using the default graph. - -See -[`Graph.device()`](../../api_docs/python/framework.md#Graph.device) -for more details. - -##### Args: - - -* `device_name_or_function`: The device name or function to use in - the context. - -##### Returns: - - A context manager that specifies the default device to use for newly - created ops. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.errors.CancelledError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.errors.CancelledError.md deleted file mode 100644 index cf20c0e2e3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.errors.CancelledError.md +++ /dev/null @@ -1,17 +0,0 @@ -Raised when an operation or step is cancelled. - -For example, a long-running operation (e.g. -[`queue.enqueue()`](../../api_docs/python/io_ops.md#QueueBase.enqueue) may be -cancelled by running another operation (e.g. -[`queue.close(cancel_pending_enqueues=True)`](../../api_docs/python/io_ops.md#QueueBase.close), -or by [closing the session](../../api_docs/python/client.md#Session.close). -A step that is running such a long-running operation will fail by raising -`CancelledError`. - -- - - - -#### `tf.errors.CancelledError.__init__(node_def, op, message)` {#CancelledError.__init__} - -Creates a `CancelledError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.errors.DataLossError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.errors.DataLossError.md deleted file mode 100644 index 3193e77ae3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.errors.DataLossError.md +++ /dev/null @@ -1,13 +0,0 @@ -Raised when unrecoverable data loss or corruption is encountered. - -For example, this may be raised by running a -[`tf.WholeFileReader.read()`](../../api_docs/python/io_ops.md#WholeFileReader) -operation, if the file is truncated while it is being read. - -- - - - -#### `tf.errors.DataLossError.__init__(node_def, op, message)` {#DataLossError.__init__} - -Creates a `DataLossError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.errors.DeadlineExceededError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.errors.DeadlineExceededError.md deleted file mode 100644 index e8ef3be06e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.errors.DeadlineExceededError.md +++ /dev/null @@ -1,11 +0,0 @@ -Raised when a deadline expires before an operation could complete. - -This exception is not currently used. - -- - - - -#### `tf.errors.DeadlineExceededError.__init__(node_def, op, message)` {#DeadlineExceededError.__init__} - -Creates a `DeadlineExceededError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fake_quant_with_min_max_vars_gradient.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fake_quant_with_min_max_vars_gradient.md deleted file mode 100644 index b363afe7ce..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fake_quant_with_min_max_vars_gradient.md +++ /dev/null @@ -1,27 +0,0 @@ -### `tf.fake_quant_with_min_max_vars_gradient(gradients, inputs, min, max, name=None)` {#fake_quant_with_min_max_vars_gradient} - -Compute gradients for a FakeQuantWithMinMaxVars operation. - -##### Args: - - -* `gradients`: A `Tensor` of type `float32`. - Backpropagated gradients above the FakeQuantWithMinMaxVars operation. -* `inputs`: A `Tensor` of type `float32`. - Values passed as inputs to the FakeQuantWithMinMaxVars operation. - min, max: Quantization interval, scalar floats. -* `min`: A `Tensor` of type `float32`. -* `max`: A `Tensor` of type `float32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (backprops_wrt_input, backprop_wrt_min, backprop_wrt_max). - -* `backprops_wrt_input`: A `Tensor` of type `float32`. Backpropagated gradients w.r.t. inputs: - `gradients * (inputs >= min && inputs <= max)`. -* `backprop_wrt_min`: A `Tensor` of type `float32`. Backpropagated gradients w.r.t. min parameter: - `sum(gradients * (inputs < min))`. -* `backprop_wrt_max`: A `Tensor` of type `float32`. Backpropagated gradients w.r.t. max parameter: - `sum(gradients * (inputs > max))`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fake_quant_with_min_max_vars_per_channel_gradient.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fake_quant_with_min_max_vars_per_channel_gradient.md deleted file mode 100644 index a7a62e29b3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fake_quant_with_min_max_vars_per_channel_gradient.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.fake_quant_with_min_max_vars_per_channel_gradient(gradients, inputs, min, max, name=None)` {#fake_quant_with_min_max_vars_per_channel_gradient} - -Compute gradients for a FakeQuantWithMinMaxVarsPerChannel operation. - -##### Args: - - -* `gradients`: A `Tensor` of type `float32`. - Backpropagated gradients above the FakeQuantWithMinMaxVars operation, - shape one of: `[d]`, `[b, d]`, `[b, h, w, d]`. -* `inputs`: A `Tensor` of type `float32`. - Values passed as inputs to the FakeQuantWithMinMaxVars operation, shape - same as `gradients`. - min, max: Quantization interval, floats of shape `[d]`. -* `min`: A `Tensor` of type `float32`. -* `max`: A `Tensor` of type `float32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (backprops_wrt_input, backprop_wrt_min, backprop_wrt_max). - -* `backprops_wrt_input`: A `Tensor` of type `float32`. Backpropagated gradients w.r.t. inputs, shape same as - `inputs`: - `gradients * (inputs >= min && inputs <= max)`. -* `backprop_wrt_min`: A `Tensor` of type `float32`. Backpropagated gradients w.r.t. min parameter, shape `[d]`: - `sum_per_d(gradients * (inputs < min))`. -* `backprop_wrt_max`: A `Tensor` of type `float32`. Backpropagated gradients w.r.t. max parameter, shape `[d]`: - `sum_per_d(gradients * (inputs > max))`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fft.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fft.md deleted file mode 100644 index da37dd4933..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fft.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.fft(input, name=None)` {#fft} - -Compute the 1-dimensional discrete Fourier Transform over the inner-most - -dimension of `input`. - -##### Args: - - -* `input`: A `Tensor` of type `complex64`. A complex64 tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `complex64`. - A complex64 tensor of the same shape as `input`. The inner-most - dimension of `input` is replaced with its 1D Fourier Transform. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fft2d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fft2d.md deleted file mode 100644 index 81b83df8bb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.fft2d.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.fft2d(input, name=None)` {#fft2d} - -Compute the 2-dimensional discrete Fourier Transform over the inner-most - -2 dimensions of `input`. - -##### Args: - - -* `input`: A `Tensor` of type `complex64`. A complex64 tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `complex64`. - A complex64 tensor of the same shape as `input`. The inner-most 2 - dimensions of `input` are replaced with their 2D Fourier Transform. - - @compatibility(numpy) - Equivalent to np.fft2 - @end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.floormod.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.floormod.md deleted file mode 100644 index 5ebd691835..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.floormod.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.floormod(x, y, name=None)` {#floormod} - -Returns element-wise remainder of division. When `x < 0` xor `y < 0` is - -true, this follows Python semantics in that the result here is consistent -with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. - -*NOTE*: `FloorMod` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `float32`, `float64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.get_seed.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.get_seed.md deleted file mode 100644 index 8fd602784c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.get_seed.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.get_seed(op_seed)` {#get_seed} - -Returns the local seeds an operation should use given an op-specific seed. - -Given operation-specific seed, `op_seed`, this helper function returns two -seeds derived from graph-level and op-level seeds. Many random operations -internally use the two seeds to allow user to change the seed globally for a -graph, or for only specific operations. - -For details on how the graph-level seed interacts with op seeds, see -@{tf.set_random_seed}. - -##### Args: - - -* `op_seed`: integer. - -##### Returns: - - A tuple of two integers that should be used for the local seed of this - operation. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.get_session_handle.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.get_session_handle.md deleted file mode 100644 index ac3379b93d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.get_session_handle.md +++ /dev/null @@ -1,40 +0,0 @@ -### `tf.get_session_handle(data, name=None)` {#get_session_handle} - -Return the handle of `data`. - -This is EXPERIMENTAL and subject to change. - -Keep `data` "in-place" in the runtime and create a handle that can be -used to retrieve `data` in a subsequent run(). - -Combined with `get_session_tensor`, we can keep a tensor produced in -one run call in place, and use it as the input in a future run call. - -##### Args: - - -* `data`: A tensor to be stored in the session. -* `name`: Optional name prefix for the return tensor. - -##### Returns: - - A scalar string tensor representing a unique handle for `data`. - -##### Raises: - - -* `TypeError`: if `data` is not a Tensor. - - -* `Example`: - -```python -c = tf.multiply(a, b) -h = tf.get_session_handle(c) -h = sess.run(h) - -p, a = tf.get_session_tensor(h.handle, tf.float32) -b = tf.multiply(a, 10) -c = sess.run(b, feed_dict={p: h.handle}) -``` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.global_norm.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.global_norm.md deleted file mode 100644 index d37d4228b2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.global_norm.md +++ /dev/null @@ -1,27 +0,0 @@ -### `tf.global_norm(t_list, name=None)` {#global_norm} - -Computes the global norm of multiple tensors. - -Given a tuple or list of tensors `t_list`, this operation returns the -global norm of the elements in all tensors in `t_list`. The global norm is -computed as: - -`global_norm = sqrt(sum([l2norm(t)**2 for t in t_list]))` - -Any entries in `t_list` that are of type None are ignored. - -##### Args: - - -* `t_list`: A tuple or list of mixed `Tensors`, `IndexedSlices`, or None. -* `name`: A name for the operation (optional). - -##### Returns: - - A 0-D (scalar) `Tensor` of type `float`. - -##### Raises: - - -* `TypeError`: If `t_list` is not a sequence. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.ifft3d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.ifft3d.md deleted file mode 100644 index 7d106f24a8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.ifft3d.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.ifft3d(input, name=None)` {#ifft3d} - -Compute the inverse 3-dimensional discrete Fourier Transform over the inner-most - -3 dimensions of `input`. - -##### Args: - - -* `input`: A `Tensor` of type `complex64`. A complex64 tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `complex64`. - A complex64 tensor of the same shape as `input`. The inner-most 3 - dimensions of `input` are replaced with their inverse 3D Fourier Transform. - - @compatibility(numpy) - Equivalent to np.fft3 - @end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.adjust_brightness.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.adjust_brightness.md deleted file mode 100644 index 7743f0180c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.adjust_brightness.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.image.adjust_brightness(image, delta)` {#adjust_brightness} - -Adjust the brightness of RGB or Grayscale images. - -This is a convenience method that converts an RGB image to float -representation, adjusts its brightness, and then converts it back to the -original data type. If several adjustments are chained it is advisable to -minimize the number of redundant conversions. - -The value `delta` is added to all components of the tensor `image`. Both -`image` and `delta` are converted to `float` before adding (and `image` is -scaled appropriately if it is in fixed-point representation). For regular -images, `delta` should be in the range `[0,1)`, as it is added to the image in -floating point representation, where pixel values are in the `[0,1)` range. - -##### Args: - - -* `image`: A tensor. -* `delta`: A scalar. Amount to add to the pixel values. - -##### Returns: - - A brightness-adjusted tensor of the same shape and type as `image`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.adjust_gamma.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.adjust_gamma.md deleted file mode 100644 index 34fdad226b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.adjust_gamma.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.image.adjust_gamma(image, gamma=1, gain=1)` {#adjust_gamma} - -Performs Gamma Correction on the input image. - Also known as Power Law Transform. This function transforms the - input image pixelwise according to the equation Out = In**gamma - after scaling each pixel to the range 0 to 1. - -##### Args: - - image : A Tensor. - gamma : A scalar. Non negative real number. - gain : A scalar. The constant multiplier. - -##### Returns: - - A Tensor. Gamma corrected output image. - -##### Notes: - - For gamma greater than 1, the histogram will shift towards left and - the output image will be darker than the input image. - For gamma less than 1, the histogram will shift towards right and - the output image will be brighter than the input image. - -##### References: - - [1] http://en.wikipedia.org/wiki/Gamma_correction - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.decode_jpeg.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.decode_jpeg.md deleted file mode 100644 index 1e3b4912b2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.decode_jpeg.md +++ /dev/null @@ -1,48 +0,0 @@ -### `tf.image.decode_jpeg(contents, channels=None, ratio=None, fancy_upscaling=None, try_recover_truncated=None, acceptable_fraction=None, dct_method=None, name=None)` {#decode_jpeg} - -Decode a JPEG-encoded image to a uint8 tensor. - -The attr `channels` indicates the desired number of color channels for the -decoded image. - -Accepted values are: - -* 0: Use the number of channels in the JPEG-encoded image. -* 1: output a grayscale image. -* 3: output an RGB image. - -If needed, the JPEG-encoded image is transformed to match the requested number -of color channels. - -The attr `ratio` allows downscaling the image by an integer factor during -decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than -downscaling the image later. - -##### Args: - - -* `contents`: A `Tensor` of type `string`. 0-D. The JPEG-encoded image. -* `channels`: An optional `int`. Defaults to `0`. - Number of color channels for the decoded image. -* `ratio`: An optional `int`. Defaults to `1`. Downscaling ratio. -* `fancy_upscaling`: An optional `bool`. Defaults to `True`. - If true use a slower but nicer upscaling of the - chroma planes (yuv420/422 only). -* `try_recover_truncated`: An optional `bool`. Defaults to `False`. - If true try to recover an image from truncated input. -* `acceptable_fraction`: An optional `float`. Defaults to `1`. - The minimum required fraction of lines before a truncated - input is accepted. -* `dct_method`: An optional `string`. Defaults to `""`. - string specifying a hint about the algorithm used for - decompression. Defaults to "" which maps to a system-specific - default. Currently valid values are ["INTEGER_FAST", - "INTEGER_ACCURATE"]. The hint may be ignored (e.g., the internal - jpeg library changes to a version that does not have that specific - option.) -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `uint8`. 3-D with shape `[height, width, channels]`.. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.grayscale_to_rgb.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.grayscale_to_rgb.md deleted file mode 100644 index 755b66141b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.grayscale_to_rgb.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.image.grayscale_to_rgb(images, name=None)` {#grayscale_to_rgb} - -Converts one or more images from Grayscale to RGB. - -Outputs a tensor of the same `DType` and rank as `images`. The size of the -last dimension of the output is 3, containing the RGB value of the pixels. - -##### Args: - - -* `images`: The Grayscale tensor to convert. Last dimension must be size 1. -* `name`: A name for the operation (optional). - -##### Returns: - - The converted grayscale image(s). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.random_brightness.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.random_brightness.md deleted file mode 100644 index 6c773b6985..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.random_brightness.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.image.random_brightness(image, max_delta, seed=None)` {#random_brightness} - -Adjust the brightness of images by a random factor. - -Equivalent to `adjust_brightness()` using a `delta` randomly picked in the -interval `[-max_delta, max_delta)`. - -##### Args: - - -* `image`: An image. -* `max_delta`: float, must be non-negative. -* `seed`: A Python integer. Used to create a random seed. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - -##### Returns: - - The brightness-adjusted image. - -##### Raises: - - -* `ValueError`: if `max_delta` is negative. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.rgb_to_grayscale.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.rgb_to_grayscale.md deleted file mode 100644 index bf9b6846e0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.image.rgb_to_grayscale.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.image.rgb_to_grayscale(images, name=None)` {#rgb_to_grayscale} - -Converts one or more images from RGB to Grayscale. - -Outputs a tensor of the same `DType` and rank as `images`. The size of the -last dimension of the output is 1, containing the Grayscale value of the -pixels. - -##### Args: - - -* `images`: The RGB tensor to convert. Last dimension must have size 3 and - should contain RGB values. -* `name`: A name for the operation (optional). - -##### Returns: - - The converted grayscale image(s). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_finite.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_finite.md deleted file mode 100644 index 15d5a7df94..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_finite.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.is_finite(x, name=None)` {#is_finite} - -Returns which elements of x are finite. - -@compatibility(numpy) -Equivalent to np.isfinite -@end_compatibility - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_nan.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_nan.md deleted file mode 100644 index b1fd8de13c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_nan.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.is_nan(x, name=None)` {#is_nan} - -Returns which elements of x are NaN. - -@compatibility(numpy) -Equivalent to np.isnan -@end_compatibility - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_non_decreasing.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_non_decreasing.md deleted file mode 100644 index f10ff932c0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_non_decreasing.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.is_non_decreasing(x, name=None)` {#is_non_decreasing} - -Returns `True` if `x` is non-decreasing. - -Elements of `x` are compared in row-major order. The tensor `[x[0],...]` -is non-decreasing if for every adjacent pair we have `x[i] <= x[i+1]`. -If `x` has less than two elements, it is trivially non-decreasing. - -See also: `is_strictly_increasing` - -##### Args: - - -* `x`: Numeric `Tensor`. -* `name`: A name for this operation (optional). Defaults to "is_non_decreasing" - -##### Returns: - - Boolean `Tensor`, equal to `True` iff `x` is non-decreasing. - -##### Raises: - - -* `TypeError`: if `x` is not a numeric tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_numeric_tensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_numeric_tensor.md deleted file mode 100644 index c2e61b856d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.is_numeric_tensor.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.is_numeric_tensor(tensor)` {#is_numeric_tensor} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.mod.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.mod.md deleted file mode 100644 index 3f928e7a61..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.mod.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.mod(x, y, name=None)` {#mod} - -Returns element-wise remainder of division. When `x < 0` xor `y < 0` is - -true, this follows Python semantics in that the result here is consistent -with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. - -*NOTE*: `FloorMod` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `float32`, `float64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.name_scope.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.name_scope.md deleted file mode 100644 index f888ca22cd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.name_scope.md +++ /dev/null @@ -1,39 +0,0 @@ -### `tf.name_scope(name, default_name=None, values=None)` {#name_scope} - -Returns a context manager for use when defining a Python op. - -This context manager validates that the given `values` are from the -same graph, makes that graph the default graph, and pushes a -name scope in that graph (see -[`Graph.name_scope()`](../../api_docs/python/framework.md#Graph.name_scope) -for more details on that). - -For example, to define a new Python op called `my_op`: - -```python -def my_op(a, b, c, name=None): - with tf.name_scope(name, "MyOp", [a, b, c]) as scope: - a = tf.convert_to_tensor(a, name="a") - b = tf.convert_to_tensor(b, name="b") - c = tf.convert_to_tensor(c, name="c") - # Define some computation that uses `a`, `b`, and `c`. - return foo_op(..., name=scope) -``` - -##### Args: - - -* `name`: The name argument that is passed to the op function. -* `default_name`: The default name to use if the `name` argument is `None`. -* `values`: The list of `Tensor` arguments that are passed to the op function. - -##### Returns: - - A context manager for use in defining Python ops. Yields the name scope. - -##### Raises: - - -* `ValueError`: if neither `name` nor `default_name` is provided - but `values` are. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.avg_pool3d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.avg_pool3d.md deleted file mode 100644 index 5bb4dcf68f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.avg_pool3d.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.nn.avg_pool3d(input, ksize, strides, padding, name=None)` {#avg_pool3d} - -Performs 3D average pooling on the input. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Shape `[batch, depth, rows, cols, channels]` tensor to pool over. -* `ksize`: A list of `ints` that has length `>= 5`. - 1-D tensor of length 5. The size of the window for each dimension of - the input tensor. Must have `ksize[0] = ksize[4] = 1`. -* `strides`: A list of `ints` that has length `>= 5`. - 1-D tensor of length 5. The stride of the sliding window for each - dimension of `input`. Must have `strides[0] = strides[4] = 1`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - The average pooled output tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.conv2d_backprop_filter.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.conv2d_backprop_filter.md deleted file mode 100644 index 27c2da89df..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.conv2d_backprop_filter.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.nn.conv2d_backprop_filter(input, filter_sizes, out_backprop, strides, padding, use_cudnn_on_gpu=None, data_format=None, name=None)` {#conv2d_backprop_filter} - -Computes the gradients of convolution with respect to the filter. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. - 4-D with shape `[batch, in_height, in_width, in_channels]`. -* `filter_sizes`: A `Tensor` of type `int32`. - An integer vector representing the tensor shape of `filter`, - where `filter` is a 4-D - `[filter_height, filter_width, in_channels, out_channels]` tensor. -* `out_backprop`: A `Tensor`. Must have the same type as `input`. - 4-D with shape `[batch, out_height, out_width, out_channels]`. - Gradients w.r.t. the output of the convolution. -* `strides`: A list of `ints`. - The stride of the sliding window for each dimension of the input - of the convolution. Must be in the same order as the dimension specified with - format. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `use_cudnn_on_gpu`: An optional `bool`. Defaults to `True`. -* `data_format`: An optional `string` from: `"NHWC", "NCHW"`. Defaults to `"NHWC"`. - Specify the data format of the input and output data. With the - default format "NHWC", the data is stored in the order of: - [batch, in_height, in_width, in_channels]. - Alternatively, the format could be "NCHW", the data storage order of: - [batch, in_channels, in_height, in_width]. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. 4-D with shape - `[filter_height, filter_width, in_channels, out_channels]`. Gradient w.r.t. - the `filter` input of the convolution. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.ctc_loss.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.ctc_loss.md deleted file mode 100644 index 128808ff36..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.ctc_loss.md +++ /dev/null @@ -1,103 +0,0 @@ -### `tf.nn.ctc_loss(labels, inputs, sequence_length, preprocess_collapse_repeated=False, ctc_merge_repeated=True, time_major=True)` {#ctc_loss} - -Computes the CTC (Connectionist Temporal Classification) Loss. - -This op implements the CTC loss as presented in the article: - -A. Graves, S. Fernandez, F. Gomez, J. Schmidhuber. -Connectionist Temporal Classification: Labelling Unsegmented Sequence Data -with Recurrent Neural Networks. ICML 2006, Pittsburgh, USA, pp. 369-376. - -http://www.cs.toronto.edu/~graves/icml_2006.pdf - -Input requirements: - -``` -sequence_length(b) <= time for all b - -max(labels.indices(labels.indices[:, 1] == b, 2)) - <= sequence_length(b) for all b. -``` - -Notes: - -This class performs the softmax operation for you, so inputs should -be e.g. linear projections of outputs by an LSTM. - -The `inputs` Tensor's innermost dimension size, `num_classes`, represents -`num_labels + 1` classes, where num_labels is the number of true labels, and -the largest value `(num_classes - 1)` is reserved for the blank label. - -For example, for a vocabulary containing 3 labels `[a, b, c]`, -`num_classes = 4` and the labels indexing is `{a: 0, b: 1, c: 2, blank: 3}`. - -Regarding the arguments `preprocess_collapse_repeated` and -`ctc_merge_repeated`: - -If `preprocess_collapse_repeated` is True, then a preprocessing step runs -before loss calculation, wherein repeated labels passed to the loss -are merged into single labels. This is useful if the training labels come -from, e.g., forced alignments and therefore have unnecessary repetitions. - -If `ctc_merge_repeated` is set False, then deep within the CTC calculation, -repeated non-blank labels will not be merged and are interpreted -as individual labels. This is a simplified (non-standard) version of CTC. - -Here is a table of the (roughly) expected first order behavior: - -* `preprocess_collapse_repeated=False`, `ctc_merge_repeated=True` - - Classical CTC behavior: Outputs true repeated classes with blanks in - between, and can also output repeated classes with no blanks in - between that need to be collapsed by the decoder. - -* `preprocess_collapse_repeated=True`, `ctc_merge_repeated=False` - - Never learns to output repeated classes, as they are collapsed - in the input labels before training. - -* `preprocess_collapse_repeated=False`, `ctc_merge_repeated=False` - - Outputs repeated classes with blanks in between, but generally does not - require the decoder to collapse/merge repeated classes. - -* `preprocess_collapse_repeated=True`, `ctc_merge_repeated=True` - - Untested. Very likely will not learn to output repeated classes. - -##### Args: - - -* `labels`: An `int32` `SparseTensor`. - `labels.indices[i, :] == [b, t]` means `labels.values[i]` stores - the id for (batch b, time t). - `labels.values[i]` must take on values in `[0, num_labels)`. - See `core/ops/ctc_ops.cc` for more details. -* `inputs`: 3-D `float` `Tensor`. - If time_major == False, this will be a `Tensor` shaped: - `[batch_size x max_time x num_classes]`. - If time_major == True (default), this will be a `Tensor` shaped: - `[max_time x batch_size x num_classes]`. - The logits. -* `sequence_length`: 1-D `int32` vector, size `[batch_size]`. - The sequence lengths. -* `preprocess_collapse_repeated`: Boolean. Default: False. - If True, repeated labels are collapsed prior to the CTC calculation. -* `ctc_merge_repeated`: Boolean. Default: True. -* `time_major`: The shape format of the `inputs` Tensors. - If True, these `Tensors` must be shaped `[max_time, batch_size, num_classes]`. - If False, these `Tensors` must be shaped `[batch_size, max_time, num_classes]`. - Using `time_major = True` (default) is a bit more efficient because it avoids - transposes at the beginning of the ctc_loss calculation. However, most - TensorFlow data is batch-major, so by this function also accepts inputs - in batch-major form. - -##### Returns: - - A 1-D `float` `Tensor`, size `[batch]`, containing the negative log probabilities. - -##### Raises: - - -* `TypeError`: if labels is not a `SparseTensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.l2_normalize.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.l2_normalize.md deleted file mode 100644 index 57b617a331..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.nn.l2_normalize.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.nn.l2_normalize(x, dim, epsilon=1e-12, name=None)` {#l2_normalize} - -Normalizes along dimension `dim` using an L2 norm. - -For a 1-D tensor with `dim = 0`, computes - - output = x / sqrt(max(sum(x**2), epsilon)) - -For `x` with more dimensions, independently normalizes each 1-D slice along -dimension `dim`. - -##### Args: - - -* `x`: A `Tensor`. -* `dim`: Dimension along which to normalize. A scalar or a vector of - integers. -* `epsilon`: A lower bound value for the norm. Will use `sqrt(epsilon)` as the - divisor if `norm < sqrt(epsilon)`. -* `name`: A name for this operation (optional). - -##### Returns: - - A `Tensor` with the same shape as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.norm.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.norm.md deleted file mode 100644 index f91766f656..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.norm.md +++ /dev/null @@ -1,66 +0,0 @@ -### `tf.norm(tensor, ord='euclidean', axis=None, keep_dims=False, name=None)` {#norm} - -Computes the norm of vectors, matrices, and tensors. - -This function can compute 3 different matrix norms (Frobenius, 1-norm, and -inf-norm) and up to 9218868437227405311 different vectors norms. - -##### Args: - - -* `tensor`: `Tensor` of types `float32`, `float64`, `complex64`, `complex128` -* `ord`: Order of the norm. Supported values are 'fro', 'euclidean', `0`, - `1, `2`, `np.inf` and any positive real number yielding the corresponding - p-norm. Default is 'euclidean' which is equivalent to Frobenius norm if - `tensor` is a matrix and equivalent to 2-norm for vectors. - Some restrictions apply, - a) The Frobenius norm `fro` is not defined for vectors, - b) If axis is a 2-tuple (matrix-norm), only 'euclidean', 'fro', `1`, - `np.inf` are supported. - See the description of `axis` on how to compute norms for a batch of - vectors or matrices stored in a tensor. -* `axis`: If `axis` is `None` (the default), the input is considered a vector - and a single vector norm is computed over the entire set of values in the - tensor, i.e. `norm(tensor, ord=ord)` is equivalent to - `norm(reshape(tensor, [-1]), ord=ord)`. - If `axis` is a Python integer, the input is considered a batch of vectors, - and `axis`t determines the axis in `tensor` over which to compute vector - norms. - If `axis` is a 2-tuple of Python integers it is considered a batch of - matrices and `axis` determines the axes in `tensor` over which to compute - a matrix norm. - Negative indices are supported. Example: If you are passing a tensor that - can be either a matrix or a batch of matrices at runtime, pass - `axis=[-2,-1]` instead of `axis=None` to make sure that matrix norms are - computed. -* `keep_dims`: If True, the axis indicated in `axis` are kept with size 1. - Otherwise, the dimensions in `axis` are removed from the output shape. -* `name`: The name of the op. - -##### Returns: - - -* `output`: A `Tensor` of the same type as tensor, containing the vector or - matrix norms. If `keep_dims` is True then the rank of output is equal to - the rank of `tensor`. Otherwise, if `axis` is none the output is a scalar, - if `axis` is an integer, the rank of `output` is one less than the rank - of `tensor`, if `axis` is a 2-tuple the rank of `output` is two less - than the rank of `tensor`. - -##### Raises: - - -* `ValueError`: If `ord` or `axis` is invalid. - -@compatibility(numpy) -Mostly equivalent to numpy.linalg.norm. -Not supported: ord <= 0, 2-norm for matrices, nuclear norm. - -##### Other differences: - - a) If axis is `None`, treats the the flattened `tensor` as a vector - regardless of rank. - b) Explicitly supports 'euclidean' norm as the default, including for - higher order tensors. -@end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.not_equal.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.not_equal.md deleted file mode 100644 index 5ed8df49d5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.not_equal.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.not_equal(x, y, name=None)` {#not_equal} - -Returns the truth value of (x != y) element-wise. - -*NOTE*: `NotEqual` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`, `complex64`, `quint8`, `qint8`, `qint32`, `string`, `bool`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.orthogonal_initializer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.orthogonal_initializer.md deleted file mode 100644 index 02f8528a6f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.orthogonal_initializer.md +++ /dev/null @@ -1,31 +0,0 @@ -Initializer that generates an orthogonal matrix. - -If the shape of the tensor to initialize is two-dimensional, i is initialized -with an orthogonal matrix obtained from the singular value decomposition of a -matrix of uniform random numbers. - -If the shape of the tensor to initialize is more than two-dimensional, -a matrix of shape `(shape[0] * ... * shape[n - 2], shape[n - 1])` -is initialized, where `n` is the length of the shape vector. -The matrix is subsequently reshaped to give a tensor of the desired shape. - -Args: - gain: multiplicative factor to apply to the orthogonal matrix - dtype: The type of the output. - seed: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -- - - - -#### `tf.orthogonal_initializer.__call__(shape, dtype=None, partition_info=None)` {#orthogonal_initializer.__call__} - - - - -- - - - -#### `tf.orthogonal_initializer.__init__(gain=1.0, dtype=tf.float32, seed=None)` {#orthogonal_initializer.__init__} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.py_func.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.py_func.md deleted file mode 100644 index 97e9df1308..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.py_func.md +++ /dev/null @@ -1,51 +0,0 @@ -### `tf.py_func(func, inp, Tout, stateful=True, name=None)` {#py_func} - -Wraps a python function and uses it as a TensorFlow op. - -Given a python function `func`, which takes numpy arrays as its -inputs and returns numpy arrays as its outputs, wrap this function as an -operation in a TensorFlow graph. The following snippet constructs a simple -TensorFlow graph that invokes the `np.sinh()` NumPy function as a operation -in the graph: - -```python -def my_func(x): - # x will be a numpy array with the contents of the placeholder below - return np.sinh(x) -inp = tf.placeholder(tf.float32) -y = tf.py_func(my_func, [inp], tf.float32) -``` - -**N.B.** The `tf.py_func()` operation has the following known limitations: - -* The body of the function (i.e. `func`) will not be serialized in a - `GraphDef`. Therefore, you should not use this function if you need to - serialize your model and restore it in a different environment. - -* The operation must run in the same address space as the Python program - that calls `tf.py_func()`. If you are using distributed TensorFlow, you - must run a `tf.train.Server` in the same process as the program that calls - `tf.py_func()` and you must pin the created operation to a device in that - server (e.g. using `with tf.device():`). - -##### Args: - - -* `func`: A Python function, which accepts a list of NumPy `ndarray` objects - having element types that match the corresponding `tf.Tensor` objects - in `inp`, and returns a list of `ndarray` objects (or a single `ndarray`) - having element types that match the corresponding values in `Tout`. -* `inp`: A list of `Tensor` objects. -* `Tout`: A list or tuple of tensorflow data types or a single tensorflow data - type if there is only one, indicating what `func` returns. -* `stateful`: (Boolean.) If True, the function should be considered stateful. - If a function is stateless, when given the same input it will return the - same output and have no observable side effects. Optimizations such as - common subexpression elimination are only performed on stateless - operations. -* `name`: A name for the operation (optional). - -##### Returns: - - A list of `Tensor` or a single `Tensor` which `func` computes. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.quantize_v2.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.quantize_v2.md deleted file mode 100644 index a02df53efe..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.quantize_v2.md +++ /dev/null @@ -1,74 +0,0 @@ -### `tf.quantize_v2(input, min_range, max_range, T, mode=None, name=None)` {#quantize_v2} - -Quantize the 'input' tensor of type float to 'output' tensor of type 'T'. - -[min_range, max_range] are scalar floats that specify the range for -the 'input' data. The 'mode' attribute controls exactly which calculations are -used to convert the float values to their quantized equivalents. - -In 'MIN_COMBINED' mode, each value of the tensor will undergo the following: - -``` -out[i] = (in[i] - min_range) * range(T) / (max_range - min_range) -if T == qint8, out[i] -= (range(T) + 1) / 2.0 -``` -here `range(T) = numeric_limits::max() - numeric_limits::min()` - -*MIN_COMBINED Mode Example* - -Assume the input is type float and has a possible range of [0.0, 6.0] and the -output type is quint8 ([0, 255]). The min_range and max_range values should be -specified as 0.0 and 6.0. Quantizing from float to quint8 will multiply each -value of the input by 255/6 and cast to quint8. - -If the output type was qint8 ([-128, 127]), the operation will additionally -subtract each value by 128 prior to casting, so that the range of values aligns -with the range of qint8. - -If the mode is 'MIN_FIRST', then this approach is used: - -``` -number_of_steps = 1 << (# of bits in T) -range_adjust = number_of_steps / (number_of_steps - 1) -range = (range_max - range_min) * range_adjust -range_scale = number_of_steps / range -quantized = round(input * range_scale) - round(range_min * range_scale) + - numeric_limits::min() -quantized = max(quantized, numeric_limits::min()) -quantized = min(quantized, numeric_limits::max()) -``` - -The biggest difference between this and MIN_COMBINED is that the minimum range -is rounded first, before it's subtracted from the rounded value. With -MIN_COMBINED, a small bias is introduced where repeated iterations of quantizing -and dequantizing will introduce a larger and larger error. - -One thing to watch out for is that the operator may choose to adjust the -requested minimum and maximum values slightly during the quantization process, -so you should always use the output ports as the range for further calculations. -For example, if the requested minimum and maximum values are close to equal, -they will be separated by a small epsilon value to prevent ill-formed quantized -buffers from being created. Otherwise, you can end up with buffers where all the -quantized values map to the same float value, which causes problems for -operations that have to perform further calculations on them. - -##### Args: - - -* `input`: A `Tensor` of type `float32`. -* `min_range`: A `Tensor` of type `float32`. - The minimum scalar value possibly produced for the input. -* `max_range`: A `Tensor` of type `float32`. - The maximum scalar value possibly produced for the input. -* `T`: A `tf.DType` from: `tf.qint8, tf.quint8, tf.qint16, tf.quint16, tf.qint32`. -* `mode`: An optional `string` from: `"MIN_COMBINED", "MIN_FIRST"`. Defaults to `"MIN_COMBINED"`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, output_min, output_max). - -* `output`: A `Tensor` of type `T`. The quantized data produced from the float input. -* `output_min`: A `Tensor` of type `float32`. The actual minimum scalar value used for the output. -* `output_max`: A `Tensor` of type `float32`. The actual maximum scalar value used for the output. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.reduce_sum.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.reduce_sum.md deleted file mode 100644 index 3da82a8cb7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.reduce_sum.md +++ /dev/null @@ -1,42 +0,0 @@ -### `tf.reduce_sum(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_sum} - -Computes the sum of elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -For example: - -```python -# 'x' is [[1, 1, 1] -# [1, 1, 1]] -tf.reduce_sum(x) ==> 6 -tf.reduce_sum(x, 0) ==> [2, 2, 2] -tf.reduce_sum(x, 1) ==> [3, 3] -tf.reduce_sum(x, 1, keep_dims=True) ==> [[3], [3]] -tf.reduce_sum(x, [0, 1]) ==> 6 -``` - -##### Args: - - -* `input_tensor`: The tensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - -@compatibility(numpy) -Equivalent to np.sum -@end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.reshape.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.reshape.md deleted file mode 100644 index 05de3a2779..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.reshape.md +++ /dev/null @@ -1,73 +0,0 @@ -### `tf.reshape(tensor, shape, name=None)` {#reshape} - -Reshapes a tensor. - -Given `tensor`, this operation returns a tensor that has the same values -as `tensor` with shape `shape`. - -If one component of `shape` is the special value -1, the size of that dimension -is computed so that the total size remains constant. In particular, a `shape` -of `[-1]` flattens into 1-D. At most one component of `shape` can be -1. - -If `shape` is 1-D or higher, then the operation returns a tensor with shape -`shape` filled with the values of `tensor`. In this case, the number of elements -implied by `shape` must be the same as the number of elements in `tensor`. - -For example: - -```prettyprint -# tensor 't' is [1, 2, 3, 4, 5, 6, 7, 8, 9] -# tensor 't' has shape [9] -reshape(t, [3, 3]) ==> [[1, 2, 3], - [4, 5, 6], - [7, 8, 9]] - -# tensor 't' is [[[1, 1], [2, 2]], -# [[3, 3], [4, 4]]] -# tensor 't' has shape [2, 2, 2] -reshape(t, [2, 4]) ==> [[1, 1, 2, 2], - [3, 3, 4, 4]] - -# tensor 't' is [[[1, 1, 1], -# [2, 2, 2]], -# [[3, 3, 3], -# [4, 4, 4]], -# [[5, 5, 5], -# [6, 6, 6]]] -# tensor 't' has shape [3, 2, 3] -# pass '[-1]' to flatten 't' -reshape(t, [-1]) ==> [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6] - -# -1 can also be used to infer the shape - -# -1 is inferred to be 9: -reshape(t, [2, -1]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3], - [4, 4, 4, 5, 5, 5, 6, 6, 6]] -# -1 is inferred to be 2: -reshape(t, [-1, 9]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3], - [4, 4, 4, 5, 5, 5, 6, 6, 6]] -# -1 is inferred to be 3: -reshape(t, [ 2, -1, 3]) ==> [[[1, 1, 1], - [2, 2, 2], - [3, 3, 3]], - [[4, 4, 4], - [5, 5, 5], - [6, 6, 6]]] - -# tensor 't' is [7] -# shape `[]` reshapes to a scalar -reshape(t, []) ==> 7 -``` - -##### Args: - - -* `tensor`: A `Tensor`. -* `shape`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - Defines the shape of the output tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.reverse_sequence.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.reverse_sequence.md deleted file mode 100644 index c6e8c748bf..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.reverse_sequence.md +++ /dev/null @@ -1,76 +0,0 @@ -### `tf.reverse_sequence(input, seq_lengths, seq_axis=None, batch_axis=None, name=None, seq_dim=None, batch_dim=None)` {#reverse_sequence} - -Reverses variable length slices. - -This op first slices `input` along the dimension `batch_axis`, and for each -slice `i`, reverses the first `seq_lengths[i]` elements along -the dimension `seq_axis`. - -The elements of `seq_lengths` must obey `seq_lengths[i] <= input.dims[seq_dim]`, -and `seq_lengths` must be a vector of length `input.dims[batch_dim]`. - -The output slice `i` along dimension `batch_axis` is then given by input -slice `i`, with the first `seq_lengths[i]` slices along dimension -`seq_axis` reversed. - -For example: - -```prettyprint -# Given this: -batch_dim = 0 -seq_dim = 1 -input.dims = (4, 8, ...) -seq_lengths = [7, 2, 3, 5] - -# then slices of input are reversed on seq_dim, but only up to seq_lengths: -output[0, 0:7, :, ...] = input[0, 7:0:-1, :, ...] -output[1, 0:2, :, ...] = input[1, 2:0:-1, :, ...] -output[2, 0:3, :, ...] = input[2, 3:0:-1, :, ...] -output[3, 0:5, :, ...] = input[3, 5:0:-1, :, ...] - -# while entries past seq_lens are copied through: -output[0, 7:, :, ...] = input[0, 7:, :, ...] -output[1, 2:, :, ...] = input[1, 2:, :, ...] -output[2, 3:, :, ...] = input[2, 3:, :, ...] -output[3, 2:, :, ...] = input[3, 2:, :, ...] -``` - -In contrast, if: - -```prettyprint -# Given this: -batch_dim = 2 -seq_dim = 0 -input.dims = (8, ?, 4, ...) -seq_lengths = [7, 2, 3, 5] - -# then slices of input are reversed on seq_dim, but only up to seq_lengths: -output[0:7, :, 0, :, ...] = input[7:0:-1, :, 0, :, ...] -output[0:2, :, 1, :, ...] = input[2:0:-1, :, 1, :, ...] -output[0:3, :, 2, :, ...] = input[3:0:-1, :, 2, :, ...] -output[0:5, :, 3, :, ...] = input[5:0:-1, :, 3, :, ...] - -# while entries past seq_lens are copied through: -output[7:, :, 0, :, ...] = input[7:, :, 0, :, ...] -output[2:, :, 1, :, ...] = input[2:, :, 1, :, ...] -output[3:, :, 2, :, ...] = input[3:, :, 2, :, ...] -output[2:, :, 3, :, ...] = input[2:, :, 3, :, ...] -``` - -##### Args: - - -* `input`: A `Tensor`. The input to reverse. -* `seq_lengths`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 1-D with length `input.dims(batch_dim)` and - `max(seq_lengths) <= input.dims(seq_dim)` -* `seq_axis`: An `int`. The dimension which is partially reversed. -* `batch_axis`: An optional `int`. Defaults to `0`. - The dimension along which reversal is performed. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - The partially reversed input. It has the same shape as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.segment_min.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.segment_min.md deleted file mode 100644 index 5cacf2cf72..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.segment_min.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.segment_min(data, segment_ids, name=None)` {#segment_min} - -Computes the minimum along segments of a tensor. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -Computes a tensor such that -\\(output_i = \min_j(data_j)\\) where `min` is over `j` such -that `segment_ids[j] == i`. - -
- -
- -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `segment_ids`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor whose rank is equal to the rank of `data`'s - first dimension. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.sparse_tensor_to_dense.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.sparse_tensor_to_dense.md deleted file mode 100644 index 6269665d08..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.sparse_tensor_to_dense.md +++ /dev/null @@ -1,43 +0,0 @@ -### `tf.sparse_tensor_to_dense(sp_input, default_value=0, validate_indices=True, name=None)` {#sparse_tensor_to_dense} - -Converts a `SparseTensor` into a dense tensor. - -This op is a convenience wrapper around `sparse_to_dense` for `SparseTensor`s. - -For example, if `sp_input` has shape `[3, 5]` and non-empty string values: - - [0, 1]: a - [0, 3]: b - [2, 0]: c - -and `default_value` is `x`, then the output will be a dense `[3, 5]` -string tensor with values: - - [[x a x b x] - [x x x x x] - [c x x x x]] - -Indices must be without repeats. This is only -tested if validate_indices is True. - -##### Args: - - -* `sp_input`: The input `SparseTensor`. -* `default_value`: Scalar value to set for indices not specified in - `sp_input`. Defaults to zero. -* `validate_indices`: A boolean value. If `True`, indices are checked to make - sure they are sorted in lexicographic order and that there are no repeats. -* `name`: A name prefix for the returned tensors (optional). - -##### Returns: - - A dense tensor with shape `sp_input.dense_shape` and values specified by - the non-empty values in `sp_input`. Indices not in `sp_input` are assigned - `default_value`. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.sqrt.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.sqrt.md deleted file mode 100644 index 89daef944d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.sqrt.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.sqrt(x, name=None)` {#sqrt} - -Computes square root of x element-wise. - -I.e., \(y = \sqrt{x} = x^{1/2}\). - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. Must be one of the following types: `half`, - `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor`, respectively. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.summary.FileWriterCache.clear.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.summary.FileWriterCache.clear.md deleted file mode 100644 index e3c7027813..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.summary.FileWriterCache.clear.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.summary.FileWriterCache.clear()` {#FileWriterCache.clear} - -Clear cached summary writers. Currently only used for unit tests. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.summary.TaggedRunMetadata.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.summary.TaggedRunMetadata.md deleted file mode 100644 index 8dc62c4c18..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.summary.TaggedRunMetadata.md +++ /dev/null @@ -1,252 +0,0 @@ - -- - - - -#### `tf.summary.TaggedRunMetadata.ByteSize()` {#TaggedRunMetadata.ByteSize} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.Clear()` {#TaggedRunMetadata.Clear} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.ClearExtension(extension_handle)` {#TaggedRunMetadata.ClearExtension} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.ClearField(field_name)` {#TaggedRunMetadata.ClearField} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.CopyFrom(other_msg)` {#TaggedRunMetadata.CopyFrom} - -Copies the content of the specified message into the current message. - -The method clears the current message and then merges the specified -message using MergeFrom. - -##### Args: - - -* `other_msg`: Message to copy into the current one. - - -- - - - -#### `tf.summary.TaggedRunMetadata.DiscardUnknownFields()` {#TaggedRunMetadata.DiscardUnknownFields} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.FindInitializationErrors()` {#TaggedRunMetadata.FindInitializationErrors} - -Finds required fields which are not initialized. - -##### Returns: - - A list of strings. Each string is a path to an uninitialized field from - the top-level message, e.g. "foo.bar[5].baz". - - -- - - - -#### `tf.summary.TaggedRunMetadata.FromString(s)` {#TaggedRunMetadata.FromString} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.HasExtension(extension_handle)` {#TaggedRunMetadata.HasExtension} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.HasField(field_name)` {#TaggedRunMetadata.HasField} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.IsInitialized(errors=None)` {#TaggedRunMetadata.IsInitialized} - -Checks if all required fields of a message are set. - -##### Args: - - -* `errors`: A list which, if provided, will be populated with the field - paths of all missing required fields. - -##### Returns: - - True iff the specified message has all required fields set. - - -- - - - -#### `tf.summary.TaggedRunMetadata.ListFields()` {#TaggedRunMetadata.ListFields} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.MergeFrom(msg)` {#TaggedRunMetadata.MergeFrom} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.MergeFromString(serialized)` {#TaggedRunMetadata.MergeFromString} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.ParseFromString(serialized)` {#TaggedRunMetadata.ParseFromString} - -Parse serialized protocol buffer data into this message. - -Like MergeFromString(), except we clear the object first and -do not return the value that MergeFromString returns. - - -- - - - -#### `tf.summary.TaggedRunMetadata.RegisterExtension(extension_handle)` {#TaggedRunMetadata.RegisterExtension} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.SerializePartialToString()` {#TaggedRunMetadata.SerializePartialToString} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.SerializeToString()` {#TaggedRunMetadata.SerializeToString} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.SetInParent()` {#TaggedRunMetadata.SetInParent} - -Sets the _cached_byte_size_dirty bit to true, -and propagates this to our listener iff this was a state change. - - -- - - - -#### `tf.summary.TaggedRunMetadata.WhichOneof(oneof_name)` {#TaggedRunMetadata.WhichOneof} - -Returns the name of the currently set field inside a oneof, or None. - - -- - - - -#### `tf.summary.TaggedRunMetadata.__deepcopy__(memo=None)` {#TaggedRunMetadata.__deepcopy__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.__eq__(other)` {#TaggedRunMetadata.__eq__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.__getstate__()` {#TaggedRunMetadata.__getstate__} - -Support the pickle protocol. - - -- - - - -#### `tf.summary.TaggedRunMetadata.__hash__()` {#TaggedRunMetadata.__hash__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.__init__(**kwargs)` {#TaggedRunMetadata.__init__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.__ne__(other_msg)` {#TaggedRunMetadata.__ne__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.__repr__()` {#TaggedRunMetadata.__repr__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.__setstate__(state)` {#TaggedRunMetadata.__setstate__} - -Support the pickle protocol. - - -- - - - -#### `tf.summary.TaggedRunMetadata.__str__()` {#TaggedRunMetadata.__str__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.__unicode__()` {#TaggedRunMetadata.__unicode__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.run_metadata` {#TaggedRunMetadata.run_metadata} - -Magic attribute generated for "run_metadata" proto field. - - -- - - - -#### `tf.summary.TaggedRunMetadata.tag` {#TaggedRunMetadata.tag} - -Magic attribute generated for "tag" proto field. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.summary.merge_all.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.summary.merge_all.md deleted file mode 100644 index 8f1ff2a277..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.summary.merge_all.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.summary.merge_all(key='summaries')` {#merge_all} - -Merges all summaries collected in the default graph. - -##### Args: - - -* `key`: `GraphKey` used to collect the summaries. Defaults to - `GraphKeys.SUMMARIES`. - -##### Returns: - - If no summaries were collected, returns None. Otherwise returns a scalar - `Tensor` of type `string` containing the serialized `Summary` protocol - buffer resulting from the merging. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.ExponentialMovingAverage.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.ExponentialMovingAverage.md deleted file mode 100644 index b540230fe0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.ExponentialMovingAverage.md +++ /dev/null @@ -1,232 +0,0 @@ -Maintains moving averages of variables by employing an exponential decay. - -When training a model, it is often beneficial to maintain moving averages of -the trained parameters. Evaluations that use averaged parameters sometimes -produce significantly better results than the final trained values. - -The `apply()` method adds shadow copies of trained variables and add ops that -maintain a moving average of the trained variables in their shadow copies. -It is used when building the training model. The ops that maintain moving -averages are typically run after each training step. -The `average()` and `average_name()` methods give access to the shadow -variables and their names. They are useful when building an evaluation -model, or when restoring a model from a checkpoint file. They help use the -moving averages in place of the last trained values for evaluations. - -The moving averages are computed using exponential decay. You specify the -decay value when creating the `ExponentialMovingAverage` object. The shadow -variables are initialized with the same initial values as the trained -variables. When you run the ops to maintain the moving averages, each -shadow variable is updated with the formula: - - `shadow_variable -= (1 - decay) * (shadow_variable - variable)` - -This is mathematically equivalent to the classic formula below, but the use -of an `assign_sub` op (the `"-="` in the formula) allows concurrent lockless -updates to the variables: - - `shadow_variable = decay * shadow_variable + (1 - decay) * variable` - -Reasonable values for `decay` are close to 1.0, typically in the -multiple-nines range: 0.999, 0.9999, etc. - -Example usage when creating a training model: - -```python -# Create variables. -var0 = tf.Variable(...) -var1 = tf.Variable(...) -# ... use the variables to build a training model... -... -# Create an op that applies the optimizer. This is what we usually -# would use as a training op. -opt_op = opt.minimize(my_loss, [var0, var1]) - -# Create an ExponentialMovingAverage object -ema = tf.train.ExponentialMovingAverage(decay=0.9999) - -# Create the shadow variables, and add ops to maintain moving averages -# of var0 and var1. -maintain_averages_op = ema.apply([var0, var1]) - -# Create an op that will update the moving averages after each training -# step. This is what we will use in place of the usual training op. -with tf.control_dependencies([opt_op]): - training_op = tf.group(maintain_averages_op) - -...train the model by running training_op... -``` - -There are two ways to use the moving averages for evaluations: - -* Build a model that uses the shadow variables instead of the variables. - For this, use the `average()` method which returns the shadow variable - for a given variable. -* Build a model normally but load the checkpoint files to evaluate by using - the shadow variable names. For this use the `average_name()` method. See - the [Saver class](../../api_docs/python/train.md#Saver) for more - information on restoring saved variables. - -Example of restoring the shadow variable values: - -```python -# Create a Saver that loads variables from their saved shadow values. -shadow_var0_name = ema.average_name(var0) -shadow_var1_name = ema.average_name(var1) -saver = tf.train.Saver({shadow_var0_name: var0, shadow_var1_name: var1}) -saver.restore(...checkpoint filename...) -# var0 and var1 now hold the moving average values -``` - -- - - - -#### `tf.train.ExponentialMovingAverage.__init__(decay, num_updates=None, zero_debias=False, name='ExponentialMovingAverage')` {#ExponentialMovingAverage.__init__} - -Creates a new ExponentialMovingAverage object. - -The `apply()` method has to be called to create shadow variables and add -ops to maintain moving averages. - -The optional `num_updates` parameter allows one to tweak the decay rate -dynamically. It is typical to pass the count of training steps, usually -kept in a variable that is incremented at each step, in which case the -decay rate is lower at the start of training. This makes moving averages -move faster. If passed, the actual decay rate used is: - - `min(decay, (1 + num_updates) / (10 + num_updates))` - -##### Args: - - -* `decay`: Float. The decay to use. -* `num_updates`: Optional count of number of updates applied to variables. -* `zero_debias`: If `True`, zero debias moving-averages that are initialized - with tensors. -* `name`: String. Optional prefix name to use for the name of ops added in - `apply()`. - - -- - - - -#### `tf.train.ExponentialMovingAverage.apply(var_list=None)` {#ExponentialMovingAverage.apply} - -Maintains moving averages of variables. - -`var_list` must be a list of `Variable` or `Tensor` objects. This method -creates shadow variables for all elements of `var_list`. Shadow variables -for `Variable` objects are initialized to the variable's initial value. -They will be added to the `GraphKeys.MOVING_AVERAGE_VARIABLES` collection. -For `Tensor` objects, the shadow variables are initialized to 0 and zero -debiased (see docstring in `assign_moving_average` for more details). - -shadow variables are created with `trainable=False` and added to the -`GraphKeys.ALL_VARIABLES` collection. They will be returned by calls to -`tf.global_variables()`. - -Returns an op that updates all shadow variables as described above. - -Note that `apply()` can be called multiple times with different lists of -variables. - -##### Args: - - -* `var_list`: A list of Variable or Tensor objects. The variables - and Tensors must be of types float16, float32, or float64. - -##### Returns: - - An Operation that updates the moving averages. - -##### Raises: - - -* `TypeError`: If the arguments are not all float16, float32, or float64. -* `ValueError`: If the moving average of one of the variables is already - being computed. - - -- - - - -#### `tf.train.ExponentialMovingAverage.average_name(var)` {#ExponentialMovingAverage.average_name} - -Returns the name of the `Variable` holding the average for `var`. - -The typical scenario for `ExponentialMovingAverage` is to compute moving -averages of variables during training, and restore the variables from the -computed moving averages during evaluations. - -To restore variables, you have to know the name of the shadow variables. -That name and the original variable can then be passed to a `Saver()` object -to restore the variable from the moving average value with: - `saver = tf.train.Saver({ema.average_name(var): var})` - -`average_name()` can be called whether or not `apply()` has been called. - -##### Args: - - -* `var`: A `Variable` object. - -##### Returns: - - A string: The name of the variable that will be used or was used - by the `ExponentialMovingAverage class` to hold the moving average of - `var`. - - -- - - - -#### `tf.train.ExponentialMovingAverage.average(var)` {#ExponentialMovingAverage.average} - -Returns the `Variable` holding the average of `var`. - -##### Args: - - -* `var`: A `Variable` object. - -##### Returns: - - A `Variable` object or `None` if the moving average of `var` - is not maintained. - - -- - - - -#### `tf.train.ExponentialMovingAverage.variables_to_restore(moving_avg_variables=None)` {#ExponentialMovingAverage.variables_to_restore} - -Returns a map of names to `Variables` to restore. - -If a variable has a moving average, use the moving average variable name as -the restore name; otherwise, use the variable name. - -For example, - -```python - variables_to_restore = ema.variables_to_restore() - saver = tf.train.Saver(variables_to_restore) -``` - -Below is an example of such mapping: - -``` - conv/batchnorm/gamma/ExponentialMovingAverage: conv/batchnorm/gamma, - conv_4/conv2d_params/ExponentialMovingAverage: conv_4/conv2d_params, - global_step: global_step -``` - -##### Args: - - -* `moving_avg_variables`: a list of variables that require to use of the - moving variable name to be restored. If None, it will default to - variables.moving_average_variables() + variables.trainable_variables() - -##### Returns: - - A map from restore_names to variables. The restore_name can be the - moving_average version of the variable name if it exist, or the original - variable name. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.GlobalStepWaiterHook.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.GlobalStepWaiterHook.md deleted file mode 100644 index 4710e841d1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.GlobalStepWaiterHook.md +++ /dev/null @@ -1,87 +0,0 @@ -Delay execution until global step reaches to wait_until_step. - -This hook delays execution until global step reaches to `wait_until_step`. It -is used to gradually start workers in distributed settings. One example usage -would be setting `wait_until_step=int(K*log(task_id+1))` assuming that -task_id=0 is the chief. -- - - - -#### `tf.train.GlobalStepWaiterHook.__init__(wait_until_step)` {#GlobalStepWaiterHook.__init__} - -Create a _GlobalStepWaiterHook. - -##### Args: - - -* `wait_until_step`: an `int` shows until which global step should we wait. - - -- - - - -#### `tf.train.GlobalStepWaiterHook.after_create_session(session, coord)` {#GlobalStepWaiterHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.GlobalStepWaiterHook.after_run(run_context, run_values)` {#GlobalStepWaiterHook.after_run} - -Called after each call to run(). - -The `run_values` argument contains results of requested ops/tensors by -`before_run()`. - -The `run_context` argument is the same one send to `before_run` call. -`run_context.request_stop()` can be called to stop the iteration. - -##### Args: - - -* `run_context`: A `SessionRunContext` object. -* `run_values`: A SessionRunValues object. - - -- - - - -#### `tf.train.GlobalStepWaiterHook.before_run(run_context)` {#GlobalStepWaiterHook.before_run} - - - - -- - - - -#### `tf.train.GlobalStepWaiterHook.begin()` {#GlobalStepWaiterHook.begin} - - - - -- - - - -#### `tf.train.GlobalStepWaiterHook.end(session)` {#GlobalStepWaiterHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.SessionRunArgs.__new__.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.SessionRunArgs.__new__.md deleted file mode 100644 index 2dd4d8c8b3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.SessionRunArgs.__new__.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.train.SessionRunArgs.__new__(cls, fetches, feed_dict=None, options=None)` {#SessionRunArgs.__new__} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.SessionRunHook.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.SessionRunHook.md deleted file mode 100644 index 00bd190dbf..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.SessionRunHook.md +++ /dev/null @@ -1,97 +0,0 @@ -Hook to extend calls to MonitoredSession.run(). -- - - - -#### `tf.train.SessionRunHook.after_create_session(session, coord)` {#SessionRunHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.SessionRunHook.after_run(run_context, run_values)` {#SessionRunHook.after_run} - -Called after each call to run(). - -The `run_values` argument contains results of requested ops/tensors by -`before_run()`. - -The `run_context` argument is the same one send to `before_run` call. -`run_context.request_stop()` can be called to stop the iteration. - -##### Args: - - -* `run_context`: A `SessionRunContext` object. -* `run_values`: A SessionRunValues object. - - -- - - - -#### `tf.train.SessionRunHook.before_run(run_context)` {#SessionRunHook.before_run} - -Called before each call to run(). - -You can return from this call a `SessionRunArgs` object indicating ops or -tensors to add to the upcoming `run()` call. These ops/tensors will be run -together with the ops/tensors originally passed to the original run() call. -The run args you return can also contain feeds to be added to the run() -call. - -The `run_context` argument is a `SessionRunContext` that provides -information about the upcoming `run()` call: the originally requested -op/tensors, the TensorFlow Session. - -At this point graph is finalized and you can not add ops. - -##### Args: - - -* `run_context`: A `SessionRunContext` object. - -##### Returns: - - None or a `SessionRunArgs` object. - - -- - - - -#### `tf.train.SessionRunHook.begin()` {#SessionRunHook.begin} - -Called once before using the session. - -When called, the default graph is the one that will be launched in the -session. The hook can modify the graph by adding new operations to it. -After the `begin()` call the graph will be finalized and the other callbacks -can not modify the graph anymore. Second call of `begin()` on the same -graph, should not change the graph. - - -- - - - -#### `tf.train.SessionRunHook.end(session)` {#SessionRunHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.add_queue_runner.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.add_queue_runner.md deleted file mode 100644 index f5b9549ad8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.add_queue_runner.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.train.add_queue_runner(qr, collection='queue_runners')` {#add_queue_runner} - -Adds a `QueueRunner` to a collection in the graph. - -When building a complex model that uses many queues it is often difficult to -gather all the queue runners that need to be run. This convenience function -allows you to add a queue runner to a well known collection in the graph. - -The companion method `start_queue_runners()` can be used to start threads for -all the collected queue runners. - -##### Args: - - -* `qr`: A `QueueRunner`. -* `collection`: A `GraphKey` specifying the graph collection to add - the queue runner to. Defaults to `GraphKeys.QUEUE_RUNNERS`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.limit_epochs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.limit_epochs.md deleted file mode 100644 index bcd9d32c30..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.train.limit_epochs.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.train.limit_epochs(tensor, num_epochs=None, name=None)` {#limit_epochs} - -Returns tensor `num_epochs` times and then raises an `OutOfRange` error. - -Note: creates local counter `epochs`. Use `local_variables_initializer()` to -initialize local variables. - -##### Args: - - -* `tensor`: Any `Tensor`. -* `num_epochs`: A positive integer (optional). If specified, limits the number - of steps the output tensor may be evaluated. -* `name`: A name for the operations (optional). - -##### Returns: - - tensor or `OutOfRange`. - -##### Raises: - - -* `ValueError`: if `num_epochs` is invalid. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.tuple.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.tuple.md deleted file mode 100644 index 503a98d625..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.tuple.md +++ /dev/null @@ -1,36 +0,0 @@ -### `tf.tuple(tensors, name=None, control_inputs=None)` {#tuple} - -Group tensors together. - -This creates a tuple of tensors with the same values as the `tensors` -argument, except that the value of each tensor is only returned after the -values of all tensors have been computed. - -`control_inputs` contains additional ops that have to finish before this op -finishes, but whose outputs are not returned. - -This can be used as a "join" mechanism for parallel computations: all the -argument tensors can be computed in parallel, but the values of any tensor -returned by `tuple` are only available after all the parallel computations -are done. - -See also `group` and `with_dependencies`. - -##### Args: - - -* `tensors`: A list of `Tensor`s or `IndexedSlices`, some entries can be `None`. -* `name`: (optional) A name to use as a `name_scope` for the operation. -* `control_inputs`: List of additional ops to finish before returning. - -##### Returns: - - Same as `tensors`. - -##### Raises: - - -* `ValueError`: If `tensors` does not contain any `Tensor` or `IndexedSlices`. -* `TypeError`: If `control_inputs` is not a list of `Operation` or `Tensor` - objects. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.zeros_initializer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.zeros_initializer.md deleted file mode 100644 index 0bfa37f6cf..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf.zeros_initializer.md +++ /dev/null @@ -1,15 +0,0 @@ -Initializer that generates tensors initialized to 0. -- - - - -#### `tf.zeros_initializer.__call__(shape, dtype=None, partition_info=None)` {#zeros_initializer.__call__} - - - - -- - - - -#### `tf.zeros_initializer.__init__(dtype=tf.float32)` {#zeros_initializer.__init__} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf_debug.DumpingDebugWrapperSession.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf_debug.DumpingDebugWrapperSession.md deleted file mode 100644 index f86f63d7d9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf_debug.DumpingDebugWrapperSession.md +++ /dev/null @@ -1,140 +0,0 @@ -Debug Session wrapper that dumps debug data to filesystem. -- - - - -#### `tf_debug.DumpingDebugWrapperSession.__enter__()` {#DumpingDebugWrapperSession.__enter__} - - - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.__exit__(exec_type, exec_value, exec_tb)` {#DumpingDebugWrapperSession.__exit__} - - - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.__init__(sess, session_root, watch_fn=None, log_usage=True)` {#DumpingDebugWrapperSession.__init__} - -Constructor of DumpingDebugWrapperSession. - -##### Args: - - -* `sess`: The TensorFlow `Session` object being wrapped. -* `session_root`: (`str`) Path to the session root directory. Must be a - directory that does not exist or an empty directory. If the directory - does not exist, it will be created by the debugger core during debug - [`Session.run()`](../../../g3doc/api_docs/python/client.md#session.run) - calls. - As the `run()` calls occur, subdirectories will be added to - `session_root`. The subdirectories' names has the following pattern: - run__ - E.g., run_1480734393835964_ad4c953a85444900ae79fc1b652fb324 -* `watch_fn`: (`Callable`) A Callable that can be used to define per-run - debug ops and watched tensors. See the doc of - `NonInteractiveDebugWrapperSession.__init__()` for details. -* `log_usage`: (`bool`) whether the usage of this class is to be logged. - -##### Raises: - - -* `ValueError`: If `session_root` is an existing and non-empty directory or - if `session_root` is a file. - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.close()` {#DumpingDebugWrapperSession.close} - - - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.graph` {#DumpingDebugWrapperSession.graph} - - - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.invoke_node_stepper(node_stepper, restore_variable_values_on_exit=True)` {#DumpingDebugWrapperSession.invoke_node_stepper} - -See doc of BaseDebugWrapperSession.invoke_node_stepper. - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.on_run_end(request)` {#DumpingDebugWrapperSession.on_run_end} - -See doc of BaseDebugWrapperSession.on_run_end. - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.on_run_start(request)` {#DumpingDebugWrapperSession.on_run_start} - -See doc of BaseDebugWrapperSession.on_run_start. - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.on_session_init(request)` {#DumpingDebugWrapperSession.on_session_init} - -See doc of BaseDebugWrapperSession.on_run_start. - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.partial_run(handle, fetches, feed_dict=None)` {#DumpingDebugWrapperSession.partial_run} - - - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.partial_run_setup(fetches, feeds=None)` {#DumpingDebugWrapperSession.partial_run_setup} - -Sets up the feeds and fetches for partial runs in the session. - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#DumpingDebugWrapperSession.run} - -Wrapper around Session.run() that inserts tensor watch options. - -##### Args: - - -* `fetches`: Same as the `fetches` arg to regular `Session.run()`. -* `feed_dict`: Same as the `feed_dict` arg to regular `Session.run()`. -* `options`: Same as the `options` arg to regular `Session.run()`. -* `run_metadata`: Same as the `run_metadata` arg to regular `Session.run()`. - -##### Returns: - - Simply forwards the output of the wrapped `Session.run()` call. - -##### Raises: - - -* `ValueError`: On invalid `OnRunStartAction` value. - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.sess_str` {#DumpingDebugWrapperSession.sess_str} - - - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.session` {#DumpingDebugWrapperSession.session} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf_debug.watch_graph_with_blacklists.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf_debug.watch_graph_with_blacklists.md deleted file mode 100644 index 72af627344..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard0/tf_debug.watch_graph_with_blacklists.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf_debug.watch_graph_with_blacklists(run_options, graph, debug_ops='DebugIdentity', debug_urls=None, node_name_regex_blacklist=None, op_type_regex_blacklist=None, global_step=-1)` {#watch_graph_with_blacklists} - -Add debug tensor watches, blacklisting nodes and op types. - -This is similar to `watch_graph()`, but the node names and op types are -blacklisted, instead of whitelisted. - -N.B.: Under certain circumstances, not all specified `Tensor`s will be - actually watched (e.g., nodes that are constant-folded during runtime will - not be watched). - -##### Args: - - -* `run_options`: An instance of `config_pb2.RunOptions` to be modified. -* `graph`: An instance of `ops.Graph`. -* `debug_ops`: (`str` or `list` of `str`) name(s) of the debug op(s) to use. -* `debug_urls`: URL(s) to send ebug values to, e.g., - `file:///tmp/tfdbg_dump_1`, `grpc://localhost:12345`. -* `node_name_regex_blacklist`: Regular-expression blacklist for node_name. - This should be a string, e.g., `"(weight_[0-9]+|bias_.*)"`. -* `op_type_regex_blacklist`: Regular-expression blacklist for the op type of - nodes, e.g., `"(Variable|Add)"`. - If both node_name_regex_blacklist and op_type_regex_blacklist - are set, the two filtering operations will occur in a logical `OR` - relation. In other words, a node will be excluded if it hits either of - the two blacklists; a node will be included if and only if it hits - neither of the blacklists. -* `global_step`: (`int`) Optional global_step count for this debug tensor - watch. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.AggregationMethod.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.AggregationMethod.md deleted file mode 100644 index ee655fbd25..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.AggregationMethod.md +++ /dev/null @@ -1,10 +0,0 @@ -A class listing aggregation methods used to combine gradients. - -Computing partial derivatives can require aggregating gradient -contributions. This class lists the various methods that can -be used to combine gradients in the graph: - -* `ADD_N`: All of the gradient terms are summed as part of one - operation using the "AddN" op. It has the property that all - gradients must be ready before any aggregation is performed. -* `DEFAULT`: The system-chosen default aggregation method. diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.ConditionalAccumulatorBase.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.ConditionalAccumulatorBase.md deleted file mode 100644 index f41d77e7db..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.ConditionalAccumulatorBase.md +++ /dev/null @@ -1,79 +0,0 @@ -A conditional accumulator for aggregating gradients. - -Up-to-date gradients (i.e., time step at which gradient was computed is -equal to the accumulator's time step) are added to the accumulator. - -Extraction of the average gradient is blocked until the required number of -gradients has been accumulated. -- - - - -#### `tf.ConditionalAccumulatorBase.__init__(dtype, shape, accumulator_ref)` {#ConditionalAccumulatorBase.__init__} - -Creates a new ConditionalAccumulator. - -##### Args: - - -* `dtype`: Datatype of the accumulated gradients. -* `shape`: Shape of the accumulated gradients. -* `accumulator_ref`: A handle to the conditional accumulator, created by sub- - classes - - -- - - - -#### `tf.ConditionalAccumulatorBase.accumulator_ref` {#ConditionalAccumulatorBase.accumulator_ref} - -The underlying accumulator reference. - - -- - - - -#### `tf.ConditionalAccumulatorBase.dtype` {#ConditionalAccumulatorBase.dtype} - -The datatype of the gradients accumulated by this accumulator. - - -- - - - -#### `tf.ConditionalAccumulatorBase.name` {#ConditionalAccumulatorBase.name} - -The name of the underlying accumulator. - - -- - - - -#### `tf.ConditionalAccumulatorBase.num_accumulated(name=None)` {#ConditionalAccumulatorBase.num_accumulated} - -Number of gradients that have currently been aggregated in accumulator. - -##### Args: - - -* `name`: Optional name for the operation. - -##### Returns: - - Number of accumulated gradients currently in accumulator. - - -- - - - -#### `tf.ConditionalAccumulatorBase.set_global_step(new_global_step, name=None)` {#ConditionalAccumulatorBase.set_global_step} - -Sets the global time step of the accumulator. - -The operation logs a warning if we attempt to set to a time step that is -lower than the accumulator's own time step. - -##### Args: - - -* `new_global_step`: Value of new time step. Can be a variable or a constant -* `name`: Optional name for the operation. - -##### Returns: - - Operation that sets the accumulator's time step. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.FIFOQueue.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.FIFOQueue.md deleted file mode 100644 index 1d271e6eab..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.FIFOQueue.md +++ /dev/null @@ -1,299 +0,0 @@ -A queue implementation that dequeues elements in first-in first-out order. - -See [`tf.QueueBase`](#QueueBase) for a description of the methods on -this class. -- - - - -#### `tf.FIFOQueue.__init__(capacity, dtypes, shapes=None, names=None, shared_name=None, name='fifo_queue')` {#FIFOQueue.__init__} - -Creates a queue that dequeues elements in a first-in first-out order. - -A `FIFOQueue` has bounded capacity; supports multiple concurrent -producers and consumers; and provides exactly-once delivery. - -A `FIFOQueue` holds a list of up to `capacity` elements. Each -element is a fixed-length tuple of tensors whose dtypes are -described by `dtypes`, and whose shapes are optionally described -by the `shapes` argument. - -If the `shapes` argument is specified, each component of a queue -element must have the respective fixed shape. If it is -unspecified, different queue elements may have different shapes, -but the use of `dequeue_many` is disallowed. - -##### Args: - - -* `capacity`: An integer. The upper bound on the number of elements - that may be stored in this queue. -* `dtypes`: A list of `DType` objects. The length of `dtypes` must equal - the number of tensors in each queue element. -* `shapes`: (Optional.) A list of fully-defined `TensorShape` objects - with the same length as `dtypes`, or `None`. -* `names`: (Optional.) A list of string naming the components in the queue - with the same length as `dtypes`, or `None`. If specified the dequeue - methods return a dictionary with the names as keys. -* `shared_name`: (Optional.) If non-empty, this queue will be shared under - the given name across multiple sessions. -* `name`: Optional name for the queue operation. - - -- - - - -#### `tf.FIFOQueue.close(cancel_pending_enqueues=False, name=None)` {#FIFOQueue.close} - -Closes this queue. - -This operation signals that no more elements will be enqueued in -the given queue. Subsequent `enqueue` and `enqueue_many` -operations will fail. Subsequent `dequeue` and `dequeue_many` -operations will continue to succeed if sufficient elements remain -in the queue. Subsequent `dequeue` and `dequeue_many` operations -that would block will fail immediately. - -If `cancel_pending_enqueues` is `True`, all pending requests will also -be cancelled. - -##### Args: - - -* `cancel_pending_enqueues`: (Optional.) A boolean, defaulting to - `False` (described above). -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that closes the queue. - - -- - - - -#### `tf.FIFOQueue.dequeue(name=None)` {#FIFOQueue.dequeue} - -Dequeues one element from this queue. - -If the queue is empty when this operation executes, it will block -until there is an element to dequeue. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue is empty, and there are no pending -enqueue operations that can fulfill this request, -`tf.errors.OutOfRangeError` will be raised. If the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of tensors that was dequeued. - - -- - - - -#### `tf.FIFOQueue.dequeue_many(n, name=None)` {#FIFOQueue.dequeue_many} - -Dequeues and concatenates `n` elements from this queue. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. All of the -components in the dequeued tuple will have size `n` in the 0th dimension. - -If the queue is closed and there are less than `n` elements left, then an -`OutOfRange` exception is raised. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue contains fewer than `n` elements, and -there are no pending enqueue operations that can fulfill this -request, `tf.errors.OutOfRangeError` will be raised. If the -session is [closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.FIFOQueue.dequeue_up_to(n, name=None)` {#FIFOQueue.dequeue_up_to} - -Dequeues and concatenates `n` elements from this queue. - -**Note** This operation is not supported by all queues. If a queue does not -support DequeueUpTo, then a `tf.errors.UnimplementedError` is raised. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. If the queue -has not been closed, all of the components in the dequeued tuple -will have size `n` in the 0th dimension. - -If the queue is closed and there are more than `0` but fewer than -`n` elements remaining, then instead of raising a -`tf.errors.OutOfRangeError` like [`dequeue_many`](#QueueBase.dequeue_many), -less than `n` elements are returned immediately. If the queue is -closed and there are `0` elements left in the queue, then a -`tf.errors.OutOfRangeError` is raised just like in `dequeue_many`. -Otherwise the behavior is identical to `dequeue_many`. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.FIFOQueue.dtypes` {#FIFOQueue.dtypes} - -The list of dtypes for each component of a queue element. - - -- - - - -#### `tf.FIFOQueue.enqueue(vals, name=None)` {#FIFOQueue.enqueue} - -Enqueues one element to this queue. - -If the queue is full when this operation executes, it will block -until the element has been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary containing - the values to enqueue. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a new tuple of tensors to the queue. - - -- - - - -#### `tf.FIFOQueue.enqueue_many(vals, name=None)` {#FIFOQueue.enqueue_many} - -Enqueues zero or more elements to this queue. - -This operation slices each component tensor along the 0th dimension to -make multiple queue elements. All of the tensors in `vals` must have the -same size in the 0th dimension. - -If the queue is full when this operation executes, it will block -until all of the elements have been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary - from which the queue elements are taken. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a batch of tuples of tensors to the queue. - - -- - - - -#### `tf.FIFOQueue.from_list(index, queues)` {#FIFOQueue.from_list} - -Create a queue using the queue reference from `queues[index]`. - -##### Args: - - -* `index`: An integer scalar tensor that determines the input that gets - selected. -* `queues`: A list of `QueueBase` objects. - -##### Returns: - - A `QueueBase` object. - -##### Raises: - - -* `TypeError`: When `queues` is not a list of `QueueBase` objects, - or when the data types of `queues` are not all the same. - - -- - - - -#### `tf.FIFOQueue.name` {#FIFOQueue.name} - -The name of the underlying queue. - - -- - - - -#### `tf.FIFOQueue.names` {#FIFOQueue.names} - -The list of names for each component of a queue element. - - -- - - - -#### `tf.FIFOQueue.queue_ref` {#FIFOQueue.queue_ref} - -The underlying queue reference. - - -- - - - -#### `tf.FIFOQueue.shapes` {#FIFOQueue.shapes} - -The list of shapes for each component of a queue element. - - -- - - - -#### `tf.FIFOQueue.size(name=None)` {#FIFOQueue.size} - -Compute the number of elements in this queue. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A scalar tensor containing the number of elements in this queue. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.IdentityReader.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.IdentityReader.md deleted file mode 100644 index 03f6211303..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.IdentityReader.md +++ /dev/null @@ -1,175 +0,0 @@ -A Reader that outputs the queued work as both the key and value. - -To use, enqueue strings in a Queue. Read will take the front -work string and output (work, work). - -See ReaderBase for supported methods. -- - - - -#### `tf.IdentityReader.__init__(name=None)` {#IdentityReader.__init__} - -Create a IdentityReader. - -##### Args: - - -* `name`: A name for the operation (optional). - - -- - - - -#### `tf.IdentityReader.num_records_produced(name=None)` {#IdentityReader.num_records_produced} - -Returns the number of records this reader has produced. - -This is the same as the number of Read executions that have -succeeded. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.IdentityReader.num_work_units_completed(name=None)` {#IdentityReader.num_work_units_completed} - -Returns the number of work units this reader has finished processing. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.IdentityReader.read(queue, name=None)` {#IdentityReader.read} - -Returns the next record (key, value pair) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g. when the -Reader needs to start reading from a new file since it has -finished with the previous file). - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (key, value). - -* `key`: A string scalar Tensor. -* `value`: A string scalar Tensor. - - -- - - - -#### `tf.IdentityReader.read_up_to(queue, num_records, name=None)` {#IdentityReader.read_up_to} - -Returns up to num_records (key, value pairs) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g., when the -Reader needs to start reading from a new file since it has -finished with the previous file). -It may return less than num_records even before the last batch. - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `num_records`: Number of records to read. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (keys, values). - -* `keys`: A 1-D string Tensor. -* `values`: A 1-D string Tensor. - - -- - - - -#### `tf.IdentityReader.reader_ref` {#IdentityReader.reader_ref} - -Op that implements the reader. - - -- - - - -#### `tf.IdentityReader.reset(name=None)` {#IdentityReader.reset} - -Restore a reader to its initial clean state. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.IdentityReader.restore_state(state, name=None)` {#IdentityReader.restore_state} - -Restore a reader to a previously saved state. - -Not all Readers support being restored, so this can produce an -Unimplemented error. - -##### Args: - - -* `state`: A string Tensor. - Result of a SerializeState of a Reader with matching type. -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.IdentityReader.serialize_state(name=None)` {#IdentityReader.serialize_state} - -Produce a string tensor that encodes the state of a reader. - -Not all Readers support being serialized, so this can produce an -Unimplemented error. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A string Tensor. - - -- - - - -#### `tf.IdentityReader.supports_serialize` {#IdentityReader.supports_serialize} - -Whether the Reader implementation can serialize its state. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.NoGradient.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.NoGradient.md deleted file mode 100644 index 7181713d26..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.NoGradient.md +++ /dev/null @@ -1,32 +0,0 @@ -### `tf.NoGradient(op_type)` {#NoGradient} - -Specifies that ops of type `op_type` is not differentiable. - -This function should *not* be used for operations that have a -well-defined gradient that is not yet implemented. - -This function is only used when defining a new op type. It may be -used for ops such as `tf.size()` that are not differentiable. For -example: - -```python -tf.NotDifferentiable("Size") -``` - -The gradient computed for 'op_type' will then propagate zeros. - -For ops that have a well-defined gradient but are not yet implemented, -no declaration should be made, and an error *must* be thrown if -an attempt to request its gradient is made. - -##### Args: - - -* `op_type`: The string type of an operation. This corresponds to the - `OpDef.name` field for the proto that defines the operation. - -##### Raises: - - -* `TypeError`: If `op_type` is not a string. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.Print.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.Print.md deleted file mode 100644 index b1ec7c1af0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.Print.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.Print(input_, data, message=None, first_n=None, summarize=None, name=None)` {#Print} - -Prints a list of tensors. - -This is an identity op with the side effect of printing `data` when -evaluating. - -##### Args: - - -* `input_`: A tensor passed through this op. -* `data`: A list of tensors to print out when op is evaluated. -* `message`: A string, prefix of the error message. -* `first_n`: Only log `first_n` number of times. Negative numbers log always; - this is the default. -* `summarize`: Only print this many entries of each tensor. If None, then a - maximum of 3 elements are printed per input tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - Same tensor as `input_`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.Tensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.Tensor.md deleted file mode 100644 index abab577434..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.Tensor.md +++ /dev/null @@ -1,940 +0,0 @@ -Represents one of the outputs of an `Operation`. - -A `Tensor` is a symbolic handle to one of the outputs of an -`Operation`. It does not hold the values of that operation's output, -but instead provides a means of computing those values in a -TensorFlow [`Session`](../../api_docs/python/client.md#Session). - -This class has two primary purposes: - -1. A `Tensor` can be passed as an input to another `Operation`. - This builds a dataflow connection between operations, which - enables TensorFlow to execute an entire `Graph` that represents a - large, multi-step computation. - -2. After the graph has been launched in a session, the value of the - `Tensor` can be computed by passing it to - [`Session.run()`](../../api_docs/python/client.md#Session.run). - `t.eval()` is a shortcut for calling - `tf.get_default_session().run(t)`. - -In the following example, `c`, `d`, and `e` are symbolic `Tensor` -objects, whereas `result` is a numpy array that stores a concrete -value: - -```python -# Build a dataflow graph. -c = tf.constant([[1.0, 2.0], [3.0, 4.0]]) -d = tf.constant([[1.0, 1.0], [0.0, 1.0]]) -e = tf.matmul(c, d) - -# Construct a `Session` to execute the graph. -sess = tf.Session() - -# Execute the graph and store the value that `e` represents in `result`. -result = sess.run(e) -``` -- - - - -#### `tf.Tensor.__abs__(x, name=None)` {#Tensor.__abs__} - -Computes the absolute value of a tensor. - -Given a tensor of real numbers `x`, this operation returns a tensor -containing the absolute value of each element in `x`. For example, if x is -an input element and y is an output element, this operation computes -\\(y = |x|\\). - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor` of type `float32`, `float64`, `int32`, or - `int64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` the same size and type as `x` with absolute - values. - - -- - - - -#### `tf.Tensor.__add__(x, y)` {#Tensor.__add__} - -Returns x + y element-wise. - -*NOTE*: `Add` supports broadcasting. `AddN` does not. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`, `complex64`, `complex128`, `string`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Tensor.__and__(x, y)` {#Tensor.__and__} - -Returns the truth value of x AND y element-wise. - -*NOTE*: `LogicalAnd` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__bool__()` {#Tensor.__bool__} - -Dummy method to prevent a tensor from being used as a Python `bool`. - -This overload raises a `TypeError` when the user inadvertently -treats a `Tensor` as a boolean (e.g. in an `if` statement). For -example: - -```python -if tf.constant(True): # Will raise. - # ... - -if tf.constant(5) < tf.constant(7): # Will raise. - # ... -``` - -This disallows ambiguities between testing the Python value vs testing the -dynamic condition of the `Tensor`. - -##### Raises: - - `TypeError`. - - -- - - - -#### `tf.Tensor.__div__(x, y)` {#Tensor.__div__} - -Divide two values using Python 2 semantics. Used for Tensor.__div__. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` returns the quotient of x and y. - - -- - - - -#### `tf.Tensor.__eq__(other)` {#Tensor.__eq__} - - - - -- - - - -#### `tf.Tensor.__floordiv__(x, y)` {#Tensor.__floordiv__} - -Divides `x / y` elementwise, rounding toward the most negative integer. - -The same as `tf.div(x,y)` for integers, but uses `tf.floor(tf.div(x,y))` for -floating point arguments so that the result is always an integer (though -possibly an integer represented as floating point). This op is generated by -`x // y` floor division in Python 3 and in Python 2.7 with -`from __future__ import division`. - -Note that for efficiency, `floordiv` uses C semantics for negative numbers -(unlike Python and Numpy). - -`x` and `y` must have the same type, and the result will have the same type -as well. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` rounded down (except possibly towards zero for negative integers). - -##### Raises: - - -* `TypeError`: If the inputs are complex. - - -- - - - -#### `tf.Tensor.__ge__(x, y, name=None)` {#Tensor.__ge__} - -Returns the truth value of (x >= y) element-wise. - -*NOTE*: `GreaterEqual` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__getitem__(tensor, slice_spec, var=None)` {#Tensor.__getitem__} - -Overload for Tensor.__getitem__. - -This operation extracts the specified region from the tensor. -The notation is similar to NumPy with the restriction that -currently only support basic indexing. That means that -using a tensor as input is not currently allowed - -Some useful examples: - -```python -# strip leading and trailing 2 elements -foo = tf.constant([1,2,3,4,5,6]) -print(foo[2:-2].eval()) # => [3,4] - -# skip every row and reverse every column -foo = tf.constant([[1,2,3], [4,5,6], [7,8,9]]) -print(foo[::2,::-1].eval()) # => [[3,2,1], [9,8,7]] - -# Insert another dimension -foo = tf.constant([[1,2,3], [4,5,6], [7,8,9]]) -print(foo[tf.newaxis, :, :].eval()) # => [[[3,2,1], [9,8,7]]] -print(foo[:, tf.newaxis, :].eval()) # => [[[3,2,1]], [[9,8,7]]] -print(foo[:, :, tf.newaxis].eval()) # => [[[3],[2],[1]], [[9],[8],[7]]] - -# Ellipses (3 equivalent operations) -print(foo[tf.newaxis, :, :].eval()) # => [[[3,2,1], [9,8,7]]] -print(foo[tf.newaxis, ...].eval()) # => [[[3,2,1], [9,8,7]]] -print(foo[tf.newaxis].eval()) # => [[[3,2,1], [9,8,7]]] -``` - -##### Notes: - - - `tf.newaxis` is `None` as in NumPy. - - An implicit ellipsis is placed at the end of the `slice_spec` - - NumPy advanced indexing is currently not supported. - -##### Args: - - -* `tensor`: An ops.Tensor object. -* `slice_spec`: The arguments to Tensor.__getitem__. -* `var`: In the case of variable slice assignment, the Variable - object to slice (i.e. tensor is the read-only view of this - variable). - -##### Returns: - - The appropriate slice of "tensor", based on "slice_spec". - -##### Raises: - - -* `ValueError`: If a slice range is negative size. -* `TypeError`: If the slice indices aren't int, slice, or Ellipsis. - - -- - - - -#### `tf.Tensor.__gt__(x, y, name=None)` {#Tensor.__gt__} - -Returns the truth value of (x > y) element-wise. - -*NOTE*: `Greater` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__hash__()` {#Tensor.__hash__} - - - - -- - - - -#### `tf.Tensor.__init__(op, value_index, dtype)` {#Tensor.__init__} - -Creates a new `Tensor`. - -##### Args: - - -* `op`: An `Operation`. `Operation` that computes this tensor. -* `value_index`: An `int`. Index of the operation's endpoint that produces - this tensor. -* `dtype`: A `DType`. Type of elements stored in this tensor. - -##### Raises: - - -* `TypeError`: If the op is not an `Operation`. - - -- - - - -#### `tf.Tensor.__invert__(x, name=None)` {#Tensor.__invert__} - -Returns the truth value of NOT x element-wise. - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__iter__()` {#Tensor.__iter__} - -Dummy method to prevent iteration. Do not call. - -NOTE(mrry): If we register __getitem__ as an overloaded operator, -Python will valiantly attempt to iterate over the Tensor from 0 to -infinity. Declaring this method prevents this unintended -behavior. - -##### Raises: - - -* `TypeError`: when invoked. - - -- - - - -#### `tf.Tensor.__le__(x, y, name=None)` {#Tensor.__le__} - -Returns the truth value of (x <= y) element-wise. - -*NOTE*: `LessEqual` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__lt__(x, y, name=None)` {#Tensor.__lt__} - -Returns the truth value of (x < y) element-wise. - -*NOTE*: `Less` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__mod__(x, y)` {#Tensor.__mod__} - -Returns element-wise remainder of division. When `x < 0` xor `y < 0` is - -true, this follows Python semantics in that the result here is consistent -with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. - -*NOTE*: `FloorMod` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `float32`, `float64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Tensor.__mul__(x, y)` {#Tensor.__mul__} - -Dispatches cwise mul for "Dense*Dense" and "Dense*Sparse". - - -- - - - -#### `tf.Tensor.__neg__(x, name=None)` {#Tensor.__neg__} - -Computes numerical negative value element-wise. - -I.e., \\(y = -x\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Tensor.__nonzero__()` {#Tensor.__nonzero__} - -Dummy method to prevent a tensor from being used as a Python `bool`. - -This is the Python 2.x counterpart to `__bool__()` above. - -##### Raises: - - `TypeError`. - - -- - - - -#### `tf.Tensor.__or__(x, y)` {#Tensor.__or__} - -Returns the truth value of x OR y element-wise. - -*NOTE*: `LogicalOr` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__pow__(x, y)` {#Tensor.__pow__} - -Computes the power of one value to another. - -Given a tensor `x` and a tensor `y`, this operation computes \\(x^y\\) for -corresponding elements in `x` and `y`. For example: - -``` -# tensor 'x' is [[2, 2], [3, 3]] -# tensor 'y' is [[8, 16], [2, 3]] -tf.pow(x, y) ==> [[256, 65536], [9, 27]] -``` - -##### Args: - - -* `x`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `y`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. - - -- - - - -#### `tf.Tensor.__radd__(y, x)` {#Tensor.__radd__} - -Returns x + y element-wise. - -*NOTE*: `Add` supports broadcasting. `AddN` does not. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`, `complex64`, `complex128`, `string`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Tensor.__rand__(y, x)` {#Tensor.__rand__} - -Returns the truth value of x AND y element-wise. - -*NOTE*: `LogicalAnd` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__rdiv__(y, x)` {#Tensor.__rdiv__} - -Divide two values using Python 2 semantics. Used for Tensor.__div__. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` returns the quotient of x and y. - - -- - - - -#### `tf.Tensor.__repr__()` {#Tensor.__repr__} - - - - -- - - - -#### `tf.Tensor.__rfloordiv__(y, x)` {#Tensor.__rfloordiv__} - -Divides `x / y` elementwise, rounding toward the most negative integer. - -The same as `tf.div(x,y)` for integers, but uses `tf.floor(tf.div(x,y))` for -floating point arguments so that the result is always an integer (though -possibly an integer represented as floating point). This op is generated by -`x // y` floor division in Python 3 and in Python 2.7 with -`from __future__ import division`. - -Note that for efficiency, `floordiv` uses C semantics for negative numbers -(unlike Python and Numpy). - -`x` and `y` must have the same type, and the result will have the same type -as well. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` rounded down (except possibly towards zero for negative integers). - -##### Raises: - - -* `TypeError`: If the inputs are complex. - - -- - - - -#### `tf.Tensor.__rmod__(y, x)` {#Tensor.__rmod__} - -Returns element-wise remainder of division. When `x < 0` xor `y < 0` is - -true, this follows Python semantics in that the result here is consistent -with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. - -*NOTE*: `FloorMod` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `float32`, `float64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Tensor.__rmul__(y, x)` {#Tensor.__rmul__} - -Dispatches cwise mul for "Dense*Dense" and "Dense*Sparse". - - -- - - - -#### `tf.Tensor.__ror__(y, x)` {#Tensor.__ror__} - -Returns the truth value of x OR y element-wise. - -*NOTE*: `LogicalOr` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Tensor.__rpow__(y, x)` {#Tensor.__rpow__} - -Computes the power of one value to another. - -Given a tensor `x` and a tensor `y`, this operation computes \\(x^y\\) for -corresponding elements in `x` and `y`. For example: - -``` -# tensor 'x' is [[2, 2], [3, 3]] -# tensor 'y' is [[8, 16], [2, 3]] -tf.pow(x, y) ==> [[256, 65536], [9, 27]] -``` - -##### Args: - - -* `x`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `y`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. - - -- - - - -#### `tf.Tensor.__rsub__(y, x)` {#Tensor.__rsub__} - -Returns x - y element-wise. - -*NOTE*: `Sub` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Tensor.__rtruediv__(y, x)` {#Tensor.__rtruediv__} - - - - -- - - - -#### `tf.Tensor.__rxor__(y, x)` {#Tensor.__rxor__} - -x ^ y = (x | y) & ~(x & y). - - -- - - - -#### `tf.Tensor.__str__()` {#Tensor.__str__} - - - - -- - - - -#### `tf.Tensor.__sub__(x, y)` {#Tensor.__sub__} - -Returns x - y element-wise. - -*NOTE*: `Sub` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Tensor.__truediv__(x, y)` {#Tensor.__truediv__} - - - - -- - - - -#### `tf.Tensor.__xor__(x, y)` {#Tensor.__xor__} - -x ^ y = (x | y) & ~(x & y). - - -- - - - -#### `tf.Tensor.consumers()` {#Tensor.consumers} - -Returns a list of `Operation`s that consume this tensor. - -##### Returns: - - A list of `Operation`s. - - -- - - - -#### `tf.Tensor.device` {#Tensor.device} - -The name of the device on which this tensor will be produced, or None. - - -- - - - -#### `tf.Tensor.dtype` {#Tensor.dtype} - -The `DType` of elements in this tensor. - - -- - - - -#### `tf.Tensor.eval(feed_dict=None, session=None)` {#Tensor.eval} - -Evaluates this tensor in a `Session`. - -Calling this method will execute all preceding operations that -produce the inputs needed for the operation that produces this -tensor. - -*N.B.* Before invoking `Tensor.eval()`, its graph must have been -launched in a session, and either a default session must be -available, or `session` must be specified explicitly. - -##### Args: - - -* `feed_dict`: A dictionary that maps `Tensor` objects to feed values. - See [`Session.run()`](../../api_docs/python/client.md#Session.run) for a - description of the valid feed values. -* `session`: (Optional.) The `Session` to be used to evaluate this tensor. If - none, the default session will be used. - -##### Returns: - - A numpy array corresponding to the value of this tensor. - - -- - - - -#### `tf.Tensor.get_shape()` {#Tensor.get_shape} - -Alias of Tensor.shape. - - -- - - - -#### `tf.Tensor.graph` {#Tensor.graph} - -The `Graph` that contains this tensor. - - -- - - - -#### `tf.Tensor.name` {#Tensor.name} - -The string name of this tensor. - - -- - - - -#### `tf.Tensor.op` {#Tensor.op} - -The `Operation` that produces this tensor as an output. - - -- - - - -#### `tf.Tensor.set_shape(shape)` {#Tensor.set_shape} - -Updates the shape of this tensor. - -This method can be called multiple times, and will merge the given -`shape` with the current shape of this tensor. It can be used to -provide additional information about the shape of this tensor that -cannot be inferred from the graph alone. For example, this can be used -to provide additional information about the shapes of images: - -```python -_, image_data = tf.TFRecordReader(...).read(...) -image = tf.image.decode_png(image_data, channels=3) - -# The height and width dimensions of `image` are data dependent, and -# cannot be computed without executing the op. -print(image.shape) -==> TensorShape([Dimension(None), Dimension(None), Dimension(3)]) - -# We know that each image in this dataset is 28 x 28 pixels. -image.set_shape([28, 28, 3]) -print(image.shape) -==> TensorShape([Dimension(28), Dimension(28), Dimension(3)]) -``` - -##### Args: - - -* `shape`: A `TensorShape` representing the shape of this tensor. - -##### Raises: - - -* `ValueError`: If `shape` is not compatible with the current shape of - this tensor. - - -- - - - -#### `tf.Tensor.shape` {#Tensor.shape} - -Returns the `TensorShape` that represents the shape of this tensor. - -The shape is computed using shape inference functions that are -registered in the Op for each `Operation`. See -[`TensorShape`](../../api_docs/python/framework.md#TensorShape) -for more details of what a shape represents. - -The inferred shape of a tensor is used to provide shape -information without having to launch the graph in a session. This -can be used for debugging, and providing early error messages. For -example: - -```python -c = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]) - -print(c.shape) -==> TensorShape([Dimension(2), Dimension(3)]) - -d = tf.constant([[1.0, 0.0], [0.0, 1.0], [1.0, 0.0], [0.0, 1.0]]) - -print(d.shape) -==> TensorShape([Dimension(4), Dimension(2)]) - -# Raises a ValueError, because `c` and `d` do not have compatible -# inner dimensions. -e = tf.matmul(c, d) - -f = tf.matmul(c, d, transpose_a=True, transpose_b=True) - -print(f.shape) -==> TensorShape([Dimension(3), Dimension(4)]) -``` - -In some cases, the inferred shape may have unknown dimensions. If -the caller has additional information about the values of these -dimensions, `Tensor.set_shape()` can be used to augment the -inferred shape. - -##### Returns: - - A `TensorShape` representing the shape of this tensor. - - -- - - - -#### `tf.Tensor.value_index` {#Tensor.value_index} - -The index of this tensor in the outputs of its `Operation`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.Variable.from_proto.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.Variable.from_proto.md deleted file mode 100644 index e4ab071c59..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.Variable.from_proto.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.Variable.from_proto(variable_def, import_scope=None)` {#Variable.from_proto} - -Returns a `Variable` object created from `variable_def`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.accumulate_n.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.accumulate_n.md deleted file mode 100644 index 7b558a4868..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.accumulate_n.md +++ /dev/null @@ -1,40 +0,0 @@ -### `tf.accumulate_n(inputs, shape=None, tensor_dtype=None, name=None)` {#accumulate_n} - -Returns the element-wise sum of a list of tensors. - -Optionally, pass `shape` and `tensor_dtype` for shape and type checking, -otherwise, these are inferred. - -NOTE: This operation is not differentiable and cannot be used if inputs depend -on trainable variables. Please use `tf.add_n` for such cases. - -For example: - -```python -# tensor 'a' is [[1, 2], [3, 4]] -# tensor `b` is [[5, 0], [0, 6]] -tf.accumulate_n([a, b, a]) ==> [[7, 4], [6, 14]] - -# Explicitly pass shape and type -tf.accumulate_n([a, b, a], shape=[2, 2], tensor_dtype=tf.int32) - ==> [[7, 4], [6, 14]] -``` - -##### Args: - - -* `inputs`: A list of `Tensor` objects, each with same shape and type. -* `shape`: Shape of elements of `inputs`. -* `tensor_dtype`: The type of `inputs`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of same shape and type as the elements of `inputs`. - -##### Raises: - - -* `ValueError`: If `inputs` don't all have same shape and dtype or the shape - cannot be inferred. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.all_variables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.all_variables.md deleted file mode 100644 index 1badf0e5c5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.all_variables.md +++ /dev/null @@ -1,8 +0,0 @@ -### `tf.all_variables(*args, **kwargs)` {#all_variables} - -See `tf.global_variables`. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-02. -Instructions for updating: -Please use tf.global_variables instead. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.assert_less_equal.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.assert_less_equal.md deleted file mode 100644 index 3671bc94df..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.assert_less_equal.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.assert_less_equal(x, y, data=None, summarize=None, message=None, name=None)` {#assert_less_equal} - -Assert the condition `x <= y` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_less_equal(x, y)]): - output = tf.reduce_sum(x) -``` - -This condition holds if for every pair of (possibly broadcast) elements -`x[i]`, `y[i]`, we have `x[i] <= y[i]`. -If both `x` and `y` are empty, this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `y`: Numeric `Tensor`, same dtype as and broadcastable to `x`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`, `y`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_less_equal" - -##### Returns: - - Op that raises `InvalidArgumentError` if `x <= y` is False. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.assert_rank_at_least.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.assert_rank_at_least.md deleted file mode 100644 index 380ab0af74..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.assert_rank_at_least.md +++ /dev/null @@ -1,33 +0,0 @@ -### `tf.assert_rank_at_least(x, rank, data=None, summarize=None, message=None, name=None)` {#assert_rank_at_least} - -Assert `x` has rank equal to `rank` or higher. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_rank_at_least(x, 2)]): - output = tf.reduce_sum(x) -``` - -##### Args: - - -* `x`: Numeric `Tensor`. -* `rank`: Scalar `Tensor`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). - Defaults to "assert_rank_at_least". - -##### Returns: - - Op raising `InvalidArgumentError` unless `x` has specified rank or higher. - If static checks determine `x` has correct rank, a `no_op` is returned. - -##### Raises: - - -* `ValueError`: If static checks determine `x` has wrong rank. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.assign.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.assign.md deleted file mode 100644 index f72385be60..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.assign.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.assign(ref, value, validate_shape=None, use_locking=None, name=None)` {#assign} - -Update 'ref' by assigning 'value' to it. - -This operation outputs "ref" after the assignment is done. -This makes it easier to chain operations that need to use the reset value. - -##### Args: - - -* `ref`: A mutable `Tensor`. - Should be from a `Variable` node. May be uninitialized. -* `value`: A `Tensor`. Must have the same type as `ref`. - The value to be assigned to the variable. -* `validate_shape`: An optional `bool`. Defaults to `True`. - If true, the operation will validate that the shape - of 'value' matches the shape of the Tensor being assigned to. If false, - 'ref' will take on the shape of 'value'. -* `use_locking`: An optional `bool`. Defaults to `True`. - If True, the assignment will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as "ref". Returned as a convenience for operations that want - to use the new value after the variable has been reset. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.batch_to_space.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.batch_to_space.md deleted file mode 100644 index 3c3f85f869..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.batch_to_space.md +++ /dev/null @@ -1,100 +0,0 @@ -### `tf.batch_to_space(input, crops, block_size, name=None)` {#batch_to_space} - -BatchToSpace for 4-D tensors of type T. - -This is a legacy version of the more general BatchToSpaceND. - -Rearranges (permutes) data from batch into blocks of spatial data, followed by -cropping. This is the reverse transformation of SpaceToBatch. More specifically, -this op outputs a copy of the input tensor where values from the `batch` -dimension are moved in spatial blocks to the `height` and `width` dimensions, -followed by cropping along the `height` and `width` dimensions. - -##### Args: - - -* `input`: A `Tensor`. 4-D tensor with shape - `[batch*block_size*block_size, height_pad/block_size, width_pad/block_size, - depth]`. Note that the batch size of the input tensor must be divisible by - `block_size * block_size`. -* `crops`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 2-D tensor of non-negative integers with shape `[2, 2]`. It specifies - how many elements to crop from the intermediate result across the spatial - dimensions as follows: - - crops = [[crop_top, crop_bottom], [crop_left, crop_right]] - -* `block_size`: An `int` that is `>= 2`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - 4-D with shape `[batch, height, width, depth]`, where: - - height = height_pad - crop_top - crop_bottom - width = width_pad - crop_left - crop_right - - The attr `block_size` must be greater than one. It indicates the block size. - - Some examples: - - (1) For the following input of shape `[4, 1, 1, 1]` and block_size of 2: - - ```prettyprint - [[[[1]]], [[[2]]], [[[3]]], [[[4]]]] - ``` - - The output tensor has shape `[1, 2, 2, 1]` and value: - - ```prettyprint - x = [[[[1], [2]], [[3], [4]]]] - ``` - - (2) For the following input of shape `[4, 1, 1, 3]` and block_size of 2: - - ```prettyprint - [[[1, 2, 3]], [[4, 5, 6]], [[7, 8, 9]], [[10, 11, 12]]] - ``` - - The output tensor has shape `[1, 2, 2, 3]` and value: - - ```prettyprint - x = [[[[1, 2, 3], [4, 5, 6]], - [[7, 8, 9], [10, 11, 12]]]] - ``` - - (3) For the following input of shape `[4, 2, 2, 1]` and block_size of 2: - - ```prettyprint - x = [[[[1], [3]], [[9], [11]]], - [[[2], [4]], [[10], [12]]], - [[[5], [7]], [[13], [15]]], - [[[6], [8]], [[14], [16]]]] - ``` - - The output tensor has shape `[1, 4, 4, 1]` and value: - - ```prettyprint - x = [[[1], [2], [3], [4]], - [[5], [6], [7], [8]], - [[9], [10], [11], [12]], - [[13], [14], [15], [16]]] - ``` - - (4) For the following input of shape `[8, 1, 2, 1]` and block_size of 2: - - ```prettyprint - x = [[[[1], [3]]], [[[9], [11]]], [[[2], [4]]], [[[10], [12]]], - [[[5], [7]]], [[[13], [15]]], [[[6], [8]]], [[[14], [16]]]] - ``` - - The output tensor has shape `[2, 2, 4, 1]` and value: - - ```prettyprint - x = [[[[1], [3]], [[5], [7]]], - [[[2], [4]], [[10], [12]]], - [[[5], [7]], [[13], [15]]], - [[[6], [8]], [[14], [16]]]] - ``` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.constant_initializer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.constant_initializer.md deleted file mode 100644 index fa95f791bf..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.constant_initializer.md +++ /dev/null @@ -1,86 +0,0 @@ -Initializer that generates tensors with constant values. - -The resulting tensor is populated with values of type `dtype`, as -specified by arguments `value` following the desired `shape` of the -new tensor (see examples below). - -The argument `value` can be a constant value, or a list of values of type -`dtype`. If `value` is a list, then the length of the list must be less -than or equal to the number of elements implied by the desired shape of the -tensor. In the case where the total number of elements in `value` is less -than the number of elements required by the tensor shape, the last element -in `value` will be used to fill the remaining entries. If the total number of -elements in `value` is greater than the number of elements required by the -tensor shape, the initializer will raise a `ValueError`. - -Args: - value: A Python scalar, list of values, or a N-dimensional numpy array. All - elements of the initialized variable will be set to the corresponding - value in the `value` argument. - dtype: The data type. - verify_shape: Boolean that enables verification of the shape of `value`. If - `True`, the initializer will throw an error if the shape of `value` is not - compatible with the shape of the initialized tensor. - -Examples: - The following example can be rewritten using a numpy.ndarray instead - of the `value` list, even reshaped, as shown in the two commented lines - below the `value` list initialization. - -```python - >>> import numpy as np - >>> import tensorflow as tf - - >>> value = [0, 1, 2, 3, 4, 5, 6, 7] - >>> # value = np.array(value) - >>> # value = value.reshape([2, 4]) - >>> init = tf.constant_initializer(value) - - >>> print('fitting shape:') - >>> with tf.Session(): - >>> x = tf.get_variable('x', shape=[2, 4], initializer=init) - >>> x.initializer.run() - >>> print(x.eval()) - - fitting shape: - [[ 0. 1. 2. 3.] - [ 4. 5. 6. 7.]] - - >>> print('larger shape:') - >>> with tf.Session(): - >>> x = tf.get_variable('x', shape=[3, 4], initializer=init) - >>> x.initializer.run() - >>> print(x.eval()) - - larger shape: - [[ 0. 1. 2. 3.] - [ 4. 5. 6. 7.] - [ 7. 7. 7. 7.]] - - >>> print('smaller shape:') - >>> with tf.Session(): - >>> x = tf.get_variable('x', shape=[2, 3], initializer=init) - - ValueError: Too many elements provided. Needed at most 6, but received 8 - - >>> print('shape verification:') - >>> init_verify = tf.constant_initializer(value, verify_shape=True) - >>> with tf.Session(): - >>> x = tf.get_variable('x', shape=[3, 4], initializer=init_verify) - - TypeError: Expected Tensor's shape: (3, 4), got (8,). -``` -- - - - -#### `tf.constant_initializer.__call__(shape, dtype=None, partition_info=None)` {#constant_initializer.__call__} - - - - -- - - - -#### `tf.constant_initializer.__init__(value=0, dtype=tf.float32, verify_shape=False)` {#constant_initializer.__init__} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.md deleted file mode 100644 index 0bee637f4d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.md +++ /dev/null @@ -1,58 +0,0 @@ -Base Class for Tensor-like objects that emit stochastic values. -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.__init__()` {#BaseStochasticTensor.__init__} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.dtype` {#BaseStochasticTensor.dtype} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.graph` {#BaseStochasticTensor.graph} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.loss(sample_loss)` {#BaseStochasticTensor.loss} - -Returns the term to add to the surrogate loss. - -This method is called by `surrogate_loss`. The input `sample_loss` should -have already had `stop_gradient` applied to it. This is because the -surrogate_loss usually provides a Monte Carlo sample term of the form -`differentiable_surrogate * sample_loss` where `sample_loss` is considered -constant with respect to the input for purposes of the gradient. - -##### Args: - - -* `sample_loss`: `Tensor`, sample loss downstream of this `StochasticTensor`. - -##### Returns: - - Either `None` or a `Tensor`. - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.name` {#BaseStochasticTensor.name} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.BaseStochasticTensor.value(name=None)` {#BaseStochasticTensor.value} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.bayesflow.variational_inference.elbo.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.bayesflow.variational_inference.elbo.md deleted file mode 100644 index b4fbbf8aad..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.bayesflow.variational_inference.elbo.md +++ /dev/null @@ -1,71 +0,0 @@ -### `tf.contrib.bayesflow.variational_inference.elbo(log_likelihood, variational_with_prior=None, keep_batch_dim=True, form=None, name='ELBO')` {#elbo} - -Evidence Lower BOund. `log p(x) >= ELBO`. - -Optimization objective for inference of hidden variables by variational -inference. - -This function is meant to be used in conjunction with `StochasticTensor`. -The user should build out the inference network, using `StochasticTensor`s -as latent variables, and the generative network. `elbo` at minimum needs -`p(x|Z)` and assumes that all `StochasticTensor`s upstream of `p(x|Z)` are -the variational distributions. Use `register_prior` to register `Distribution` -priors for each `StochasticTensor`. Alternatively, pass in -`variational_with_prior` specifying all variational distributions and their -priors. - -Mathematical details: - -``` -log p(x) = log \int p(x, Z) dZ - = log \int \frac {q(Z)p(x, Z)}{q(Z)} dZ - = log E_q[\frac {p(x, Z)}{q(Z)}] - >= E_q[log \frac {p(x, Z)}{q(Z)}] = L[q; p, x] # ELBO - -L[q; p, x] = E_q[log p(x|Z)p(Z)] - E_q[log q(Z)] - = E_q[log p(x|Z)p(Z)] + H[q] (1) - = E_q[log p(x|Z)] - KL(q || p) (2) - -H - Entropy -KL - Kullback-Leibler divergence -``` - -See section 2.2 of Stochastic Variational Inference by Hoffman et al. for -more, including the ELBO's equivalence to minimizing `KL(q(Z)||p(Z|x))` -in the fully Bayesian setting. https://arxiv.org/pdf/1206.7051.pdf. - -`form` specifies which form of the ELBO is used. `form=ELBOForms.default` -tries, in order of preference: analytic KL, analytic entropy, sampling. - -Multiple entries in the `variational_with_prior` dict implies a factorization. -e.g. `q(Z) = q(z1)q(z2)q(z3)`. - -##### Args: - - -* `log_likelihood`: `Tensor` log p(x|Z). -* `variational_with_prior`: dict from `StochasticTensor` q(Z) to - `Distribution` p(Z). If `None`, defaults to all `StochasticTensor` - objects upstream of `log_likelihood` with priors registered with - `register_prior`. -* `keep_batch_dim`: bool. Whether to keep the batch dimension when summing - entropy/KL term. When the sample is per data point, this should be True; - otherwise (e.g. in a Bayesian NN), this should be False. -* `form`: ELBOForms constant. Controls how the ELBO is computed. Defaults to - ELBOForms.default. -* `name`: name to prefix ops with. - -##### Returns: - - `Tensor` ELBO of the same type and shape as `log_likelihood`. - -##### Raises: - - -* `TypeError`: if variationals in `variational_with_prior` are not - `StochasticTensor`s or if priors are not `Distribution`s. -* `TypeError`: if form is not a valid ELBOForms constant. -* `ValueError`: if `variational_with_prior` is None and there are no - `StochasticTensor`s upstream of `log_likelihood`. -* `ValueError`: if any variational does not have a prior passed or registered. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.crf.crf_log_likelihood.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.crf.crf_log_likelihood.md deleted file mode 100644 index a1f7bd2033..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.crf.crf_log_likelihood.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.contrib.crf.crf_log_likelihood(inputs, tag_indices, sequence_lengths, transition_params=None)` {#crf_log_likelihood} - -Computes the log-likelihood of tag sequences in a CRF. - -##### Args: - - -* `inputs`: A [batch_size, max_seq_len, num_tags] tensor of unary potentials - to use as input to the CRF layer. -* `tag_indices`: A [batch_size, max_seq_len] matrix of tag indices for which we - compute the log-likelihood. -* `sequence_lengths`: A [batch_size] vector of true sequence lengths. -* `transition_params`: A [num_tags, num_tags] transition matrix, if available. - -##### Returns: - - -* `log_likelihood`: A scalar containing the log-likelihood of the given sequence - of tag indices. -* `transition_params`: A [num_tags, num_tags] transition matrix. This is either - provided by the caller or created in this function. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.MultivariateNormalDiag.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.MultivariateNormalDiag.md deleted file mode 100644 index c0aec27082..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.MultivariateNormalDiag.md +++ /dev/null @@ -1,771 +0,0 @@ -The multivariate normal distribution on `R^k`. - -The Multivariate Normal distribution is defined over `R^k` and parameterized -by a (batch of) length-`k` `loc` vector (aka "mu") and a (batch of) `k x k` -`scale` matrix; `covariance = scale @ scale.T` where `@` denotes -matrix-multiplication. - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; loc, scale) = exp(-0.5 ||y||**2) / Z, -y = inv(scale) @ (x - loc), -Z = (2 pi)**(0.5 k) |det(scale)|, -``` - -where: - -* `loc` is a vector in `R^k`, -* `scale` is a linear operator in `R^{k x k}`, `cov = scale @ scale.T`, -* `Z` denotes the normalization constant, and, -* `||y||**2` denotes the squared Euclidean norm of `y`. - -A (non-batch) `scale` matrix is: - -```none -scale = diag(scale_diag + scale_identity_multiplier * ones(k)) -``` - -where: - -* `scale_diag.shape = [k]`, and, -* `scale_identity_multiplier.shape = []`. - -Additional leading dimensions (if any) will index batches. - -If both `scale_diag` and `scale_identity_multiplier` are `None`, then -`scale` is the Identity matrix. - -The MultivariateNormal distribution is a member of the [location-scale -family](https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be -constructed as, - -```none -X ~ MultivariateNormal(loc=0, scale=1) # Identity scale, zero shift. -Y = scale @ X + loc -``` - -#### Examples - -```python -ds = tf.contrib.distributions - -# Initialize a single 2-variate Gaussian. -mvn = ds.MultivariateNormalDiag( - loc=[1., -1], - scale_diag=[1, 2.]) - -mvn.mean().eval() -# ==> [1., -1] - -mvn.stddev().eval() -# ==> [1., 2] - -# Evaluate this on an observation in `R^2`, returning a scalar. -mvn.prob([-1., 0]).eval() # shape: [] - -# Initialize a 3-batch, 2-variate scaled-identity Gaussian. -mvn = ds.MultivariateNormalDiag( - loc=[1., -1], - scale_identity_multiplier=[1, 2., 3]) - -mvn.mean().eval() # shape: [3, 2] -# ==> [[1., -1] -# [1, -1], -# [1, -1]] - -mvn.stddev().eval() # shape: [3, 2] -# ==> [[1., 1], -# [2, 2], -# [3, 3]] - -# Evaluate this on an observation in `R^2`, returning a length-3 vector. -mvn.prob([-1., 0]).eval() # shape: [3] - -# Initialize a 2-batch of 3-variate Gaussians. -mvn = ds.MultivariateNormalDiag( - loc=[[1., 2, 3], - [11, 22, 33]] # shape: [2, 3] - scale_diag=[[1., 2, 3], - [0.5, 1, 1.5]]) # shape: [2, 3] - -# Evaluate this on a two observations, each in `R^3`, returning a length-2 -# vector. -x = [[-1., 0, 1], - [-11, 0, 11.]] # shape: [2, 3]. -mvn.prob(x).eval() # shape: [2] -``` -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.__init__(loc=None, scale_diag=None, scale_identity_multiplier=None, validate_args=False, allow_nan_stats=True, name='MultivariateNormalDiag')` {#MultivariateNormalDiag.__init__} - -Construct Multivariate Normal distribution on `R^k`. - -The `batch_shape` is the broadcast shape between `loc` and `scale` -arguments. - -The `event_shape` is given by the last dimension of `loc` or the last -dimension of the matrix implied by `scale`. - -Recall that `covariance = scale @ scale.T`. A (non-batch) `scale` matrix is: - -```none -scale = diag(scale_diag + scale_identity_multiplier * ones(k)) -``` - -where: - -* `scale_diag.shape = [k]`, and, -* `scale_identity_multiplier.shape = []`. - -Additional leading dimensions (if any) will index batches. - -If both `scale_diag` and `scale_identity_multiplier` are `None`, then -`scale` is the Identity matrix. - -##### Args: - - -* `loc`: Floating-point `Tensor`. If this is set to `None`, `loc` is - implicitly `0`. When specified, may have shape `[B1, ..., Bb, k]` where - `b >= 0` and `k` is the event size. -* `scale_diag`: Non-zero, floating-point `Tensor` representing a diagonal - matrix added to `scale`. May have shape `[B1, ..., Bb, k]`, `b >= 0`, - and characterizes `b`-batches of `k x k` diagonal matrices added to - `scale`. When both `scale_identity_multiplier` and `scale_diag` are - `None` then `scale` is the `Identity`. -* `scale_identity_multiplier`: Non-zero, floating-point `Tensor` representing - a scaled-identity-matrix added to `scale`. May have shape - `[B1, ..., Bb]`, `b >= 0`, and characterizes `b`-batches of scaled - `k x k` identity matrices added to `scale`. When both - `scale_identity_multiplier` and `scale_diag` are `None` then `scale` is - the `Identity`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, - statistics (e.g., mean, mode, variance) use the value "`NaN`" to - indicate the result is undefined. When `False`, an exception is raised - if one or more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `ValueError`: if at most `scale_identity_multiplier` is specified. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.allow_nan_stats` {#MultivariateNormalDiag.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.batch_shape` {#MultivariateNormalDiag.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.batch_shape_tensor(name='batch_shape_tensor')` {#MultivariateNormalDiag.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.bijector` {#MultivariateNormalDiag.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.cdf(value, name='cdf')` {#MultivariateNormalDiag.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.copy(**override_parameters_kwargs)` {#MultivariateNormalDiag.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.covariance(name='covariance')` {#MultivariateNormalDiag.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.det_covariance(name='det_covariance')` {#MultivariateNormalDiag.det_covariance} - -Determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.distribution` {#MultivariateNormalDiag.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.dtype` {#MultivariateNormalDiag.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.entropy(name='entropy')` {#MultivariateNormalDiag.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.event_shape` {#MultivariateNormalDiag.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.event_shape_tensor(name='event_shape_tensor')` {#MultivariateNormalDiag.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.is_continuous` {#MultivariateNormalDiag.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.is_scalar_batch(name='is_scalar_batch')` {#MultivariateNormalDiag.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.is_scalar_event(name='is_scalar_event')` {#MultivariateNormalDiag.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.loc` {#MultivariateNormalDiag.loc} - -The `loc` `Tensor` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.log_cdf(value, name='log_cdf')` {#MultivariateNormalDiag.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.log_det_covariance(name='log_det_covariance')` {#MultivariateNormalDiag.log_det_covariance} - -Log of determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.log_prob(value, name='log_prob')` {#MultivariateNormalDiag.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalDiag.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.mean(name='mean')` {#MultivariateNormalDiag.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.mode(name='mode')` {#MultivariateNormalDiag.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.name` {#MultivariateNormalDiag.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#MultivariateNormalDiag.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.param_static_shapes(cls, sample_shape)` {#MultivariateNormalDiag.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.parameters` {#MultivariateNormalDiag.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.prob(value, name='prob')` {#MultivariateNormalDiag.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.reparameterization_type` {#MultivariateNormalDiag.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.sample(sample_shape=(), seed=None, name='sample')` {#MultivariateNormalDiag.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.scale` {#MultivariateNormalDiag.scale} - -The `scale` `LinearOperator` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.stddev(name='stddev')` {#MultivariateNormalDiag.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.survival_function(value, name='survival_function')` {#MultivariateNormalDiag.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.validate_args` {#MultivariateNormalDiag.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiag.variance(name='variance')` {#MultivariateNormalDiag.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.md deleted file mode 100644 index 0353b095bf..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.md +++ /dev/null @@ -1,619 +0,0 @@ -MultivariateNormalDiag with `diag_stddev = softplus(diag_stddev)`. -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.__init__(loc, scale_diag, validate_args=False, allow_nan_stats=True, name='MultivariateNormalDiagWithSoftplusScale')` {#MultivariateNormalDiagWithSoftplusScale.__init__} - - - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.allow_nan_stats` {#MultivariateNormalDiagWithSoftplusScale.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.batch_shape` {#MultivariateNormalDiagWithSoftplusScale.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.batch_shape_tensor(name='batch_shape_tensor')` {#MultivariateNormalDiagWithSoftplusScale.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.bijector` {#MultivariateNormalDiagWithSoftplusScale.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.cdf(value, name='cdf')` {#MultivariateNormalDiagWithSoftplusScale.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.copy(**override_parameters_kwargs)` {#MultivariateNormalDiagWithSoftplusScale.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.covariance(name='covariance')` {#MultivariateNormalDiagWithSoftplusScale.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.det_covariance(name='det_covariance')` {#MultivariateNormalDiagWithSoftplusScale.det_covariance} - -Determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.distribution` {#MultivariateNormalDiagWithSoftplusScale.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.dtype` {#MultivariateNormalDiagWithSoftplusScale.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.entropy(name='entropy')` {#MultivariateNormalDiagWithSoftplusScale.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.event_shape` {#MultivariateNormalDiagWithSoftplusScale.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.event_shape_tensor(name='event_shape_tensor')` {#MultivariateNormalDiagWithSoftplusScale.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.is_continuous` {#MultivariateNormalDiagWithSoftplusScale.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.is_scalar_batch(name='is_scalar_batch')` {#MultivariateNormalDiagWithSoftplusScale.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.is_scalar_event(name='is_scalar_event')` {#MultivariateNormalDiagWithSoftplusScale.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.loc` {#MultivariateNormalDiagWithSoftplusScale.loc} - -The `loc` `Tensor` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.log_cdf(value, name='log_cdf')` {#MultivariateNormalDiagWithSoftplusScale.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.log_det_covariance(name='log_det_covariance')` {#MultivariateNormalDiagWithSoftplusScale.log_det_covariance} - -Log of determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.log_prob(value, name='log_prob')` {#MultivariateNormalDiagWithSoftplusScale.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalDiagWithSoftplusScale.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.mean(name='mean')` {#MultivariateNormalDiagWithSoftplusScale.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.mode(name='mode')` {#MultivariateNormalDiagWithSoftplusScale.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.name` {#MultivariateNormalDiagWithSoftplusScale.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#MultivariateNormalDiagWithSoftplusScale.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.param_static_shapes(cls, sample_shape)` {#MultivariateNormalDiagWithSoftplusScale.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.parameters` {#MultivariateNormalDiagWithSoftplusScale.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.prob(value, name='prob')` {#MultivariateNormalDiagWithSoftplusScale.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.reparameterization_type` {#MultivariateNormalDiagWithSoftplusScale.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.sample(sample_shape=(), seed=None, name='sample')` {#MultivariateNormalDiagWithSoftplusScale.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.scale` {#MultivariateNormalDiagWithSoftplusScale.scale} - -The `scale` `LinearOperator` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.stddev(name='stddev')` {#MultivariateNormalDiagWithSoftplusScale.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.survival_function(value, name='survival_function')` {#MultivariateNormalDiagWithSoftplusScale.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.validate_args` {#MultivariateNormalDiagWithSoftplusScale.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagWithSoftplusScale.variance(name='variance')` {#MultivariateNormalDiagWithSoftplusScale.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.QuantizedDistribution.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.QuantizedDistribution.md deleted file mode 100644 index 42bdb1eb24..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.QuantizedDistribution.md +++ /dev/null @@ -1,740 +0,0 @@ -Distribution representing the quantization `Y = ceiling(X)`. - -#### Definition in terms of sampling. - -``` -1. Draw X -2. Set Y <-- ceiling(X) -3. If Y < low, reset Y <-- low -4. If Y > high, reset Y <-- high -5. Return Y -``` - -#### Definition in terms of the probability mass function. - -Given scalar random variable `X`, we define a discrete random variable `Y` -supported on the integers as follows: - -``` -P[Y = j] := P[X <= low], if j == low, - := P[X > high - 1], j == high, - := 0, if j < low or j > high, - := P[j - 1 < X <= j], all other j. -``` - -Conceptually, without cutoffs, the quantization process partitions the real -line `R` into half open intervals, and identifies an integer `j` with the -right endpoints: - -``` -R = ... (-2, -1](-1, 0](0, 1](1, 2](2, 3](3, 4] ... -j = ... -1 0 1 2 3 4 ... -``` - -`P[Y = j]` is the mass of `X` within the `jth` interval. -If `low = 0`, and `high = 2`, then the intervals are redrawn -and `j` is re-assigned: - -``` -R = (-infty, 0](0, 1](1, infty) -j = 0 1 2 -``` - -`P[Y = j]` is still the mass of `X` within the `jth` interval. - -#### Caveats - -Since evaluation of each `P[Y = j]` involves a cdf evaluation (rather than -a closed form function such as for a Poisson), computations such as mean and -entropy are better done with samples or approximations, and are not -implemented by this class. -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.__init__(distribution, low=None, high=None, validate_args=False, name='QuantizedDistribution')` {#QuantizedDistribution.__init__} - -Construct a Quantized Distribution representing `Y = ceiling(X)`. - -Some properties are inherited from the distribution defining `X`. Example: -`allow_nan_stats` is determined for this `QuantizedDistribution` by reading -the `distribution`. - -##### Args: - - -* `distribution`: The base distribution class to transform. Typically an - instance of `Distribution`. -* `low`: `Tensor` with same `dtype` as this distribution and shape - able to be added to samples. Should be a whole number. Default `None`. - If provided, base distribution's `prob` should be defined at - `low`. -* `high`: `Tensor` with same `dtype` as this distribution and shape - able to be added to samples. Should be a whole number. Default `None`. - If provided, base distribution's `prob` should be defined at - `high - 1`. - `high` must be strictly greater than `low`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `TypeError`: If `dist_cls` is not a subclass of - `Distribution` or continuous. -* `NotImplementedError`: If the base distribution does not implement `cdf`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.allow_nan_stats` {#QuantizedDistribution.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.batch_shape` {#QuantizedDistribution.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.batch_shape_tensor(name='batch_shape_tensor')` {#QuantizedDistribution.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.cdf(value, name='cdf')` {#QuantizedDistribution.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - - -Additional documentation from `QuantizedDistribution`: - -For whole numbers `y`, - -``` -cdf(y) := P[Y <= y] - = 1, if y >= high, - = 0, if y < low, - = P[X <= y], otherwise. -``` - -Since `Y` only has mass at whole numbers, `P[Y <= y] = P[Y <= floor(y)]`. -This dictates that fractional `y` are first floored to a whole number, and -then above definition applies. - -The base distribution's `cdf` method must be defined on `y - 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.copy(**override_parameters_kwargs)` {#QuantizedDistribution.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.covariance(name='covariance')` {#QuantizedDistribution.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.distribution` {#QuantizedDistribution.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.dtype` {#QuantizedDistribution.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.entropy(name='entropy')` {#QuantizedDistribution.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.event_shape` {#QuantizedDistribution.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.event_shape_tensor(name='event_shape_tensor')` {#QuantizedDistribution.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.is_continuous` {#QuantizedDistribution.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.is_scalar_batch(name='is_scalar_batch')` {#QuantizedDistribution.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.is_scalar_event(name='is_scalar_event')` {#QuantizedDistribution.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.log_cdf(value, name='log_cdf')` {#QuantizedDistribution.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - - -Additional documentation from `QuantizedDistribution`: - -For whole numbers `y`, - -``` -cdf(y) := P[Y <= y] - = 1, if y >= high, - = 0, if y < low, - = P[X <= y], otherwise. -``` - -Since `Y` only has mass at whole numbers, `P[Y <= y] = P[Y <= floor(y)]`. -This dictates that fractional `y` are first floored to a whole number, and -then above definition applies. - -The base distribution's `log_cdf` method must be defined on `y - 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.log_prob(value, name='log_prob')` {#QuantizedDistribution.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `QuantizedDistribution`: - -For whole numbers `y`, - -``` -P[Y = y] := P[X <= low], if y == low, - := P[X > high - 1], y == high, - := 0, if j < low or y > high, - := P[y - 1 < X <= y], all other y. -``` - - -The base distribution's `log_cdf` method must be defined on `y - 1`. If the -base distribution has a `log_survival_function` method results will be more -accurate for large values of `y`, and in this case the `log_survival_function` -must also be defined on `y - 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.log_survival_function(value, name='log_survival_function')` {#QuantizedDistribution.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - - -Additional documentation from `QuantizedDistribution`: - -For whole numbers `y`, - -``` -survival_function(y) := P[Y > y] - = 0, if y >= high, - = 1, if y < low, - = P[X <= y], otherwise. -``` - -Since `Y` only has mass at whole numbers, `P[Y <= y] = P[Y <= floor(y)]`. -This dictates that fractional `y` are first floored to a whole number, and -then above definition applies. - -The base distribution's `log_cdf` method must be defined on `y - 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.mean(name='mean')` {#QuantizedDistribution.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.mode(name='mode')` {#QuantizedDistribution.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.name` {#QuantizedDistribution.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#QuantizedDistribution.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.param_static_shapes(cls, sample_shape)` {#QuantizedDistribution.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.parameters` {#QuantizedDistribution.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.prob(value, name='prob')` {#QuantizedDistribution.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `QuantizedDistribution`: - -For whole numbers `y`, - -``` -P[Y = y] := P[X <= low], if y == low, - := P[X > high - 1], y == high, - := 0, if j < low or y > high, - := P[y - 1 < X <= y], all other y. -``` - - -The base distribution's `cdf` method must be defined on `y - 1`. If the -base distribution has a `survival_function` method, results will be more -accurate for large values of `y`, and in this case the `survival_function` must -also be defined on `y - 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.reparameterization_type` {#QuantizedDistribution.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.sample(sample_shape=(), seed=None, name='sample')` {#QuantizedDistribution.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.stddev(name='stddev')` {#QuantizedDistribution.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.survival_function(value, name='survival_function')` {#QuantizedDistribution.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - - -Additional documentation from `QuantizedDistribution`: - -For whole numbers `y`, - -``` -survival_function(y) := P[Y > y] - = 0, if y >= high, - = 1, if y < low, - = P[X <= y], otherwise. -``` - -Since `Y` only has mass at whole numbers, `P[Y <= y] = P[Y <= floor(y)]`. -This dictates that fractional `y` are first floored to a whole number, and -then above definition applies. - -The base distribution's `cdf` method must be defined on `y - 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.validate_args` {#QuantizedDistribution.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.QuantizedDistribution.variance(name='variance')` {#QuantizedDistribution.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.StudentT.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.StudentT.md deleted file mode 100644 index 569e5caab3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.StudentT.md +++ /dev/null @@ -1,683 +0,0 @@ -Student's t-distribution with degree of freedom `df`, location `loc`, and `scale` parameters. - -#### Mathematical details - -The probability density function (pdf) is, - -```none -pdf(x; df, mu, sigma) = (1 + y**2 / df)**(-0.5 (df + 1)) / Z -where, -y = (x - mu) / sigma -Z = abs(sigma) sqrt(df pi) Gamma(0.5 df) / Gamma(0.5 (df + 1)) -``` - -where: -* `loc = mu`, -* `scale = sigma`, and, -* `Z` is the normalization constant, and, -* `Gamma` is the [gamma function]( - https://en.wikipedia.org/wiki/Gamma_function). - -The StudentT distribution is a member of the [location-scale family]( -https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be -constructed as, - -```none -X ~ StudentT(df, loc=0, scale=1) -Y = loc + scale * X -``` - -Notice that `scale` has semantics more similar to standard deviation than -variance. However it is not actually the std. deviation; the Student's -t-distribution std. dev. is `scale sqrt(df / (df - 2))` when `df > 2`. - -#### Examples - -Examples of initialization of one or a batch of distributions. - -```python -# Define a single scalar Student t distribution. -single_dist = tf.contrib.distributions.StudentT(df=3) - -# Evaluate the pdf at 1, returning a scalar Tensor. -single_dist.prob(1.) - -# Define a batch of two scalar valued Student t's. -# The first has degrees of freedom 2, mean 1, and scale 11. -# The second 3, 2 and 22. -multi_dist = tf.contrib.distributions.StudentT(df=[2, 3], - loc=[1, 2.], - scale=[11, 22.]) - -# Evaluate the pdf of the first distribution on 0, and the second on 1.5, -# returning a length two tensor. -multi_dist.prob([0, 1.5]) - -# Get 3 samples, returning a 3 x 2 tensor. -multi_dist.sample(3) -``` - -Arguments are broadcast when possible. - -```python -# Define a batch of two Student's t distributions. -# Both have df 2 and mean 1, but different scales. -dist = tf.contrib.distributions.StudentT(df=2, loc=1, scale=[11, 22.]) - -# Evaluate the pdf of both distributions on the same point, 3.0, -# returning a length 2 tensor. -dist.prob(3.0) -``` -- - - - -#### `tf.contrib.distributions.StudentT.__init__(df, loc, scale, validate_args=False, allow_nan_stats=True, name='StudentT')` {#StudentT.__init__} - -Construct Student's t distributions. - -The distributions have degree of freedom `df`, mean `loc`, and scale -`scale`. - -The parameters `df`, `loc`, and `scale` must be shaped in a way that -supports broadcasting (e.g. `df + loc + scale` is a valid operation). - -##### Args: - - -* `df`: Floating-point `Tensor`. The degrees of freedom of the - distribution(s). `df` must contain only positive values. -* `loc`: Floating-point `Tensor`. The mean(s) of the distribution(s). -* `scale`: Floating-point `Tensor`. The scaling factor(s) for the - distribution(s). Note that `scale` is not technically the standard - deviation of this distribution but has semantics more similar to - standard deviation than variance. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, - statistics (e.g., mean, mode, variance) use the value "`NaN`" to - indicate the result is undefined. When `False`, an exception is raised - if one or more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `TypeError`: if loc and scale are different dtypes. - - -- - - - -#### `tf.contrib.distributions.StudentT.allow_nan_stats` {#StudentT.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.StudentT.batch_shape` {#StudentT.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.StudentT.batch_shape_tensor(name='batch_shape_tensor')` {#StudentT.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentT.cdf(value, name='cdf')` {#StudentT.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentT.copy(**override_parameters_kwargs)` {#StudentT.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.StudentT.covariance(name='covariance')` {#StudentT.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.StudentT.df` {#StudentT.df} - -Degrees of freedom in these Student's t distribution(s). - - -- - - - -#### `tf.contrib.distributions.StudentT.dtype` {#StudentT.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.StudentT.entropy(name='entropy')` {#StudentT.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.StudentT.event_shape` {#StudentT.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.StudentT.event_shape_tensor(name='event_shape_tensor')` {#StudentT.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentT.is_continuous` {#StudentT.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.StudentT.is_scalar_batch(name='is_scalar_batch')` {#StudentT.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentT.is_scalar_event(name='is_scalar_event')` {#StudentT.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentT.loc` {#StudentT.loc} - -Locations of these Student's t distribution(s). - - -- - - - -#### `tf.contrib.distributions.StudentT.log_cdf(value, name='log_cdf')` {#StudentT.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentT.log_prob(value, name='log_prob')` {#StudentT.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentT.log_survival_function(value, name='log_survival_function')` {#StudentT.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentT.mean(name='mean')` {#StudentT.mean} - -Mean. - -Additional documentation from `StudentT`: - -The mean of Student's T equals `loc` if `df > 1`, otherwise it is -`NaN`. If `self.allow_nan_stats=True`, then an exception will be raised -rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.StudentT.mode(name='mode')` {#StudentT.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.StudentT.name` {#StudentT.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.StudentT.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#StudentT.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.StudentT.param_static_shapes(cls, sample_shape)` {#StudentT.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.StudentT.parameters` {#StudentT.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.StudentT.prob(value, name='prob')` {#StudentT.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentT.reparameterization_type` {#StudentT.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.StudentT.sample(sample_shape=(), seed=None, name='sample')` {#StudentT.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.StudentT.scale` {#StudentT.scale} - -Scaling factors of these Student's t distribution(s). - - -- - - - -#### `tf.contrib.distributions.StudentT.stddev(name='stddev')` {#StudentT.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.StudentT.survival_function(value, name='survival_function')` {#StudentT.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentT.validate_args` {#StudentT.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.StudentT.variance(name='variance')` {#StudentT.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - - -Additional documentation from `StudentT`: - -The variance for Student's T equals - -``` -df / (df - 2), when df > 2 -infinity, when 1 < df <= 2 -NaN, when df <= 1 -``` - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.md deleted file mode 100644 index e21e0cca75..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.md +++ /dev/null @@ -1,583 +0,0 @@ -StudentT with `df = floor(abs(df))` and `scale = softplus(scale)`. -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.__init__(df, loc, scale, validate_args=False, allow_nan_stats=True, name='StudentTWithAbsDfSoftplusScale')` {#StudentTWithAbsDfSoftplusScale.__init__} - - - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.allow_nan_stats` {#StudentTWithAbsDfSoftplusScale.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.batch_shape` {#StudentTWithAbsDfSoftplusScale.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.batch_shape_tensor(name='batch_shape_tensor')` {#StudentTWithAbsDfSoftplusScale.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.cdf(value, name='cdf')` {#StudentTWithAbsDfSoftplusScale.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.copy(**override_parameters_kwargs)` {#StudentTWithAbsDfSoftplusScale.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.covariance(name='covariance')` {#StudentTWithAbsDfSoftplusScale.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.df` {#StudentTWithAbsDfSoftplusScale.df} - -Degrees of freedom in these Student's t distribution(s). - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.dtype` {#StudentTWithAbsDfSoftplusScale.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.entropy(name='entropy')` {#StudentTWithAbsDfSoftplusScale.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.event_shape` {#StudentTWithAbsDfSoftplusScale.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.event_shape_tensor(name='event_shape_tensor')` {#StudentTWithAbsDfSoftplusScale.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.is_continuous` {#StudentTWithAbsDfSoftplusScale.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.is_scalar_batch(name='is_scalar_batch')` {#StudentTWithAbsDfSoftplusScale.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.is_scalar_event(name='is_scalar_event')` {#StudentTWithAbsDfSoftplusScale.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.loc` {#StudentTWithAbsDfSoftplusScale.loc} - -Locations of these Student's t distribution(s). - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.log_cdf(value, name='log_cdf')` {#StudentTWithAbsDfSoftplusScale.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.log_prob(value, name='log_prob')` {#StudentTWithAbsDfSoftplusScale.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.log_survival_function(value, name='log_survival_function')` {#StudentTWithAbsDfSoftplusScale.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.mean(name='mean')` {#StudentTWithAbsDfSoftplusScale.mean} - -Mean. - -Additional documentation from `StudentT`: - -The mean of Student's T equals `loc` if `df > 1`, otherwise it is -`NaN`. If `self.allow_nan_stats=True`, then an exception will be raised -rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.mode(name='mode')` {#StudentTWithAbsDfSoftplusScale.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.name` {#StudentTWithAbsDfSoftplusScale.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#StudentTWithAbsDfSoftplusScale.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.param_static_shapes(cls, sample_shape)` {#StudentTWithAbsDfSoftplusScale.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.parameters` {#StudentTWithAbsDfSoftplusScale.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.prob(value, name='prob')` {#StudentTWithAbsDfSoftplusScale.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.reparameterization_type` {#StudentTWithAbsDfSoftplusScale.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.sample(sample_shape=(), seed=None, name='sample')` {#StudentTWithAbsDfSoftplusScale.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.scale` {#StudentTWithAbsDfSoftplusScale.scale} - -Scaling factors of these Student's t distribution(s). - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.stddev(name='stddev')` {#StudentTWithAbsDfSoftplusScale.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.survival_function(value, name='survival_function')` {#StudentTWithAbsDfSoftplusScale.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.validate_args` {#StudentTWithAbsDfSoftplusScale.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.StudentTWithAbsDfSoftplusScale.variance(name='variance')` {#StudentTWithAbsDfSoftplusScale.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - - -Additional documentation from `StudentT`: - -The variance for Student's T equals - -``` -df / (df - 2), when df > 2 -infinity, when 1 < df <= 2 -NaN, when df <= 1 -``` - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.TransformedDistribution.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.TransformedDistribution.md deleted file mode 100644 index 4c3d0fb0b2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.distributions.TransformedDistribution.md +++ /dev/null @@ -1,710 +0,0 @@ -A Transformed Distribution. - -A `TransformedDistribution` models `p(y)` given a base distribution `p(x)`, -and a deterministic, invertible, differentiable transform, `Y = g(X)`. The -transform is typically an instance of the `Bijector` class and the base -distribution is typically an instance of the `Distribution` class. - -A `Bijector` is expected to implement the following functions: -- `forward`, -- `inverse`, -- `inverse_log_det_jacobian`. -The semantics of these functions are outlined in the `Bijector` documentation. - -We now describe how a `TransformedDistribution` alters the input/outputs of a -`Distribution` associated with a random variable (rv) `X`. - -Write `cdf(Y=y)` for an absolutely continuous cumulative distribution function -of random variable `Y`; write the probability density function `pdf(Y=y) := -d^k / (dy_1,...,dy_k) cdf(Y=y)` for its derivative wrt to `Y` evaluated at -`y`. Assume that `Y = g(X)` where `g` is a deterministic diffeomorphism, -i.e., a non-random, continuous, differentiable, and invertible function. -Write the inverse of `g` as `X = g^{-1}(Y)` and `(J o g)(x)` for the Jacobian -of `g` evaluated at `x`. - -A `TransformedDistribution` implements the following operations: - - * `sample`: - - Mathematically: - - ```none - Y = g(X) - ``` - - Programmatically: - - ```python - return bijector.forward(distribution.sample(...)) - ``` - - * `log_prob`: - - Mathematically: - - ```none - (log o pdf)(Y=y) = (log o pdf o g^{-1})(y) + - (log o abs o det o J o g^{-1})(y) - ``` - - Programmatically: - - ```python - return (distribution.log_prob(bijector.inverse(y)) + - bijector.inverse_log_det_jacobian(y)) - ``` - - * `log_cdf`: - - Mathematically: - - ```none - (log o cdf)(Y=y) = (log o cdf o g^{-1})(y) - ``` - - Programmatically: - - ```python - return distribution.log_cdf(bijector.inverse(x)) - ``` - - * and similarly for: `cdf`, `prob`, `log_survival_function`, - `survival_function`. - -A simple example constructing a Log-Normal distribution from a Normal -distribution: - -```python -ds = tf.contrib.distributions -log_normal = ds.TransformedDistribution( - distribution=ds.Normal(loc=mu, scale=sigma), - bijector=ds.bijector.Exp(), - name="LogNormalTransformedDistribution") -``` - -A `LogNormal` made from callables: - -```python -ds = tf.contrib.distributions -log_normal = ds.TransformedDistribution( - distribution=ds.Normal(loc=mu, scale=sigma), - bijector=ds.bijector.Inline( - forward_fn=tf.exp, - inverse_fn=tf.log, - inverse_log_det_jacobian_fn=( - lambda y: -tf.reduce_sum(tf.log(y), axis=-1)), - name="LogNormalTransformedDistribution") -``` - -Another example constructing a Normal from a StandardNormal: - -```python -ds = tf.contrib.distributions -normal = ds.TransformedDistribution( - distribution=ds.Normal(loc=0, scale=1), - bijector=ds.bijector.ScaleAndShift(loc=mu, scale=sigma, event_ndims=0), - name="NormalTransformedDistribution") -``` - -A `TransformedDistribution`'s batch- and event-shape are implied by the base -distribution unless explicitly overridden by `batch_shape` or `event_shape` -arguments. Specifying an overriding `batch_shape` (`event_shape`) is -permitted only if the base distribution has scalar batch-shape (event-shape). -The bijector is applied to the distribution as if the distribution possessed -the overridden shape(s). The following example demonstrates how to construct a -multivariate Normal as a `TransformedDistribution`. - -```python -bs = tf.contrib.distributions.bijector -ds = tf.contrib.distributions -# We will create two MVNs with batch_shape = event_shape = 2. -mean = [[-1., 0], # batch:0 - [0., 1]] # batch:1 -chol_cov = [[[1., 0], - [0, 1]], # batch:0 - [[1, 0], - [2, 2]]] # batch:1 -mvn1 = ds.TransformedDistribution( - distribution=ds.Normal(loc=0., scale=1.), - bijector=bs.Affine(shift=mean, tril=chol_cov), - batch_shape=[2], # Valid because base_distribution.batch_shape == []. - event_shape=[2]) # Valid because base_distribution.event_shape == []. -mvn2 = ds.MultivariateNormalTriL(loc=mean, scale_tril=chol_cov) -# mvn1.log_prob(x) == mvn2.log_prob(x) -``` -- - - - -#### `tf.contrib.distributions.TransformedDistribution.__init__(distribution, bijector=None, batch_shape=None, event_shape=None, validate_args=False, name=None)` {#TransformedDistribution.__init__} - -Construct a Transformed Distribution. - -##### Args: - - -* `distribution`: The base distribution instance to transform. Typically an - instance of `Distribution`. -* `bijector`: The object responsible for calculating the transformation. - Typically an instance of `Bijector`. `None` means `Identity()`. -* `batch_shape`: `integer` vector `Tensor` which overrides `distribution` - `batch_shape`; valid only if `distribution.is_scalar_batch()`. -* `event_shape`: `integer` vector `Tensor` which overrides `distribution` - `event_shape`; valid only if `distribution.is_scalar_event()`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `name`: Python `str` name prefixed to Ops created by this class. Default: - `bijector.name + distribution.name`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.allow_nan_stats` {#TransformedDistribution.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.batch_shape` {#TransformedDistribution.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.batch_shape_tensor(name='batch_shape_tensor')` {#TransformedDistribution.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.bijector` {#TransformedDistribution.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.cdf(value, name='cdf')` {#TransformedDistribution.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.copy(**override_parameters_kwargs)` {#TransformedDistribution.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.covariance(name='covariance')` {#TransformedDistribution.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.distribution` {#TransformedDistribution.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.dtype` {#TransformedDistribution.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.entropy(name='entropy')` {#TransformedDistribution.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.event_shape` {#TransformedDistribution.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.event_shape_tensor(name='event_shape_tensor')` {#TransformedDistribution.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.is_continuous` {#TransformedDistribution.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.is_scalar_batch(name='is_scalar_batch')` {#TransformedDistribution.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.is_scalar_event(name='is_scalar_event')` {#TransformedDistribution.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.log_cdf(value, name='log_cdf')` {#TransformedDistribution.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.log_prob(value, name='log_prob')` {#TransformedDistribution.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.log_survival_function(value, name='log_survival_function')` {#TransformedDistribution.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.mean(name='mean')` {#TransformedDistribution.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.mode(name='mode')` {#TransformedDistribution.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.name` {#TransformedDistribution.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#TransformedDistribution.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.param_static_shapes(cls, sample_shape)` {#TransformedDistribution.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.parameters` {#TransformedDistribution.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.prob(value, name='prob')` {#TransformedDistribution.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.reparameterization_type` {#TransformedDistribution.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.sample(sample_shape=(), seed=None, name='sample')` {#TransformedDistribution.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.stddev(name='stddev')` {#TransformedDistribution.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.survival_function(value, name='survival_function')` {#TransformedDistribution.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.validate_args` {#TransformedDistribution.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.TransformedDistribution.variance(name='variance')` {#TransformedDistribution.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.get_graph_from_inputs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.get_graph_from_inputs.md deleted file mode 100644 index d7f0016029..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.get_graph_from_inputs.md +++ /dev/null @@ -1,32 +0,0 @@ -### `tf.contrib.framework.get_graph_from_inputs(op_input_list, graph=None)` {#get_graph_from_inputs} - -Returns the appropriate graph to use for the given inputs. - -1. If `graph` is provided, we validate that all inputs in `op_input_list` are - from the same graph. -2. Otherwise, we attempt to select a graph from the first Operation- or - Tensor-valued input in `op_input_list`, and validate that all other - such inputs are in the same graph. -3. If the graph was not specified and it could not be inferred from - `op_input_list`, we attempt to use the default graph. - -##### Args: - - -* `op_input_list`: A list of inputs to an operation, which may include `Tensor`, - `Operation`, and other objects that may be converted to a graph element. -* `graph`: (Optional) The explicit graph to use. - -##### Raises: - - -* `TypeError`: If `op_input_list` is not a list or tuple, or if graph is not a - Graph. -* `ValueError`: If a graph is explicitly passed and not all inputs are from it, - or if the inputs are from multiple graphs, or we could not find a graph - and there was no default graph. - -##### Returns: - - The appropriate graph to use for the given inputs. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.get_local_variables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.get_local_variables.md deleted file mode 100644 index 94c9fc96d9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.get_local_variables.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.contrib.framework.get_local_variables(scope=None, suffix=None)` {#get_local_variables} - -Gets the list of local variables, filtered by scope and/or suffix. - -##### Args: - - -* `scope`: an optional scope for filtering the variables to return. -* `suffix`: an optional suffix for filtering the variables to return. - -##### Returns: - - a list of variables in collection with scope and suffix. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.get_variables_by_name.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.get_variables_by_name.md deleted file mode 100644 index a76f564a1d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.get_variables_by_name.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.contrib.framework.get_variables_by_name(given_name, scope=None)` {#get_variables_by_name} - -Gets the list of variables that were given that name. - -##### Args: - - -* `given_name`: name given to the variable without any scope. -* `scope`: an optional scope for filtering the variables to return. - -##### Returns: - - a copied list of variables with the given name and scope. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.init_from_checkpoint.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.init_from_checkpoint.md deleted file mode 100644 index 9d3ee1d24a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.framework.init_from_checkpoint.md +++ /dev/null @@ -1,72 +0,0 @@ -### `tf.contrib.framework.init_from_checkpoint(checkpoint_dir, assignment_map)` {#init_from_checkpoint} - -Using assingment map initializes current variables with loaded tensors. - -Note: This overrides default initialization ops of specified variables and -redefines dtype. - -##### Assignment map supports following syntax: - - `'checkpoint_scope_name/': 'scope_name/'` - will load all variables in - current `scope_name` from `checkpoint_scope_name` with matching variable - names. - `'checkpoint_scope_name/some_other_variable': 'scope_name/variable_name'` - - will initalize `scope_name/variable_name` variable - from `checkpoint_scope_name/some_other_variable`. - `'scope_variable_name': variable` - will initialize given `tf.Variable` - object with variable from the checkpoint. - `'scope_variable_name': list(variable)` - will initialize list of - partitioned variables with variable from the checkpoint. - `'/': 'scope_name/'` - will load all variables in current `scope_name` from - checkpoint's root (e.g. no scope). - -Supports loading into partitioned variables, which are represented as -'/part_'. - - -* `Example`: -```python - # Create variables. - with tf.variable_scope('test'): - m = tf.get_variable('my_var') - with tf.variable_scope('test2'): - var2 = tf.get_variable('my_var') - var3 = tf.get_variable(name="my1", shape=[100, 100], - partitioner=lambda shape, dtype: [5, 1]) - ... - # Specify which variables to intialize from checkpoint. - init_from_checkpoint(checkpoint_dir, { - 'some_var': 'test/my_var', - 'some_scope/': 'test2/'}) - ... - # Or use `Variable` objects to identify what to initialize. - init_from_checkpoint(checkpoint_dir, { - 'some_scope/var2': var2, - }) - # Initialize partitioned variables - init_from_checkpoint(checkpoint_dir, { - 'some_var_from_ckpt': 'part_var', - }) - # Or specifying the list of `Variable` objects. - init_from_checkpoint(checkpoint_dir, { - 'some_var_from_ckpt': var3._get_variable_list(), - }) - ... - # Initialize variables as usual. - session.run(tf.get_all_variables()) -``` - -##### Args: - - -* `checkpoint_dir`: Directory with checkpoints file or path to checkpoint. -* `assignment_map`: Dict, where keys are names of the variables in the - checkpoint and values are current variables or names of current variables - (in default graph). - -##### Raises: - - tf.errors.OpError: If missing checkpoints or tensors in checkpoints. - -* `ValueError`: If missing variables in current graph. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.compute_boundary_ts.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.compute_boundary_ts.md deleted file mode 100644 index 27ad95be99..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.compute_boundary_ts.md +++ /dev/null @@ -1,32 +0,0 @@ -### `tf.contrib.graph_editor.compute_boundary_ts(ops)` {#compute_boundary_ts} - -Compute the tensors at the boundary of a set of ops. - -This function looks at all the tensors connected to the given ops (in/out) -and classify them into three categories: -1) input tensors: tensors whose generating operation is not in ops. -2) output tensors: tensors whose consumer operations are not in ops -3) inside tensors: tensors which are neither input nor output tensors. - -Note that a tensor can be both an inside tensor and an output tensor if it is -consumed by operations both outside and inside of `ops`. - -##### Args: - - -* `ops`: an object convertible to a list of tf.Operation. - -##### Returns: - - A tuple `(outside_input_ts, outside_output_ts, inside_ts)` where: - `outside_input_ts` is a Python list of input tensors; - `outside_output_ts` is a python list of output tensors; - `inside_ts` is a python list of inside tensors. - Since a tensor can be both an inside tensor and an output tensor, - `outside_output_ts` and `inside_ts` might intersect. - -##### Raises: - - -* `TypeError`: if ops cannot be converted to a list of tf.Operation. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.get_name_scope_ops.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.get_name_scope_ops.md deleted file mode 100644 index 462ae97e17..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.get_name_scope_ops.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.contrib.graph_editor.get_name_scope_ops(ops, scope)` {#get_name_scope_ops} - -Get all the operations under the given scope path. - -##### Args: - - -* `ops`: an object convertible to a list of tf.Operation. -* `scope`: a scope path. - -##### Returns: - - A list of tf.Operation. - -##### Raises: - - -* `TypeError`: if ops cannot be converted to a list of tf.Operation. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.make_list_of_t.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.make_list_of_t.md deleted file mode 100644 index c67586bcf8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.make_list_of_t.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.contrib.graph_editor.make_list_of_t(ts, check_graph=True, allow_graph=True, ignore_ops=False)` {#make_list_of_t} - -Convert ts to a list of `tf.Tensor`. - -##### Args: - - -* `ts`: can be an iterable of `tf.Tensor`, a `tf.Graph` or a single tensor. -* `check_graph`: if `True` check if all the tensors belong to the same graph. -* `allow_graph`: if `False` a `tf.Graph` cannot be converted. -* `ignore_ops`: if `True`, silently ignore `tf.Operation`. - -##### Returns: - - A newly created list of `tf.Tensor`. - -##### Raises: - - -* `TypeError`: if `ts` cannot be converted to a list of `tf.Tensor` or, - if `check_graph` is `True`, if all the ops do not belong to the same graph. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.reroute_ios.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.reroute_ios.md deleted file mode 100644 index 0979bf0e0f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.reroute_ios.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.graph_editor.reroute_ios(sgv0, sgv1)` {#reroute_ios} - -Re-route the inputs and outputs of sgv0 to sgv1 (see _reroute). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.transform_op_if_inside_handler.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.transform_op_if_inside_handler.md deleted file mode 100644 index 176ed58f08..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.graph_editor.transform_op_if_inside_handler.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.contrib.graph_editor.transform_op_if_inside_handler(info, op, keep_if_possible=True)` {#transform_op_if_inside_handler} - -Transform an optional op only if it is inside the subgraph. - -This handler is typically use to handle original op: it is fine to keep them -if they are inside the subgraph, otherwise they are just ignored. - -##### Args: - - -* `info`: Transform._TmpInfo instance. -* `op`: the optional op to transform (or ignore). -* `keep_if_possible`: re-attach to the original op if possible, that is, - if the source graph and the destination graph are the same. - -##### Returns: - - The transformed op or None. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.integrate.odeint.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.integrate.odeint.md deleted file mode 100644 index 25b2709be8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.integrate.odeint.md +++ /dev/null @@ -1,90 +0,0 @@ -### `tf.contrib.integrate.odeint(func, y0, t, rtol=1e-06, atol=1e-12, method=None, options=None, full_output=False, name=None)` {#odeint} - -Integrate a system of ordinary differential equations. - -Solves the initial value problem for a non-stiff system of first order ode-s: - - ``` - dy/dt = func(y, t), y(t[0]) = y0 - ``` - -where y is a Tensor of any shape. - -For example: - - ``` - # solve `dy/dt = -y`, corresponding to exponential decay - tf.contrib.integrate.odeint(lambda y, _: -y, 1.0, [0, 1, 2]) - => [1, exp(-1), exp(-2)] - ``` - -Output dtypes and numerical precision are based on the dtypes of the inputs -`y0` and `t`. - -Currently, implements 5th order Runge-Kutta with adaptive step size control -and dense output, using the Dormand-Prince method. Similar to the 'dopri5' -method of `scipy.integrate.ode` and MATLAB's `ode45`. - -Based on: Shampine, Lawrence F. (1986), "Some Practical Runge-Kutta Formulas", -Mathematics of Computation, American Mathematical Society, 46 (173): 135-150, -doi:10.2307/2008219 - -##### Args: - - -* `func`: Function that maps a Tensor holding the state `y` and a scalar Tensor - `t` into a Tensor of state derivatives with respect to time. -* `y0`: N-D Tensor giving starting value of `y` at time point `t[0]`. May - have any floating point or complex dtype. -* `t`: 1-D Tensor holding a sequence of time points for which to solve for - `y`. The initial time point should be the first element of this sequence, - and each time must be larger than the previous time. May have any floating - point dtype. If not provided as a Tensor, converted to a Tensor with - float64 dtype. -* `rtol`: optional float64 Tensor specifying an upper bound on relative error, - per element of `y`. -* `atol`: optional float64 Tensor specifying an upper bound on absolute error, - per element of `y`. -* `method`: optional string indicating the integration method to use. Currently, - the only valid option is `'dopri5'`. -* `options`: optional dict of configuring options for the indicated integration - method. Can only be provided if a `method` is explicitly set. For - `'dopri5'`, valid options include: - * first_step: an initial guess for the size of the first integration - (current default: 1.0, but may later be changed to use heuristics based - on the gradient). - * safety: safety factor for adaptive step control, generally a constant - in the range 0.8-1 (default: 0.9). - * ifactor: maximum factor by which the adaptive step may be increased - (default: 10.0). - * dfactor: maximum factor by which the adpative step may be decreased - (default: 0.2). - * max_num_steps: integer maximum number of integrate steps between time - points in `t` (default: 1000). -* `full_output`: optional boolean. If True, `odeint` returns a tuple - `(y, info_dict)` describing the integration process. -* `name`: Optional name for this operation. - -##### Returns: - - -* `y`: (N+1)-D tensor, where the first dimension corresponds to different - time points. Contains the solved value of y for each desired time point in - `t`, with the initial value `y0` being the first element along the first - dimension. -* `info_dict`: only if `full_output == True`. A dict with the following values: - * num_func_evals: integer Tensor counting the number of function - evaluations. - * integrate_points: 1D float64 Tensor with the upper bound of each - integration time step. - * error_ratio: 1D float Tensor with the estimated ratio of the integration - error to the error tolerance at each integration step. An ratio greater - than 1 corresponds to rejected steps. - -##### Raises: - - -* `ValueError`: if an invalid `method` is provided. -* `TypeError`: if `options` is supplied without `method`, or if `t` or `y0` has - an invalid dtype. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.embedding_column.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.embedding_column.md deleted file mode 100644 index 30c543c631..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.embedding_column.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.contrib.layers.embedding_column(sparse_id_column, dimension, combiner='mean', initializer=None, ckpt_to_load_from=None, tensor_name_in_ckpt=None, max_norm=None)` {#embedding_column} - -Creates an `_EmbeddingColumn` for feeding sparse data into a DNN. - -##### Args: - - -* `sparse_id_column`: A `_SparseColumn` which is created by for example - `sparse_column_with_*` or crossed_column functions. Note that `combiner` - defined in `sparse_id_column` is ignored. -* `dimension`: An integer specifying dimension of the embedding. -* `combiner`: A string specifying how to reduce if there are multiple entries - in a single row. Currently "mean", "sqrtn" and "sum" are supported, with - "mean" the default. "sqrtn" often achieves good accuracy, in particular - with bag-of-words columns. Each of this can be thought as example level - normalizations on the column: - * "sum": do not normalize - * "mean": do l1 normalization - * "sqrtn": do l2 normalization - For more information: `tf.embedding_lookup_sparse`. -* `initializer`: A variable initializer function to be used in embedding - variable initialization. If not specified, defaults to - `tf.truncated_normal_initializer` with mean 0.0 and standard deviation - 1/sqrt(sparse_id_column.length). -* `ckpt_to_load_from`: (Optional). String representing checkpoint name/pattern - to restore the column weights. Required if `tensor_name_in_ckpt` is not - None. -* `tensor_name_in_ckpt`: (Optional). Name of the `Tensor` in the provided - checkpoint from which to restore the column weights. Required if - `ckpt_to_load_from` is not None. -* `max_norm`: (Optional). If not None, embedding values are l2-normalized to - the value of max_norm. - -##### Returns: - - An `_EmbeddingColumn`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.flatten.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.flatten.md deleted file mode 100644 index e7de4571b0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.flatten.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.contrib.layers.flatten(*args, **kwargs)` {#flatten} - -Flattens the input while maintaining the batch_size. - - Assumes that the first dimension represents the batch. - -##### Args: - - -* `inputs`: A tensor of size [batch_size, ...]. -* `outputs_collections`: Collection to add the outputs. -* `scope`: Optional scope for name_scope. - -##### Returns: - - A flattened tensor with shape [batch_size, k]. - -##### Raises: - - -* `ValueError`: If inputs rank is unknown or less than 2. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.make_place_holder_tensors_for_base_features.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.make_place_holder_tensors_for_base_features.md deleted file mode 100644 index bc6cc5ccc3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.make_place_holder_tensors_for_base_features.md +++ /dev/null @@ -1,15 +0,0 @@ -### `tf.contrib.layers.make_place_holder_tensors_for_base_features(feature_columns)` {#make_place_holder_tensors_for_base_features} - -Returns placeholder tensors for inference. - -##### Args: - - -* `feature_columns`: An iterable containing all the feature columns. All items - should be instances of classes derived from _FeatureColumn. - -##### Returns: - - A dict mapping feature keys to SparseTensors (sparse columns) or - placeholder Tensors (dense columns). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.summarize_tensors.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.summarize_tensors.md deleted file mode 100644 index 608999b437..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.layers.summarize_tensors.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.layers.summarize_tensors(tensors, summarizer=summarize_tensor)` {#summarize_tensors} - -Summarize a set of tensors. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.LinearClassifier.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.LinearClassifier.md deleted file mode 100644 index 5b70ba0493..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.LinearClassifier.md +++ /dev/null @@ -1,467 +0,0 @@ -Linear classifier model. - -Train a linear model to classify instances into one of multiple possible -classes. When number of possible classes is 2, this is binary classification. - -Example: - -```python -sparse_column_a = sparse_column_with_hash_bucket(...) -sparse_column_b = sparse_column_with_hash_bucket(...) - -sparse_feature_a_x_sparse_feature_b = crossed_column(...) - -# Estimator using the default optimizer. -estimator = LinearClassifier( - feature_columns=[sparse_column_a, sparse_feature_a_x_sparse_feature_b]) - -# Or estimator using the FTRL optimizer with regularization. -estimator = LinearClassifier( - feature_columns=[sparse_column_a, sparse_feature_a_x_sparse_feature_b], - optimizer=tf.train.FtrlOptimizer( - learning_rate=0.1, - l1_regularization_strength=0.001 - )) - -# Or estimator using the SDCAOptimizer. -estimator = LinearClassifier( - feature_columns=[sparse_column_a, sparse_feature_a_x_sparse_feature_b], - optimizer=tf.contrib.linear_optimizer.SDCAOptimizer( - example_id_column='example_id', - num_loss_partitions=..., - symmetric_l2_regularization=2.0 - )) - -# Input builders -def input_fn_train: # returns x, y (where y represents label's class index). - ... -def input_fn_eval: # returns x, y (where y represents label's class index). - ... -estimator.fit(input_fn=input_fn_train) -estimator.evaluate(input_fn=input_fn_eval) -estimator.predict(x=x) # returns predicted labels (i.e. label's class index). -``` - -Input of `fit` and `evaluate` should have following features, - otherwise there will be a `KeyError`: - -* if `weight_column_name` is not `None`, a feature with - `key=weight_column_name` whose value is a `Tensor`. -* for each `column` in `feature_columns`: - - if `column` is a `SparseColumn`, a feature with `key=column.name` - whose `value` is a `SparseTensor`. - - if `column` is a `WeightedSparseColumn`, two features: the first with - `key` the id column name, the second with `key` the weight column name. - Both features' `value` must be a `SparseTensor`. - - if `column` is a `RealValuedColumn`, a feature with `key=column.name` - whose `value` is a `Tensor`. -- - - - -#### `tf.contrib.learn.LinearClassifier.__init__(feature_columns, model_dir=None, n_classes=2, weight_column_name=None, optimizer=None, gradient_clip_norm=None, enable_centered_bias=False, _joint_weight=False, config=None, feature_engineering_fn=None)` {#LinearClassifier.__init__} - -Construct a `LinearClassifier` estimator object. - -##### Args: - - -* `feature_columns`: An iterable containing all the feature columns used by - the model. All items in the set should be instances of classes derived - from `FeatureColumn`. -* `model_dir`: Directory to save model parameters, graph and etc. This can - also be used to load checkpoints from the directory into a estimator - to continue training a previously saved model. -* `n_classes`: number of label classes. Default is binary classification. - Note that class labels are integers representing the class index (i.e. - values from 0 to n_classes-1). For arbitrary label values (e.g. string - labels), convert to class indices first. -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. It - will be multiplied by the loss of the example. -* `optimizer`: The optimizer used to train the model. If specified, it should - be either an instance of `tf.Optimizer` or the SDCAOptimizer. If `None`, - the Ftrl optimizer will be used. -* `gradient_clip_norm`: A `float` > 0. If provided, gradients are clipped - to their global norm with this clipping ratio. See - `tf.clip_by_global_norm` for more details. -* `enable_centered_bias`: A bool. If True, estimator will learn a centered - bias variable for each class. Rest of the model structure learns the - residual after centered bias. - _joint_weight: If True, the weights for all columns will be stored in a - single (possibly partitioned) variable. It's more efficient, but it's - incompatible with SDCAOptimizer, and requires all feature columns are - sparse and use the 'sum' combiner. - -* `config`: `RunConfig` object to configure the runtime settings. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into the model. - -##### Returns: - - A `LinearClassifier` estimator. - -##### Raises: - - -* `ValueError`: if n_classes < 2. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.__repr__()` {#LinearClassifier.__repr__} - - - - -- - - - -#### `tf.contrib.learn.LinearClassifier.bias_` {#LinearClassifier.bias_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - -- - - - -#### `tf.contrib.learn.LinearClassifier.config` {#LinearClassifier.config} - - - - -- - - - -#### `tf.contrib.learn.LinearClassifier.evaluate(*args, **kwargs)` {#LinearClassifier.evaluate} - -See `Evaluable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If at least one of `x` or `y` is provided, and at least one of - `input_fn` or `feed_fn` is provided. - Or if `metrics` is not `None` or `dict`. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.export(export_dir, input_fn=None, input_feature_key=None, use_deprecated_input_fn=True, signature_fn=None, default_batch_size=1, exports_to_keep=None)` {#LinearClassifier.export} - -See BaseEstimator.export. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#LinearClassifier.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.fit(*args, **kwargs)` {#LinearClassifier.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.get_params(deep=True)` {#LinearClassifier.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.get_variable_names()` {#LinearClassifier.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.get_variable_value(name)` {#LinearClassifier.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.model_dir` {#LinearClassifier.model_dir} - - - - -- - - - -#### `tf.contrib.learn.LinearClassifier.partial_fit(*args, **kwargs)` {#LinearClassifier.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.predict(*args, **kwargs)` {#LinearClassifier.predict} - -Returns predictions for given features. (deprecated arguments) (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2017-03-01. -Instructions for updating: -Please switch to predict_classes, or set `outputs` argument. - -By default, returns predicted classes. But this default will be dropped -soon. Users should either pass `outputs`, or call `predict_classes` method. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns classes. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted classes with shape [batch_size] (or an iterable - of predicted classes if as_iterable is True). Each predicted class is - represented by its class index (i.e. integer from 0 to n_classes-1). - If `outputs` is set, returns a dict of predictions. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.predict_classes(*args, **kwargs)` {#LinearClassifier.predict_classes} - -Returns predicted classes for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted classes with shape [batch_size] (or an iterable - of predicted classes if as_iterable is True). Each predicted class is - represented by its class index (i.e. integer from 0 to n_classes-1). - - -- - - - -#### `tf.contrib.learn.LinearClassifier.predict_proba(*args, **kwargs)` {#LinearClassifier.predict_proba} - -Returns predicted probabilities for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x and y must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted probabilities with shape [batch_size, n_classes] - (or an iterable of predicted probabilities if as_iterable is True). - - -- - - - -#### `tf.contrib.learn.LinearClassifier.set_params(**params)` {#LinearClassifier.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - -- - - - -#### `tf.contrib.learn.LinearClassifier.weights_` {#LinearClassifier.weights_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.PredictionKey.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.PredictionKey.md deleted file mode 100644 index 8b13789179..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.PredictionKey.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.extract_pandas_data.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.extract_pandas_data.md deleted file mode 100644 index 6b1956884d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.extract_pandas_data.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.contrib.learn.extract_pandas_data(data)` {#extract_pandas_data} - -Extract data from pandas.DataFrame for predictors. - -Given a DataFrame, will extract the values and cast them to float. The -DataFrame is expected to contain values of type int, float or bool. - -##### Args: - - -* `data`: `pandas.DataFrame` containing the data to be extracted. - -##### Returns: - - A numpy `ndarray` of the DataFrame's values as floats. - -##### Raises: - - -* `ValueError`: if data contains types other than int, float or bool. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.infer_real_valued_columns_from_input_fn.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.infer_real_valued_columns_from_input_fn.md deleted file mode 100644 index e1ac197953..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.infer_real_valued_columns_from_input_fn.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.contrib.learn.infer_real_valued_columns_from_input_fn(input_fn)` {#infer_real_valued_columns_from_input_fn} - -Creates `FeatureColumn` objects for inputs defined by `input_fn`. - -This interprets all inputs as dense, fixed-length float values. This creates -a local graph in which it calls `input_fn` to build the tensors, then discards -it. - -##### Args: - - -* `input_fn`: Input function returning a tuple of: - features - Dictionary of string feature name to `Tensor` or `Tensor`. - labels - `Tensor` of label values. - -##### Returns: - - List of `FeatureColumn` objects. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.monitors.SummaryWriterCache.get.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.monitors.SummaryWriterCache.get.md deleted file mode 100644 index 35b49b99cf..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.monitors.SummaryWriterCache.get.md +++ /dev/null @@ -1,13 +0,0 @@ -#### `tf.contrib.learn.monitors.SummaryWriterCache.get(logdir)` {#SummaryWriterCache.get} - -Returns the FileWriter for the specified directory. - -##### Args: - - -* `logdir`: str, name of the directory. - -##### Returns: - - A `FileWriter`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.monitors.ValidationMonitor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.monitors.ValidationMonitor.md deleted file mode 100644 index b24a86f1e1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.monitors.ValidationMonitor.md +++ /dev/null @@ -1,242 +0,0 @@ -Runs evaluation of a given estimator, at most every N steps. - -Note that the evaluation is done based on the saved checkpoint, which will -usually be older than the current step. - -Can do early stopping on validation metrics if `early_stopping_rounds` is -provided. -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.__init__(x=None, y=None, input_fn=None, batch_size=None, eval_steps=None, every_n_steps=100, metrics=None, hooks=None, early_stopping_rounds=None, early_stopping_metric='loss', early_stopping_metric_minimize=True, name=None)` {#ValidationMonitor.__init__} - -Initializes a ValidationMonitor. - -##### Args: - - -* `x`: See `BaseEstimator.evaluate`. -* `y`: See `BaseEstimator.evaluate`. -* `input_fn`: See `BaseEstimator.evaluate`. -* `batch_size`: See `BaseEstimator.evaluate`. -* `eval_steps`: See `BaseEstimator.evaluate`. -* `every_n_steps`: Check for new checkpoints to evaluate every N steps. If a - new checkpoint is found, it is evaluated. See `EveryN`. -* `metrics`: See `BaseEstimator.evaluate`. -* `hooks`: A list of `SessionRunHook` hooks to pass to the - `Estimator`'s `evaluate` function. -* `early_stopping_rounds`: `int`. If the metric indicated by - `early_stopping_metric` does not change according to - `early_stopping_metric_minimize` for this many steps, then training - will be stopped. -* `early_stopping_metric`: `string`, name of the metric to check for early - stopping. -* `early_stopping_metric_minimize`: `bool`, True if `early_stopping_metric` is - expected to decrease (thus early stopping occurs when this metric - stops decreasing), False if `early_stopping_metric` is expected to - increase. Typically, `early_stopping_metric_minimize` is True for - loss metrics like mean squared error, and False for performance - metrics like accuracy. -* `name`: See `BaseEstimator.evaluate`. - -##### Raises: - - -* `ValueError`: If both x and input_fn are provided. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.begin(max_steps=None)` {#ValidationMonitor.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.best_step` {#ValidationMonitor.best_step} - -Returns the step at which the best early stopping metric was found. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.best_value` {#ValidationMonitor.best_value} - -Returns the best early stopping metric value found so far. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.early_stopped` {#ValidationMonitor.early_stopped} - -Returns True if this monitor caused an early stop. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.end(session=None)` {#ValidationMonitor.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.epoch_begin(epoch)` {#ValidationMonitor.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.epoch_end(epoch)` {#ValidationMonitor.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.every_n_post_step(step, session)` {#ValidationMonitor.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.every_n_step_begin(step)` {#ValidationMonitor.every_n_step_begin} - -Callback before every n'th step begins. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list` of tensors that will be evaluated at this step. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.every_n_step_end(step, outputs)` {#ValidationMonitor.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.post_step(step, session)` {#ValidationMonitor.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.run_on_all_workers` {#ValidationMonitor.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.set_estimator(estimator)` {#ValidationMonitor.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.step_begin(step)` {#ValidationMonitor.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.ValidationMonitor.step_end(step, output)` {#ValidationMonitor.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.train.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.train.md deleted file mode 100644 index 4158479faf..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.learn.train.md +++ /dev/null @@ -1,75 +0,0 @@ -### `tf.contrib.learn.train(*args, **kwargs)` {#train} - -Train a model. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-02-15. -Instructions for updating: -graph_actions.py will be deleted. Use tf.train.* utilities instead. You can use learn/estimators/estimator.py as an example. - -Given `graph`, a directory to write outputs to (`output_dir`), and some ops, -run a training loop. The given `train_op` performs one step of training on the -model. The `loss_op` represents the objective function of the training. It is -expected to increment the `global_step_tensor`, a scalar integer tensor -counting training steps. This function uses `Supervisor` to initialize the -graph (from a checkpoint if one is available in `output_dir`), write summaries -defined in the graph, and write regular checkpoints as defined by -`supervisor_save_model_secs`. - -Training continues until `global_step_tensor` evaluates to `max_steps`, or, if -`fail_on_nan_loss`, until `loss_op` evaluates to `NaN`. In that case the -program is terminated with exit code 1. - -##### Args: - - -* `graph`: A graph to train. It is expected that this graph is not in use - elsewhere. -* `output_dir`: A directory to write outputs to. -* `train_op`: An op that performs one training step when run. -* `loss_op`: A scalar loss tensor. -* `global_step_tensor`: A tensor representing the global step. If none is given, - one is extracted from the graph using the same logic as in `Supervisor`. -* `init_op`: An op that initializes the graph. If `None`, use `Supervisor`'s - default. -* `init_feed_dict`: A dictionary that maps `Tensor` objects to feed values. - This feed dictionary will be used when `init_op` is evaluated. -* `init_fn`: Optional callable passed to Supervisor to initialize the model. -* `log_every_steps`: Output logs regularly. The logs contain timing data and the - current loss. -* `supervisor_is_chief`: Whether the current process is the chief supervisor in - charge of restoring the model and running standard services. -* `supervisor_master`: The master string to use when preparing the session. -* `supervisor_save_model_secs`: Save a checkpoint every - `supervisor_save_model_secs` seconds when training. -* `keep_checkpoint_max`: The maximum number of recent checkpoint files to - keep. As new files are created, older files are deleted. If None or 0, - all checkpoint files are kept. This is simply passed as the max_to_keep - arg to tf.Saver constructor. -* `supervisor_save_summaries_steps`: Save summaries every - `supervisor_save_summaries_steps` seconds when training. -* `feed_fn`: A function that is called every iteration to produce a `feed_dict` - passed to `session.run` calls. Optional. -* `steps`: Trains for this many steps (e.g. current global step + `steps`). -* `fail_on_nan_loss`: If true, raise `NanLossDuringTrainingError` if `loss_op` - evaluates to `NaN`. If false, continue training as if nothing happened. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. -* `max_steps`: Number of total steps for which to train model. If `None`, - train forever. Two calls fit(steps=100) means 200 training iterations. - On the other hand two calls of fit(max_steps=100) means, second call - will not do any iteration since first call did all 100 steps. - -##### Returns: - - The final loss value. - -##### Raises: - - -* `ValueError`: If `output_dir`, `train_op`, `loss_op`, or `global_step_tensor` - is not provided. See `tf.contrib.framework.get_global_step` for how we - look up the latter if not provided explicitly. -* `NanLossDuringTrainingError`: If `fail_on_nan_loss` is `True`, and loss ever - evaluates to `NaN`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.linalg.LinearOperatorComposition.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.linalg.LinearOperatorComposition.md deleted file mode 100644 index a6654ab014..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.linalg.LinearOperatorComposition.md +++ /dev/null @@ -1,536 +0,0 @@ -Composes one or more `LinearOperators`. - -This operator composes one or more linear operators `[op1,...,opJ]`, -building a new `LinearOperator` with action defined by: - -``` -op_composed(x) := op1(op2(...(opJ(x)...)) -``` - -If `opj` acts like [batch] matrix `Aj`, then `op_composed` acts like the -[batch] matrix formed with the multiplication `A1 A2...AJ`. - -If `opj` has shape `batch_shape_j + [M_j, N_j]`, then we must have -`N_j = M_{j+1}`, in which case the composed operator has shape equal to -`broadcast_batch_shape + [M_1, N_J]`, where `broadcast_batch_shape` is the -mutual broadcast of `batch_shape_j`, `j = 1,...,J`, assuming the intermediate -batch shapes broadcast. Even if the composed shape is well defined, the -composed operator's methods may fail due to lack of broadcasting ability in -the defining operators' methods. - -```python -# Create a 2 x 2 linear operator composed of two 2 x 2 operators. -operator_1 = LinearOperatorMatrix([[1., 2.], [3., 4.]]) -operator_2 = LinearOperatorMatrix([[1., 0.], [0., 1.]]) -operator = LinearOperatorComposition([operator_1, operator_2]) - -operator.to_dense() -==> [[1., 2.] - [3., 4.]] - -operator.shape -==> [2, 2] - -operator.log_determinant() -==> scalar Tensor - -x = ... Shape [2, 4] Tensor -operator.apply(x) -==> Shape [2, 4] Tensor - -# Create a [2, 3] batch of 4 x 5 linear operators. -matrix_45 = tf.random_normal(shape=[2, 3, 4, 5]) -operator_45 = LinearOperatorMatrix(matrix) - -# Create a [2, 3] batch of 5 x 6 linear operators. -matrix_56 = tf.random_normal(shape=[2, 3, 5, 6]) -operator_56 = LinearOperatorMatrix(matrix_56) - -# Compose to create a [2, 3] batch of 4 x 6 operators. -opeartor_46 = LinearOperatorComposition([operator_45, operator_56]) - -# Create a shape [2, 3, 6, 2] vector. -x = tf.random_normal(shape=[2, 3, 6, 2]) -operator.apply(x) -==> Shape [2, 3, 4, 2] Tensor -``` - -#### Performance - -The performance of `LinearOperatorComposition` on any operation is equal to -the sum of the individual operators' operations. - - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite`. -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.__init__(operators, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, name=None)` {#LinearOperatorComposition.__init__} - -Initialize a `LinearOperatorComposition`. - -`LinearOperatorComposition` is initialized with a list of operators -`[op_1,...,op_J]`. For the `apply` method to be well defined, the -composition `op_i.apply(op_{i+1}(x))` must be defined. Other methods have -similar constraints. - -##### Args: - - -* `operators`: Iterable of `LinearOperator` objects, each with - the same `dtype` and composible shape. -* `is_non_singular`: Expect that this operator is non-singular. -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. -* `is_positive_definite`: Expect that this operator is positive definite, - meaning the real part of all eigenvalues is positive. We do not require - the operator to be self-adjoint to be positive-definite. See: -* `https`: //en.wikipedia.org/wiki/Positive-definite_matrix - #Extension_for_non_symmetric_matrices -* `name`: A name for this `LinearOperator`. Default is the individual - operators names joined with `_o_`. - -##### Raises: - - -* `TypeError`: If all operators do not have the same `dtype`. -* `ValueError`: If `operators` is empty. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.add_to_tensor(x, name='add_to_tensor')` {#LinearOperatorComposition.add_to_tensor} - -Add matrix represented by this operator to `x`. Equivalent to `A + x`. - -##### Args: - - -* `x`: `Tensor` with same `dtype` and shape broadcastable to `self.shape`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.apply(x, adjoint=False, name='apply')` {#LinearOperatorComposition.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.assert_non_singular(name='assert_non_singular')` {#LinearOperatorComposition.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.assert_positive_definite(name='assert_positive_definite')` {#LinearOperatorComposition.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperatorComposition.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.batch_shape` {#LinearOperatorComposition.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperatorComposition.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.determinant(name='det')` {#LinearOperatorComposition.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.diag_part(name='diag_part')` {#LinearOperatorComposition.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.domain_dimension` {#LinearOperatorComposition.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperatorComposition.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.dtype` {#LinearOperatorComposition.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.graph_parents` {#LinearOperatorComposition.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.is_non_singular` {#LinearOperatorComposition.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.is_positive_definite` {#LinearOperatorComposition.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.is_self_adjoint` {#LinearOperatorComposition.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.is_square` {#LinearOperatorComposition.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.log_abs_determinant(name='log_abs_det')` {#LinearOperatorComposition.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.name` {#LinearOperatorComposition.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.operators` {#LinearOperatorComposition.operators} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.range_dimension` {#LinearOperatorComposition.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperatorComposition.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.shape` {#LinearOperatorComposition.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.shape_tensor(name='shape_tensor')` {#LinearOperatorComposition.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.solve(rhs, adjoint=False, name='solve')` {#LinearOperatorComposition.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.tensor_rank` {#LinearOperatorComposition.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperatorComposition.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorComposition.to_dense(name='to_dense')` {#LinearOperatorComposition.to_dense} - -Return a dense (batch) matrix representing this operator. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.linalg.LinearOperatorIdentity.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.linalg.LinearOperatorIdentity.md deleted file mode 100644 index 80f6b13b73..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.linalg.LinearOperatorIdentity.md +++ /dev/null @@ -1,562 +0,0 @@ -`LinearOperator` acting like a [batch] square identity matrix. - -This operator acts like a [batch] identity matrix `A` with shape -`[B1,...,Bb, N, N]` for some `b >= 0`. The first `b` indices index a -batch member. For every batch index `(i1,...,ib)`, `A[i1,...,ib, : :]` is -an `N x N` matrix. This matrix `A` is not materialized, but for -purposes of broadcasting this shape will be relevant. - -`LinearOperatorIdentity` is initialized with `num_rows`, and optionally -`batch_shape`, and `dtype` arguments. If `batch_shape` is `None`, this -operator efficiently passes through all arguments. If `batch_shape` is -provided, broadcasting may occur, which will require making copies. - -```python -# Create a 2 x 2 identity matrix. -operator = LinearOperatorIdentity(num_rows=2, dtype=tf.float32) - -operator.to_dense() -==> [[1., 0.] - [0., 1.]] - -operator.shape -==> [2, 2] - -operator.log_determinant() -==> 0. - -x = ... Shape [2, 4] Tensor -operator.apply(x) -==> Shape [2, 4] Tensor, same as x. - -y = tf.random_normal(shape=[3, 2, 4]) -# Note that y.shape is compatible with operator.shape because operator.shape -# is broadcast to [3, 2, 2]. -# This broadcast does NOT require copying data, since we can infer that y -# will be passed through without changing shape. We are always able to infer -# this if the operator has no batch_shape. -x = operator.solve(y) -==> Shape [3, 2, 4] Tensor, same as y. - -# Create a 2-batch of 2x2 identity matrices -operator = LinearOperatorIdentity(num_rows=2, batch_shape=[2]) -operator.to_dense() -==> [[[1., 0.] - [0., 1.]], - [[1., 0.] - [0., 1.]]] - -# Here, even though the operator has a batch shape, the input is the same as -# the output, so x can be passed through without a copy. The operator is able -# to detect that no broadcast is necessary because both x and the operator -# have statically defined shape. -x = ... Shape [2, 2, 3] -operator.apply(x) -==> Shape [2, 2, 3] Tensor, same as x - -# Here the operator and x have different batch_shape, and are broadcast. -# This requires a copy, since the output is different size than the input. -x = ... Shape [1, 2, 3] -operator.apply(x) -==> Shape [2, 2, 3] Tensor, equal to [x, x] -``` - -### Shape compatibility - -This operator acts on [batch] matrix with compatible shape. -`x` is a batch matrix with compatible shape for `apply` and `solve` if - -``` -operator.shape = [B1,...,Bb] + [N, N], with b >= 0 -x.shape = [C1,...,Cc] + [N, R], -and [C1,...,Cc] broadcasts with [B1,...,Bb] to [D1,...,Dd] -``` - -### Performance - -If `batch_shape` initialization arg is `None`: - -* `operator.apply(x)` is `O(1)` -* `operator.solve(x)` is `O(1)` -* `operator.determinant()` is `O(1)` - -If `batch_shape` initialization arg is provided, and static checks cannot -rule out the need to broadcast: - -* `operator.apply(x)` is `O(D1*...*Dd*N*R)` -* `operator.solve(x)` is `O(D1*...*Dd*N*R)` -* `operator.determinant()` is `O(B1*...*Bb)` - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite`. -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.__init__(num_rows, batch_shape=None, dtype=None, is_non_singular=True, is_self_adjoint=True, is_positive_definite=True, assert_proper_shapes=False, name='LinearOperatorIdentity')` {#LinearOperatorIdentity.__init__} - -Initialize a `LinearOperatorIdentity`. - -The `LinearOperatorIdentity` is initialized with arguments defining `dtype` -and shape. - -This operator is able to broadcast the leading (batch) dimensions, which -sometimes requires copying data. If `batch_shape` is `None`, the operator -can take arguments of any batch shape without copying. See examples. - -##### Args: - - -* `num_rows`: Scalar non-negative integer `Tensor`. Number of rows in the - corresponding identity matrix. -* `batch_shape`: Optional `1-D` integer `Tensor`. The shape of the leading - dimensions. If `None`, this operator has no leading dimensions. -* `dtype`: Data type of the matrix that this operator represents. -* `is_non_singular`: Expect that this operator is non-singular. -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. -* `is_positive_definite`: Expect that this operator is positive definite. -* `assert_proper_shapes`: Python `bool`. If `False`, only perform static - checks that initialization and method arguments have proper shape. - If `True`, and static checks are inconclusive, add asserts to the graph. -* `name`: A name for this `LinearOperator` - -##### Raises: - - -* `ValueError`: If `num_rows` is determined statically to be non-scalar, or - negative. -* `ValueError`: If `batch_shape` is determined statically to not be 1-D, or - negative. -* `ValueError`: If any of the following is not `True`: - `{is_self_adjoint, is_non_singular, is_positive_definite}`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.add_to_tensor(mat, name='add_to_tensor')` {#LinearOperatorIdentity.add_to_tensor} - -Add matrix represented by this operator to `mat`. Equiv to `I + mat`. - -##### Args: - - -* `mat`: `Tensor` with same `dtype` and shape broadcastable to `self`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.apply(x, adjoint=False, name='apply')` {#LinearOperatorIdentity.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.assert_non_singular(name='assert_non_singular')` {#LinearOperatorIdentity.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.assert_positive_definite(name='assert_positive_definite')` {#LinearOperatorIdentity.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperatorIdentity.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.batch_shape` {#LinearOperatorIdentity.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperatorIdentity.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.determinant(name='det')` {#LinearOperatorIdentity.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.diag_part(name='diag_part')` {#LinearOperatorIdentity.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.domain_dimension` {#LinearOperatorIdentity.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperatorIdentity.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.dtype` {#LinearOperatorIdentity.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.graph_parents` {#LinearOperatorIdentity.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.is_non_singular` {#LinearOperatorIdentity.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.is_positive_definite` {#LinearOperatorIdentity.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.is_self_adjoint` {#LinearOperatorIdentity.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.is_square` {#LinearOperatorIdentity.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.log_abs_determinant(name='log_abs_det')` {#LinearOperatorIdentity.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.name` {#LinearOperatorIdentity.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.range_dimension` {#LinearOperatorIdentity.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperatorIdentity.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.shape` {#LinearOperatorIdentity.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.shape_tensor(name='shape_tensor')` {#LinearOperatorIdentity.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.solve(rhs, adjoint=False, name='solve')` {#LinearOperatorIdentity.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.tensor_rank` {#LinearOperatorIdentity.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperatorIdentity.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorIdentity.to_dense(name='to_dense')` {#LinearOperatorIdentity.to_dense} - -Return a dense (batch) matrix representing this operator. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.losses.absolute_difference.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.losses.absolute_difference.md deleted file mode 100644 index 1f900a6ffc..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.losses.absolute_difference.md +++ /dev/null @@ -1,35 +0,0 @@ -### `tf.contrib.losses.absolute_difference(*args, **kwargs)` {#absolute_difference} - -Adds an Absolute Difference loss to the training procedure. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.absolute_difference instead. - -`weights` acts as a coefficient for the loss. If a scalar is provided, then -the loss is simply scaled by the given value. If `weights` is a tensor of size -[batch_size], then the total loss for each sample of the batch is rescaled -by the corresponding element in the `weights` vector. If the shape of -`weights` matches the shape of `predictions`, then the loss of each -measurable element of `predictions` is scaled by the corresponding value of -`weights`. - -##### Args: - - -* `predictions`: The predicted outputs. -* `labels`: The ground truth output tensor, same dimensions as 'predictions'. -* `weights`: Coefficients for the loss a scalar, a tensor of shape - [batch_size] or a tensor whose shape matches `predictions`. -* `scope`: The scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the loss value. - -##### Raises: - - -* `ValueError`: If the shape of `predictions` doesn't match that of `labels` or - if the shape of `weights` is invalid. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.losses.compute_weighted_loss.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.losses.compute_weighted_loss.md deleted file mode 100644 index 6f7d92f7bb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.losses.compute_weighted_loss.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.contrib.losses.compute_weighted_loss(*args, **kwargs)` {#compute_weighted_loss} - -Computes the weighted loss. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.compute_weighted_loss instead. - -##### Args: - - -* `losses`: A tensor of size [batch_size, d1, ... dN]. -* `weights`: A tensor of size [1] or [batch_size, d1, ... dK] where K < N. -* `scope`: the scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` that returns the weighted loss. - -##### Raises: - - -* `ValueError`: If `weights` is `None` or the shape is not compatible with - `losses`, or if the number of dimensions (rank) of either `losses` or - `weights` is missing. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.losses.hinge_loss.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.losses.hinge_loss.md deleted file mode 100644 index ca98c0cc9f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.losses.hinge_loss.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.contrib.losses.hinge_loss(*args, **kwargs)` {#hinge_loss} - -Method that returns the loss tensor for hinge loss. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.hinge_loss instead. Note that the order of the predictions and labels arguments were changed. - -##### Args: - - -* `logits`: The logits, a float tensor. -* `labels`: The ground truth output tensor. Its shape should match the shape of - logits. The values of the tensor are expected to be 0.0 or 1.0. -* `scope`: The scope for the operations performed in computing the loss. - -##### Returns: - - A `Tensor` of same shape as `logits` and `labels` representing the loss - values across the batch. - -##### Raises: - - -* `ValueError`: If the shapes of `logits` and `labels` don't match. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.metrics.streaming_mean_squared_error.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.metrics.streaming_mean_squared_error.md deleted file mode 100644 index 285b2528e0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.metrics.streaming_mean_squared_error.md +++ /dev/null @@ -1,51 +0,0 @@ -### `tf.contrib.metrics.streaming_mean_squared_error(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_mean_squared_error} - -Computes the mean squared error between the labels and predictions. - -The `streaming_mean_squared_error` function creates two local variables, -`total` and `count` that are used to compute the mean squared error. -This average is weighted by `weights`, and it is ultimately returned as -`mean_squared_error`: an idempotent operation that simply divides `total` by -`count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`mean_squared_error`. Internally, a `squared_error` operation computes the -element-wise square of the difference between `predictions` and `labels`. Then -`update_op` increments `total` with the reduced sum of the product of -`weights` and `squared_error`, and it increments `count` with the reduced sum -of `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A `Tensor` of arbitrary shape. -* `labels`: A `Tensor` of the same shape as `predictions`. -* `weights`: Optional `Tensor` indicating the frequency with which an example is - sampled. Rank must be 0, or the same rank as `labels`, and must be - broadcastable to `labels` (i.e., all dimensions must be either `1`, or - the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that - `mean_squared_error` should be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `mean_squared_error`: A `Tensor` representing the current mean, the value of - `total` divided by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `mean_squared_error`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.metrics.streaming_sparse_recall_at_k.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.metrics.streaming_sparse_recall_at_k.md deleted file mode 100644 index 19259dd2f3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.metrics.streaming_sparse_recall_at_k.md +++ /dev/null @@ -1,74 +0,0 @@ -### `tf.contrib.metrics.streaming_sparse_recall_at_k(predictions, labels, k, class_id=None, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_sparse_recall_at_k} - -Computes recall@k of the predictions with respect to sparse labels. - -If `class_id` is not specified, we'll calculate recall as the ratio of true - positives (i.e., correct predictions, items in the top `k` highest - `predictions` that are found in the corresponding row in `labels`) to - actual positives (the full `labels` row). -If `class_id` is specified, we calculate recall by considering only the rows - in the batch for which `class_id` is in `labels`, and computing the - fraction of them for which `class_id` is in the corresponding row in - `labels`. - -`streaming_sparse_recall_at_k` creates two local variables, -`true_positive_at_` and `false_negative_at_`, that are used to compute -the recall_at_k frequency. This frequency is ultimately returned as -`recall_at_`: an idempotent operation that simply divides -`true_positive_at_` by total (`true_positive_at_` + -`false_negative_at_`). - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`recall_at_`. Internally, a `top_k` operation computes a `Tensor` -indicating the top `k` `predictions`. Set operations applied to `top_k` and -`labels` calculate the true positives and false negatives weighted by -`weights`. Then `update_op` increments `true_positive_at_` and -`false_negative_at_` using these values. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: Float `Tensor` with shape [D1, ... DN, num_classes] where - N >= 1. Commonly, N=1 and predictions has shape [batch size, num_classes]. - The final dimension contains the logit values for each class. [D1, ... DN] - must match `labels`. -* `labels`: `int64` `Tensor` or `SparseTensor` with shape - [D1, ... DN, num_labels], where N >= 1 and num_labels is the number of - target classes for the associated prediction. Commonly, N=1 and `labels` - has shape [batch_size, num_labels]. [D1, ... DN] must match `predictions`. - Values should be in range [0, num_classes), where num_classes is the last - dimension of `predictions`. Values outside this range always count - towards `false_negative_at_`. -* `k`: Integer, k for @k metric. -* `class_id`: Integer class ID for which we want binary metrics. This should be - in range [0, num_classes), where num_classes is the last dimension of - `predictions`. If class_id is outside this range, the method returns NAN. -* `weights`: `Tensor` whose rank is either 0, or n-1, where n is the rank of - `labels`. If the latter, it must be broadcastable to `labels` (i.e., all - dimensions must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that values should - be added to. -* `updates_collections`: An optional list of collections that updates should - be added to. -* `name`: Name of new update operation, and namespace for other dependent ops. - -##### Returns: - - -* `recall`: Scalar `float64` `Tensor` with the value of `true_positives` divided - by the sum of `true_positives` and `false_negatives`. -* `update_op`: `Operation` that increments `true_positives` and - `false_negatives` variables appropriately, and whose value matches - `recall`. - -##### Raises: - - -* `ValueError`: If `weights` is not `None` and its shape doesn't match - `predictions`, or if either `metrics_collections` or `updates_collections` - are not a list or tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.opt.VariableClippingOptimizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.opt.VariableClippingOptimizer.md deleted file mode 100644 index 7dac3ec66a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.opt.VariableClippingOptimizer.md +++ /dev/null @@ -1,66 +0,0 @@ -Wrapper optimizer that clips the norm of specified variables after update. - -This optimizer delegates all aspects of gradient calculation and application -to an underlying optimizer. After applying gradients, this optimizer then -clips the variable to have a maximum L2 norm along specified dimensions. -NB: this is quite different from clipping the norm of the gradients. - -Multiple instances of `VariableClippingOptimizer` may be chained to specify -different max norms for different subsets of variables. - -This is more efficient at serving-time than using normalization during -embedding lookup, at the expense of more expensive training and fewer -guarantees about the norms. - -- - - - -#### `tf.contrib.opt.VariableClippingOptimizer.__init__(opt, vars_to_clip_dims, max_norm, use_locking=False, colocate_clip_ops_with_vars=False, name='VariableClipping')` {#VariableClippingOptimizer.__init__} - -Construct a new clip-norm optimizer. - -##### Args: - - -* `opt`: The actual optimizer that will be used to compute and apply the - gradients. Must be one of the Optimizer classes. -* `vars_to_clip_dims`: A dict with keys as Variables and values as lists - of dimensions along which to compute the L2-norm. See - `tf.clip_by_norm` for more details. -* `max_norm`: The L2-norm to clip to, for all variables specified. -* `use_locking`: If `True` use locks for clip update operations. -* `colocate_clip_ops_with_vars`: If `True`, try colocating the clip norm - ops with the corresponding variable. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "VariableClipping". - - - -#### Other Methods -- - - - -#### `tf.contrib.opt.VariableClippingOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#VariableClippingOptimizer.apply_gradients} - - - - -- - - - -#### `tf.contrib.opt.VariableClippingOptimizer.compute_gradients(*args, **kwargs)` {#VariableClippingOptimizer.compute_gradients} - - - - -- - - - -#### `tf.contrib.opt.VariableClippingOptimizer.get_slot(*args, **kwargs)` {#VariableClippingOptimizer.get_slot} - - - - -- - - - -#### `tf.contrib.opt.VariableClippingOptimizer.get_slot_names(*args, **kwargs)` {#VariableClippingOptimizer.get_slot_names} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.BasicLSTMCell.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.BasicLSTMCell.md deleted file mode 100644 index eb4a38a8c3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.BasicLSTMCell.md +++ /dev/null @@ -1,72 +0,0 @@ -Basic LSTM recurrent network cell. - -The implementation is based on: http://arxiv.org/abs/1409.2329. - -We add forget_bias (default: 1) to the biases of the forget gate in order to -reduce the scale of forgetting in the beginning of the training. - -It does not allow cell clipping, a projection layer, and does not -use peep-hole connections: it is the basic baseline. - -For advanced models, please use the full LSTMCell that follows. -- - - - -#### `tf.contrib.rnn.BasicLSTMCell.__call__(inputs, state, scope=None)` {#BasicLSTMCell.__call__} - -Long short-term memory cell (LSTM). - - -- - - - -#### `tf.contrib.rnn.BasicLSTMCell.__init__(num_units, forget_bias=1.0, input_size=None, state_is_tuple=True, activation=tanh)` {#BasicLSTMCell.__init__} - -Initialize the basic LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell. -* `forget_bias`: float, The bias added to forget gates (see above). -* `input_size`: Deprecated and unused. -* `state_is_tuple`: If True, accepted and returned states are 2-tuples of - the `c_state` and `m_state`. If False, they are concatenated - along the column axis. The latter behavior will soon be deprecated. -* `activation`: Activation function of the inner states. - - -- - - - -#### `tf.contrib.rnn.BasicLSTMCell.output_size` {#BasicLSTMCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.BasicLSTMCell.state_size` {#BasicLSTMCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.BasicLSTMCell.zero_state(batch_size, dtype)` {#BasicLSTMCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.GRUCell.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.GRUCell.md deleted file mode 100644 index 4f7cf4402f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.GRUCell.md +++ /dev/null @@ -1,51 +0,0 @@ -Gated Recurrent Unit cell (cf. http://arxiv.org/abs/1406.1078). -- - - - -#### `tf.contrib.rnn.GRUCell.__call__(inputs, state, scope=None)` {#GRUCell.__call__} - -Gated recurrent unit (GRU) with nunits cells. - - -- - - - -#### `tf.contrib.rnn.GRUCell.__init__(num_units, input_size=None, activation=tanh)` {#GRUCell.__init__} - - - - -- - - - -#### `tf.contrib.rnn.GRUCell.output_size` {#GRUCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.GRUCell.state_size` {#GRUCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.GRUCell.zero_state(batch_size, dtype)` {#GRUCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.GridLSTMCell.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.GridLSTMCell.md deleted file mode 100644 index a88d5f8977..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.GridLSTMCell.md +++ /dev/null @@ -1,134 +0,0 @@ -Grid Long short-term memory unit (LSTM) recurrent network cell. - -The default is based on: - Nal Kalchbrenner, Ivo Danihelka and Alex Graves - "Grid Long Short-Term Memory," Proc. ICLR 2016. - http://arxiv.org/abs/1507.01526 - -When peephole connections are used, the implementation is based on: - Tara N. Sainath and Bo Li - "Modeling Time-Frequency Patterns with LSTM vs. Convolutional Architectures - for LVCSR Tasks." submitted to INTERSPEECH, 2016. - -The code uses optional peephole connections, shared_weights and cell clipping. -- - - - -#### `tf.contrib.rnn.GridLSTMCell.__call__(inputs, state, scope=None)` {#GridLSTMCell.__call__} - -Run one step of LSTM. - -##### Args: - - -* `inputs`: input Tensor, 2D, [batch, feature_size]. -* `state`: Tensor or tuple of Tensors, 2D, [batch, state_size], depends on the - flag self._state_is_tuple. -* `scope`: (optional) VariableScope for the created subgraph; if None, it - defaults to "GridLSTMCell". - -##### Returns: - - A tuple containing: - - A 2D, [batch, output_dim], Tensor representing the output of the LSTM - after reading "inputs" when previous state was "state". - Here output_dim is num_units. - - A 2D, [batch, state_size], Tensor representing the new state of LSTM - after reading "inputs" when previous state was "state". - -##### Raises: - - -* `ValueError`: if an input_size was specified and the provided inputs have - a different dimension. - - -- - - - -#### `tf.contrib.rnn.GridLSTMCell.__init__(num_units, use_peepholes=False, share_time_frequency_weights=False, cell_clip=None, initializer=None, num_unit_shards=1, forget_bias=1.0, feature_size=None, frequency_skip=None, num_frequency_blocks=None, start_freqindex_list=None, end_freqindex_list=None, couple_input_forget_gates=False, state_is_tuple=False)` {#GridLSTMCell.__init__} - -Initialize the parameters for an LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell -* `use_peepholes`: (optional) bool, default False. Set True to enable - diagonal/peephole connections. -* `share_time_frequency_weights`: (optional) bool, default False. Set True to - enable shared cell weights between time and frequency LSTMs. -* `cell_clip`: (optional) A float value, default None, if provided the cell - state is clipped by this value prior to the cell output activation. -* `initializer`: (optional) The initializer to use for the weight and - projection matrices, default None. -* `num_unit_shards`: (optional) int, defualt 1, How to split the weight - matrix. If > 1,the weight matrix is stored across num_unit_shards. -* `forget_bias`: (optional) float, default 1.0, The initial bias of the - forget gates, used to reduce the scale of forgetting at the beginning - of the training. -* `feature_size`: (optional) int, default None, The size of the input feature - the LSTM spans over. -* `frequency_skip`: (optional) int, default None, The amount the LSTM filter - is shifted by in frequency. -* `num_frequency_blocks`: [required] A list of frequency blocks needed to - cover the whole input feature splitting defined by start_freqindex_list - and end_freqindex_list. -* `start_freqindex_list`: [optional], list of ints, default None, The - starting frequency index for each frequency block. -* `end_freqindex_list`: [optional], list of ints, default None. The ending - frequency index for each frequency block. -* `couple_input_forget_gates`: (optional) bool, default False, Whether to - couple the input and forget gates, i.e. f_gate = 1.0 - i_gate, to reduce - model parameters and computation cost. -* `state_is_tuple`: If True, accepted and returned states are 2-tuples of - the `c_state` and `m_state`. By default (False), they are concatenated - along the column axis. This default behavior will soon be deprecated. - -##### Raises: - - -* `ValueError`: if the num_frequency_blocks list is not specified - - -- - - - -#### `tf.contrib.rnn.GridLSTMCell.output_size` {#GridLSTMCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.GridLSTMCell.state_size` {#GridLSTMCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.GridLSTMCell.state_tuple_type` {#GridLSTMCell.state_tuple_type} - - - - -- - - - -#### `tf.contrib.rnn.GridLSTMCell.zero_state(batch_size, dtype)` {#GridLSTMCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.TimeReversedFusedRNN.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.TimeReversedFusedRNN.md deleted file mode 100644 index 0d9eb1ff90..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.TimeReversedFusedRNN.md +++ /dev/null @@ -1,25 +0,0 @@ -This is an adaptor to time-reverse a FusedRNNCell. - -For example, - -```python -cell = tf.contrib.rnn.BasicRNNCell(10) -fw_lstm = tf.contrib.rnn.FusedRNNCellAdaptor(cell, use_dynamic_rnn=True) -bw_lstm = tf.contrib.rnn.TimeReversedFusedRNN(fw_lstm) -fw_out, fw_state = fw_lstm(inputs) -bw_out, bw_state = bw_lstm(inputs) -``` -- - - - -#### `tf.contrib.rnn.TimeReversedFusedRNN.__call__(inputs, initial_state=None, dtype=None, sequence_length=None, scope=None)` {#TimeReversedFusedRNN.__call__} - - - - -- - - - -#### `tf.contrib.rnn.TimeReversedFusedRNN.__init__(cell)` {#TimeReversedFusedRNN.__init__} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.static_state_saving_rnn.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.static_state_saving_rnn.md deleted file mode 100644 index 0f6ef9e409..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.rnn.static_state_saving_rnn.md +++ /dev/null @@ -1,33 +0,0 @@ -### `tf.contrib.rnn.static_state_saving_rnn(cell, inputs, state_saver, state_name, sequence_length=None, scope=None)` {#static_state_saving_rnn} - -RNN that accepts a state saver for time-truncated RNN calculation. - -##### Args: - - -* `cell`: An instance of `RNNCell`. -* `inputs`: A length T list of inputs, each a `Tensor` of shape - `[batch_size, input_size]`. -* `state_saver`: A state saver object with methods `state` and `save_state`. -* `state_name`: Python string or tuple of strings. The name to use with the - state_saver. If the cell returns tuples of states (i.e., - `cell.state_size` is a tuple) then `state_name` should be a tuple of - strings having the same length as `cell.state_size`. Otherwise it should - be a single string. -* `sequence_length`: (optional) An int32/int64 vector size [batch_size]. - See the documentation for rnn() for more details about sequence_length. -* `scope`: VariableScope for the created subgraph; defaults to "rnn". - -##### Returns: - - A pair (outputs, state) where: - outputs is a length T list of outputs (one for each input) - states is the final state - -##### Raises: - - -* `TypeError`: If `cell` is not an instance of RNNCell. -* `ValueError`: If `inputs` is `None` or an empty list, or if the arity and - type of `state_name` does not match that of `cell.state_size`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.training.resample_at_rate.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.training.resample_at_rate.md deleted file mode 100644 index 7142c66c2e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.training.resample_at_rate.md +++ /dev/null @@ -1,36 +0,0 @@ -### `tf.contrib.training.resample_at_rate(inputs, rates, scope=None, seed=None, back_prop=False)` {#resample_at_rate} - -Given `inputs` tensors, stochastically resamples each at a given rate. - -For example, if the inputs are `[[a1, a2], [b1, b2]]` and the rates -tensor contains `[3, 1]`, then the return value may look like `[[a1, -a2, a1, a1], [b1, b2, b1, b1]]`. However, many other outputs are -possible, since this is stochastic -- averaged over many repeated -calls, each set of inputs should appear in the output `rate` times -the number of invocations. - -Uses Knuth's method to generate samples from the poisson -distribution (but instead of just incrementing a count, actually -emits the input); this is described at -https://en.wikipedia.org/wiki/Poisson_distribution in the section on -generating Poisson-distributed random variables. - -Note that this method is not appropriate for large rate values: with -float16 it will stop performing correctly for rates above 9.17; -float32, 87; and float64, 708. (These are the base-e versions of the -minimum representable exponent for each type.) - -##### Args: - - -* `inputs`: A list of tensors, each of which has a shape of `[batch_size, ...]` -* `rates`: A tensor of shape `[batch_size]` contiaining the resampling rates - for each input. -* `scope`: Scope for the op. -* `seed`: Random seed to use. -* `back_prop`: Whether to allow back-propagation through this op. - -##### Returns: - - Selections from the input tensors. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.util.constant_value.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.util.constant_value.md deleted file mode 100644 index 58ba7b0abb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.contrib.util.constant_value.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.contrib.util.constant_value(tensor)` {#constant_value} - -Returns the constant value of the given tensor, if efficiently calculable. - -This function attempts to partially evaluate the given tensor, and -returns its value as a numpy ndarray if this succeeds. - -TODO(mrry): Consider whether this function should use a registration -mechanism like gradients and ShapeFunctions, so that it is easily -extensible. - -NOTE: If `constant_value(tensor)` returns a non-`None` result, it will no -longer be possible to feed a different value for `tensor`. This allows the -result of this function to influence the graph that is constructed, and -permits static shape optimizations. - -##### Args: - - -* `tensor`: The Tensor to be evaluated. - -##### Returns: - - A numpy ndarray containing the constant value of the given `tensor`, - or None if it cannot be calculated. - -##### Raises: - - -* `TypeError`: if tensor is not an ops.Tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.convert_to_tensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.convert_to_tensor.md deleted file mode 100644 index 226e01ead0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.convert_to_tensor.md +++ /dev/null @@ -1,50 +0,0 @@ -### `tf.convert_to_tensor(value, dtype=None, name=None, preferred_dtype=None)` {#convert_to_tensor} - -Converts the given `value` to a `Tensor`. - -This function converts Python objects of various types to `Tensor` -objects. It accepts `Tensor` objects, numpy arrays, Python lists, -and Python scalars. For example: - -```python -import numpy as np - -def my_func(arg): - arg = tf.convert_to_tensor(arg, dtype=tf.float32) - return tf.matmul(arg, arg) + arg - -# The following calls are equivalent. -value_1 = my_func(tf.constant([[1.0, 2.0], [3.0, 4.0]])) -value_2 = my_func([[1.0, 2.0], [3.0, 4.0]]) -value_3 = my_func(np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32)) -``` - -This function can be useful when composing a new operation in Python -(such as `my_func` in the example above). All standard Python op -constructors apply this function to each of their Tensor-valued -inputs, which allows those ops to accept numpy arrays, Python lists, -and scalars in addition to `Tensor` objects. - -##### Args: - - -* `value`: An object whose type has a registered `Tensor` conversion function. -* `dtype`: Optional element type for the returned tensor. If missing, the - type is inferred from the type of `value`. -* `name`: Optional name to use if a new `Tensor` is created. -* `preferred_dtype`: Optional element type for the returned tensor, - used when dtype is None. In some cases, a caller may not have a - dtype in mind when converting to a tensor, so preferred_dtype - can be used as a soft preference. If the conversion to - `preferred_dtype` is not possible, this argument has no effect. - -##### Returns: - - An `Output` based on `value`. - -##### Raises: - - -* `TypeError`: If no conversion function is registered for `value`. -* `RuntimeError`: If a registered conversion function returns an invalid value. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.diag.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.diag.md deleted file mode 100644 index 3279122875..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.diag.md +++ /dev/null @@ -1,33 +0,0 @@ -### `tf.diag(diagonal, name=None)` {#diag} - -Returns a diagonal tensor with a given diagonal values. - -Given a `diagonal`, this operation returns a tensor with the `diagonal` and -everything else padded with zeros. The diagonal is computed as follows: - -Assume `diagonal` has dimensions [D1,..., Dk], then the output is a tensor of -rank 2k with dimensions [D1,..., Dk, D1,..., Dk] where: - -`output[i1,..., ik, i1,..., ik] = diagonal[i1, ..., ik]` and 0 everywhere else. - -For example: - -```prettyprint -# 'diagonal' is [1, 2, 3, 4] -tf.diag(diagonal) ==> [[1, 0, 0, 0] - [0, 2, 0, 0] - [0, 0, 3, 0] - [0, 0, 0, 4]] -``` - -##### Args: - - -* `diagonal`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. - Rank k tensor where k is at most 3. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `diagonal`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.divide.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.divide.md deleted file mode 100644 index 8db7bf156c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.divide.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.divide(x, y, name=None)` {#divide} - -Computes Python style division of `x` by `y`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.einsum.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.einsum.md deleted file mode 100644 index 45597f2056..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.einsum.md +++ /dev/null @@ -1,74 +0,0 @@ -### `tf.einsum(equation, *inputs)` {#einsum} - -A generalized contraction between tensors of arbitrary dimension. - -This function returns a tensor whose elements are defined by `equation`, -which is written in a shorthand form inspired by the Einstein summation -convention. As an example, consider multiplying two matrices -A and B to form a matrix C. The elements of C are given by: - -``` - C[i,k] = sum_j A[i,j] * B[j,k] -``` - -The corresponding `equation` is: - -``` - ij,jk->ik -``` - -In general, the `equation` is obtained from the more familiar element-wise -equation by - 1. removing variable names, brackets, and commas, - 2. replacing "*" with ",", - 3. dropping summation signs, and - 4. moving the output to the right, and replacing "=" with "->". - -Many common operations can be expressed in this way. For example: - -```python -# Matrix multiplication ->>> einsum('ij,jk->ik', m0, m1) # output[i,k] = sum_j m0[i,j] * m1[j, k] - -# Dot product ->>> einsum('i,i->', u, v) # output = sum_i u[i]*v[i] - -# Outer product ->>> einsum('i,j->ij', u, v) # output[i,j] = u[i]*v[j] - -# Transpose ->>> einsum('ij->ji', m) # output[j,i] = m[i,j] - -# Batch matrix multiplication ->>> einsum('aij,ajk->aik', s, t) # out[a,i,k] = sum_j s[a,i,j] * t[a, j, k] -``` - -This function behaves like `numpy.einsum`, but does not support: -* Ellipses (subscripts like `ij...,jk...->ik...`) -* Subscripts where an axis appears more than once for a single input - (e.g. `ijj,k->ik`). -* Subscripts that are summed across multiple inputs (e.g., `ij,ij,jk->ik`). - -##### Args: - - -* `equation`: a `str` describing the contraction, in the same format as - `numpy.einsum`. -* `inputs`: the inputs to contract (each one a `Tensor`), whose shapes should - be consistent with `equation`. - -##### Returns: - - The contracted `Tensor`, with shape determined by `equation`. - -##### Raises: - - -* `ValueError`: If - - the format of `equation` is incorrect, - - the number of inputs implied by `equation` does not match `len(inputs)`, - - an axis appears in the output subscripts but not in any of the inputs, - - the number of dimensions of an input differs from the number of - indices in its subscript, or - - the input shapes are inconsistent along a particular axis. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.erf.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.erf.md deleted file mode 100644 index 21e0f14be4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.erf.md +++ /dev/null @@ -1,15 +0,0 @@ -### `tf.erf(x, name=None)` {#erf} - -Computes the Gauss error function of `x` element-wise. - -##### Args: - - -* `x`: A `Tensor` of `SparseTensor`. Must be one of the following types: `half`, - `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor`, respectively. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.errors.AlreadyExistsError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.errors.AlreadyExistsError.md deleted file mode 100644 index 85425df298..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.errors.AlreadyExistsError.md +++ /dev/null @@ -1,14 +0,0 @@ -Raised when an entity that we attempted to create already exists. - -For example, running an operation that saves a file -(e.g. [`tf.train.Saver.save()`](../../api_docs/python/train.md#Saver.save)) -could potentially raise this exception if an explicit filename for an -existing file was passed. - -- - - - -#### `tf.errors.AlreadyExistsError.__init__(node_def, op, message)` {#AlreadyExistsError.__init__} - -Creates an `AlreadyExistsError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.fake_quant_with_min_max_args_gradient.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.fake_quant_with_min_max_args_gradient.md deleted file mode 100644 index 5c93c3e046..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.fake_quant_with_min_max_args_gradient.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.fake_quant_with_min_max_args_gradient(gradients, inputs, min=None, max=None, name=None)` {#fake_quant_with_min_max_args_gradient} - -Compute gradients for a FakeQuantWithMinMaxArgs operation. - -##### Args: - - -* `gradients`: A `Tensor` of type `float32`. - Backpropagated gradients above the FakeQuantWithMinMaxArgs operation. -* `inputs`: A `Tensor` of type `float32`. - Values passed as inputs to the FakeQuantWithMinMaxArgs operation. -* `min`: An optional `float`. Defaults to `-6`. -* `max`: An optional `float`. Defaults to `6`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. - Backpropagated gradients below the FakeQuantWithMinMaxArgs operation: - `gradients * (inputs >= min && inputs <= max)`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.get_default_session.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.get_default_session.md deleted file mode 100644 index c564366e8b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.get_default_session.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.get_default_session()` {#get_default_session} - -Returns the default session for the current thread. - -The returned `Session` will be the innermost session on which a -`Session` or `Session.as_default()` context has been entered. - -NOTE: The default session is a property of the current thread. If you -create a new thread, and wish to use the default session in that -thread, you must explicitly add a `with sess.as_default():` in that -thread's function. - -##### Returns: - - The default `Session` being used in the current thread. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.gradients.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.gradients.md deleted file mode 100644 index ea710b2a15..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.gradients.md +++ /dev/null @@ -1,48 +0,0 @@ -### `tf.gradients(ys, xs, grad_ys=None, name='gradients', colocate_gradients_with_ops=False, gate_gradients=False, aggregation_method=None)` {#gradients} - -Constructs symbolic partial derivatives of sum of `ys` w.r.t. x in `xs`. - -`ys` and `xs` are each a `Tensor` or a list of tensors. `grad_ys` -is a list of `Tensor`, holding the gradients received by the -`ys`. The list must be the same length as `ys`. - -`gradients()` adds ops to the graph to output the partial -derivatives of `ys` with respect to `xs`. It returns a list of -`Tensor` of length `len(xs)` where each tensor is the `sum(dy/dx)` -for y in `ys`. - -`grad_ys` is a list of tensors of the same length as `ys` that holds -the initial gradients for each y in `ys`. When `grad_ys` is None, -we fill in a tensor of '1's of the shape of y for each y in `ys`. A -user can provide their own initial `grad_ys` to compute the -derivatives using a different initial gradient for each y (e.g., if -one wanted to weight the gradient differently for each value in -each y). - -##### Args: - - -* `ys`: A `Tensor` or list of tensors to be differentiated. -* `xs`: A `Tensor` or list of tensors to be used for differentiation. -* `grad_ys`: Optional. A `Tensor` or list of tensors the same size as - `ys` and holding the gradients computed for each y in `ys`. -* `name`: Optional name to use for grouping all the gradient ops together. - defaults to 'gradients'. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `gate_gradients`: If True, add a tuple around the gradients returned - for an operations. This avoids some race conditions. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Accepted values are constants defined in the class `AggregationMethod`. - -##### Returns: - - A list of `sum(dy/dx)` for each x in `xs`. - -##### Raises: - - -* `LookupError`: if one of the operations between `x` and `y` does not - have a registered gradient function. -* `ValueError`: if the arguments are invalid. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.greater_equal.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.greater_equal.md deleted file mode 100644 index d6ce057c13..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.greater_equal.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.greater_equal(x, y, name=None)` {#greater_equal} - -Returns the truth value of (x >= y) element-wise. - -*NOTE*: `GreaterEqual` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.igammac.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.igammac.md deleted file mode 100644 index 2d935bb6e3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.igammac.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.igammac(a, x, name=None)` {#igammac} - -Compute the upper regularized incomplete Gamma function `Q(a, x)`. - -The upper regularized incomplete Gamma function is defined as: - -``` -Q(a, x) = Gamma(a, x) / Gamma(a) = 1 - P(a, x) -``` -where -``` -Gamma(a, x) = int_{x}^{\infty} t^{a-1} exp(-t) dt -``` -is the upper incomplete Gama function. - -Note, above `P(a, x)` (`Igamma`) is the lower regularized complete -Gamma function. - -##### Args: - - -* `a`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `x`: A `Tensor`. Must have the same type as `a`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `a`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.adjust_hue.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.adjust_hue.md deleted file mode 100644 index e334e26184..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.adjust_hue.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.image.adjust_hue(image, delta, name=None)` {#adjust_hue} - -Adjust hue of an RGB image. - -This is a convenience method that converts an RGB image to float -representation, converts it to HSV, add an offset to the hue channel, converts -back to RGB and then back to the original data type. If several adjustments -are chained it is advisable to minimize the number of redundant conversions. - -`image` is an RGB image. The image hue is adjusted by converting the -image to HSV and rotating the hue channel (H) by -`delta`. The image is then converted back to RGB. - -`delta` must be in the interval `[-1, 1]`. - -##### Args: - - -* `image`: RGB image or images. Size of the last dimension must be 3. -* `delta`: float. How much to add to the hue channel. -* `name`: A name for this operation (optional). - -##### Returns: - - Adjusted image(s), same shape and DType as `image`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.central_crop.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.central_crop.md deleted file mode 100644 index 4e6b6115f8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.central_crop.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.image.central_crop(image, central_fraction)` {#central_crop} - -Crop the central region of the image. - -Remove the outer parts of an image but retain the central region of the image -along each dimension. If we specify central_fraction = 0.5, this function -returns the region marked with "X" in the below diagram. - - -------- - | | - | XXXX | - | XXXX | - | | where "X" is the central 50% of the image. - -------- - -##### Args: - - -* `image`: 3-D float Tensor of shape [height, width, depth] -* `central_fraction`: float (0, 1], fraction of size to crop - -##### Raises: - - -* `ValueError`: if central_crop_fraction is not within (0, 1]. - -##### Returns: - - 3-D float Tensor - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.random_hue.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.random_hue.md deleted file mode 100644 index 09a4ebc17f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.random_hue.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.image.random_hue(image, max_delta, seed=None)` {#random_hue} - -Adjust the hue of an RGB image by a random factor. - -Equivalent to `adjust_hue()` but uses a `delta` randomly -picked in the interval `[-max_delta, max_delta]`. - -`max_delta` must be in the interval `[0, 0.5]`. - -##### Args: - - -* `image`: RGB image or images. Size of the last dimension must be 3. -* `max_delta`: float. Maximum value for the random delta. -* `seed`: An operation-specific seed. It will be used in conjunction - with the graph-level seed to determine the real seeds that will be - used in this operation. Please see the documentation of - set_random_seed for its interaction with the graph-level random seed. - -##### Returns: - - 3-D float tensor of shape `[height, width, channels]`. - -##### Raises: - - -* `ValueError`: if `max_delta` is invalid. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.resize_bicubic.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.resize_bicubic.md deleted file mode 100644 index 1805c7423d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.image.resize_bicubic.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.image.resize_bicubic(images, size, align_corners=None, name=None)` {#resize_bicubic} - -Resize `images` to `size` using bicubic interpolation. - -Input images can be of different types but output images are always float. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int16`, `int32`, `int64`, `half`, `float32`, `float64`. - 4-D with shape `[batch, height, width, channels]`. -* `size`: A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The - new size for the images. -* `align_corners`: An optional `bool`. Defaults to `False`. - If true, rescale input by (new_height - 1) / (height - 1), which - exactly aligns the 4 corners of images and resized images. If false, rescale - by new_height / height. Treat similarly the width dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. 4-D with shape - `[batch, new_height, new_width, channels]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.invert_permutation.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.invert_permutation.md deleted file mode 100644 index 20cab18208..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.invert_permutation.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.invert_permutation(x, name=None)` {#invert_permutation} - -Computes the inverse permutation of a tensor. - -This operation computes the inverse of an index permutation. It takes a 1-D -integer tensor `x`, which represents the indices of a zero-based array, and -swaps each value with its index position. In other words, for an output tensor -`y` and an input tensor `x`, this operation computes the following: - -`y[x[i]] = i for i in [0, 1, ..., len(x) - 1]` - -The values must include 0. There can be no duplicate values or negative values. - -For example: - -```prettyprint -# tensor `x` is [3, 4, 0, 2, 1] -invert_permutation(x) ==> [2, 4, 3, 0, 1] -``` - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`. 1-D. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. 1-D. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.is_strictly_increasing.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.is_strictly_increasing.md deleted file mode 100644 index bdaedd519e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.is_strictly_increasing.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.is_strictly_increasing(x, name=None)` {#is_strictly_increasing} - -Returns `True` if `x` is strictly increasing. - -Elements of `x` are compared in row-major order. The tensor `[x[0],...]` -is strictly increasing if for every adjacent pair we have `x[i] < x[i+1]`. -If `x` has less than two elements, it is trivially strictly increasing. - -See also: `is_non_decreasing` - -##### Args: - - -* `x`: Numeric `Tensor`. -* `name`: A name for this operation (optional). - Defaults to "is_strictly_increasing" - -##### Returns: - - Boolean `Tensor`, equal to `True` iff `x` is strictly increasing. - -##### Raises: - - -* `TypeError`: if `x` is not a numeric tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.linspace.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.linspace.md deleted file mode 100644 index 29b8993fe6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.linspace.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.linspace(start, stop, num, name=None)` {#linspace} - -Generates values in an interval. - -A sequence of `num` evenly-spaced values are generated beginning at `start`. -If `num > 1`, the values in the sequence increase by `stop - start / num - 1`, -so that the last one is exactly `stop`. - -For example: - -``` -tf.linspace(10.0, 12.0, 3, name="linspace") => [ 10.0 11.0 12.0] -``` - -##### Args: - - -* `start`: A `Tensor`. Must be one of the following types: `float32`, `float64`. - First entry in the range. -* `stop`: A `Tensor`. Must have the same type as `start`. - Last entry in the range. -* `num`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - Number of values to generate. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `start`. 1-D. The generated values. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.log1p.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.log1p.md deleted file mode 100644 index e861034528..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.log1p.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.log1p(x, name=None)` {#log1p} - -Computes natural logarithm of (1 + x) element-wise. - -I.e., \\(y = \log_e (1 + x)\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.map_fn.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.map_fn.md deleted file mode 100644 index 1cbc6177de..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.map_fn.md +++ /dev/null @@ -1,96 +0,0 @@ -### `tf.map_fn(fn, elems, dtype=None, parallel_iterations=10, back_prop=True, swap_memory=False, infer_shape=True, name=None)` {#map_fn} - -map on the list of tensors unpacked from `elems` on dimension 0. - -The simplest version of `map` repeatedly applies the callable `fn` to a -sequence of elements from first to last. The elements are made of the -tensors unpacked from `elems`. `dtype` is the data type of the return -value of `fn`. Users must provide `dtype` if it is different from -the data type of `elems`. - -Suppose that `elems` is unpacked into `values`, a list of tensors. The shape -of the result tensor is `[values.shape[0]] + fn(values[0]).shape`. - -This method also allows multi-arity `elems` and output of `fn`. If `elems` -is a (possibly nested) list or tuple of tensors, then each of these tensors -must have a matching first (unpack) dimension. The signature of `fn` may -match the structure of `elems`. That is, if `elems` is -`(t1, [t2, t3, [t4, t5]])`, then an appropriate signature for `fn` is: -`fn = lambda (t1, [t2, t3, [t4, t5]]):`. - -Furthermore, `fn` may emit a different structure than its input. For example, -`fn` may look like: `fn = lambda t1: return (t1 + 1, t1 - 1)`. In this case, -the `dtype` parameter is not optional: `dtype` must be a type or (possibly -nested) tuple of types matching the output of `fn`. - -To apply a functional operation to the nonzero elements of a SparseTensor -one of the following methods is recommended. First, if the function is -expressible as TensorFlow ops, use - -```python - result = SparseTensor(input.indices, fn(input.values), input.dense_shape) -``` - -If, however, the function is not expressible as a TensorFlow op, then use - -```python -result = SparseTensor( - input.indices, map_fn(fn, input.values), input.dense_shape) -``` - -instead. - -##### Args: - - -* `fn`: The callable to be performed. It accepts one argument, which will - have the same (possibly nested) structure as `elems`. Its output - must have the same structure as `dtype` if one is provided, otherwise - it must have the same structure as `elems`. -* `elems`: A tensor or (possibly nested) sequence of tensors, each of which - will be unpacked along their first dimension. The nested sequence - of the resulting slices will be applied to `fn`. -* `dtype`: (optional) The output type(s) of `fn`. If `fn` returns a structure - of Tensors differing from the structure of `elems`, then `dtype` is not - optional and must have the same structure as the output of `fn`. -* `parallel_iterations`: (optional) The number of iterations allowed to run - in parallel. -* `back_prop`: (optional) True enables support for back propagation. -* `swap_memory`: (optional) True enables GPU-CPU memory swapping. -* `infer_shape`: (optional) False disables tests for consistent output shapes. -* `name`: (optional) Name prefix for the returned tensors. - -##### Returns: - - A tensor or (possibly nested) sequence of tensors. Each tensor packs the - results of applying `fn` to tensors unpacked from `elems` along the first - dimension, from first to last. - -##### Raises: - - -* `TypeError`: if `fn` is not callable or the structure of the output of - `fn` and `dtype` do not match, or if elems is a SparseTensor. -* `ValueError`: if the lengths of the output of `fn` and `dtype` do not match. - -##### Examples: - - ```python - elems = np.array([1, 2, 3, 4, 5, 6]) - squares = map_fn(lambda x: x * x, elems) - # squares == [1, 4, 9, 16, 25, 36] - ``` - - ```python - elems = (np.array([1, 2, 3]), np.array([-1, 1, -1])) - alternate = map_fn(lambda x: x[0] * x[1], elems, dtype=tf.int64) - # alternate == [-1, 2, -3] - ``` - - ```python - elems = np.array([1, 2, 3]) - alternates = map_fn(lambda x: (x, -x), elems, dtype=(tf.int64, tf.int64)) - # alternates[0] == [1, 2, 3] - # alternates[1] == [-1, -2, -3] - ``` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.matching_files.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.matching_files.md deleted file mode 100644 index 19262f8dd5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.matching_files.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.matching_files(pattern, name=None)` {#matching_files} - -Returns the set of files matching one or more glob patterns. - -Note that this routine only supports wildcard characters in the -basename portion of the pattern, not in the directory portion. - -##### Args: - - -* `pattern`: A `Tensor` of type `string`. - Shell wildcard pattern(s). Scalar or vector of type string. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. A vector of matching filenames. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.negative.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.negative.md deleted file mode 100644 index 80a062f68f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.negative.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.negative(x, name=None)` {#negative} - -Computes numerical negative value element-wise. - -I.e., \(y = -x\). - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. Must be one of the following types: `half`, - `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor`, respectively. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.compute_accidental_hits.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.compute_accidental_hits.md deleted file mode 100644 index 9d5bb30303..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.compute_accidental_hits.md +++ /dev/null @@ -1,45 +0,0 @@ -### `tf.nn.compute_accidental_hits(true_classes, sampled_candidates, num_true, seed=None, name=None)` {#compute_accidental_hits} - -Compute the position ids in `sampled_candidates` matching `true_classes`. - -In Candidate Sampling, this operation facilitates virtually removing -sampled classes which happen to match target classes. This is done -in Sampled Softmax and Sampled Logistic. - -See our [Candidate Sampling Algorithms -Reference](http://www.tensorflow.org/extras/candidate_sampling.pdf). - -We presuppose that the `sampled_candidates` are unique. - -We call it an 'accidental hit' when one of the target classes -matches one of the sampled classes. This operation reports -accidental hits as triples `(index, id, weight)`, where `index` -represents the row number in `true_classes`, `id` represents the -position in `sampled_candidates`, and weight is `-FLOAT_MAX`. - -The result of this op should be passed through a `sparse_to_dense` -operation, then added to the logits of the sampled classes. This -removes the contradictory effect of accidentally sampling the true -target classes as noise classes for the same example. - -##### Args: - - -* `true_classes`: A `Tensor` of type `int64` and shape `[batch_size, - num_true]`. The target classes. -* `sampled_candidates`: A tensor of type `int64` and shape `[num_sampled]`. - The sampled_candidates output of CandidateSampler. -* `num_true`: An `int`. The number of target classes per training example. -* `seed`: An `int`. An operation-specific seed. Default is 0. -* `name`: A name for the operation (optional). - -##### Returns: - - -* `indices`: A `Tensor` of type `int32` and shape `[num_accidental_hits]`. - Values indicate rows in `true_classes`. -* `ids`: A `Tensor` of type `int64` and shape `[num_accidental_hits]`. - Values indicate positions in `sampled_candidates`. -* `weights`: A `Tensor` of type `float` and shape `[num_accidental_hits]`. - Each value is `-FLOAT_MAX`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.conv1d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.conv1d.md deleted file mode 100644 index d073ce7fb2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.conv1d.md +++ /dev/null @@ -1,50 +0,0 @@ -### `tf.nn.conv1d(value, filters, stride, padding, use_cudnn_on_gpu=None, data_format=None, name=None)` {#conv1d} - -Computes a 1-D convolution given 3-D input and filter tensors. - -Given an input tensor of shape - [batch, in_width, in_channels] -if data_format is "NHWC", or - [batch, in_channels, in_width] -if data_format is "NCHW", -and a filter / kernel tensor of shape -[filter_width, in_channels, out_channels], this op reshapes -the arguments to pass them to conv2d to perform the equivalent -convolution operation. - -Internally, this op reshapes the input tensors and invokes `tf.nn.conv2d`. -For example, if `data_format` does not start with "NC", a tensor of shape - [batch, in_width, in_channels] -is reshaped to - [batch, 1, in_width, in_channels], -and the filter is reshaped to - [1, filter_width, in_channels, out_channels]. -The result is then reshaped back to - [batch, out_width, out_channels] -(where out_width is a function of the stride and padding as in conv2d) and -returned to the caller. - -##### Args: - - -* `value`: A 3D `Tensor`. Must be of type `float32` or `float64`. -* `filters`: A 3D `Tensor`. Must have the same type as `input`. -* `stride`: An `integer`. The number of entries by which - the filter is moved right at each step. -* `padding`: 'SAME' or 'VALID' -* `use_cudnn_on_gpu`: An optional `bool`. Defaults to `True`. -* `data_format`: An optional `string` from `"NHWC", "NCHW"`. Defaults - to `"NHWC"`, the data is stored in the order of - [batch, in_width, in_channels]. The `"NCHW"` format stores - data as [batch, in_channels, in_width]. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as input. - -##### Raises: - - -* `ValueError`: if `data_format` is invalid. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.embedding_lookup_sparse.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.embedding_lookup_sparse.md deleted file mode 100644 index 23e0fe4a54..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.embedding_lookup_sparse.md +++ /dev/null @@ -1,76 +0,0 @@ -### `tf.nn.embedding_lookup_sparse(params, sp_ids, sp_weights, partition_strategy='mod', name=None, combiner=None, max_norm=None)` {#embedding_lookup_sparse} - -Computes embeddings for the given ids and weights. - -This op assumes that there is at least one id for each row in the dense tensor -represented by sp_ids (i.e. there are no rows with empty features), and that -all the indices of sp_ids are in canonical row-major order. - -It also assumes that all id values lie in the range [0, p0), where p0 -is the sum of the size of params along dimension 0. - -##### Args: - - -* `params`: A single tensor representing the complete embedding tensor, - or a list of P tensors all of same shape except for the first dimension, - representing sharded embedding tensors. Alternatively, a - `PartitionedVariable`, created by partitioning along dimension 0. Each - element must be appropriately sized for the given `partition_strategy`. -* `sp_ids`: N x M SparseTensor of int64 ids (typically from FeatureValueToId), - where N is typically batch size and M is arbitrary. -* `sp_weights`: either a SparseTensor of float / double weights, or None to - indicate all weights should be taken to be 1. If specified, sp_weights - must have exactly the same shape and indices as sp_ids. -* `partition_strategy`: A string specifying the partitioning strategy, relevant - if `len(params) > 1`. Currently `"div"` and `"mod"` are supported. Default - is `"mod"`. See `tf.nn.embedding_lookup` for more details. -* `name`: Optional name for the op. -* `combiner`: A string specifying the reduction op. Currently "mean", "sqrtn" - and "sum" are supported. - "sum" computes the weighted sum of the embedding results for each row. - "mean" is the weighted sum divided by the total weight. - "sqrtn" is the weighted sum divided by the square root of the sum of the - squares of the weights. -* `max_norm`: If not None, each embedding is normalized to have l2 norm equal - to max_norm before combining. - -##### Returns: - - A dense tensor representing the combined embeddings for the - sparse ids. For each row in the dense tensor represented by sp_ids, the op - looks up the embeddings for all ids in that row, multiplies them by the - corresponding weight, and combines these embeddings as specified. - - In other words, if - - shape(combined params) = [p0, p1, ..., pm] - - and - - shape(sp_ids) = shape(sp_weights) = [d0, d1, ..., dn] - - then - - shape(output) = [d0, d1, ..., dn-1, p1, ..., pm]. - - For instance, if params is a 10x20 matrix, and sp_ids / sp_weights are - - [0, 0]: id 1, weight 2.0 - [0, 1]: id 3, weight 0.5 - [1, 0]: id 0, weight 1.0 - [2, 3]: id 1, weight 3.0 - - with `combiner`="mean", then the output will be a 3x20 matrix where - - output[0, :] = (params[1, :] * 2.0 + params[3, :] * 0.5) / (2.0 + 0.5) - output[1, :] = params[0, :] * 1.0 - output[2, :] = params[1, :] * 3.0 - -##### Raises: - - -* `TypeError`: If sp_ids is not a SparseTensor, or if sp_weights is neither - None nor SparseTensor. -* `ValueError`: If combiner is not one of {"mean", "sqrtn", "sum"}. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.erosion2d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.erosion2d.md deleted file mode 100644 index a6fc19fb6d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.erosion2d.md +++ /dev/null @@ -1,52 +0,0 @@ -### `tf.nn.erosion2d(value, kernel, strides, rates, padding, name=None)` {#erosion2d} - -Computes the grayscale erosion of 4-D `value` and 3-D `kernel` tensors. - -The `value` tensor has shape `[batch, in_height, in_width, depth]` and the -`kernel` tensor has shape `[kernel_height, kernel_width, depth]`, i.e., -each input channel is processed independently of the others with its own -structuring function. The `output` tensor has shape -`[batch, out_height, out_width, depth]`. The spatial dimensions of the -output tensor depend on the `padding` algorithm. We currently only support the -default "NHWC" `data_format`. - -In detail, the grayscale morphological 2-D erosion is given by: - - output[b, y, x, c] = - min_{dy, dx} value[b, - strides[1] * y - rates[1] * dy, - strides[2] * x - rates[2] * dx, - c] - - kernel[dy, dx, c] - -Duality: The erosion of `value` by the `kernel` is equal to the negation of -the dilation of `-value` by the reflected `kernel`. - -##### Args: - - -* `value`: A `Tensor`. 4-D with shape `[batch, in_height, in_width, depth]`. -* `kernel`: A `Tensor`. Must have the same type as `value`. - 3-D with shape `[kernel_height, kernel_width, depth]`. -* `strides`: A list of `ints` that has length `>= 4`. - 1-D of length 4. The stride of the sliding window for each dimension of - the input tensor. Must be: `[1, stride_height, stride_width, 1]`. -* `rates`: A list of `ints` that has length `>= 4`. - 1-D of length 4. The input stride for atrous morphological dilation. - Must be: `[1, rate_height, rate_width, 1]`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). If not specified "erosion2d" - is used. - -##### Returns: - - A `Tensor`. Has the same type as `value`. - 4-D with shape `[batch, out_height, out_width, depth]`. - -##### Raises: - - -* `ValueError`: If the `value` depth does not match `kernel`' shape, or if - padding is other than `'VALID'` or `'SAME'`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.moments.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.moments.md deleted file mode 100644 index dd56055311..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.moments.md +++ /dev/null @@ -1,35 +0,0 @@ -### `tf.nn.moments(x, axes, shift=None, name=None, keep_dims=False)` {#moments} - -Calculate the mean and variance of `x`. - -The mean and variance are calculated by aggregating the contents of `x` -across `axes`. If `x` is 1-D and `axes = [0]` this is just the mean -and variance of a vector. - -Note: for numerical stability, when shift=None, the true mean -would be computed and used as shift. - -When using these moments for batch normalization (see -`tf.nn.batch_normalization`): - - * for so-called "global normalization", used with convolutional filters with - shape `[batch, height, width, depth]`, pass `axes=[0, 1, 2]`. - * for simple batch normalization pass `axes=[0]` (batch only). - -##### Args: - - -* `x`: A `Tensor`. -* `axes`: Array of ints. Axes along which to compute mean and - variance. -* `shift`: A `Tensor` containing the value by which to shift the data for - numerical stability, or `None` in which case the true mean of the data is - used as shift. A shift close to the true mean provides the most - numerically stable results. -* `name`: Name used to scope the operations that compute the moments. -* `keep_dims`: produce moments with the same dimensionality as the input. - -##### Returns: - - Two `Tensor` objects: `mean` and `variance`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.normalize_moments.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.normalize_moments.md deleted file mode 100644 index d7a6b9cab4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.normalize_moments.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.nn.normalize_moments(counts, mean_ss, variance_ss, shift, name=None)` {#normalize_moments} - -Calculate the mean and variance of based on the sufficient statistics. - -##### Args: - - -* `counts`: A `Tensor` containing a the total count of the data (one value). -* `mean_ss`: A `Tensor` containing the mean sufficient statistics: the (possibly - shifted) sum of the elements to average over. -* `variance_ss`: A `Tensor` containing the variance sufficient statistics: the - (possibly shifted) squared sum of the data to compute the variance over. -* `shift`: A `Tensor` containing the value by which the data is shifted for - numerical stability, or `None` if no shift was performed. -* `name`: Name used to scope the operations that compute the moments. - -##### Returns: - - Two `Tensor` objects: `mean` and `variance`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.sampled_softmax_loss.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.sampled_softmax_loss.md deleted file mode 100644 index 6cddbd7d17..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.nn.sampled_softmax_loss.md +++ /dev/null @@ -1,49 +0,0 @@ -### `tf.nn.sampled_softmax_loss(weights, biases, labels, inputs, num_sampled, num_classes, num_true=1, sampled_values=None, remove_accidental_hits=True, partition_strategy='mod', name='sampled_softmax_loss')` {#sampled_softmax_loss} - -Computes and returns the sampled softmax training loss. - -This is a faster way to train a softmax classifier over a huge number of -classes. - -This operation is for training only. It is generally an underestimate of -the full softmax loss. - -At inference time, you can compute full softmax probabilities with the -expression `tf.nn.softmax(tf.matmul(inputs, tf.transpose(weights)) + biases)`. - -See our [Candidate Sampling Algorithms Reference] -(../../extras/candidate_sampling.pdf) - -Also see Section 3 of [Jean et al., 2014](http://arxiv.org/abs/1412.2007) -([pdf](http://arxiv.org/pdf/1412.2007.pdf)) for the math. - -##### Args: - - -* `weights`: A `Tensor` of shape `[num_classes, dim]`, or a list of `Tensor` - objects whose concatenation along dimension 0 has shape - [num_classes, dim]. The (possibly-sharded) class embeddings. -* `biases`: A `Tensor` of shape `[num_classes]`. The class biases. -* `labels`: A `Tensor` of type `int64` and shape `[batch_size, - num_true]`. The target classes. Note that this format differs from - the `labels` argument of `nn.softmax_cross_entropy_with_logits`. -* `inputs`: A `Tensor` of shape `[batch_size, dim]`. The forward - activations of the input network. -* `num_sampled`: An `int`. The number of classes to randomly sample per batch. -* `num_classes`: An `int`. The number of possible classes. -* `num_true`: An `int`. The number of target classes per training example. -* `sampled_values`: a tuple of (`sampled_candidates`, `true_expected_count`, - `sampled_expected_count`) returned by a `*_candidate_sampler` function. - (if None, we default to `log_uniform_candidate_sampler`) -* `remove_accidental_hits`: A `bool`. whether to remove "accidental hits" - where a sampled class equals one of the target classes. Default is - True. -* `partition_strategy`: A string specifying the partitioning strategy, relevant - if `len(weights) > 1`. Currently `"div"` and `"mod"` are supported. - Default is `"mod"`. See `tf.nn.embedding_lookup` for more details. -* `name`: A name for the operation (optional). - -##### Returns: - - A `batch_size` 1-D tensor of per-example sampled softmax losses. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.parse_single_example.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.parse_single_example.md deleted file mode 100644 index e5ac731bce..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.parse_single_example.md +++ /dev/null @@ -1,38 +0,0 @@ -### `tf.parse_single_example(serialized, features, name=None, example_names=None)` {#parse_single_example} - -Parses a single `Example` proto. - -Similar to `parse_example`, except: - -For dense tensors, the returned `Tensor` is identical to the output of -`parse_example`, except there is no batch dimension, the output shape is the -same as the shape given in `dense_shape`. - -For `SparseTensor`s, the first (batch) column of the indices matrix is removed -(the indices matrix is a column vector), the values vector is unchanged, and -the first (`batch_size`) entry of the shape vector is removed (it is now a -single element vector). - -One might see performance advantages by batching `Example` protos with -`parse_example` instead of using this function directly. - -##### Args: - - -* `serialized`: A scalar string Tensor, a single serialized Example. - See `_parse_single_example_raw` documentation for more details. -* `features`: A `dict` mapping feature keys to `FixedLenFeature` or - `VarLenFeature` values. -* `name`: A name for this operation (optional). -* `example_names`: (Optional) A scalar string Tensor, the associated name. - See `_parse_single_example_raw` documentation for more details. - -##### Returns: - - A `dict` mapping feature keys to `Tensor` and `SparseTensor` values. - -##### Raises: - - -* `ValueError`: if any feature is invalid. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.qr.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.qr.md deleted file mode 100644 index 64467b22a7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.qr.md +++ /dev/null @@ -1,36 +0,0 @@ -### `tf.qr(input, full_matrices=None, name=None)` {#qr} - -Computes the QR decompositions of one or more matrices. - -Computes the QR decomposition of each inner matrix in `tensor` such that -`tensor[..., :, :] = q[..., :, :] * r[..., :,:])` - -```prettyprint -# a is a tensor. -# q is a tensor of orthonormal matrices. -# r is a tensor of upper triangular matrices. -q, r = qr(a) -q_full, r_full = qr(a, full_matrices=True) -``` - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float64`, `float32`, `complex64`, `complex128`. - A tensor of shape `[..., M, N]` whose inner-most 2 dimensions - form matrices of size `[M, N]`. Let `P` be the minimum of `M` and `N`. -* `full_matrices`: An optional `bool`. Defaults to `False`. - If true, compute full-sized `q` and `r`. If false - (the default), compute only the leading `P` columns of `q`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (q, r). - -* `q`: A `Tensor`. Has the same type as `input`. Orthonormal basis for range of `a`. If `full_matrices` is `False` then - shape is `[..., M, P]`; if `full_matrices` is `True` then shape is - `[..., M, M]`. -* `r`: A `Tensor`. Has the same type as `input`. Triangular factor. If `full_matrices` is `False` then shape is - `[..., P, N]`. If `full_matrices` is `True` then shape is `[..., M, N]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.random_uniform_initializer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.random_uniform_initializer.md deleted file mode 100644 index 65cf607305..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.random_uniform_initializer.md +++ /dev/null @@ -1,25 +0,0 @@ -Initializer that generates tensors with a uniform distribution. - -Args: - minval: A python scalar or a scalar tensor. Lower bound of the range - of random values to generate. - maxval: A python scalar or a scalar tensor. Upper bound of the range - of random values to generate. Defaults to 1 for float types. - seed: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - dtype: The data type. -- - - - -#### `tf.random_uniform_initializer.__call__(shape, dtype=None, partition_info=None)` {#random_uniform_initializer.__call__} - - - - -- - - - -#### `tf.random_uniform_initializer.__init__(minval=0, maxval=None, seed=None, dtype=tf.float32)` {#random_uniform_initializer.__init__} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.read_file.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.read_file.md deleted file mode 100644 index 3c0ad3652a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.read_file.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.read_file(filename, name=None)` {#read_file} - -Reads and outputs the entire contents of the input filename. - -##### Args: - - -* `filename`: A `Tensor` of type `string`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.reduce_any.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.reduce_any.md deleted file mode 100644 index ef4468dae2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.reduce_any.md +++ /dev/null @@ -1,40 +0,0 @@ -### `tf.reduce_any(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_any} - -Computes the "logical or" of elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -For example: - -```python -# 'x' is [[True, True] -# [False, False]] -tf.reduce_any(x) ==> True -tf.reduce_any(x, 0) ==> [True, True] -tf.reduce_any(x, 1) ==> [True, False] -``` - -##### Args: - - -* `input_tensor`: The boolean tensor to reduce. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - -@compatibility(numpy) -Equivalent to np.any -@end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.reduce_join.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.reduce_join.md deleted file mode 100644 index 2a6d631b6b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.reduce_join.md +++ /dev/null @@ -1,46 +0,0 @@ -### `tf.reduce_join(inputs, axis=None, keep_dims=False, separator='', name=None, reduction_indices=None)` {#reduce_join} - -Joins a string Tensor across the given dimensions. - -Computes the string join across dimensions in the given string Tensor of shape -`[d_0, d_1, ..., d_n-1]`. Returns a new Tensor created by joining the input -strings with the given separator (default: empty string). Negative indices are -counted backwards from the end, with `-1` being equivalent to `n - 1`. - -For example: - -``` -# tensor `a` is [["a", "b"], ["c", "d"]] -tf.reduce_join(a, 0) ==> ["ac", "bd"] -tf.reduce_join(a, 1) ==> ["ab", "cd"] -tf.reduce_join(a, -2) = tf.reduce_join(a, 0) ==> ["ac", "bd"] -tf.reduce_join(a, -1) = tf.reduce_join(a, 1) ==> ["ab", "cd"] -tf.reduce_join(a, 0, keep_dims=True) ==> [["ac", "bd"]] -tf.reduce_join(a, 1, keep_dims=True) ==> [["ab"], ["cd"]] -tf.reduce_join(a, 0, separator=".") ==> ["a.c", "b.d"] -tf.reduce_join(a, [0, 1]) ==> ["acbd"] -tf.reduce_join(a, [1, 0]) ==> ["abcd"] -tf.reduce_join(a, []) ==> ["abcd"] -``` - -##### Args: - - -* `inputs`: A `Tensor` of type `string`. - The input to be joined. All reduced indices must have non-zero size. -* `axis`: A `Tensor` of type `int32`. - The dimensions to reduce over. Dimensions are reduced in the - order specified. Omitting `axis` is equivalent to passing - `[n-1, n-2, ..., 0]`. Negative indices from `-n` to `-1` are supported. -* `keep_dims`: An optional `bool`. Defaults to `False`. - If `True`, retain reduced dimensions with length `1`. -* `separator`: An optional `string`. Defaults to `""`. - The separator to use when joining. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. - Has shape equal to that of the input with reduced dimensions removed or - set to `1` depending on `keep_dims`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.reduce_logsumexp.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.reduce_logsumexp.md deleted file mode 100644 index 485d8fb9be..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.reduce_logsumexp.md +++ /dev/null @@ -1,42 +0,0 @@ -### `tf.reduce_logsumexp(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_logsumexp} - -Computes log(sum(exp(elements across dimensions of a tensor))). - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -This function is more numerically stable than log(sum(exp(input))). It avoids -overflows caused by taking the exp of large inputs and underflows caused by -taking the log of small inputs. - -For example: - -```python -# 'x' is [[0, 0, 0]] -# [0, 0, 0]] -tf.reduce_logsumexp(x) ==> log(6) -tf.reduce_logsumexp(x, 0) ==> [log(2), log(2), log(2)] -tf.reduce_logsumexp(x, 1) ==> [log(3), log(3)] -tf.reduce_logsumexp(x, 1, keep_dims=True) ==> [[log(3)], [log(3)]] -tf.reduce_logsumexp(x, [0, 1]) ==> log(6) -``` - -##### Args: - - -* `input_tensor`: The tensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.sparse_minimum.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.sparse_minimum.md deleted file mode 100644 index 1455e3e533..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.sparse_minimum.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.sparse_minimum(sp_a, sp_b, name=None)` {#sparse_minimum} - -Returns the element-wise min of two SparseTensors. - -Assumes the two SparseTensors have the same shape, i.e., no broadcasting. -Example: - -```python -sp_zero = sparse_tensor.SparseTensor([[0]], [0], [7]) -sp_one = sparse_tensor.SparseTensor([[1]], [1], [7]) -res = tf.sparse_minimum(sp_zero, sp_one).eval() -# "res" should be equal to SparseTensor([[0], [1]], [0, 0], [7]). -``` - -##### Args: - - -* `sp_a`: a `SparseTensor` operand whose dtype is real, and indices - lexicographically ordered. -* `sp_b`: the other `SparseTensor` operand with the same requirements (and the - same shape). -* `name`: optional name of the operation. - -##### Returns: - - -* `output`: the output SparseTensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.string_to_hash_bucket_strong.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.string_to_hash_bucket_strong.md deleted file mode 100644 index 764dfe8431..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.string_to_hash_bucket_strong.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.string_to_hash_bucket_strong(input, num_buckets, key, name=None)` {#string_to_hash_bucket_strong} - -Converts each string in the input Tensor to its hash mod by a number of buckets. - -The hash function is deterministic on the content of the string within the -process. The hash function is a keyed hash function, where attribute `key` -defines the key of the hash function. `key` is an array of 2 elements. - -A strong hash is important when inputs may be malicious, e.g. URLs with -additional components. Adversaries could try to make their inputs hash to the -same bucket for a denial-of-service attack or to skew the results. A strong -hash prevents this by making it dificult, if not infeasible, to compute inputs -that hash to the same bucket. This comes at a cost of roughly 4x higher compute -time than `tf.string_to_hash_bucket_fast`. - -##### Args: - - -* `input`: A `Tensor` of type `string`. The strings to assign a hash bucket. -* `num_buckets`: An `int` that is `>= 1`. The number of buckets. -* `key`: A list of `ints`. - The key for the keyed hash function passed as a list of two uint64 - elements. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `int64`. - A Tensor of the same shape as the input `string_tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.test.Benchmark.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.test.Benchmark.md deleted file mode 100644 index d4a2f78b5d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.test.Benchmark.md +++ /dev/null @@ -1,61 +0,0 @@ -Abstract class that provides helpers for TensorFlow benchmarks. -- - - - -#### `tf.test.Benchmark.is_abstract(cls)` {#Benchmark.is_abstract} - - - - -- - - - -#### `tf.test.Benchmark.report_benchmark(iters=None, cpu_time=None, wall_time=None, throughput=None, extras=None, name=None)` {#Benchmark.report_benchmark} - -Report a benchmark. - -##### Args: - - -* `iters`: (optional) How many iterations were run -* `cpu_time`: (optional) Total cpu time in seconds -* `wall_time`: (optional) Total wall time in seconds -* `throughput`: (optional) Throughput (in MB/s) -* `extras`: (optional) Dict mapping string keys to additional benchmark info. - Values may be either floats or values that are convertible to strings. -* `name`: (optional) Override the BenchmarkEntry name with `name`. - Otherwise it is inferred from the top-level method name. - - -- - - - -#### `tf.test.Benchmark.run_op_benchmark(sess, op_or_tensor, feed_dict=None, burn_iters=2, min_iters=10, store_trace=False, store_memory_usage=True, name=None, extras=None, mbs=0)` {#Benchmark.run_op_benchmark} - -Run an op or tensor in the given session. Report the results. - -##### Args: - - -* `sess`: `Session` object to use for timing. -* `op_or_tensor`: `Operation` or `Tensor` to benchmark. -* `feed_dict`: A `dict` of values to feed for each op iteration (see the - `feed_dict` parameter of `Session.run`). -* `burn_iters`: Number of burn-in iterations to run. -* `min_iters`: Minimum number of iterations to use for timing. -* `store_trace`: Boolean, whether to run an extra untimed iteration and - store the trace of iteration in the benchmark report. - The trace will be stored as a string in Google Chrome trace format - in the extras field "full_trace_chrome_format". -* `store_memory_usage`: Boolean, whether to run an extra untimed iteration, - calculate memory usage, and store that in extras fields. -* `name`: (optional) Override the BenchmarkEntry name with `name`. - Otherwise it is inferred from the top-level method name. -* `extras`: (optional) Dict mapping string keys to additional benchmark info. - Values may be either floats or values that are convertible to strings. -* `mbs`: (optional) The number of megabytes moved by this op, used to - calculate the ops throughput. - -##### Returns: - - A `dict` containing the key-value pairs that were passed to - `report_benchmark`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.test.get_temp_dir.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.test.get_temp_dir.md deleted file mode 100644 index e36d6163a7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.test.get_temp_dir.md +++ /dev/null @@ -1,10 +0,0 @@ -### `tf.test.get_temp_dir()` {#get_temp_dir} - -Returns a temporary directory for use during tests. - -There is no need to delete the directory after the test. - -##### Returns: - - The temporary directory. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.AdadeltaOptimizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.AdadeltaOptimizer.md deleted file mode 100644 index 08d37ac815..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.AdadeltaOptimizer.md +++ /dev/null @@ -1,176 +0,0 @@ -Optimizer that implements the Adadelta algorithm. - -See [M. D. Zeiler](http://arxiv.org/abs/1212.5701) -([pdf](http://arxiv.org/pdf/1212.5701v1.pdf)) -- - - - -#### `tf.train.AdadeltaOptimizer.__init__(learning_rate=0.001, rho=0.95, epsilon=1e-08, use_locking=False, name='Adadelta')` {#AdadeltaOptimizer.__init__} - -Construct a new Adadelta optimizer. - -##### Args: - - -* `learning_rate`: A `Tensor` or a floating point value. The learning rate. -* `rho`: A `Tensor` or a floating point value. The decay rate. -* `epsilon`: A `Tensor` or a floating point value. A constant epsilon used - to better conditioning the grad update. -* `use_locking`: If `True` use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "Adadelta". - - -- - - - -#### `tf.train.AdadeltaOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#AdadeltaOptimizer.apply_gradients} - -Apply gradients to variables. - -This is the second part of `minimize()`. It returns an `Operation` that -applies gradients. - -##### Args: - - -* `grads_and_vars`: List of (gradient, variable) pairs as returned by - `compute_gradients()`. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `name`: Optional name for the returned operation. Default to the - name passed to the `Optimizer` constructor. - -##### Returns: - - An `Operation` that applies the specified gradients. If `global_step` - was not None, that operation also increments `global_step`. - -##### Raises: - - -* `TypeError`: If `grads_and_vars` is malformed. -* `ValueError`: If none of the variables have gradients. - - -- - - - -#### `tf.train.AdadeltaOptimizer.compute_gradients(loss, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, grad_loss=None)` {#AdadeltaOptimizer.compute_gradients} - -Compute gradients of `loss` for the variables in `var_list`. - -This is the first part of `minimize()`. It returns a list -of (gradient, variable) pairs where "gradient" is the gradient -for "variable". Note that "gradient" can be a `Tensor`, an -`IndexedSlices`, or `None` if there is no gradient for the -given variable. - -##### Args: - - -* `loss`: A Tensor containing the value to minimize. -* `var_list`: Optional list of `tf.Variable` to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKey.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - A list of (gradient, variable) pairs. Variable is always present, but - gradient can be `None`. - -##### Raises: - - -* `TypeError`: If `var_list` contains anything else than `Variable` objects. -* `ValueError`: If some arguments are invalid. - - -- - - - -#### `tf.train.AdadeltaOptimizer.get_name()` {#AdadeltaOptimizer.get_name} - - - - -- - - - -#### `tf.train.AdadeltaOptimizer.get_slot(var, name)` {#AdadeltaOptimizer.get_slot} - -Return a slot named `name` created for `var` by the Optimizer. - -Some `Optimizer` subclasses use additional variables. For example -`Momentum` and `Adagrad` use variables to accumulate updates. This method -gives access to these `Variable` objects if for some reason you need them. - -Use `get_slot_names()` to get the list of slot names created by the -`Optimizer`. - -##### Args: - - -* `var`: A variable passed to `minimize()` or `apply_gradients()`. -* `name`: A string. - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - -- - - - -#### `tf.train.AdadeltaOptimizer.get_slot_names()` {#AdadeltaOptimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -See `get_slot()`. - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.train.AdadeltaOptimizer.minimize(loss, global_step=None, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, name=None, grad_loss=None)` {#AdadeltaOptimizer.minimize} - -Add operations to minimize `loss` by updating `var_list`. - -This method simply combines calls `compute_gradients()` and -`apply_gradients()`. If you want to process the gradient before applying -them call `compute_gradients()` and `apply_gradients()` explicitly instead -of using this function. - -##### Args: - - -* `loss`: A `Tensor` containing the value to minimize. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `name`: Optional name for the returned operation. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - An Operation that updates the variables in `var_list`. If `global_step` - was not `None`, that operation also increments `global_step`. - -##### Raises: - - -* `ValueError`: If some of the variables are not `Variable` objects. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.ClusterSpec.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.ClusterSpec.md deleted file mode 100644 index bd4c26b2d3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.ClusterSpec.md +++ /dev/null @@ -1,210 +0,0 @@ -Represents a cluster as a set of "tasks", organized into "jobs". - -A `tf.train.ClusterSpec` represents the set of processes that -participate in a distributed TensorFlow computation. Every -[`tf.train.Server`](#Server) is constructed in a particular cluster. - -To create a cluster with two jobs and five tasks, you specify the -mapping from job names to lists of network addresses (typically -hostname-port pairs). - -```python -cluster = tf.train.ClusterSpec({"worker": ["worker0.example.com:2222", - "worker1.example.com:2222", - "worker2.example.com:2222"], - "ps": ["ps0.example.com:2222", - "ps1.example.com:2222"]}) -``` - -Each job may also be specified as a sparse mapping from task indices -to network addresses. This enables a server to be configured without -needing to know the identity of (for example) all other worker -tasks: - -```python -cluster = tf.train.ClusterSpec({"worker": {1: "worker1.example.com:2222"}, - "ps": ["ps0.example.com:2222", - "ps1.example.com:2222"]}) -``` - -- - - - -#### `tf.train.ClusterSpec.as_cluster_def()` {#ClusterSpec.as_cluster_def} - -Returns a `tf.train.ClusterDef` protocol buffer based on this cluster. - - -- - - - -#### `tf.train.ClusterSpec.as_dict()` {#ClusterSpec.as_dict} - -Returns a dictionary from job names to their tasks. - -For each job, if the task index space is dense, the corresponding -value will be a list of network addresses; otherwise it will be a -dictionary mapping (sparse) task indices to the corresponding -addresses. - -##### Returns: - - A dictionary mapping job names to lists or dictionaries - describing the tasks in those jobs. - - - -#### Other Methods -- - - - -#### `tf.train.ClusterSpec.__bool__()` {#ClusterSpec.__bool__} - - - - -- - - - -#### `tf.train.ClusterSpec.__eq__(other)` {#ClusterSpec.__eq__} - - - - -- - - - -#### `tf.train.ClusterSpec.__init__(cluster)` {#ClusterSpec.__init__} - -Creates a `ClusterSpec`. - -##### Args: - - -* `cluster`: A dictionary mapping one or more job names to (i) a - list of network addresses, or (ii) a dictionary mapping integer - task indices to network addresses; or a `tf.train.ClusterDef` - protocol buffer. - -##### Raises: - - -* `TypeError`: If `cluster` is not a dictionary mapping strings to lists - of strings, and not a `tf.train.ClusterDef` protobuf. - - -- - - - -#### `tf.train.ClusterSpec.__ne__(other)` {#ClusterSpec.__ne__} - - - - -- - - - -#### `tf.train.ClusterSpec.__nonzero__()` {#ClusterSpec.__nonzero__} - - - - -- - - - -#### `tf.train.ClusterSpec.job_tasks(job_name)` {#ClusterSpec.job_tasks} - -Returns a mapping from task ID to address in the given job. - -NOTE: For backwards compatibility, this method returns a list. If -the given job was defined with a sparse set of task indices, the -length of this list may not reflect the number of tasks defined in -this job. Use the [`num_tasks()`](#ClusterSpec.num_tasks) method -to find the number of tasks defined in a particular job. - -##### Args: - - -* `job_name`: The string name of a job in this cluster. - -##### Returns: - - A list of task addresses, where the index in the list - corresponds to the task index of each task. The list may contain - `None` if the job was defined with a sparse set of task indices. - -##### Raises: - - -* `ValueError`: If `job_name` does not name a job in this cluster. - - -- - - - -#### `tf.train.ClusterSpec.jobs` {#ClusterSpec.jobs} - -Returns a list of job names in this cluster. - -##### Returns: - - A list of strings, corresponding to the names of jobs in this cluster. - - -- - - - -#### `tf.train.ClusterSpec.num_tasks(job_name)` {#ClusterSpec.num_tasks} - -Returns the number of tasks defined in the given job. - -##### Args: - - -* `job_name`: The string name of a job in this cluster. - -##### Returns: - - The number of tasks defined in the given job. - -##### Raises: - - -* `ValueError`: If `job_name` does not name a job in this cluster. - - -- - - - -#### `tf.train.ClusterSpec.task_address(job_name, task_index)` {#ClusterSpec.task_address} - -Returns the address of the given task in the given job. - -##### Args: - - -* `job_name`: The string name of a job in this cluster. -* `task_index`: A non-negative integer. - -##### Returns: - - The address of the given task in the given job. - -##### Raises: - - -* `ValueError`: If `job_name` does not name a job in this cluster, - or no task with index `task_index` is defined in that job. - - -- - - - -#### `tf.train.ClusterSpec.task_indices(job_name)` {#ClusterSpec.task_indices} - -Returns a list of valid task indices in the given job. - -##### Args: - - -* `job_name`: The string name of a job in this cluster. - -##### Returns: - - A list of valid task indices in the given job. - -##### Raises: - - -* `ValueError`: If `job_name` does not name a job in this cluster, - or no task with index `task_index` is defined in that job. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.GradientDescentOptimizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.GradientDescentOptimizer.md deleted file mode 100644 index 99a5f1f0b1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.GradientDescentOptimizer.md +++ /dev/null @@ -1,18 +0,0 @@ -Optimizer that implements the gradient descent algorithm. - -- - - - -#### `tf.train.GradientDescentOptimizer.__init__(learning_rate, use_locking=False, name='GradientDescent')` {#GradientDescentOptimizer.__init__} - -Construct a new gradient descent optimizer. - -##### Args: - - -* `learning_rate`: A Tensor or a floating point value. The learning - rate to use. -* `use_locking`: If True use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "GradientDescent". - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.LoggingTensorHook.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.LoggingTensorHook.md deleted file mode 100644 index e76b7838ed..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.LoggingTensorHook.md +++ /dev/null @@ -1,85 +0,0 @@ -Prints the given tensors once every N local steps or once every N seconds. - -The tensors will be printed to the log, with `INFO` severity. -- - - - -#### `tf.train.LoggingTensorHook.__init__(tensors, every_n_iter=None, every_n_secs=None, formatter=None)` {#LoggingTensorHook.__init__} - -Initializes a LoggingHook monitor. - -##### Args: - - -* `tensors`: `dict` that maps string-valued tags to tensors/tensor names, - or `iterable` of tensors/tensor names. -* `every_n_iter`: `int`, print the values of `tensors` once every N local - steps taken on the current worker. -* `every_n_secs`: `int` or `float`, print the values of `tensors` once every N - seconds. Exactly one of `every_n_iter` and `every_n_secs` should be - provided. -* `formatter`: function, takes dict of `tag`->`Tensor` and returns a string. - If `None` uses default printing all tensors. - -##### Raises: - - -* `ValueError`: if `every_n_iter` is non-positive. - - -- - - - -#### `tf.train.LoggingTensorHook.after_create_session(session, coord)` {#LoggingTensorHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.LoggingTensorHook.after_run(run_context, run_values)` {#LoggingTensorHook.after_run} - - - - -- - - - -#### `tf.train.LoggingTensorHook.before_run(run_context)` {#LoggingTensorHook.before_run} - - - - -- - - - -#### `tf.train.LoggingTensorHook.begin()` {#LoggingTensorHook.begin} - - - - -- - - - -#### `tf.train.LoggingTensorHook.end(session)` {#LoggingTensorHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.LooperThread.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.LooperThread.md deleted file mode 100644 index d4fc63d870..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.LooperThread.md +++ /dev/null @@ -1,222 +0,0 @@ -A thread that runs code repeatedly, optionally on a timer. - -This thread class is intended to be used with a `Coordinator`. It repeatedly -runs code specified either as `target` and `args` or by the `run_loop()` -method. - -Before each run the thread checks if the coordinator has requested stop. In -that case the looper thread terminates immediately. - -If the code being run raises an exception, that exception is reported to the -coordinator and the thread terminates. The coordinator will then request all -the other threads it coordinates to stop. - -You typically pass looper threads to the supervisor `Join()` method. -- - - - -#### `tf.train.LooperThread.__init__(coord, timer_interval_secs, target=None, args=None, kwargs=None)` {#LooperThread.__init__} - -Create a LooperThread. - -##### Args: - - -* `coord`: A Coordinator. -* `timer_interval_secs`: Time boundaries at which to call Run(), or None - if it should be called back to back. -* `target`: Optional callable object that will be executed in the thread. -* `args`: Optional arguments to pass to `target` when calling it. -* `kwargs`: Optional keyword arguments to pass to `target` when calling it. - -##### Raises: - - -* `ValueError`: If one of the arguments is invalid. - - -- - - - -#### `tf.train.LooperThread.__repr__()` {#LooperThread.__repr__} - - - - -- - - - -#### `tf.train.LooperThread.daemon` {#LooperThread.daemon} - -A boolean value indicating whether this thread is a daemon thread (True) or not (False). - -This must be set before start() is called, otherwise RuntimeError is -raised. Its initial value is inherited from the creating thread; the -main thread is not a daemon thread and therefore all threads created in -the main thread default to daemon = False. - -The entire Python program exits when no alive non-daemon threads are -left. - - -- - - - -#### `tf.train.LooperThread.getName()` {#LooperThread.getName} - - - - -- - - - -#### `tf.train.LooperThread.ident` {#LooperThread.ident} - -Thread identifier of this thread or None if it has not been started. - -This is a nonzero integer. See the thread.get_ident() function. Thread -identifiers may be recycled when a thread exits and another thread is -created. The identifier is available even after the thread has exited. - - -- - - - -#### `tf.train.LooperThread.isAlive()` {#LooperThread.isAlive} - -Return whether the thread is alive. - -This method returns True just before the run() method starts until just -after the run() method terminates. The module function enumerate() -returns a list of all alive threads. - - -- - - - -#### `tf.train.LooperThread.isDaemon()` {#LooperThread.isDaemon} - - - - -- - - - -#### `tf.train.LooperThread.is_alive()` {#LooperThread.is_alive} - -Return whether the thread is alive. - -This method returns True just before the run() method starts until just -after the run() method terminates. The module function enumerate() -returns a list of all alive threads. - - -- - - - -#### `tf.train.LooperThread.join(timeout=None)` {#LooperThread.join} - -Wait until the thread terminates. - -This blocks the calling thread until the thread whose join() method is -called terminates -- either normally or through an unhandled exception -or until the optional timeout occurs. - -When the timeout argument is present and not None, it should be a -floating point number specifying a timeout for the operation in seconds -(or fractions thereof). As join() always returns None, you must call -isAlive() after join() to decide whether a timeout happened -- if the -thread is still alive, the join() call timed out. - -When the timeout argument is not present or None, the operation will -block until the thread terminates. - -A thread can be join()ed many times. - -join() raises a RuntimeError if an attempt is made to join the current -thread as that would cause a deadlock. It is also an error to join() a -thread before it has been started and attempts to do so raises the same -exception. - - -- - - - -#### `tf.train.LooperThread.loop(coord, timer_interval_secs, target, args=None, kwargs=None)` {#LooperThread.loop} - -Start a LooperThread that calls a function periodically. - -If `timer_interval_secs` is None the thread calls `target(args)` -repeatedly. Otherwise `target(args)` is called every `timer_interval_secs` -seconds. The thread terminates when a stop of the coordinator is -requested. - -##### Args: - - -* `coord`: A Coordinator. -* `timer_interval_secs`: Number. Time boundaries at which to call `target`. -* `target`: A callable object. -* `args`: Optional arguments to pass to `target` when calling it. -* `kwargs`: Optional keyword arguments to pass to `target` when calling it. - -##### Returns: - - The started thread. - - -- - - - -#### `tf.train.LooperThread.name` {#LooperThread.name} - -A string used for identification purposes only. - -It has no semantics. Multiple threads may be given the same name. The -initial name is set by the constructor. - - -- - - - -#### `tf.train.LooperThread.run()` {#LooperThread.run} - - - - -- - - - -#### `tf.train.LooperThread.run_loop()` {#LooperThread.run_loop} - -Called at 'timer_interval_secs' boundaries. - - -- - - - -#### `tf.train.LooperThread.setDaemon(daemonic)` {#LooperThread.setDaemon} - - - - -- - - - -#### `tf.train.LooperThread.setName(name)` {#LooperThread.setName} - - - - -- - - - -#### `tf.train.LooperThread.start()` {#LooperThread.start} - -Start the thread's activity. - -It must be called at most once per thread object. It arranges for the -object's run() method to be invoked in a separate thread of control. - -This method will raise a RuntimeError if called more than once on the -same thread object. - - -- - - - -#### `tf.train.LooperThread.start_loop()` {#LooperThread.start_loop} - -Called when the thread starts. - - -- - - - -#### `tf.train.LooperThread.stop_loop()` {#LooperThread.stop_loop} - -Called when the thread stops. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.MonitoredSession.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.MonitoredSession.md deleted file mode 100644 index 0e96f64ff4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.MonitoredSession.md +++ /dev/null @@ -1,128 +0,0 @@ -Session-like object that handles initialization, recovery and hooks. - -Example usage: - -```python -saver_hook = CheckpointSaverHook(...) -summary_hook = SummaryHook(...) -with MonitoredSession(session_creator=ChiefSessionCreator(...), - hooks=[saver_hook, summary_hook]) as sess: - while not sess.should_stop(): - sess.run(train_op) -``` - -Initialization: At creation time the monitored session does following things -in given order: - -* calls `hook.begin()` for each given hook -* finalizes the graph via `scaffold.finalize()` -* create session -* initializes the model via initialization ops provided by `Scaffold` -* restores variables if a checkpoint exists -* launches queue runners - -Run: When `run()` is called, the monitored session does following things: - -* calls `hook.before_run()` -* calls TensorFlow `session.run()` with merged fetches and feed_dict -* calls `hook.after_run()` -* returns result of `session.run()` asked by user -* if `AbortedError` occurs, it recovers or reinitializes the session before - executing the run() call again - - -Exit: At the `close()`, the monitored session does following things in order: - -* calls `hook.end()` -* closes the queue runners and the session -* suppresses `OutOfRange` error which indicates that all inputs have been - processed if the monitored_session is used as a context - -How to set `tf.Session` arguments: - -* In most cases you can set session arguments as follows: - -```python -MonitoredSession( - session_creator=ChiefSessionCreator(master=..., config=...)) -``` - -* In distributed setting for a non-chief worker, you can use following: - -```python -MonitoredSession( - session_creator=WorkerSessionCreator(master=..., config=...)) -``` - -See `MonitoredTrainingSession` for an example usage based on chief or worker. - -Args: - session_creator: A factory object to create session. Typically a - `ChiefSessionCreator` which is the default one. - hooks: An iterable of `SessionRunHook' objects. - -Returns: - A MonitoredSession object. -- - - - -#### `tf.train.MonitoredSession.__enter__()` {#MonitoredSession.__enter__} - - - - -- - - - -#### `tf.train.MonitoredSession.__exit__(exception_type, exception_value, traceback)` {#MonitoredSession.__exit__} - - - - -- - - - -#### `tf.train.MonitoredSession.__init__(session_creator=None, hooks=None, stop_grace_period_secs=120)` {#MonitoredSession.__init__} - - - - -- - - - -#### `tf.train.MonitoredSession.close()` {#MonitoredSession.close} - - - - -- - - - -#### `tf.train.MonitoredSession.graph` {#MonitoredSession.graph} - -The graph that was launched in this session. - - -- - - - -#### `tf.train.MonitoredSession.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#MonitoredSession.run} - -Run ops in the monitored session. - -This method is completely compatible with the `tf.Session.run()` method. - -##### Args: - - -* `fetches`: Same as `tf.Session.run()`. -* `feed_dict`: Same as `tf.Session.run()`. -* `options`: Same as `tf.Session.run()`. -* `run_metadata`: Same as `tf.Session.run()`. - -##### Returns: - - Same as `tf.Session.run()`. - - -- - - - -#### `tf.train.MonitoredSession.should_stop()` {#MonitoredSession.should_stop} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.MonitoredTrainingSession.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.MonitoredTrainingSession.md deleted file mode 100644 index d84ddbe277..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.MonitoredTrainingSession.md +++ /dev/null @@ -1,44 +0,0 @@ -### `tf.train.MonitoredTrainingSession(master='', is_chief=True, checkpoint_dir=None, scaffold=None, hooks=None, chief_only_hooks=None, save_checkpoint_secs=600, save_summaries_steps=100, save_summaries_secs=None, config=None, stop_grace_period_secs=120)` {#MonitoredTrainingSession} - -Creates a `MonitoredSession` for training. - -For a chief, this utility sets proper session initializer/restorer. It also -creates hooks related to checkpoint and summary saving. For workers, this -utility sets proper session creator which waits for the chief to -inialize/restore. - - -##### Args: - - -* `master`: `String` the TensorFlow master to use. -* `is_chief`: If `True`, it will take care of initialization and recovery the - underlying TensorFlow session. If `False`, it will wait on a chief to - initialize or recover the TensorFlow session. -* `checkpoint_dir`: A string. Optional path to a directory where to restore - variables. -* `scaffold`: A `Scaffold` used for gathering or building supportive ops. If - not specified, a default one is created. It's used to finalize the graph. -* `hooks`: Optional list of `SessionRunHook` objects. -* `chief_only_hooks`: list of `SessionRunHook` objects. Activate these hooks if - `is_chief==True`, ignore otherwise. -* `save_checkpoint_secs`: The frequency, in seconds, that a checkpoint is saved - using a default checkpoint saver. If `save_checkpoint_secs` is set to - `None`, then the default checkpoint saver isn't used. -* `save_summaries_steps`: The frequency, in number of global steps, that the - summaries are written to disk using a default summary saver. If both - `save_summaries_steps` and `save_summaries_secs` are set to `None`, then - the default summary saver isn't used. -* `save_summaries_secs`: The frequency, in secs, that the summaries are written - to disk using a default summary saver. If both `save_summaries_steps` and - `save_summaries_secs` are set to `None`, then the default summary saver - isn't used. -* `config`: an instance of `tf.ConfigProto` proto used to configure the session. - It's the `config` argument of constructor of `tf.Session`. -* `stop_grace_period_secs`: Number of seconds given to threads to stop after - `close()` has been called. - -##### Returns: - - A `MonitoredSession` object. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.NanTensorHook.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.NanTensorHook.md deleted file mode 100644 index 6e509684c2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.NanTensorHook.md +++ /dev/null @@ -1,80 +0,0 @@ -NaN Loss monitor. - -Monitors loss and stops training if loss is NaN. -Can either fail with exception or just stop training. -- - - - -#### `tf.train.NanTensorHook.__init__(loss_tensor, fail_on_nan_loss=True)` {#NanTensorHook.__init__} - -Initializes NanLoss monitor. - -##### Args: - - -* `loss_tensor`: `Tensor`, the loss tensor. -* `fail_on_nan_loss`: `bool`, whether to raise exception when loss is NaN. - - -- - - - -#### `tf.train.NanTensorHook.after_create_session(session, coord)` {#NanTensorHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.NanTensorHook.after_run(run_context, run_values)` {#NanTensorHook.after_run} - - - - -- - - - -#### `tf.train.NanTensorHook.before_run(run_context)` {#NanTensorHook.before_run} - - - - -- - - - -#### `tf.train.NanTensorHook.begin()` {#NanTensorHook.begin} - -Called once before using the session. - -When called, the default graph is the one that will be launched in the -session. The hook can modify the graph by adding new operations to it. -After the `begin()` call the graph will be finalized and the other callbacks -can not modify the graph anymore. Second call of `begin()` on the same -graph, should not change the graph. - - -- - - - -#### `tf.train.NanTensorHook.end(session)` {#NanTensorHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.Server.create_local_server.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.Server.create_local_server.md deleted file mode 100644 index 9834004957..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.Server.create_local_server.md +++ /dev/null @@ -1,21 +0,0 @@ -#### `tf.train.Server.create_local_server(config=None, start=True)` {#Server.create_local_server} - -Creates a new single-process cluster running on the local host. - -This method is a convenience wrapper for creating a -`tf.train.Server` with a `tf.train.ServerDef` that specifies a -single-process cluster containing a single task in a job called -`"local"`. - -##### Args: - - -* `config`: (Options.) A `tf.ConfigProto` that specifies default - configuration options for all sessions that run on this server. -* `start`: (Optional.) Boolean, indicating whether to start the server after - creating it. Defaults to `True`. - -##### Returns: - - A local `tf.train.Server`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.generate_checkpoint_state_proto.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.generate_checkpoint_state_proto.md deleted file mode 100644 index 7405b289e3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.generate_checkpoint_state_proto.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.train.generate_checkpoint_state_proto(save_dir, model_checkpoint_path, all_model_checkpoint_paths=None)` {#generate_checkpoint_state_proto} - -Generates a checkpoint state proto. - -##### Args: - - -* `save_dir`: Directory where the model was saved. -* `model_checkpoint_path`: The checkpoint file. -* `all_model_checkpoint_paths`: List of strings. Paths to all not-yet-deleted - checkpoints, sorted from oldest to newest. If this is a non-empty list, - the last element must be equal to model_checkpoint_path. These paths - are also saved in the CheckpointState proto. - -##### Returns: - - CheckpointState proto with model_checkpoint_path and - all_model_checkpoint_paths updated to either absolute paths or - relative paths to the current save_dir. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.maybe_batch.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.maybe_batch.md deleted file mode 100644 index ed68f0e240..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.maybe_batch.md +++ /dev/null @@ -1,41 +0,0 @@ -### `tf.train.maybe_batch(tensors, keep_input, batch_size, num_threads=1, capacity=32, enqueue_many=False, shapes=None, dynamic_pad=False, allow_smaller_final_batch=False, shared_name=None, name=None)` {#maybe_batch} - -Conditionally creates batches of tensors based on `keep_input`. - -See docstring in `batch` for more details. - -##### Args: - - -* `tensors`: The list or dictionary of tensors to enqueue. -* `keep_input`: A `bool` Tensor. This tensor controls whether the input is - added to the queue or not. If it is a scalar and evaluates `True`, then - `tensors` are all added to the queue. If it is a vector and `enqueue_many` - is `True`, then each example is added to the queue only if the - corresonding value in `keep_input` is `True`. This tensor essentially acts - as a filtering mechanism. -* `batch_size`: The new batch size pulled from the queue. -* `num_threads`: The number of threads enqueuing `tensors`. -* `capacity`: An integer. The maximum number of elements in the queue. -* `enqueue_many`: Whether each tensor in `tensors` is a single example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensors`. -* `dynamic_pad`: Boolean. Allow variable dimensions in input shapes. - The given dimensions are padded upon dequeue so that tensors within a - batch have the same shapes. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (Optional). If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the same types as `tensors`. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensors`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.shuffle_batch_join.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.shuffle_batch_join.md deleted file mode 100644 index 13a925678a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.train.shuffle_batch_join.md +++ /dev/null @@ -1,77 +0,0 @@ -### `tf.train.shuffle_batch_join(tensors_list, batch_size, capacity, min_after_dequeue, seed=None, enqueue_many=False, shapes=None, allow_smaller_final_batch=False, shared_name=None, name=None)` {#shuffle_batch_join} - -Create batches by randomly shuffling tensors. - -The `tensors_list` argument is a list of tuples of tensors, or a list of -dictionaries of tensors. Each element in the list is treated similarly -to the `tensors` argument of `tf.train.shuffle_batch()`. - -This version enqueues a different list of tensors in different threads. -It adds the following to the current `Graph`: - -* A shuffling queue into which tensors from `tensors_list` are enqueued. -* A `dequeue_many` operation to create batches from the queue. -* A `QueueRunner` to `QUEUE_RUNNER` collection, to enqueue the tensors - from `tensors_list`. - -`len(tensors_list)` threads will be started, with thread `i` enqueuing -the tensors from `tensors_list[i]`. `tensors_list[i1][j]` must match -`tensors_list[i2][j]` in type and shape, except in the first dimension if -`enqueue_many` is true. - -If `enqueue_many` is `False`, each `tensors_list[i]` is assumed -to represent a single example. An input tensor with shape `[x, y, z]` -will be output as a tensor with shape `[batch_size, x, y, z]`. - -If `enqueue_many` is `True`, `tensors_list[i]` is assumed to -represent a batch of examples, where the first dimension is indexed -by example, and all members of `tensors_list[i]` should have the -same size in the first dimension. If an input tensor has shape `[*, x, -y, z]`, the output will have shape `[batch_size, x, y, z]`. - -The `capacity` argument controls the how long the prefetching is allowed to -grow the queues. - -The returned operation is a dequeue operation and will throw -`tf.errors.OutOfRangeError` if the input queue is exhausted. If this -operation is feeding another input queue, its queue runner will catch -this exception, however, if this operation is used in your main thread -you are responsible for catching this yourself. - -If `allow_smaller_final_batch` is `True`, a smaller batch value than -`batch_size` is returned when the queue is closed and there are not enough -elements to fill the batch, otherwise the pending elements are discarded. -In addition, all output tensors' static shapes, as accessed via the -`get_shape` method will have a first `Dimension` value of `None`, and -operations that depend on fixed batch_size would fail. - -##### Args: - - -* `tensors_list`: A list of tuples or dictionaries of tensors to enqueue. -* `batch_size`: An integer. The new batch size pulled from the queue. -* `capacity`: An integer. The maximum number of elements in the queue. -* `min_after_dequeue`: Minimum number elements in the queue after a - dequeue, used to ensure a level of mixing of elements. -* `seed`: Seed for the random shuffling within the queue. -* `enqueue_many`: Whether each tensor in `tensor_list_list` is a single - example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensors_list[i]`. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (optional). If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the same number and types as - `tensors_list[i]`. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensors_list`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.unsorted_segment_max.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.unsorted_segment_max.md deleted file mode 100644 index 655f08dbe9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.unsorted_segment_max.md +++ /dev/null @@ -1,38 +0,0 @@ -### `tf.unsorted_segment_max(data, segment_ids, num_segments, name=None)` {#unsorted_segment_max} - -Computes the Max along segments of a tensor. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -This operator is similar to the [unsorted segment sum operator](../../api_docs/python/math_ops.md#UnsortedSegmentSum). -Instead of computing the sum over segments, it computes the maximum -such that: - -\\(output_i = \max_j data_j\\) where max is over `j` such -that `segment_ids[j] == i`. - -If the maximum is empty for a given segment ID `i`, it outputs the smallest possible value for specific numeric type, - `output[i] = numeric_limits::min()`. - -
- -
- -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `segment_ids`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor whose rank is equal to the rank of `data`'s - first dimension. -* `num_segments`: A `Tensor` of type `int32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `num_segments`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.unstack.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.unstack.md deleted file mode 100644 index 872ef968c1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.unstack.md +++ /dev/null @@ -1,42 +0,0 @@ -### `tf.unstack(value, num=None, axis=0, name='unstack')` {#unstack} - -Unpacks the given dimension of a rank-`R` tensor into rank-`(R-1)` tensors. - -Unpacks `num` tensors from `value` by chipping it along the `axis` dimension. -If `num` is not specified (the default), it is inferred from `value`'s shape. -If `value.shape[axis]` is not known, `ValueError` is raised. - -For example, given a tensor of shape `(A, B, C, D)`; - -If `axis == 0` then the i'th tensor in `output` is the slice - `value[i, :, :, :]` and each tensor in `output` will have shape `(B, C, D)`. - (Note that the dimension unpacked along is gone, unlike `split`). - -If `axis == 1` then the i'th tensor in `output` is the slice - `value[:, i, :, :]` and each tensor in `output` will have shape `(A, C, D)`. -Etc. - -This is the opposite of pack. The numpy equivalent is - - tf.unstack(x, n) = list(x) - -##### Args: - - -* `value`: A rank `R > 0` `Tensor` to be unstacked. -* `num`: An `int`. The length of the dimension `axis`. Automatically inferred - if `None` (the default). -* `axis`: An `int`. The axis to unstack along. Defaults to the first - dimension. Supports negative indexes. -* `name`: A name for the operation (optional). - -##### Returns: - - The list of `Tensor` objects unstacked from `value`. - -##### Raises: - - -* `ValueError`: If `num` is unspecified and cannot be inferred. -* `ValueError`: If `axis` is out of the range [-R, R). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.zeros.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.zeros.md deleted file mode 100644 index 590294db65..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.zeros.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.zeros(shape, dtype=tf.float32, name=None)` {#zeros} - -Creates a tensor with all elements set to zero. - -This operation returns a tensor of type `dtype` with shape `shape` and -all elements set to zero. - -For example: - -```python -tf.zeros([3, 4], tf.int32) ==> [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] -``` - -##### Args: - - -* `shape`: Either a list of integers, or a 1-D `Tensor` of type `int32`. -* `dtype`: The type of an element in the resulting `Tensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` with all elements set to zero. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.zeros_like.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.zeros_like.md deleted file mode 100644 index 178c2ae467..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf.zeros_like.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.zeros_like(tensor, dtype=None, name=None, optimize=True)` {#zeros_like} - -Creates a tensor with all elements set to zero. - -Given a single tensor (`tensor`), this operation returns a tensor of the -same type and shape as `tensor` with all elements set to zero. Optionally, -you can use `dtype` to specify a new type for the returned tensor. - -For example: - -```python -# 'tensor' is [[1, 2, 3], [4, 5, 6]] -tf.zeros_like(tensor) ==> [[0, 0, 0], [0, 0, 0]] -``` - -##### Args: - - -* `tensor`: A `Tensor`. -* `dtype`: A type for the returned `Tensor`. Must be `float32`, `float64`, - `int8`, `int16`, `int32`, `int64`, `uint8`, `complex64`, or `complex128`. - -* `name`: A name for the operation (optional). -* `optimize`: if true, attempt to statically determine the shape of 'tensor' - and encode it as a constant. - -##### Returns: - - A `Tensor` with all elements set to zero. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf_debug.LocalCLIDebugHook.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf_debug.LocalCLIDebugHook.md deleted file mode 100644 index eeb4226633..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard1/tf_debug.LocalCLIDebugHook.md +++ /dev/null @@ -1,256 +0,0 @@ -Command-line-interface debugger hook. - -Can be used as a monitor/hook for `tf.train.MonitoredSession`s and -`tf.contrib.learn`'s `Estimator`s and `Experiment`s. -- - - - -#### `tf_debug.LocalCLIDebugHook.__enter__()` {#LocalCLIDebugHook.__enter__} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.__exit__(exec_type, exec_value, exec_tb)` {#LocalCLIDebugHook.__exit__} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.__init__(ui_type='curses')` {#LocalCLIDebugHook.__init__} - -Create a local debugger command-line interface (CLI) hook. - -##### Args: - - -* `ui_type`: (str) user-interface type. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.add_tensor_filter(filter_name, tensor_filter)` {#LocalCLIDebugHook.add_tensor_filter} - -Add a tensor filter. - -See doc of `LocalCLIDebugWrapperSession.add_tensor_filter()` for details. -Override default behavior to accomodate the possibility of this method being -called prior to the initialization of the underlying -`LocalCLIDebugWrapperSession` object. - -##### Args: - - -* `filter_name`: See doc of `LocalCLIDebugWrapperSession.add_tensor_filter()` - for details. -* `tensor_filter`: See doc of - `LocalCLIDebugWrapperSession.add_tensor_filter()` for details. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.after_create_session(session, coord)` {#LocalCLIDebugHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.after_run(run_context, run_values)` {#LocalCLIDebugHook.after_run} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.before_run(run_context)` {#LocalCLIDebugHook.before_run} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.begin()` {#LocalCLIDebugHook.begin} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.close()` {#LocalCLIDebugHook.close} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.end(session)` {#LocalCLIDebugHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.graph` {#LocalCLIDebugHook.graph} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.invoke_node_stepper(node_stepper, restore_variable_values_on_exit=True)` {#LocalCLIDebugHook.invoke_node_stepper} - -Overrides method in base class to implement interactive node stepper. - -##### Args: - - -* `node_stepper`: (`stepper.NodeStepper`) The underlying NodeStepper API - object. -* `restore_variable_values_on_exit`: (`bool`) Whether any variables whose - values have been altered during this node-stepper invocation should be - restored to their old values when this invocation ends. - -##### Returns: - - The same return values as the `Session.run()` call on the same fetches as - the NodeStepper. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.on_run_end(request)` {#LocalCLIDebugHook.on_run_end} - -Overrides on-run-end callback. - -##### Actions taken: - - 1) Load the debug dump. - 2) Bring up the Analyzer CLI. - -##### Args: - - -* `request`: An instance of OnSessionInitRequest. - -##### Returns: - - An instance of OnSessionInitResponse. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.on_run_start(request)` {#LocalCLIDebugHook.on_run_start} - -Overrides on-run-start callback. - -##### Invoke the CLI to let user choose what action to take: - - `run` / `invoke_stepper`. - -##### Args: - - -* `request`: An instance of `OnSessionInitRequest`. - -##### Returns: - - An instance of `OnSessionInitResponse`. - -##### Raises: - - -* `RuntimeError`: If user chooses to prematurely exit the debugger. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.on_session_init(request)` {#LocalCLIDebugHook.on_session_init} - -Overrides on-session-init callback. - -##### Args: - - -* `request`: An instance of `OnSessionInitRequest`. - -##### Returns: - - An instance of `OnSessionInitResponse`. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.partial_run(handle, fetches, feed_dict=None)` {#LocalCLIDebugHook.partial_run} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.partial_run_setup(fetches, feeds=None)` {#LocalCLIDebugHook.partial_run_setup} - -Sets up the feeds and fetches for partial runs in the session. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#LocalCLIDebugHook.run} - -Wrapper around Session.run() that inserts tensor watch options. - -##### Args: - - -* `fetches`: Same as the `fetches` arg to regular `Session.run()`. -* `feed_dict`: Same as the `feed_dict` arg to regular `Session.run()`. -* `options`: Same as the `options` arg to regular `Session.run()`. -* `run_metadata`: Same as the `run_metadata` arg to regular `Session.run()`. - -##### Returns: - - Simply forwards the output of the wrapped `Session.run()` call. - -##### Raises: - - -* `ValueError`: On invalid `OnRunStartAction` value. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.sess_str` {#LocalCLIDebugHook.sess_str} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.session` {#LocalCLIDebugHook.session} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.DType.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.DType.md deleted file mode 100644 index 7035798b17..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.DType.md +++ /dev/null @@ -1,250 +0,0 @@ -Represents the type of the elements in a `Tensor`. - -The following `DType` objects are defined: - -* `tf.float16`: 16-bit half-precision floating-point. -* `tf.float32`: 32-bit single-precision floating-point. -* `tf.float64`: 64-bit double-precision floating-point. -* `tf.bfloat16`: 16-bit truncated floating-point. -* `tf.complex64`: 64-bit single-precision complex. -* `tf.complex128`: 128-bit double-precision complex. -* `tf.int8`: 8-bit signed integer. -* `tf.uint8`: 8-bit unsigned integer. -* `tf.uint16`: 16-bit unsigned integer. -* `tf.int16`: 16-bit signed integer. -* `tf.int32`: 32-bit signed integer. -* `tf.int64`: 64-bit signed integer. -* `tf.bool`: Boolean. -* `tf.string`: String. -* `tf.qint8`: Quantized 8-bit signed integer. -* `tf.quint8`: Quantized 8-bit unsigned integer. -* `tf.qint16`: Quantized 16-bit signed integer. -* `tf.quint16`: Quantized 16-bit unsigned integer. -* `tf.qint32`: Quantized 32-bit signed integer. -* `tf.resource`: Handle to a mutable resource. - -In addition, variants of these types with the `_ref` suffix are -defined for reference-typed tensors. - -The `tf.as_dtype()` function converts numpy types and string type -names to a `DType` object. -- - - - -#### `tf.DType.__eq__(other)` {#DType.__eq__} - -Returns True iff this DType refers to the same type as `other`. - - -- - - - -#### `tf.DType.__hash__()` {#DType.__hash__} - - - - -- - - - -#### `tf.DType.__init__(type_enum)` {#DType.__init__} - -Creates a new `DataType`. - -NOTE(mrry): In normal circumstances, you should not need to -construct a `DataType` object directly. Instead, use the -`tf.as_dtype()` function. - -##### Args: - - -* `type_enum`: A `types_pb2.DataType` enum value. - -##### Raises: - - -* `TypeError`: If `type_enum` is not a value `types_pb2.DataType`. - - -- - - - -#### `tf.DType.__ne__(other)` {#DType.__ne__} - -Returns True iff self != other. - - -- - - - -#### `tf.DType.__repr__()` {#DType.__repr__} - - - - -- - - - -#### `tf.DType.__str__()` {#DType.__str__} - - - - -- - - - -#### `tf.DType.as_datatype_enum` {#DType.as_datatype_enum} - -Returns a `types_pb2.DataType` enum value based on this `DType`. - - -- - - - -#### `tf.DType.as_numpy_dtype` {#DType.as_numpy_dtype} - -Returns a `numpy.dtype` based on this `DType`. - - -- - - - -#### `tf.DType.base_dtype` {#DType.base_dtype} - -Returns a non-reference `DType` based on this `DType`. - - -- - - - -#### `tf.DType.is_bool` {#DType.is_bool} - -Returns whether this is a boolean data type - - -- - - - -#### `tf.DType.is_compatible_with(other)` {#DType.is_compatible_with} - -Returns True if the `other` DType will be converted to this DType. - -The conversion rules are as follows: - -```python -DType(T) .is_compatible_with(DType(T)) == True -DType(T) .is_compatible_with(DType(T).as_ref) == True -DType(T).as_ref.is_compatible_with(DType(T)) == False -DType(T).as_ref.is_compatible_with(DType(T).as_ref) == True -``` - -##### Args: - - -* `other`: A `DType` (or object that may be converted to a `DType`). - -##### Returns: - - True if a Tensor of the `other` `DType` will be implicitly converted to - this `DType`. - - -- - - - -#### `tf.DType.is_complex` {#DType.is_complex} - -Returns whether this is a complex floating point type. - - -- - - - -#### `tf.DType.is_floating` {#DType.is_floating} - -Returns whether this is a (non-quantized, real) floating point type. - - -- - - - -#### `tf.DType.is_integer` {#DType.is_integer} - -Returns whether this is a (non-quantized) integer type. - - -- - - - -#### `tf.DType.is_numpy_compatible` {#DType.is_numpy_compatible} - - - - -- - - - -#### `tf.DType.is_quantized` {#DType.is_quantized} - -Returns whether this is a quantized data type. - - -- - - - -#### `tf.DType.is_unsigned` {#DType.is_unsigned} - -Returns whether this type is unsigned. - -Non-numeric, unordered, and quantized types are not considered unsigned, and -this function returns `False`. - -##### Returns: - - Whether a `DType` is unsigned. - - -- - - - -#### `tf.DType.limits` {#DType.limits} - -Return intensity limits, i.e. (min, max) tuple, of the dtype. - -##### Args: - - clip_negative : bool, optional - If True, clip the negative range (i.e. return 0 for min intensity) - even if the image dtype allows negative values. -Returns - min, max : tuple - Lower and upper intensity limits. - - -- - - - -#### `tf.DType.max` {#DType.max} - -Returns the maximum representable value in this data type. - -##### Raises: - - -* `TypeError`: if this is a non-numeric, unordered, or quantized type. - - -- - - - -#### `tf.DType.min` {#DType.min} - -Returns the minimum representable value in this data type. - -##### Raises: - - -* `TypeError`: if this is a non-numeric, unordered, or quantized type. - - -- - - - -#### `tf.DType.name` {#DType.name} - -Returns the string name for this `DType`. - - -- - - - -#### `tf.DType.real_dtype` {#DType.real_dtype} - -Returns the dtype correspond to this dtype's real part. - - -- - - - -#### `tf.DType.size` {#DType.size} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.FIFOQueue.from_list.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.FIFOQueue.from_list.md deleted file mode 100644 index f27017af74..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.FIFOQueue.from_list.md +++ /dev/null @@ -1,21 +0,0 @@ -#### `tf.FIFOQueue.from_list(index, queues)` {#FIFOQueue.from_list} - -Create a queue using the queue reference from `queues[index]`. - -##### Args: - - -* `index`: An integer scalar tensor that determines the input that gets - selected. -* `queues`: A list of `QueueBase` objects. - -##### Returns: - - A `QueueBase` object. - -##### Raises: - - -* `TypeError`: When `queues` is not a list of `QueueBase` objects, - or when the data types of `queues` are not all the same. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.Graph.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.Graph.md deleted file mode 100644 index dc1e898211..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.Graph.md +++ /dev/null @@ -1,885 +0,0 @@ -A TensorFlow computation, represented as a dataflow graph. - -A `Graph` contains a set of -[`Operation`](../../api_docs/python/framework.md#Operation) objects, -which represent units of computation; and -[`Tensor`](../../api_docs/python/framework.md#Tensor) objects, which represent -the units of data that flow between operations. - -A default `Graph` is always registered, and accessible by calling -[`tf.get_default_graph()`](../../api_docs/python/framework.md#get_default_graph). -To add an operation to the default graph, simply call one of the functions -that defines a new `Operation`: - -```python -c = tf.constant(4.0) -assert c.graph is tf.get_default_graph() -``` - -Another typical usage involves the -[`Graph.as_default()`](../../api_docs/python/framework.md#Graph.as_default) -context manager, which overrides the current default graph for the -lifetime of the context: - -```python -g = tf.Graph() -with g.as_default(): - # Define operations and tensors in `g`. - c = tf.constant(30.0) - assert c.graph is g -``` - -Important note: This class *is not* thread-safe for graph construction. All -operations should be created from a single thread, or external -synchronization must be provided. Unless otherwise specified, all methods -are not thread-safe. - -- - - - -#### `tf.Graph.__init__()` {#Graph.__init__} - -Creates a new, empty Graph. - - -- - - - -#### `tf.Graph.as_default()` {#Graph.as_default} - -Returns a context manager that makes this `Graph` the default graph. - -This method should be used if you want to create multiple graphs -in the same process. For convenience, a global default graph is -provided, and all ops will be added to this graph if you do not -create a new graph explicitly. Use this method with the `with` keyword -to specify that ops created within the scope of a block should be -added to this graph. - -The default graph is a property of the current thread. If you -create a new thread, and wish to use the default graph in that -thread, you must explicitly add a `with g.as_default():` in that -thread's function. - -The following code examples are equivalent: - -```python -# 1. Using Graph.as_default(): -g = tf.Graph() -with g.as_default(): - c = tf.constant(5.0) - assert c.graph is g - -# 2. Constructing and making default: -with tf.Graph().as_default() as g: - c = tf.constant(5.0) - assert c.graph is g -``` - -##### Returns: - - A context manager for using this graph as the default graph. - - -- - - - -#### `tf.Graph.as_graph_def(from_version=None, add_shapes=False)` {#Graph.as_graph_def} - -Returns a serialized `GraphDef` representation of this graph. - -The serialized `GraphDef` can be imported into another `Graph` -(using [`import_graph_def()`](#import_graph_def)) or used with the -[C++ Session API](../../api_docs/cc/index.md). - -This method is thread-safe. - -##### Args: - - -* `from_version`: Optional. If this is set, returns a `GraphDef` - containing only the nodes that were added to this graph since - its `version` property had the given value. -* `add_shapes`: If true, adds an "_output_shapes" list attr to each - node with the inferred shapes of each of its outputs. - -##### Returns: - - A [`GraphDef`](https://www.tensorflow.org/code/tensorflow/core/framework/graph.proto) - protocol buffer. - -##### Raises: - - -* `ValueError`: If the `graph_def` would be too large. - - -- - - - -#### `tf.Graph.finalize()` {#Graph.finalize} - -Finalizes this graph, making it read-only. - -After calling `g.finalize()`, no new operations can be added to -`g`. This method is used to ensure that no operations are added -to a graph when it is shared between multiple threads, for example -when using a [`QueueRunner`](../../api_docs/python/train.md#QueueRunner). - - -- - - - -#### `tf.Graph.finalized` {#Graph.finalized} - -True if this graph has been finalized. - - - -- - - - -#### `tf.Graph.control_dependencies(control_inputs)` {#Graph.control_dependencies} - -Returns a context manager that specifies control dependencies. - -Use with the `with` keyword to specify that all operations constructed -within the context should have control dependencies on -`control_inputs`. For example: - -```python -with g.control_dependencies([a, b, c]): - # `d` and `e` will only run after `a`, `b`, and `c` have executed. - d = ... - e = ... -``` - -Multiple calls to `control_dependencies()` can be nested, and in -that case a new `Operation` will have control dependencies on the union -of `control_inputs` from all active contexts. - -```python -with g.control_dependencies([a, b]): - # Ops constructed here run after `a` and `b`. - with g.control_dependencies([c, d]): - # Ops constructed here run after `a`, `b`, `c`, and `d`. -``` - -You can pass None to clear the control dependencies: - -```python -with g.control_dependencies([a, b]): - # Ops constructed here run after `a` and `b`. - with g.control_dependencies(None): - # Ops constructed here run normally, not waiting for either `a` or `b`. - with g.control_dependencies([c, d]): - # Ops constructed here run after `c` and `d`, also not waiting - # for either `a` or `b`. -``` - -*N.B.* The control dependencies context applies *only* to ops that -are constructed within the context. Merely using an op or tensor -in the context does not add a control dependency. The following -example illustrates this point: - -```python -# WRONG -def my_func(pred, tensor): - t = tf.matmul(tensor, tensor) - with tf.control_dependencies([pred]): - # The matmul op is created outside the context, so no control - # dependency will be added. - return t - -# RIGHT -def my_func(pred, tensor): - with tf.control_dependencies([pred]): - # The matmul op is created in the context, so a control dependency - # will be added. - return tf.matmul(tensor, tensor) -``` - -##### Args: - - -* `control_inputs`: A list of `Operation` or `Tensor` objects which - must be executed or computed before running the operations - defined in the context. Can also be `None` to clear the control - dependencies. - -##### Returns: - - A context manager that specifies control dependencies for all - operations constructed within the context. - -##### Raises: - - -* `TypeError`: If `control_inputs` is not a list of `Operation` or - `Tensor` objects. - - -- - - - -#### `tf.Graph.device(device_name_or_function)` {#Graph.device} - -Returns a context manager that specifies the default device to use. - -The `device_name_or_function` argument may either be a device name -string, a device function, or None: - -* If it is a device name string, all operations constructed in - this context will be assigned to the device with that name, unless - overridden by a nested `device()` context. -* If it is a function, it will be treated as a function from - Operation objects to device name strings, and invoked each time - a new Operation is created. The Operation will be assigned to - the device with the returned name. -* If it is None, all `device()` invocations from the enclosing context - will be ignored. - -For information about the valid syntax of device name strings, see -the documentation in -[`DeviceNameUtils`](https://www.tensorflow.org/code/tensorflow/core/util/device_name_utils.h). - -For example: - -```python -with g.device('/gpu:0'): - # All operations constructed in this context will be placed - # on GPU 0. - with g.device(None): - # All operations constructed in this context will have no - # assigned device. - -# Defines a function from `Operation` to device string. -def matmul_on_gpu(n): - if n.type == "MatMul": - return "/gpu:0" - else: - return "/cpu:0" - -with g.device(matmul_on_gpu): - # All operations of type "MatMul" constructed in this context - # will be placed on GPU 0; all other operations will be placed - # on CPU 0. -``` - -**N.B.** The device scope may be overridden by op wrappers or -other library code. For example, a variable assignment op -`v.assign()` must be colocated with the `tf.Variable` `v`, and -incompatible device scopes will be ignored. - -##### Args: - - -* `device_name_or_function`: The device name or function to use in - the context. - -##### Returns: - - A context manager that specifies the default device to use for newly - created ops. - - -- - - - -#### `tf.Graph.name_scope(name)` {#Graph.name_scope} - -Returns a context manager that creates hierarchical names for operations. - -A graph maintains a stack of name scopes. A `with name_scope(...):` -statement pushes a new name onto the stack for the lifetime of the context. - -The `name` argument will be interpreted as follows: - -* A string (not ending with '/') will create a new name scope, in which - `name` is appended to the prefix of all operations created in the - context. If `name` has been used before, it will be made unique by - calling `self.unique_name(name)`. -* A scope previously captured from a `with g.name_scope(...) as - scope:` statement will be treated as an "absolute" name scope, which - makes it possible to re-enter existing scopes. -* A value of `None` or the empty string will reset the current name scope - to the top-level (empty) name scope. - -For example: - -```python -with tf.Graph().as_default() as g: - c = tf.constant(5.0, name="c") - assert c.op.name == "c" - c_1 = tf.constant(6.0, name="c") - assert c_1.op.name == "c_1" - - # Creates a scope called "nested" - with g.name_scope("nested") as scope: - nested_c = tf.constant(10.0, name="c") - assert nested_c.op.name == "nested/c" - - # Creates a nested scope called "inner". - with g.name_scope("inner"): - nested_inner_c = tf.constant(20.0, name="c") - assert nested_inner_c.op.name == "nested/inner/c" - - # Create a nested scope called "inner_1". - with g.name_scope("inner"): - nested_inner_1_c = tf.constant(30.0, name="c") - assert nested_inner_1_c.op.name == "nested/inner_1/c" - - # Treats `scope` as an absolute name scope, and - # switches to the "nested/" scope. - with g.name_scope(scope): - nested_d = tf.constant(40.0, name="d") - assert nested_d.op.name == "nested/d" - - with g.name_scope(""): - e = tf.constant(50.0, name="e") - assert e.op.name == "e" -``` - -The name of the scope itself can be captured by `with -g.name_scope(...) as scope:`, which stores the name of the scope -in the variable `scope`. This value can be used to name an -operation that represents the overall result of executing the ops -in a scope. For example: - -```python -inputs = tf.constant(...) -with g.name_scope('my_layer') as scope: - weights = tf.Variable(..., name="weights") - biases = tf.Variable(..., name="biases") - affine = tf.matmul(inputs, weights) + biases - output = tf.nn.relu(affine, name=scope) -``` - -NOTE: This constructor validates the given `name`. Valid scope -names match one of the following regular expressions: - - [A-Za-z0-9.][A-Za-z0-9_.\\-/]* (for scopes at the root) - [A-Za-z0-9_.\\-/]* (for other scopes) - -##### Args: - - -* `name`: A name for the scope. - -##### Returns: - - A context manager that installs `name` as a new name scope. - -##### Raises: - - -* `ValueError`: If `name` is not a valid scope name, according to the rules - above. - - - -A `Graph` instance supports an arbitrary number of "collections" -that are identified by name. For convenience when building a large -graph, collections can store groups of related objects: for -example, the `tf.Variable` uses a collection (named -[`tf.GraphKeys.GLOBAL_VARIABLES`](../../api_docs/python/framework.md#GraphKeys)) for -all variables that are created during the construction of a graph. The caller -may define additional collections by specifying a new name. - -- - - - -#### `tf.Graph.add_to_collection(name, value)` {#Graph.add_to_collection} - -Stores `value` in the collection with the given `name`. - -Note that collections are not sets, so it is possible to add a value to -a collection several times. - -##### Args: - - -* `name`: The key for the collection. The `GraphKeys` class - contains many standard names for collections. -* `value`: The value to add to the collection. - - -- - - - -#### `tf.Graph.add_to_collections(names, value)` {#Graph.add_to_collections} - -Stores `value` in the collections given by `names`. - -Note that collections are not sets, so it is possible to add a value to -a collection several times. This function makes sure that duplicates in -`names` are ignored, but it will not check for pre-existing membership of -`value` in any of the collections in `names`. - -`names` can be any iterable, but if `names` is a string, it is treated as a -single collection name. - -##### Args: - - -* `names`: The keys for the collections to add to. The `GraphKeys` class - contains many standard names for collections. -* `value`: The value to add to the collections. - - -- - - - -#### `tf.Graph.get_collection(name, scope=None)` {#Graph.get_collection} - -Returns a list of values in the collection with the given `name`. - -This is different from `get_collection_ref()` which always returns the -actual collection list if it exists in that it returns a new list each time -it is called. - -##### Args: - - -* `name`: The key for the collection. For example, the `GraphKeys` class - contains many standard names for collections. -* `scope`: (Optional.) If supplied, the resulting list is filtered to include - only items whose `name` attribute matches using `re.match`. Items - without a `name` attribute are never returned if a scope is supplied and - the choice or `re.match` means that a `scope` without special tokens - filters by prefix. - -##### Returns: - - The list of values in the collection with the given `name`, or - an empty list if no value has been added to that collection. The - list contains the values in the order under which they were - collected. - - -- - - - -#### `tf.Graph.get_collection_ref(name)` {#Graph.get_collection_ref} - -Returns a list of values in the collection with the given `name`. - -If the collection exists, this returns the list itself, which can -be modified in place to change the collection. If the collection does -not exist, it is created as an empty list and the list is returned. - -This is different from `get_collection()` which always returns a copy of -the collection list if it exists and never creates an empty collection. - -##### Args: - - -* `name`: The key for the collection. For example, the `GraphKeys` class - contains many standard names for collections. - -##### Returns: - - The list of values in the collection with the given `name`, or an empty - list if no value has been added to that collection. - - - -- - - - -#### `tf.Graph.as_graph_element(obj, allow_tensor=True, allow_operation=True)` {#Graph.as_graph_element} - -Returns the object referred to by `obj`, as an `Operation` or `Tensor`. - -This function validates that `obj` represents an element of this -graph, and gives an informative error message if it is not. - -This function is the canonical way to get/validate an object of -one of the allowed types from an external argument reference in the -Session API. - -This method may be called concurrently from multiple threads. - -##### Args: - - -* `obj`: A `Tensor`, an `Operation`, or the name of a tensor or operation. - Can also be any object with an `_as_graph_element()` method that returns - a value of one of these types. -* `allow_tensor`: If true, `obj` may refer to a `Tensor`. -* `allow_operation`: If true, `obj` may refer to an `Operation`. - -##### Returns: - - The `Tensor` or `Operation` in the Graph corresponding to `obj`. - -##### Raises: - - -* `TypeError`: If `obj` is not a type we support attempting to convert - to types. -* `ValueError`: If `obj` is of an appropriate type but invalid. For - example, an invalid string. -* `KeyError`: If `obj` is not an object in the graph. - - -- - - - -#### `tf.Graph.get_operation_by_name(name)` {#Graph.get_operation_by_name} - -Returns the `Operation` with the given `name`. - -This method may be called concurrently from multiple threads. - -##### Args: - - -* `name`: The name of the `Operation` to return. - -##### Returns: - - The `Operation` with the given `name`. - -##### Raises: - - -* `TypeError`: If `name` is not a string. -* `KeyError`: If `name` does not correspond to an operation in this graph. - - -- - - - -#### `tf.Graph.get_tensor_by_name(name)` {#Graph.get_tensor_by_name} - -Returns the `Tensor` with the given `name`. - -This method may be called concurrently from multiple threads. - -##### Args: - - -* `name`: The name of the `Tensor` to return. - -##### Returns: - - The `Tensor` with the given `name`. - -##### Raises: - - -* `TypeError`: If `name` is not a string. -* `KeyError`: If `name` does not correspond to a tensor in this graph. - - -- - - - -#### `tf.Graph.get_operations()` {#Graph.get_operations} - -Return the list of operations in the graph. - -You can modify the operations in place, but modifications -to the list such as inserts/delete have no effect on the -list of operations known to the graph. - -This method may be called concurrently from multiple threads. - -##### Returns: - - A list of Operations. - - - -- - - - -#### `tf.Graph.seed` {#Graph.seed} - -The graph-level random seed of this graph. - - -- - - - -#### `tf.Graph.unique_name(name, mark_as_used=True)` {#Graph.unique_name} - -Return a unique operation name for `name`. - -Note: You rarely need to call `unique_name()` directly. Most of -the time you just need to create `with g.name_scope()` blocks to -generate structured names. - -`unique_name` is used to generate structured names, separated by -`"/"`, to help identify operations when debugging a graph. -Operation names are displayed in error messages reported by the -TensorFlow runtime, and in various visualization tools such as -TensorBoard. - -If `mark_as_used` is set to `True`, which is the default, a new -unique name is created and marked as in use. If it's set to `False`, -the unique name is returned without actually being marked as used. -This is useful when the caller simply wants to know what the name -to be created will be. - -##### Args: - - -* `name`: The name for an operation. -* `mark_as_used`: Whether to mark this name as being used. - -##### Returns: - - A string to be passed to `create_op()` that will be used - to name the operation being created. - - -- - - - -#### `tf.Graph.version` {#Graph.version} - -Returns a version number that increases as ops are added to the graph. - -Note that this is unrelated to the -[GraphDef version](#Graph.graph_def_version). - - -- - - - -#### `tf.Graph.graph_def_versions` {#Graph.graph_def_versions} - -The GraphDef version information of this graph. - -For details on the meaning of each version, see -[`GraphDef`](https://www.tensorflow.org/code/tensorflow/core/framework/graph.proto). - -##### Returns: - - A `VersionDef`. - - - -- - - - -#### `tf.Graph.create_op(op_type, inputs, dtypes, input_types=None, name=None, attrs=None, op_def=None, compute_shapes=True, compute_device=True)` {#Graph.create_op} - -Creates an `Operation` in this graph. - -This is a low-level interface for creating an `Operation`. Most -programs will not call this method directly, and instead use the -Python op constructors, such as `tf.constant()`, which add ops to -the default graph. - -##### Args: - - -* `op_type`: The `Operation` type to create. This corresponds to the - `OpDef.name` field for the proto that defines the operation. -* `inputs`: A list of `Tensor` objects that will be inputs to the `Operation`. -* `dtypes`: A list of `DType` objects that will be the types of the tensors - that the operation produces. -* `input_types`: (Optional.) A list of `DType`s that will be the types of - the tensors that the operation consumes. By default, uses the base - `DType` of each input in `inputs`. Operations that expect - reference-typed inputs must specify `input_types` explicitly. -* `name`: (Optional.) A string name for the operation. If not specified, a - name is generated based on `op_type`. -* `attrs`: (Optional.) A dictionary where the key is the attribute name (a - string) and the value is the respective `attr` attribute of the - `NodeDef` proto that will represent the operation (an `AttrValue` - proto). -* `op_def`: (Optional.) The `OpDef` proto that describes the `op_type` that - the operation will have. -* `compute_shapes`: (Optional.) If True, shape inference will be performed - to compute the shapes of the outputs. -* `compute_device`: (Optional.) If True, device functions will be executed - to compute the device property of the Operation. - -##### Raises: - - -* `TypeError`: if any of the inputs is not a `Tensor`. -* `ValueError`: if colocation conflicts with existing device assignment. - -##### Returns: - - An `Operation` object. - - -- - - - -#### `tf.Graph.gradient_override_map(op_type_map)` {#Graph.gradient_override_map} - -EXPERIMENTAL: A context manager for overriding gradient functions. - -This context manager can be used to override the gradient function -that will be used for ops within the scope of the context. - -For example: - -```python -@tf.RegisterGradient("CustomSquare") -def _custom_square_grad(op, grad): - # ... - -with tf.Graph().as_default() as g: - c = tf.constant(5.0) - s_1 = tf.square(c) # Uses the default gradient for tf.square. - with g.gradient_override_map({"Square": "CustomSquare"}): - s_2 = tf.square(s_2) # Uses _custom_square_grad to compute the - # gradient of s_2. -``` - -##### Args: - - -* `op_type_map`: A dictionary mapping op type strings to alternative op - type strings. - -##### Returns: - - A context manager that sets the alternative op type to be used for one - or more ops created in that context. - -##### Raises: - - -* `TypeError`: If `op_type_map` is not a dictionary mapping strings to - strings. - - - -#### Other Methods -- - - - -#### `tf.Graph.building_function` {#Graph.building_function} - -Returns True iff this graph represents a function. - - -- - - - -#### `tf.Graph.clear_collection(name)` {#Graph.clear_collection} - -Clears all values in a collection. - -##### Args: - - -* `name`: The key for the collection. The `GraphKeys` class contains many - standard names for collections. - - -- - - - -#### `tf.Graph.colocate_with(op, ignore_existing=False)` {#Graph.colocate_with} - -Returns a context manager that specifies an op to colocate with. - -Note: this function is not for public use, only for internal libraries. - -For example: - -```python -a = tf.Variable([1.0]) -with g.colocate_with(a): - b = tf.constant(1.0) - c = tf.add(a, b) -``` - -`b` and `c` will always be colocated with `a`, no matter where `a` -is eventually placed. - -**NOTE** Using a colocation scope resets any existing device constraints. - -If `op` is `None` then `ignore_existing` must be `True` and the new -scope resets all colocation and device constraints. - -##### Args: - - -* `op`: The op to colocate all created ops with, or `None`. -* `ignore_existing`: If true, only applies colocation of this op within - the context, rather than applying all colocation properties - on the stack. If `op` is `None`, this value must be `True`. - -##### Raises: - - -* `ValueError`: if op is None but ignore_existing is False. - -##### Yields: - - A context manager that specifies the op with which to colocate - newly created ops. - - -- - - - -#### `tf.Graph.container(container_name)` {#Graph.container} - -Returns a context manager that specifies the resource container to use. - -Stateful operations, such as variables and queues, can maintain their -states on devices so that they can be shared by multiple processes. -A resource container is a string name under which these stateful -operations are tracked. These resources can be released or cleared -with `tf.Session.reset()`. - -For example: - -```python -with g.container('experiment0'): - # All stateful Operations constructed in this context will be placed - # in resource container "experiment0". - v1 = tf.Variable([1.0]) - v2 = tf.Variable([2.0]) - with g.container("experiment1"): - # All stateful Operations constructed in this context will be - # placed in resource container "experiment1". - v3 = tf.Variable([3.0]) - q1 = tf.FIFOQueue(10, tf.float32) - # All stateful Operations constructed in this context will be - # be created in the "experiment0". - v4 = tf.Variable([4.0]) - q1 = tf.FIFOQueue(20, tf.float32) - with g.container(""): - # All stateful Operations constructed in this context will be - # be placed in the default resource container. - v5 = tf.Variable([5.0]) - q3 = tf.FIFOQueue(30, tf.float32) - -# Resets container "experiment0", after which the state of v1, v2, v4, q1 -# will become undefined (such as uninitialized). -tf.Session.reset(target, ["experiment0"]) -``` - -##### Args: - - -* `container_name`: container name string. - -##### Returns: - - A context manager for defining resource containers for stateful ops, - yields the container name. - - -- - - - -#### `tf.Graph.get_all_collection_keys()` {#Graph.get_all_collection_keys} - -Returns a list of collections used in this graph. - - -- - - - -#### `tf.Graph.is_feedable(tensor)` {#Graph.is_feedable} - -Returns `True` if and only if `tensor` is feedable. - - -- - - - -#### `tf.Graph.is_fetchable(tensor_or_op)` {#Graph.is_fetchable} - -Returns `True` if and only if `tensor_or_op` is fetchable. - - -- - - - -#### `tf.Graph.prevent_feeding(tensor)` {#Graph.prevent_feeding} - -Marks the given `tensor` as unfeedable in this graph. - - -- - - - -#### `tf.Graph.prevent_fetching(op)` {#Graph.prevent_fetching} - -Marks the given `op` as unfetchable in this graph. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.InteractiveSession.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.InteractiveSession.md deleted file mode 100644 index 5c0c5892bd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.InteractiveSession.md +++ /dev/null @@ -1,346 +0,0 @@ -A TensorFlow `Session` for use in interactive contexts, such as a shell. - -The only difference with a regular `Session` is that an `InteractiveSession` -installs itself as the default session on construction. -The methods [`Tensor.eval()`](../../api_docs/python/framework.md#Tensor.eval) -and [`Operation.run()`](../../api_docs/python/framework.md#Operation.run) -will use that session to run ops. - -This is convenient in interactive shells and [IPython -notebooks](http://ipython.org), as it avoids having to pass an explicit -`Session` object to run ops. - -For example: - -```python -sess = tf.InteractiveSession() -a = tf.constant(5.0) -b = tf.constant(6.0) -c = a * b -# We can just use 'c.eval()' without passing 'sess' -print(c.eval()) -sess.close() -``` - -Note that a regular session installs itself as the default session when it -is created in a `with` statement. The common usage in non-interactive -programs is to follow that pattern: - -```python -a = tf.constant(5.0) -b = tf.constant(6.0) -c = a * b -with tf.Session(): - # We can also use 'c.eval()' here. - print(c.eval()) -``` -- - - - -#### `tf.InteractiveSession.__del__()` {#InteractiveSession.__del__} - - - - -- - - - -#### `tf.InteractiveSession.__init__(target='', graph=None, config=None)` {#InteractiveSession.__init__} - -Creates a new interactive TensorFlow session. - -If no `graph` argument is specified when constructing the session, -the default graph will be launched in the session. If you are -using more than one graph (created with `tf.Graph()` in the same -process, you will have to use different sessions for each graph, -but each graph can be used in multiple sessions. In this case, it -is often clearer to pass the graph to be launched explicitly to -the session constructor. - -##### Args: - - -* `target`: (Optional.) The execution engine to connect to. - Defaults to using an in-process engine. -* `graph`: (Optional.) The `Graph` to be launched (described above). -* `config`: (Optional) `ConfigProto` proto used to configure the session. - - -- - - - -#### `tf.InteractiveSession.as_default()` {#InteractiveSession.as_default} - -Returns a context manager that makes this object the default session. - -Use with the `with` keyword to specify that calls to -[`Operation.run()`](../../api_docs/python/framework.md#Operation.run) or -[`Tensor.eval()`](../../api_docs/python/framework.md#Tensor.eval) should be -executed in this session. - -```python -c = tf.constant(..) -sess = tf.Session() - -with sess.as_default(): - assert tf.get_default_session() is sess - print(c.eval()) -``` - -To get the current default session, use -[`tf.get_default_session()`](#get_default_session). - - -*N.B.* The `as_default` context manager *does not* close the -session when you exit the context, and you must close the session -explicitly. - -```python -c = tf.constant(...) -sess = tf.Session() -with sess.as_default(): - print(c.eval()) -# ... -with sess.as_default(): - print(c.eval()) - -sess.close() -``` - -Alternatively, you can use `with tf.Session():` to create a -session that is automatically closed on exiting the context, -including when an uncaught exception is raised. - -*N.B.* The default graph is a property of the current thread. If you -create a new thread, and wish to use the default session in that -thread, you must explicitly add a `with sess.as_default():` in that -thread's function. - -##### Returns: - - A context manager using this session as the default session. - - -- - - - -#### `tf.InteractiveSession.close()` {#InteractiveSession.close} - -Closes an `InteractiveSession`. - - -- - - - -#### `tf.InteractiveSession.graph` {#InteractiveSession.graph} - -The graph that was launched in this session. - - -- - - - -#### `tf.InteractiveSession.graph_def` {#InteractiveSession.graph_def} - -A serializable version of the underlying TensorFlow graph. - -##### Returns: - - A graph_pb2.GraphDef proto containing nodes for all of the Operations in - the underlying TensorFlow graph. - - -- - - - -#### `tf.InteractiveSession.partial_run(handle, fetches, feed_dict=None)` {#InteractiveSession.partial_run} - -Continues the execution with more feeds and fetches. - -This is EXPERIMENTAL and subject to change. - -To use partial execution, a user first calls `partial_run_setup()` and -then a sequence of `partial_run()`. `partial_run_setup` specifies the -list of feeds and fetches that will be used in the subsequent -`partial_run` calls. - -The optional `feed_dict` argument allows the caller to override -the value of tensors in the graph. See run() for more information. - -Below is a simple example: - -```python -a = array_ops.placeholder(dtypes.float32, shape=[]) -b = array_ops.placeholder(dtypes.float32, shape=[]) -c = array_ops.placeholder(dtypes.float32, shape=[]) -r1 = math_ops.add(a, b) -r2 = math_ops.multiply(r1, c) - -h = sess.partial_run_setup([r1, r2], [a, b, c]) -res = sess.partial_run(h, r1, feed_dict={a: 1, b: 2}) -res = sess.partial_run(h, r2, feed_dict={c: res}) -``` - -##### Args: - - -* `handle`: A handle for a sequence of partial runs. -* `fetches`: A single graph element, a list of graph elements, - or a dictionary whose values are graph elements or lists of graph - elements (see documentation for `run`). -* `feed_dict`: A dictionary that maps graph elements to values - (described above). - -##### Returns: - - Either a single value if `fetches` is a single graph element, or - a list of values if `fetches` is a list, or a dictionary with the - same keys as `fetches` if that is a dictionary - (see documentation for `run`). - -##### Raises: - - tf.errors.OpError: Or one of its subclasses on error. - - -- - - - -#### `tf.InteractiveSession.partial_run_setup(fetches, feeds=None)` {#InteractiveSession.partial_run_setup} - -Sets up a graph with feeds and fetches for partial run. - -This is EXPERIMENTAL and subject to change. - -Note that contrary to `run`, `feeds` only specifies the graph elements. -The tensors will be supplied by the subsequent `partial_run` calls. - -##### Args: - - -* `fetches`: A single graph element, or a list of graph elements. -* `feeds`: A single graph element, or a list of graph elements. - -##### Returns: - - A handle for partial run. - -##### Raises: - - -* `RuntimeError`: If this `Session` is in an invalid state (e.g. has been - closed). -* `TypeError`: If `fetches` or `feed_dict` keys are of an inappropriate type. - tf.errors.OpError: Or one of its subclasses if a TensorFlow error happens. - - -- - - - -#### `tf.InteractiveSession.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#InteractiveSession.run} - -Runs operations and evaluates tensors in `fetches`. - -This method runs one "step" of TensorFlow computation, by -running the necessary graph fragment to execute every `Operation` -and evaluate every `Tensor` in `fetches`, substituting the values in -`feed_dict` for the corresponding input values. - -The `fetches` argument may be a single graph element, or an arbitrarily -nested list, tuple, namedtuple, dict, or OrderedDict containing graph -elements at its leaves. A graph element can be one of the following types: - -* An [`Operation`](../../api_docs/python/framework.md#Operation). - The corresponding fetched value will be `None`. -* A [`Tensor`](../../api_docs/python/framework.md#Tensor). - The corresponding fetched value will be a numpy ndarray containing the - value of that tensor. -* A [`SparseTensor`](../../api_docs/python/sparse_ops.md#SparseTensor). - The corresponding fetched value will be a - [`SparseTensorValue`](../../api_docs/python/sparse_ops.md#SparseTensorValue) - containing the value of that sparse tensor. -* A `get_tensor_handle` op. The corresponding fetched value will be a - numpy ndarray containing the handle of that tensor. -* A `string` which is the name of a tensor or operation in the graph. - -The value returned by `run()` has the same shape as the `fetches` argument, -where the leaves are replaced by the corresponding values returned by -TensorFlow. - -Example: - -```python - a = tf.constant([10, 20]) - b = tf.constant([1.0, 2.0]) - # 'fetches' can be a singleton - v = session.run(a) - # v is the numpy array [10, 20] - # 'fetches' can be a list. - v = session.run([a, b]) - # v a Python list with 2 numpy arrays: the numpy array [10, 20] and the - # 1-D array [1.0, 2.0] - # 'fetches' can be arbitrary lists, tuples, namedtuple, dicts: - MyData = collections.namedtuple('MyData', ['a', 'b']) - v = session.run({'k1': MyData(a, b), 'k2': [b, a]}) - # v is a dict with - # v['k1'] is a MyData namedtuple with 'a' the numpy array [10, 20] and - # 'b' the numpy array [1.0, 2.0] - # v['k2'] is a list with the numpy array [1.0, 2.0] and the numpy array - # [10, 20]. -``` - -The optional `feed_dict` argument allows the caller to override -the value of tensors in the graph. Each key in `feed_dict` can be -one of the following types: - -* If the key is a [`Tensor`](../../api_docs/python/framework.md#Tensor), the - value may be a Python scalar, string, list, or numpy ndarray - that can be converted to the same `dtype` as that - tensor. Additionally, if the key is a - [placeholder](../../api_docs/python/io_ops.md#placeholder), the shape of - the value will be checked for compatibility with the placeholder. -* If the key is a - [`SparseTensor`](../../api_docs/python/sparse_ops.md#SparseTensor), - the value should be a - [`SparseTensorValue`](../../api_docs/python/sparse_ops.md#SparseTensorValue). -* If the key is a nested tuple of `Tensor`s or `SparseTensor`s, the value - should be a nested tuple with the same structure that maps to their - corresponding values as above. - -Each value in `feed_dict` must be convertible to a numpy array of the dtype -of the corresponding key. - -The optional `options` argument expects a [`RunOptions`] proto. The options -allow controlling the behavior of this particular step (e.g. turning tracing -on). - -The optional `run_metadata` argument expects a [`RunMetadata`] proto. When -appropriate, the non-Tensor output of this step will be collected there. For -example, when users turn on tracing in `options`, the profiled info will be -collected into this argument and passed back. - -##### Args: - - -* `fetches`: A single graph element, a list of graph elements, - or a dictionary whose values are graph elements or lists of graph - elements (described above). -* `feed_dict`: A dictionary that maps graph elements to values - (described above). -* `options`: A [`RunOptions`] protocol buffer -* `run_metadata`: A [`RunMetadata`] protocol buffer - -##### Returns: - - Either a single value if `fetches` is a single graph element, or - a list of values if `fetches` is a list, or a dictionary with the - same keys as `fetches` if that is a dictionary (described above). - -##### Raises: - - -* `RuntimeError`: If this `Session` is in an invalid state (e.g. has been - closed). -* `TypeError`: If `fetches` or `feed_dict` keys are of an inappropriate type. -* `ValueError`: If `fetches` or `feed_dict` keys are invalid or refer to a - `Tensor` that doesn't exist. - - -- - - - -#### `tf.InteractiveSession.sess_str` {#InteractiveSession.sess_str} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.SparseFeature.__new__.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.SparseFeature.__new__.md deleted file mode 100644 index 167611ebd5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.SparseFeature.__new__.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.SparseFeature.__new__(_cls, index_key, value_key, dtype, size, already_sorted=False)` {#SparseFeature.__new__} - -Create new instance of SparseFeature(index_key, value_key, dtype, size, already_sorted) - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.SparseTensorValue.__new__.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.SparseTensorValue.__new__.md deleted file mode 100644 index cc3fb1c052..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.SparseTensorValue.__new__.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.SparseTensorValue.__new__(_cls, indices, values, dense_shape)` {#SparseTensorValue.__new__} - -Create new instance of SparseTensorValue(indices, values, dense_shape) - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.TFRecordReader.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.TFRecordReader.md deleted file mode 100644 index dd8a5242da..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.TFRecordReader.md +++ /dev/null @@ -1,173 +0,0 @@ -A Reader that outputs the records from a TFRecords file. - -See ReaderBase for supported methods. -- - - - -#### `tf.TFRecordReader.__init__(name=None, options=None)` {#TFRecordReader.__init__} - -Create a TFRecordReader. - -##### Args: - - -* `name`: A name for the operation (optional). -* `options`: A TFRecordOptions object (optional). - - -- - - - -#### `tf.TFRecordReader.num_records_produced(name=None)` {#TFRecordReader.num_records_produced} - -Returns the number of records this reader has produced. - -This is the same as the number of Read executions that have -succeeded. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.TFRecordReader.num_work_units_completed(name=None)` {#TFRecordReader.num_work_units_completed} - -Returns the number of work units this reader has finished processing. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.TFRecordReader.read(queue, name=None)` {#TFRecordReader.read} - -Returns the next record (key, value pair) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g. when the -Reader needs to start reading from a new file since it has -finished with the previous file). - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (key, value). - -* `key`: A string scalar Tensor. -* `value`: A string scalar Tensor. - - -- - - - -#### `tf.TFRecordReader.read_up_to(queue, num_records, name=None)` {#TFRecordReader.read_up_to} - -Returns up to num_records (key, value pairs) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g., when the -Reader needs to start reading from a new file since it has -finished with the previous file). -It may return less than num_records even before the last batch. - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `num_records`: Number of records to read. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (keys, values). - -* `keys`: A 1-D string Tensor. -* `values`: A 1-D string Tensor. - - -- - - - -#### `tf.TFRecordReader.reader_ref` {#TFRecordReader.reader_ref} - -Op that implements the reader. - - -- - - - -#### `tf.TFRecordReader.reset(name=None)` {#TFRecordReader.reset} - -Restore a reader to its initial clean state. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.TFRecordReader.restore_state(state, name=None)` {#TFRecordReader.restore_state} - -Restore a reader to a previously saved state. - -Not all Readers support being restored, so this can produce an -Unimplemented error. - -##### Args: - - -* `state`: A string Tensor. - Result of a SerializeState of a Reader with matching type. -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.TFRecordReader.serialize_state(name=None)` {#TFRecordReader.serialize_state} - -Produce a string tensor that encodes the state of a reader. - -Not all Readers support being serialized, so this can produce an -Unimplemented error. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A string Tensor. - - -- - - - -#### `tf.TFRecordReader.supports_serialize` {#TFRecordReader.supports_serialize} - -Whether the Reader implementation can serialize its state. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.TextLineReader.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.TextLineReader.md deleted file mode 100644 index 9338435dde..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.TextLineReader.md +++ /dev/null @@ -1,175 +0,0 @@ -A Reader that outputs the lines of a file delimited by newlines. - -Newlines are stripped from the output. -See ReaderBase for supported methods. -- - - - -#### `tf.TextLineReader.__init__(skip_header_lines=None, name=None)` {#TextLineReader.__init__} - -Create a TextLineReader. - -##### Args: - - -* `skip_header_lines`: An optional int. Defaults to 0. Number of lines - to skip from the beginning of every file. -* `name`: A name for the operation (optional). - - -- - - - -#### `tf.TextLineReader.num_records_produced(name=None)` {#TextLineReader.num_records_produced} - -Returns the number of records this reader has produced. - -This is the same as the number of Read executions that have -succeeded. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.TextLineReader.num_work_units_completed(name=None)` {#TextLineReader.num_work_units_completed} - -Returns the number of work units this reader has finished processing. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.TextLineReader.read(queue, name=None)` {#TextLineReader.read} - -Returns the next record (key, value pair) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g. when the -Reader needs to start reading from a new file since it has -finished with the previous file). - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (key, value). - -* `key`: A string scalar Tensor. -* `value`: A string scalar Tensor. - - -- - - - -#### `tf.TextLineReader.read_up_to(queue, num_records, name=None)` {#TextLineReader.read_up_to} - -Returns up to num_records (key, value pairs) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g., when the -Reader needs to start reading from a new file since it has -finished with the previous file). -It may return less than num_records even before the last batch. - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `num_records`: Number of records to read. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (keys, values). - -* `keys`: A 1-D string Tensor. -* `values`: A 1-D string Tensor. - - -- - - - -#### `tf.TextLineReader.reader_ref` {#TextLineReader.reader_ref} - -Op that implements the reader. - - -- - - - -#### `tf.TextLineReader.reset(name=None)` {#TextLineReader.reset} - -Restore a reader to its initial clean state. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.TextLineReader.restore_state(state, name=None)` {#TextLineReader.restore_state} - -Restore a reader to a previously saved state. - -Not all Readers support being restored, so this can produce an -Unimplemented error. - -##### Args: - - -* `state`: A string Tensor. - Result of a SerializeState of a Reader with matching type. -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.TextLineReader.serialize_state(name=None)` {#TextLineReader.serialize_state} - -Produce a string tensor that encodes the state of a reader. - -Not all Readers support being serialized, so this can produce an -Unimplemented error. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A string Tensor. - - -- - - - -#### `tf.TextLineReader.supports_serialize` {#TextLineReader.supports_serialize} - -Whether the Reader implementation can serialize its state. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.WholeFileReader.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.WholeFileReader.md deleted file mode 100644 index 0ae2d4e591..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.WholeFileReader.md +++ /dev/null @@ -1,175 +0,0 @@ -A Reader that outputs the entire contents of a file as a value. - -To use, enqueue filenames in a Queue. The output of Read will -be a filename (key) and the contents of that file (value). - -See ReaderBase for supported methods. -- - - - -#### `tf.WholeFileReader.__init__(name=None)` {#WholeFileReader.__init__} - -Create a WholeFileReader. - -##### Args: - - -* `name`: A name for the operation (optional). - - -- - - - -#### `tf.WholeFileReader.num_records_produced(name=None)` {#WholeFileReader.num_records_produced} - -Returns the number of records this reader has produced. - -This is the same as the number of Read executions that have -succeeded. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.WholeFileReader.num_work_units_completed(name=None)` {#WholeFileReader.num_work_units_completed} - -Returns the number of work units this reader has finished processing. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.WholeFileReader.read(queue, name=None)` {#WholeFileReader.read} - -Returns the next record (key, value pair) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g. when the -Reader needs to start reading from a new file since it has -finished with the previous file). - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (key, value). - -* `key`: A string scalar Tensor. -* `value`: A string scalar Tensor. - - -- - - - -#### `tf.WholeFileReader.read_up_to(queue, num_records, name=None)` {#WholeFileReader.read_up_to} - -Returns up to num_records (key, value pairs) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g., when the -Reader needs to start reading from a new file since it has -finished with the previous file). -It may return less than num_records even before the last batch. - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `num_records`: Number of records to read. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (keys, values). - -* `keys`: A 1-D string Tensor. -* `values`: A 1-D string Tensor. - - -- - - - -#### `tf.WholeFileReader.reader_ref` {#WholeFileReader.reader_ref} - -Op that implements the reader. - - -- - - - -#### `tf.WholeFileReader.reset(name=None)` {#WholeFileReader.reset} - -Restore a reader to its initial clean state. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.WholeFileReader.restore_state(state, name=None)` {#WholeFileReader.restore_state} - -Restore a reader to a previously saved state. - -Not all Readers support being restored, so this can produce an -Unimplemented error. - -##### Args: - - -* `state`: A string Tensor. - Result of a SerializeState of a Reader with matching type. -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.WholeFileReader.serialize_state(name=None)` {#WholeFileReader.serialize_state} - -Produce a string tensor that encodes the state of a reader. - -Not all Readers support being serialized, so this can produce an -Unimplemented error. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A string Tensor. - - -- - - - -#### `tf.WholeFileReader.supports_serialize` {#WholeFileReader.supports_serialize} - -Whether the Reader implementation can serialize its state. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.assert_non_negative.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.assert_non_negative.md deleted file mode 100644 index aa835e51cd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.assert_non_negative.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.assert_non_negative(x, data=None, summarize=None, message=None, name=None)` {#assert_non_negative} - -Assert the condition `x >= 0` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_non_negative(x)]): - output = tf.reduce_sum(x) -``` - -Non-negative means, for every element `x[i]` of `x`, we have `x[i] >= 0`. -If `x` is empty this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). - Defaults to "assert_non_negative". - -##### Returns: - - Op raising `InvalidArgumentError` unless `x` is all non-negative. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.betainc.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.betainc.md deleted file mode 100644 index 9da04a3642..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.betainc.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.betainc(a, b, x, name=None)` {#betainc} - -Compute the regularized incomplete beta integral \\(I_x(a, b)\\). - -The regularized incomplete beta integral is defined as: - -``` -I_x(a, b) = \frac{B(x; a, b)}{B(a, b)} -``` -where - -``` -B(x; a, b) = \int_0^x t^{a-1} (1 - t)^{b-1} dt -``` - -is the incomplete beta function and \\(B(a, b)\\) is the *complete* -beta function. - -##### Args: - - -* `a`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `b`: A `Tensor`. Must have the same type as `a`. -* `x`: A `Tensor`. Must have the same type as `a`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `a`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.cholesky_solve.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.cholesky_solve.md deleted file mode 100644 index cb0bdd7feb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.cholesky_solve.md +++ /dev/null @@ -1,35 +0,0 @@ -### `tf.cholesky_solve(chol, rhs, name=None)` {#cholesky_solve} - -Solves systems of linear eqns `A X = RHS`, given Cholesky factorizations. - -```python -# Solve 10 separate 2x2 linear systems: -A = ... # shape 10 x 2 x 2 -RHS = ... # shape 10 x 2 x 1 -chol = tf.cholesky(A) # shape 10 x 2 x 2 -X = tf.cholesky_solve(chol, RHS) # shape 10 x 2 x 1 -# tf.matmul(A, X) ~ RHS -X[3, :, 0] # Solution to the linear system A[3, :, :] x = RHS[3, :, 0] - -# Solve five linear systems (K = 5) for every member of the length 10 batch. -A = ... # shape 10 x 2 x 2 -RHS = ... # shape 10 x 2 x 5 -... -X[3, :, 2] # Solution to the linear system A[3, :, :] x = RHS[3, :, 2] -``` - -##### Args: - - -* `chol`: A `Tensor`. Must be `float32` or `float64`, shape is `[..., M, M]`. - Cholesky factorization of `A`, e.g. `chol = tf.cholesky(A)`. - For that reason, only the lower triangular parts (including the diagonal) - of the last two dimensions of `chol` are used. The strictly upper part is - assumed to be zero and not accessed. -* `rhs`: A `Tensor`, same type as `chol`, shape is `[..., M, K]`. -* `name`: A name to give this `Op`. Defaults to `cholesky_solve`. - -##### Returns: - - Solution to `A x = rhs`, shape `[..., M, K]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.constant.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.constant.md deleted file mode 100644 index 3cc1e1ac0a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.constant.md +++ /dev/null @@ -1,53 +0,0 @@ -### `tf.constant(value, dtype=None, shape=None, name='Const', verify_shape=False)` {#constant} - -Creates a constant tensor. - - The resulting tensor is populated with values of type `dtype`, as - specified by arguments `value` and (optionally) `shape` (see examples - below). - - The argument `value` can be a constant value, or a list of values of type - `dtype`. If `value` is a list, then the length of the list must be less - than or equal to the number of elements implied by the `shape` argument (if - specified). In the case where the list length is less than the number of - elements specified by `shape`, the last element in the list will be used - to fill the remaining entries. - - The argument `shape` is optional. If present, it specifies the dimensions of - the resulting tensor. If not present, the shape of `value` is used. - - If the argument `dtype` is not specified, then the type is inferred from - the type of `value`. - - For example: - - ```python - # Constant 1-D Tensor populated with value list. - tensor = tf.constant([1, 2, 3, 4, 5, 6, 7]) => [1 2 3 4 5 6 7] - - # Constant 2-D tensor populated with scalar value -1. - tensor = tf.constant(-1.0, shape=[2, 3]) => [[-1. -1. -1.] - [-1. -1. -1.]] - ``` - -##### Args: - - -* `value`: A constant value (or list) of output type `dtype`. - - -* `dtype`: The type of the elements of the resulting tensor. - - -* `shape`: Optional dimensions of resulting tensor. - - -* `name`: Optional name for the tensor. - - -* `verify_shape`: Boolean that enables verification of a shape of values. - -##### Returns: - - A Constant Tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.bayesflow.monte_carlo.expectation.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.bayesflow.monte_carlo.expectation.md deleted file mode 100644 index d8f9c5c462..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.bayesflow.monte_carlo.expectation.md +++ /dev/null @@ -1,56 +0,0 @@ -### `tf.contrib.bayesflow.monte_carlo.expectation(f, p, z=None, n=None, seed=None, name='expectation')` {#expectation} - -Monte Carlo estimate of an expectation: `E_p[f(Z)]` with sample mean. - -This `Op` returns - -``` -n^{-1} sum_{i=1}^n f(z_i), where z_i ~ p -\approx E_p[f(Z)] -``` - -User supplies either `Tensor` of samples `z`, or number of samples to draw `n` - -##### Args: - - -* `f`: Callable mapping samples from `p` to `Tensors`. -* `p`: `tf.contrib.distributions.Distribution`. -* `z`: `Tensor` of samples from `p`, produced by `p.sample` for some `n`. -* `n`: Integer `Tensor`. Number of samples to generate if `z` is not provided. -* `seed`: Python integer to seed the random number generator. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with the same `dtype` as `p`. - - -* `Example`: - -```python -N_samples = 10000 - -distributions = tf.contrib.distributions - -dist = distributions.Uniform([0.0, 0.0], [1.0, 2.0]) -elementwise_mean = lambda x: x -mean_sum = lambda x: tf.reduce_sum(x, 1) - -estimate_elementwise_mean_tf = monte_carlo.expectation(elementwise_mean, - dist, - n=N_samples) -estimate_mean_sum_tf = monte_carlo.expectation(mean_sum, - dist, - n=N_samples) - -with tf.Session() as sess: - estimate_elementwise_mean, estimate_mean_sum = ( - sess.run([estimate_elementwise_mean_tf, estimate_mean_sum_tf])) -print estimate_elementwise_mean ->>> np.array([ 0.50018013 1.00097895], dtype=np.float32) -print estimate_mean_sum ->>> 1.49571 - -``` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.copy_graph.get_copied_op.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.copy_graph.get_copied_op.md deleted file mode 100644 index 9e5a2118fd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.copy_graph.get_copied_op.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.contrib.copy_graph.get_copied_op(org_instance, graph, scope='')` {#get_copied_op} - -Given an `Operation` instance from some `Graph`, returns -its namesake from `graph`, under the specified scope -(default `""`). - -If a copy of `org_instance` is present in `graph` under the given -`scope`, it will be returned. - -Args: -org_instance: An `Operation` from some `Graph`. -graph: The `Graph` to be searched for a copr of `org_instance`. -scope: The scope `org_instance` is present in. - -##### Returns: - - The `Operation` copy from `graph`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.crf.CrfForwardRnnCell.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.crf.CrfForwardRnnCell.md deleted file mode 100644 index a319e9bead..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.crf.CrfForwardRnnCell.md +++ /dev/null @@ -1,73 +0,0 @@ -Computes the alpha values in a linear-chain CRF. - -See http://www.cs.columbia.edu/~mcollins/fb.pdf for reference. -- - - - -#### `tf.contrib.crf.CrfForwardRnnCell.__call__(inputs, state, scope=None)` {#CrfForwardRnnCell.__call__} - -Build the CrfForwardRnnCell. - -##### Args: - - -* `inputs`: A [batch_size, num_tags] matrix of unary potentials. -* `state`: A [batch_size, num_tags] matrix containing the previous alpha - values. -* `scope`: Unused variable scope of this cell. - -##### Returns: - - new_alphas, new_alphas: A pair of [batch_size, num_tags] matrices - values containing the new alpha values. - - -- - - - -#### `tf.contrib.crf.CrfForwardRnnCell.__init__(transition_params)` {#CrfForwardRnnCell.__init__} - -Initialize the CrfForwardRnnCell. - -##### Args: - - -* `transition_params`: A [num_tags, num_tags] matrix of binary potentials. - This matrix is expanded into a [1, num_tags, num_tags] in preparation - for the broadcast summation occurring within the cell. - - -- - - - -#### `tf.contrib.crf.CrfForwardRnnCell.output_size` {#CrfForwardRnnCell.output_size} - - - - -- - - - -#### `tf.contrib.crf.CrfForwardRnnCell.state_size` {#CrfForwardRnnCell.state_size} - - - - -- - - - -#### `tf.contrib.crf.CrfForwardRnnCell.zero_state(batch_size, dtype)` {#CrfForwardRnnCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.crf.crf_binary_score.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.crf.crf_binary_score.md deleted file mode 100644 index 956f52766d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.crf.crf_binary_score.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.contrib.crf.crf_binary_score(tag_indices, sequence_lengths, transition_params)` {#crf_binary_score} - -Computes the binary scores of tag sequences. - -##### Args: - - -* `tag_indices`: A [batch_size, max_seq_len] matrix of tag indices. -* `sequence_lengths`: A [batch_size] vector of true sequence lengths. -* `transition_params`: A [num_tags, num_tags] matrix of binary potentials. - -##### Returns: - - -* `binary_scores`: A [batch_size] vector of binary scores. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.Categorical.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.Categorical.md deleted file mode 100644 index 6e2b72c7f3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.Categorical.md +++ /dev/null @@ -1,629 +0,0 @@ -Categorical distribution. - -The categorical distribution is parameterized by the log-probabilities -of a set of classes. - -#### Examples - -Creates a 3-class distiribution, with the 2nd class, the most likely to be -drawn from. - -```python -p = [0.1, 0.5, 0.4] -dist = Categorical(probs=p) -``` - -Creates a 3-class distiribution, with the 2nd class the most likely to be -drawn from, using logits. - -```python -logits = [-50, 400, 40] -dist = Categorical(logits=logits) -``` - -Creates a 3-class distribution, with the 3rd class is most likely to be drawn. -The distribution functions can be evaluated on counts. - -```python -# counts is a scalar. -p = [0.1, 0.4, 0.5] -dist = Categorical(probs=p) -dist.prob(0) # Shape [] - -# p will be broadcast to [[0.1, 0.4, 0.5], [0.1, 0.4, 0.5]] to match counts. -counts = [1, 0] -dist.prob(counts) # Shape [2] - -# p will be broadcast to shape [3, 5, 7, 3] to match counts. -counts = [[...]] # Shape [5, 7, 3] -dist.prob(counts) # Shape [5, 7, 3] -``` -- - - - -#### `tf.contrib.distributions.Categorical.__init__(logits=None, probs=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='Categorical')` {#Categorical.__init__} - -Initialize Categorical distributions using class log-probabilities. - -##### Args: - - -* `logits`: An N-D `Tensor`, `N >= 1`, representing the log probabilities - of a set of Categorical distributions. The first `N - 1` dimensions - index into a batch of independent distributions and the last dimension - represents a vector of logits for each class. Only one of `logits` or - `probs` should be passed in. -* `probs`: An N-D `Tensor`, `N >= 1`, representing the probabilities - of a set of Categorical distributions. The first `N - 1` dimensions - index into a batch of independent distributions and the last dimension - represents a vector of probabilities for each class. Only one of - `logits` or `probs` should be passed in. -* `dtype`: The type of the event samples (default: int32). -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Categorical.allow_nan_stats` {#Categorical.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Categorical.batch_shape` {#Categorical.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Categorical.batch_shape_tensor(name='batch_shape_tensor')` {#Categorical.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Categorical.cdf(value, name='cdf')` {#Categorical.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Categorical.copy(**override_parameters_kwargs)` {#Categorical.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Categorical.covariance(name='covariance')` {#Categorical.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Categorical.dtype` {#Categorical.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Categorical.entropy(name='entropy')` {#Categorical.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Categorical.event_shape` {#Categorical.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Categorical.event_shape_tensor(name='event_shape_tensor')` {#Categorical.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Categorical.event_size` {#Categorical.event_size} - -Scalar `int32` tensor: the number of classes. - - -- - - - -#### `tf.contrib.distributions.Categorical.is_continuous` {#Categorical.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Categorical.is_scalar_batch(name='is_scalar_batch')` {#Categorical.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Categorical.is_scalar_event(name='is_scalar_event')` {#Categorical.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Categorical.log_cdf(value, name='log_cdf')` {#Categorical.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Categorical.log_prob(value, name='log_prob')` {#Categorical.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Categorical.log_survival_function(value, name='log_survival_function')` {#Categorical.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Categorical.logits` {#Categorical.logits} - -Vector of coordinatewise logits. - - -- - - - -#### `tf.contrib.distributions.Categorical.mean(name='mean')` {#Categorical.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Categorical.mode(name='mode')` {#Categorical.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Categorical.name` {#Categorical.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Categorical.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Categorical.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Categorical.param_static_shapes(cls, sample_shape)` {#Categorical.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Categorical.parameters` {#Categorical.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Categorical.prob(value, name='prob')` {#Categorical.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Categorical.probs` {#Categorical.probs} - -Vector of coordinatewise probabilities. - - -- - - - -#### `tf.contrib.distributions.Categorical.reparameterization_type` {#Categorical.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Categorical.sample(sample_shape=(), seed=None, name='sample')` {#Categorical.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Categorical.stddev(name='stddev')` {#Categorical.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Categorical.survival_function(value, name='survival_function')` {#Categorical.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Categorical.validate_args` {#Categorical.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Categorical.variance(name='variance')` {#Categorical.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.Chi2.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.Chi2.md deleted file mode 100644 index 76a28f8d17..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.Chi2.md +++ /dev/null @@ -1,612 +0,0 @@ -Chi2 distribution. - -The Chi2 distribution is defined over positive real numbers using a degrees of -freedom ("df") parameter. - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; df, x > 0) = x**(0.5 df - 1) exp(-0.5 x) / Z -Z = 2**(0.5 df) Gamma(0.5 df) -``` - -where: - -* `df` denotes the degrees of freedom, -* `Z` is the normalization constant, and, -* `Gamma` is the [gamma function]( - https://en.wikipedia.org/wiki/Gamma_function). - -The Chi2 distribution is a special case of the Gamma distribution, i.e., - -```python -Chi2(df) = Gamma(concentration=0.5 * df, rate=0.5) -``` -- - - - -#### `tf.contrib.distributions.Chi2.__init__(df, validate_args=False, allow_nan_stats=True, name='Chi2')` {#Chi2.__init__} - -Construct Chi2 distributions with parameter `df`. - -##### Args: - - -* `df`: Floating point tensor, the degrees of freedom of the - distribution(s). `df` must contain only positive values. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Chi2.allow_nan_stats` {#Chi2.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Chi2.batch_shape` {#Chi2.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Chi2.batch_shape_tensor(name='batch_shape_tensor')` {#Chi2.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2.cdf(value, name='cdf')` {#Chi2.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2.concentration` {#Chi2.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.Chi2.copy(**override_parameters_kwargs)` {#Chi2.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Chi2.covariance(name='covariance')` {#Chi2.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Chi2.df` {#Chi2.df} - - - - -- - - - -#### `tf.contrib.distributions.Chi2.dtype` {#Chi2.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Chi2.entropy(name='entropy')` {#Chi2.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Chi2.event_shape` {#Chi2.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Chi2.event_shape_tensor(name='event_shape_tensor')` {#Chi2.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2.is_continuous` {#Chi2.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Chi2.is_scalar_batch(name='is_scalar_batch')` {#Chi2.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2.is_scalar_event(name='is_scalar_event')` {#Chi2.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Chi2.log_cdf(value, name='log_cdf')` {#Chi2.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2.log_prob(value, name='log_prob')` {#Chi2.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2.log_survival_function(value, name='log_survival_function')` {#Chi2.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2.mean(name='mean')` {#Chi2.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Chi2.mode(name='mode')` {#Chi2.mode} - -Mode. - -Additional documentation from `Gamma`: - -The mode of a gamma distribution is `(shape - 1) / rate` when -`shape > 1`, and `NaN` otherwise. If `self.allow_nan_stats` is `False`, -an exception will be raised rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.Chi2.name` {#Chi2.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Chi2.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Chi2.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Chi2.param_static_shapes(cls, sample_shape)` {#Chi2.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Chi2.parameters` {#Chi2.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Chi2.prob(value, name='prob')` {#Chi2.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2.rate` {#Chi2.rate} - -Rate parameter. - - -- - - - -#### `tf.contrib.distributions.Chi2.reparameterization_type` {#Chi2.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Chi2.sample(sample_shape=(), seed=None, name='sample')` {#Chi2.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Chi2.stddev(name='stddev')` {#Chi2.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Chi2.survival_function(value, name='survival_function')` {#Chi2.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Chi2.validate_args` {#Chi2.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Chi2.variance(name='variance')` {#Chi2.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.ConditionalDistribution.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.ConditionalDistribution.md deleted file mode 100644 index 97d31bb273..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.ConditionalDistribution.md +++ /dev/null @@ -1,476 +0,0 @@ -Distribution that supports intrinsic parameters (local latents). - -Subclasses of this distribution may have additional keyword arguments passed -to their sample-based methods (i.e. `sample`, `log_prob`, etc.). -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.__init__(dtype, is_continuous, reparameterization_type, validate_args, allow_nan_stats, parameters=None, graph_parents=None, name=None)` {#ConditionalDistribution.__init__} - -Constructs the `Distribution`. - -**This is a private method for subclass use.** - -##### Args: - - -* `dtype`: The type of the event samples. `None` implies no type-enforcement. -* `is_continuous`: Python `bool`. If `True` this `Distribution` is continuous - over its supported domain. -* `reparameterization_type`: Instance of `ReparameterizationType`. - If `distributions.FULLY_REPARAMETERIZED`, this - `Distribution` can be reparameterized in terms of some standard - distribution with a function whose Jacobian is constant for the support - of the standard distribution. If `distributions.NOT_REPARAMETERIZED`, - then no such reparameterization is available. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `parameters`: Python `dict` of parameters used to instantiate this - `Distribution`. -* `graph_parents`: Python `list` of graph prerequisites of this - `Distribution`. -* `name`: Python `str` name prefixed to Ops created by this class. Default: - subclass name. - -##### Raises: - - -* `ValueError`: if any member of graph_parents is `None` or not a `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.allow_nan_stats` {#ConditionalDistribution.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.batch_shape` {#ConditionalDistribution.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.batch_shape_tensor(name='batch_shape_tensor')` {#ConditionalDistribution.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.cdf(*args, **kwargs)` {#ConditionalDistribution.cdf} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.copy(**override_parameters_kwargs)` {#ConditionalDistribution.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.covariance(name='covariance')` {#ConditionalDistribution.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.dtype` {#ConditionalDistribution.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.entropy(name='entropy')` {#ConditionalDistribution.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.event_shape` {#ConditionalDistribution.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.event_shape_tensor(name='event_shape_tensor')` {#ConditionalDistribution.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.is_continuous` {#ConditionalDistribution.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.is_scalar_batch(name='is_scalar_batch')` {#ConditionalDistribution.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.is_scalar_event(name='is_scalar_event')` {#ConditionalDistribution.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.log_cdf(*args, **kwargs)` {#ConditionalDistribution.log_cdf} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.log_prob(*args, **kwargs)` {#ConditionalDistribution.log_prob} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.log_survival_function(*args, **kwargs)` {#ConditionalDistribution.log_survival_function} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.mean(name='mean')` {#ConditionalDistribution.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.mode(name='mode')` {#ConditionalDistribution.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.name` {#ConditionalDistribution.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#ConditionalDistribution.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.param_static_shapes(cls, sample_shape)` {#ConditionalDistribution.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.parameters` {#ConditionalDistribution.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.prob(*args, **kwargs)` {#ConditionalDistribution.prob} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.reparameterization_type` {#ConditionalDistribution.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.sample(*args, **kwargs)` {#ConditionalDistribution.sample} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.stddev(name='stddev')` {#ConditionalDistribution.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.survival_function(*args, **kwargs)` {#ConditionalDistribution.survival_function} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.validate_args` {#ConditionalDistribution.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.ConditionalDistribution.variance(name='variance')` {#ConditionalDistribution.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.ReparameterizationType.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.ReparameterizationType.md deleted file mode 100644 index 35e5d87db8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.ReparameterizationType.md +++ /dev/null @@ -1,47 +0,0 @@ -Instances of this class represent how sampling is reparameterized. - -Two static instances exist in the distritributions library, signifying -one of two possible properties for samples from a distribution: - -`FULLY_REPARAMETERIZED`: Samples from the distribution are fully - reparameterized, and straight-through gradients are supported. - -`NOT_REPARAMETERIZED`: Samples from the distribution are not fully - reparameterized, and straight-through gradients are either partially - unsupported or are not supported at all. In this case, for purposes of - e.g. RL or variational inference, it is generally safest to wrap the - sample results in a `stop_gradients` call and instead use policy - gradients / surrogate loss instead. -- - - - -#### `tf.contrib.distributions.ReparameterizationType.__eq__(other)` {#ReparameterizationType.__eq__} - -Determine if this `ReparameterizationType` is equal to another. - -Since RepaparameterizationType instances are constant static global -instances, equality checks if two instances' id() values are equal. - -##### Args: - - -* `other`: Object to compare against. - -##### Returns: - - `self is other`. - - -- - - - -#### `tf.contrib.distributions.ReparameterizationType.__init__(rep_type)` {#ReparameterizationType.__init__} - - - - -- - - - -#### `tf.contrib.distributions.ReparameterizationType.__repr__()` {#ReparameterizationType.__repr__} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.Uniform.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.Uniform.md deleted file mode 100644 index a3455aa9ea..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.Uniform.md +++ /dev/null @@ -1,625 +0,0 @@ -Uniform distribution with `low` and `high` parameters. - -### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; a, b) = I[a <= x < b] / Z -Z = b - a -``` - -where: -* `low = a`, -* `high = b`, -* `Z` is the normalizing constant, and, -* `I[predicate]` is the [indicator function]( - https://en.wikipedia.org/wiki/Indicator_function) for `predicate`. - -The parameters `low` and `high` must be shaped in a way that supports -broadcasting (e.g., `high - low` is a valid operation). - -### Examples - -```python -# Without broadcasting: -u1 = Uniform(low=3.0, high=4.0) # a single uniform distribution [3, 4] -u2 = Uniform(low=[1.0, 2.0], - high=[3.0, 4.0]) # 2 distributions [1, 3], [2, 4] -u3 = Uniform(low=[[1.0, 2.0], - [3.0, 4.0]], - high=[[1.5, 2.5], - [3.5, 4.5]]) # 4 distributions -``` - -```python -# With broadcasting: -u1 = Uniform(low=3.0, high=[5.0, 6.0, 7.0]) # 3 distributions -``` -- - - - -#### `tf.contrib.distributions.Uniform.__init__(low=0.0, high=1.0, validate_args=False, allow_nan_stats=True, name='Uniform')` {#Uniform.__init__} - -Initialize a batch of Uniform distributions. - -##### Args: - - -* `low`: Floating point tensor, lower boundary of the output interval. Must - have `low < high`. -* `high`: Floating point tensor, upper boundary of the output interval. Must - have `low < high`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `InvalidArgumentError`: if `low >= high` and `validate_args=False`. - - -- - - - -#### `tf.contrib.distributions.Uniform.allow_nan_stats` {#Uniform.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Uniform.batch_shape` {#Uniform.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Uniform.batch_shape_tensor(name='batch_shape_tensor')` {#Uniform.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Uniform.cdf(value, name='cdf')` {#Uniform.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Uniform.copy(**override_parameters_kwargs)` {#Uniform.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Uniform.covariance(name='covariance')` {#Uniform.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Uniform.dtype` {#Uniform.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Uniform.entropy(name='entropy')` {#Uniform.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Uniform.event_shape` {#Uniform.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Uniform.event_shape_tensor(name='event_shape_tensor')` {#Uniform.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Uniform.high` {#Uniform.high} - -Upper boundary of the output interval. - - -- - - - -#### `tf.contrib.distributions.Uniform.is_continuous` {#Uniform.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Uniform.is_scalar_batch(name='is_scalar_batch')` {#Uniform.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Uniform.is_scalar_event(name='is_scalar_event')` {#Uniform.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Uniform.log_cdf(value, name='log_cdf')` {#Uniform.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Uniform.log_prob(value, name='log_prob')` {#Uniform.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Uniform.log_survival_function(value, name='log_survival_function')` {#Uniform.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Uniform.low` {#Uniform.low} - -Lower boundary of the output interval. - - -- - - - -#### `tf.contrib.distributions.Uniform.mean(name='mean')` {#Uniform.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Uniform.mode(name='mode')` {#Uniform.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Uniform.name` {#Uniform.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Uniform.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Uniform.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Uniform.param_static_shapes(cls, sample_shape)` {#Uniform.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Uniform.parameters` {#Uniform.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Uniform.prob(value, name='prob')` {#Uniform.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Uniform.range(name='range')` {#Uniform.range} - -`high - low`. - - -- - - - -#### `tf.contrib.distributions.Uniform.reparameterization_type` {#Uniform.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Uniform.sample(sample_shape=(), seed=None, name='sample')` {#Uniform.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Uniform.stddev(name='stddev')` {#Uniform.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Uniform.survival_function(value, name='survival_function')` {#Uniform.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Uniform.validate_args` {#Uniform.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Uniform.variance(name='variance')` {#Uniform.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.WishartCholesky.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.WishartCholesky.md deleted file mode 100644 index 156e009dd4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.WishartCholesky.md +++ /dev/null @@ -1,673 +0,0 @@ -The matrix Wishart distribution on positive definite matrices. - -This distribution is defined by a scalar degrees of freedom `df` and a -lower, triangular Cholesky factor which characterizes the scale matrix. - -Using WishartCholesky is a constant-time improvement over WishartFull. It -saves an O(nbk^3) operation, i.e., a matrix-product operation for sampling -and a Cholesky factorization in log_prob. For most use-cases it often saves -another O(nbk^3) operation since most uses of Wishart will also use the -Cholesky factorization. - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(X; df, scale) = det(X)**(0.5 (df-k-1)) exp(-0.5 tr[inv(scale) X]) / Z -Z = 2**(0.5 df k) |det(scale)|**(0.5 df) Gamma_k(0.5 df) -``` - -where: -* `df >= k` denotes the degrees of freedom, -* `scale` is a symmetric, positive definite, `k x k` matrix, -* `Z` is the normalizing constant, and, -* `Gamma_k` is the [multivariate Gamma function]( - https://en.wikipedia.org/wiki/Multivariate_gamma_function). - - -#### Examples - -```python -# Initialize a single 3x3 Wishart with Cholesky factored scale matrix and 5 -# degrees-of-freedom.(*) -df = 5 -chol_scale = tf.cholesky(...) # Shape is [3, 3]. -dist = tf.contrib.distributions.WishartCholesky(df=df, scale=chol_scale) - -# Evaluate this on an observation in R^3, returning a scalar. -x = ... # A 3x3 positive definite matrix. -dist.prob(x) # Shape is [], a scalar. - -# Evaluate this on a two observations, each in R^{3x3}, returning a length two -# Tensor. -x = [x0, x1] # Shape is [2, 3, 3]. -dist.prob(x) # Shape is [2]. - -# Initialize two 3x3 Wisharts with Cholesky factored scale matrices. -df = [5, 4] -chol_scale = tf.cholesky(...) # Shape is [2, 3, 3]. -dist = tf.contrib.distributions.WishartCholesky(df=df, scale=chol_scale) - -# Evaluate this on four observations. -x = [[x0, x1], [x2, x3]] # Shape is [2, 2, 3, 3]. -dist.prob(x) # Shape is [2, 2]. - -# (*) - To efficiently create a trainable covariance matrix, see the example -# in tf.contrib.distributions.matrix_diag_transform. -``` -- - - - -#### `tf.contrib.distributions.WishartCholesky.__init__(df, scale, cholesky_input_output_matrices=False, validate_args=False, allow_nan_stats=True, name='WishartCholesky')` {#WishartCholesky.__init__} - -Construct Wishart distributions. - -##### Args: - - -* `df`: `float` or `double` `Tensor`. Degrees of freedom, must be greater than - or equal to dimension of the scale matrix. -* `scale`: `float` or `double` `Tensor`. The Cholesky factorization of - the symmetric positive definite scale matrix of the distribution. -* `cholesky_input_output_matrices`: Python `bool`. Any function which whose - input or output is a matrix assumes the input is Cholesky and returns a - Cholesky factored matrix. Example `log_prob` input takes a Cholesky and - `sample_n` returns a Cholesky when - `cholesky_input_output_matrices=True`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.allow_nan_stats` {#WishartCholesky.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.batch_shape` {#WishartCholesky.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.batch_shape_tensor(name='batch_shape_tensor')` {#WishartCholesky.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.cdf(value, name='cdf')` {#WishartCholesky.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.cholesky_input_output_matrices` {#WishartCholesky.cholesky_input_output_matrices} - -Boolean indicating if `Tensor` input/outputs are Cholesky factorized. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.copy(**override_parameters_kwargs)` {#WishartCholesky.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.covariance(name='covariance')` {#WishartCholesky.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.df` {#WishartCholesky.df} - -Wishart distribution degree(s) of freedom. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.dimension` {#WishartCholesky.dimension} - -Dimension of underlying vector space. The `p` in `R^(p*p)`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.dtype` {#WishartCholesky.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.entropy(name='entropy')` {#WishartCholesky.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.event_shape` {#WishartCholesky.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.event_shape_tensor(name='event_shape_tensor')` {#WishartCholesky.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.is_continuous` {#WishartCholesky.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.is_scalar_batch(name='is_scalar_batch')` {#WishartCholesky.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.is_scalar_event(name='is_scalar_event')` {#WishartCholesky.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.log_cdf(value, name='log_cdf')` {#WishartCholesky.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.log_normalization(name='log_normalization')` {#WishartCholesky.log_normalization} - -Computes the log normalizing constant, log(Z). - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.log_prob(value, name='log_prob')` {#WishartCholesky.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.log_survival_function(value, name='log_survival_function')` {#WishartCholesky.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.mean(name='mean')` {#WishartCholesky.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.mean_log_det(name='mean_log_det')` {#WishartCholesky.mean_log_det} - -Computes E[log(det(X))] under this Wishart distribution. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.mode(name='mode')` {#WishartCholesky.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.name` {#WishartCholesky.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#WishartCholesky.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.param_static_shapes(cls, sample_shape)` {#WishartCholesky.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.parameters` {#WishartCholesky.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.prob(value, name='prob')` {#WishartCholesky.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.reparameterization_type` {#WishartCholesky.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.sample(sample_shape=(), seed=None, name='sample')` {#WishartCholesky.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.scale()` {#WishartCholesky.scale} - -Wishart distribution scale matrix. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.scale_operator_pd` {#WishartCholesky.scale_operator_pd} - -Wishart distribution scale matrix as an OperatorPD. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.stddev(name='stddev')` {#WishartCholesky.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.survival_function(value, name='survival_function')` {#WishartCholesky.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.validate_args` {#WishartCholesky.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.WishartCholesky.variance(name='variance')` {#WishartCholesky.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.bijector.Bijector.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.bijector.Bijector.md deleted file mode 100644 index bc383ea122..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.distributions.bijector.Bijector.md +++ /dev/null @@ -1,509 +0,0 @@ -Interface for transforming a `Distribution` sample. - -A `Bijector` implements a -[diffeomorphism](https://en.wikipedia.org/wiki/Diffeomorphism), i.e., a -bijective, differentiable function. A `Bijector` is used by -`TransformedDistribution` but can be generally used for transforming a -`Distribution` generated `Tensor`. A `Bijector` is characterized by three -operations: - -1. Forward Evaluation - - Useful for turning one random outcome into another random outcome from a - different distribution. - -2. Inverse Evaluation - - Useful for "reversing" a transformation to compute one probability in - terms of another. - -3. (log o det o Jacobian o inverse)(x) - - "The log of the determinant of the matrix of all first-order partial - derivatives of the inverse function." - Useful for inverting a transformation to compute one probability in terms - of another. Geometrically, the det(Jacobian) is the volume of the - transformation and is used to scale the probability. - -By convention, transformations of random variables are named in terms of the -forward transformation. The forward transformation creates samples, the -inverse is useful for computing probabilities. - -Example Use: - - - Basic properties: - - ```python - x = ... # A tensor. - # Evaluate forward transformation. - fwd_x = my_bijector.forward(x) - x == my_bijector.inverse(fwd_x) - x != my_bijector.forward(fwd_x) # Not equal because g(x) != g(g(x)). - ``` - - - Computing a log-likelihood: - - ```python - def transformed_log_prob(bijector, log_prob, x): - return (bijector.inverse_log_det_jacobian(x) + - log_prob(bijector.inverse(x))) - ``` - - - Transforming a random outcome: - - ```python - def transformed_sample(bijector, x): - return bijector.forward(x) - ``` - -Example transformations: - - - "Exponential" - - ``` - Y = g(X) = exp(X) - X ~ Normal(0, 1) # Univariate. - ``` - - Implies: - - ``` - g^{-1}(Y) = log(Y) - |Jacobian(g^{-1})(y)| = 1 / y - Y ~ LogNormal(0, 1), i.e., - prob(Y=y) = |Jacobian(g^{-1})(y)| * prob(X=g^{-1}(y)) - = (1 / y) Normal(log(y); 0, 1) - ``` - - Here is an example of how one might implement the `Exp` bijector: - - ``` - class Exp(Bijector): - def __init__(self, event_ndims=0, validate_args=False, name="exp"): - super(Exp, self).__init__(event_ndims=event_ndims, - validate_args=validate_args, name=name) - def _forward(self, x): - return math_ops.exp(x) - def _inverse_and_inverse_log_det_jacobian(self, y): - x = math_ops.log(y) - return x, -self._forward_log_det_jacobian(x) - def _forward_log_det_jacobian(self, x): - if self.event_ndims is None: - raise ValueError("Jacobian requires known event_ndims.") - event_dims = array_ops.shape(x)[-self.event_ndims:] - return math_ops.reduce_sum(x, axis=event_dims) - ``` - - - "Affine" - - ``` - Y = g(X) = sqrtSigma * X + mu - X ~ MultivariateNormal(0, I_d) - ``` - - Implies: - - ``` - g^{-1}(Y) = inv(sqrtSigma) * (Y - mu) - |Jacobian(g^{-1})(y)| = det(inv(sqrtSigma)) - Y ~ MultivariateNormal(mu, sqrtSigma) , i.e., - prob(Y=y) = |Jacobian(g^{-1})(y)| * prob(X=g^{-1}(y)) - = det(sqrtSigma)^(-d) * - MultivariateNormal(inv(sqrtSigma) * (y - mu); 0, I_d) - ``` - -Example of why a `Bijector` needs to understand sample, batch, event -partitioning: - -- Consider the `Exp` `Bijector` applied to a `Tensor` which has sample, batch, - and event (S, B, E) shape semantics. Suppose the `Tensor`'s - partitioned-shape is `(S=[4], B=[2], E=[3, 3])`. - - For `Exp`, the shape of the `Tensor` returned by `forward` and `inverse` is - unchanged, i.e., `[4, 2, 3, 3]`. However the shape returned by - `inverse_log_det_jacobian` is `[4, 2]` because the Jacobian is a reduction - over the event dimensions. - -Subclass Requirements: - -- Typically subclasses implement `_forward` and one or both of: - - `_inverse`, `_inverse_log_det_jacobian`, - - `_inverse_and_inverse_log_det_jacobian`. - -- If the `Bijector`'s use is limited to `TransformedDistribution` (or friends - like `QuantizedDistribution`) then depending on your use, you may not need - to implement all of `_forward` and `_inverse` functions. Examples: - 1. Sampling (e.g., `sample`) only requires `_forward`. - 2. Probability functions (e.g., `prob`, `cdf`, `survival`) only require - `_inverse` (and related). - 3. Only calling probability functions on the output of `sample` means - `_inverse` can be implemented as a cache lookup. - - See `Example Use` [above] which shows how these functions are used to - transform a distribution. (Note: `_forward` could theoretically be - implemented as a cache lookup but this would require controlling the - underlying sample generation mechanism.) - -- If computation can be shared among `_inverse` and - `_inverse_log_det_jacobian` it is preferable to implement - `_inverse_and_inverse_log_det_jacobian`. This usually reduces - graph-construction overhead because a `Distribution`'s implementation of - `log_prob` will need to evaluate both the inverse Jacobian as well as the - inverse function. - -- If an additional use case needs just `inverse` or just - `inverse_log_det_jacobian` then he or she may also wish to implement these - functions to avoid computing the `inverse_log_det_jacobian` or the - `inverse`, respectively. - -- Subclasses should implement `_forward_event_shape`, - `_forward_event_shape_tensor` (and `inverse` counterparts) if the - transformation is shape-changing. By default the event-shape is assumed - unchanged from input. - -Tips for implementing `_inverse` and `_inverse_log_det_jacobian`: - -- As case 3 [above] indicates, under some circumstances the inverse function - can be implemented as a cache lookup. - -- The inverse `log o det o Jacobian` can be implemented as the negative of the - forward `log o det o Jacobian`. This is useful if the `inverse` is - implemented as a cache or the inverse Jacobian is computationally more - expensive (e.g., `CholeskyOuterProduct` `Bijector`). The following - demonstrates the suggested implementation. - - ```python - def _inverse_and_log_det_jacobian(self, y): - x = ... # implement inverse, possibly via cache. - return x, -self._forward_log_det_jac(x) # Note negation. - ``` - - By overriding the `_inverse_and_log_det_jacobian` function we have access to - the inverse in one call. - - The correctness of this approach can be seen from the following claim. - - - Claim: - - Assume `Y=g(X)` is a bijection whose derivative exists and is nonzero - for its domain, i.e., `d/dX g(X)!=0`. Then: - - ```none - (log o det o jacobian o g^{-1})(Y) = -(log o det o jacobian o g)(X) - ``` - - - Proof: - - From the bijective, nonzero differentiability of `g`, the - [inverse function theorem]( - https://en.wikipedia.org/wiki/Inverse_function_theorem) - implies `g^{-1}` is differentiable in the image of `g`. - Applying the chain rule to `y = g(x) = g(g^{-1}(y))` yields - `I = g'(g^{-1}(y))*g^{-1}'(y)`. - The same theorem also implies `g{-1}'` is non-singular therefore: - `inv[ g'(g^{-1}(y)) ] = g^{-1}'(y)`. - The claim follows from [properties of determinant]( -https://en.wikipedia.org/wiki/Determinant#Multiplicativity_and_matrix_groups). - -- If possible, prefer a direct implementation of the inverse Jacobian. This - should have superior numerical stability and will often share subgraphs with - the `_inverse` implementation. -- - - - -#### `tf.contrib.distributions.bijector.Bijector.__init__(event_ndims=None, graph_parents=None, is_constant_jacobian=False, validate_args=False, dtype=None, name=None)` {#Bijector.__init__} - -Constructs Bijector. - -A `Bijector` transforms random variables into new random variables. - -Examples: - -```python -# Create the Y = g(X) = X transform which operates on vector events. -identity = Identity(event_ndims=1) - -# Create the Y = g(X) = exp(X) transform which operates on matrices. -exp = Exp(event_ndims=2) -``` - -See `Bijector` subclass docstring for more details and specific examples. - -##### Args: - - -* `event_ndims`: number of dimensions associated with event coordinates. -* `graph_parents`: Python list of graph prerequisites of this `Bijector`. -* `is_constant_jacobian`: Python `bool` indicating that the Jacobian is not a - function of the input. -* `validate_args`: Python `bool`, default `False`. Whether to validate input - with asserts. If `validate_args` is `False`, and the inputs are invalid, - correct behavior is not guaranteed. -* `dtype`: `tf.dtype` supported by this `Bijector`. `None` means dtype is not - enforced. -* `name`: The name to give Ops created by the initializer. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.dtype` {#Bijector.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.event_ndims` {#Bijector.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.forward(x, name='forward')` {#Bijector.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.forward_event_shape(input_shape)` {#Bijector.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Bijector.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Bijector.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.graph_parents` {#Bijector.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.inverse(y, name='inverse')` {#Bijector.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Bijector.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.inverse_event_shape(output_shape)` {#Bijector.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Bijector.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Bijector.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.is_constant_jacobian` {#Bijector.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.name` {#Bijector.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Bijector.validate_args` {#Bijector.validate_args} - -Returns True if Tensor arguments will be validated. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.arg_scope.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.arg_scope.md deleted file mode 100644 index 1b3ea08e64..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.arg_scope.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.contrib.framework.arg_scope(list_ops_or_scope, **kwargs)` {#arg_scope} - -Stores the default arguments for the given set of list_ops. - -For usage, please see examples at top of the file. - -##### Args: - - -* `list_ops_or_scope`: List or tuple of operations to set argument scope for or - a dictionary containing the current scope. When list_ops_or_scope is a - dict, kwargs must be empty. When list_ops_or_scope is a list or tuple, - then every op in it need to be decorated with @add_arg_scope to work. -* `**kwargs`: keyword=value that will define the defaults for each op in - list_ops. All the ops need to accept the given set of arguments. - -##### Yields: - - the current_scope, which is a dictionary of {op: {arg: value}} - -##### Raises: - - -* `TypeError`: if list_ops is not a list or a tuple. -* `ValueError`: if any op in list_ops has not be decorated with @add_arg_scope. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.assert_scalar_int.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.assert_scalar_int.md deleted file mode 100644 index 469566f7b8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.assert_scalar_int.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.contrib.framework.assert_scalar_int(tensor, name=None)` {#assert_scalar_int} - -Assert `tensor` is 0-D, of type `tf.int32` or `tf.int64`. - -##### Args: - - -* `tensor`: `Tensor` to test. -* `name`: Name of the op and of the new `Tensor` if one is created. - -##### Returns: - - `tensor`, for chaining. - -##### Raises: - - -* `ValueError`: if `tensor` is not 0-D, of type `tf.int32` or `tf.int64`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.deprecated_arg_values.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.deprecated_arg_values.md deleted file mode 100644 index 285ea14f96..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.deprecated_arg_values.md +++ /dev/null @@ -1,35 +0,0 @@ -### `tf.contrib.framework.deprecated_arg_values(date, instructions, **deprecated_kwargs)` {#deprecated_arg_values} - -Decorator for marking specific function argument values as deprecated. - -This decorator logs a deprecation warning whenever the decorated function is -called with the deprecated argument values. It has the following format: - - Calling (from ) with = is deprecated and - will be removed after . Instructions for updating: - - - will include the class name if it is a method. - -It also edits the docstring of the function: ' (deprecated arguments)' is -appended to the first line of the docstring and a deprecation notice is -prepended to the rest of the docstring. - -##### Args: - - -* `date`: String. The date the function is scheduled to be removed. Must be - ISO 8601 (YYYY-MM-DD). -* `instructions`: String. Instructions on how to update code using the - deprecated function. -* `**deprecated_kwargs`: The deprecated argument values. - -##### Returns: - - Decorated function or method. - -##### Raises: - - -* `ValueError`: If date is not in ISO 8601 format, or instructions are empty. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.get_unique_variable.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.get_unique_variable.md deleted file mode 100644 index 39ef6a1453..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.get_unique_variable.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.contrib.framework.get_unique_variable(var_op_name)` {#get_unique_variable} - -Gets the variable uniquely identified by that var_op_name. - -##### Args: - - -* `var_op_name`: the full name of the variable op, including the scope. - -##### Returns: - - a tensorflow variable. - -##### Raises: - - -* `ValueError`: if no variable uniquely identified by the name exists. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.get_variables_to_restore.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.get_variables_to_restore.md deleted file mode 100644 index c9cde43c39..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.get_variables_to_restore.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.contrib.framework.get_variables_to_restore(include=None, exclude=None)` {#get_variables_to_restore} - -Gets the list of the variables to restore. - -##### Args: - - -* `include`: an optional list/tuple of scope strings for filtering which - variables from the VARIABLES collection to include. None would include all - the variables. -* `exclude`: an optional list/tuple of scope strings for filtering which - variables from the VARIABLES collection to exclude. None it would not - exclude any. - -##### Returns: - - a list of variables to restore. - -##### Raises: - - -* `TypeError`: include or exclude is provided but is not a list or a tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.load_checkpoint.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.load_checkpoint.md deleted file mode 100644 index d8a1c94f6f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.load_checkpoint.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.contrib.framework.load_checkpoint(filepattern)` {#load_checkpoint} - -Returns CheckpointReader for latest checkpoint. - -##### Args: - - -* `filepattern`: Directory with checkpoints file or path to checkpoint. - -##### Returns: - - `CheckpointReader` object. - -##### Raises: - - -* `ValueError`: if checkpoint_dir doesn't have 'checkpoint' file or checkpoints. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.with_same_shape.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.with_same_shape.md deleted file mode 100644 index a0d85c425e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.framework.with_same_shape.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.contrib.framework.with_same_shape(expected_tensor, tensor)` {#with_same_shape} - -Assert tensors are the same shape, from the same graph. - -##### Args: - - -* `expected_tensor`: Tensor with expected shape. -* `tensor`: Tensor of actual values. - -##### Returns: - - Tuple of (actual_tensor, label_tensor), possibly with assert ops added. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.SubGraphView.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.SubGraphView.md deleted file mode 100644 index 07338f7185..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.SubGraphView.md +++ /dev/null @@ -1,472 +0,0 @@ -A subgraph view on an existing `tf.Graph`. - -An instance of this class is a subgraph view on an existing `tf.Graph`. -"subgraph" means that it can represent part of the whole `tf.Graph`. -"view" means that it only provides a passive observation and do not to act -on the `tf.Graph`. Note that in this documentation, the term "subgraph" is -often used as substitute to "subgraph view". - -A subgraph contains: - -* a list of input tensors, accessible via the `inputs` property. -* a list of output tensors, accessible via the `outputs` property. -* and the operations in between, accessible via the "ops" property. - -An subgraph can be seen as a function F(i0, i1, ...) -> o0, o1, ... It is a -function which takes as input some input tensors and returns as output some -output tensors. The computation that the function performs is encoded in the -operations of the subgraph. - -The tensors (input or output) can be of two kinds: - -- connected: a connected tensor connects to at least one operation contained -in the subgraph. One example is a subgraph representing a single operation -and its inputs and outputs: all the input and output tensors of the op -are "connected". -- passthrough: a passthrough tensor does not connect to any operation -contained in the subgraph. One example is a subgraph representing a -single tensor: this tensor is passthrough. By default a passthrough tensor is -present both in the input and output tensors of the subgraph. It can however -be remapped to only appear as an input (or output) only. - -The input and output tensors can be remapped. For instance, some input tensor -can be omitted. For instance, a subgraph representing an operation with two -inputs can be remapped to only take one input. Note that this does not change -at all the underlying `tf.Graph` (remember, it is a view). It means that -the other input is being ignored, or is being treated as "given". -The analogy with functions can be extended like this: F(x,y) is the original -function. Remapping the inputs from [x, y] to just [x] means that the subgraph -now represent the function F_y(x) (y is "given"). - -The output tensors can also be remapped. For instance, some output tensor can -be omitted. Other output tensor can be duplicated as well. As mentioned -before, this does not change at all the underlying `tf.Graph`. -The analogy with functions can be extended like this: F(...)->x,y is the -original function. Remapping the outputs from [x, y] to just [y,y] means that -the subgraph now represent the function M(F(...)) where M is the function -M(a,b)->b,b. - -It is useful to describe three other kind of tensors: - -* internal: an internal tensor is a tensor connecting operations contained - in the subgraph. One example in the subgraph representing the two - operations A and B connected sequentially: -> A -> B ->. The middle arrow - is an internal tensor. -* actual input: an input tensor of the subgraph, regardless of whether it is - listed in "inputs" or not (masked-out). -* actual output: an output tensor of the subgraph, regardless of whether it is - listed in "outputs" or not (masked-out). -* hidden input: an actual input which has been masked-out using an - input remapping. In other word, a hidden input is a non-internal tensor - not listed as a input tensor and one of whose consumers belongs to - the subgraph. -* hidden output: a actual output which has been masked-out using an output - remapping. In other word, a hidden output is a non-internal tensor - not listed as an output and one of whose generating operations belongs to - the subgraph. - -Here are some useful guarantees about an instance of a SubGraphView: - -* the input (or output) tensors are not internal. -* the input (or output) tensors are either "connected" or "passthrough". -* the passthrough tensors are not connected to any of the operation of -the subgraph. - -Note that there is no guarantee that an operation in a subgraph contributes -at all to its inputs or outputs. For instance, remapping both the inputs and -outputs to empty lists will produce a subgraph which still contains all the -original operations. However, the remove_unused_ops function can be used to -make a new subgraph view whose operations are connected to at least one of -the input or output tensors. - -An instance of this class is meant to be a lightweight object which is not -modified in-place by the user. Rather, the user can create new modified -instances of a given subgraph. In that sense, the class SubGraphView is meant -to be used like an immutable python object. - -A common problem when using views is that they can get out-of-sync with the -data they observe (in this case, a `tf.Graph`). This is up to the user to -ensure that this doesn't happen. To keep on the safe side, it is recommended -that the life time of subgraph views are kept very short. One way to achieve -this is to use subgraphs within a "with make_sgv(...) as sgv:" Python context. - -To alleviate the out-of-sync problem, some functions are granted the right to -modified subgraph in place. This is typically the case of graph manipulation -functions which, given some subgraphs as arguments, can modify the underlying -`tf.Graph`. Since this modification is likely to render the subgraph view -invalid, those functions can modify the argument in place to reflect the -change. For instance, calling the function swap_inputs(svg0, svg1) will modify -svg0 and svg1 in place to reflect the fact that their inputs have now being -swapped. -- - - - -#### `tf.contrib.graph_editor.SubGraphView.__bool__()` {#SubGraphView.__bool__} - -Allows for implicit boolean conversion. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.__copy__()` {#SubGraphView.__copy__} - -Create a copy of this subgraph. - -Note that this class is a "view", copying it only create another view and -does not copy the underlying part of the `tf.Graph`. - -##### Returns: - - A new identical instance of the original subgraph view. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.__enter__()` {#SubGraphView.__enter__} - -Allow Python context to minimize the life time of a subgraph view. - -A subgraph view is meant to be a lightweight and transient object. A short -lifetime will alleviate the "out-of-sync" issue mentioned earlier. For that -reason, a SubGraphView instance can be used within a Python context. For -example: - -from tensorflow.contrib import graph_editor as ge -with ge.make_sgv(...) as sgv: - print(sgv) - -##### Returns: - - Itself. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.__exit__(exc_type, exc_value, traceback)` {#SubGraphView.__exit__} - - - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.__init__(inside_ops=(), passthrough_ts=())` {#SubGraphView.__init__} - -Create a subgraph containing the given ops and the "passthrough" tensors. - -##### Args: - - -* `inside_ops`: an object convertible to a list of `tf.Operation`. This list - defines all the operations in the subgraph. -* `passthrough_ts`: an object convertible to a list of `tf.Tensor`. This list - define all the "passthrough" tensors. A passthrough tensor is a tensor - which goes directly from the input of the subgraph to it output, without - any intermediate operations. All the non passthrough tensors are - silently ignored. - -##### Raises: - - -* `TypeError`: if inside_ops cannot be converted to a list of `tf.Operation` - or if `passthrough_ts` cannot be converted to a list of `tf.Tensor`. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.__nonzero__()` {#SubGraphView.__nonzero__} - -Allows for implicit boolean conversion. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.__str__()` {#SubGraphView.__str__} - - - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.connected_inputs` {#SubGraphView.connected_inputs} - -The connected input tensors of this subgraph view. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.connected_outputs` {#SubGraphView.connected_outputs} - -The connected output tensors of this subgraph view. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.consumers()` {#SubGraphView.consumers} - -Return a Python set of all the consumers of this subgraph view. - -A consumer of a subgraph view is a tf.Operation which is a consumer -of one of the output tensors and is not in the subgraph. - -##### Returns: - - A list of `tf.Operation` which are the consumers of this subgraph view. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.copy()` {#SubGraphView.copy} - -Return a copy of itself. - -Note that this class is a "view", copying it only create another view and -does not copy the underlying part of the tf.Graph. - -##### Returns: - - A new instance identical to the original one. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.find_op_by_name(op_name)` {#SubGraphView.find_op_by_name} - -Return the op named op_name. - -##### Args: - - -* `op_name`: the name to search for - -##### Returns: - - The op named op_name. - -##### Raises: - - -* `ValueError`: if the op_name could not be found. -* `AssertionError`: if the name was found multiple time. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.graph` {#SubGraphView.graph} - -The underlying `tf.Graph`. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.input_index(t)` {#SubGraphView.input_index} - -Find the input index corresponding to the given input tensor t. - -##### Args: - - -* `t`: the input tensor of this subgraph view. - -##### Returns: - - The index in the self.inputs list. - -##### Raises: - - -* `Error`: if t in not an input tensor. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.inputs` {#SubGraphView.inputs} - -The input tensors of this subgraph view. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.is_passthrough(t)` {#SubGraphView.is_passthrough} - -Check whether a tensor is passthrough. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.op(op_id)` {#SubGraphView.op} - -Get an op by its index. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.ops` {#SubGraphView.ops} - -The operations in this subgraph view. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.output_index(t)` {#SubGraphView.output_index} - -Find the output index corresponding to given output tensor t. - -##### Args: - - -* `t`: the output tensor of this subgraph view. - -##### Returns: - - The index in the self.outputs list. - -##### Raises: - - -* `Error`: if t in not an output tensor. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.outputs` {#SubGraphView.outputs} - -The output tensors of this subgraph view. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.passthroughs` {#SubGraphView.passthroughs} - -The passthrough tensors, going straight from input to output. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.remap(new_input_indices=None, new_output_indices=None)` {#SubGraphView.remap} - -Remap the inputs and outputs of the subgraph. - -Note that this is only modifying the view: the underlying tf.Graph is not -affected. - -##### Args: - - -* `new_input_indices`: an iterable of integers or tf.Tensors - representing a mapping between the old inputs and the new ones. - Integers must be positive and smaller than the number of old inputs. - tf.Tensors must belong to the old list of inputs. - This mapping can be under-complete and must be without repetitions. -* `new_output_indices`: an iterable of integers or tf.Tensors - representing a mapping between the old outputs and the new ones. - Integers must be positive and smaller than the number of old outputs. - tf.Tensors must belong to the old list of outputs. - This mapping can be under-complete and can have repetitions. - -##### Returns: - - A new modified instance of the original subgraph view with remapped - inputs and outputs. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.remap_default(remove_input_map=True, remove_output_map=True)` {#SubGraphView.remap_default} - -Remap the inputs and/or outputs to the default mapping. - -##### Args: - - -* `remove_input_map`: if True the input map is reset to the default one. -* `remove_output_map`: if True the output map is reset to the default one. - -##### Returns: - - A new modified instance of the original subgraph view with its - input and/or output mapping reset to the default one. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.remap_inputs(new_input_indices)` {#SubGraphView.remap_inputs} - -Remap the inputs of the subgraph. - -If the inputs of the original subgraph are [t0, t1, t2], remapping to [2,0] -will create a new instance whose inputs is [t2, t0]. - -Note that this is only modifying the view: the underlying `tf.Graph` is not -affected. - -##### Args: - - -* `new_input_indices`: an iterable of integers or tf.Tensors - representing a mapping between the old inputs and the new ones. - Integers must be positive and smaller than the number of old inputs. - tf.Tensors must belong to the old list of inputs. - This mapping can be under-complete and must be without repetitions. - -##### Returns: - - A new modified instance of the original subgraph view with remapped - inputs. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.remap_outputs(new_output_indices)` {#SubGraphView.remap_outputs} - -Remap the output of the subgraph. - -If the output of the original subgraph are [t0, t1, t2], remapping to -[1,1,0] will create a new instance whose outputs is [t1, t1, t0]. - -Note that this is only modifying the view: the underlying tf.Graph is not -affected. - -##### Args: - - -* `new_output_indices`: an iterable of integers or tf.Tensors - representing a mapping between the old outputs and the new ones. - Integers must be positive and smaller than the number of old outputs. - tf.Tensors must belong to the old list of outputs. - This mapping can be under-complete and can have repetitions. - -##### Returns: - - A new modified instance of the original subgraph view with remapped - outputs. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.remap_outputs_make_unique()` {#SubGraphView.remap_outputs_make_unique} - -Remap the outputs so that all the tensors appears only once. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.remap_outputs_to_consumers()` {#SubGraphView.remap_outputs_to_consumers} - -Remap the outputs to match the number of consumers. - - -- - - - -#### `tf.contrib.graph_editor.SubGraphView.remove_unused_ops(control_inputs=True)` {#SubGraphView.remove_unused_ops} - -Remove unused ops. - -##### Args: - - -* `control_inputs`: if True, control inputs are used to detect used ops. - -##### Returns: - - A new subgraph view which only contains used operations. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.TransformerInfo.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.TransformerInfo.md deleted file mode 100644 index 34489b5305..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.TransformerInfo.md +++ /dev/null @@ -1,67 +0,0 @@ -"Contains information about the result of a transform operation. -- - - - -#### `tf.contrib.graph_editor.TransformerInfo.__init__(info)` {#TransformerInfo.__init__} - -Constructor. - -##### Args: - - -* `info`: an instance of Transformer._TmpInfo containing various internal - information about the transform operation. - - -- - - - -#### `tf.contrib.graph_editor.TransformerInfo.__str__()` {#TransformerInfo.__str__} - - - - -- - - - -#### `tf.contrib.graph_editor.TransformerInfo.original(transformed, missing_fn=None)` {#TransformerInfo.original} - -Return the original op/tensor corresponding to the transformed one. - -Note that the output of this function mimics the hierarchy -of its input argument `transformed`. -Given an iterable, it returns a list. Given an operation or a tensor, -it will return an operation or a tensor. - -##### Args: - - -* `transformed`: the transformed tensor/operation. -* `missing_fn`: function handling the case where the counterpart - cannot be found. By default, None is returned. - -##### Returns: - - the original tensor/operation (or None if no match is found). - - -- - - - -#### `tf.contrib.graph_editor.TransformerInfo.transformed(original, missing_fn=None)` {#TransformerInfo.transformed} - -Return the transformed op/tensor corresponding to the original one. - -Note that the output of this function mimics the hierarchy -of its input argument `original`. -Given an iterable, it returns a list. Given an operation or a tensor, -it will return an operation or a tensor. - -##### Args: - - -* `original`: the original tensor/operation. -* `missing_fn`: function handling the case where the counterpart - cannot be found. By default, None is returned. - -##### Returns: - - the transformed tensor/operation (or None if no match is found). - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.copy.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.copy.md deleted file mode 100644 index 008fe66686..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.copy.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.contrib.graph_editor.copy(sgv, dst_graph=None, dst_scope='', src_scope='', reuse_dst_scope=False)` {#copy} - -Copy a subgraph. - -##### Args: - - -* `sgv`: the source subgraph-view. This argument is converted to a subgraph - using the same rules than the function subgraph.make_view. -* `dst_graph`: the destination graph. -* `dst_scope`: the destination scope. -* `src_scope`: the source scope. -* `reuse_dst_scope`: if True the dst_scope is re-used if it already exists. - Otherwise, the scope is given a unique name based on the one given - by appending an underscore followed by a digit (default). - -##### Returns: - - A tuple `(sgv, info)` where: - `sgv` is the transformed subgraph view; - `info` is an instance of TransformerInfo containing - information about the transform, including mapping between - original and transformed tensors and operations. - -##### Raises: - - -* `TypeError`: if `dst_graph` is not a `tf.Graph`. -* `StandardError`: if sgv cannot be converted to a SubGraphView using - the same rules than the function subgraph.make_view. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.filter_ts_from_regex.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.filter_ts_from_regex.md deleted file mode 100644 index 469a458b4b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.filter_ts_from_regex.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.contrib.graph_editor.filter_ts_from_regex(ops, regex)` {#filter_ts_from_regex} - -Get all the tensors linked to ops that match the given regex. - -##### Args: - - -* `ops`: an object convertible to a list of tf.Operation. -* `regex`: a regular expression matching the tensors' name. - For example, "^foo(/.*)?:\d+$" will match all the tensors in the "foo" - scope. - -##### Returns: - - A list of tf.Tensor. - -##### Raises: - - -* `TypeError`: if ops cannot be converted to a list of tf.Operation. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.keep_t_if_possible_handler.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.keep_t_if_possible_handler.md deleted file mode 100644 index 97d3977124..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.graph_editor.keep_t_if_possible_handler.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.contrib.graph_editor.keep_t_if_possible_handler(info, t)` {#keep_t_if_possible_handler} - -Transform a tensor into itself (identity) if possible. - -This handler transform a tensor into itself if the source and destination -graph are the same. Otherwise it will create a placeholder. -This handler is typically used to transform a hidden input tensors. - -##### Args: - - -* `info`: Transform._TmpInfo instance. -* `t`: tensor whose input must be transformed into a place holder. - -##### Returns: - - The tensor generated by the newly created place holder. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.infer_real_valued_columns.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.infer_real_valued_columns.md deleted file mode 100644 index 92c0e584f2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.infer_real_valued_columns.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.layers.infer_real_valued_columns(features)` {#infer_real_valued_columns} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.optimize_loss.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.optimize_loss.md deleted file mode 100644 index a3a7a2989f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.optimize_loss.md +++ /dev/null @@ -1,83 +0,0 @@ -### `tf.contrib.layers.optimize_loss(loss, global_step, learning_rate, optimizer, gradient_noise_scale=None, gradient_multipliers=None, clip_gradients=None, learning_rate_decay_fn=None, update_ops=None, variables=None, name=None, summaries=None, colocate_gradients_with_ops=False)` {#optimize_loss} - -Given loss and parameters for optimizer, returns a training op. - -Various ways of passing optimizers, include: - -- string, name of the optimizer like 'SGD', 'Adam', see OPTIMIZER_CLS_NAMES - for full list. E.g. `optimize_loss(..., optimizer='Adam')`. -- function, takes learning rate `Tensor` as argument and must return - `Optimizer` instance. E.g. `optimize_loss(..., - optimizer=lambda lr: tf.train.MomentumOptimizer(lr, momentum=0.5))`. - Alternatively, if `learning_rate` is `None`, the function takes no - arguments. E.g. `optimize_loss(..., learning_rate=None, - optimizer=lambda: tf.train.MomentumOptimizer(0.5, momentum=0.5))`. -- class, subclass of `Optimizer` that takes only one required argument - - learning rate, such as AdamOptimizer, AdagradOptimizer. - E.g. `optimize_loss(..., optimizer=tf.train.AdagradOptimizer)`. -- object, instance of subclass of `Optimizer`. - E.g., `optimizer_loss(..., optimizer=tf.train.AdagradOptimizer(0.5))`. - -##### Args: - - -* `loss`: Scalar `Tensor`. -* `global_step`: Scalar int `Tensor`, step counter for each update. If not - supplied, it will be fetched from the default graph (see - `tf.contrib.framework.get_global_step` for details). If it's - not been created, no step will be incremented with each weight - update. `learning_rate_decay_fn` requires `global_step`. -* `learning_rate`: float or `Tensor`, magnitude of update per each training - step. Can be `None`. -* `optimizer`: string, class or optimizer instance, used as trainer. - string should be name of optimizer, like 'SGD', - 'Adam', 'Adagrad'. Full list in OPTIMIZER_CLS_NAMES constant. - class should be sub-class of `tf.Optimizer` that implements - `compute_gradients` and `apply_gradients` functions. - optimizer instance should be instantiation of `tf.Optimizer` - sub-class and have `compute_gradients` and `apply_gradients` - functions. -* `gradient_noise_scale`: float or None, adds 0-mean normal noise scaled by this - value. -* `gradient_multipliers`: dict of variables or variable names to floats. - If present, gradients for specified - variables will be multiplied by given constant. -* `clip_gradients`: float, callable or `None`. If float, is provided, a global - clipping is applied to prevent the norm of the gradient to exceed this - value. Alternatively, a callable can be provided e.g.: adaptive_clipping. - This callable takes a `list` of `(gradients, variables)` `tuple`s and - returns the same thing with the gradients modified. -* `learning_rate_decay_fn`: function, takes `learning_rate` and `global_step` - `Tensor`s, returns `Tensor`. - Can be used to implement any learning rate decay - functions. - For example: `tf.train.exponential_decay`. - Ignored if `learning_rate` is not supplied. -* `update_ops`: list of update `Operation`s to execute at each step. If `None`, - uses elements of UPDATE_OPS collection. The order of execution - between `update_ops` and `loss` is non-deterministic. -* `variables`: list of variables to optimize or - `None` to use all trainable variables. -* `name`: The name for this operation is used to scope operations and summaries. -* `summaries`: List of internal quantities to visualize on tensorboard. If not - set only the loss and the learning rate will be reported. The - complete list is in OPTIMIZER_SUMMARIES. -* `colocate_gradients_with_ops`: If True, try colocating gradients with the - corresponding op. - -##### Returns: - - Training op. - -##### Raises: - - -* `ValueError`: if: - * `loss` is an invalid type or shape. - * `global_step` is an invalid type or shape. - * `learning_rate` is an invalid type or value. - * `optimizer` is wrong type. - * `clip_gradients` is not float or callable. - * `learning_rate` and `learning_rate_decay_fn` are supplied, but no - `global_step` is available. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.repeat.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.repeat.md deleted file mode 100644 index 47672d30bd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.repeat.md +++ /dev/null @@ -1,36 +0,0 @@ -### `tf.contrib.layers.repeat(inputs, repetitions, layer, *args, **kwargs)` {#repeat} - -Applies the same layer with the same arguments repeatedly. - -```python - y = repeat(x, 3, conv2d, 64, [3, 3], scope='conv1') - # It is equivalent to: - - x = conv2d(x, 64, [3, 3], scope='conv1/conv1_1') - x = conv2d(x, 64, [3, 3], scope='conv1/conv1_2') - y = conv2d(x, 64, [3, 3], scope='conv1/conv1_3') -``` - -If the `scope` argument is not given in `kwargs`, it is set to -`layer.__name__`, or `layer.func.__name__` (for `functools.partial` -objects). If neither `__name__` nor `func.__name__` is available, the -layers are called with `scope='stack'`. - -##### Args: - - -* `inputs`: A `Tensor` suitable for layer. -* `repetitions`: Int, number of repetitions. -* `layer`: A layer with arguments `(inputs, *args, **kwargs)` -* `*args`: Extra args for the layer. -* `**kwargs`: Extra kwargs for the layer. - -##### Returns: - - A tensor result of applying the layer, repetitions times. - -##### Raises: - - -* `ValueError`: If the op is unknown or wrong. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.safe_embedding_lookup_sparse.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.safe_embedding_lookup_sparse.md deleted file mode 100644 index faa0bb0351..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.safe_embedding_lookup_sparse.md +++ /dev/null @@ -1,50 +0,0 @@ -### `tf.contrib.layers.safe_embedding_lookup_sparse(embedding_weights, sparse_ids, sparse_weights=None, combiner=None, default_id=None, name=None, partition_strategy='div', max_norm=None)` {#safe_embedding_lookup_sparse} - -Lookup embedding results, accounting for invalid IDs and empty features. - -The partitioned embedding in `embedding_weights` must all be the same shape -except for the first dimension. The first dimension is allowed to vary as the -vocabulary size is not necessarily a multiple of `P`. `embedding_weights` -may be a `PartitionedVariable` as returned by using `tf.get_variable()` with a -partitioner. - -Invalid IDs (< 0) are pruned from input IDs and weights, as well as any IDs -with non-positive weight. For an entry with no features, the embedding vector -for `default_id` is returned, or the 0-vector if `default_id` is not supplied. - -The ids and weights may be multi-dimensional. Embeddings are always aggregated -along the last dimension. - -##### Args: - - -* `embedding_weights`: A list of `P` float tensors or values representing - partitioned embedding tensors. Alternatively, a `PartitionedVariable`, - created by partitioning along dimension 0. The total unpartitioned - shape should be `[e_0, e_1, ..., e_m]`, where `e_0` represents the - vocab size and `e_1, ..., e_m` are the embedding dimensions. -* `sparse_ids`: `SparseTensor` of shape `[d_0, d_1, ..., d_n]` containing the - ids. `d_0` is typically batch size. -* `sparse_weights`: `SparseTensor` of same shape as `sparse_ids`, containing - float weights corresponding to `sparse_ids`, or `None` if all weights - are be assumed to be 1.0. -* `combiner`: A string specifying how to combine embedding results for each - entry. Currently "mean", "sqrtn" and "sum" are supported, with "mean" - the default. -* `default_id`: The id to use for an entry with no features. -* `name`: A name for this operation (optional). -* `partition_strategy`: A string specifying the partitioning strategy. - Currently `"div"` and `"mod"` are supported. Default is `"div"`. -* `max_norm`: If not None, all embeddings are l2-normalized to max_norm before - combining. - - -##### Returns: - - Dense tensor of shape `[d_0, d_1, ..., d_{n-1}, e_1, ..., e_m]`. - -##### Raises: - - -* `ValueError`: if `embedding_weights` is empty. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.shared_embedding_columns.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.shared_embedding_columns.md deleted file mode 100644 index 29611d833a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.shared_embedding_columns.md +++ /dev/null @@ -1,48 +0,0 @@ -### `tf.contrib.layers.shared_embedding_columns(sparse_id_columns, dimension, combiner='mean', shared_embedding_name=None, initializer=None, ckpt_to_load_from=None, tensor_name_in_ckpt=None, max_norm=None)` {#shared_embedding_columns} - -Creates a list of `_EmbeddingColumn` sharing the same embedding. - -##### Args: - - -* `sparse_id_columns`: An iterable of `_SparseColumn`, such as those created by - `sparse_column_with_*` or crossed_column functions. Note that `combiner` - defined in each sparse_id_column is ignored. -* `dimension`: An integer specifying dimension of the embedding. -* `combiner`: A string specifying how to reduce if there are multiple entries - in a single row. Currently "mean", "sqrtn" and "sum" are supported, with - "mean" the default. "sqrtn" often achieves good accuracy, in particular - with bag-of-words columns. Each of this can be thought as example level - normalizations on the column: - * "sum": do not normalize - * "mean": do l1 normalization - * "sqrtn": do l2 normalization - For more information: `tf.embedding_lookup_sparse`. -* `shared_embedding_name`: (Optional). A string specifying the name of shared - embedding weights. This will be needed if you want to reference the shared - embedding separately from the generated `_EmbeddingColumn`. -* `initializer`: A variable initializer function to be used in embedding - variable initialization. If not specified, defaults to - `tf.truncated_normal_initializer` with mean 0.0 and standard deviation - 1/sqrt(sparse_id_columns[0].length). -* `ckpt_to_load_from`: (Optional). String representing checkpoint name/pattern - to restore the column weights. Required if `tensor_name_in_ckpt` is not - None. -* `tensor_name_in_ckpt`: (Optional). Name of the `Tensor` in the provided - checkpoint from which to restore the column weights. Required if - `ckpt_to_load_from` is not None. -* `max_norm`: (Optional). If not None, embedding values are l2-normalized to - the value of max_norm. - -##### Returns: - - A tuple of `_EmbeddingColumn` with shared embedding space. - -##### Raises: - - -* `ValueError`: if sparse_id_columns is empty, or its elements are not - compatible with each other. -* `TypeError`: if `sparse_id_columns` is not a sequence or is a string. If at - least one element of `sparse_id_columns` is not a `SparseTensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.weighted_sum_from_feature_columns.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.weighted_sum_from_feature_columns.md deleted file mode 100644 index 39ae2754f9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.layers.weighted_sum_from_feature_columns.md +++ /dev/null @@ -1,54 +0,0 @@ -### `tf.contrib.layers.weighted_sum_from_feature_columns(columns_to_tensors, feature_columns, num_outputs, weight_collections=None, trainable=True, scope=None)` {#weighted_sum_from_feature_columns} - -A tf.contrib.layer style linear prediction builder based on FeatureColumns. - -Generally a single example in training data is described with feature columns. -This function generates weighted sum for each num_outputs. Weighted sum refers -to logits in classification problems. It refers to prediction itself for -linear regression problems. - -Example: - - ``` - # Building model for training - feature_columns = ( - real_valued_column("my_feature1"), - ... - ) - columns_to_tensor = tf.parse_example(...) - logits = weighted_sum_from_feature_columns( - columns_to_tensors=columns_to_tensor, - feature_columns=feature_columns, - num_outputs=1) - loss = tf.nn.sigmoid_cross_entropy_with_logits(labels=labels, - logits=logits) - ``` - -##### Args: - - -* `columns_to_tensors`: A mapping from feature column to tensors. 'string' key - means a base feature (not-transformed). It can have FeatureColumn as a - key too. That means that FeatureColumn is already transformed by input - pipeline. For example, `inflow` may have handled transformations. -* `feature_columns`: A set containing all the feature columns. All items in the - set should be instances of classes derived from FeatureColumn. -* `num_outputs`: An integer specifying number of outputs. Default value is 1. -* `weight_collections`: List of graph collections to which weights are added. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for variable_scope. - -##### Returns: - - A tuple containing: - - * A Tensor which represents predictions of a linear model. - * A dictionary which maps feature_column to corresponding Variable. - * A Variable which is used for bias. - -##### Raises: - - -* `ValueError`: if FeatureColumn cannot be used for linear predictions. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.BaseEstimator.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.BaseEstimator.md deleted file mode 100644 index 740be32d9b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.BaseEstimator.md +++ /dev/null @@ -1,305 +0,0 @@ -Abstract BaseEstimator class to train and evaluate TensorFlow models. - -Users should not instantiate or subclass this class. Instead, use `Estimator`. -- - - - -#### `tf.contrib.learn.BaseEstimator.__init__(model_dir=None, config=None)` {#BaseEstimator.__init__} - -Initializes a BaseEstimator instance. - -##### Args: - - -* `model_dir`: Directory to save model parameters, graph and etc. This can - also be used to load checkpoints from the directory into a estimator to - continue training a previously saved model. -* `config`: A RunConfig instance. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.__repr__()` {#BaseEstimator.__repr__} - - - - -- - - - -#### `tf.contrib.learn.BaseEstimator.config` {#BaseEstimator.config} - - - - -- - - - -#### `tf.contrib.learn.BaseEstimator.evaluate(*args, **kwargs)` {#BaseEstimator.evaluate} - -See `Evaluable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If at least one of `x` or `y` is provided, and at least one of - `input_fn` or `feed_fn` is provided. - Or if `metrics` is not `None` or `dict`. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.export(*args, **kwargs)` {#BaseEstimator.export} - -Exports inference graph into given dir. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-23. -Instructions for updating: -The signature of the input_fn accepted by export is changing to be consistent with what's used by tf.Learn Estimator's train/evaluate. input_fn (and in most cases, input_feature_key) will become required args, and use_deprecated_input_fn will default to False and be removed altogether. - -##### Args: - - -* `export_dir`: A string containing a directory to write the exported graph - and checkpoints. -* `input_fn`: If `use_deprecated_input_fn` is true, then a function that given - `Tensor` of `Example` strings, parses it into features that are then - passed to the model. Otherwise, a function that takes no argument and - returns a tuple of (features, labels), where features is a dict of - string key to `Tensor` and labels is a `Tensor` that's currently not - used (and so can be `None`). -* `input_feature_key`: Only used if `use_deprecated_input_fn` is false. String - key into the features dict returned by `input_fn` that corresponds to a - the raw `Example` strings `Tensor` that the exported model will take as - input. Can only be `None` if you're using a custom `signature_fn` that - does not use the first arg (examples). -* `use_deprecated_input_fn`: Determines the signature format of `input_fn`. -* `signature_fn`: Function that returns a default signature and a named - signature map, given `Tensor` of `Example` strings, `dict` of `Tensor`s - for features and `Tensor` or `dict` of `Tensor`s for predictions. -* `prediction_key`: The key for a tensor in the `predictions` dict (output - from the `model_fn`) to use as the `predictions` input to the - `signature_fn`. Optional. If `None`, predictions will pass to - `signature_fn` without filtering. -* `default_batch_size`: Default batch size of the `Example` placeholder. -* `exports_to_keep`: Number of exports to keep. -* `checkpoint_path`: the checkpoint path of the model to be exported. If it is - `None` (which is default), will use the latest checkpoint in - export_dir. - -##### Returns: - - The string path to the exported directory. NB: this functionality was - added ca. 2016/09/25; clients that depend on the return value may need - to handle the case where this function returns None because subclasses - are not returning a value. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.fit(*args, **kwargs)` {#BaseEstimator.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.get_params(deep=True)` {#BaseEstimator.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.get_variable_names()` {#BaseEstimator.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.get_variable_value(name)` {#BaseEstimator.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.model_dir` {#BaseEstimator.model_dir} - - - - -- - - - -#### `tf.contrib.learn.BaseEstimator.partial_fit(*args, **kwargs)` {#BaseEstimator.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.predict(*args, **kwargs)` {#BaseEstimator.predict} - -Returns predictions for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x` and 'batch_size' must be `None`. -* `batch_size`: Override default batch size. If set, 'input_fn' must be - 'None'. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns all. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - A numpy array of predicted classes or regression values if the - constructor's `model_fn` returns a `Tensor` for `predictions` or a `dict` - of numpy arrays if `model_fn` returns a `dict`. Returns an iterable of - predictions if as_iterable is True. - -##### Raises: - - -* `ValueError`: If x and input_fn are both provided or both `None`. - - -- - - - -#### `tf.contrib.learn.BaseEstimator.set_params(**params)` {#BaseEstimator.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.ModeKeys.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.ModeKeys.md deleted file mode 100644 index 83e0bd4119..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.ModeKeys.md +++ /dev/null @@ -1,7 +0,0 @@ -Standard names for model modes. - -The following standard keys are defined: - -* `TRAIN`: training mode. -* `EVAL`: evaluation mode. -* `INFER`: inference mode. diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.ModelFnOps.__new__.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.ModelFnOps.__new__.md deleted file mode 100644 index 10dec55e35..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.ModelFnOps.__new__.md +++ /dev/null @@ -1,54 +0,0 @@ -#### `tf.contrib.learn.ModelFnOps.__new__(cls, mode, predictions=None, loss=None, train_op=None, eval_metric_ops=None, output_alternatives=None, training_chief_hooks=None, training_hooks=None, scaffold=None)` {#ModelFnOps.__new__} - -Creates a validated `ModelFnOps` instance. - -For a multi-headed model, the predictions dict here will contain the outputs -of all of the heads. However: at serving time, requests will be made -specifically for one or more heads, and the RPCs used for these requests may -differ by problem type (i.e., regression, classification, other). The -purpose of the output_alternatives dict is to aid in exporting a SavedModel -from which such head-specific queries can be served. These -output_alternatives will be combined with input_alternatives (see -`saved_model_export_utils`) to produce a set of `SignatureDef`s specifying -the valid requests that can be served from this model. - -For a single-headed model, it is still adviseable to provide -output_alternatives with a single entry, because this is how the problem -type is communicated for export and serving. If output_alternatives is not -given, the resulting SavedModel will support only one head of unspecified -type. - -##### Args: - - -* `mode`: One of `ModeKeys`. Specifies if this training, evaluation or - prediction. -* `predictions`: Predictions `Tensor` or dict of `Tensor`. -* `loss`: Training loss `Tensor`. -* `train_op`: Op for the training step. -* `eval_metric_ops`: Dict of metric results keyed by name. The values of the - dict are the results of calling a metric function, such as `Tensor`. -* `output_alternatives`: a dict of - `{submodel_name: (problem_type, {tensor_name: Tensor})}`, where - `submodel_name` is a submodel identifier that should be consistent - across the pipeline (here likely taken from the name of each `Head`, - for models that use them), `problem_type` is a `ProblemType`, - `tensor_name` is a symbolic name for an output Tensor possibly but not - necessarily taken from `PredictionKey`, and `Tensor` is the - corresponding output Tensor itself. -* `training_chief_hooks`: A list of `SessionRunHook` objects that will be - run on the chief worker during training. -* `training_hooks`: A list of `SessionRunHook` objects that will be run on - all workers during training. -* `scaffold`: A `tf.train.Scaffold` object that can be used to set - initialization, saver, and more to be used in training. - -##### Returns: - - A validated `ModelFnOps` object. - -##### Raises: - - -* `ValueError`: If validation fails. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.ProblemType.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.ProblemType.md deleted file mode 100644 index 20be4db791..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.ProblemType.md +++ /dev/null @@ -1,10 +0,0 @@ -Enum-like values for the type of problem that the model solves. - -These values are used when exporting the model to produce the appropriate -signature function for serving. - -The following values are supported: - UNSPECIFIED: Produces a predict signature_fn. - CLASSIFICATION: Produces a classify signature_fn. - LINEAR_REGRESSION: Produces a regression signature_fn. - LOGISTIC_REGRESSION: Produces a classify signature_fn. diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.CaptureVariable.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.CaptureVariable.md deleted file mode 100644 index 4160ed5ec4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.CaptureVariable.md +++ /dev/null @@ -1,199 +0,0 @@ -Captures a variable's values into a collection. - -This monitor is useful for unit testing. You should exercise caution when -using this monitor in production, since it never discards values. - -This is an `EveryN` monitor and has consistent semantic for `every_n` -and `first_n`. -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.__init__(var_name, every_n=100, first_n=1)` {#CaptureVariable.__init__} - -Initializes a CaptureVariable monitor. - -##### Args: - - -* `var_name`: `string`. The variable name, including suffix (typically ":0"). -* `every_n`: `int`, print every N steps. See `PrintN.` -* `first_n`: `int`, also print the first N steps. See `PrintN.` - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.begin(max_steps=None)` {#CaptureVariable.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.end(session=None)` {#CaptureVariable.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.epoch_begin(epoch)` {#CaptureVariable.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.epoch_end(epoch)` {#CaptureVariable.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.every_n_post_step(step, session)` {#CaptureVariable.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.every_n_step_begin(step)` {#CaptureVariable.every_n_step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.every_n_step_end(step, outputs)` {#CaptureVariable.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.post_step(step, session)` {#CaptureVariable.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.run_on_all_workers` {#CaptureVariable.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.set_estimator(estimator)` {#CaptureVariable.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.step_begin(step)` {#CaptureVariable.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.step_end(step, output)` {#CaptureVariable.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - -- - - - -#### `tf.contrib.learn.monitors.CaptureVariable.values` {#CaptureVariable.values} - -Returns the values captured so far. - -##### Returns: - - `dict` mapping `int` step numbers to that values of the variable at the - respective step. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.ExportMonitor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.ExportMonitor.md deleted file mode 100644 index bf3fa842a3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.ExportMonitor.md +++ /dev/null @@ -1,248 +0,0 @@ -Monitor that exports Estimator every N steps. -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.__init__(*args, **kwargs)` {#ExportMonitor.__init__} - -Initializes ExportMonitor. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-23. -Instructions for updating: -The signature of the input_fn accepted by export is changing to be consistent with what's used by tf.Learn Estimator's train/evaluate. input_fn (and in most cases, input_feature_key) will both become required args. - -##### Args: - - -* `every_n_steps`: Run monitor every N steps. -* `export_dir`: str, folder to export. -* `input_fn`: A function that takes no argument and returns a tuple of - (features, labels), where features is a dict of string key to `Tensor` - and labels is a `Tensor` that's currently not used (and so can be - `None`). -* `input_feature_key`: String key into the features dict returned by - `input_fn` that corresponds to the raw `Example` strings `Tensor` that - the exported model will take as input. Should be `None` if and only if - you're passing in a `signature_fn` that does not use the first arg - (`Tensor` of `Example` strings). -* `exports_to_keep`: int, number of exports to keep. -* `signature_fn`: Function that returns a default signature and a named - signature map, given `Tensor` of `Example` strings, `dict` of `Tensor`s - for features and `dict` of `Tensor`s for predictions. -* `default_batch_size`: Default batch size of the `Example` placeholder. - -##### Raises: - - -* `ValueError`: If `input_fn` and `input_feature_key` are not both defined or - are not both `None`. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.begin(max_steps=None)` {#ExportMonitor.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.end(session=None)` {#ExportMonitor.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.epoch_begin(epoch)` {#ExportMonitor.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.epoch_end(epoch)` {#ExportMonitor.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.every_n_post_step(step, session)` {#ExportMonitor.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.every_n_step_begin(step)` {#ExportMonitor.every_n_step_begin} - -Callback before every n'th step begins. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list` of tensors that will be evaluated at this step. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.every_n_step_end(step, outputs)` {#ExportMonitor.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.export_dir` {#ExportMonitor.export_dir} - - - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.exports_to_keep` {#ExportMonitor.exports_to_keep} - - - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.last_export_dir` {#ExportMonitor.last_export_dir} - -Returns the directory containing the last completed export. - -##### Returns: - - The string path to the exported directory. NB: this functionality was - added on 2016/09/25; clients that depend on the return value may need - to handle the case where this function returns None because the - estimator being fitted does not yet return a value during export. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.post_step(step, session)` {#ExportMonitor.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.run_on_all_workers` {#ExportMonitor.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.set_estimator(estimator)` {#ExportMonitor.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.signature_fn` {#ExportMonitor.signature_fn} - - - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.step_begin(step)` {#ExportMonitor.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.ExportMonitor.step_end(step, output)` {#ExportMonitor.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.GraphDump.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.GraphDump.md deleted file mode 100644 index 8e1fed54c1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.GraphDump.md +++ /dev/null @@ -1,163 +0,0 @@ -Dumps almost all tensors in the graph at every step. - -Note, this is very expensive, prefer `PrintTensor` in production. -- - - - -#### `tf.contrib.learn.monitors.GraphDump.__init__(ignore_ops=None)` {#GraphDump.__init__} - -Initializes GraphDump monitor. - -##### Args: - - -* `ignore_ops`: `list` of `string`. Names of ops to ignore. - If None, `GraphDump.IGNORE_OPS` is used. - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.begin(max_steps=None)` {#GraphDump.begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.compare(other_dump, step, atol=1e-06)` {#GraphDump.compare} - -Compares two `GraphDump` monitors and returns differences. - -##### Args: - - -* `other_dump`: Another `GraphDump` monitor. -* `step`: `int`, step to compare on. -* `atol`: `float`, absolute tolerance in comparison of floating arrays. - -##### Returns: - - Returns tuple: - -* `matched`: `list` of keys that matched. -* `non_matched`: `dict` of keys to tuple of 2 mismatched values. - -##### Raises: - - -* `ValueError`: if a key in `data` is missing from `other_dump` at `step`. - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.data` {#GraphDump.data} - - - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.end(session=None)` {#GraphDump.end} - -Callback at the end of training/evaluation. - -##### Args: - - -* `session`: A `tf.Session` object that can be used to run ops. - -##### Raises: - - -* `ValueError`: if we've not begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.epoch_begin(epoch)` {#GraphDump.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.epoch_end(epoch)` {#GraphDump.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.post_step(step, session)` {#GraphDump.post_step} - -Callback after the step is finished. - -Called after step_end and receives session to perform extra session.run -calls. If failure occurred in the process, will be called as well. - -##### Args: - - -* `step`: `int`, global step of the model. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.run_on_all_workers` {#GraphDump.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.set_estimator(estimator)` {#GraphDump.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.step_begin(step)` {#GraphDump.step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.GraphDump.step_end(step, output)` {#GraphDump.step_end} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.NanLoss.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.NanLoss.md deleted file mode 100644 index d5fb341690..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.NanLoss.md +++ /dev/null @@ -1,184 +0,0 @@ -NaN Loss monitor. - -Monitors loss and stops training if loss is NaN. -Can either fail with exception or just stop training. -- - - - -#### `tf.contrib.learn.monitors.NanLoss.__init__(loss_tensor, every_n_steps=100, fail_on_nan_loss=True)` {#NanLoss.__init__} - -Initializes NanLoss monitor. - -##### Args: - - -* `loss_tensor`: `Tensor`, the loss tensor. -* `every_n_steps`: `int`, run check every this many steps. -* `fail_on_nan_loss`: `bool`, whether to raise exception when loss is NaN. - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.begin(max_steps=None)` {#NanLoss.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.end(session=None)` {#NanLoss.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.epoch_begin(epoch)` {#NanLoss.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.epoch_end(epoch)` {#NanLoss.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.every_n_post_step(step, session)` {#NanLoss.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.every_n_step_begin(step)` {#NanLoss.every_n_step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.every_n_step_end(step, outputs)` {#NanLoss.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.post_step(step, session)` {#NanLoss.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.run_on_all_workers` {#NanLoss.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.set_estimator(estimator)` {#NanLoss.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.step_begin(step)` {#NanLoss.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.NanLoss.step_end(step, output)` {#NanLoss.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.StepCounter.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.StepCounter.md deleted file mode 100644 index 13278b4fb2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.learn.monitors.StepCounter.md +++ /dev/null @@ -1,171 +0,0 @@ -Steps per second monitor. -- - - - -#### `tf.contrib.learn.monitors.StepCounter.__init__(every_n_steps=100, output_dir=None, summary_writer=None)` {#StepCounter.__init__} - - - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.begin(max_steps=None)` {#StepCounter.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.end(session=None)` {#StepCounter.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.epoch_begin(epoch)` {#StepCounter.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.epoch_end(epoch)` {#StepCounter.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.every_n_post_step(step, session)` {#StepCounter.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.every_n_step_begin(step)` {#StepCounter.every_n_step_begin} - -Callback before every n'th step begins. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list` of tensors that will be evaluated at this step. - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.every_n_step_end(current_step, outputs)` {#StepCounter.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.post_step(step, session)` {#StepCounter.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.run_on_all_workers` {#StepCounter.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.set_estimator(estimator)` {#StepCounter.set_estimator} - - - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.step_begin(step)` {#StepCounter.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.StepCounter.step_end(step, output)` {#StepCounter.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.legacy_seq2seq.embedding_attention_decoder.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.legacy_seq2seq.embedding_attention_decoder.md deleted file mode 100644 index 2ad87bab35..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.legacy_seq2seq.embedding_attention_decoder.md +++ /dev/null @@ -1,52 +0,0 @@ -### `tf.contrib.legacy_seq2seq.embedding_attention_decoder(decoder_inputs, initial_state, attention_states, cell, num_symbols, embedding_size, num_heads=1, output_size=None, output_projection=None, feed_previous=False, update_embedding_for_previous=True, dtype=None, scope=None, initial_state_attention=False)` {#embedding_attention_decoder} - -RNN decoder with embedding and attention and a pure-decoding option. - -##### Args: - - -* `decoder_inputs`: A list of 1D batch-sized int32 Tensors (decoder inputs). -* `initial_state`: 2D Tensor [batch_size x cell.state_size]. -* `attention_states`: 3D Tensor [batch_size x attn_length x attn_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function. -* `num_symbols`: Integer, how many symbols come into the embedding. -* `embedding_size`: Integer, the length of the embedding vector for each symbol. -* `num_heads`: Number of attention heads that read from attention_states. -* `output_size`: Size of the output vectors; if None, use output_size. -* `output_projection`: None or a pair (W, B) of output projection weights and - biases; W has shape [output_size x num_symbols] and B has shape - [num_symbols]; if provided and feed_previous=True, each fed previous - output will first be multiplied by W and added B. -* `feed_previous`: Boolean; if True, only the first of decoder_inputs will be - used (the "GO" symbol), and all other decoder inputs will be generated by: - next = embedding_lookup(embedding, argmax(previous_output)), - In effect, this implements a greedy decoder. It can also be used - during training to emulate http://arxiv.org/abs/1506.03099. - If False, decoder_inputs are used as given (the standard decoder case). -* `update_embedding_for_previous`: Boolean; if False and feed_previous=True, - only the embedding for the first symbol of decoder_inputs (the "GO" - symbol) will be updated by back propagation. Embeddings for the symbols - generated from the decoder itself remain unchanged. This parameter has - no effect if feed_previous=False. -* `dtype`: The dtype to use for the RNN initial states (default: tf.float32). -* `scope`: VariableScope for the created subgraph; defaults to - "embedding_attention_decoder". -* `initial_state_attention`: If False (default), initial attentions are zero. - If True, initialize the attentions from the initial state and attention - states -- useful when we wish to resume decoding from a previously - stored decoder state and attention states. - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors with - shape [batch_size x output_size] containing the generated outputs. -* `state`: The state of each decoder cell at the final time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - -##### Raises: - - -* `ValueError`: When output_projection has the wrong shape. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.legacy_seq2seq.embedding_attention_seq2seq.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.legacy_seq2seq.embedding_attention_seq2seq.md deleted file mode 100644 index 6055727edd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.legacy_seq2seq.embedding_attention_seq2seq.md +++ /dev/null @@ -1,50 +0,0 @@ -### `tf.contrib.legacy_seq2seq.embedding_attention_seq2seq(encoder_inputs, decoder_inputs, cell, num_encoder_symbols, num_decoder_symbols, embedding_size, num_heads=1, output_projection=None, feed_previous=False, dtype=None, scope=None, initial_state_attention=False)` {#embedding_attention_seq2seq} - -Embedding sequence-to-sequence model with attention. - -This model first embeds encoder_inputs by a newly created embedding (of shape -[num_encoder_symbols x input_size]). Then it runs an RNN to encode -embedded encoder_inputs into a state vector. It keeps the outputs of this -RNN at every step to use for attention later. Next, it embeds decoder_inputs -by another newly created embedding (of shape [num_decoder_symbols x -input_size]). Then it runs attention decoder, initialized with the last -encoder state, on embedded decoder_inputs and attending to encoder outputs. - -Warning: when output_projection is None, the size of the attention vectors -and variables will be made proportional to num_decoder_symbols, can be large. - -##### Args: - - -* `encoder_inputs`: A list of 1D int32 Tensors of shape [batch_size]. -* `decoder_inputs`: A list of 1D int32 Tensors of shape [batch_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function and size. -* `num_encoder_symbols`: Integer; number of symbols on the encoder side. -* `num_decoder_symbols`: Integer; number of symbols on the decoder side. -* `embedding_size`: Integer, the length of the embedding vector for each symbol. -* `num_heads`: Number of attention heads that read from attention_states. -* `output_projection`: None or a pair (W, B) of output projection weights and - biases; W has shape [output_size x num_decoder_symbols] and B has - shape [num_decoder_symbols]; if provided and feed_previous=True, each - fed previous output will first be multiplied by W and added B. -* `feed_previous`: Boolean or scalar Boolean Tensor; if True, only the first - of decoder_inputs will be used (the "GO" symbol), and all other decoder - inputs will be taken from previous outputs (as in embedding_rnn_decoder). - If False, decoder_inputs are used as given (the standard decoder case). -* `dtype`: The dtype of the initial RNN state (default: tf.float32). -* `scope`: VariableScope for the created subgraph; defaults to - "embedding_attention_seq2seq". -* `initial_state_attention`: If False (default), initial attentions are zero. - If True, initialize the attentions from the initial state and attention - states. - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors with - shape [batch_size x num_decoder_symbols] containing the generated - outputs. -* `state`: The state of each decoder cell at the final time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.legacy_seq2seq.rnn_decoder.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.legacy_seq2seq.rnn_decoder.md deleted file mode 100644 index c5eb781d62..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.legacy_seq2seq.rnn_decoder.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.contrib.legacy_seq2seq.rnn_decoder(decoder_inputs, initial_state, cell, loop_function=None, scope=None)` {#rnn_decoder} - -RNN decoder for the sequence-to-sequence model. - -##### Args: - - -* `decoder_inputs`: A list of 2D Tensors [batch_size x input_size]. -* `initial_state`: 2D Tensor with shape [batch_size x cell.state_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function and size. -* `loop_function`: If not None, this function will be applied to the i-th output - in order to generate the i+1-st input, and decoder_inputs will be ignored, - except for the first element ("GO" symbol). This can be used for decoding, - but also for training to emulate http://arxiv.org/abs/1506.03099. - Signature -- loop_function(prev, i) = next - * prev is a 2D Tensor of shape [batch_size x output_size], - * i is an integer, the step number (when advanced control is needed), - * next is a 2D Tensor of shape [batch_size x input_size]. -* `scope`: VariableScope for the created subgraph; defaults to "rnn_decoder". - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors with - shape [batch_size x output_size] containing generated outputs. -* `state`: The state of each cell at the final time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - (Note that in some cases, like basic RNN cell or GRU cell, outputs and - states can be the same. They are different for LSTM cells though.) - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.set_difference.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.set_difference.md deleted file mode 100644 index f656fb5e42..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.set_difference.md +++ /dev/null @@ -1,64 +0,0 @@ -### `tf.contrib.metrics.set_difference(a, b, aminusb=True, validate_indices=True)` {#set_difference} - -Compute set difference of elements in last dimension of `a` and `b`. - -All but the last dimension of `a` and `b` must match. - -Example: - -```python - a = [ - [ - [ - [1, 2], - [3], - ], - [ - [4], - [5, 6], - ], - ], - ] - b = [ - [ - [ - [1, 3], - [2], - ], - [ - [4, 5], - [5, 6, 7, 8], - ], - ], - ] - set_difference(a, b, aminusb=True) = [ - [ - [ - [2], - [3], - ], - [ - [], - [], - ], - ], - ] -``` - -##### Args: - - -* `a`: `Tensor` or `SparseTensor` of the same type as `b`. If sparse, indices - must be sorted in row-major order. -* `b`: `Tensor` or `SparseTensor` of the same type as `a`. If sparse, indices - must be sorted in row-major order. -* `aminusb`: Whether to subtract `b` from `a`, vs vice versa. -* `validate_indices`: Whether to validate the order and range of sparse indices - in `a` and `b`. - -##### Returns: - - A `SparseTensor` whose shape is the same rank as `a` and `b`, and all but - the last dimension the same. Elements along the last dimension contain the - differences. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_auc.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_auc.md deleted file mode 100644 index 9f405ebd5d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_auc.md +++ /dev/null @@ -1,64 +0,0 @@ -### `tf.contrib.metrics.streaming_auc(predictions, labels, weights=None, num_thresholds=200, metrics_collections=None, updates_collections=None, curve='ROC', name=None)` {#streaming_auc} - -Computes the approximate AUC via a Riemann sum. - -The `streaming_auc` function creates four local variables, `true_positives`, -`true_negatives`, `false_positives` and `false_negatives` that are used to -compute the AUC. To discretize the AUC curve, a linearly spaced set of -thresholds is used to compute pairs of recall and precision values. The area -under the ROC-curve is therefore computed using the height of the recall -values by the false positive rate, while the area under the PR-curve is the -computed using the height of the precision values by the recall. - -This value is ultimately returned as `auc`, an idempotent operation that -computes the area under a discretized curve of precision versus recall values -(computed using the aforementioned variables). The `num_thresholds` variable -controls the degree of discretization with larger numbers of thresholds more -closely approximating the true AUC. The quality of the approximation may vary -dramatically depending on `num_thresholds`. - -For best results, `predictions` should be distributed approximately uniformly -in the range [0, 1] and not peaked around 0 or 1. The quality of the AUC -approximation may be poor if this is not the case. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the `auc`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A floating point `Tensor` of arbitrary shape and whose values - are in the range `[0, 1]`. -* `labels`: A `bool` `Tensor` whose shape matches `predictions`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `num_thresholds`: The number of thresholds to use when discretizing the roc - curve. -* `metrics_collections`: An optional list of collections that `auc` should be - added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `curve`: Specifies the name of the curve to be computed, 'ROC' [default] or - 'PR' for the Precision-Recall-curve. - -* `name`: An optional variable_scope name. - -##### Returns: - - -* `auc`: A scalar `Tensor` representing the current area-under-curve. -* `update_op`: An operation that increments the `true_positives`, - `true_negatives`, `false_positives` and `false_negatives` variables - appropriately and whose value matches `auc`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_covariance.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_covariance.md deleted file mode 100644 index 6136a4ebf1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_covariance.md +++ /dev/null @@ -1,55 +0,0 @@ -### `tf.contrib.metrics.streaming_covariance(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_covariance} - -Computes the unbiased sample covariance between `predictions` and `labels`. - -The `streaming_covariance` function creates four local variables, -`comoment`, `mean_prediction`, `mean_label`, and `count`, which are used to -compute the sample covariance between predictions and labels across multiple -batches of data. The covariance is ultimately returned as an idempotent -operation that simply divides `comoment` by `count` - 1. We use `count` - 1 -in order to get an unbiased estimate. - -The algorithm used for this online computation is described in -https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance. -Specifically, the formula used to combine two sample comoments is -`C_AB = C_A + C_B + (E[x_A] - E[x_B]) * (E[y_A] - E[y_B]) * n_A * n_B / n_AB` -The comoment for a single batch of data is simply -`sum((x - E[x]) * (y - E[y]))`, optionally weighted. - -If `weights` is not None, then it is used to compute weighted comoments, -means, and count. NOTE: these weights are treated as "frequency weights", as -opposed to "reliability weights". See discussion of the difference on -https://wikipedia.org/wiki/Weighted_arithmetic_mean#Weighted_sample_variance - -To facilitate the computation of covariance across multiple batches of data, -the function creates an `update_op` operation, which updates underlying -variables and returns the updated covariance. - -##### Args: - - -* `predictions`: A `Tensor` of arbitrary size. -* `labels`: A `Tensor` of the same size as `predictions`. -* `weights`: Optional `Tensor` indicating the frequency with which an example is - sampled. Rank must be 0, or the same rank as `labels`, and must be - broadcastable to `labels` (i.e., all dimensions must be either `1`, or - the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `covariance`: A `Tensor` representing the current unbiased sample covariance, - `comoment` / (`count` - 1). -* `update_op`: An operation that updates the local variables appropriately. - -##### Raises: - - -* `ValueError`: If labels and predictions are of different sizes or if either - `metrics_collections` or `updates_collections` are not a list or tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_false_negatives_at_thresholds.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_false_negatives_at_thresholds.md deleted file mode 100644 index e1b1c77293..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_false_negatives_at_thresholds.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.metrics.streaming_false_negatives_at_thresholds(predictions, labels, thresholds, weights=None)` {#streaming_false_negatives_at_thresholds} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_mean.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_mean.md deleted file mode 100644 index 3919eed9be..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_mean.md +++ /dev/null @@ -1,44 +0,0 @@ -### `tf.contrib.metrics.streaming_mean(values, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_mean} - -Computes the (weighted) mean of the given values. - -The `streaming_mean` function creates two local variables, `total` and `count` -that are used to compute the average of `values`. This average is ultimately -returned as `mean` which is an idempotent operation that simply divides -`total` by `count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the `mean`. -`update_op` increments `total` with the reduced sum of the product of `values` -and `weights`, and it increments `count` with the reduced sum of `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `values`: A `Tensor` of arbitrary dimensions. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `values`, and - must be broadcastable to `values` (i.e., all dimensions must be either - `1`, or the same as the corresponding `values` dimension). -* `metrics_collections`: An optional list of collections that `mean` - should be added to. -* `updates_collections`: An optional list of collections that `update_op` - should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `mean`: A `Tensor` representing the current mean, the value of `total` divided - by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `mean_value`. - -##### Raises: - - -* `ValueError`: If `weights` is not `None` and its shape doesn't match `values`, - or if either `metrics_collections` or `updates_collections` are not a list - or tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_mean_relative_error.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_mean_relative_error.md deleted file mode 100644 index 1270d60a13..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_mean_relative_error.md +++ /dev/null @@ -1,52 +0,0 @@ -### `tf.contrib.metrics.streaming_mean_relative_error(predictions, labels, normalizer, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_mean_relative_error} - -Computes the mean relative error by normalizing with the given values. - -The `streaming_mean_relative_error` function creates two local variables, -`total` and `count` that are used to compute the mean relative absolute error. -This average is weighted by `weights`, and it is ultimately returned as -`mean_relative_error`: an idempotent operation that simply divides `total` by -`count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`mean_reative_error`. Internally, a `relative_errors` operation divides the -absolute value of the differences between `predictions` and `labels` by the -`normalizer`. Then `update_op` increments `total` with the reduced sum of the -product of `weights` and `relative_errors`, and it increments `count` with the -reduced sum of `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A `Tensor` of arbitrary shape. -* `labels`: A `Tensor` of the same shape as `predictions`. -* `normalizer`: A `Tensor` of the same shape as `predictions`. -* `weights`: Optional `Tensor` indicating the frequency with which an example is - sampled. Rank must be 0, or the same rank as `labels`, and must be - broadcastable to `labels` (i.e., all dimensions must be either `1`, or - the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that - `mean_relative_error` should be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `mean_relative_error`: A `Tensor` representing the current mean, the value of - `total` divided by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `mean_relative_error`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_sparse_precision_at_k.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_sparse_precision_at_k.md deleted file mode 100644 index d68243c573..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.metrics.streaming_sparse_precision_at_k.md +++ /dev/null @@ -1,77 +0,0 @@ -### `tf.contrib.metrics.streaming_sparse_precision_at_k(predictions, labels, k, class_id=None, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_sparse_precision_at_k} - -Computes precision@k of the predictions with respect to sparse labels. - -If `class_id` is not specified, we calculate precision as the ratio of true - positives (i.e., correct predictions, items in the top `k` highest - `predictions` that are found in the corresponding row in `labels`) to - positives (all top `k` `predictions`). -If `class_id` is specified, we calculate precision by considering only the - rows in the batch for which `class_id` is in the top `k` highest - `predictions`, and computing the fraction of them for which `class_id` is - in the corresponding row in `labels`. - -We expect precision to decrease as `k` increases. - -`streaming_sparse_precision_at_k` creates two local variables, -`true_positive_at_` and `false_positive_at_`, that are used to compute -the precision@k frequency. This frequency is ultimately returned as -`precision_at_`: an idempotent operation that simply divides -`true_positive_at_` by total (`true_positive_at_` + -`false_positive_at_`). - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`precision_at_`. Internally, a `top_k` operation computes a `Tensor` -indicating the top `k` `predictions`. Set operations applied to `top_k` and -`labels` calculate the true positives and false positives weighted by -`weights`. Then `update_op` increments `true_positive_at_` and -`false_positive_at_` using these values. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: Float `Tensor` with shape [D1, ... DN, num_classes] where - N >= 1. Commonly, N=1 and predictions has shape [batch size, num_classes]. - The final dimension contains the logit values for each class. [D1, ... DN] - must match `labels`. -* `labels`: `int64` `Tensor` or `SparseTensor` with shape - [D1, ... DN, num_labels], where N >= 1 and num_labels is the number of - target classes for the associated prediction. Commonly, N=1 and `labels` - has shape [batch_size, num_labels]. [D1, ... DN] must match - `predictions`. Values should be in range [0, num_classes), where - num_classes is the last dimension of `predictions`. Values outside this - range are ignored. -* `k`: Integer, k for @k metric. -* `class_id`: Integer class ID for which we want binary metrics. This should be - in range [0, num_classes], where num_classes is the last dimension of - `predictions`. If `class_id` is outside this range, the method returns - NAN. -* `weights`: `Tensor` whose rank is either 0, or n-1, where n is the rank of - `labels`. If the latter, it must be broadcastable to `labels` (i.e., all - dimensions must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that values should - be added to. -* `updates_collections`: An optional list of collections that updates should - be added to. -* `name`: Name of new update operation, and namespace for other dependent ops. - -##### Returns: - - -* `precision`: Scalar `float64` `Tensor` with the value of `true_positives` - divided by the sum of `true_positives` and `false_positives`. -* `update_op`: `Operation` that increments `true_positives` and - `false_positives` variables appropriately, and whose value matches - `precision`. - -##### Raises: - - -* `ValueError`: If `weights` is not `None` and its shape doesn't match - `predictions`, or if either `metrics_collections` or `updates_collections` - are not a list or tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.opt.ScipyOptimizerInterface.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.opt.ScipyOptimizerInterface.md deleted file mode 100644 index 63bf919f5c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.opt.ScipyOptimizerInterface.md +++ /dev/null @@ -1,87 +0,0 @@ -Wrapper allowing `scipy.optimize.minimize` to operate a `tf.Session`. - -Example: - -```python -vector = tf.Variable([7., 7.], 'vector') - -# Make vector norm as small as possible. -loss = tf.reduce_sum(tf.square(vector)) - -optimizer = ScipyOptimizerInterface(loss, options={'maxiter': 100}) - -with tf.Session() as session: - optimizer.minimize(session) - -# The value of vector should now be [0., 0.]. -``` - -Example with constraints: - -```python -vector = tf.Variable([7., 7.], 'vector') - -# Make vector norm as small as possible. -loss = tf.reduce_sum(tf.square(vector)) -# Ensure the vector's y component is = 1. -equalities = [vector[1] - 1.] -# Ensure the vector's x component is >= 1. -inequalities = [vector[0] - 1.] - -# Our default SciPy optimization algorithm, L-BFGS-B, does not support -# general constraints. Thus we use SLSQP instead. -optimizer = ScipyOptimizerInterface( - loss, equalities=equalities, inequalities=inequalities, method='SLSQP') - -with tf.Session() as session: - optimizer.minimize(session) - -# The value of vector should now be [1., 1.]. -``` -- - - - -#### `tf.contrib.opt.ScipyOptimizerInterface.__init__(loss, var_list=None, equalities=None, inequalities=None, **optimizer_kwargs)` {#ScipyOptimizerInterface.__init__} - -Initialize a new interface instance. - -##### Args: - - -* `loss`: A scalar `Tensor` to be minimized. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `equalities`: Optional list of equality constraint scalar `Tensor`s to be - held equal to zero. -* `inequalities`: Optional list of inequality constraint scalar `Tensor`s - to be kept nonnegative. -* `**optimizer_kwargs`: Other subclass-specific keyword arguments. - - -- - - - -#### `tf.contrib.opt.ScipyOptimizerInterface.minimize(session=None, feed_dict=None, fetches=None, step_callback=None, loss_callback=None)` {#ScipyOptimizerInterface.minimize} - -Minimize a scalar `Tensor`. - -Variables subject to optimization are updated in-place at the end of -optimization. - -Note that this method does *not* just return a minimization `Op`, unlike -`Optimizer.minimize()`; instead it actually performs minimization by -executing commands to control a `Session`. - -##### Args: - - -* `session`: A `Session` instance. -* `feed_dict`: A feed dict to be passed to calls to `session.run`. -* `fetches`: A list of `Tensor`s to fetch and supply to `loss_callback` - as positional arguments. -* `step_callback`: A function to be called at each optimization step; - arguments are the current values of all optimization variables - flattened into a single vector. -* `loss_callback`: A function to be called every time the loss and gradients - are computed, with evaluated fetches supplied as positional arguments. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.rnn.GRUBlockCell.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.rnn.GRUBlockCell.md deleted file mode 100644 index e6b8d4fc8b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.rnn.GRUBlockCell.md +++ /dev/null @@ -1,84 +0,0 @@ -Block GRU cell implementation. - -The implementation is based on: http://arxiv.org/abs/1406.1078 -Computes the LSTM cell forward propagation for 1 time step. - -This kernel op implements the following mathematical equations: - -Biases are initialized with: - -* `b_ru` - constant_initializer(1.0) -* `b_c` - constant_initializer(0.0) - -``` -x_h_prev = [x, h_prev] - -[r_bar u_bar] = x_h_prev * w_ru + b_ru - -r = sigmoid(r_bar) -u = sigmoid(u_bar) - -h_prevr = h_prev \circ r - -x_h_prevr = [x h_prevr] - -c_bar = x_h_prevr * w_c + b_c -c = tanh(c_bar) - -h = (1-u) \circ c + u \circ h_prev -``` -- - - - -#### `tf.contrib.rnn.GRUBlockCell.__call__(x, h_prev, scope=None)` {#GRUBlockCell.__call__} - -GRU cell. - - -- - - - -#### `tf.contrib.rnn.GRUBlockCell.__init__(cell_size)` {#GRUBlockCell.__init__} - -Initialize the Block GRU cell. - -##### Args: - - -* `cell_size`: int, GRU cell size. - - -- - - - -#### `tf.contrib.rnn.GRUBlockCell.output_size` {#GRUBlockCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.GRUBlockCell.state_size` {#GRUBlockCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.GRUBlockCell.zero_state(batch_size, dtype)` {#GRUBlockCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.rnn.static_bidirectional_rnn.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.rnn.static_bidirectional_rnn.md deleted file mode 100644 index b4cc966e32..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.contrib.rnn.static_bidirectional_rnn.md +++ /dev/null @@ -1,48 +0,0 @@ -### `tf.contrib.rnn.static_bidirectional_rnn(cell_fw, cell_bw, inputs, initial_state_fw=None, initial_state_bw=None, dtype=None, sequence_length=None, scope=None)` {#static_bidirectional_rnn} - -Creates a bidirectional recurrent neural network. - -Similar to the unidirectional case above (rnn) but takes input and builds -independent forward and backward RNNs with the final forward and backward -outputs depth-concatenated, such that the output will have the format -[time][batch][cell_fw.output_size + cell_bw.output_size]. The input_size of -forward and backward cell must match. The initial state for both directions -is zero by default (but can be set optionally) and no intermediate states are -ever returned -- the network is fully unrolled for the given (passed in) -length(s) of the sequence(s) or completely unrolled if length(s) is not given. - -##### Args: - - -* `cell_fw`: An instance of RNNCell, to be used for forward direction. -* `cell_bw`: An instance of RNNCell, to be used for backward direction. -* `inputs`: A length T list of inputs, each a tensor of shape - [batch_size, input_size], or a nested tuple of such elements. -* `initial_state_fw`: (optional) An initial state for the forward RNN. - This must be a tensor of appropriate type and shape - `[batch_size, cell_fw.state_size]`. - If `cell_fw.state_size` is a tuple, this should be a tuple of - tensors having shapes `[batch_size, s] for s in cell_fw.state_size`. -* `initial_state_bw`: (optional) Same as for `initial_state_fw`, but using - the corresponding properties of `cell_bw`. -* `dtype`: (optional) The data type for the initial state. Required if - either of the initial states are not provided. -* `sequence_length`: (optional) An int32/int64 vector, size `[batch_size]`, - containing the actual lengths for each of the sequences. -* `scope`: VariableScope for the created subgraph; defaults to - "bidirectional_rnn" - -##### Returns: - - A tuple (outputs, output_state_fw, output_state_bw) where: - outputs is a length `T` list of outputs (one for each input), which - are depth-concatenated forward and backward outputs. - output_state_fw is the final state of the forward rnn. - output_state_bw is the final state of the backward rnn. - -##### Raises: - - -* `TypeError`: If `cell_fw` or `cell_bw` is not an instance of `RNNCell`. -* `ValueError`: If inputs is None or an empty list. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.digamma.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.digamma.md deleted file mode 100644 index 8729e7ecfe..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.digamma.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.digamma(x, name=None)` {#digamma} - -Computes Psi, the derivative of Lgamma (the log of the absolute value of - -`Gamma(x)`), element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.edit_distance.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.edit_distance.md deleted file mode 100644 index e5f6471817..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.edit_distance.md +++ /dev/null @@ -1,65 +0,0 @@ -### `tf.edit_distance(hypothesis, truth, normalize=True, name='edit_distance')` {#edit_distance} - -Computes the Levenshtein distance between sequences. - -This operation takes variable-length sequences (`hypothesis` and `truth`), -each provided as a `SparseTensor`, and computes the Levenshtein distance. -You can normalize the edit distance by length of `truth` by setting -`normalize` to true. - -For example, given the following input: - -```python -# 'hypothesis' is a tensor of shape `[2, 1]` with variable-length values: -# (0,0) = ["a"] -# (1,0) = ["b"] -hypothesis = tf.SparseTensor( - [[0, 0, 0], - [1, 0, 0]], - ["a", "b"] - (2, 1, 1)) - -# 'truth' is a tensor of shape `[2, 2]` with variable-length values: -# (0,0) = [] -# (0,1) = ["a"] -# (1,0) = ["b", "c"] -# (1,1) = ["a"] -truth = tf.SparseTensor( - [[0, 1, 0], - [1, 0, 0], - [1, 0, 1], - [1, 1, 0]] - ["a", "b", "c", "a"], - (2, 2, 2)) - -normalize = True -``` - -This operation would return the following: - -```python -# 'output' is a tensor of shape `[2, 2]` with edit distances normalized -# by 'truth' lengths. -output ==> [[inf, 1.0], # (0,0): no truth, (0,1): no hypothesis - [0.5, 1.0]] # (1,0): addition, (1,1): no hypothesis -``` - -##### Args: - - -* `hypothesis`: A `SparseTensor` containing hypothesis sequences. -* `truth`: A `SparseTensor` containing truth sequences. -* `normalize`: A `bool`. If `True`, normalizes the Levenshtein distance by - length of `truth.` -* `name`: A name for the operation (optional). - -##### Returns: - - A dense `Tensor` with rank `R - 1`, where R is the rank of the - `SparseTensor` inputs `hypothesis` and `truth`. - -##### Raises: - - -* `TypeError`: If either `hypothesis` or `truth` are not a `SparseTensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.encode_base64.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.encode_base64.md deleted file mode 100644 index 20fef36bcb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.encode_base64.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.encode_base64(input, pad=None, name=None)` {#encode_base64} - -Encode strings into web-safe base64 format. - -Refer to the following article for more information on base64 format: -en.wikipedia.org/wiki/Base64. Base64 strings may have padding with '=' at the -end so that the encoded has length multiple of 4. See Padding section of the -link above. - -Web-safe means that the encoder uses - and _ instead of + and /. - -##### Args: - - -* `input`: A `Tensor` of type `string`. Strings to be encoded. -* `pad`: An optional `bool`. Defaults to `False`. - Bool whether padding is applied at the ends. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. Input strings encoded in base64. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.errors.ResourceExhaustedError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.errors.ResourceExhaustedError.md deleted file mode 100644 index a01e255be5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.errors.ResourceExhaustedError.md +++ /dev/null @@ -1,12 +0,0 @@ -Some resource has been exhausted. - -For example, this error might be raised if a per-user quota is -exhausted, or perhaps the entire file system is out of space. - -- - - - -#### `tf.errors.ResourceExhaustedError.__init__(node_def, op, message)` {#ResourceExhaustedError.__init__} - -Creates a `ResourceExhaustedError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.expand_dims.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.expand_dims.md deleted file mode 100644 index 53272b295f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.expand_dims.md +++ /dev/null @@ -1,54 +0,0 @@ -### `tf.expand_dims(input, axis=None, name=None, dim=None)` {#expand_dims} - -Inserts a dimension of 1 into a tensor's shape. - -Given a tensor `input`, this operation inserts a dimension of 1 at the -dimension index `axis` of `input`'s shape. The dimension index `axis` starts -at zero; if you specify a negative number for `axis` it is counted backward -from the end. - -This operation is useful if you want to add a batch dimension to a single -element. For example, if you have a single image of shape `[height, width, -channels]`, you can make it a batch of 1 image with `expand_dims(image, 0)`, -which will make the shape `[1, height, width, channels]`. - -Other examples: - -```python -# 't' is a tensor of shape [2] -shape(expand_dims(t, 0)) ==> [1, 2] -shape(expand_dims(t, 1)) ==> [2, 1] -shape(expand_dims(t, -1)) ==> [2, 1] - -# 't2' is a tensor of shape [2, 3, 5] -shape(expand_dims(t2, 0)) ==> [1, 2, 3, 5] -shape(expand_dims(t2, 2)) ==> [2, 3, 1, 5] -shape(expand_dims(t2, 3)) ==> [2, 3, 5, 1] -``` - -This operation requires that: - -`-1-input.dims() <= dim <= input.dims()` - -This operation is related to `squeeze()`, which removes dimensions of -size 1. - -##### Args: - - -* `input`: A `Tensor`. -* `axis`: 0-D (scalar). Specifies the dimension index at which to - expand the shape of `input`. -* `name`: The name of the output `Tensor`. -* `dim`: 0-D (scalar). Equivalent to `axis`, to be deprecated. - -##### Returns: - - A `Tensor` with the same data as `input`, but its shape has an additional - dimension of size 1 added. - -##### Raises: - - -* `ValueError`: if both `dim` and `axis` are specified. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.floor_div.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.floor_div.md deleted file mode 100644 index da18338be6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.floor_div.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.floor_div(x, y, name=None)` {#floor_div} - -Returns x // y element-wise. - -*NOTE*: `FloorDiv` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `uint16`, `int16`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.gather_nd.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.gather_nd.md deleted file mode 100644 index 22cccc9d9a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.gather_nd.md +++ /dev/null @@ -1,110 +0,0 @@ -### `tf.gather_nd(params, indices, name=None)` {#gather_nd} - -Gather values or slices from `params` according to `indices`. - -`params` is a Tensor of rank `P` and `indices` is a Tensor of rank `Q`. - -`indices` must be integer tensor, containing indices into `params`. -It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. - -The innermost dimension of `indices` (with length `K`) corresponds to -indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th -dimension of `params`. - -Produces an output tensor with shape - -``` -[d_0, ..., d_{Q-2}, params.shape[K], ..., params.shape[P-1]]. -``` - -Some examples below. - -Simple indexing into a matrix: - -```python - indices = [[0, 0], [1, 1]] - params = [['a', 'b'], ['c', 'd']] - output = ['a', 'd'] -``` - -Slice indexing into a matrix: - -```python - indices = [[1], [0]] - params = [['a', 'b'], ['c', 'd']] - output = [['c', 'd'], ['a', 'b']] -``` - -Indexing into a 3-tensor: - -```python - indices = [[1]] - params = [[['a0', 'b0'], ['c0', 'd0']], - [['a1', 'b1'], ['c1', 'd1']]] - output = [[['a1', 'b1'], ['c1', 'd1']]] - - - indices = [[0, 1], [1, 0]] - params = [[['a0', 'b0'], ['c0', 'd0']], - [['a1', 'b1'], ['c1', 'd1']]] - output = [['c0', 'd0'], ['a1', 'b1']] - - - indices = [[0, 0, 1], [1, 0, 1]] - params = [[['a0', 'b0'], ['c0', 'd0']], - [['a1', 'b1'], ['c1', 'd1']]] - output = ['b0', 'b1'] -``` - -Batched indexing into a matrix: - -```python - indices = [[[0, 0]], [[0, 1]]] - params = [['a', 'b'], ['c', 'd']] - output = [['a'], ['b']] -``` - -Batched slice indexing into a matrix: - -```python - indices = [[[1]], [[0]]] - params = [['a', 'b'], ['c', 'd']] - output = [[['c', 'd']], [['a', 'b']]] -``` - -Batched indexing into a 3-tensor: - -```python - indices = [[[1]], [[0]]] - params = [[['a0', 'b0'], ['c0', 'd0']], - [['a1', 'b1'], ['c1', 'd1']]] - output = [[[['a1', 'b1'], ['c1', 'd1']]], - [[['a0', 'b0'], ['c0', 'd0']]]] - - indices = [[[0, 1], [1, 0]], [[0, 0], [1, 1]]] - params = [[['a0', 'b0'], ['c0', 'd0']], - [['a1', 'b1'], ['c1', 'd1']]] - output = [[['c0', 'd0'], ['a1', 'b1']], - [['a0', 'b0'], ['c1', 'd1']]] - - - indices = [[[0, 0, 1], [1, 0, 1]], [[0, 1, 1], [1, 1, 0]]] - params = [[['a0', 'b0'], ['c0', 'd0']], - [['a1', 'b1'], ['c1', 'd1']]] - output = [['b0', 'b1'], ['d0', 'c1']] -``` - -##### Args: - - -* `params`: A `Tensor`. `P-D`. The tensor from which to gather values. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - `Q-D`. Index tensor having shape `[d_0, ..., d_{Q-2}, K]`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `params`. - `(P+Q-K-1)-D`. Values from `params` gathered from indices given by - `indices`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.get_variable_scope.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.get_variable_scope.md deleted file mode 100644 index 4a0d3bc775..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.get_variable_scope.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.get_variable_scope()` {#get_variable_scope} - -Returns the current variable scope. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.global_variables_initializer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.global_variables_initializer.md deleted file mode 100644 index b1ebdcc327..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.global_variables_initializer.md +++ /dev/null @@ -1,10 +0,0 @@ -### `tf.global_variables_initializer()` {#global_variables_initializer} - -Returns an Op that initializes global variables. - -This is just a shortcut for `variable_initializers(global_variables())` - -##### Returns: - - An Op that initializes global variables in the graph. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.identity.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.identity.md deleted file mode 100644 index 13f1318601..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.identity.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.identity(input, name=None)` {#identity} - -Return a tensor with the same shape and contents as the input tensor or value. - -##### Args: - - -* `input`: A `Tensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.imag.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.imag.md deleted file mode 100644 index e6a0ed1a39..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.imag.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.imag(input, name=None)` {#imag} - -Returns the imaginary part of a complex number. - -Given a tensor `input` of complex numbers, this operation returns a tensor of -type `float32` or `float64` that is the imaginary part of each element in -`input`. All elements in `input` must be complex numbers of the form \(a + -bj\), where *a* is the real part and *b* is the imaginary part returned by -this operation. - -For example: - -``` -# tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j] -tf.imag(input) ==> [4.75, 5.75] -``` - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `complex64`, - `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32` or `float64`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.image.crop_and_resize.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.image.crop_and_resize.md deleted file mode 100644 index aace65153a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.image.crop_and_resize.md +++ /dev/null @@ -1,50 +0,0 @@ -### `tf.image.crop_and_resize(image, boxes, box_ind, crop_size, method=None, extrapolation_value=None, name=None)` {#crop_and_resize} - -Extracts crops from the input image tensor and bilinearly resizes them (possibly - -with aspect ratio change) to a common output size specified by `crop_size`. This -is more general than the `crop_to_bounding_box` op which extracts a fixed size -slice from the input image and does not allow resizing or aspect ratio change. - -Returns a tensor with `crops` from the input `image` at positions defined at the -bounding box locations in `boxes`. The cropped boxes are all resized (with -bilinear interpolation) to a fixed `size = [crop_height, crop_width]`. The -result is a 4-D tensor `[num_boxes, crop_height, crop_width, depth]`. - -##### Args: - - -* `image`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int16`, `int32`, `int64`, `half`, `float32`, `float64`. - A 4-D tensor of shape `[batch, image_height, image_width, depth]`. - Both `image_height` and `image_width` need to be positive. -* `boxes`: A `Tensor` of type `float32`. - A 2-D tensor of shape `[num_boxes, 4]`. The `i`-th row of the tensor - specifies the coordinates of a box in the `box_ind[i]` image and is specified - in normalized coordinates `[y1, x1, y2, x2]`. A normalized coordinate value of - `y` is mapped to the image coordinate at `y * (image_height - 1)`, so as the - `[0, 1]` interval of normalized image height is mapped to - `[0, image_height - 1] in image height coordinates. We do allow y1 > y2, in - which case the sampled crop is an up-down flipped version of the original - image. The width dimension is treated similarly. Normalized coordinates - outside the `[0, 1]` range are allowed, in which case we use - `extrapolation_value` to extrapolate the input image values. -* `box_ind`: A `Tensor` of type `int32`. - A 1-D tensor of shape `[num_boxes]` with int32 values in `[0, batch)`. - The value of `box_ind[i]` specifies the image that the `i`-th box refers to. -* `crop_size`: A `Tensor` of type `int32`. - A 1-D tensor of 2 elements, `size = [crop_height, crop_width]`. All - cropped image patches are resized to this size. The aspect ratio of the image - content is not preserved. Both `crop_height` and `crop_width` need to be - positive. -* `method`: An optional `string` from: `"bilinear"`. Defaults to `"bilinear"`. - A string specifying the interpolation method. Only 'bilinear' is - supported for now. -* `extrapolation_value`: An optional `float`. Defaults to `0`. - Value used for extrapolation, when applicable. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. - A 4-D tensor of shape `[num_boxes, crop_height, crop_width, depth]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.image.encode_jpeg.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.image.encode_jpeg.md deleted file mode 100644 index 24b1886c10..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.image.encode_jpeg.md +++ /dev/null @@ -1,51 +0,0 @@ -### `tf.image.encode_jpeg(image, format=None, quality=None, progressive=None, optimize_size=None, chroma_downsampling=None, density_unit=None, x_density=None, y_density=None, xmp_metadata=None, name=None)` {#encode_jpeg} - -JPEG-encode an image. - -`image` is a 3-D uint8 Tensor of shape `[height, width, channels]`. - -The attr `format` can be used to override the color format of the encoded -output. Values can be: - -* `''`: Use a default format based on the number of channels in the image. -* `grayscale`: Output a grayscale JPEG image. The `channels` dimension - of `image` must be 1. -* `rgb`: Output an RGB JPEG image. The `channels` dimension - of `image` must be 3. - -If `format` is not specified or is the empty string, a default format is picked -in function of the number of channels in `image`: - -* 1: Output a grayscale image. -* 3: Output an RGB image. - -##### Args: - - -* `image`: A `Tensor` of type `uint8`. - 3-D with shape `[height, width, channels]`. -* `format`: An optional `string` from: `"", "grayscale", "rgb"`. Defaults to `""`. - Per pixel image format. -* `quality`: An optional `int`. Defaults to `95`. - Quality of the compression from 0 to 100 (higher is better and slower). -* `progressive`: An optional `bool`. Defaults to `False`. - If True, create a JPEG that loads progressively (coarse to fine). -* `optimize_size`: An optional `bool`. Defaults to `False`. - If True, spend CPU/RAM to reduce size with no quality change. -* `chroma_downsampling`: An optional `bool`. Defaults to `True`. - See http://en.wikipedia.org/wiki/Chroma_subsampling. -* `density_unit`: An optional `string` from: `"in", "cm"`. Defaults to `"in"`. - Unit used to specify `x_density` and `y_density`: - pixels per inch (`'in'`) or centimeter (`'cm'`). -* `x_density`: An optional `int`. Defaults to `300`. - Horizontal pixels per density unit. -* `y_density`: An optional `int`. Defaults to `300`. - Vertical pixels per density unit. -* `xmp_metadata`: An optional `string`. Defaults to `""`. - If not empty, embed this XMP metadata in the image header. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. 0-D. JPEG-encoded image. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.initialize_all_variables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.initialize_all_variables.md deleted file mode 100644 index ec240fc608..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.initialize_all_variables.md +++ /dev/null @@ -1,8 +0,0 @@ -### `tf.initialize_all_variables(*args, **kwargs)` {#initialize_all_variables} - -See `tf.global_variables_initializer`. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-02. -Instructions for updating: -Use `tf.global_variables_initializer` instead. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.initialize_local_variables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.initialize_local_variables.md deleted file mode 100644 index a6c1395e91..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.initialize_local_variables.md +++ /dev/null @@ -1,8 +0,0 @@ -### `tf.initialize_local_variables(*args, **kwargs)` {#initialize_local_variables} - -See `tf.local_variables_initializer`. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-02. -Instructions for updating: -Use `tf.local_variables_initializer` instead. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.is_variable_initialized.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.is_variable_initialized.md deleted file mode 100644 index d8383439ab..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.is_variable_initialized.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.is_variable_initialized(variable)` {#is_variable_initialized} - -Tests if a variable has been initialized. - -##### Args: - - -* `variable`: A `Variable`. - -##### Returns: - - Returns a scalar boolean Tensor, `True` if the variable has been - initialized, `False` otherwise. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.local_variables_initializer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.local_variables_initializer.md deleted file mode 100644 index 3f726bdf7a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.local_variables_initializer.md +++ /dev/null @@ -1,10 +0,0 @@ -### `tf.local_variables_initializer()` {#local_variables_initializer} - -Returns an Op that initializes all local variables. - -This is just a shortcut for `variable_initializers(local_variables())` - -##### Returns: - - An Op that initializes all local variables in the graph. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.matmul.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.matmul.md deleted file mode 100644 index 69079ecabe..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.matmul.md +++ /dev/null @@ -1,90 +0,0 @@ -### `tf.matmul(a, b, transpose_a=False, transpose_b=False, adjoint_a=False, adjoint_b=False, a_is_sparse=False, b_is_sparse=False, name=None)` {#matmul} - -Multiplies matrix `a` by matrix `b`, producing `a` * `b`. - -The inputs must be matrices (or tensors of rank > 2, representing batches of -matrices), with matching inner dimensions, possibly after transposition. - -Both matrices must be of the same type. The supported types are: -`float16`, `float32`, `float64`, `int32`, `complex64`, `complex128`. - -Either matrix can be transposed or adjointed (conjugated and transposed) on -the fly by setting one of the corresponding flag to `True`. These are `False` -by default. - -If one or both of the matrices contain a lot of zeros, a more efficient -multiplication algorithm can be used by setting the corresponding -`a_is_sparse` or `b_is_sparse` flag to `True`. These are `False` by default. -This optimization is only available for plain matrices (rank-2 tensors) with -datatypes `bfloat16` or `float32`. - -For example: - -```python -# 2-D tensor `a` -a = tf.constant([1, 2, 3, 4, 5, 6], shape=[2, 3]) => [[1. 2. 3.] - [4. 5. 6.]] -# 2-D tensor `b` -b = tf.constant([7, 8, 9, 10, 11, 12], shape=[3, 2]) => [[7. 8.] - [9. 10.] - [11. 12.]] -c = tf.matmul(a, b) => [[58 64] - [139 154]] - - -# 3-D tensor `a` -a = tf.constant(np.arange(1, 13, dtype=np.int32), - shape=[2, 2, 3]) => [[[ 1. 2. 3.] - [ 4. 5. 6.]], - [[ 7. 8. 9.] - [10. 11. 12.]]] - -# 3-D tensor `b` -b = tf.constant(np.arange(13, 25, dtype=np.int32), - shape=[2, 3, 2]) => [[[13. 14.] - [15. 16.] - [17. 18.]], - [[19. 20.] - [21. 22.] - [23. 24.]]] -c = tf.matmul(a, b) => [[[ 94 100] - [229 244]], - [[508 532] - [697 730]]] -``` - -##### Args: - - -* `a`: `Tensor` of type `float16`, `float32`, `float64`, `int32`, `complex64`, - `complex128` and rank > 1. -* `b`: `Tensor` with same type and rank as `a`. -* `transpose_a`: If `True`, `a` is transposed before multiplication. -* `transpose_b`: If `True`, `b` is transposed before multiplication. -* `adjoint_a`: If `True`, `a` is conjugated and transposed before - multiplication. -* `adjoint_b`: If `True`, `b` is conjugated and transposed before - multiplication. -* `a_is_sparse`: If `True`, `a` is treated as a sparse matrix. -* `b_is_sparse`: If `True`, `b` is treated as a sparse matrix. -* `name`: Name for the operation (optional). - -##### Returns: - - A `Tensor` of the same type as `a` and `b` where each inner-most matrix is - the product of the corresponding matrices in `a` and `b`, e.g. if all - transpose or adjoint attributes are `False`: - - `output`[..., i, j] = sum_k (`a`[..., i, k] * `b`[..., k, j]), - for all indices i, j. - - -* `Note`: This is matrix product, not element-wise product. - - -##### Raises: - - -* `ValueError`: If transpose_a and adjoint_a, or transpose_b and adjoint_b - are both set to True. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.minimum.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.minimum.md deleted file mode 100644 index 9bcd03f6e7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.minimum.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.minimum(x, y, name=None)` {#minimum} - -Returns the min of x and y (i.e. x < y ? x : y) element-wise. - -*NOTE*: `Minimum` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.conv3d_backprop_filter_v2.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.conv3d_backprop_filter_v2.md deleted file mode 100644 index 1a48a6f0e0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.conv3d_backprop_filter_v2.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.nn.conv3d_backprop_filter_v2(input, filter_sizes, out_backprop, strides, padding, name=None)` {#conv3d_backprop_filter_v2} - -Computes the gradients of 3-D convolution with respect to the filter. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Shape `[batch, depth, rows, cols, in_channels]`. -* `filter_sizes`: A `Tensor` of type `int32`. - An integer vector representing the tensor shape of `filter`, - where `filter` is a 5-D - `[filter_depth, filter_height, filter_width, in_channels, out_channels]` - tensor. -* `out_backprop`: A `Tensor`. Must have the same type as `input`. - Backprop signal of shape `[batch, out_depth, out_rows, out_cols, - out_channels]`. -* `strides`: A list of `ints` that has length `>= 5`. - 1-D tensor of length 5. The stride of the sliding window for each - dimension of `input`. Must have `strides[0] = strides[4] = 1`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.depthwise_conv2d_native_backprop_input.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.depthwise_conv2d_native_backprop_input.md deleted file mode 100644 index 26023f5f65..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.depthwise_conv2d_native_backprop_input.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.nn.depthwise_conv2d_native_backprop_input(input_sizes, filter, out_backprop, strides, padding, name=None)` {#depthwise_conv2d_native_backprop_input} - -Computes the gradients of depthwise convolution with respect to the input. - -##### Args: - - -* `input_sizes`: A `Tensor` of type `int32`. - An integer vector representing the shape of `input`, - where `input` is a 4-D `[batch, height, width, channels]` tensor. -* `filter`: A `Tensor`. Must be one of the following types: `float32`, `float64`. - 4-D with shape - `[filter_height, filter_width, in_channels, depthwise_multiplier]`. -* `out_backprop`: A `Tensor`. Must have the same type as `filter`. - 4-D with shape `[batch, out_height, out_width, out_channels]`. - Gradients w.r.t. the output of the convolution. -* `strides`: A list of `ints`. - The stride of the sliding window for each dimension of the input - of the convolution. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `filter`. - 4-D with shape `[batch, in_height, in_width, in_channels]`. Gradient - w.r.t. the input of the convolution. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.embedding_lookup.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.embedding_lookup.md deleted file mode 100644 index a58bd7f728..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.embedding_lookup.md +++ /dev/null @@ -1,56 +0,0 @@ -### `tf.nn.embedding_lookup(params, ids, partition_strategy='mod', name=None, validate_indices=True, max_norm=None)` {#embedding_lookup} - -Looks up `ids` in a list of embedding tensors. - -This function is used to perform parallel lookups on the list of -tensors in `params`. It is a generalization of -[`tf.gather()`](../../api_docs/python/array_ops.md#gather), where `params` is -interpreted as a partitioning of a large embedding tensor. `params` may be -a `PartitionedVariable` as returned by using `tf.get_variable()` with a -partitioner. - -If `len(params) > 1`, each element `id` of `ids` is partitioned between -the elements of `params` according to the `partition_strategy`. -In all strategies, if the id space does not evenly divide the number of -partitions, each of the first `(max_id + 1) % len(params)` partitions will -be assigned one more id. - -If `partition_strategy` is `"mod"`, we assign each id to partition -`p = id % len(params)`. For instance, -13 ids are split across 5 partitions as: -`[[0, 5, 10], [1, 6, 11], [2, 7, 12], [3, 8], [4, 9]]` - -If `partition_strategy` is `"div"`, we assign ids to partitions in a -contiguous manner. In this case, 13 ids are split across 5 partitions as: -`[[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10], [11, 12]]` - -The results of the lookup are concatenated into a dense -tensor. The returned tensor has shape `shape(ids) + shape(params)[1:]`. - -##### Args: - - -* `params`: A single tensor representing the complete embedding tensor, - or a list of P tensors all of same shape except for the first dimension, - representing sharded embedding tensors. Alternatively, a - `PartitionedVariable`, created by partitioning along dimension 0. Each - element must be appropriately sized for the given `partition_strategy`. -* `ids`: A `Tensor` with type `int32` or `int64` containing the ids to be looked - up in `params`. -* `partition_strategy`: A string specifying the partitioning strategy, relevant - if `len(params) > 1`. Currently `"div"` and `"mod"` are supported. Default - is `"mod"`. -* `name`: A name for the operation (optional). -* `validate_indices`: Whether or not to validate gather indices. -* `max_norm`: If not None, embedding values are l2-normalized to the value of - max_norm. - -##### Returns: - - A `Tensor` with the same type as the tensors in `params`. - -##### Raises: - - -* `ValueError`: If `params` is empty. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.log_uniform_candidate_sampler.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.log_uniform_candidate_sampler.md deleted file mode 100644 index baf9f9d421..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.log_uniform_candidate_sampler.md +++ /dev/null @@ -1,56 +0,0 @@ -### `tf.nn.log_uniform_candidate_sampler(true_classes, num_true, num_sampled, unique, range_max, seed=None, name=None)` {#log_uniform_candidate_sampler} - -Samples a set of classes using a log-uniform (Zipfian) base distribution. - -This operation randomly samples a tensor of sampled classes -(`sampled_candidates`) from the range of integers `[0, range_max)`. - -The elements of `sampled_candidates` are drawn without replacement -(if `unique=True`) or with replacement (if `unique=False`) from -the base distribution. - -The base distribution for this operation is an approximately log-uniform -or Zipfian distribution: - -`P(class) = (log(class + 2) - log(class + 1)) / log(range_max + 1)` - -This sampler is useful when the target classes approximately follow such -a distribution - for example, if the classes represent words in a lexicon -sorted in decreasing order of frequency. If your classes are not ordered by -decreasing frequency, do not use this op. - -In addition, this operation returns tensors `true_expected_count` -and `sampled_expected_count` representing the number of times each -of the target classes (`true_classes`) and the sampled -classes (`sampled_candidates`) is expected to occur in an average -tensor of sampled classes. These values correspond to `Q(y|x)` -defined in [this -document](http://www.tensorflow.org/extras/candidate_sampling.pdf). -If `unique=True`, then these are post-rejection probabilities and we -compute them approximately. - -##### Args: - - -* `true_classes`: A `Tensor` of type `int64` and shape `[batch_size, - num_true]`. The target classes. -* `num_true`: An `int`. The number of target classes per training example. -* `num_sampled`: An `int`. The number of classes to randomly sample per batch. -* `unique`: A `bool`. Determines whether all sampled classes in a batch are - unique. -* `range_max`: An `int`. The number of possible classes. -* `seed`: An `int`. An operation-specific seed. Default is 0. -* `name`: A name for the operation (optional). - -##### Returns: - - -* `sampled_candidates`: A tensor of type `int64` and shape `[num_sampled]`. - The sampled classes. -* `true_expected_count`: A tensor of type `float`. Same shape as - `true_classes`. The expected counts under the sampling distribution - of each of `true_classes`. -* `sampled_expected_count`: A tensor of type `float`. Same shape as - `sampled_candidates`. The expected counts under the sampling distribution - of each of `sampled_candidates`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.relu.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.relu.md deleted file mode 100644 index 5811a1da96..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.nn.relu.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.nn.relu(features, name=None)` {#relu} - -Computes rectified linear: `max(features, 0)`. - -##### Args: - - -* `features`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `features`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.parallel_stack.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.parallel_stack.md deleted file mode 100644 index a9df823110..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.parallel_stack.md +++ /dev/null @@ -1,41 +0,0 @@ -### `tf.parallel_stack(values, name='parallel_stack')` {#parallel_stack} - -Stacks a list of rank-`R` tensors into one rank-`(R+1)` tensor in parallel. - -Requires that the shape of inputs be known at graph construction time. - -Packs the list of tensors in `values` into a tensor with rank one higher than -each tensor in `values`, by packing them along the first dimension. -Given a list of length `N` of tensors of shape `(A, B, C)`; the `output` -tensor will have the shape `(N, A, B, C)`. - -For example: - -```prettyprint -# 'x' is [1, 4] -# 'y' is [2, 5] -# 'z' is [3, 6] -parallel_stack([x, y, z]) => [[1, 4], [2, 5], [3, 6]] -``` - -The difference between stack and parallel_stack is that stack requires all -of the inputs be computed before the operation will begin but doesn't require -that the input shapes be known during graph construction. Parallel stack -will copy pieces of the input into the output as they become available, in -some situations this can provide a performance benefit. - -This is the opposite of unstack. The numpy equivalent is - - tf.parallel_stack([x, y, z]) = np.asarray([x, y, z]) - -##### Args: - - -* `values`: A list of `Tensor` objects with the same shape and type. -* `name`: A name for this operation (optional). - -##### Returns: - - -* `output`: A stacked `Tensor` with the same type as `values`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.random_uniform.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.random_uniform.md deleted file mode 100644 index 517bdd98c4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.random_uniform.md +++ /dev/null @@ -1,41 +0,0 @@ -### `tf.random_uniform(shape, minval=0, maxval=None, dtype=tf.float32, seed=None, name=None)` {#random_uniform} - -Outputs random values from a uniform distribution. - -The generated values follow a uniform distribution in the range -`[minval, maxval)`. The lower bound `minval` is included in the range, while -the upper bound `maxval` is excluded. - -For floats, the default range is `[0, 1)`. For ints, at least `maxval` must -be specified explicitly. - -In the integer case, the random integers are slightly biased unless -`maxval - minval` is an exact power of two. The bias is small for values of -`maxval - minval` significantly smaller than the range of the output (either -`2**32` or `2**64`). - -##### Args: - - -* `shape`: A 1-D integer Tensor or Python array. The shape of the output tensor. -* `minval`: A 0-D Tensor or Python value of type `dtype`. The lower bound on the - range of random values to generate. Defaults to 0. -* `maxval`: A 0-D Tensor or Python value of type `dtype`. The upper bound on - the range of random values to generate. Defaults to 1 if `dtype` is - floating point. -* `dtype`: The type of the output: `float32`, `float64`, `int32`, or `int64`. -* `seed`: A Python integer. Used to create a random seed for the distribution. - See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: A name for the operation (optional). - -##### Returns: - - A tensor of the specified shape filled with random uniform values. - -##### Raises: - - -* `ValueError`: If `dtype` is integral and `maxval` is not specified. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.real.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.real.md deleted file mode 100644 index 00ebad2676..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.real.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.real(input, name=None)` {#real} - -Returns the real part of a complex number. - -Given a tensor `input` of complex numbers, this operation returns a tensor of -type `float32` or `float64` that is the real part of each element in `input`. -All elements in `input` must be complex numbers of the form \\(a + bj\\), -where *a* is the real part returned by this operation and *b* is the -imaginary part. - -For example: - -``` -# tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j] -tf.real(input) ==> [-2.25, 3.25] -``` - -If `input` is already real, it is returned unchanged. - -##### Args: - - -* `input`: A `Tensor`. Must have numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32` or `float64`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.report_uninitialized_variables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.report_uninitialized_variables.md deleted file mode 100644 index e3ecdf7733..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.report_uninitialized_variables.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.report_uninitialized_variables(var_list=None, name='report_uninitialized_variables')` {#report_uninitialized_variables} - -Adds ops to list the names of uninitialized variables. - -When run, it returns a 1-D tensor containing the names of uninitialized -variables if there are any, or an empty array if there are none. - -##### Args: - - -* `var_list`: List of `Variable` objects to check. Defaults to the - value of `global_variables() + local_variables()` -* `name`: Optional name of the `Operation`. - -##### Returns: - - A 1-D tensor containing names of the uninitialized variables, or an empty - 1-D tensor if there are no variables or no uninitialized variables. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.required_space_to_batch_paddings.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.required_space_to_batch_paddings.md deleted file mode 100644 index ac3bd931fb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.required_space_to_batch_paddings.md +++ /dev/null @@ -1,35 +0,0 @@ -### `tf.required_space_to_batch_paddings(input_shape, block_shape, base_paddings=None, name=None)` {#required_space_to_batch_paddings} - -Calculate padding required to make block_shape divide input_shape. - -This function can be used to calculate a suitable paddings argument for use -with space_to_batch_nd and batch_to_space_nd. - -##### Args: - - -* `input_shape`: int32 Tensor of shape [N]. -* `block_shape`: int32 Tensor of shape [N]. -* `base_paddings`: Optional int32 Tensor of shape [N, 2]. Specifies the minimum - amount of padding to use. All elements must be >= 0. If not specified, - defaults to 0. -* `name`: string. Optional name prefix. - -##### Returns: - - (paddings, crops), where: - - `paddings` and `crops` are int32 Tensors of rank 2 and shape [N, 2] - -* `satisfying`: - - paddings[i, 0] = base_paddings[i, 0]. - 0 <= paddings[i, 1] - base_paddings[i, 1] < block_shape[i] - (input_shape[i] + paddings[i, 0] + paddings[i, 1]) % block_shape[i] == 0 - - crops[i, 0] = 0 - crops[i, 1] = paddings[i, 1] - base_paddings[i, 1] - - -* `Raises`: ValueError if called with incompatible shapes. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.scatter_nd_sub.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.scatter_nd_sub.md deleted file mode 100644 index 1d16c8e06c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.scatter_nd_sub.md +++ /dev/null @@ -1,61 +0,0 @@ -### `tf.scatter_nd_sub(ref, indices, updates, use_locking=None, name=None)` {#scatter_nd_sub} - -Applies sparse subtraction between `updates` and individual values or slices - -within a given variable according to `indices`. - -`ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. - -`indices` must be integer tensor, containing indices into `ref`. -It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. - -The innermost dimension of `indices` (with length `K`) corresponds to -indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th -dimension of `ref`. - -`updates` is `Tensor` of rank `Q-1+P-K` with shape: - -``` -[d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]]. -``` - -For example, say we want to subtract 4 scattered elements from a rank-1 tensor -with 8 elements. In Python, that subtraction would look like this: - - ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8]) - indices = tf.constant([[4], [3], [1], [7]]) - updates = tf.constant([9, 10, 11, 12]) - sub = tf.scatter_nd_sub(ref, indices, updates) - with tf.Session() as sess: - print sess.run(sub) - -The resulting update to ref would look like this: - - [1, -9, 3, -6, -4, 6, 7, -4] - -See [tf.scatter_nd](#scatter_nd) for more details about how to make updates to -slices. - -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - A mutable Tensor. Should be from a Variable node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A Tensor. Must be one of the following types: int32, int64. - A tensor of indices into ref. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A Tensor. Must have the same type as ref. A tensor of updated values - to subtract from ref. -* `use_locking`: An optional `bool`. Defaults to `False`. - An optional bool. Defaults to True. If True, the assignment will - be protected by a lock; otherwise the behavior is undefined, - but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - A mutable `Tensor`. Has the same type as `ref`. - Same as ref. Returned as a convenience for operations that want - to use the updated values after the update is done. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.scatter_update.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.scatter_update.md deleted file mode 100644 index 880b740b16..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.scatter_update.md +++ /dev/null @@ -1,46 +0,0 @@ -### `tf.scatter_update(ref, indices, updates, use_locking=None, name=None)` {#scatter_update} - -Applies sparse updates to a variable reference. - -This operation computes - - # Scalar indices - ref[indices, ...] = updates[...] - - # Vector indices (for each i) - ref[indices[i], ...] = updates[i, ...] - - # High rank indices (for each i, ..., j) - ref[indices[i, ..., j], ...] = updates[i, ..., j, ...] - -This operation outputs `ref` after the update is done. -This makes it easier to chain operations that need to use the reset value. - -If values in `ref` is to be updated more than once, because there are -duplicate entries in `indices`, the order at which the updates happen -for each value is undefined. - -Requires `updates.shape = indices.shape + ref.shape[1:]`. - -
- -
- -##### Args: - - -* `ref`: A mutable `Tensor`. Should be from a `Variable` node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A tensor of indices into the first dimension of `ref`. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A tensor of updated values to store in `ref`. -* `use_locking`: An optional `bool`. Defaults to `True`. - If True, the assignment will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as `ref`. Returned as a convenience for operations that want - to use the updated values after the update is done. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.setdiff1d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.setdiff1d.md deleted file mode 100644 index 3bd95f13c5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.setdiff1d.md +++ /dev/null @@ -1,41 +0,0 @@ -### `tf.setdiff1d(x, y, index_dtype=tf.int32, name=None)` {#setdiff1d} - -Computes the difference between two lists of numbers or strings. - -Given a list `x` and a list `y`, this operation returns a list `out` that -represents all values that are in `x` but not in `y`. The returned list `out` -is sorted in the same order that the numbers appear in `x` (duplicates are -preserved). This operation also returns a list `idx` that represents the -position of each `out` element in `x`. In other words: - -`out[i] = x[idx[i]] for i in [0, 1, ..., len(out) - 1]` - -For example, given this input: - -```prettyprint -x = [1, 2, 3, 4, 5, 6] -y = [1, 3, 5] -``` - -This operation would return: - -```prettyprint -out ==> [2, 4, 6] -idx ==> [1, 3, 5] -``` - -##### Args: - - -* `x`: A `Tensor`. 1-D. Values to keep. -* `y`: A `Tensor`. Must have the same type as `x`. 1-D. Values to remove. -* `out_idx`: An optional `tf.DType` from: `tf.int32, tf.int64`. Defaults to `tf.int32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (out, idx). - -* `out`: A `Tensor`. Has the same type as `x`. 1-D. Values present in `x` but not in `y`. -* `idx`: A `Tensor` of type `out_idx`. 1-D. Positions of `x` values preserved in `out`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.shape_n.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.shape_n.md deleted file mode 100644 index 5a5eca2762..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.shape_n.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.shape_n(input, out_type=None, name=None)` {#shape_n} - -Returns shape of tensors. - -This operation returns N 1-D integer tensors representing shape of `input[i]s`. - -##### Args: - - -* `input`: A list of at least 1 `Tensor` objects of the same type. -* `out_type`: An optional `tf.DType` from: `tf.int32, tf.int64`. Defaults to `tf.int32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A list with the same number of `Tensor` objects as `input` of `Tensor` objects of type out_type. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.sin.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.sin.md deleted file mode 100644 index f69c58bee0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.sin.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.sin(x, name=None)` {#sin} - -Computes sin of x element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.space_to_batch_nd.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.space_to_batch_nd.md deleted file mode 100644 index 7ab9e70475..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.space_to_batch_nd.md +++ /dev/null @@ -1,137 +0,0 @@ -### `tf.space_to_batch_nd(input, block_shape, paddings, name=None)` {#space_to_batch_nd} - -SpaceToBatch for N-D tensors of type T. - -This operation divides "spatial" dimensions `[1, ..., M]` of the input into a -grid of blocks of shape `block_shape`, and interleaves these blocks with the -"batch" dimension (0) such that in the output, the spatial dimensions -`[1, ..., M]` correspond to the position within the grid, and the batch -dimension combines both the position within a spatial block and the original -batch position. Prior to division into blocks, the spatial dimensions of the -input are optionally zero padded according to `paddings`. See below for a -precise description. - -##### Args: - - -* `input`: A `Tensor`. - N-D with shape `input_shape = [batch] + spatial_shape + remaining_shape`, - where spatial_shape has `M` dimensions. -* `block_shape`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 1-D with shape `[M]`, all values must be >= 1. -* `paddings`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 2-D with shape `[M, 2]`, all values must be >= 0. - `paddings[i] = [pad_start, pad_end]` specifies the padding for input dimension - `i + 1`, which corresponds to spatial dimension `i`. It is required that - `block_shape[i]` divides `input_shape[i + 1] + pad_start + pad_end`. - - This operation is equivalent to the following steps: - - 1. Zero-pad the start and end of dimensions `[1, ..., M]` of the - input according to `paddings` to produce `padded` of shape `padded_shape`. - - 2. Reshape `padded` to `reshaped_padded` of shape: - - [batch] + - [padded_shape[1] / block_shape[0], - block_shape[0], - ..., - padded_shape[M] / block_shape[M-1], - block_shape[M-1]] + - remaining_shape - - 3. Permute dimensions of `reshaped_padded` to produce - `permuted_reshaped_padded` of shape: - - block_shape + - [batch] + - [padded_shape[1] / block_shape[0], - ..., - padded_shape[M] / block_shape[M-1]] + - remaining_shape - - 4. Reshape `permuted_reshaped_padded` to flatten `block_shape` into the batch - dimension, producing an output tensor of shape: - - [batch * prod(block_shape)] + - [padded_shape[1] / block_shape[0], - ..., - padded_shape[M] / block_shape[M-1]] + - remaining_shape - - Some examples: - - (1) For the following input of shape `[1, 2, 2, 1]`, `block_shape = [2, 2]`, and - `paddings = [[0, 0], [0, 0]]`: - - ```prettyprint - x = [[[[1], [2]], [[3], [4]]]] - ``` - - The output tensor has shape `[4, 1, 1, 1]` and value: - - ```prettyprint - [[[[1]]], [[[2]]], [[[3]]], [[[4]]]] - ``` - - (2) For the following input of shape `[1, 2, 2, 3]`, `block_shape = [2, 2]`, and - `paddings = [[0, 0], [0, 0]]`: - - ```prettyprint - x = [[[[1, 2, 3], [4, 5, 6]], - [[7, 8, 9], [10, 11, 12]]]] - ``` - - The output tensor has shape `[4, 1, 1, 3]` and value: - - ```prettyprint - [[[1, 2, 3]], [[4, 5, 6]], [[7, 8, 9]], [[10, 11, 12]]] - ``` - - (3) For the following input of shape `[1, 4, 4, 1]`, `block_shape = [2, 2]`, and - `paddings = [[0, 0], [0, 0]]`: - - ```prettyprint - x = [[[[1], [2], [3], [4]], - [[5], [6], [7], [8]], - [[9], [10], [11], [12]], - [[13], [14], [15], [16]]]] - ``` - - The output tensor has shape `[4, 2, 2, 1]` and value: - - ```prettyprint - x = [[[[1], [3]], [[9], [11]]], - [[[2], [4]], [[10], [12]]], - [[[5], [7]], [[13], [15]]], - [[[6], [8]], [[14], [16]]]] - ``` - - (4) For the following input of shape `[2, 2, 4, 1]`, block_shape = `[2, 2]`, and - paddings = `[[0, 0], [2, 0]]`: - - ```prettyprint - x = [[[[1], [2], [3], [4]], - [[5], [6], [7], [8]]], - [[[9], [10], [11], [12]], - [[13], [14], [15], [16]]]] - ``` - - The output tensor has shape `[8, 1, 3, 1]` and value: - - ```prettyprint - x = [[[[0], [1], [3]]], [[[0], [9], [11]]], - [[[0], [2], [4]]], [[[0], [10], [12]]], - [[[0], [5], [7]]], [[[0], [13], [15]]], - [[[0], [6], [8]]], [[[0], [14], [16]]]] - ``` - - Among others, this operation is useful for reducing atrous convolution into - regular convolution. - -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.sparse_placeholder.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.sparse_placeholder.md deleted file mode 100644 index c1fa1d12e6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.sparse_placeholder.md +++ /dev/null @@ -1,43 +0,0 @@ -### `tf.sparse_placeholder(dtype, shape=None, name=None)` {#sparse_placeholder} - -Inserts a placeholder for a sparse tensor that will be always fed. - -**Important**: This sparse tensor will produce an error if evaluated. -Its value must be fed using the `feed_dict` optional argument to -`Session.run()`, `Tensor.eval()`, or `Operation.run()`. - -For example: - -```python -x = tf.sparse_placeholder(tf.float32) -y = tf.sparse_reduce_sum(x) - -with tf.Session() as sess: - print(sess.run(y)) # ERROR: will fail because x was not fed. - - indices = np.array([[3, 2, 0], [4, 5, 1]], dtype=np.int64) - values = np.array([1.0, 2.0], dtype=np.float32) - shape = np.array([7, 9, 2], dtype=np.int64) - print(sess.run(y, feed_dict={ - x: tf.SparseTensorValue(indices, values, shape)})) # Will succeed. - print(sess.run(y, feed_dict={ - x: (indices, values, shape)})) # Will succeed. - - sp = tf.SparseTensor(indices=indices, values=values, dense_shape=shape) - sp_value = sp.eval(session) - print(sess.run(y, feed_dict={x: sp_value})) # Will succeed. -``` - -##### Args: - - -* `dtype`: The type of `values` elements in the tensor to be fed. -* `shape`: The shape of the tensor to be fed (optional). If the shape is not - specified, you can feed a sparse tensor of any shape. -* `name`: A name for prefixing the operations (optional). - -##### Returns: - - A `SparseTensor` that may be used as a handle for feeding a value, but not - evaluated directly. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.split.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.split.md deleted file mode 100644 index 06c6461b83..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.split.md +++ /dev/null @@ -1,53 +0,0 @@ -### `tf.split(value, num_or_size_splits, axis=0, num=None, name='split')` {#split} - -Splits a tensor into sub tensors. - -If `num_or_size_splits` is a scalar, `num_split`, then splits `value` along -dimension `axis` into `num_split` smaller tensors. -Requires that `num_split` evenly divides `value.shape[axis]`. - -If `num_or_size_splits` is a tensor, `size_splits`, then splits `value` into -`len(size_splits)` pieces. The shape of the `i`-th piece has the same size as -the `value` except along dimension `axis` where the size is `size_splits[i]`. - -For example: - -```python -# 'value' is a tensor with shape [5, 30] -# Split 'value' into 3 tensors with sizes [4, 15, 11] along dimension 1 -split0, split1, split2 = tf.split(value, [4, 15, 11], 1) -tf.shape(split0) ==> [5, 4] -tf.shape(split1) ==> [5, 15] -tf.shape(split2) ==> [5, 11] -# Split 'value' into 3 tensors along dimension 1 -split0, split1, split2 = tf.split(value, num_or_size_splits=3, axis=1) -tf.shape(split0) ==> [5, 10] -``` - -##### Args: - - -* `value`: The `Tensor` to split. -* `num_or_size_splits`: Either an integer indicating the number of splits along - split_dim or a 1-D Tensor containing the sizes of each output tensor - along split_dim. If an integer then it must evenly divide - `value.shape[axis]`; otherwise the sum of sizes along the split - dimension must match that of the `value`. -* `axis`: A 0-D `int32` `Tensor`. The dimension along which to split. - Must be in the range `[0, rank(value))`. Defaults to 0. -* `num`: Optional, used to specify the number of outputs when it cannot be - inferred from the shape of `size_splits`. -* `name`: A name for the operation (optional). - -##### Returns: - - if `num_or_size_splits` is a scalar returns `num_or_size_splits` `Tensor` - objects; if `num_or_size_splits` is a 1-D Tensor returns - `num_or_size_splits.get_shape[0]` `Tensor` objects resulting from splitting - `value`. - -##### Raises: - - -* `ValueError`: If `num` is unspecified and cannot be inferred. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.squeeze.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.squeeze.md deleted file mode 100644 index 90a1b9af82..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.squeeze.md +++ /dev/null @@ -1,44 +0,0 @@ -### `tf.squeeze(input, axis=None, name=None, squeeze_dims=None)` {#squeeze} - -Removes dimensions of size 1 from the shape of a tensor. - -Given a tensor `input`, this operation returns a tensor of the same type with -all dimensions of size 1 removed. If you don't want to remove all size 1 -dimensions, you can remove specific size 1 dimensions by specifying -`axis`. - -For example: - -```prettyprint -# 't' is a tensor of shape [1, 2, 1, 3, 1, 1] -shape(squeeze(t)) ==> [2, 3] -``` - -Or, to remove specific size 1 dimensions: - -```prettyprint -# 't' is a tensor of shape [1, 2, 1, 3, 1, 1] -shape(squeeze(t, [2, 4])) ==> [1, 2, 3, 1] -``` - -##### Args: - - -* `input`: A `Tensor`. The `input` to squeeze. -* `axis`: An optional list of `ints`. Defaults to `[]`. - If specified, only squeezes the dimensions listed. The dimension - index starts at 0. It is an error to squeeze a dimension that is not 1. -* `name`: A name for the operation (optional). -* `squeeze_dims`: Deprecated keyword argument that is now axis. - -##### Returns: - - A `Tensor`. Has the same type as `input`. - Contains the same data as `input`, but has one or more dimensions of - size 1 removed. - -##### Raises: - - -* `ValueError`: When both `squeeze_dims` and `axis` are specified. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.string_split.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.string_split.md deleted file mode 100644 index 08ccc5f104..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.string_split.md +++ /dev/null @@ -1,43 +0,0 @@ -### `tf.string_split(source, delimiter=' ')` {#string_split} - -Split elements of `source` based on `delimiter` into a `SparseTensor`. - -Let N be the size of source (typically N will be the batch size). Split each -element of `source` based on `delimiter` and return a `SparseTensor` -containing the splitted tokens. Empty tokens are ignored. - -If `delimiter` is an empty string, each element of the `source` is split -into individual strings, each containing one byte. (This includes splitting -multibyte sequences of UTF-8.) If delimiter contains multiple bytes, it is -treated as a set of delimiters with each considered a potential split point. - -For example: -N = 2, source[0] is 'hello world' and source[1] is 'a b c', then the output -will be - -st.indices = [0, 0; - 0, 1; - 1, 0; - 1, 1; - 1, 2] -st.shape = [2, 3] -st.values = ['hello', 'world', 'a', 'b', 'c'] - -##### Args: - - -* `source`: `1-D` string `Tensor`, the strings to split. -* `delimiter`: `0-D` string `Tensor`, the delimiter character, the string should - be length 0 or 1. - -##### Raises: - - -* `ValueError`: If delimiter is not a string. - -##### Returns: - - A `SparseTensor` of rank `2`, the strings split according to the delimiter. - The first column of the indices corresponds to the row in `source` and the - second column corresponds to the index of the split component in this row. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.summary.SummaryDescription.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.summary.SummaryDescription.md deleted file mode 100644 index bce704ef4f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.summary.SummaryDescription.md +++ /dev/null @@ -1,245 +0,0 @@ - -- - - - -#### `tf.summary.SummaryDescription.ByteSize()` {#SummaryDescription.ByteSize} - - - - -- - - - -#### `tf.summary.SummaryDescription.Clear()` {#SummaryDescription.Clear} - - - - -- - - - -#### `tf.summary.SummaryDescription.ClearExtension(extension_handle)` {#SummaryDescription.ClearExtension} - - - - -- - - - -#### `tf.summary.SummaryDescription.ClearField(field_name)` {#SummaryDescription.ClearField} - - - - -- - - - -#### `tf.summary.SummaryDescription.CopyFrom(other_msg)` {#SummaryDescription.CopyFrom} - -Copies the content of the specified message into the current message. - -The method clears the current message and then merges the specified -message using MergeFrom. - -##### Args: - - -* `other_msg`: Message to copy into the current one. - - -- - - - -#### `tf.summary.SummaryDescription.DiscardUnknownFields()` {#SummaryDescription.DiscardUnknownFields} - - - - -- - - - -#### `tf.summary.SummaryDescription.FindInitializationErrors()` {#SummaryDescription.FindInitializationErrors} - -Finds required fields which are not initialized. - -##### Returns: - - A list of strings. Each string is a path to an uninitialized field from - the top-level message, e.g. "foo.bar[5].baz". - - -- - - - -#### `tf.summary.SummaryDescription.FromString(s)` {#SummaryDescription.FromString} - - - - -- - - - -#### `tf.summary.SummaryDescription.HasExtension(extension_handle)` {#SummaryDescription.HasExtension} - - - - -- - - - -#### `tf.summary.SummaryDescription.HasField(field_name)` {#SummaryDescription.HasField} - - - - -- - - - -#### `tf.summary.SummaryDescription.IsInitialized(errors=None)` {#SummaryDescription.IsInitialized} - -Checks if all required fields of a message are set. - -##### Args: - - -* `errors`: A list which, if provided, will be populated with the field - paths of all missing required fields. - -##### Returns: - - True iff the specified message has all required fields set. - - -- - - - -#### `tf.summary.SummaryDescription.ListFields()` {#SummaryDescription.ListFields} - - - - -- - - - -#### `tf.summary.SummaryDescription.MergeFrom(msg)` {#SummaryDescription.MergeFrom} - - - - -- - - - -#### `tf.summary.SummaryDescription.MergeFromString(serialized)` {#SummaryDescription.MergeFromString} - - - - -- - - - -#### `tf.summary.SummaryDescription.ParseFromString(serialized)` {#SummaryDescription.ParseFromString} - -Parse serialized protocol buffer data into this message. - -Like MergeFromString(), except we clear the object first and -do not return the value that MergeFromString returns. - - -- - - - -#### `tf.summary.SummaryDescription.RegisterExtension(extension_handle)` {#SummaryDescription.RegisterExtension} - - - - -- - - - -#### `tf.summary.SummaryDescription.SerializePartialToString()` {#SummaryDescription.SerializePartialToString} - - - - -- - - - -#### `tf.summary.SummaryDescription.SerializeToString()` {#SummaryDescription.SerializeToString} - - - - -- - - - -#### `tf.summary.SummaryDescription.SetInParent()` {#SummaryDescription.SetInParent} - -Sets the _cached_byte_size_dirty bit to true, -and propagates this to our listener iff this was a state change. - - -- - - - -#### `tf.summary.SummaryDescription.WhichOneof(oneof_name)` {#SummaryDescription.WhichOneof} - -Returns the name of the currently set field inside a oneof, or None. - - -- - - - -#### `tf.summary.SummaryDescription.__deepcopy__(memo=None)` {#SummaryDescription.__deepcopy__} - - - - -- - - - -#### `tf.summary.SummaryDescription.__eq__(other)` {#SummaryDescription.__eq__} - - - - -- - - - -#### `tf.summary.SummaryDescription.__getstate__()` {#SummaryDescription.__getstate__} - -Support the pickle protocol. - - -- - - - -#### `tf.summary.SummaryDescription.__hash__()` {#SummaryDescription.__hash__} - - - - -- - - - -#### `tf.summary.SummaryDescription.__init__(**kwargs)` {#SummaryDescription.__init__} - - - - -- - - - -#### `tf.summary.SummaryDescription.__ne__(other_msg)` {#SummaryDescription.__ne__} - - - - -- - - - -#### `tf.summary.SummaryDescription.__repr__()` {#SummaryDescription.__repr__} - - - - -- - - - -#### `tf.summary.SummaryDescription.__setstate__(state)` {#SummaryDescription.__setstate__} - -Support the pickle protocol. - - -- - - - -#### `tf.summary.SummaryDescription.__str__()` {#SummaryDescription.__str__} - - - - -- - - - -#### `tf.summary.SummaryDescription.__unicode__()` {#SummaryDescription.__unicode__} - - - - -- - - - -#### `tf.summary.SummaryDescription.type_hint` {#SummaryDescription.type_hint} - -Magic attribute generated for "type_hint" proto field. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.summary.audio.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.summary.audio.md deleted file mode 100644 index c7edb74291..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.summary.audio.md +++ /dev/null @@ -1,35 +0,0 @@ -### `tf.summary.audio(name, tensor, sample_rate, max_outputs=3, collections=None)` {#audio} - -Outputs a `Summary` protocol buffer with audio. - -The summary has up to `max_outputs` summary values containing audio. The -audio is built from `tensor` which must be 3-D with shape `[batch_size, -frames, channels]` or 2-D with shape `[batch_size, frames]`. The values are -assumed to be in the range of `[-1.0, 1.0]` with a sample rate of -`sample_rate`. - -The `tag` in the outputted Summary.Value protobufs is generated based on the -name, with a suffix depending on the max_outputs setting: - -* If `max_outputs` is 1, the summary value tag is '*name*/audio'. -* If `max_outputs` is greater than 1, the summary value tags are - generated sequentially as '*name*/audio/0', '*name*/audio/1', etc - -##### Args: - - -* `name`: A name for the generated node. Will also serve as a series name in - TensorBoard. -* `tensor`: A 3-D `float32` `Tensor` of shape `[batch_size, frames, channels]` - or a 2-D `float32` `Tensor` of shape `[batch_size, frames]`. -* `sample_rate`: A Scalar `float32` `Tensor` indicating the sample rate of the - signal in hertz. -* `max_outputs`: Max number of batch elements to generate audio for. -* `collections`: Optional list of ops.GraphKeys. The collections to add the - summary to. Defaults to [_ops.GraphKeys.SUMMARIES] - -##### Returns: - - A scalar `Tensor` of type `string`. The serialized `Summary` protocol - buffer. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.summary.tensor_summary.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.summary.tensor_summary.md deleted file mode 100644 index 3fb19c2601..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.summary.tensor_summary.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.summary.tensor_summary(name, tensor, summary_description=None, collections=None)` {#tensor_summary} - -Outputs a `Summary` protocol buffer with a serialized tensor.proto. - -The generated -[`Summary`](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto) -has one summary value containing the input tensor. - -##### Args: - - -* `name`: A name for the generated node. Will also serve as the series name in - TensorBoard. -* `tensor`: A tensor of any type and shape to serialize. -* `summary_description`: Optional summary_pb2.SummaryDescription() -* `collections`: Optional list of graph collections keys. The new summary op is - added to these collections. Defaults to `[GraphKeys.SUMMARIES]`. - -##### Returns: - - A scalar `Tensor` of type `string`. The serialized `Summary` protocol - buffer. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.tables_initializer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.tables_initializer.md deleted file mode 100644 index f278bd57e6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.tables_initializer.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.tables_initializer(name='init_all_tables')` {#tables_initializer} - -Returns an Op that initializes all tables of the default graph. - -##### Args: - - -* `name`: Optional name for the initialization op. - -##### Returns: - - An Op that initializes all tables. Note that if there are - not tables the returned Op is a NoOp. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.TestCase.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.TestCase.md deleted file mode 100644 index 0e63e0d708..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.TestCase.md +++ /dev/null @@ -1,875 +0,0 @@ -Base class for tests that need to test TensorFlow. -- - - - -#### `tf.test.TestCase.__call__(*args, **kwds)` {#TestCase.__call__} - - - - -- - - - -#### `tf.test.TestCase.__eq__(other)` {#TestCase.__eq__} - - - - -- - - - -#### `tf.test.TestCase.__hash__()` {#TestCase.__hash__} - - - - -- - - - -#### `tf.test.TestCase.__init__(methodName='runTest')` {#TestCase.__init__} - - - - -- - - - -#### `tf.test.TestCase.__ne__(other)` {#TestCase.__ne__} - - - - -- - - - -#### `tf.test.TestCase.__repr__()` {#TestCase.__repr__} - - - - -- - - - -#### `tf.test.TestCase.__str__()` {#TestCase.__str__} - - - - -- - - - -#### `tf.test.TestCase.addCleanup(function, *args, **kwargs)` {#TestCase.addCleanup} - -Add a function, with arguments, to be called when the test is -completed. Functions added are called on a LIFO basis and are -called after tearDown on test failure or success. - -Cleanup items are called even if setUp fails (unlike tearDown). - - -- - - - -#### `tf.test.TestCase.addTypeEqualityFunc(typeobj, function)` {#TestCase.addTypeEqualityFunc} - -Add a type specific assertEqual style function to compare a type. - -This method is for use by TestCase subclasses that need to register -their own type equality functions to provide nicer error messages. - -##### Args: - - -* `typeobj`: The data type to call this function on when both values - are of the same type in assertEqual(). -* `function`: The callable taking two arguments and an optional - msg= argument that raises self.failureException with a - useful error message when the two arguments are not equal. - - -- - - - -#### `tf.test.TestCase.assertAllClose(a, b, rtol=1e-06, atol=1e-06)` {#TestCase.assertAllClose} - -Asserts that two numpy arrays have near values. - -##### Args: - - -* `a`: a numpy ndarray or anything can be converted to one. -* `b`: a numpy ndarray or anything can be converted to one. -* `rtol`: relative tolerance -* `atol`: absolute tolerance - - -- - - - -#### `tf.test.TestCase.assertAllCloseAccordingToType(a, b, rtol=1e-06, atol=1e-06, float_rtol=1e-06, float_atol=1e-06, half_rtol=0.001, half_atol=0.001)` {#TestCase.assertAllCloseAccordingToType} - -Like assertAllClose, but also suitable for comparing fp16 arrays. - -In particular, the tolerance is reduced to 1e-3 if at least -one of the arguments is of type float16. - -##### Args: - - -* `a`: a numpy ndarray or anything can be converted to one. -* `b`: a numpy ndarray or anything can be converted to one. -* `rtol`: relative tolerance -* `atol`: absolute tolerance -* `float_rtol`: relative tolerance for float32 -* `float_atol`: absolute tolerance for float32 -* `half_rtol`: relative tolerance for float16 -* `half_atol`: absolute tolerance for float16 - - -- - - - -#### `tf.test.TestCase.assertAllEqual(a, b)` {#TestCase.assertAllEqual} - -Asserts that two numpy arrays have the same values. - -##### Args: - - -* `a`: a numpy ndarray or anything can be converted to one. -* `b`: a numpy ndarray or anything can be converted to one. - - -- - - - -#### `tf.test.TestCase.assertAlmostEqual(first, second, places=None, msg=None, delta=None)` {#TestCase.assertAlmostEqual} - -Fail if the two objects are unequal as determined by their -difference rounded to the given number of decimal places -(default 7) and comparing to zero, or by comparing that the -between the two objects is more than the given delta. - -Note that decimal places (from zero) are usually not the same -as significant digits (measured from the most signficant digit). - -If the two objects compare equal then they will automatically -compare almost equal. - - -- - - - -#### `tf.test.TestCase.assertAlmostEquals(first, second, places=None, msg=None, delta=None)` {#TestCase.assertAlmostEquals} - -Fail if the two objects are unequal as determined by their -difference rounded to the given number of decimal places -(default 7) and comparing to zero, or by comparing that the -between the two objects is more than the given delta. - -Note that decimal places (from zero) are usually not the same -as significant digits (measured from the most signficant digit). - -If the two objects compare equal then they will automatically -compare almost equal. - - -- - - - -#### `tf.test.TestCase.assertArrayNear(farray1, farray2, err)` {#TestCase.assertArrayNear} - -Asserts that two float arrays are near each other. - -Checks that for all elements of farray1 and farray2 -|f1 - f2| < err. Asserts a test failure if not. - -##### Args: - - -* `farray1`: a list of float values. -* `farray2`: a list of float values. -* `err`: a float value. - - -- - - - -#### `tf.test.TestCase.assertDeviceEqual(device1, device2)` {#TestCase.assertDeviceEqual} - -Asserts that the two given devices are the same. - -##### Args: - - -* `device1`: A string device name or TensorFlow `DeviceSpec` object. -* `device2`: A string device name or TensorFlow `DeviceSpec` object. - - -- - - - -#### `tf.test.TestCase.assertDictContainsSubset(expected, actual, msg=None)` {#TestCase.assertDictContainsSubset} - -Checks whether actual is a superset of expected. - - -- - - - -#### `tf.test.TestCase.assertDictEqual(d1, d2, msg=None)` {#TestCase.assertDictEqual} - - - - -- - - - -#### `tf.test.TestCase.assertEqual(first, second, msg=None)` {#TestCase.assertEqual} - -Fail if the two objects are unequal as determined by the '==' -operator. - - -- - - - -#### `tf.test.TestCase.assertEquals(first, second, msg=None)` {#TestCase.assertEquals} - -Fail if the two objects are unequal as determined by the '==' -operator. - - -- - - - -#### `tf.test.TestCase.assertFalse(expr, msg=None)` {#TestCase.assertFalse} - -Check that the expression is false. - - -- - - - -#### `tf.test.TestCase.assertGreater(a, b, msg=None)` {#TestCase.assertGreater} - -Just like self.assertTrue(a > b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertGreaterEqual(a, b, msg=None)` {#TestCase.assertGreaterEqual} - -Just like self.assertTrue(a >= b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertIn(member, container, msg=None)` {#TestCase.assertIn} - -Just like self.assertTrue(a in b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertIs(expr1, expr2, msg=None)` {#TestCase.assertIs} - -Just like self.assertTrue(a is b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertIsInstance(obj, cls, msg=None)` {#TestCase.assertIsInstance} - -Same as self.assertTrue(isinstance(obj, cls)), with a nicer -default message. - - -- - - - -#### `tf.test.TestCase.assertIsNone(obj, msg=None)` {#TestCase.assertIsNone} - -Same as self.assertTrue(obj is None), with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertIsNot(expr1, expr2, msg=None)` {#TestCase.assertIsNot} - -Just like self.assertTrue(a is not b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertIsNotNone(obj, msg=None)` {#TestCase.assertIsNotNone} - -Included for symmetry with assertIsNone. - - -- - - - -#### `tf.test.TestCase.assertItemsEqual(expected_seq, actual_seq, msg=None)` {#TestCase.assertItemsEqual} - -An unordered sequence specific comparison. It asserts that -actual_seq and expected_seq have the same element counts. -Equivalent to:: - - self.assertEqual(Counter(iter(actual_seq)), - Counter(iter(expected_seq))) - -Asserts that each element has the same count in both sequences. - -##### Example: - - - [0, 1, 1] and [1, 0, 1] compare equal. - - [0, 0, 1] and [0, 1] compare unequal. - - -- - - - -#### `tf.test.TestCase.assertLess(a, b, msg=None)` {#TestCase.assertLess} - -Just like self.assertTrue(a < b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertLessEqual(a, b, msg=None)` {#TestCase.assertLessEqual} - -Just like self.assertTrue(a <= b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertListEqual(list1, list2, msg=None)` {#TestCase.assertListEqual} - -A list-specific equality assertion. - -##### Args: - - -* `list1`: The first list to compare. -* `list2`: The second list to compare. -* `msg`: Optional message to use on failure instead of a list of - differences. - - -- - - - -#### `tf.test.TestCase.assertMultiLineEqual(first, second, msg=None)` {#TestCase.assertMultiLineEqual} - -Assert that two multi-line strings are equal. - - -- - - - -#### `tf.test.TestCase.assertNDArrayNear(ndarray1, ndarray2, err)` {#TestCase.assertNDArrayNear} - -Asserts that two numpy arrays have near values. - -##### Args: - - -* `ndarray1`: a numpy ndarray. -* `ndarray2`: a numpy ndarray. -* `err`: a float. The maximum absolute difference allowed. - - -- - - - -#### `tf.test.TestCase.assertNear(f1, f2, err, msg=None)` {#TestCase.assertNear} - -Asserts that two floats are near each other. - -Checks that |f1 - f2| < err and asserts a test failure -if not. - -##### Args: - - -* `f1`: A float value. -* `f2`: A float value. -* `err`: A float value. -* `msg`: An optional string message to append to the failure message. - - -- - - - -#### `tf.test.TestCase.assertNotAlmostEqual(first, second, places=None, msg=None, delta=None)` {#TestCase.assertNotAlmostEqual} - -Fail if the two objects are equal as determined by their -difference rounded to the given number of decimal places -(default 7) and comparing to zero, or by comparing that the -between the two objects is less than the given delta. - -Note that decimal places (from zero) are usually not the same -as significant digits (measured from the most signficant digit). - -Objects that are equal automatically fail. - - -- - - - -#### `tf.test.TestCase.assertNotAlmostEquals(first, second, places=None, msg=None, delta=None)` {#TestCase.assertNotAlmostEquals} - -Fail if the two objects are equal as determined by their -difference rounded to the given number of decimal places -(default 7) and comparing to zero, or by comparing that the -between the two objects is less than the given delta. - -Note that decimal places (from zero) are usually not the same -as significant digits (measured from the most signficant digit). - -Objects that are equal automatically fail. - - -- - - - -#### `tf.test.TestCase.assertNotEqual(first, second, msg=None)` {#TestCase.assertNotEqual} - -Fail if the two objects are equal as determined by the '!=' -operator. - - -- - - - -#### `tf.test.TestCase.assertNotEquals(first, second, msg=None)` {#TestCase.assertNotEquals} - -Fail if the two objects are equal as determined by the '!=' -operator. - - -- - - - -#### `tf.test.TestCase.assertNotIn(member, container, msg=None)` {#TestCase.assertNotIn} - -Just like self.assertTrue(a not in b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertNotIsInstance(obj, cls, msg=None)` {#TestCase.assertNotIsInstance} - -Included for symmetry with assertIsInstance. - - -- - - - -#### `tf.test.TestCase.assertNotRegexpMatches(text, unexpected_regexp, msg=None)` {#TestCase.assertNotRegexpMatches} - -Fail the test if the text matches the regular expression. - - -- - - - -#### `tf.test.TestCase.assertProtoEquals(expected_message_maybe_ascii, message)` {#TestCase.assertProtoEquals} - -Asserts that message is same as parsed expected_message_ascii. - -Creates another prototype of message, reads the ascii message into it and -then compares them using self._AssertProtoEqual(). - -##### Args: - - -* `expected_message_maybe_ascii`: proto message in original or ascii form -* `message`: the message to validate - - -- - - - -#### `tf.test.TestCase.assertProtoEqualsVersion(expected, actual, producer=21, min_consumer=0)` {#TestCase.assertProtoEqualsVersion} - - - - -- - - - -#### `tf.test.TestCase.assertRaises(excClass, callableObj=None, *args, **kwargs)` {#TestCase.assertRaises} - -Fail unless an exception of class excClass is raised -by callableObj when invoked with arguments args and keyword -arguments kwargs. If a different type of exception is -raised, it will not be caught, and the test case will be -deemed to have suffered an error, exactly as for an -unexpected exception. - -If called with callableObj omitted or None, will return a -context object used like this:: - - with self.assertRaises(SomeException): - do_something() - -The context manager keeps a reference to the exception as -the 'exception' attribute. This allows you to inspect the -exception after the assertion:: - - with self.assertRaises(SomeException) as cm: - do_something() - the_exception = cm.exception - self.assertEqual(the_exception.error_code, 3) - - -- - - - -#### `tf.test.TestCase.assertRaisesOpError(expected_err_re_or_predicate)` {#TestCase.assertRaisesOpError} - - - - -- - - - -#### `tf.test.TestCase.assertRaisesRegexp(expected_exception, expected_regexp, callable_obj=None, *args, **kwargs)` {#TestCase.assertRaisesRegexp} - -Asserts that the message in a raised exception matches a regexp. - -##### Args: - - -* `expected_exception`: Exception class expected to be raised. -* `expected_regexp`: Regexp (re pattern object or string) expected - to be found in error message. -* `callable_obj`: Function to be called. -* `args`: Extra args. -* `kwargs`: Extra kwargs. - - -- - - - -#### `tf.test.TestCase.assertRaisesWithPredicateMatch(exception_type, expected_err_re_or_predicate)` {#TestCase.assertRaisesWithPredicateMatch} - -Returns a context manager to enclose code expected to raise an exception. - -If the exception is an OpError, the op stack is also included in the message -predicate search. - -##### Args: - - -* `exception_type`: The expected type of exception that should be raised. -* `expected_err_re_or_predicate`: If this is callable, it should be a function - of one argument that inspects the passed-in exception and - returns True (success) or False (please fail the test). Otherwise, the - error message is expected to match this regular expression partially. - -##### Returns: - - A context manager to surround code that is expected to raise an - exception. - - -- - - - -#### `tf.test.TestCase.assertRegexpMatches(text, expected_regexp, msg=None)` {#TestCase.assertRegexpMatches} - -Fail the test unless the text matches the regular expression. - - -- - - - -#### `tf.test.TestCase.assertSequenceEqual(seq1, seq2, msg=None, seq_type=None)` {#TestCase.assertSequenceEqual} - -An equality assertion for ordered sequences (like lists and tuples). - -For the purposes of this function, a valid ordered sequence type is one -which can be indexed, has a length, and has an equality operator. - -##### Args: - - -* `seq1`: The first sequence to compare. -* `seq2`: The second sequence to compare. -* `seq_type`: The expected datatype of the sequences, or None if no - datatype should be enforced. -* `msg`: Optional message to use on failure instead of a list of - differences. - - -- - - - -#### `tf.test.TestCase.assertSetEqual(set1, set2, msg=None)` {#TestCase.assertSetEqual} - -A set-specific equality assertion. - -##### Args: - - -* `set1`: The first set to compare. -* `set2`: The second set to compare. -* `msg`: Optional message to use on failure instead of a list of - differences. - -assertSetEqual uses ducktyping to support different types of sets, and -is optimized for sets specifically (parameters must support a -difference method). - - -- - - - -#### `tf.test.TestCase.assertShapeEqual(np_array, tf_tensor)` {#TestCase.assertShapeEqual} - -Asserts that a Numpy ndarray and a TensorFlow tensor have the same shape. - -##### Args: - - -* `np_array`: A Numpy ndarray or Numpy scalar. -* `tf_tensor`: A Tensor. - -##### Raises: - - -* `TypeError`: If the arguments have the wrong type. - - -- - - - -#### `tf.test.TestCase.assertStartsWith(actual, expected_start, msg=None)` {#TestCase.assertStartsWith} - -Assert that actual.startswith(expected_start) is True. - -##### Args: - - -* `actual`: str -* `expected_start`: str -* `msg`: Optional message to report on failure. - - -- - - - -#### `tf.test.TestCase.assertTrue(expr, msg=None)` {#TestCase.assertTrue} - -Check that the expression is true. - - -- - - - -#### `tf.test.TestCase.assertTupleEqual(tuple1, tuple2, msg=None)` {#TestCase.assertTupleEqual} - -A tuple-specific equality assertion. - -##### Args: - - -* `tuple1`: The first tuple to compare. -* `tuple2`: The second tuple to compare. -* `msg`: Optional message to use on failure instead of a list of - differences. - - -- - - - -#### `tf.test.TestCase.assert_(expr, msg=None)` {#TestCase.assert_} - -Check that the expression is true. - - -- - - - -#### `tf.test.TestCase.checkedThread(target, args=None, kwargs=None)` {#TestCase.checkedThread} - -Returns a Thread wrapper that asserts 'target' completes successfully. - -This method should be used to create all threads in test cases, as -otherwise there is a risk that a thread will silently fail, and/or -assertions made in the thread will not be respected. - -##### Args: - - -* `target`: A callable object to be executed in the thread. -* `args`: The argument tuple for the target invocation. Defaults to (). -* `kwargs`: A dictionary of keyword arguments for the target invocation. - Defaults to {}. - -##### Returns: - - A wrapper for threading.Thread that supports start() and join() methods. - - -- - - - -#### `tf.test.TestCase.countTestCases()` {#TestCase.countTestCases} - - - - -- - - - -#### `tf.test.TestCase.debug()` {#TestCase.debug} - -Run the test without collecting errors in a TestResult - - -- - - - -#### `tf.test.TestCase.defaultTestResult()` {#TestCase.defaultTestResult} - - - - -- - - - -#### `tf.test.TestCase.doCleanups()` {#TestCase.doCleanups} - -Execute all cleanup functions. Normally called for you after -tearDown. - - -- - - - -#### `tf.test.TestCase.fail(msg=None)` {#TestCase.fail} - -Fail immediately, with the given message. - - -- - - - -#### `tf.test.TestCase.failIf(*args, **kwargs)` {#TestCase.failIf} - - - - -- - - - -#### `tf.test.TestCase.failIfAlmostEqual(*args, **kwargs)` {#TestCase.failIfAlmostEqual} - - - - -- - - - -#### `tf.test.TestCase.failIfEqual(*args, **kwargs)` {#TestCase.failIfEqual} - - - - -- - - - -#### `tf.test.TestCase.failUnless(*args, **kwargs)` {#TestCase.failUnless} - - - - -- - - - -#### `tf.test.TestCase.failUnlessAlmostEqual(*args, **kwargs)` {#TestCase.failUnlessAlmostEqual} - - - - -- - - - -#### `tf.test.TestCase.failUnlessEqual(*args, **kwargs)` {#TestCase.failUnlessEqual} - - - - -- - - - -#### `tf.test.TestCase.failUnlessRaises(*args, **kwargs)` {#TestCase.failUnlessRaises} - - - - -- - - - -#### `tf.test.TestCase.get_temp_dir()` {#TestCase.get_temp_dir} - -Returns a unique temporary directory for the test to use. - -Across different test runs, this method will return a different folder. -This will ensure that across different runs tests will not be able to -pollute each others environment. - -##### Returns: - - string, the path to the unique temporary directory created for this test. - - -- - - - -#### `tf.test.TestCase.id()` {#TestCase.id} - - - - -- - - - -#### `tf.test.TestCase.run(result=None)` {#TestCase.run} - - - - -- - - - -#### `tf.test.TestCase.setUp()` {#TestCase.setUp} - - - - -- - - - -#### `tf.test.TestCase.setUpClass(cls)` {#TestCase.setUpClass} - -Hook method for setting up class fixture before running tests in the class. - - -- - - - -#### `tf.test.TestCase.shortDescription()` {#TestCase.shortDescription} - -Returns a one-line description of the test, or None if no -description has been provided. - -The default implementation of this method returns the first line of -the specified test method's docstring. - - -- - - - -#### `tf.test.TestCase.skipTest(reason)` {#TestCase.skipTest} - -Skip this test. - - -- - - - -#### `tf.test.TestCase.tearDown()` {#TestCase.tearDown} - - - - -- - - - -#### `tf.test.TestCase.tearDownClass(cls)` {#TestCase.tearDownClass} - -Hook method for deconstructing the class fixture after running all tests in the class. - - -- - - - -#### `tf.test.TestCase.test_session(graph=None, config=None, use_gpu=False, force_gpu=False)` {#TestCase.test_session} - -Returns a TensorFlow Session for use in executing tests. - -This method should be used for all functional tests. - -This method behaves different than session.Session: for performance reasons -`test_session` will by default (if `graph` is None) reuse the same session -across tests. This means you may want to either call the function -`reset_default_graph()` before tests, or if creating an explicit new graph, -pass it here (simply setting it with `as_default()` won't do it), which will -trigger the creation of a new session. - -Use the `use_gpu` and `force_gpu` options to control where ops are run. If -`force_gpu` is True, all ops are pinned to `/gpu:0`. Otherwise, if `use_gpu` -is True, TensorFlow tries to run as many ops on the GPU as possible. If both -`force_gpu and `use_gpu` are False, all ops are pinned to the CPU. - -Example: - - class MyOperatorTest(test_util.TensorFlowTestCase): - def testMyOperator(self): - with self.test_session(use_gpu=True): - valid_input = [1.0, 2.0, 3.0, 4.0, 5.0] - result = MyOperator(valid_input).eval() - self.assertEqual(result, [1.0, 2.0, 3.0, 5.0, 8.0] - invalid_input = [-1.0, 2.0, 7.0] - with self.assertRaisesOpError("negative input not supported"): - MyOperator(invalid_input).eval() - -##### Args: - - -* `graph`: Optional graph to use during the returned session. -* `config`: An optional config_pb2.ConfigProto to use to configure the - session. -* `use_gpu`: If True, attempt to run as many ops as possible on GPU. -* `force_gpu`: If True, pin all ops to `/gpu:0`. - -##### Returns: - - A Session object that should be used as a context manager to surround - the graph building and execution code in a test case. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.assert_equal_graph_def.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.assert_equal_graph_def.md deleted file mode 100644 index 026f5df890..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.assert_equal_graph_def.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.test.assert_equal_graph_def(actual, expected, checkpoint_v2=False)` {#assert_equal_graph_def} - -Asserts that two `GraphDef`s are (mostly) the same. - -Compares two `GraphDef` protos for equality, ignoring versions and ordering of -nodes, attrs, and control inputs. Node names are used to match up nodes -between the graphs, so the naming of nodes must be consistent. - -##### Args: - - -* `actual`: The `GraphDef` we have. -* `expected`: The `GraphDef` we expected. -* `checkpoint_v2`: boolean determining whether to ignore randomized attribute - values that appear in V2 checkpoints. - -##### Raises: - - -* `AssertionError`: If the `GraphDef`s do not match. -* `TypeError`: If either argument is not a `GraphDef`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.compute_gradient.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.compute_gradient.md deleted file mode 100644 index a69224a0c5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.compute_gradient.md +++ /dev/null @@ -1,42 +0,0 @@ -### `tf.test.compute_gradient(x, x_shape, y, y_shape, x_init_value=None, delta=0.001, init_targets=None, extra_feed_dict=None)` {#compute_gradient} - -Computes and returns the theoretical and numerical Jacobian. - -If `x` or `y` is complex, the Jacobian will still be real but the -corresponding Jacobian dimension(s) will be twice as large. This is required -even if both input and output is complex since TensorFlow graphs are not -necessarily holomorphic, and may have gradients not expressible as complex -numbers. For example, if `x` is complex with shape `[m]` and `y` is complex -with shape `[n]`, each Jacobian `J` will have shape `[m * 2, n * 2]` with - - J[:m, :n] = d(Re y)/d(Re x) - J[:m, n:] = d(Im y)/d(Re x) - J[m:, :n] = d(Re y)/d(Im x) - J[m:, n:] = d(Im y)/d(Im x) - -##### Args: - - -* `x`: a tensor or list of tensors -* `x_shape`: the dimensions of x as a tuple or an array of ints. If x is a list, - then this is the list of shapes. - -* `y`: a tensor -* `y_shape`: the dimensions of y as a tuple or an array of ints. -* `x_init_value`: (optional) a numpy array of the same shape as "x" - representing the initial value of x. If x is a list, this should be a list - of numpy arrays. If this is none, the function will pick a random tensor - as the initial value. -* `delta`: (optional) the amount of perturbation. -* `init_targets`: list of targets to run to initialize model params. - TODO(mrry): remove this argument. -* `extra_feed_dict`: dict that allows fixing specified tensor values - during the Jacobian calculation. - -##### Returns: - - Two 2-d numpy arrays representing the theoretical and numerical - Jacobian for dy/dx. Each has "x_size" rows and "y_size" columns - where "x_size" is the number of elements in x and "y_size" is the - number of elements in y. If x is a list, returns a list of two numpy arrays. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.is_built_with_cuda.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.is_built_with_cuda.md deleted file mode 100644 index 51e3d97d8c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.test.is_built_with_cuda.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.test.is_built_with_cuda()` {#is_built_with_cuda} - -Returns whether TensorFlow was built with CUDA (GPU) support. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.to_int32.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.to_int32.md deleted file mode 100644 index fcc9db61cc..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.to_int32.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.to_int32(x, name='ToInt32')` {#to_int32} - -Casts a tensor to type `int32`. - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` with same shape as `x` with type `int32`. - -##### Raises: - - -* `TypeError`: If `x` cannot be cast to the `int32`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.CheckpointSaverHook.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.CheckpointSaverHook.md deleted file mode 100644 index 8654557bd5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.CheckpointSaverHook.md +++ /dev/null @@ -1,77 +0,0 @@ -Saves checkpoints every N steps or seconds. -- - - - -#### `tf.train.CheckpointSaverHook.__init__(checkpoint_dir, save_secs=None, save_steps=None, saver=None, checkpoint_basename='model.ckpt', scaffold=None, listeners=None)` {#CheckpointSaverHook.__init__} - -Initialize CheckpointSaverHook monitor. - -##### Args: - - -* `checkpoint_dir`: `str`, base directory for the checkpoint files. -* `save_secs`: `int`, save every N secs. -* `save_steps`: `int`, save every N steps. -* `saver`: `Saver` object, used for saving. -* `checkpoint_basename`: `str`, base name for the checkpoint files. -* `scaffold`: `Scaffold`, use to get saver object. -* `listeners`: List of `CheckpointSaverListener` subclass instances. - Used for callbacks that run immediately after the corresponding - CheckpointSaverHook callbacks, only in steps where the - CheckpointSaverHook was triggered. - -##### Raises: - - -* `ValueError`: One of `save_steps` or `save_secs` should be set. -* `ValueError`: Exactly one of saver or scaffold should be set. - - -- - - - -#### `tf.train.CheckpointSaverHook.after_create_session(session, coord)` {#CheckpointSaverHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.CheckpointSaverHook.after_run(run_context, run_values)` {#CheckpointSaverHook.after_run} - - - - -- - - - -#### `tf.train.CheckpointSaverHook.before_run(run_context)` {#CheckpointSaverHook.before_run} - - - - -- - - - -#### `tf.train.CheckpointSaverHook.begin()` {#CheckpointSaverHook.begin} - - - - -- - - - -#### `tf.train.CheckpointSaverHook.end(session)` {#CheckpointSaverHook.end} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.Saver.from_proto.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.Saver.from_proto.md deleted file mode 100644 index 1c3b17e2e9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.Saver.from_proto.md +++ /dev/null @@ -1,14 +0,0 @@ -#### `tf.train.Saver.from_proto(saver_def, import_scope=None)` {#Saver.from_proto} - -Returns a `Saver` object created from `saver_def`. - -##### Args: - - -* `saver_def`: a `SaveDef` protocol buffer. -* `import_scope`: Optional `string`. Name scope to use. - -##### Returns: - - A `Saver` built from saver_def. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.SessionCreator.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.SessionCreator.md deleted file mode 100644 index c1df9b3406..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.SessionCreator.md +++ /dev/null @@ -1,8 +0,0 @@ -A factory for tf.Session. -- - - - -#### `tf.train.SessionCreator.create_session()` {#SessionCreator.create_session} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.basic_train_loop.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.basic_train_loop.md deleted file mode 100644 index 774cbe5ad5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.basic_train_loop.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.train.basic_train_loop(supervisor, train_step_fn, args=None, kwargs=None, master='')` {#basic_train_loop} - -Basic loop to train a model. - -Calls `train_step_fn` in a loop to train a model. The function is called as: - -```python -train_step_fn(session, *args, **kwargs) -``` - -It is passed a `tf.Session` in addition to `args` and `kwargs`. The function -typically runs one training step in the session. - -##### Args: - - -* `supervisor`: `tf.Supervisor` to run the training services. -* `train_step_fn`: Callable to execute one training step. Called - repeatedly as `train_step_fn(session, *args **kwargs)`. -* `args`: Optional positional arguments passed to `train_step_fn`. -* `kwargs`: Optional keyword arguments passed to `train_step_fn`. -* `master`: Master to use to create the training session. Defaults to - `""` which causes the session to be created in the local process. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.global_step.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.global_step.md deleted file mode 100644 index 2ec7f9654a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.global_step.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.train.global_step(sess, global_step_tensor)` {#global_step} - -Small helper to get the global step. - -```python -# Creates a variable to hold the global_step. -global_step_tensor = tf.Variable(10, trainable=False, name='global_step') -# Creates a session. -sess = tf.Session() -# Initializes the variable. -print('global_step: %s' % tf.train.global_step(sess, global_step_tensor)) - -global_step: 10 -``` - -##### Args: - - -* `sess`: A TensorFlow `Session` object. -* `global_step_tensor`: `Tensor` or the `name` of the operation that contains - the global step. - -##### Returns: - - The global step value. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.latest_checkpoint.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.latest_checkpoint.md deleted file mode 100644 index b1fc87cdd7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.latest_checkpoint.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.train.latest_checkpoint(checkpoint_dir, latest_filename=None)` {#latest_checkpoint} - -Finds the filename of latest saved checkpoint file. - -##### Args: - - -* `checkpoint_dir`: Directory where the variables were saved. -* `latest_filename`: Optional name for the protocol buffer file that - contains the list of most recent checkpoint filenames. - See the corresponding argument to `Saver.save()`. - -##### Returns: - - The full path to the latest checkpoint or `None` if no checkpoint was found. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.maybe_shuffle_batch_join.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.maybe_shuffle_batch_join.md deleted file mode 100644 index ec101daba3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.maybe_shuffle_batch_join.md +++ /dev/null @@ -1,42 +0,0 @@ -### `tf.train.maybe_shuffle_batch_join(tensors_list, batch_size, capacity, min_after_dequeue, keep_input, seed=None, enqueue_many=False, shapes=None, allow_smaller_final_batch=False, shared_name=None, name=None)` {#maybe_shuffle_batch_join} - -Create batches by randomly shuffling conditionally-enqueued tensors. - -See docstring in `shuffle_batch_join` for more details. - -##### Args: - - -* `tensors_list`: A list of tuples or dictionaries of tensors to enqueue. -* `batch_size`: An integer. The new batch size pulled from the queue. -* `capacity`: An integer. The maximum number of elements in the queue. -* `min_after_dequeue`: Minimum number elements in the queue after a - dequeue, used to ensure a level of mixing of elements. -* `keep_input`: A `bool` Tensor. This tensor controls whether the input is - added to the queue or not. If it is a scalar and evaluates `True`, then - `tensors` are all added to the queue. If it is a vector and `enqueue_many` - is `True`, then each example is added to the queue only if the - corresonding value in `keep_input` is `True`. This tensor essentially acts - as a filtering mechanism. -* `seed`: Seed for the random shuffling within the queue. -* `enqueue_many`: Whether each tensor in `tensor_list_list` is a single - example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensors_list[i]`. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (optional). If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the same number and types as - `tensors_list[i]`. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensors_list`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.natural_exp_decay.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.natural_exp_decay.md deleted file mode 100644 index 5fbff8f9d4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.natural_exp_decay.md +++ /dev/null @@ -1,56 +0,0 @@ -### `tf.train.natural_exp_decay(learning_rate, global_step, decay_steps, decay_rate, staircase=False, name=None)` {#natural_exp_decay} - -Applies natural exponential decay to the initial learning rate. - -When training a model, it is often recommended to lower the learning rate as -the training progresses. This function applies an exponential decay function -to a provided initial learning rate. It requires an `global_step` value to -compute the decayed learning rate. You can just pass a TensorFlow variable -that you increment at each training step. - -The function returns the decayed learning rate. It is computed as: - -```python -decayed_learning_rate = learning_rate * exp(-decay_rate * global_step) -``` - -Example: decay exponentially with a base of 0.96: - -```python -... -global_step = tf.Variable(0, trainable=False) -learning_rate = 0.1 -k = 0.5 -learning_rate = tf.train.exponential_time_decay(learning_rate, global_step, k) - -# Passing global_step to minimize() will increment it at each step. -learning_step = ( - tf.train.GradientDescentOptimizer(learning_rate) - .minimize(...my loss..., global_step=global_step) -) -``` - -##### Args: - - -* `learning_rate`: A scalar `float32` or `float64` `Tensor` or a - Python number. The initial learning rate. -* `global_step`: A Python number. - Global step to use for the decay computation. Must not be negative. -* `decay_steps`: How often to apply decay. -* `decay_rate`: A Python number. The decay rate. -* `staircase`: Whether to apply decay in a discrete staircase, as opposed to - continuous, fashion. -* `name`: String. Optional name of the operation. Defaults to - 'ExponentialTimeDecay'. - -##### Returns: - - A scalar `Tensor` of the same type as `learning_rate`. The decayed - learning rate. - -##### Raises: - - -* `ValueError`: if `global_step` is not supplied. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.shuffle_batch.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.shuffle_batch.md deleted file mode 100644 index 1da7793d58..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.shuffle_batch.md +++ /dev/null @@ -1,86 +0,0 @@ -### `tf.train.shuffle_batch(tensors, batch_size, capacity, min_after_dequeue, num_threads=1, seed=None, enqueue_many=False, shapes=None, allow_smaller_final_batch=False, shared_name=None, name=None)` {#shuffle_batch} - -Creates batches by randomly shuffling tensors. - -This function adds the following to the current `Graph`: - -* A shuffling queue into which tensors from `tensors` are enqueued. -* A `dequeue_many` operation to create batches from the queue. -* A `QueueRunner` to `QUEUE_RUNNER` collection, to enqueue the tensors - from `tensors`. - -If `enqueue_many` is `False`, `tensors` is assumed to represent a -single example. An input tensor with shape `[x, y, z]` will be output -as a tensor with shape `[batch_size, x, y, z]`. - -If `enqueue_many` is `True`, `tensors` is assumed to represent a -batch of examples, where the first dimension is indexed by example, -and all members of `tensors` should have the same size in the -first dimension. If an input tensor has shape `[*, x, y, z]`, the -output will have shape `[batch_size, x, y, z]`. - -The `capacity` argument controls the how long the prefetching is allowed to -grow the queues. - -The returned operation is a dequeue operation and will throw -`tf.errors.OutOfRangeError` if the input queue is exhausted. If this -operation is feeding another input queue, its queue runner will catch -this exception, however, if this operation is used in your main thread -you are responsible for catching this yourself. - -For example: - -```python -# Creates batches of 32 images and 32 labels. -image_batch, label_batch = tf.train.shuffle_batch( - [single_image, single_label], - batch_size=32, - num_threads=4, - capacity=50000, - min_after_dequeue=10000) -``` - -*N.B.:* You must ensure that either (i) the `shapes` argument is -passed, or (ii) all of the tensors in `tensors` must have -fully-defined shapes. `ValueError` will be raised if neither of -these conditions holds. - -If `allow_smaller_final_batch` is `True`, a smaller batch value than -`batch_size` is returned when the queue is closed and there are not enough -elements to fill the batch, otherwise the pending elements are discarded. -In addition, all output tensors' static shapes, as accessed via the -`get_shape` method will have a first `Dimension` value of `None`, and -operations that depend on fixed batch_size would fail. - -Note: if `num_epochs` is not `None`, this function creates local counter -`epochs`. Use `local_variables_initializer()` to initialize local variables. - -##### Args: - - -* `tensors`: The list or dictionary of tensors to enqueue. -* `batch_size`: The new batch size pulled from the queue. -* `capacity`: An integer. The maximum number of elements in the queue. -* `min_after_dequeue`: Minimum number elements in the queue after a - dequeue, used to ensure a level of mixing of elements. -* `num_threads`: The number of threads enqueuing `tensor_list`. -* `seed`: Seed for the random shuffling within the queue. -* `enqueue_many`: Whether each tensor in `tensor_list` is a single example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensor_list`. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (Optional) If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the types as `tensors`. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensors`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.start_queue_runners.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.start_queue_runners.md deleted file mode 100644 index 21ac6efee8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.train.start_queue_runners.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.train.start_queue_runners(sess=None, coord=None, daemon=True, start=True, collection='queue_runners')` {#start_queue_runners} - -Starts all queue runners collected in the graph. - -This is a companion method to `add_queue_runner()`. It just starts -threads for all queue runners collected in the graph. It returns -the list of all threads. - -##### Args: - - -* `sess`: `Session` used to run the queue ops. Defaults to the - default session. -* `coord`: Optional `Coordinator` for coordinating the started threads. -* `daemon`: Whether the threads should be marked as `daemons`, meaning - they don't block program exit. -* `start`: Set to `False` to only create the threads, not start them. -* `collection`: A `GraphKey` specifying the graph collection to - get the queue runners from. Defaults to `GraphKeys.QUEUE_RUNNERS`. - -##### Returns: - - A list of threads. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.uniform_unit_scaling_initializer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.uniform_unit_scaling_initializer.md deleted file mode 100644 index 7d76e45912..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.uniform_unit_scaling_initializer.md +++ /dev/null @@ -1,38 +0,0 @@ -Initializer that generates tensors without scaling variance. - -When initializing a deep network, it is in principle advantageous to keep -the scale of the input variance constant, so it does not explode or diminish -by reaching the final layer. If the input is `x` and the operation `x * W`, -and we want to initialize `W` uniformly at random, we need to pick `W` from - - [-sqrt(3) / sqrt(dim), sqrt(3) / sqrt(dim)] - -to keep the scale intact, where `dim = W.shape[0]` (the size of the input). -A similar calculation for convolutional networks gives an analogous result -with `dim` equal to the product of the first 3 dimensions. When -nonlinearities are present, we need to multiply this by a constant `factor`. -See [Sussillo et al., 2014](https://arxiv.org/abs/1412.6558) -([pdf](http://arxiv.org/pdf/1412.6558.pdf)) for deeper motivation, experiments -and the calculation of constants. In section 2.3 there, the constants were -numerically computed: for a linear layer it's 1.0, relu: ~1.43, tanh: ~1.15. - -Args: - factor: Float. A multiplicative factor by which the values will be scaled. - seed: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - dtype: The data type. Only floating point types are supported. -- - - - -#### `tf.uniform_unit_scaling_initializer.__call__(shape, dtype=None, partition_info=None)` {#uniform_unit_scaling_initializer.__call__} - - - - -- - - - -#### `tf.uniform_unit_scaling_initializer.__init__(factor=1.0, seed=None, dtype=tf.float32)` {#uniform_unit_scaling_initializer.__init__} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.variables_initializer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.variables_initializer.md deleted file mode 100644 index ec779e79f6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.variables_initializer.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.variables_initializer(var_list, name='init')` {#variables_initializer} - -Returns an Op that initializes a list of variables. - -After you launch the graph in a session, you can run the returned Op to -initialize all the variables in `var_list`. This Op runs all the -initializers of the variables in `var_list` in parallel. - -Calling `initialize_variables()` is equivalent to passing the list of -initializers to `Group()`. - -If `var_list` is empty, however, the function still returns an Op that can -be run. That Op just has no effect. - -##### Args: - - -* `var_list`: List of `Variable` objects to initialize. -* `name`: Optional name for the returned operation. - -##### Returns: - - An Op that run the initializers of all the specified variables. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.write_file.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.write_file.md deleted file mode 100644 index ccccf9b43b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard2/tf.write_file.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.write_file(filename, contents, name=None)` {#write_file} - -Writes contents to the file at input filename. Creates file if not existing. - -##### Args: - - -* `filename`: A `Tensor` of type `string`. - scalar. The name of the file to which we write the contents. -* `contents`: A `Tensor` of type `string`. - scalar. The content to be written to the output file. -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.PriorityQueue.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.PriorityQueue.md deleted file mode 100644 index 6154301c4e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.PriorityQueue.md +++ /dev/null @@ -1,305 +0,0 @@ -A queue implementation that dequeues elements in prioritized order. - -See [`tf.QueueBase`](#QueueBase) for a description of the methods on -this class. -- - - - -#### `tf.PriorityQueue.__init__(capacity, types, shapes=None, names=None, shared_name=None, name='priority_queue')` {#PriorityQueue.__init__} - -Creates a queue that dequeues elements in a first-in first-out order. - -A `PriorityQueue` has bounded capacity; supports multiple concurrent -producers and consumers; and provides exactly-once delivery. - -A `PriorityQueue` holds a list of up to `capacity` elements. Each -element is a fixed-length tuple of tensors whose dtypes are -described by `types`, and whose shapes are optionally described -by the `shapes` argument. - -If the `shapes` argument is specified, each component of a queue -element must have the respective fixed shape. If it is -unspecified, different queue elements may have different shapes, -but the use of `dequeue_many` is disallowed. - -Enqueues and Dequeues to the `PriorityQueue` must include an additional -tuple entry at the beginning: the `priority`. The priority must be -an int64 scalar (for `enqueue`) or an int64 vector (for `enqueue_many`). - -##### Args: - - -* `capacity`: An integer. The upper bound on the number of elements - that may be stored in this queue. -* `types`: A list of `DType` objects. The length of `types` must equal - the number of tensors in each queue element, except the first priority - element. The first tensor in each element is the priority, - which must be type int64. -* `shapes`: (Optional.) A list of fully-defined `TensorShape` objects, - with the same length as `types`, or `None`. -* `names`: (Optional.) A list of strings naming the components in the queue - with the same length as `dtypes`, or `None`. If specified, the dequeue - methods return a dictionary with the names as keys. -* `shared_name`: (Optional.) If non-empty, this queue will be shared under - the given name across multiple sessions. -* `name`: Optional name for the queue operation. - - -- - - - -#### `tf.PriorityQueue.close(cancel_pending_enqueues=False, name=None)` {#PriorityQueue.close} - -Closes this queue. - -This operation signals that no more elements will be enqueued in -the given queue. Subsequent `enqueue` and `enqueue_many` -operations will fail. Subsequent `dequeue` and `dequeue_many` -operations will continue to succeed if sufficient elements remain -in the queue. Subsequent `dequeue` and `dequeue_many` operations -that would block will fail immediately. - -If `cancel_pending_enqueues` is `True`, all pending requests will also -be cancelled. - -##### Args: - - -* `cancel_pending_enqueues`: (Optional.) A boolean, defaulting to - `False` (described above). -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that closes the queue. - - -- - - - -#### `tf.PriorityQueue.dequeue(name=None)` {#PriorityQueue.dequeue} - -Dequeues one element from this queue. - -If the queue is empty when this operation executes, it will block -until there is an element to dequeue. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue is empty, and there are no pending -enqueue operations that can fulfill this request, -`tf.errors.OutOfRangeError` will be raised. If the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of tensors that was dequeued. - - -- - - - -#### `tf.PriorityQueue.dequeue_many(n, name=None)` {#PriorityQueue.dequeue_many} - -Dequeues and concatenates `n` elements from this queue. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. All of the -components in the dequeued tuple will have size `n` in the 0th dimension. - -If the queue is closed and there are less than `n` elements left, then an -`OutOfRange` exception is raised. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue contains fewer than `n` elements, and -there are no pending enqueue operations that can fulfill this -request, `tf.errors.OutOfRangeError` will be raised. If the -session is [closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.PriorityQueue.dequeue_up_to(n, name=None)` {#PriorityQueue.dequeue_up_to} - -Dequeues and concatenates `n` elements from this queue. - -**Note** This operation is not supported by all queues. If a queue does not -support DequeueUpTo, then a `tf.errors.UnimplementedError` is raised. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. If the queue -has not been closed, all of the components in the dequeued tuple -will have size `n` in the 0th dimension. - -If the queue is closed and there are more than `0` but fewer than -`n` elements remaining, then instead of raising a -`tf.errors.OutOfRangeError` like [`dequeue_many`](#QueueBase.dequeue_many), -less than `n` elements are returned immediately. If the queue is -closed and there are `0` elements left in the queue, then a -`tf.errors.OutOfRangeError` is raised just like in `dequeue_many`. -Otherwise the behavior is identical to `dequeue_many`. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.PriorityQueue.dtypes` {#PriorityQueue.dtypes} - -The list of dtypes for each component of a queue element. - - -- - - - -#### `tf.PriorityQueue.enqueue(vals, name=None)` {#PriorityQueue.enqueue} - -Enqueues one element to this queue. - -If the queue is full when this operation executes, it will block -until the element has been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary containing - the values to enqueue. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a new tuple of tensors to the queue. - - -- - - - -#### `tf.PriorityQueue.enqueue_many(vals, name=None)` {#PriorityQueue.enqueue_many} - -Enqueues zero or more elements to this queue. - -This operation slices each component tensor along the 0th dimension to -make multiple queue elements. All of the tensors in `vals` must have the -same size in the 0th dimension. - -If the queue is full when this operation executes, it will block -until all of the elements have been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary - from which the queue elements are taken. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a batch of tuples of tensors to the queue. - - -- - - - -#### `tf.PriorityQueue.from_list(index, queues)` {#PriorityQueue.from_list} - -Create a queue using the queue reference from `queues[index]`. - -##### Args: - - -* `index`: An integer scalar tensor that determines the input that gets - selected. -* `queues`: A list of `QueueBase` objects. - -##### Returns: - - A `QueueBase` object. - -##### Raises: - - -* `TypeError`: When `queues` is not a list of `QueueBase` objects, - or when the data types of `queues` are not all the same. - - -- - - - -#### `tf.PriorityQueue.name` {#PriorityQueue.name} - -The name of the underlying queue. - - -- - - - -#### `tf.PriorityQueue.names` {#PriorityQueue.names} - -The list of names for each component of a queue element. - - -- - - - -#### `tf.PriorityQueue.queue_ref` {#PriorityQueue.queue_ref} - -The underlying queue reference. - - -- - - - -#### `tf.PriorityQueue.shapes` {#PriorityQueue.shapes} - -The list of shapes for each component of a queue element. - - -- - - - -#### `tf.PriorityQueue.size(name=None)` {#PriorityQueue.size} - -Compute the number of elements in this queue. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A scalar tensor containing the number of elements in this queue. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.RegisterGradient.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.RegisterGradient.md deleted file mode 100644 index 2a93bbba40..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.RegisterGradient.md +++ /dev/null @@ -1,45 +0,0 @@ -A decorator for registering the gradient function for an op type. - -This decorator is only used when defining a new op type. For an op -with `m` inputs and `n` outputs, the gradient function is a function -that takes the original `Operation` and `n` `Tensor` objects -(representing the gradients with respect to each output of the op), -and returns `m` `Tensor` objects (representing the partial gradients -with respect to each input of the op). - -For example, assuming that operations of type `"Sub"` take two -inputs `x` and `y`, and return a single output `x - y`, the -following gradient function would be registered: - -```python -@tf.RegisterGradient("Sub") -def _sub_grad(unused_op, grad): - return grad, tf.negative(grad) -``` - -The decorator argument `op_type` is the string type of an -operation. This corresponds to the `OpDef.name` field for the proto -that defines the operation. - -- - - - -#### `tf.RegisterGradient.__init__(op_type)` {#RegisterGradient.__init__} - -Creates a new decorator with `op_type` as the Operation type. - -##### Args: - - -* `op_type`: The string type of an operation. This corresponds to the - `OpDef.name` field for the proto that defines the operation. - - - -#### Other Methods -- - - - -#### `tf.RegisterGradient.__call__(f)` {#RegisterGradient.__call__} - -Registers the function `f` as gradient function for `op_type`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.SparseTensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.SparseTensor.md deleted file mode 100644 index 31c5d725b2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.SparseTensor.md +++ /dev/null @@ -1,248 +0,0 @@ -Represents a sparse tensor. - -TensorFlow represents a sparse tensor as three separate dense tensors: -`indices`, `values`, and `dense_shape`. In Python, the three tensors are -collected into a `SparseTensor` class for ease of use. If you have separate -`indices`, `values`, and `dense_shape` tensors, wrap them in a `SparseTensor` -object before passing to the ops below. - -Concretely, the sparse tensor `SparseTensor(indices, values, dense_shape)` -comprises the following components, where `N` and `ndims` are the number -of values and number of dimensions in the `SparseTensor`, respectively: - -* `indices`: A 2-D int64 tensor of dense_shape `[N, ndims]`, which specifies - the indices of the elements in the sparse tensor that contain nonzero - values (elements are zero-indexed). For example, `indices=[[1,3], [2,4]]` - specifies that the elements with indexes of [1,3] and [2,4] have - nonzero values. - -* `values`: A 1-D tensor of any type and dense_shape `[N]`, which supplies the - values for each element in `indices`. For example, given - `indices=[[1,3], [2,4]]`, the parameter `values=[18, 3.6]` specifies - that element [1,3] of the sparse tensor has a value of 18, and element - [2,4] of the tensor has a value of 3.6. - -* `dense_shape`: A 1-D int64 tensor of dense_shape `[ndims]`, which specifies - the dense_shape of the sparse tensor. Takes a list indicating the number of - elements in each dimension. For example, `dense_shape=[3,6]` specifies a - two-dimensional 3x6 tensor, `dense_shape=[2,3,4]` specifies a - three-dimensional 2x3x4 tensor, and `dense_shape=[9]` specifies a - one-dimensional tensor with 9 elements. - -The corresponding dense tensor satisfies: - -```python -dense.shape = dense_shape -dense[tuple(indices[i])] = values[i] -``` - -By convention, `indices` should be sorted in row-major order (or equivalently -lexicographic order on the tuples `indices[i]`). This is not enforced when -`SparseTensor` objects are constructed, but most ops assume correct ordering. -If the ordering of sparse tensor `st` is wrong, a fixed version can be -obtained by calling `tf.sparse_reorder(st)`. - -Example: The sparse tensor - -```python -SparseTensor(indices=[[0, 0], [1, 2]], values=[1, 2], dense_shape=[3, 4]) -``` - -represents the dense tensor - -```python -[[1, 0, 0, 0] - [0, 0, 2, 0] - [0, 0, 0, 0]] -``` -- - - - -#### `tf.SparseTensor.__div__(sp_x, y)` {#SparseTensor.__div__} - -Component-wise divides a SparseTensor by a dense Tensor. - -*Limitation*: this Op only broadcasts the dense side to the sparse side, but not -the other direction. - -##### Args: - - -* `sp_indices`: A `Tensor` of type `int64`. - 2-D. `N x R` matrix with the indices of non-empty values in a - SparseTensor, possibly not in canonical ordering. -* `sp_values`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - 1-D. `N` non-empty values corresponding to `sp_indices`. -* `sp_shape`: A `Tensor` of type `int64`. - 1-D. Shape of the input SparseTensor. -* `dense`: A `Tensor`. Must have the same type as `sp_values`. - `R`-D. The dense Tensor operand. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `sp_values`. - 1-D. The `N` values that are operated on. - - -- - - - -#### `tf.SparseTensor.__init__(indices, values, dense_shape)` {#SparseTensor.__init__} - -Creates a `SparseTensor`. - -##### Args: - - -* `indices`: A 2-D int64 tensor of shape `[N, ndims]`. -* `values`: A 1-D tensor of any type and shape `[N]`. -* `dense_shape`: A 1-D int64 tensor of shape `[ndims]`. - -##### Returns: - - A `SparseTensor`. - - -- - - - -#### `tf.SparseTensor.__mul__(sp_x, y)` {#SparseTensor.__mul__} - -Component-wise multiplies a SparseTensor by a dense Tensor. - -The output locations corresponding to the implicitly zero elements in the sparse -tensor will be zero (i.e., will not take up storage space), regardless of the -contents of the dense tensor (even if it's +/-INF and that INF*0 == NaN). - -*Limitation*: this Op only broadcasts the dense side to the sparse side, but not -the other direction. - -##### Args: - - -* `sp_indices`: A `Tensor` of type `int64`. - 2-D. `N x R` matrix with the indices of non-empty values in a - SparseTensor, possibly not in canonical ordering. -* `sp_values`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - 1-D. `N` non-empty values corresponding to `sp_indices`. -* `sp_shape`: A `Tensor` of type `int64`. - 1-D. Shape of the input SparseTensor. -* `dense`: A `Tensor`. Must have the same type as `sp_values`. - `R`-D. The dense Tensor operand. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `sp_values`. - 1-D. The `N` values that are operated on. - - -- - - - -#### `tf.SparseTensor.__str__()` {#SparseTensor.__str__} - - - - -- - - - -#### `tf.SparseTensor.__truediv__(sp_x, y)` {#SparseTensor.__truediv__} - -Internal helper function for 'sp_t / dense_t'. - - -- - - - -#### `tf.SparseTensor.dense_shape` {#SparseTensor.dense_shape} - -A 1-D Tensor of int64 representing the shape of the dense tensor. - - -- - - - -#### `tf.SparseTensor.dtype` {#SparseTensor.dtype} - -The `DType` of elements in this tensor. - - -- - - - -#### `tf.SparseTensor.eval(feed_dict=None, session=None)` {#SparseTensor.eval} - -Evaluates this sparse tensor in a `Session`. - -Calling this method will execute all preceding operations that -produce the inputs needed for the operation that produces this -tensor. - -*N.B.* Before invoking `SparseTensor.eval()`, its graph must have been -launched in a session, and either a default session must be -available, or `session` must be specified explicitly. - -##### Args: - - -* `feed_dict`: A dictionary that maps `Tensor` objects to feed values. - See [`Session.run()`](../../api_docs/python/client.md#Session.run) for a - description of the valid feed values. -* `session`: (Optional.) The `Session` to be used to evaluate this sparse - tensor. If none, the default session will be used. - -##### Returns: - - A `SparseTensorValue` object. - - -- - - - -#### `tf.SparseTensor.from_value(cls, sparse_tensor_value)` {#SparseTensor.from_value} - - - - -- - - - -#### `tf.SparseTensor.get_shape()` {#SparseTensor.get_shape} - -Get the `TensorShape` representing the shape of the dense tensor. - -##### Returns: - - A `TensorShape` object. - - -- - - - -#### `tf.SparseTensor.graph` {#SparseTensor.graph} - -The `Graph` that contains the index, value, and dense_shape tensors. - - -- - - - -#### `tf.SparseTensor.indices` {#SparseTensor.indices} - -The indices of non-zero values in the represented dense tensor. - -##### Returns: - - A 2-D Tensor of int64 with dense_shape `[N, ndims]`, where `N` is the - number of non-zero values in the tensor, and `ndims` is the rank. - - -- - - - -#### `tf.SparseTensor.op` {#SparseTensor.op} - -The `Operation` that produces `values` as an output. - - -- - - - -#### `tf.SparseTensor.values` {#SparseTensor.values} - -The non-zero values in the represented dense tensor. - -##### Returns: - - A 1-D Tensor of any data type. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.assert_rank.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.assert_rank.md deleted file mode 100644 index 488b7519d2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.assert_rank.md +++ /dev/null @@ -1,32 +0,0 @@ -### `tf.assert_rank(x, rank, data=None, summarize=None, message=None, name=None)` {#assert_rank} - -Assert `x` has rank equal to `rank`. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_rank(x, 2)]): - output = tf.reduce_sum(x) -``` - -##### Args: - - -* `x`: Numeric `Tensor`. -* `rank`: Scalar integer `Tensor`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_rank". - -##### Returns: - - Op raising `InvalidArgumentError` unless `x` has specified rank. - If static checks determine `x` has correct rank, a `no_op` is returned. - -##### Raises: - - -* `ValueError`: If static checks determine `x` has wrong rank. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.assert_type.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.assert_type.md deleted file mode 100644 index 922d85b530..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.assert_type.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.assert_type(tensor, tf_type, message=None, name=None)` {#assert_type} - -Statically asserts that the given `Tensor` is of the specified type. - -##### Args: - - -* `tensor`: A tensorflow `Tensor`. -* `tf_type`: A tensorflow type (`dtypes.float32`, `tf.int64`, `dtypes.bool`, - etc). -* `message`: A string to prefix to the default message. -* `name`: A name to give this `Op`. Defaults to "assert_type" - -##### Raises: - - -* `TypeError`: If the tensors data type doesn't match `tf_type`. - -##### Returns: - - A `no_op` that does nothing. Type can be determined statically. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.ceil.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.ceil.md deleted file mode 100644 index 34e4a7feed..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.ceil.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.ceil(x, name=None)` {#ceil} - -Returns element-wise smallest integer in not less than x. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.check_numerics.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.check_numerics.md deleted file mode 100644 index 46a8f6f7db..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.check_numerics.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.check_numerics(tensor, message, name=None)` {#check_numerics} - -Checks a tensor for NaN and Inf values. - -When run, reports an `InvalidArgument` error if `tensor` has any values -that are not a number (NaN) or infinity (Inf). Otherwise, passes `tensor` as-is. - -##### Args: - - -* `tensor`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `message`: A `string`. Prefix of the error message. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.bayesflow.stochastic_tensor.SampleValue.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.bayesflow.stochastic_tensor.SampleValue.md deleted file mode 100644 index 5ace6653e3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.bayesflow.stochastic_tensor.SampleValue.md +++ /dev/null @@ -1,80 +0,0 @@ -Draw samples, possibly adding new outer dimensions along the way. - -This ValueType draws samples from StochasticTensors run within its -context, increasing the rank according to the requested shape. - -Examples: - -```python -mu = tf.zeros((2,3)) -sigma = tf.ones((2, 3)) -with sg.value_type(sg.SampleValue()): - st = sg.StochasticTensor( - tf.contrib.distributions.Normal, mu=mu, sigma=sigma) -# draws 1 sample and does not reshape -assertEqual(st.value().get_shape(), (2, 3)) -``` - -```python -mu = tf.zeros((2,3)) -sigma = tf.ones((2, 3)) -with sg.value_type(sg.SampleValue(4)): - st = sg.StochasticTensor( - tf.contrib.distributions.Normal, mu=mu, sigma=sigma) -# draws 4 samples each with shape (2, 3) and concatenates -assertEqual(st.value().get_shape(), (4, 2, 3)) -``` -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.SampleValue.__init__(shape=(), stop_gradient=False)` {#SampleValue.__init__} - -Sample according to shape. - -For the given StochasticTensor `st` using this value type, -the shape of `st.value()` will match that of -`st.distribution.sample(shape)`. - -##### Args: - - -* `shape`: A shape tuple or int32 tensor. The sample shape. - Default is a scalar: take one sample and do not change the size. -* `stop_gradient`: If `True`, StochasticTensors' values are wrapped in - `stop_gradient`, to avoid backpropagation through. - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.SampleValue.declare_inputs(unused_stochastic_tensor, unused_inputs_dict)` {#SampleValue.declare_inputs} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.SampleValue.popped_above(unused_value_type)` {#SampleValue.popped_above} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.SampleValue.pushed_above(unused_value_type)` {#SampleValue.pushed_above} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.SampleValue.shape` {#SampleValue.shape} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.SampleValue.stop_gradient` {#SampleValue.stop_gradient} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.bayesflow.variational_inference.ELBOForms.check_form.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.bayesflow.variational_inference.ELBOForms.check_form.md deleted file mode 100644 index e3cc3ca4fe..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.bayesflow.variational_inference.ELBOForms.check_form.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.contrib.bayesflow.variational_inference.ELBOForms.check_form(form)` {#ELBOForms.check_form} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.copy_graph.copy_op_to_graph.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.copy_graph.copy_op_to_graph.md deleted file mode 100644 index d549132fa2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.copy_graph.copy_op_to_graph.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.contrib.copy_graph.copy_op_to_graph(org_instance, to_graph, variables, scope='')` {#copy_op_to_graph} - -Given an `Operation` 'org_instance` from one `Graph`, -initializes and returns a copy of it from another `Graph`, -under the specified scope (default `""`). - -The copying is done recursively, so any `Operation` whose output -is required to evaluate the `org_instance`, is also copied (unless -already done). - -Since `Variable` instances are copied separately, those required -to evaluate `org_instance` must be provided as input. - -Args: -org_instance: An `Operation` from some `Graph`. Could be a - `Placeholder` as well. -to_graph: The `Graph` to copy `org_instance` to. -variables: An iterable of `Variable` instances to copy `org_instance` to. -scope: A scope for the new `Variable` (default `""`). - -##### Returns: - - The copied `Operation` from `to_graph`. - -##### Raises: - - -* `TypeError`: If `org_instance` is not an `Operation` or `Tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Binomial.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Binomial.md deleted file mode 100644 index 6baa4d2700..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Binomial.md +++ /dev/null @@ -1,687 +0,0 @@ -Binomial distribution. - -This distribution is parameterized by `probs`, a (batch of) probabilities for -drawing a `1` and `total_count`, the number of trials per draw from the -Binomial. - -#### Mathematical Details - -The Binomial is a distribution over the number of `1`'s in `total_count` -independent trials, with each trial having the same probability of `1`, i.e., -`probs`. - -The probability mass function (pmf) is, - -```none -pmf(k; n, p) = p**k (1 - p)**(n - k) / Z -Z = k! (n - k)! / n! -``` - -where: -* `total_count = n`, -* `probs = p`, -* `Z` is the normalizaing constant, and, -* `n!` is the factorial of `n`. - -#### Examples - -Create a single distribution, corresponding to 5 coin flips. - -```python -dist = Binomial(total_count=5., probs=.5) -``` - -Create a single distribution (using logits), corresponding to 5 coin flips. - -```python -dist = Binomial(total_count=5., logits=0.) -``` - -Creates 3 distributions with the third distribution most likely to have -successes. - -```python -p = [.2, .3, .8] -# n will be broadcast to [4., 4., 4.], to match p. -dist = Binomial(total_count=4., probs=p) -``` - -The distribution functions can be evaluated on counts. - -```python -# counts same shape as p. -counts = [1., 2, 3] -dist.prob(counts) # Shape [3] - -# p will be broadcast to [[.2, .3, .8], [.2, .3, .8]] to match counts. -counts = [[1., 2, 1], [2, 2, 4]] -dist.prob(counts) # Shape [2, 3] - -# p will be broadcast to shape [5, 7, 3] to match counts. -counts = [[...]] # Shape [5, 7, 3] -dist.prob(counts) # Shape [5, 7, 3] -``` -- - - - -#### `tf.contrib.distributions.Binomial.__init__(total_count, logits=None, probs=None, validate_args=False, allow_nan_stats=True, name='Binomial')` {#Binomial.__init__} - -Initialize a batch of Binomial distributions. - -##### Args: - - -* `total_count`: Non-negative floating point tensor with shape broadcastable - to `[N1,..., Nm]` with `m >= 0` and the same dtype as `probs` or - `logits`. Defines this as a batch of `N1 x ... x Nm` different Binomial - distributions. Its components should be equal to integer values. -* `logits`: Floating point tensor representing the log-odds of a - positive event with shape broadcastable to `[N1,..., Nm]` `m >= 0`, and - the same dtype as `total_count`. Each entry represents logits for the - probability of success for independent Binomial distributions. Only one - of `logits` or `probs` should be passed in. -* `probs`: Positive floating point tensor with shape broadcastable to - `[N1,..., Nm]` `m >= 0`, `probs in [0, 1]`. Each entry represents the - probability of success for independent Binomial distributions. Only one - of `logits` or `probs` should be passed in. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Binomial.allow_nan_stats` {#Binomial.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Binomial.batch_shape` {#Binomial.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Binomial.batch_shape_tensor(name='batch_shape_tensor')` {#Binomial.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Binomial.cdf(value, name='cdf')` {#Binomial.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Binomial.copy(**override_parameters_kwargs)` {#Binomial.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Binomial.covariance(name='covariance')` {#Binomial.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Binomial.dtype` {#Binomial.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Binomial.entropy(name='entropy')` {#Binomial.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Binomial.event_shape` {#Binomial.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Binomial.event_shape_tensor(name='event_shape_tensor')` {#Binomial.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Binomial.is_continuous` {#Binomial.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Binomial.is_scalar_batch(name='is_scalar_batch')` {#Binomial.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Binomial.is_scalar_event(name='is_scalar_event')` {#Binomial.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Binomial.log_cdf(value, name='log_cdf')` {#Binomial.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Binomial.log_prob(value, name='log_prob')` {#Binomial.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Binomial`: - -For each batch member of counts `value`, `P[value]` is the probability that -after sampling `self.total_count` draws from this Binomial distribution, the -number of successes is `value`. Since different sequences of draws can result in -the same counts, the probability includes a combinatorial coefficient. - -Note: `value` must be a non-negative tensor with dtype `dtype` and whose shape -can be broadcast with `self.probs` and `self.total_count`. `value` is only legal -if it is less than or equal to `self.total_count` and its components are equal -to integer values. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Binomial.log_survival_function(value, name='log_survival_function')` {#Binomial.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Binomial.logits` {#Binomial.logits} - -Log-odds of drawing a `1`. - - -- - - - -#### `tf.contrib.distributions.Binomial.mean(name='mean')` {#Binomial.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Binomial.mode(name='mode')` {#Binomial.mode} - -Mode. - -Additional documentation from `Binomial`: - -Note that when `(1 + total_count) * probs` is an integer, there are -actually two modes. Namely, `(1 + total_count) * probs` and -`(1 + total_count) * probs - 1` are both modes. Here we return only the -larger of the two modes. - - -- - - - -#### `tf.contrib.distributions.Binomial.name` {#Binomial.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Binomial.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Binomial.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Binomial.param_static_shapes(cls, sample_shape)` {#Binomial.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Binomial.parameters` {#Binomial.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Binomial.prob(value, name='prob')` {#Binomial.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Binomial`: - -For each batch member of counts `value`, `P[value]` is the probability that -after sampling `self.total_count` draws from this Binomial distribution, the -number of successes is `value`. Since different sequences of draws can result in -the same counts, the probability includes a combinatorial coefficient. - -Note: `value` must be a non-negative tensor with dtype `dtype` and whose shape -can be broadcast with `self.probs` and `self.total_count`. `value` is only legal -if it is less than or equal to `self.total_count` and its components are equal -to integer values. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Binomial.probs` {#Binomial.probs} - -Probability of of drawing a `1`. - - -- - - - -#### `tf.contrib.distributions.Binomial.reparameterization_type` {#Binomial.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Binomial.sample(sample_shape=(), seed=None, name='sample')` {#Binomial.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Binomial.stddev(name='stddev')` {#Binomial.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Binomial.survival_function(value, name='survival_function')` {#Binomial.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Binomial.total_count` {#Binomial.total_count} - -Number of trials. - - -- - - - -#### `tf.contrib.distributions.Binomial.validate_args` {#Binomial.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Binomial.variance(name='variance')` {#Binomial.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.DirichletMultinomial.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.DirichletMultinomial.md deleted file mode 100644 index e9d08ed6b9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.DirichletMultinomial.md +++ /dev/null @@ -1,726 +0,0 @@ -Dirichlet-Multinomial compound distribution. - -The Dirichlet-Multinomial distribution is parameterized by a (batch of) -length-`k` `concentration` vectors (`k > 1`) and a `total_count` number of -trials, i.e., the number of trials per draw from the DirichletMultinomial. It -is defined over a (batch of) length-`k` vector `counts` such that -`tf.reduce_sum(counts, -1) = total_count`. The Dirichlet-Multinomial is -identically the Beta-Binomial distribution when `k = 2`. - -#### Mathematical Details - -The Dirichlet-Multinomial is a distribution over `k`-class counts, i.e., a -length-`k` vector of non-negative integer `counts = n = [n_0, ..., n_{k-1}]`. - -The probability mass function (pmf) is, - -```none -pmf(n; alpha, N) = Beta(alpha + n) / (prod_j n_j!) / Z -Z = Beta(alpha) / N! -``` - -where: - -* `concentration = alpha = [alpha_0, ..., alpha_{k-1}]`, `alpha_j > 0`, -* `total_count = N`, `N` a positive integer, -* `N!` is `N` factorial, and, -* `Beta(x) = prod_j Gamma(x_j) / Gamma(sum_j x_j)` is the - [multivariate beta function]( - https://en.wikipedia.org/wiki/Beta_function#Multivariate_beta_function), - and, -* `Gamma` is the [gamma function]( - https://en.wikipedia.org/wiki/Gamma_function). - -Dirichlet-Multinomial is a [compound distribution]( -https://en.wikipedia.org/wiki/Compound_probability_distribution), i.e., its -samples are generated as follows. - - 1. Choose class probabilities: - `probs = [p_0,...,p_{k-1}] ~ Dir(concentration)` - 2. Draw integers: - `counts = [n_0,...,n_{k-1}] ~ Multinomial(total_count, probs)` - -The last `concentration` dimension parametrizes a single Dirichlet-Multinomial -distribution. When calling distribution functions (e.g., `dist.prob(counts)`), -`concentration`, `total_count` and `counts` are broadcast to the same shape. -The last dimension of of `counts` corresponds single Dirichlet-Multinomial -distributions. - -Distribution parameters are automatically broadcast in all functions; see -examples for details. - -#### Examples - -```python -alpha = [1, 2, 3] -n = 2 -dist = DirichletMultinomial(n, alpha) -``` - -Creates a 3-class distribution, with the 3rd class is most likely to be drawn. -The distribution functions can be evaluated on counts. - -```python -# counts same shape as alpha. -counts = [0, 0, 2] -dist.prob(counts) # Shape [] - -# alpha will be broadcast to [[1, 2, 3], [1, 2, 3]] to match counts. -counts = [[1, 1, 0], [1, 0, 1]] -dist.prob(counts) # Shape [2] - -# alpha will be broadcast to shape [5, 7, 3] to match counts. -counts = [[...]] # Shape [5, 7, 3] -dist.prob(counts) # Shape [5, 7] -``` - -Creates a 2-batch of 3-class distributions. - -```python -alpha = [[1, 2, 3], [4, 5, 6]] # Shape [2, 3] -n = [3, 3] -dist = DirichletMultinomial(n, alpha) - -# counts will be broadcast to [[2, 1, 0], [2, 1, 0]] to match alpha. -counts = [2, 1, 0] -dist.prob(counts) # Shape [2] -``` -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.__init__(total_count, concentration, validate_args=False, allow_nan_stats=True, name='DirichletMultinomial')` {#DirichletMultinomial.__init__} - -Initialize a batch of DirichletMultinomial distributions. - -##### Args: - - -* `total_count`: Non-negative floating point tensor, whose dtype is the same - as `concentration`. The shape is broadcastable to `[N1,..., Nm]` with - `m >= 0`. Defines this as a batch of `N1 x ... x Nm` different - Dirichlet multinomial distributions. Its components should be equal to - integer values. -* `concentration`: Positive floating point tensor, whose dtype is the - same as `n` with shape broadcastable to `[N1,..., Nm, k]` `m >= 0`. - Defines this as a batch of `N1 x ... x Nm` different `k` class Dirichlet - multinomial distributions. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.allow_nan_stats` {#DirichletMultinomial.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.batch_shape` {#DirichletMultinomial.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.batch_shape_tensor(name='batch_shape_tensor')` {#DirichletMultinomial.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.cdf(value, name='cdf')` {#DirichletMultinomial.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.concentration` {#DirichletMultinomial.concentration} - -Concentration parameter; expected prior counts for that coordinate. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.copy(**override_parameters_kwargs)` {#DirichletMultinomial.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.covariance(name='covariance')` {#DirichletMultinomial.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - - -Additional documentation from `DirichletMultinomial`: - -The covariance for each batch member is defined as the following: - -```none -Var(X_j) = n * alpha_j / alpha_0 * (1 - alpha_j / alpha_0) * -(n + alpha_0) / (1 + alpha_0) -``` - -where `concentration = alpha` and -`total_concentration = alpha_0 = sum_j alpha_j`. - -The covariance between elements in a batch is defined as: - -```none -Cov(X_i, X_j) = -n * alpha_i * alpha_j / alpha_0 ** 2 * -(n + alpha_0) / (1 + alpha_0) -``` - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.dtype` {#DirichletMultinomial.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.entropy(name='entropy')` {#DirichletMultinomial.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.event_shape` {#DirichletMultinomial.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.event_shape_tensor(name='event_shape_tensor')` {#DirichletMultinomial.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.is_continuous` {#DirichletMultinomial.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.is_scalar_batch(name='is_scalar_batch')` {#DirichletMultinomial.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.is_scalar_event(name='is_scalar_event')` {#DirichletMultinomial.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.log_cdf(value, name='log_cdf')` {#DirichletMultinomial.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.log_prob(value, name='log_prob')` {#DirichletMultinomial.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `DirichletMultinomial`: - -For each batch of counts, -`value = [n_0, ..., n_{k-1}]`, `P[value]` is the probability that after -sampling `self.total_count` draws from this Dirichlet-Multinomial distribution, -the number of draws falling in class `j` is `n_j`. Since this definition is -[exchangeable](https://en.wikipedia.org/wiki/Exchangeable_random_variables); -different sequences have the same counts so the probability includes a -combinatorial coefficient. - -Note: `value` must be a non-negative tensor with dtype `self.dtype`, have no -fractional components, and such that -`tf.reduce_sum(value, -1) = self.total_count`. Its shape must be broadcastable -with `self.concentration` and `self.total_count`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.log_survival_function(value, name='log_survival_function')` {#DirichletMultinomial.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.mean(name='mean')` {#DirichletMultinomial.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.mode(name='mode')` {#DirichletMultinomial.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.name` {#DirichletMultinomial.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#DirichletMultinomial.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.param_static_shapes(cls, sample_shape)` {#DirichletMultinomial.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.parameters` {#DirichletMultinomial.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.prob(value, name='prob')` {#DirichletMultinomial.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `DirichletMultinomial`: - -For each batch of counts, -`value = [n_0, ..., n_{k-1}]`, `P[value]` is the probability that after -sampling `self.total_count` draws from this Dirichlet-Multinomial distribution, -the number of draws falling in class `j` is `n_j`. Since this definition is -[exchangeable](https://en.wikipedia.org/wiki/Exchangeable_random_variables); -different sequences have the same counts so the probability includes a -combinatorial coefficient. - -Note: `value` must be a non-negative tensor with dtype `self.dtype`, have no -fractional components, and such that -`tf.reduce_sum(value, -1) = self.total_count`. Its shape must be broadcastable -with `self.concentration` and `self.total_count`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.reparameterization_type` {#DirichletMultinomial.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.sample(sample_shape=(), seed=None, name='sample')` {#DirichletMultinomial.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.stddev(name='stddev')` {#DirichletMultinomial.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.survival_function(value, name='survival_function')` {#DirichletMultinomial.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.total_concentration` {#DirichletMultinomial.total_concentration} - -Sum of last dim of concentration parameter. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.total_count` {#DirichletMultinomial.total_count} - -Number of trials used to construct a sample. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.validate_args` {#DirichletMultinomial.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.DirichletMultinomial.variance(name='variance')` {#DirichletMultinomial.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.ExpRelaxedOneHotCategorical.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.ExpRelaxedOneHotCategorical.md deleted file mode 100644 index 4a1f17a6d0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.ExpRelaxedOneHotCategorical.md +++ /dev/null @@ -1,688 +0,0 @@ -ExpRelaxedOneHotCategorical distribution with temperature and logits. - -An ExpRelaxedOneHotCategorical distribution is a log-transformed -RelaxedOneHotCategorical distribution. The RelaxedOneHotCategorical is a -distribution over random probability vectors, vectors of positive real -values that sum to one, which continuously approximates a OneHotCategorical. -The degree of approximation is controlled by a temperature: as the temperature -goes to 0 the RelaxedOneHotCategorical becomes discrete with a distribution -described by the logits, as the temperature goes to infinity the -RelaxedOneHotCategorical becomes the constant distribution that is identically -the constant vector of (1/event_size, ..., 1/event_size). - -Because computing log-probabilities of the RelaxedOneHotCategorical can -suffer from underflow issues, this class is one solution for loss -functions that depend on log-probabilities, such as the KL Divergence found -in the variational autoencoder loss. The KL divergence between two -distributions is invariant under invertible transformations, so evaluating -KL divergences of ExpRelaxedOneHotCategorical samples, which are always -followed by a `tf.exp` op, is equivalent to evaluating KL divergences of -RelaxedOneHotCategorical samples. See the appendix of Maddison et al., 2016 -for more mathematical details, where this distribution is called the -ExpConcrete. - -#### Examples - -Creates a continuous distribution, whoe exp approximates a 3-class one-hot -categorical distiribution. The 2nd class is the most likely to be the -largest component in samples drawn from this distribution. If those samples -are followed by a `tf.exp` op, then they are distributed as a relaxed onehot -categorical. - -```python -temperature = 0.5 -p = [0.1, 0.5, 0.4] -dist = ExpRelaxedOneHotCategorical(temperature, probs=p) -samples = dist.sample() -exp_samples = tf.exp(samples) -# exp_samples has the same distribution as samples from -# RelaxedOneHotCategorical(temperature, probs=p) -``` - -Creates a continuous distribution, whose exp approximates a 3-class one-hot -categorical distiribution. The 2nd class is the most likely to be the -largest component in samples drawn from this distribution. - -```python -temperature = 0.5 -logits = [-2, 2, 0] -dist = ExpRelaxedOneHotCategorical(temperature, logits=logits) -samples = dist.sample() -exp_samples = tf.exp(samples) -# exp_samples has the same distribution as samples from -# RelaxedOneHotCategorical(temperature, probs=p) -``` - -Creates a continuous distribution, whose exp approximates a 3-class one-hot -categorical distiribution. Because the temperature is very low, samples from -this distribution are almost discrete, with one component almost 0 and the -others very negative. The 2nd class is the most likely to be the largest -component in samples drawn from this distribution. - -```python -temperature = 1e-5 -logits = [-2, 2, 0] -dist = ExpRelaxedOneHotCategorical(temperature, logits=logits) -samples = dist.sample() -exp_samples = tf.exp(samples) -# exp_samples has the same distribution as samples from -# RelaxedOneHotCategorical(temperature, probs=p) -``` - -Creates a continuous distribution, whose exp approximates a 3-class one-hot -categorical distiribution. Because the temperature is very high, samples from -this distribution are usually close to the (-log(3), -log(3), -log(3)) vector. -The 2nd class is still the most likely to be the largest component -in samples drawn from this distribution. - -```python -temperature = 10 -logits = [-2, 2, 0] -dist = ExpRelaxedOneHotCategorical(temperature, logits=logits) -samples = dist.sample() -exp_samples = tf.exp(samples) -# exp_samples has the same distribution as samples from -# RelaxedOneHotCategorical(temperature, probs=p) -``` - -Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The Concrete Distribution: -A Continuous Relaxation of Discrete Random Variables. 2016. -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.__init__(temperature, logits=None, probs=None, dtype=tf.float32, validate_args=False, allow_nan_stats=True, name='ExpRelaxedOneHotCategorical')` {#ExpRelaxedOneHotCategorical.__init__} - -Initialize ExpRelaxedOneHotCategorical using class log-probabilities. - -##### Args: - - -* `temperature`: An 0-D `Tensor`, representing the temperature - of a set of ExpRelaxedCategorical distributions. The temperature should - be positive. -* `logits`: An N-D `Tensor`, `N >= 1`, representing the log probabilities - of a set of ExpRelaxedCategorical distributions. The first - `N - 1` dimensions index into a batch of independent distributions and - the last dimension represents a vector of logits for each class. Only - one of `logits` or `probs` should be passed in. -* `probs`: An N-D `Tensor`, `N >= 1`, representing the probabilities - of a set of ExpRelaxedCategorical distributions. The first - `N - 1` dimensions index into a batch of independent distributions and - the last dimension represents a vector of probabilities for each - class. Only one of `logits` or `probs` should be passed in. -* `dtype`: The type of the event samples (default: int32). -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.allow_nan_stats` {#ExpRelaxedOneHotCategorical.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.batch_shape` {#ExpRelaxedOneHotCategorical.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.batch_shape_tensor(name='batch_shape_tensor')` {#ExpRelaxedOneHotCategorical.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.cdf(value, name='cdf')` {#ExpRelaxedOneHotCategorical.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.copy(**override_parameters_kwargs)` {#ExpRelaxedOneHotCategorical.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.covariance(name='covariance')` {#ExpRelaxedOneHotCategorical.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.dtype` {#ExpRelaxedOneHotCategorical.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.entropy(name='entropy')` {#ExpRelaxedOneHotCategorical.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.event_shape` {#ExpRelaxedOneHotCategorical.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.event_shape_tensor(name='event_shape_tensor')` {#ExpRelaxedOneHotCategorical.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.event_size` {#ExpRelaxedOneHotCategorical.event_size} - -Scalar `int32` tensor: the number of classes. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.is_continuous` {#ExpRelaxedOneHotCategorical.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.is_scalar_batch(name='is_scalar_batch')` {#ExpRelaxedOneHotCategorical.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.is_scalar_event(name='is_scalar_event')` {#ExpRelaxedOneHotCategorical.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.log_cdf(value, name='log_cdf')` {#ExpRelaxedOneHotCategorical.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.log_prob(value, name='log_prob')` {#ExpRelaxedOneHotCategorical.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.log_survival_function(value, name='log_survival_function')` {#ExpRelaxedOneHotCategorical.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.logits` {#ExpRelaxedOneHotCategorical.logits} - -Vector of coordinatewise logits. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.mean(name='mean')` {#ExpRelaxedOneHotCategorical.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.mode(name='mode')` {#ExpRelaxedOneHotCategorical.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.name` {#ExpRelaxedOneHotCategorical.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#ExpRelaxedOneHotCategorical.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.param_static_shapes(cls, sample_shape)` {#ExpRelaxedOneHotCategorical.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.parameters` {#ExpRelaxedOneHotCategorical.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.prob(value, name='prob')` {#ExpRelaxedOneHotCategorical.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.probs` {#ExpRelaxedOneHotCategorical.probs} - -Vector of probabilities summing to one. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.reparameterization_type` {#ExpRelaxedOneHotCategorical.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.sample(sample_shape=(), seed=None, name='sample')` {#ExpRelaxedOneHotCategorical.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.stddev(name='stddev')` {#ExpRelaxedOneHotCategorical.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.survival_function(value, name='survival_function')` {#ExpRelaxedOneHotCategorical.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.temperature` {#ExpRelaxedOneHotCategorical.temperature} - -Batchwise temperature tensor of a RelaxedCategorical. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.validate_args` {#ExpRelaxedOneHotCategorical.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.ExpRelaxedOneHotCategorical.variance(name='variance')` {#ExpRelaxedOneHotCategorical.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Exponential.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Exponential.md deleted file mode 100644 index 6ce65a7b2f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Exponential.md +++ /dev/null @@ -1,608 +0,0 @@ -Exponential distribution. - -The Exponential distribution is parameterized by an event `rate` parameter. - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; lambda, x > 0) = exp(-lambda x) / Z -Z = 1 / lambda -``` - -where `rate = lambda` and `Z` is the normalizaing constant. - -The Exponential distribution is a special case of the Gamma distribution, -i.e., - -```python -Exponential(rate) = Gamma(concentration=1., rate) -``` - -The Exponential distribution uses a `rate` parameter, or "inverse scale", -which can be intuited as, - -```none -X ~ Exponential(rate=1) -Y = X / rate -``` -- - - - -#### `tf.contrib.distributions.Exponential.__init__(rate, validate_args=False, allow_nan_stats=True, name='Exponential')` {#Exponential.__init__} - -Construct Exponential distribution with parameter `rate`. - -##### Args: - - -* `rate`: Floating point tensor, equivalent to `1 / mean`. Must contain only - positive values. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Exponential.allow_nan_stats` {#Exponential.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Exponential.batch_shape` {#Exponential.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Exponential.batch_shape_tensor(name='batch_shape_tensor')` {#Exponential.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Exponential.cdf(value, name='cdf')` {#Exponential.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Exponential.concentration` {#Exponential.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.Exponential.copy(**override_parameters_kwargs)` {#Exponential.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Exponential.covariance(name='covariance')` {#Exponential.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Exponential.dtype` {#Exponential.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Exponential.entropy(name='entropy')` {#Exponential.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Exponential.event_shape` {#Exponential.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Exponential.event_shape_tensor(name='event_shape_tensor')` {#Exponential.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Exponential.is_continuous` {#Exponential.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Exponential.is_scalar_batch(name='is_scalar_batch')` {#Exponential.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Exponential.is_scalar_event(name='is_scalar_event')` {#Exponential.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Exponential.log_cdf(value, name='log_cdf')` {#Exponential.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Exponential.log_prob(value, name='log_prob')` {#Exponential.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Exponential.log_survival_function(value, name='log_survival_function')` {#Exponential.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Exponential.mean(name='mean')` {#Exponential.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Exponential.mode(name='mode')` {#Exponential.mode} - -Mode. - -Additional documentation from `Gamma`: - -The mode of a gamma distribution is `(shape - 1) / rate` when -`shape > 1`, and `NaN` otherwise. If `self.allow_nan_stats` is `False`, -an exception will be raised rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.Exponential.name` {#Exponential.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Exponential.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Exponential.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Exponential.param_static_shapes(cls, sample_shape)` {#Exponential.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Exponential.parameters` {#Exponential.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Exponential.prob(value, name='prob')` {#Exponential.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Exponential.rate` {#Exponential.rate} - - - - -- - - - -#### `tf.contrib.distributions.Exponential.reparameterization_type` {#Exponential.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Exponential.sample(sample_shape=(), seed=None, name='sample')` {#Exponential.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Exponential.stddev(name='stddev')` {#Exponential.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Exponential.survival_function(value, name='survival_function')` {#Exponential.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Exponential.validate_args` {#Exponential.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Exponential.variance(name='variance')` {#Exponential.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Gamma.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Gamma.md deleted file mode 100644 index 78246d36f8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Gamma.md +++ /dev/null @@ -1,639 +0,0 @@ -Gamma distribution. - -The Gamma distribution is defined over positive real numbers using -parameters `concentration` (aka "alpha") and `rate` (aka "beta"). - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; alpha, beta, x > 0) = x**(alpha - 1) exp(-x beta) / Z -Z = Gamma(alpha) beta**alpha -``` - -where: - -* `concentration = alpha`, `alpha > 0`, -* `rate = beta`, `beta > 0`, -* `Z` is the normalizing constant, and, -* `Gamma` is the [gamma function]( - https://en.wikipedia.org/wiki/Gamma_function). - -The cumulative density function (cdf) is, - -```none -cdf(x; alpha, beta, x > 0) = GammaInc(alpha, beta x) / Gamma(alpha) -``` - -where `GammaInc` is the [lower incomplete Gamma function]( -https://en.wikipedia.org/wiki/Incomplete_gamma_function). - -The parameters can be intuited via their relationship to mean and stddev, - -```none -concentration = alpha = (mean / stddev)**2 -rate = beta = mean / stddev**2 = concentration / mean -``` - -Distribution parameters are automatically broadcast in all functions; see -examples for details. - -WARNING: This distribution may draw 0-valued samples for small `concentration` -values. See note in `tf.random_gamma` docstring. - -#### Examples - -```python -dist = Gamma(concentration=3.0, rate=2.0) -dist2 = Gamma(concentration=[3.0, 4.0], rate=[2.0, 3.0]) -``` -- - - - -#### `tf.contrib.distributions.Gamma.__init__(concentration, rate, validate_args=False, allow_nan_stats=True, name='Gamma')` {#Gamma.__init__} - -Construct Gamma with `concentration` and `rate` parameters. - -The parameters `concentration` and `rate` must be shaped in a way that -supports broadcasting (e.g. `concentration + rate` is a valid operation). - -##### Args: - - -* `concentration`: Floating point tensor, the concentration params of the - distribution(s). Must contain only positive values. -* `rate`: Floating point tensor, the inverse scale params of the - distribution(s). Must contain only positive values. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `TypeError`: if `concentration` and `rate` are different dtypes. - - -- - - - -#### `tf.contrib.distributions.Gamma.allow_nan_stats` {#Gamma.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Gamma.batch_shape` {#Gamma.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Gamma.batch_shape_tensor(name='batch_shape_tensor')` {#Gamma.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Gamma.cdf(value, name='cdf')` {#Gamma.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Gamma.concentration` {#Gamma.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.Gamma.copy(**override_parameters_kwargs)` {#Gamma.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Gamma.covariance(name='covariance')` {#Gamma.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Gamma.dtype` {#Gamma.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Gamma.entropy(name='entropy')` {#Gamma.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Gamma.event_shape` {#Gamma.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Gamma.event_shape_tensor(name='event_shape_tensor')` {#Gamma.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Gamma.is_continuous` {#Gamma.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Gamma.is_scalar_batch(name='is_scalar_batch')` {#Gamma.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Gamma.is_scalar_event(name='is_scalar_event')` {#Gamma.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Gamma.log_cdf(value, name='log_cdf')` {#Gamma.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Gamma.log_prob(value, name='log_prob')` {#Gamma.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Gamma.log_survival_function(value, name='log_survival_function')` {#Gamma.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Gamma.mean(name='mean')` {#Gamma.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Gamma.mode(name='mode')` {#Gamma.mode} - -Mode. - -Additional documentation from `Gamma`: - -The mode of a gamma distribution is `(shape - 1) / rate` when -`shape > 1`, and `NaN` otherwise. If `self.allow_nan_stats` is `False`, -an exception will be raised rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.Gamma.name` {#Gamma.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Gamma.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Gamma.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Gamma.param_static_shapes(cls, sample_shape)` {#Gamma.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Gamma.parameters` {#Gamma.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Gamma.prob(value, name='prob')` {#Gamma.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Gamma.rate` {#Gamma.rate} - -Rate parameter. - - -- - - - -#### `tf.contrib.distributions.Gamma.reparameterization_type` {#Gamma.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Gamma.sample(sample_shape=(), seed=None, name='sample')` {#Gamma.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Gamma.stddev(name='stddev')` {#Gamma.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Gamma.survival_function(value, name='survival_function')` {#Gamma.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Gamma.validate_args` {#Gamma.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Gamma.variance(name='variance')` {#Gamma.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.InverseGamma.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.InverseGamma.md deleted file mode 100644 index e908ceac08..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.InverseGamma.md +++ /dev/null @@ -1,653 +0,0 @@ -InverseGamma distribution. - -The `InverseGamma` distribution is defined over positive real numbers using -parameters `concentration` (aka "alpha") and `rate` (aka "beta"). - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; alpha, beta, x > 0) = x**(-alpha - 1) exp(-beta / x) / Z -Z = Gamma(alpha) beta**-alpha -``` - -where: - -* `concentration = alpha`, -* `rate = beta`, -* `Z` is the normalizing constant, and, -* `Gamma` is the [gamma function]( - https://en.wikipedia.org/wiki/Gamma_function). - -The cumulative density function (cdf) is, - -```none -cdf(x; alpha, beta, x > 0) = GammaInc(alpha, beta / x) / Gamma(alpha) -``` - -where `GammaInc` is the [upper incomplete Gamma function]( -https://en.wikipedia.org/wiki/Incomplete_gamma_function). - -The parameters can be intuited via their relationship to mean and stddev, - -```none -concentration = alpha = (mean / stddev)**2 -rate = beta = mean / stddev**2 -``` - -Distribution parameters are automatically broadcast in all functions; see -examples for details. - -WARNING: This distribution may draw 0-valued samples for small concentration -values. See note in `tf.random_gamma` docstring. - -#### Examples - -```python -dist = InverseGamma(concentration=3.0, rate=2.0) -dist2 = InverseGamma(concentration=[3.0, 4.0], rate=[2.0, 3.0]) -``` -- - - - -#### `tf.contrib.distributions.InverseGamma.__init__(concentration, rate, validate_args=False, allow_nan_stats=True, name='InverseGamma')` {#InverseGamma.__init__} - -Construct InverseGamma with `concentration` and `rate` parameters. - -The parameters `concentration` and `rate` must be shaped in a way that -supports broadcasting (e.g. `concentration + rate` is a valid operation). - -##### Args: - - -* `concentration`: Floating point tensor, the concentration params of the - distribution(s). Must contain only positive values. -* `rate`: Floating point tensor, the inverse scale params of the - distribution(s). Must contain only positive values. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -##### Raises: - - -* `TypeError`: if `concentration` and `rate` are different dtypes. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.allow_nan_stats` {#InverseGamma.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.batch_shape` {#InverseGamma.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.batch_shape_tensor(name='batch_shape_tensor')` {#InverseGamma.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.cdf(value, name='cdf')` {#InverseGamma.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.concentration` {#InverseGamma.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.copy(**override_parameters_kwargs)` {#InverseGamma.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.covariance(name='covariance')` {#InverseGamma.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.dtype` {#InverseGamma.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.entropy(name='entropy')` {#InverseGamma.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.event_shape` {#InverseGamma.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.event_shape_tensor(name='event_shape_tensor')` {#InverseGamma.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.is_continuous` {#InverseGamma.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.InverseGamma.is_scalar_batch(name='is_scalar_batch')` {#InverseGamma.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.is_scalar_event(name='is_scalar_event')` {#InverseGamma.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.log_cdf(value, name='log_cdf')` {#InverseGamma.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.log_prob(value, name='log_prob')` {#InverseGamma.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.log_survival_function(value, name='log_survival_function')` {#InverseGamma.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.mean(name='mean')` {#InverseGamma.mean} - -Mean. - -Additional documentation from `InverseGamma`: - -The mean of an inverse gamma distribution is -`rate / (concentration - 1)`, when `concentration > 1`, and `NaN` -otherwise. If `self.allow_nan_stats` is `False`, an exception will be -raised rather than returning `NaN` - - -- - - - -#### `tf.contrib.distributions.InverseGamma.mode(name='mode')` {#InverseGamma.mode} - -Mode. - -Additional documentation from `InverseGamma`: - -The mode of an inverse gamma distribution is `rate / (concentration + -1)`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.name` {#InverseGamma.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#InverseGamma.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.param_static_shapes(cls, sample_shape)` {#InverseGamma.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.parameters` {#InverseGamma.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.prob(value, name='prob')` {#InverseGamma.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.rate` {#InverseGamma.rate} - -Rate parameter. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.reparameterization_type` {#InverseGamma.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.sample(sample_shape=(), seed=None, name='sample')` {#InverseGamma.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.stddev(name='stddev')` {#InverseGamma.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.survival_function(value, name='survival_function')` {#InverseGamma.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.validate_args` {#InverseGamma.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.InverseGamma.variance(name='variance')` {#InverseGamma.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - - -Additional documentation from `InverseGamma`: - -Variance for inverse gamma is defined only for `concentration > 2`. If -`self.allow_nan_stats` is `False`, an exception will be raised rather -than returning `NaN`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Multinomial.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Multinomial.md deleted file mode 100644 index 796aece469..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.Multinomial.md +++ /dev/null @@ -1,697 +0,0 @@ -Multinomial distribution. - -This Multinomial distribution is parameterized by `probs`, a (batch of) -length-`k` `prob` (probability) vectors (`k > 1`) such that -`tf.reduce_sum(probs, -1) = 1`, and a `total_count` number of trials, i.e., -the number of trials per draw from the Multinomial. It is defined over a -(batch of) length-`k` vector `counts` such that -`tf.reduce_sum(counts, -1) = total_count`. The Multinomial is identically the -Binomial distribution when `k = 2`. - -#### Mathematical Details - -The Multinomial is a distribution over `k`-class counts, i.e., a length-`k` -vector of non-negative integer `counts = n = [n_0, ..., n_{k-1}]`. - -The probability mass function (pmf) is, - -```none -pmf(n; pi, N) = prod_j (pi_j)**n_j / Z -Z = (prod_j n_j!) / N! -``` - -where: -* `probs = pi = [pi_0, ..., pi_{k-1}]`, `pi_j > 0`, `sum_j pi_j = 1`, -* `total_count = N`, `N` a positive integer, -* `Z` is the normalization constant, and, -* `N!` denotes `N` factorial. - -Distribution parameters are automatically broadcast in all functions; see -examples for details. - -#### Examples - -Create a 3-class distribution, with the 3rd class is most likely to be drawn, -using logits. - -```python -logits = [-50., -43, 0] -dist = Multinomial(total_count=4., logits=logits) -``` - -Create a 3-class distribution, with the 3rd class is most likely to be drawn. - -```python -p = [.2, .3, .5] -dist = Multinomial(total_count=4., probs=p) -``` - -The distribution functions can be evaluated on counts. - -```python -# counts same shape as p. -counts = [1., 0, 3] -dist.prob(counts) # Shape [] - -# p will be broadcast to [[.2, .3, .5], [.2, .3, .5]] to match counts. -counts = [[1., 2, 1], [2, 2, 0]] -dist.prob(counts) # Shape [2] - -# p will be broadcast to shape [5, 7, 3] to match counts. -counts = [[...]] # Shape [5, 7, 3] -dist.prob(counts) # Shape [5, 7] -``` - -Create a 2-batch of 3-class distributions. - -```python -p = [[.1, .2, .7], [.3, .3, .4]] # Shape [2, 3] -dist = Multinomial(total_count=[4., 5], probs=p) - -counts = [[2., 1, 1], [3, 1, 1]] -dist.prob(counts) # Shape [2] -``` -- - - - -#### `tf.contrib.distributions.Multinomial.__init__(total_count, logits=None, probs=None, validate_args=False, allow_nan_stats=True, name='Multinomial')` {#Multinomial.__init__} - -Initialize a batch of Multinomial distributions. - -##### Args: - - -* `total_count`: Non-negative floating point tensor with shape broadcastable - to `[N1,..., Nm]` with `m >= 0`. Defines this as a batch of - `N1 x ... x Nm` different Multinomial distributions. Its components - should be equal to integer values. -* `logits`: Floating point tensor representing the log-odds of a - positive event with shape broadcastable to `[N1,..., Nm, k], m >= 0`, - and the same dtype as `total_count`. Defines this as a batch of - `N1 x ... x Nm` different `k` class Multinomial distributions. Only one - of `logits` or `probs` should be passed in. -* `probs`: Positive floating point tensor with shape broadcastable to - `[N1,..., Nm, k]` `m >= 0` and same dtype as `total_count`. Defines - this as a batch of `N1 x ... x Nm` different `k` class Multinomial - distributions. `probs`'s components in the last portion of its shape - should sum to `1`. Only one of `logits` or `probs` should be passed in. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Multinomial.allow_nan_stats` {#Multinomial.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.batch_shape` {#Multinomial.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Multinomial.batch_shape_tensor(name='batch_shape_tensor')` {#Multinomial.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.cdf(value, name='cdf')` {#Multinomial.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.copy(**override_parameters_kwargs)` {#Multinomial.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.covariance(name='covariance')` {#Multinomial.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.dtype` {#Multinomial.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.entropy(name='entropy')` {#Multinomial.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Multinomial.event_shape` {#Multinomial.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Multinomial.event_shape_tensor(name='event_shape_tensor')` {#Multinomial.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.is_continuous` {#Multinomial.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Multinomial.is_scalar_batch(name='is_scalar_batch')` {#Multinomial.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.is_scalar_event(name='is_scalar_event')` {#Multinomial.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.log_cdf(value, name='log_cdf')` {#Multinomial.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.log_prob(value, name='log_prob')` {#Multinomial.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Multinomial`: - -For each batch of counts, `value = [n_0, ... -,n_{k-1}]`, `P[value]` is the probability that after sampling `self.total_count` -draws from this Multinomial distribution, the number of draws falling in class -`j` is `n_j`. Since this definition is [exchangeable]( -https://en.wikipedia.org/wiki/Exchangeable_random_variables); different -sequences have the same counts so the probability includes a combinatorial -coefficient. - -Note: `value` must be a non-negative tensor with dtype `self.dtype`, have no -fractional components, and such that -`tf.reduce_sum(value, -1) = self.total_count`. Its shape must be broadcastable -with `self.probs` and `self.total_count`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.log_survival_function(value, name='log_survival_function')` {#Multinomial.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.logits` {#Multinomial.logits} - -Vector of coordinatewise logits. - - -- - - - -#### `tf.contrib.distributions.Multinomial.mean(name='mean')` {#Multinomial.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Multinomial.mode(name='mode')` {#Multinomial.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Multinomial.name` {#Multinomial.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Multinomial.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Multinomial.param_static_shapes(cls, sample_shape)` {#Multinomial.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Multinomial.parameters` {#Multinomial.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.prob(value, name='prob')` {#Multinomial.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Multinomial`: - -For each batch of counts, `value = [n_0, ... -,n_{k-1}]`, `P[value]` is the probability that after sampling `self.total_count` -draws from this Multinomial distribution, the number of draws falling in class -`j` is `n_j`. Since this definition is [exchangeable]( -https://en.wikipedia.org/wiki/Exchangeable_random_variables); different -sequences have the same counts so the probability includes a combinatorial -coefficient. - -Note: `value` must be a non-negative tensor with dtype `self.dtype`, have no -fractional components, and such that -`tf.reduce_sum(value, -1) = self.total_count`. Its shape must be broadcastable -with `self.probs` and `self.total_count`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.probs` {#Multinomial.probs} - -Probability of of drawing a `1` in that coordinate. - - -- - - - -#### `tf.contrib.distributions.Multinomial.reparameterization_type` {#Multinomial.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.sample(sample_shape=(), seed=None, name='sample')` {#Multinomial.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.stddev(name='stddev')` {#Multinomial.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.survival_function(value, name='survival_function')` {#Multinomial.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Multinomial.total_count` {#Multinomial.total_count} - -Number of trials used to construct a sample. - - -- - - - -#### `tf.contrib.distributions.Multinomial.validate_args` {#Multinomial.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Multinomial.variance(name='variance')` {#Multinomial.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.NormalWithSoftplusScale.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.NormalWithSoftplusScale.md deleted file mode 100644 index b9d6592fdb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.NormalWithSoftplusScale.md +++ /dev/null @@ -1,559 +0,0 @@ -Normal with softplus applied to `scale`. -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.__init__(loc, scale, validate_args=False, allow_nan_stats=True, name='NormalWithSoftplusScale')` {#NormalWithSoftplusScale.__init__} - - - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.allow_nan_stats` {#NormalWithSoftplusScale.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.batch_shape` {#NormalWithSoftplusScale.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.batch_shape_tensor(name='batch_shape_tensor')` {#NormalWithSoftplusScale.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.cdf(value, name='cdf')` {#NormalWithSoftplusScale.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.copy(**override_parameters_kwargs)` {#NormalWithSoftplusScale.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.covariance(name='covariance')` {#NormalWithSoftplusScale.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.dtype` {#NormalWithSoftplusScale.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.entropy(name='entropy')` {#NormalWithSoftplusScale.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.event_shape` {#NormalWithSoftplusScale.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.event_shape_tensor(name='event_shape_tensor')` {#NormalWithSoftplusScale.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.is_continuous` {#NormalWithSoftplusScale.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.is_scalar_batch(name='is_scalar_batch')` {#NormalWithSoftplusScale.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.is_scalar_event(name='is_scalar_event')` {#NormalWithSoftplusScale.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.loc` {#NormalWithSoftplusScale.loc} - -Distribution parameter for the mean. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.log_cdf(value, name='log_cdf')` {#NormalWithSoftplusScale.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.log_prob(value, name='log_prob')` {#NormalWithSoftplusScale.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.log_survival_function(value, name='log_survival_function')` {#NormalWithSoftplusScale.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.mean(name='mean')` {#NormalWithSoftplusScale.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.mode(name='mode')` {#NormalWithSoftplusScale.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.name` {#NormalWithSoftplusScale.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#NormalWithSoftplusScale.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.param_static_shapes(cls, sample_shape)` {#NormalWithSoftplusScale.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.parameters` {#NormalWithSoftplusScale.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.prob(value, name='prob')` {#NormalWithSoftplusScale.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.reparameterization_type` {#NormalWithSoftplusScale.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.sample(sample_shape=(), seed=None, name='sample')` {#NormalWithSoftplusScale.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.scale` {#NormalWithSoftplusScale.scale} - -Distribution parameter for standard deviation. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.stddev(name='stddev')` {#NormalWithSoftplusScale.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.survival_function(value, name='survival_function')` {#NormalWithSoftplusScale.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.validate_args` {#NormalWithSoftplusScale.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.NormalWithSoftplusScale.variance(name='variance')` {#NormalWithSoftplusScale.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.OneHotCategorical.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.OneHotCategorical.md deleted file mode 100644 index 6cf39c39de..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.distributions.OneHotCategorical.md +++ /dev/null @@ -1,637 +0,0 @@ -OneHotCategorical distribution. - -The categorical distribution is parameterized by the log-probabilities -of a set of classes. The difference between OneHotCategorical and Categorical -distributions is that OneHotCategorical is a discrete distribution over -one-hot bit vectors whereas Categorical is a discrete distribution over -positive integers. OneHotCategorical is equivalent to Categorical except -Categorical has event_dim=() while OneHotCategorical has event_dim=K, where -K is the number of classes. - -This class provides methods to create indexed batches of OneHotCategorical -distributions. If the provided `logits` or `probs` is rank 2 or higher, for -every fixed set of leading dimensions, the last dimension represents one -single OneHotCategorical distribution. When calling distribution -functions (e.g. `dist.prob(x)`), `logits` and `x` are broadcast to the -same shape (if possible). In all cases, the last dimension of `logits,x` -represents single OneHotCategorical distributions. - -#### Examples - -Creates a 3-class distiribution, with the 2nd class, the most likely to be -drawn from. - -```python -p = [0.1, 0.5, 0.4] -dist = OneHotCategorical(probs=p) -``` - -Creates a 3-class distiribution, with the 2nd class the most likely to be -drawn from, using logits. - -```python -logits = [-2, 2, 0] -dist = OneHotCategorical(logits=logits) -``` - -Creates a 3-class distribution, with the 3rd class is most likely to be drawn. - -```python -# counts is a scalar. -p = [0.1, 0.4, 0.5] -dist = OneHotCategorical(probs=p) -dist.prob([0,1,0]) # Shape [] - -# p will be broadcast to [[0.1, 0.4, 0.5], [0.1, 0.4, 0.5]] to match. -samples = [[0,1,0], [1,0,0]] -dist.prob(samples) # Shape [2] -``` -- - - - -#### `tf.contrib.distributions.OneHotCategorical.__init__(logits=None, probs=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='OneHotCategorical')` {#OneHotCategorical.__init__} - -Initialize OneHotCategorical distributions using class log-probabilities. - -##### Args: - - -* `logits`: An N-D `Tensor`, `N >= 1`, representing the log probabilities of a - set of Categorical distributions. The first `N - 1` dimensions index - into a batch of independent distributions and the last dimension - represents a vector of logits for each class. Only one of `logits` or - `probs` should be passed in. -* `probs`: An N-D `Tensor`, `N >= 1`, representing the probabilities of a set - of Categorical distributions. The first `N - 1` dimensions index into a - batch of independent distributions and the last dimension represents a - vector of probabilities for each class. Only one of `logits` or `probs` - should be passed in. -* `dtype`: The type of the event samples (default: int32). -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.allow_nan_stats` {#OneHotCategorical.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.batch_shape` {#OneHotCategorical.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.batch_shape_tensor(name='batch_shape_tensor')` {#OneHotCategorical.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.cdf(value, name='cdf')` {#OneHotCategorical.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.copy(**override_parameters_kwargs)` {#OneHotCategorical.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.covariance(name='covariance')` {#OneHotCategorical.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.dtype` {#OneHotCategorical.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.entropy(name='entropy')` {#OneHotCategorical.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.event_shape` {#OneHotCategorical.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.event_shape_tensor(name='event_shape_tensor')` {#OneHotCategorical.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.event_size` {#OneHotCategorical.event_size} - -Scalar `int32` tensor: the number of classes. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.is_continuous` {#OneHotCategorical.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.is_scalar_batch(name='is_scalar_batch')` {#OneHotCategorical.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.is_scalar_event(name='is_scalar_event')` {#OneHotCategorical.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.log_cdf(value, name='log_cdf')` {#OneHotCategorical.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.log_prob(value, name='log_prob')` {#OneHotCategorical.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.log_survival_function(value, name='log_survival_function')` {#OneHotCategorical.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.logits` {#OneHotCategorical.logits} - -Vector of coordinatewise logits. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.mean(name='mean')` {#OneHotCategorical.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.mode(name='mode')` {#OneHotCategorical.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.name` {#OneHotCategorical.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#OneHotCategorical.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.param_static_shapes(cls, sample_shape)` {#OneHotCategorical.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.parameters` {#OneHotCategorical.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.prob(value, name='prob')` {#OneHotCategorical.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.probs` {#OneHotCategorical.probs} - -Vector of coordinatewise probabilities. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.reparameterization_type` {#OneHotCategorical.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.sample(sample_shape=(), seed=None, name='sample')` {#OneHotCategorical.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.stddev(name='stddev')` {#OneHotCategorical.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.survival_function(value, name='survival_function')` {#OneHotCategorical.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.validate_args` {#OneHotCategorical.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.OneHotCategorical.variance(name='variance')` {#OneHotCategorical.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.ffmpeg.encode_audio.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.ffmpeg.encode_audio.md deleted file mode 100644 index fb9d958f26..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.ffmpeg.encode_audio.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.contrib.ffmpeg.encode_audio(audio, file_format=None, samples_per_second=None)` {#encode_audio} - -Creates an op that encodes an audio file using sampled audio from a tensor. - -##### Args: - - -* `audio`: A rank 2 tensor that has time along dimension 0 and channels along - dimension 1. Dimension 0 is `samples_per_second * length` long in - seconds. -* `file_format`: The type of file to encode. "wav" is the only supported format. -* `samples_per_second`: The number of samples in the audio tensor per second of - audio. - -##### Returns: - - A scalar tensor that contains the encoded audio in the specified file - format. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.framework.add_model_variable.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.framework.add_model_variable.md deleted file mode 100644 index 45944baf03..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.framework.add_model_variable.md +++ /dev/null @@ -1,9 +0,0 @@ -### `tf.contrib.framework.add_model_variable(var)` {#add_model_variable} - -Adds a variable to the `GraphKeys.MODEL_VARIABLES` collection. - -##### Args: - - -* `var`: a variable. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.framework.get_model_variables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.framework.get_model_variables.md deleted file mode 100644 index 078140ccb6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.framework.get_model_variables.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.contrib.framework.get_model_variables(scope=None, suffix=None)` {#get_model_variables} - -Gets the list of model variables, filtered by scope and/or suffix. - -##### Args: - - -* `scope`: an optional scope for filtering the variables to return. -* `suffix`: an optional suffix for filtering the variables to return. - -##### Returns: - - a list of variables in collection with scope and suffix. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.framework.local_variable.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.framework.local_variable.md deleted file mode 100644 index ac0abb46ad..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.framework.local_variable.md +++ /dev/null @@ -1,15 +0,0 @@ -### `tf.contrib.framework.local_variable(initial_value, validate_shape=True, name=None)` {#local_variable} - -Create variable and add it to `GraphKeys.LOCAL_VARIABLES` collection. - -##### Args: - - -* `initial_value`: See variables.Variable.__init__. -* `validate_shape`: See variables.Variable.__init__. -* `name`: See variables.Variable.__init__. - -##### Returns: - - New variable. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.copy_op_handler.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.copy_op_handler.md deleted file mode 100644 index 1ea461dd9e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.copy_op_handler.md +++ /dev/null @@ -1,15 +0,0 @@ -### `tf.contrib.graph_editor.copy_op_handler(info, op, copy_shape=True)` {#copy_op_handler} - -Copy a `tf.Operation`. - -##### Args: - - -* `info`: Transform._TmpInfo instance. -* `op`: the `tf.Operation` to be copied. -* `copy_shape`: also copy the shape of the tensor - -##### Returns: - - A `(op, op_outputs)` tuple containgin the transformed op and its outputs. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.detach_outputs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.detach_outputs.md deleted file mode 100644 index 922d905c82..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.detach_outputs.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.contrib.graph_editor.detach_outputs(sgv, control_outputs=None)` {#detach_outputs} - -Detach the output of a subgraph view. - -##### Args: - - -* `sgv`: the subgraph view to be detached. This argument is converted to a - subgraph using the same rules as the function subgraph.make_view. - Note that sgv is modified in place. -* `control_outputs`: a util.ControlOutputs instance or None. If not None the - control outputs are also detached. - -##### Returns: - - A tuple `(sgv, output_placeholders)` where - `sgv` is a new subgraph view of the detached subgraph; - `output_placeholders` is a list of the created output placeholders. - -##### Raises: - - -* `StandardError`: if sgv cannot be converted to a SubGraphView using - the same rules than the function subgraph.make_view. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.filter_ops_from_regex.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.filter_ops_from_regex.md deleted file mode 100644 index 41332dfdba..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.filter_ops_from_regex.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.contrib.graph_editor.filter_ops_from_regex(ops, regex)` {#filter_ops_from_regex} - -Get all the operations that match the given regex. - -##### Args: - - -* `ops`: an object convertible to a list of `tf.Operation`. -* `regex`: a regular expression matching the operation's name. - For example, `"^foo(/.*)?$"` will match all the operations in the "foo" - scope. - -##### Returns: - - A list of `tf.Operation`. - -##### Raises: - - -* `TypeError`: if ops cannot be converted to a list of `tf.Operation`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.filter_ts.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.filter_ts.md deleted file mode 100644 index ef4764bc2c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.filter_ts.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.contrib.graph_editor.filter_ts(ops, positive_filter)` {#filter_ts} - -Get all the tensors which are input or output of an op in ops. - -##### Args: - - -* `ops`: an object convertible to a list of `tf.Operation`. -* `positive_filter`: a function deciding whether to keep a tensor or not. - If `True`, all the tensors are returned. - -##### Returns: - - A list of `tf.Tensor`. - -##### Raises: - - -* `TypeError`: if ops cannot be converted to a list of `tf.Operation`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.op_type.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.op_type.md deleted file mode 100644 index bbf3dfc4c7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.op_type.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.contrib.graph_editor.op_type(op_types, op=None)` {#op_type} - -Check if an op is of the given type. - -##### Args: - - -* `op_types`: tuple of strings containing the types to check against. - For instance: ("Add", "Const") -* `op`: the operation to check (or None). - -##### Returns: - - if op is not None, return True if the op is of the correct type. - if op is None, return a lambda function which does the type checking. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.reroute_inputs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.reroute_inputs.md deleted file mode 100644 index 91c1d91008..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.reroute_inputs.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.graph_editor.reroute_inputs(sgv0, sgv1)` {#reroute_inputs} - -Re-route all the inputs of sgv0 to sgv1 (see reroute_inputs). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.select_ts.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.select_ts.md deleted file mode 100644 index a37e0948c8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.select_ts.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.contrib.graph_editor.select_ts(*args, **kwargs)` {#select_ts} - -Helper to select tensors. - -##### Args: - - -* `*args`: list of 1) regular expressions (compiled or not) or 2) (array of) - `tf.Tensor`. `tf.Operation` instances are silently ignored. -* `**kwargs`: 'graph': `tf.Graph` in which to perform the regex query.This is - required when using regex. - 'positive_filter': an elem if selected only if `positive_filter(elem)` is - `True`. This is optional. - 'restrict_ts_regex': a regular expression is ignored if it doesn't start - with the substring "(?#ts)". - -##### Returns: - - A list of `tf.Tensor`. - -##### Raises: - - -* `TypeError`: if the optional keyword argument graph is not a `tf.Graph` - or if an argument in args is not an (array of) `tf.Tensor` - or an (array of) `tf.Operation` (silently ignored) or a string - or a regular expression. -* `ValueError`: if one of the keyword arguments is unexpected or if a regular - expression is used without passing a graph as a keyword argument. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.swap_outputs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.swap_outputs.md deleted file mode 100644 index 31ed5df8d4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.graph_editor.swap_outputs.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.graph_editor.swap_outputs(sgv0, sgv1)` {#swap_outputs} - -Swap all the outputs of sgv0 and sgv1 (see _reroute_outputs). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.crossed_column.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.crossed_column.md deleted file mode 100644 index a7ca34c986..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.crossed_column.md +++ /dev/null @@ -1,42 +0,0 @@ -### `tf.contrib.layers.crossed_column(columns, hash_bucket_size, combiner='sum', ckpt_to_load_from=None, tensor_name_in_ckpt=None, hash_key=None)` {#crossed_column} - -Creates a _CrossedColumn for performing feature crosses. - -##### Args: - - -* `columns`: An iterable of _FeatureColumn. Items can be an instance of - _SparseColumn, _CrossedColumn, or _BucketizedColumn. -* `hash_bucket_size`: An int that is > 1. The number of buckets. -* `combiner`: A string specifying how to reduce if there are multiple entries - in a single row. Currently "mean", "sqrtn" and "sum" are supported, with - "sum" the default. "sqrtn" often achieves good accuracy, in particular - with bag-of-words columns. Each of this can be thought as example level - normalizations on the column:: - * "sum": do not normalize - * "mean": do l1 normalization - * "sqrtn": do l2 normalization - For more information: `tf.embedding_lookup_sparse`. -* `ckpt_to_load_from`: (Optional). String representing checkpoint name/pattern - to restore the column weights. Required if `tensor_name_in_ckpt` is not - None. -* `tensor_name_in_ckpt`: (Optional). Name of the `Tensor` in the provided - checkpoint from which to restore the column weights. Required if - `ckpt_to_load_from` is not None. -* `hash_key`: Specify the hash_key that will be used by the `FingerprintCat64` - function to combine the crosses fingerprints on SparseFeatureCrossOp - (optional). - -##### Returns: - - A _CrossedColumn. - -##### Raises: - - -* `TypeError`: if any item in columns is not an instance of _SparseColumn, - _CrossedColumn, or _BucketizedColumn, or - hash_bucket_size is not an int. -* `ValueError`: if hash_bucket_size is not > 1 or - len(columns) is not > 1. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.separable_convolution2d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.separable_convolution2d.md deleted file mode 100644 index a946caf980..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.separable_convolution2d.md +++ /dev/null @@ -1,52 +0,0 @@ -### `tf.contrib.layers.separable_convolution2d(*args, **kwargs)` {#separable_convolution2d} - -Adds a depth-separable 2D convolution with optional batch_norm layer. - -This op first performs a depthwise convolution that acts separately on -channels, creating a variable called `depthwise_weights`. If `num_outputs` -is not None, it adds a pointwise convolution that mixes channels, creating a -variable called `pointwise_weights`. Then, if `batch_norm_params` is None, -it adds bias to the result, creating a variable called 'biases', otherwise -it adds a batch normalization layer. It finally applies an activation function -to produce the end result. - -##### Args: - - -* `inputs`: A tensor of size [batch_size, height, width, channels]. -* `num_outputs`: The number of pointwise convolution output filters. If is - None, then we skip the pointwise convolution stage. -* `kernel_size`: A list of length 2: [kernel_height, kernel_width] of - of the filters. Can be an int if both values are the same. -* `depth_multiplier`: The number of depthwise convolution output channels for - each input channel. The total number of depthwise convolution output - channels will be equal to `num_filters_in * depth_multiplier`. -* `stride`: A list of length 2: [stride_height, stride_width], specifying the - depthwise convolution stride. Can be an int if both strides are the same. -* `padding`: One of 'VALID' or 'SAME'. -* `rate`: A list of length 2: [rate_height, rate_width], specifying the dilation - rates for a'trous convolution. Can be an int if both rates are the same. - If any value is larger than one, then both stride values need to be one. -* `activation_fn`: Activation function. The default value is a ReLU function. - Explicitly set it to None to skip it and maintain a linear activation. -* `normalizer_fn`: Normalization function to use instead of `biases`. If - `normalizer_fn` is provided then `biases_initializer` and - `biases_regularizer` are ignored and `biases` are not created nor added. - default set to None for no normalizer function -* `normalizer_params`: Normalization function parameters. -* `weights_initializer`: An initializer for the weights. -* `weights_regularizer`: Optional regularizer for the weights. -* `biases_initializer`: An initializer for the biases. If None skip biases. -* `biases_regularizer`: Optional regularizer for the biases. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional list of collections for all the variables or - a dictionay containing a different list of collection per variable. -* `outputs_collections`: Collection to add the outputs. -* `trainable`: Whether or not the variables should be trainable or not. -* `scope`: Optional scope for variable_scope. - -##### Returns: - - A `Tensor` representing the output of the operation. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.sparse_column_with_integerized_feature.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.sparse_column_with_integerized_feature.md deleted file mode 100644 index 99e91fd792..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.sparse_column_with_integerized_feature.md +++ /dev/null @@ -1,43 +0,0 @@ -### `tf.contrib.layers.sparse_column_with_integerized_feature(column_name, bucket_size, combiner='sum', dtype=tf.int64)` {#sparse_column_with_integerized_feature} - -Creates an integerized _SparseColumn. - -Use this when your features are already pre-integerized into int64 IDs, that -is, when the set of values to output is already coming in as what's desired in -the output. Integerized means we can use the feature value itself as id. - -Typically this is used for reading contiguous ranges of integers indexes, but -it doesn't have to be. The output value is simply copied from the -input_feature, whatever it is. Just be aware, however, that if you have large -gaps of unused integers it might affect what you feed those in (for instance, -if you make up a one-hot tensor from these, the unused integers will appear as -values in the tensor which are always zero.) - -##### Args: - - -* `column_name`: A string defining sparse column name. -* `bucket_size`: An int that is > 1. The number of buckets. It should be bigger - than maximum feature. In other words features in this column should be an - int64 in range [0, bucket_size) -* `combiner`: A string specifying how to reduce if the sparse column is - multivalent. Currently "mean", "sqrtn" and "sum" are supported, with "sum" - the default. "sqrtn" often achieves good accuracy, in particular with - bag-of-words columns. - * "sum": do not normalize features in the column - * "mean": do l1 normalization on features in the column - * "sqrtn": do l2 normalization on features in the column - For more information: `tf.embedding_lookup_sparse`. -* `dtype`: Type of features. It should be an integer type. Default value is - dtypes.int64. - -##### Returns: - - An integerized _SparseColumn definition. - -##### Raises: - - -* `ValueError`: bucket_size is not greater than 1. -* `ValueError`: dtype is not integer. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.summarize_activation.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.summarize_activation.md deleted file mode 100644 index 3aed0ff43c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.summarize_activation.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.contrib.layers.summarize_activation(op)` {#summarize_activation} - -Summarize an activation. - -This applies the given activation and adds useful summaries specific to the -activation. - -##### Args: - - -* `op`: The tensor to summarize (assumed to be a layer activation). - -##### Returns: - - The summary op created to summarize `op`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.variance_scaling_initializer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.variance_scaling_initializer.md deleted file mode 100644 index 27b1b58d7e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.layers.variance_scaling_initializer.md +++ /dev/null @@ -1,54 +0,0 @@ -### `tf.contrib.layers.variance_scaling_initializer(factor=2.0, mode='FAN_IN', uniform=False, seed=None, dtype=tf.float32)` {#variance_scaling_initializer} - -Returns an initializer that generates tensors without scaling variance. - -When initializing a deep network, it is in principle advantageous to keep -the scale of the input variance constant, so it does not explode or diminish -by reaching the final layer. This initializer use the following formula: - -```python - if mode='FAN_IN': # Count only number of input connections. - n = fan_in - elif mode='FAN_OUT': # Count only number of output connections. - n = fan_out - elif mode='FAN_AVG': # Average number of inputs and output connections. - n = (fan_in + fan_out)/2.0 - - truncated_normal(shape, 0.0, stddev=sqrt(factor / n)) -``` - -* To get [Delving Deep into Rectifiers]( - http://arxiv.org/pdf/1502.01852v1.pdf), use (Default):
- `factor=2.0 mode='FAN_IN' uniform=False` -* To get [Convolutional Architecture for Fast Feature Embedding]( - http://arxiv.org/abs/1408.5093), use:
- `factor=1.0 mode='FAN_IN' uniform=True` -* To get [Understanding the difficulty of training deep feedforward neural - networks](http://jmlr.org/proceedings/papers/v9/glorot10a/glorot10a.pdf), - use:
- `factor=1.0 mode='FAN_AVG' uniform=True.` -* To get `xavier_initializer` use either:
- `factor=1.0 mode='FAN_AVG' uniform=True`, or
- `factor=1.0 mode='FAN_AVG' uniform=False`. - -##### Args: - - -* `factor`: Float. A multiplicative factor. -* `mode`: String. 'FAN_IN', 'FAN_OUT', 'FAN_AVG'. -* `uniform`: Whether to use uniform or normal distributed random initialization. -* `seed`: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `dtype`: The data type. Only floating point types are supported. - -##### Returns: - - An initializer that generates tensors with unit variance. - -##### Raises: - - -* `ValueError`: if `dtype` is not a floating point type. -* `TypeError`: if `mode` is not in ['FAN_IN', 'FAN_OUT', 'FAN_AVG']. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.Estimator.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.Estimator.md deleted file mode 100644 index c564b6fcf8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.Estimator.md +++ /dev/null @@ -1,397 +0,0 @@ -Estimator class is the basic TensorFlow model trainer/evaluator. -- - - - -#### `tf.contrib.learn.Estimator.__init__(model_fn=None, model_dir=None, config=None, params=None, feature_engineering_fn=None)` {#Estimator.__init__} - -Constructs an `Estimator` instance. - -##### Args: - - -* `model_fn`: Model function. Follows the signature: - * Args: - * `features`: single `Tensor` or `dict` of `Tensor`s - (depending on data passed to `fit`), - * `labels`: `Tensor` or `dict` of `Tensor`s (for multi-head - models). If mode is `ModeKeys.INFER`, `labels=None` will be - passed. If the `model_fn`'s signature does not accept - `mode`, the `model_fn` must still be able to handle - `labels=None`. - * `mode`: Optional. Specifies if this training, evaluation or - prediction. See `ModeKeys`. - * `params`: Optional `dict` of hyperparameters. Will receive what - is passed to Estimator in `params` parameter. This allows - to configure Estimators from hyper parameter tuning. - * `config`: Optional configuration object. Will receive what is passed - to Estimator in `config` parameter, or the default `config`. - Allows updating things in your model_fn based on configuration - such as `num_ps_replicas`. - * `model_dir`: Optional directory where model parameters, graph etc - are saved. Will receive what is passed to Estimator in - `model_dir` parameter, or the default `model_dir`. Allows - updating things in your model_fn that expect model_dir, such as - training hooks. - - * Returns: - `ModelFnOps` - - Also supports a legacy signature which returns tuple of: - - * predictions: `Tensor`, `SparseTensor` or dictionary of same. - Can also be any type that is convertible to a `Tensor` or - `SparseTensor`, or dictionary of same. - * loss: Scalar loss `Tensor`. - * train_op: Training update `Tensor` or `Operation`. - - Supports next three signatures for the function: - - * `(features, labels) -> (predictions, loss, train_op)` - * `(features, labels, mode) -> (predictions, loss, train_op)` - * `(features, labels, mode, params) -> (predictions, loss, train_op)` - * `(features, labels, mode, params, config) -> - (predictions, loss, train_op)` - * `(features, labels, mode, params, config, model_dir) -> - (predictions, loss, train_op)` - - -* `model_dir`: Directory to save model parameters, graph and etc. This can - also be used to load checkpoints from the directory into a estimator to - continue training a previously saved model. -* `config`: Configuration object. -* `params`: `dict` of hyper parameters that will be passed into `model_fn`. - Keys are names of parameters, values are basic python types. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into `model_fn`. Please check `model_fn` for - a definition of features and labels. - -##### Raises: - - -* `ValueError`: parameters of `model_fn` don't match `params`. - - -- - - - -#### `tf.contrib.learn.Estimator.__repr__()` {#Estimator.__repr__} - - - - -- - - - -#### `tf.contrib.learn.Estimator.config` {#Estimator.config} - - - - -- - - - -#### `tf.contrib.learn.Estimator.evaluate(*args, **kwargs)` {#Estimator.evaluate} - -See `Evaluable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If at least one of `x` or `y` is provided, and at least one of - `input_fn` or `feed_fn` is provided. - Or if `metrics` is not `None` or `dict`. - - -- - - - -#### `tf.contrib.learn.Estimator.export(*args, **kwargs)` {#Estimator.export} - -Exports inference graph into given dir. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-23. -Instructions for updating: -The signature of the input_fn accepted by export is changing to be consistent with what's used by tf.Learn Estimator's train/evaluate. input_fn (and in most cases, input_feature_key) will become required args, and use_deprecated_input_fn will default to False and be removed altogether. - -##### Args: - - -* `export_dir`: A string containing a directory to write the exported graph - and checkpoints. -* `input_fn`: If `use_deprecated_input_fn` is true, then a function that given - `Tensor` of `Example` strings, parses it into features that are then - passed to the model. Otherwise, a function that takes no argument and - returns a tuple of (features, labels), where features is a dict of - string key to `Tensor` and labels is a `Tensor` that's currently not - used (and so can be `None`). -* `input_feature_key`: Only used if `use_deprecated_input_fn` is false. String - key into the features dict returned by `input_fn` that corresponds to a - the raw `Example` strings `Tensor` that the exported model will take as - input. Can only be `None` if you're using a custom `signature_fn` that - does not use the first arg (examples). -* `use_deprecated_input_fn`: Determines the signature format of `input_fn`. -* `signature_fn`: Function that returns a default signature and a named - signature map, given `Tensor` of `Example` strings, `dict` of `Tensor`s - for features and `Tensor` or `dict` of `Tensor`s for predictions. -* `prediction_key`: The key for a tensor in the `predictions` dict (output - from the `model_fn`) to use as the `predictions` input to the - `signature_fn`. Optional. If `None`, predictions will pass to - `signature_fn` without filtering. -* `default_batch_size`: Default batch size of the `Example` placeholder. -* `exports_to_keep`: Number of exports to keep. -* `checkpoint_path`: the checkpoint path of the model to be exported. If it is - `None` (which is default), will use the latest checkpoint in - export_dir. - -##### Returns: - - The string path to the exported directory. NB: this functionality was - added ca. 2016/09/25; clients that depend on the return value may need - to handle the case where this function returns None because subclasses - are not returning a value. - - -- - - - -#### `tf.contrib.learn.Estimator.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#Estimator.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.Estimator.fit(*args, **kwargs)` {#Estimator.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.Estimator.get_params(deep=True)` {#Estimator.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.Estimator.get_variable_names()` {#Estimator.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.Estimator.get_variable_value(name)` {#Estimator.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.Estimator.model_dir` {#Estimator.model_dir} - - - - -- - - - -#### `tf.contrib.learn.Estimator.partial_fit(*args, **kwargs)` {#Estimator.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.Estimator.predict(*args, **kwargs)` {#Estimator.predict} - -Returns predictions for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x` and 'batch_size' must be `None`. -* `batch_size`: Override default batch size. If set, 'input_fn' must be - 'None'. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns all. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - A numpy array of predicted classes or regression values if the - constructor's `model_fn` returns a `Tensor` for `predictions` or a `dict` - of numpy arrays if `model_fn` returns a `dict`. Returns an iterable of - predictions if as_iterable is True. - -##### Raises: - - -* `ValueError`: If x and input_fn are both provided or both `None`. - - -- - - - -#### `tf.contrib.learn.Estimator.set_params(**params)` {#Estimator.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.extract_dask_data.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.extract_dask_data.md deleted file mode 100644 index 16342ea708..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.extract_dask_data.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.contrib.learn.extract_dask_data(data)` {#extract_dask_data} - -Extract data from dask.Series or dask.DataFrame for predictors. - -Given a distributed dask.DataFrame or dask.Series containing columns or names -for one or more predictors, this operation returns a single dask.DataFrame or -dask.Series that can be iterated over. - -##### Args: - - -* `data`: A distributed dask.DataFrame or dask.Series. - -##### Returns: - - A dask.DataFrame or dask.Series that can be iterated over. - If the supplied argument is neither a dask.DataFrame nor a dask.Series this - operation returns it without modification. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.monitors.StopAtStep.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.monitors.StopAtStep.md deleted file mode 100644 index 55d4104813..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.monitors.StopAtStep.md +++ /dev/null @@ -1,154 +0,0 @@ -Monitor to request stop at a specified step. -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.__init__(num_steps=None, last_step=None)` {#StopAtStep.__init__} - -Create a StopAtStep monitor. - -This monitor requests stop after either a number of steps have been -executed or a last step has been reached. Only of the two options can be -specified. - -if `num_steps` is specified, it indicates the number of steps to execute -after `begin()` is called. If instead `last_step` is specified, it -indicates the last step we want to execute, as passed to the `step_begin()` -call. - -##### Args: - - -* `num_steps`: Number of steps to execute. -* `last_step`: Step after which to stop. - -##### Raises: - - -* `ValueError`: If one of the arguments is invalid. - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.begin(max_steps=None)` {#StopAtStep.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.end(session=None)` {#StopAtStep.end} - -Callback at the end of training/evaluation. - -##### Args: - - -* `session`: A `tf.Session` object that can be used to run ops. - -##### Raises: - - -* `ValueError`: if we've not begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.epoch_begin(epoch)` {#StopAtStep.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.epoch_end(epoch)` {#StopAtStep.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.post_step(step, session)` {#StopAtStep.post_step} - -Callback after the step is finished. - -Called after step_end and receives session to perform extra session.run -calls. If failure occurred in the process, will be called as well. - -##### Args: - - -* `step`: `int`, global step of the model. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.run_on_all_workers` {#StopAtStep.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.set_estimator(estimator)` {#StopAtStep.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.step_begin(step)` {#StopAtStep.step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.StopAtStep.step_end(step, output)` {#StopAtStep.step_end} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.monitors.SummarySaver.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.monitors.SummarySaver.md deleted file mode 100644 index 056c1c1839..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.monitors.SummarySaver.md +++ /dev/null @@ -1,175 +0,0 @@ -Saves summaries every N steps. -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.__init__(summary_op, save_steps=100, output_dir=None, summary_writer=None, scaffold=None)` {#SummarySaver.__init__} - -Initializes a `SummarySaver` monitor. - -##### Args: - - -* `summary_op`: `Tensor` of type `string`. A serialized `Summary` protocol - buffer, as output by TF summary methods like `summary.scalar` or - `summary.merge_all`. -* `save_steps`: `int`, save summaries every N steps. See `EveryN`. -* `output_dir`: `string`, the directory to save the summaries to. Only used - if no `summary_writer` is supplied. -* `summary_writer`: `SummaryWriter`. If `None` and an `output_dir` was passed, - one will be created accordingly. -* `scaffold`: `Scaffold` to get summary_op if it's not provided. - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.begin(max_steps=None)` {#SummarySaver.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.end(session=None)` {#SummarySaver.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.epoch_begin(epoch)` {#SummarySaver.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.epoch_end(epoch)` {#SummarySaver.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.every_n_post_step(step, session)` {#SummarySaver.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.every_n_step_begin(step)` {#SummarySaver.every_n_step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.every_n_step_end(step, outputs)` {#SummarySaver.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.post_step(step, session)` {#SummarySaver.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.run_on_all_workers` {#SummarySaver.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.set_estimator(estimator)` {#SummarySaver.set_estimator} - - - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.step_begin(step)` {#SummarySaver.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.SummarySaver.step_end(step, output)` {#SummarySaver.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.monitors.SummaryWriterCache.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.monitors.SummaryWriterCache.md deleted file mode 100644 index 8c700a1899..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.learn.monitors.SummaryWriterCache.md +++ /dev/null @@ -1,26 +0,0 @@ -Cache for file writers. - -This class caches file writers, one per directory. -- - - - -#### `tf.contrib.learn.monitors.SummaryWriterCache.clear()` {#SummaryWriterCache.clear} - -Clear cached summary writers. Currently only used for unit tests. - - -- - - - -#### `tf.contrib.learn.monitors.SummaryWriterCache.get(logdir)` {#SummaryWriterCache.get} - -Returns the FileWriter for the specified directory. - -##### Args: - - -* `logdir`: str, name of the directory. - -##### Returns: - - A `FileWriter`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.legacy_seq2seq.basic_rnn_seq2seq.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.legacy_seq2seq.basic_rnn_seq2seq.md deleted file mode 100644 index a3f7faac5e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.legacy_seq2seq.basic_rnn_seq2seq.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.contrib.legacy_seq2seq.basic_rnn_seq2seq(encoder_inputs, decoder_inputs, cell, dtype=tf.float32, scope=None)` {#basic_rnn_seq2seq} - -Basic RNN sequence-to-sequence model. - -This model first runs an RNN to encode encoder_inputs into a state vector, -then runs decoder, initialized with the last encoder state, on decoder_inputs. -Encoder and decoder use the same RNN cell type, but don't share parameters. - -##### Args: - - -* `encoder_inputs`: A list of 2D Tensors [batch_size x input_size]. -* `decoder_inputs`: A list of 2D Tensors [batch_size x input_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function and size. -* `dtype`: The dtype of the initial state of the RNN cell (default: tf.float32). -* `scope`: VariableScope for the created subgraph; default: "basic_rnn_seq2seq". - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors with - shape [batch_size x output_size] containing the generated outputs. -* `state`: The state of each decoder cell in the final time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.legacy_seq2seq.tied_rnn_seq2seq.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.legacy_seq2seq.tied_rnn_seq2seq.md deleted file mode 100644 index 06369b1173..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.legacy_seq2seq.tied_rnn_seq2seq.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.contrib.legacy_seq2seq.tied_rnn_seq2seq(encoder_inputs, decoder_inputs, cell, loop_function=None, dtype=tf.float32, scope=None)` {#tied_rnn_seq2seq} - -RNN sequence-to-sequence model with tied encoder and decoder parameters. - -This model first runs an RNN to encode encoder_inputs into a state vector, and -then runs decoder, initialized with the last encoder state, on decoder_inputs. -Encoder and decoder use the same RNN cell and share parameters. - -##### Args: - - -* `encoder_inputs`: A list of 2D Tensors [batch_size x input_size]. -* `decoder_inputs`: A list of 2D Tensors [batch_size x input_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function and size. -* `loop_function`: If not None, this function will be applied to i-th output - in order to generate i+1-th input, and decoder_inputs will be ignored, - except for the first element ("GO" symbol), see rnn_decoder for details. -* `dtype`: The dtype of the initial state of the rnn cell (default: tf.float32). -* `scope`: VariableScope for the created subgraph; default: "tied_rnn_seq2seq". - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors with - shape [batch_size x output_size] containing the generated outputs. -* `state`: The state of each decoder cell in each time-step. This is a list - with length len(decoder_inputs) -- one item for each time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.linalg.LinearOperatorScaledIdentity.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.linalg.LinearOperatorScaledIdentity.md deleted file mode 100644 index 4dc1f88b1f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.linalg.LinearOperatorScaledIdentity.md +++ /dev/null @@ -1,543 +0,0 @@ -`LinearOperator` acting like a scaled [batch] identity matrix `A = c I`. - -This operator acts like a scaled [batch] identity matrix `A` with shape -`[B1,...,Bb, N, N]` for some `b >= 0`. The first `b` indices index a -batch member. For every batch index `(i1,...,ib)`, `A[i1,...,ib, : :]` is -a scaled version of the `N x N` identity matrix. - -`LinearOperatorIdentity` is initialized with `num_rows`, and a `multiplier` -(a `Tensor`) of shape `[B1,...,Bb]`. `N` is set to `num_rows`, and the -`multiplier` determines the scale for each batch member. - -```python -# Create a 2 x 2 scaled identity matrix. -operator = LinearOperatorIdentity(num_rows=2, multiplier=3.) - -operator.to_dense() -==> [[3., 0.] - [0., 3.]] - -operator.shape -==> [2, 2] - -operator.log_determinant() -==> 2 * Log[3] - -x = ... Shape [2, 4] Tensor -operator.apply(x) -==> 3 * x - -y = tf.random_normal(shape=[3, 2, 4]) -# Note that y.shape is compatible with operator.shape because operator.shape -# is broadcast to [3, 2, 2]. -x = operator.solve(y) -==> 3 * x - -# Create a 2-batch of 2x2 identity matrices -operator = LinearOperatorIdentity(num_rows=2, multiplier=5.) -operator.to_dense() -==> [[[5., 0.] - [0., 5.]], - [[5., 0.] - [0., 5.]]] - -x = ... Shape [2, 2, 3] -operator.apply(x) -==> 5 * x - -# Here the operator and x have different batch_shape, and are broadcast. -x = ... Shape [1, 2, 3] -operator.apply(x) -==> 5 * x -``` - -### Shape compatibility - -This operator acts on [batch] matrix with compatible shape. -`x` is a batch matrix with compatible shape for `apply` and `solve` if - -``` -operator.shape = [B1,...,Bb] + [N, N], with b >= 0 -x.shape = [C1,...,Cc] + [N, R], -and [C1,...,Cc] broadcasts with [B1,...,Bb] to [D1,...,Dd] -``` - -### Performance - -* `operator.apply(x)` is `O(D1*...*Dd*N*R)` -* `operator.solve(x)` is `O(D1*...*Dd*N*R)` -* `operator.determinant()` is `O(D1*...*Dd)` - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite`. -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.__init__(num_rows, multiplier, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, assert_proper_shapes=False, name='LinearOperatorScaledIdentity')` {#LinearOperatorScaledIdentity.__init__} - -Initialize a `LinearOperatorScaledIdentity`. - -The `LinearOperatorScaledIdentity` is initialized with `num_rows`, which -determines the size of each identity matrix, and a `multiplier`, -which defines `dtype`, batch shape, and scale of each matrix. - -This operator is able to broadcast the leading (batch) dimensions. - -##### Args: - - -* `num_rows`: Scalar non-negative integer `Tensor`. Number of rows in the - corresponding identity matrix. -* `multiplier`: `Tensor` of shape `[B1,...,Bb]`, or `[]` (a scalar). -* `is_non_singular`: Expect that this operator is non-singular. -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. -* `is_positive_definite`: Expect that this operator is positive definite. -* `assert_proper_shapes`: Python `bool`. If `False`, only perform static - checks that initialization and method arguments have proper shape. - If `True`, and static checks are inconclusive, add asserts to the graph. -* `name`: A name for this `LinearOperator` - -##### Raises: - - -* `ValueError`: If `num_rows` is determined statically to be non-scalar, or - negative. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.add_to_tensor(mat, name='add_to_tensor')` {#LinearOperatorScaledIdentity.add_to_tensor} - -Add matrix represented by this operator to `mat`. Equiv to `I + mat`. - -##### Args: - - -* `mat`: `Tensor` with same `dtype` and shape broadcastable to `self`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.apply(x, adjoint=False, name='apply')` {#LinearOperatorScaledIdentity.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.assert_non_singular(name='assert_non_singular')` {#LinearOperatorScaledIdentity.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.assert_positive_definite(name='assert_positive_definite')` {#LinearOperatorScaledIdentity.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperatorScaledIdentity.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.batch_shape` {#LinearOperatorScaledIdentity.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperatorScaledIdentity.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.determinant(name='det')` {#LinearOperatorScaledIdentity.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.diag_part(name='diag_part')` {#LinearOperatorScaledIdentity.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.domain_dimension` {#LinearOperatorScaledIdentity.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperatorScaledIdentity.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.dtype` {#LinearOperatorScaledIdentity.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.graph_parents` {#LinearOperatorScaledIdentity.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.is_non_singular` {#LinearOperatorScaledIdentity.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.is_positive_definite` {#LinearOperatorScaledIdentity.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.is_self_adjoint` {#LinearOperatorScaledIdentity.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.is_square` {#LinearOperatorScaledIdentity.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.log_abs_determinant(name='log_abs_det')` {#LinearOperatorScaledIdentity.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.multiplier` {#LinearOperatorScaledIdentity.multiplier} - -The [batch] scalar `Tensor`, `c` in `cI`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.name` {#LinearOperatorScaledIdentity.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.range_dimension` {#LinearOperatorScaledIdentity.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperatorScaledIdentity.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.shape` {#LinearOperatorScaledIdentity.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.shape_tensor(name='shape_tensor')` {#LinearOperatorScaledIdentity.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.solve(rhs, adjoint=False, name='solve')` {#LinearOperatorScaledIdentity.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.tensor_rank` {#LinearOperatorScaledIdentity.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperatorScaledIdentity.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorScaledIdentity.to_dense(name='to_dense')` {#LinearOperatorScaledIdentity.to_dense} - -Return a dense (batch) matrix representing this operator. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.linalg.LinearOperatorUDVHUpdate.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.linalg.LinearOperatorUDVHUpdate.md deleted file mode 100644 index 6705f62ac6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.linalg.LinearOperatorUDVHUpdate.md +++ /dev/null @@ -1,600 +0,0 @@ -Perturb a `LinearOperator` with a rank `K` update. - -This operator acts like a [batch] matrix `A` with shape -`[B1,...,Bb, M, N]` for some `b >= 0`. The first `b` indices index a -batch member. For every batch index `(i1,...,ib)`, `A[i1,...,ib, : :]` is -an `M x N` matrix. - -`LinearOperatorUDVHUpdate` represents `A = L + U D V^H`, where - -``` -L, is a LinearOperator representing [batch] M x N matrices -U, is a [batch] M x K matrix. Typically K << M. -D, is a [batch] K x K matrix. -V, is a [batch] N x K matrix. Typically K << N. -V^H is the Hermitian transpose (adjoint) of V. -``` - -If `M = N`, determinants and solves are done using the matrix determinant -lemma and Woodbury identities, and thus require L and D to be non-singular. - -Solves and determinants will be attempted unless the "is_non_singular" -property of L and D is False. - -In the event that L and D are positive-definite, and U = V, solves and -determinants can be done using a Cholesky factorization. - -```python -# Create a 3 x 3 diagonal linear operator. -diag_operator = LinearOperatorDiag( - diag=[1., 2., 3.], is_non_singular=True, is_self_adjoint=True, - is_positive_definite=True) - -# Perturb with a rank 2 perturbation -operator = LinearOperatorUDVHUpdate( - operator=diag_operator, - u=[[1., 2.], [-1., 3.], [0., 0.]], - diag=[11., 12.], - v=[[1., 2.], [-1., 3.], [10., 10.]]) - -operator.shape -==> [3, 3] - -operator.log_determinant() -==> scalar Tensor - -x = ... Shape [3, 4] Tensor -operator.apply(x) -==> Shape [3, 4] Tensor -``` - -### Shape compatibility - -This operator acts on [batch] matrix with compatible shape. -`x` is a batch matrix with compatible shape for `apply` and `solve` if - -``` -operator.shape = [B1,...,Bb] + [M, N], with b >= 0 -x.shape = [B1,...,Bb] + [N, R], with R >= 0. -``` - -### Performance - -Suppose `operator` is a `LinearOperatorUDVHUpdate` of shape `[M, N]`, -made from a rank `K` update of `base_operator` which performs `.apply(x)` on -`x` having `x.shape = [N, R]` with `O(L_apply*N*R)` complexity (and similarly -for `solve`, `determinant`. Then, if `x.shape = [N, R]`, - -* `operator.apply(x)` is `O(L_apply*N*R + K*N*R)` - -and if `M = N`, - -* `operator.solve(x)` is `O(L_apply*N*R + N*K*R + K^2*R + K^3)` -* `operator.determinant()` is `O(L_determinant + L_solve*N*K + K^2*N + K^3)` - -If instead `operator` and `x` have shape `[B1,...,Bb, M, N]` and -`[B1,...,Bb, N, R]`, every operation increases in complexity by `B1*...*Bb`. - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite, diag_positive, square` -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.__init__(base_operator, u, diag=None, v=None, is_diag_positive=None, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, is_square=None, name='LinearOperatorUDVHUpdate')` {#LinearOperatorUDVHUpdate.__init__} - -Initialize a `LinearOperatorUDVHUpdate`. - -This creates a `LinearOperator` of the form `A = L + U D V^H`, with -`L` a `LinearOperator`, `U, V` both [batch] matrices, and `D` a [batch] -diagonal matrix. - -If `L` is non-singular, solves and determinants are available. -Solves/determinants both involve a solve/determinant of a `K x K` system. -In the event that L and D are self-adjoint positive-definite, and U = V, -this can be done using a Cholesky factorization. The user should set the -`is_X` matrix property hints, which will trigger the appropriate code path. - -##### Args: - - -* `base_operator`: Shape `[B1,...,Bb, M, N]` real `float32` or `float64` - `LinearOperator`. This is `L` above. -* `u`: Shape `[B1,...,Bb, M, K]` `Tensor` of same `dtype` as `base_operator`. - This is `U` above. -* `diag`: Optional shape `[B1,...,Bb, K]` `Tensor` with same `dtype` as - `base_operator`. This is the diagonal of `D` above. - Defaults to `D` being the identity operator. -* `v`: Optional `Tensor` of same `dtype` as `u` and shape `[B1,...,Bb, N, K]` - Defaults to `v = u`, in which case the perturbation is symmetric. - If `M != N`, then `v` must be set since the pertrubation is not square. -* `is_diag_positive`: Python `bool`. If `True`, expect `diag > 0`. -* `is_non_singular`: Expect that this operator is non-singular. - Default is `None`, unless `is_positive_definite` is auto-set to be - `True` (see below). -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. Default is `None`, unless `base_operator` is self-adjoint - and `v = None` (meaning `u=v`), in which case this defaults to `True`. -* `is_positive_definite`: Expect that this operator is positive definite. - Default is `None`, unless `base_operator` is positive-definite - `v = None` (meaning `u=v`), and `is_diag_positive`, in which case this - defaults to `True`. -* `is_square`: Expect that this operator acts like square [batch] matrices. -* `name`: A name for this `LinearOperator`. - -##### Raises: - - -* `ValueError`: If `is_X` flags are set in an inconsistent way. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.add_to_tensor(x, name='add_to_tensor')` {#LinearOperatorUDVHUpdate.add_to_tensor} - -Add matrix represented by this operator to `x`. Equivalent to `A + x`. - -##### Args: - - -* `x`: `Tensor` with same `dtype` and shape broadcastable to `self.shape`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.apply(x, adjoint=False, name='apply')` {#LinearOperatorUDVHUpdate.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.assert_non_singular(name='assert_non_singular')` {#LinearOperatorUDVHUpdate.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.assert_positive_definite(name='assert_positive_definite')` {#LinearOperatorUDVHUpdate.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperatorUDVHUpdate.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.base_operator` {#LinearOperatorUDVHUpdate.base_operator} - -If this operator is `A = L + U D V^H`, this is the `L`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.batch_shape` {#LinearOperatorUDVHUpdate.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperatorUDVHUpdate.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.determinant(name='det')` {#LinearOperatorUDVHUpdate.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.diag_arg` {#LinearOperatorUDVHUpdate.diag_arg} - -If this operator is `A = L + U D V^H`, this is the diagonal of `D`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.diag_operator` {#LinearOperatorUDVHUpdate.diag_operator} - -If this operator is `A = L + U D V^H`, this is `D`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.diag_part(name='diag_part')` {#LinearOperatorUDVHUpdate.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.domain_dimension` {#LinearOperatorUDVHUpdate.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperatorUDVHUpdate.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.dtype` {#LinearOperatorUDVHUpdate.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.graph_parents` {#LinearOperatorUDVHUpdate.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.is_diag_positive` {#LinearOperatorUDVHUpdate.is_diag_positive} - -If this operator is `A = L + U D V^H`, this hints `D > 0` elementwise. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.is_non_singular` {#LinearOperatorUDVHUpdate.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.is_positive_definite` {#LinearOperatorUDVHUpdate.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.is_self_adjoint` {#LinearOperatorUDVHUpdate.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.is_square` {#LinearOperatorUDVHUpdate.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.log_abs_determinant(name='log_abs_det')` {#LinearOperatorUDVHUpdate.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.name` {#LinearOperatorUDVHUpdate.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.range_dimension` {#LinearOperatorUDVHUpdate.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperatorUDVHUpdate.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.shape` {#LinearOperatorUDVHUpdate.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.shape_tensor(name='shape_tensor')` {#LinearOperatorUDVHUpdate.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.solve(rhs, adjoint=False, name='solve')` {#LinearOperatorUDVHUpdate.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.tensor_rank` {#LinearOperatorUDVHUpdate.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperatorUDVHUpdate.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.to_dense(name='to_dense')` {#LinearOperatorUDVHUpdate.to_dense} - -Return a dense (batch) matrix representing this operator. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.u` {#LinearOperatorUDVHUpdate.u} - -If this operator is `A = L + U D V^H`, this is the `U`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorUDVHUpdate.v` {#LinearOperatorUDVHUpdate.v} - -If this operator is `A = L + U D V^H`, this is the `V`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.losses.add_loss.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.losses.add_loss.md deleted file mode 100644 index ba2cba6f1b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.losses.add_loss.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.contrib.losses.add_loss(*args, **kwargs)` {#add_loss} - -Adds a externally defined loss to the collection of losses. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.add_loss instead. - -##### Args: - - -* `loss`: A loss `Tensor`. -* `loss_collection`: Optional collection to add the loss to. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.losses.cosine_distance.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.losses.cosine_distance.md deleted file mode 100644 index 8d888a8996..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.losses.cosine_distance.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.contrib.losses.cosine_distance(*args, **kwargs)` {#cosine_distance} - -Adds a cosine-distance loss to the training procedure. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.cosine_distance instead. - -Note that the function assumes that `predictions` and `labels` are already -unit-normalized. - -##### Args: - - -* `predictions`: An arbitrary matrix. -* `labels`: A `Tensor` whose shape matches 'predictions' -* `dim`: The dimension along which the cosine distance is computed. -* `weights`: Coefficients for the loss a scalar, a tensor of shape - [batch_size] or a tensor whose shape matches `predictions`. -* `scope`: The scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the loss value. - -##### Raises: - - -* `ValueError`: If `predictions` shape doesn't match `labels` shape, or - `weights` is `None`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.losses.get_regularization_losses.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.losses.get_regularization_losses.md deleted file mode 100644 index e48896b8fa..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.losses.get_regularization_losses.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.contrib.losses.get_regularization_losses(*args, **kwargs)` {#get_regularization_losses} - -Gets the regularization losses. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.get_regularization_losses instead. - -##### Args: - - -* `scope`: an optional scope for filtering the losses to return. - -##### Returns: - - A list of loss variables. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.metrics.auc_using_histogram.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.metrics.auc_using_histogram.md deleted file mode 100644 index 01f67e402c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.metrics.auc_using_histogram.md +++ /dev/null @@ -1,38 +0,0 @@ -### `tf.contrib.metrics.auc_using_histogram(boolean_labels, scores, score_range, nbins=100, collections=None, check_shape=True, name=None)` {#auc_using_histogram} - -AUC computed by maintaining histograms. - -Rather than computing AUC directly, this Op maintains Variables containing -histograms of the scores associated with `True` and `False` labels. By -comparing these the AUC is generated, with some discretization error. -See: "Efficient AUC Learning Curve Calculation" by Bouckaert. - -This AUC Op updates in `O(batch_size + nbins)` time and works well even with -large class imbalance. The accuracy is limited by discretization error due -to finite number of bins. If scores are concentrated in a fewer bins, -accuracy is lower. If this is a concern, we recommend trying different -numbers of bins and comparing results. - -##### Args: - - -* `boolean_labels`: 1-D boolean `Tensor`. Entry is `True` if the corresponding - record is in class. -* `scores`: 1-D numeric `Tensor`, same shape as boolean_labels. -* `score_range`: `Tensor` of shape `[2]`, same dtype as `scores`. The min/max - values of score that we expect. Scores outside range will be clipped. -* `nbins`: Integer number of bins to use. Accuracy strictly increases as the - number of bins increases. -* `collections`: List of graph collections keys. Internal histogram Variables - are added to these collections. Defaults to `[GraphKeys.LOCAL_VARIABLES]`. -* `check_shape`: Boolean. If `True`, do a runtime shape check on the scores - and labels. -* `name`: A name for this Op. Defaults to "auc_using_histogram". - -##### Returns: - - -* `auc`: `float32` scalar `Tensor`. Fetching this converts internal histograms - to auc value. -* `update_op`: `Op`, when run, updates internal histograms. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.metrics.streaming_concat.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.metrics.streaming_concat.md deleted file mode 100644 index 814ef347f6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.metrics.streaming_concat.md +++ /dev/null @@ -1,44 +0,0 @@ -### `tf.contrib.metrics.streaming_concat(values, axis=0, max_size=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_concat} - -Concatenate values along an axis across batches. - -The function `streaming_concat` creates two local variables, `array` and -`size`, that are used to store concatenated values. Internally, `array` is -used as storage for a dynamic array (if `maxsize` is `None`), which ensures -that updates can be run in amortized constant time. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that appends the values of a tensor and returns the -length of the concatenated axis. - -This op allows for evaluating metrics that cannot be updated incrementally -using the same framework as other streaming metrics. - -##### Args: - - -* `values`: `Tensor` to concatenate. Rank and the shape along all axes other - than the axis to concatenate along must be statically known. -* `axis`: optional integer axis to concatenate along. -* `max_size`: optional integer maximum size of `value` along the given axis. - Once the maximum size is reached, further updates are no-ops. By default, - there is no maximum size: the array is resized as necessary. -* `metrics_collections`: An optional list of collections that `value` - should be added to. -* `updates_collections`: An optional list of collections `update_op` should be - added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `value`: A `Tensor` representing the concatenated values. -* `update_op`: An operation that concatenates the next values. - -##### Raises: - - -* `ValueError`: if `values` does not have a statically known rank, `axis` is - not in the valid range or the size of `values` is not statically known - along any axis other than `axis`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.metrics.streaming_true_negatives_at_thresholds.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.metrics.streaming_true_negatives_at_thresholds.md deleted file mode 100644 index d8fede8878..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.metrics.streaming_true_negatives_at_thresholds.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.metrics.streaming_true_negatives_at_thresholds(predictions, labels, thresholds, weights=None)` {#streaming_true_negatives_at_thresholds} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.CoupledInputForgetGateLSTMCell.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.CoupledInputForgetGateLSTMCell.md deleted file mode 100644 index 31e4e3808b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.CoupledInputForgetGateLSTMCell.md +++ /dev/null @@ -1,127 +0,0 @@ -Long short-term memory unit (LSTM) recurrent network cell. - -The default non-peephole implementation is based on: - - http://deeplearning.cs.cmu.edu/pdfs/Hochreiter97_lstm.pdf - -S. Hochreiter and J. Schmidhuber. -"Long Short-Term Memory". Neural Computation, 9(8):1735-1780, 1997. - -The peephole implementation is based on: - - https://research.google.com/pubs/archive/43905.pdf - -Hasim Sak, Andrew Senior, and Francoise Beaufays. -"Long short-term memory recurrent neural network architectures for - large scale acoustic modeling." INTERSPEECH, 2014. - -The coupling of input and forget gate is based on: - - http://arxiv.org/pdf/1503.04069.pdf - -Greff et al. "LSTM: A Search Space Odyssey" - -The class uses optional peep-hole connections, and an optional projection -layer. -- - - - -#### `tf.contrib.rnn.CoupledInputForgetGateLSTMCell.__call__(inputs, state, scope=None)` {#CoupledInputForgetGateLSTMCell.__call__} - -Run one step of LSTM. - -##### Args: - - -* `inputs`: input Tensor, 2D, batch x num_units. -* `state`: if `state_is_tuple` is False, this must be a state Tensor, - `2-D, batch x state_size`. If `state_is_tuple` is True, this must be a - tuple of state Tensors, both `2-D`, with column sizes `c_state` and - `m_state`. -* `scope`: VariableScope for the created subgraph; defaults to "LSTMCell". - -##### Returns: - - A tuple containing: - - A `2-D, [batch x output_dim]`, Tensor representing the output of the - LSTM after reading `inputs` when previous state was `state`. - Here output_dim is: - num_proj if num_proj was set, - num_units otherwise. - - Tensor(s) representing the new state of LSTM after reading `inputs` when - the previous state was `state`. Same type and shape(s) as `state`. - -##### Raises: - - -* `ValueError`: If input size cannot be inferred from inputs via - static shape inference. - - -- - - - -#### `tf.contrib.rnn.CoupledInputForgetGateLSTMCell.__init__(num_units, use_peepholes=False, initializer=None, num_proj=None, proj_clip=None, num_unit_shards=1, num_proj_shards=1, forget_bias=1.0, state_is_tuple=False, activation=tanh)` {#CoupledInputForgetGateLSTMCell.__init__} - -Initialize the parameters for an LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell -* `use_peepholes`: bool, set True to enable diagonal/peephole connections. -* `initializer`: (optional) The initializer to use for the weight and - projection matrices. -* `num_proj`: (optional) int, The output dimensionality for the projection - matrices. If None, no projection is performed. -* `proj_clip`: (optional) A float value. If `num_proj > 0` and `proj_clip` is - provided, then the projected values are clipped elementwise to within - `[-proj_clip, proj_clip]`. - -* `num_unit_shards`: How to split the weight matrix. If >1, the weight - matrix is stored across num_unit_shards. -* `num_proj_shards`: How to split the projection matrix. If >1, the - projection matrix is stored across num_proj_shards. -* `forget_bias`: Biases of the forget gate are initialized by default to 1 - in order to reduce the scale of forgetting at the beginning of - the training. -* `state_is_tuple`: If True, accepted and returned states are 2-tuples of - the `c_state` and `m_state`. By default (False), they are concatenated - along the column axis. This default behavior will soon be deprecated. -* `activation`: Activation function of the inner states. - - -- - - - -#### `tf.contrib.rnn.CoupledInputForgetGateLSTMCell.output_size` {#CoupledInputForgetGateLSTMCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.CoupledInputForgetGateLSTMCell.state_size` {#CoupledInputForgetGateLSTMCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.CoupledInputForgetGateLSTMCell.zero_state(batch_size, dtype)` {#CoupledInputForgetGateLSTMCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.DropoutWrapper.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.DropoutWrapper.md deleted file mode 100644 index af7dce705d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.DropoutWrapper.md +++ /dev/null @@ -1,69 +0,0 @@ -Operator adding dropout to inputs and outputs of the given cell. -- - - - -#### `tf.contrib.rnn.DropoutWrapper.__call__(inputs, state, scope=None)` {#DropoutWrapper.__call__} - -Run the cell with the declared dropouts. - - -- - - - -#### `tf.contrib.rnn.DropoutWrapper.__init__(cell, input_keep_prob=1.0, output_keep_prob=1.0, seed=None)` {#DropoutWrapper.__init__} - -Create a cell with added input and/or output dropout. - -Dropout is never used on the state. - -##### Args: - - -* `cell`: an RNNCell, a projection to output_size is added to it. -* `input_keep_prob`: unit Tensor or float between 0 and 1, input keep - probability; if it is float and 1, no input dropout will be added. -* `output_keep_prob`: unit Tensor or float between 0 and 1, output keep - probability; if it is float and 1, no output dropout will be added. -* `seed`: (optional) integer, the randomness seed. - -##### Raises: - - -* `TypeError`: if cell is not an RNNCell. -* `ValueError`: if keep_prob is not between 0 and 1. - - -- - - - -#### `tf.contrib.rnn.DropoutWrapper.output_size` {#DropoutWrapper.output_size} - - - - -- - - - -#### `tf.contrib.rnn.DropoutWrapper.state_size` {#DropoutWrapper.state_size} - - - - -- - - - -#### `tf.contrib.rnn.DropoutWrapper.zero_state(batch_size, dtype)` {#DropoutWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.InputProjectionWrapper.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.InputProjectionWrapper.md deleted file mode 100644 index 1898136704..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.InputProjectionWrapper.md +++ /dev/null @@ -1,67 +0,0 @@ -Operator adding an input projection to the given cell. - -Note: in many cases it may be more efficient to not use this wrapper, -but instead concatenate the whole sequence of your inputs in time, -do the projection on this batch-concatenated sequence, then split it. -- - - - -#### `tf.contrib.rnn.InputProjectionWrapper.__call__(inputs, state, scope=None)` {#InputProjectionWrapper.__call__} - -Run the input projection and then the cell. - - -- - - - -#### `tf.contrib.rnn.InputProjectionWrapper.__init__(cell, num_proj, input_size=None)` {#InputProjectionWrapper.__init__} - -Create a cell with input projection. - -##### Args: - - -* `cell`: an RNNCell, a projection of inputs is added before it. -* `num_proj`: Python integer. The dimension to project to. -* `input_size`: Deprecated and unused. - -##### Raises: - - -* `TypeError`: if cell is not an RNNCell. - - -- - - - -#### `tf.contrib.rnn.InputProjectionWrapper.output_size` {#InputProjectionWrapper.output_size} - - - - -- - - - -#### `tf.contrib.rnn.InputProjectionWrapper.state_size` {#InputProjectionWrapper.state_size} - - - - -- - - - -#### `tf.contrib.rnn.InputProjectionWrapper.zero_state(batch_size, dtype)` {#InputProjectionWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.LSTMBlockWrapper.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.LSTMBlockWrapper.md deleted file mode 100644 index 5cb59b7a0f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.rnn.LSTMBlockWrapper.md +++ /dev/null @@ -1,49 +0,0 @@ -This is a helper class that provides housekeeping for LSTM cells. - -This may be useful for alternative LSTM and similar type of cells. -The subclasses must implement `_call_cell` method and `num_units` property. -- - - - -#### `tf.contrib.rnn.LSTMBlockWrapper.__call__(inputs, initial_state=None, dtype=None, sequence_length=None, scope=None)` {#LSTMBlockWrapper.__call__} - -Run this LSTM on inputs, starting from the given state. - -##### Args: - - -* `inputs`: `3-D` tensor with shape `[time_len, batch_size, input_size]` - or a list of `time_len` tensors of shape `[batch_size, input_size]`. -* `initial_state`: a tuple `(initial_cell_state, initial_output)` with tensors - of shape `[batch_size, self._num_units]`. If this is not provided, the - cell is expected to create a zero initial state of type `dtype`. -* `dtype`: The data type for the initial state and expected output. Required - if `initial_state` is not provided or RNN state has a heterogeneous - dtype. -* `sequence_length`: Specifies the length of each sequence in inputs. An - `int32` or `int64` vector (tensor) size `[batch_size]`, values in `[0, - time_len).` - Defaults to `time_len` for each element. -* `scope`: `VariableScope` for the created subgraph; defaults to class name. - -##### Returns: - - A pair containing: - - - Output: A `3-D` tensor of shape `[time_len, batch_size, output_size]` - or a list of time_len tensors of shape `[batch_size, output_size]`, - to match the type of the `inputs`. - - Final state: a tuple `(cell_state, output)` matching `initial_state`. - -##### Raises: - - -* `ValueError`: in case of shape mismatches - - -- - - - -#### `tf.contrib.rnn.LSTMBlockWrapper.num_units` {#LSTMBlockWrapper.num_units} - -Number of units in this cell (output dimension). - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.training.bucket.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.training.bucket.md deleted file mode 100644 index 19cd27dec8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.training.bucket.md +++ /dev/null @@ -1,86 +0,0 @@ -### `tf.contrib.training.bucket(tensors, which_bucket, batch_size, num_buckets, num_threads=1, capacity=32, shapes=None, dynamic_pad=False, allow_smaller_final_batch=False, keep_input=True, shared_name=None, name=None)` {#bucket} - -Lazy bucketing of input tensors according to `which_bucket`. - -The argument `tensors` can be a list or a dictionary of tensors. -The value returned by the function will be of the same type -as `tensors`. - -The tensors entering this function are put into the bucket given by -`which_bucket`. Each bucket has its own queue. When a bucket contains -`batch_size` elements, this minibatch is pushed onto a top queue. The -tensors returned from this function are a the result of dequeueing the -next minibatch from this top queue. - -This function is implemented using several queues. A `QueueRunner` for the -queues is added to the current `Graph`'s `QUEUE_RUNNER` collection. - -As the returned tensors are the result of of a dequeue operation, evaluating -them will throw a `tf.errors.OutOfRangeError` when the input queue is -exhausted. If these tensors are feeding another input queue, its queue runner -will catch this exception, however, if they are used in your main thread -you are responsible for catching this yourself. - -*N.B.:* If `dynamic_pad` is `False`, you must ensure that either -(i) the `shapes` argument is passed, or (ii) all of the tensors in -`tensors` must have fully-defined shapes. `ValueError` will be -raised if neither of these conditions holds. - -If `dynamic_pad` is `True`, it is sufficient that the *rank* of the -tensors is known, but individual dimensions may have shape `None`. -In this case, for each enqueue the dimensions with value `None` -may have a variable length; upon dequeue, the output tensors will be padded -on the right to the maximum shape of the tensors in the current minibatch. -For numbers, this padding takes value 0. For strings, this padding is -the empty string. See `PaddingFIFOQueue` for more info. - -If `allow_smaller_final_batch` is `True`, a smaller batch value than -`batch_size` is returned when the queues are closed and there are not enough -elements to fill the batch, otherwise the pending elements are discarded. -In addition, all output tensors' static shapes, as accessed via the -`get_shape()` method will have a 0th `Dimension` value of `None`, and -operations that depend on fixed batch_size would fail. - -##### Args: - - -* `tensors`: The list or dictionary of tensors, representing a single element, - to bucket. Nested lists are not supported. -* `which_bucket`: An `int32` scalar Tensor taking a value in `[0, num_buckets)`. -* `batch_size`: The new batch size pulled from the queue (all queues will have - the same size). If a list is passed in then each bucket will have a - different batch_size. - (python int, int32 scalar or iterable of integers of length num_buckets). -* `num_buckets`: A python integer, the number of buckets. -* `num_threads`: An integer. The number of threads enqueuing `tensors`. -* `capacity`: An integer. The maximum number of minibatches in the top queue, - and also the maximum number of elements within each bucket. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensors`. -* `dynamic_pad`: Boolean. Allow variable dimensions in input shapes. - The given dimensions are padded upon dequeue so that tensors within a - batch have the same shapes. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batches to be smaller if there are insufficient items left in the queues. -* `keep_input`: A `bool` scalar Tensor. If provided, this tensor controls - whether the input is added to the queue or not. If it evaluates `True`, - then `tensors` are added to the bucket; otherwise they are dropped. This - tensor essentially acts as a filtering mechanism. -* `shared_name`: (Optional). If set, the queues will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A tuple `(bucket, outputs)` where `bucket` is - a `int32` scalar tensor and `outputs` is a list or - dictionary of batched outputs corresponding to elements of `tensors`. - Every step will receive a new bucket of outputs. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensors` or if batch_size is a sequence - but it's length != num_buckets. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.training.rejection_sample.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.training.rejection_sample.md deleted file mode 100644 index fe3c9866e8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.training.rejection_sample.md +++ /dev/null @@ -1,57 +0,0 @@ -### `tf.contrib.training.rejection_sample(tensors, accept_prob_fn, batch_size, queue_threads=1, enqueue_many=False, prebatch_capacity=16, prebatch_threads=1, runtime_checks=False, name=None)` {#rejection_sample} - -Stochastically creates batches by rejection sampling. - -Each list of non-batched tensors is evaluated by `accept_prob_fn`, to produce -a scalar tensor between 0 and 1. This tensor corresponds to the probability of -being accepted. When `batch_size` tensor groups have been accepted, the batch -queue will return a mini-batch. - -##### Args: - - -* `tensors`: List of tensors for data. All tensors are either one item or a - batch, according to enqueue_many. -* `accept_prob_fn`: A python lambda that takes a non-batch tensor from each - item in `tensors`, and produces a scalar tensor. -* `batch_size`: Size of batch to be returned. -* `queue_threads`: The number of threads for the queue that will hold the final - batch. -* `enqueue_many`: Bool. If true, interpret input tensors as having a batch - dimension. -* `prebatch_capacity`: Capacity for the large queue that is used to convert - batched tensors to single examples. -* `prebatch_threads`: Number of threads for the large queue that is used to - convert batched tensors to single examples. -* `runtime_checks`: Bool. If true, insert runtime checks on the output of - `accept_prob_fn`. Using `True` might have a performance impact. -* `name`: Optional prefix for ops created by this function. - -##### Raises: - - -* `ValueError`: enqueue_many is True and labels doesn't have a batch - dimension, or if enqueue_many is False and labels isn't a scalar. -* `ValueError`: enqueue_many is True, and batch dimension on data and labels - don't match. -* `ValueError`: if a zero initial probability class has a nonzero target - probability. - -##### Returns: - - A list of tensors of the same length as `tensors`, with batch dimension - `batch_size`. - -##### Example: - - # Get tensor for a single data and label example. - data, label = data_provider.Get(['data', 'label']) - - # Get stratified batch according to data tensor. - accept_prob_fn = lambda x: (tf.tanh(x[0]) + 1) / 2 - data_batch = tf.contrib.training.rejection_sample( - [data, label], accept_prob_fn, 16) - - # Run batch through network. - ... - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.training.stratified_sample.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.training.stratified_sample.md deleted file mode 100644 index 27251e3b1c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.contrib.training.stratified_sample.md +++ /dev/null @@ -1,58 +0,0 @@ -### `tf.contrib.training.stratified_sample(tensors, labels, target_probs, batch_size, init_probs=None, enqueue_many=False, queue_capacity=16, threads_per_queue=1, name=None)` {#stratified_sample} - -Stochastically creates batches based on per-class probabilities. - -This method discards examples. Internally, it creates one queue to amortize -the cost of disk reads, and one queue to hold the properly-proportioned -batch. - -##### Args: - - -* `tensors`: List of tensors for data. All tensors are either one item or a - batch, according to enqueue_many. -* `labels`: Tensor for label of data. Label is a single integer or a batch, - depending on enqueue_many. It is not a one-hot vector. -* `target_probs`: Target class proportions in batch. An object whose type has a - registered Tensor conversion function. -* `batch_size`: Size of batch to be returned. -* `init_probs`: Class proportions in the data. An object whose type has a - registered Tensor conversion function, or `None` for estimating the - initial distribution. -* `enqueue_many`: Bool. If true, interpret input tensors as having a batch - dimension. -* `queue_capacity`: Capacity of the large queue that holds input examples. -* `threads_per_queue`: Number of threads for the large queue that holds input - examples and for the final queue with the proper class proportions. -* `name`: Optional prefix for ops created by this function. - -##### Raises: - - -* `ValueError`: enqueue_many is True and labels doesn't have a batch - dimension, or if enqueue_many is False and labels isn't a scalar. -* `ValueError`: enqueue_many is True, and batch dimension on data and labels - don't match. -* `ValueError`: if probs don't sum to one. -* `ValueError`: if a zero initial probability class has a nonzero target - probability. -* `TFAssertion`: if labels aren't integers in [0, num classes). - -##### Returns: - - (data_batch, label_batch), where data_batch is a list of tensors of the same - length as `tensors` - -##### Example: - - # Get tensor for a single data and label example. - data, label = data_provider.Get(['data', 'label']) - - # Get stratified batch according to per-class probabilities. - target_probs = [...distribution you want...] - [data_batch], labels = tf.contrib.training.stratified_sample( - [data], label, target_probs) - - # Run batch through network. - ... - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.control_dependencies.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.control_dependencies.md deleted file mode 100644 index 070f8788e5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.control_dependencies.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.control_dependencies(control_inputs)` {#control_dependencies} - -Wrapper for `Graph.control_dependencies()` using the default graph. - -See [`Graph.control_dependencies()`](../../api_docs/python/framework.md#Graph.control_dependencies) -for more details. - -##### Args: - - -* `control_inputs`: A list of `Operation` or `Tensor` objects which - must be executed or computed before running the operations - defined in the context. Can also be `None` to clear the control - dependencies. - -##### Returns: - - A context manager that specifies control dependencies for all - operations constructed within the context. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.convert_to_tensor_or_indexed_slices.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.convert_to_tensor_or_indexed_slices.md deleted file mode 100644 index 18cf6c58be..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.convert_to_tensor_or_indexed_slices.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.convert_to_tensor_or_indexed_slices(value, dtype=None, name=None)` {#convert_to_tensor_or_indexed_slices} - -Converts the given object to a `Tensor` or an `IndexedSlices`. - -If `value` is an `IndexedSlices` or `SparseTensor` it is returned -unmodified. Otherwise, it is converted to a `Tensor` using -`convert_to_tensor()`. - -##### Args: - - -* `value`: An `IndexedSlices`, `SparseTensor`, or an object that can be consumed - by `convert_to_tensor()`. -* `dtype`: (Optional.) The required `DType` of the returned `Tensor` or - `IndexedSlices`. -* `name`: (Optional.) A name to use if a new `Tensor` is created. - -##### Returns: - - An `Tensor`, `IndexedSlices`, or `SparseTensor` based on `value`. - -##### Raises: - - -* `ValueError`: If `dtype` does not match the element type of `value`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.decode_csv.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.decode_csv.md deleted file mode 100644 index f2ebf6945b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.decode_csv.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.decode_csv(records, record_defaults, field_delim=None, name=None)` {#decode_csv} - -Convert CSV records to tensors. Each column maps to one tensor. - -RFC 4180 format is expected for the CSV records. -(https://tools.ietf.org/html/rfc4180) -Note that we allow leading and trailing spaces with int or float field. - -##### Args: - - -* `records`: A `Tensor` of type `string`. - Each string is a record/row in the csv and all records should have - the same format. -* `record_defaults`: A list of `Tensor` objects with types from: `float32`, `int32`, `int64`, `string`. - One tensor per column of the input record, with either a - scalar default value for that column or empty if the column is required. -* `field_delim`: An optional `string`. Defaults to `","`. - delimiter to separate fields in a record. -* `name`: A name for the operation (optional). - -##### Returns: - - A list of `Tensor` objects. Has the same type as `record_defaults`. - Each tensor will have the same shape as records. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.decode_raw.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.decode_raw.md deleted file mode 100644 index 8beeae4c00..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.decode_raw.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.decode_raw(bytes, out_type, little_endian=None, name=None)` {#decode_raw} - -Reinterpret the bytes of a string as a vector of numbers. - -##### Args: - - -* `bytes`: A `Tensor` of type `string`. - All the elements must have the same length. -* `out_type`: A `tf.DType` from: `tf.half, tf.float32, tf.float64, tf.int32, tf.uint8, tf.int16, tf.int8, tf.int64`. -* `little_endian`: An optional `bool`. Defaults to `True`. - Whether the input `bytes` are in little-endian order. - Ignored for `out_type` values that are stored in a single byte like - `uint8`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `out_type`. - A Tensor with one more dimension than the input `bytes`. The - added dimension will have size equal to the length of the elements - of `bytes` divided by the number of bytes to represent `out_type`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.errors.OutOfRangeError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.errors.OutOfRangeError.md deleted file mode 100644 index ef996b0a88..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.errors.OutOfRangeError.md +++ /dev/null @@ -1,15 +0,0 @@ -Raised when an operation iterates past the valid input range. - -This exception is raised in "end-of-file" conditions, such as when a -[`queue.dequeue()`](../../api_docs/python/io_ops.md#QueueBase.dequeue) -operation is blocked on an empty queue, and a -[`queue.close()`](../../api_docs/python/io_ops.md#QueueBase.close) -operation executes. - -- - - - -#### `tf.errors.OutOfRangeError.__init__(node_def, op, message)` {#OutOfRangeError.__init__} - -Creates an `OutOfRangeError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.errors.UnauthenticatedError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.errors.UnauthenticatedError.md deleted file mode 100644 index d3344dc6b1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.errors.UnauthenticatedError.md +++ /dev/null @@ -1,11 +0,0 @@ -The request does not have valid authentication credentials. - -This exception is not currently used. - -- - - - -#### `tf.errors.UnauthenticatedError.__init__(node_def, op, message)` {#UnauthenticatedError.__init__} - -Creates an `UnauthenticatedError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.exp.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.exp.md deleted file mode 100644 index f31531e762..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.exp.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.exp(x, name=None)` {#exp} - -Computes exponential of x element-wise. \\(y = e^x\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.fake_quant_with_min_max_vars.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.fake_quant_with_min_max_vars.md deleted file mode 100644 index 74ed0e0242..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.fake_quant_with_min_max_vars.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.fake_quant_with_min_max_vars(inputs, min, max, name=None)` {#fake_quant_with_min_max_vars} - -Fake-quantize the 'inputs' tensor of type float via global float scalars `min` - -and `max` to 'outputs' tensor of same shape as `inputs`. - -[min; max] is the clamping range for the 'inputs' data. Op divides this range -into 255 steps (total of 256 values), then replaces each 'inputs' value with the -closest of the quantized step values. - -This operation has a gradient and thus allows for training `min` and `max` values. - -##### Args: - - -* `inputs`: A `Tensor` of type `float32`. -* `min`: A `Tensor` of type `float32`. -* `max`: A `Tensor` of type `float32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.fake_quant_with_min_max_vars_per_channel.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.fake_quant_with_min_max_vars_per_channel.md deleted file mode 100644 index bc39cf9570..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.fake_quant_with_min_max_vars_per_channel.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.fake_quant_with_min_max_vars_per_channel(inputs, min, max, name=None)` {#fake_quant_with_min_max_vars_per_channel} - -Fake-quantize the 'inputs' tensor of type float and one of the shapes: `[d]`, - -`[b, d]` `[b, h, w, d]` via per-channel floats `min` and `max` of shape `[d]` -to 'outputs' tensor of same shape as `inputs`. - -[min; max] is the clamping range for the 'inputs' data in the corresponding -depth channel. Op divides this range into 255 steps (total of 256 values), then -replaces each 'inputs' value with the closest of the quantized step values. - -This operation has a gradient and thus allows for training `min` and `max` values. - -##### Args: - - -* `inputs`: A `Tensor` of type `float32`. -* `min`: A `Tensor` of type `float32`. -* `max`: A `Tensor` of type `float32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.foldl.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.foldl.md deleted file mode 100644 index 1206976da8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.foldl.md +++ /dev/null @@ -1,44 +0,0 @@ -### `tf.foldl(fn, elems, initializer=None, parallel_iterations=10, back_prop=True, swap_memory=False, name=None)` {#foldl} - -foldl on the list of tensors unpacked from `elems` on dimension 0. - -This foldl operator repeatedly applies the callable `fn` to a sequence -of elements from first to last. The elements are made of the tensors -unpacked from `elems` on dimension 0. The callable fn takes two tensors as -arguments. The first argument is the accumulated value computed from the -preceding invocation of fn. If `initializer` is None, `elems` must contain -at least one element, and its first element is used as the initializer. - -Suppose that `elems` is unpacked into `values`, a list of tensors. The shape -of the result tensor is fn(initializer, values[0]).shape`. - -##### Args: - - -* `fn`: The callable to be performed. -* `elems`: A tensor to be unpacked on dimension 0. -* `initializer`: (optional) The initial value for the accumulator. -* `parallel_iterations`: (optional) The number of iterations allowed to run - in parallel. -* `back_prop`: (optional) True enables support for back propagation. -* `swap_memory`: (optional) True enables GPU-CPU memory swapping. -* `name`: (optional) Name prefix for the returned tensors. - -##### Returns: - - A tensor resulting from applying `fn` consecutively to the list of tensors - unpacked from `elems`, from first to last. - -##### Raises: - - -* `TypeError`: if `fn` is not callable. - -##### Example: - - ```python - elems = [1, 2, 3, 4, 5, 6] - sum = foldl(lambda a, x: a + x, elems) - # sum == 21 - ``` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.global_variables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.global_variables.md deleted file mode 100644 index 1939f42224..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.global_variables.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.global_variables()` {#global_variables} - -Returns global variables. - -Global variables are variables that are shared across machines in a -distributed environment. The `Variable()` constructor or `get_variable()` -automatically adds new variables to the graph collection -`GraphKeys.GLOBAL_VARIABLES`. -This convenience function returns the contents of that collection. - -An alternative to global variables are local variables. See -[`tf.local_variables()`](../../api_docs/python/state_ops.md#local_variables) - -##### Returns: - - A list of `Variable` objects. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.group.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.group.md deleted file mode 100644 index 7958cf9e58..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.group.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.group(*inputs, **kwargs)` {#group} - -Create an op that groups multiple operations. - -When this op finishes, all ops in `input` have finished. This op has no -output. - -See also `tuple` and `with_dependencies`. - -##### Args: - - -* `*inputs`: Zero or more tensors to group. -* `**kwargs`: Optional parameters to pass when constructing the NodeDef. -* `name`: A name for this operation (optional). - -##### Returns: - - An Operation that executes all its inputs. - -##### Raises: - - -* `ValueError`: If an unknown keyword argument is provided. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.ifft2d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.ifft2d.md deleted file mode 100644 index d19b164d8c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.ifft2d.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.ifft2d(input, name=None)` {#ifft2d} - -Compute the inverse 2-dimensional discrete Fourier Transform over the inner-most - -2 dimensions of `input`. - -##### Args: - - -* `input`: A `Tensor` of type `complex64`. A complex64 tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `complex64`. - A complex64 tensor of the same shape as `input`. The inner-most 2 - dimensions of `input` are replaced with their inverse 2D Fourier Transform. - - @compatibility(numpy) - Equivalent to np.ifft2 - @end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.adjust_contrast.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.adjust_contrast.md deleted file mode 100644 index 2fbf1b3e2a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.adjust_contrast.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.image.adjust_contrast(images, contrast_factor)` {#adjust_contrast} - -Adjust contrast of RGB or grayscale images. - -This is a convenience method that converts an RGB image to float -representation, adjusts its contrast, and then converts it back to the -original data type. If several adjustments are chained it is advisable to -minimize the number of redundant conversions. - -`images` is a tensor of at least 3 dimensions. The last 3 dimensions are -interpreted as `[height, width, channels]`. The other dimensions only -represent a collection of images, such as `[batch, height, width, channels].` - -Contrast is adjusted independently for each channel of each image. - -For each channel, this Op computes the mean of the image pixels in the -channel and then adjusts each component `x` of each pixel to -`(x - mean) * contrast_factor + mean`. - -##### Args: - - -* `images`: Images to adjust. At least 3-D. -* `contrast_factor`: A float multiplier for adjusting contrast. - -##### Returns: - - The contrast-adjusted image or images. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.adjust_saturation.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.adjust_saturation.md deleted file mode 100644 index 1829271ff6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.adjust_saturation.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.image.adjust_saturation(image, saturation_factor, name=None)` {#adjust_saturation} - -Adjust saturation of an RGB image. - -This is a convenience method that converts an RGB image to float -representation, converts it to HSV, add an offset to the saturation channel, -converts back to RGB and then back to the original data type. If several -adjustments are chained it is advisable to minimize the number of redundant -conversions. - -`image` is an RGB image. The image saturation is adjusted by converting the -image to HSV and multiplying the saturation (S) channel by -`saturation_factor` and clipping. The image is then converted back to RGB. - -##### Args: - - -* `image`: RGB image or images. Size of the last dimension must be 3. -* `saturation_factor`: float. Factor to multiply the saturation by. -* `name`: A name for this operation (optional). - -##### Returns: - - Adjusted image(s), same shape and DType as `image`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.convert_image_dtype.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.convert_image_dtype.md deleted file mode 100644 index 63db6f36a9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.convert_image_dtype.md +++ /dev/null @@ -1,32 +0,0 @@ -### `tf.image.convert_image_dtype(image, dtype, saturate=False, name=None)` {#convert_image_dtype} - -Convert `image` to `dtype`, scaling its values if needed. - -Images that are represented using floating point values are expected to have -values in the range [0,1). Image data stored in integer data types are -expected to have values in the range `[0,MAX]`, where `MAX` is the largest -positive representable number for the data type. - -This op converts between data types, scaling the values appropriately before -casting. - -Note that converting from floating point inputs to integer types may lead to -over/underflow problems. Set saturate to `True` to avoid such problem in -problematic conversions. If enabled, saturation will clip the output into the -allowed range before performing a potentially dangerous cast (and only before -performing such a cast, i.e., when casting from a floating point to an integer -type, and when casting from a signed to an unsigned type; `saturate` has no -effect on casts between floats, or on casts that increase the type's range). - -##### Args: - - -* `image`: An image. -* `dtype`: A `DType` to convert `image` to. -* `saturate`: If `True`, clip the input before casting (if necessary). -* `name`: A name for this operation (optional). - -##### Returns: - - `image`, converted to `dtype`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.decode_png.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.decode_png.md deleted file mode 100644 index 4332af7704..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.decode_png.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.image.decode_png(contents, channels=None, dtype=None, name=None)` {#decode_png} - -Decode a PNG-encoded image to a uint8 or uint16 tensor. - -The attr `channels` indicates the desired number of color channels for the -decoded image. - -Accepted values are: - -* 0: Use the number of channels in the PNG-encoded image. -* 1: output a grayscale image. -* 3: output an RGB image. -* 4: output an RGBA image. - -If needed, the PNG-encoded image is transformed to match the requested number -of color channels. - -##### Args: - - -* `contents`: A `Tensor` of type `string`. 0-D. The PNG-encoded image. -* `channels`: An optional `int`. Defaults to `0`. - Number of color channels for the decoded image. -* `dtype`: An optional `tf.DType` from: `tf.uint8, tf.uint16`. Defaults to `tf.uint8`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `dtype`. 3-D with shape `[height, width, channels]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.random_contrast.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.random_contrast.md deleted file mode 100644 index 76cd2292cf..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.random_contrast.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.image.random_contrast(image, lower, upper, seed=None)` {#random_contrast} - -Adjust the contrast of an image by a random factor. - -Equivalent to `adjust_contrast()` but uses a `contrast_factor` randomly -picked in the interval `[lower, upper]`. - -##### Args: - - -* `image`: An image tensor with 3 or more dimensions. -* `lower`: float. Lower bound for the random contrast factor. -* `upper`: float. Upper bound for the random contrast factor. -* `seed`: A Python integer. Used to create a random seed. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - -##### Returns: - - The contrast-adjusted tensor. - -##### Raises: - - -* `ValueError`: if `upper <= lower` or if `lower < 0`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.random_saturation.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.random_saturation.md deleted file mode 100644 index 397bfc4d0b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.image.random_saturation.md +++ /dev/null @@ -1,27 +0,0 @@ -### `tf.image.random_saturation(image, lower, upper, seed=None)` {#random_saturation} - -Adjust the saturation of an RGB image by a random factor. - -Equivalent to `adjust_saturation()` but uses a `saturation_factor` randomly -picked in the interval `[lower, upper]`. - -##### Args: - - -* `image`: RGB image or images. Size of the last dimension must be 3. -* `lower`: float. Lower bound for the random saturation factor. -* `upper`: float. Upper bound for the random saturation factor. -* `seed`: An operation-specific seed. It will be used in conjunction - with the graph-level seed to determine the real seeds that will be - used in this operation. Please see the documentation of - set_random_seed for its interaction with the graph-level random seed. - -##### Returns: - - Adjusted image(s), same shape and DType as `image`. - -##### Raises: - - -* `ValueError`: if `upper <= lower` or if `lower < 0`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.local_variables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.local_variables.md deleted file mode 100644 index 2bf8d2f912..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.local_variables.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.local_variables()` {#local_variables} - -Returns local variables. - -Local variables - per process variables, usually not saved/restored to -checkpoint and used for temporary or intermediate values. -For example, they can be used as counters for metrics computation or -number of epochs this machine has read data. -The `tf.contrib.framework.local_variable()` function automatically adds the -new variable to `GraphKeys.LOCAL_VARIABLES`. -This convenience function returns the contents of that collection. - -An alternative to local variables are global variables. See -[`tf.global_variables()`](../../api_docs/python/state_ops.md#global_variables) - -##### Returns: - - A list of local `Variable` objects. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.logical_xor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.logical_xor.md deleted file mode 100644 index 20db3e60a6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.logical_xor.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.logical_xor(x, y, name='LogicalXor')` {#logical_xor} - -x ^ y = (x | y) & ~(x & y). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.multinomial.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.multinomial.md deleted file mode 100644 index 8e8e1e102d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.multinomial.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.multinomial(logits, num_samples, seed=None, name=None)` {#multinomial} - -Draws samples from a multinomial distribution. - -Example: - -```python -# samples has shape [1, 5], where each value is either 0 or 1 with equal -# probability. -samples = tf.multinomial(tf.log([[10., 10.]]), 5) -``` - -##### Args: - - -* `logits`: 2-D Tensor with shape `[batch_size, num_classes]`. Each slice - `[i, :]` represents the unnormalized log probabilities for all classes. -* `num_samples`: 0-D. Number of independent samples to draw for each row slice. -* `seed`: A Python integer. Used to create a random seed for the distribution. - See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: Optional name for the operation. - -##### Returns: - - The drawn samples of shape `[batch_size, num_samples]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.dropout.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.dropout.md deleted file mode 100644 index 4f2b7c0214..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.dropout.md +++ /dev/null @@ -1,38 +0,0 @@ -### `tf.nn.dropout(x, keep_prob, noise_shape=None, seed=None, name=None)` {#dropout} - -Computes dropout. - -With probability `keep_prob`, outputs the input element scaled up by -`1 / keep_prob`, otherwise outputs `0`. The scaling is so that the expected -sum is unchanged. - -By default, each element is kept or dropped independently. If `noise_shape` -is specified, it must be -[broadcastable](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) -to the shape of `x`, and only dimensions with `noise_shape[i] == shape(x)[i]` -will make independent decisions. For example, if `shape(x) = [k, l, m, n]` -and `noise_shape = [k, 1, 1, n]`, each batch and channel component will be -kept independently and each row and column will be kept or not kept together. - -##### Args: - - -* `x`: A tensor. -* `keep_prob`: A scalar `Tensor` with the same type as x. The probability - that each element is kept. -* `noise_shape`: A 1-D `Tensor` of type `int32`, representing the - shape for randomly generated keep/drop flags. -* `seed`: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: A name for this operation (optional). - -##### Returns: - - A Tensor of the same shape of `x`. - -##### Raises: - - -* `ValueError`: If `keep_prob` is not in `(0, 1]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.fractional_max_pool.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.fractional_max_pool.md deleted file mode 100644 index 8f8fb0237c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.fractional_max_pool.md +++ /dev/null @@ -1,81 +0,0 @@ -### `tf.nn.fractional_max_pool(value, pooling_ratio, pseudo_random=None, overlapping=None, deterministic=None, seed=None, seed2=None, name=None)` {#fractional_max_pool} - -Performs fractional max pooling on the input. - -Fractional max pooling is slightly different than regular max pooling. In -regular max pooling, you downsize an input set by taking the maximum value of -smaller N x N subsections of the set (often 2x2), and try to reduce the set by -a factor of N, where N is an integer. Fractional max pooling, as you might -expect from the word "fractional", means that the overall reduction ratio N -does not have to be an integer. - -The sizes of the pooling regions are generated randomly but are fairly uniform. -For example, let's look at the height dimension, and the constraints on the -list of rows that will be pool boundaries. - -First we define the following: - -1. input_row_length : the number of rows from the input set -2. output_row_length : which will be smaller than the input -3. alpha = input_row_length / output_row_length : our reduction ratio -4. K = floor(alpha) -5. row_pooling_sequence : this is the result list of pool boundary rows - -Then, row_pooling_sequence should satisfy: - -1. a[0] = 0 : the first value of the sequence is 0 -2. a[end] = input_row_length : the last value of the sequence is the size -3. K <= (a[i+1] - a[i]) <= K+1 : all intervals are K or K+1 size -4. length(row_pooling_sequence) = output_row_length+1 - -For more details on fractional max pooling, see this paper: -[Benjamin Graham, Fractional Max-Pooling](http://arxiv.org/abs/1412.6071) - -##### Args: - - -* `value`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`. - 4-D with shape `[batch, height, width, channels]`. -* `pooling_ratio`: A list of `floats` that has length `>= 4`. - Pooling ratio for each dimension of `value`, currently only - supports row and col dimension and should be >= 1.0. For example, a valid - pooling ratio looks like [1.0, 1.44, 1.73, 1.0]. The first and last elements - must be 1.0 because we don't allow pooling on batch and channels - dimensions. 1.44 and 1.73 are pooling ratio on height and width dimensions - respectively. -* `pseudo_random`: An optional `bool`. Defaults to `False`. - When set to True, generates the pooling sequence in a - pseudorandom fashion, otherwise, in a random fashion. Check paper [Benjamin - Graham, Fractional Max-Pooling](http://arxiv.org/abs/1412.6071) for - difference between pseudorandom and random. -* `overlapping`: An optional `bool`. Defaults to `False`. - When set to True, it means when pooling, the values at the boundary - of adjacent pooling cells are used by both cells. For example: - - `index 0 1 2 3 4` - - `value 20 5 16 3 7` - - If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. - The result would be [20, 16] for fractional max pooling. - -* `deterministic`: An optional `bool`. Defaults to `False`. - When set to True, a fixed pooling region will be used when - iterating over a FractionalMaxPool node in the computation graph. Mainly used - in unit test to make FractionalMaxPool deterministic. -* `seed`: An optional `int`. Defaults to `0`. - If either seed or seed2 are set to be non-zero, the random number - generator is seeded by the given seed. Otherwise, it is seeded by a - random seed. -* `seed2`: An optional `int`. Defaults to `0`. - An second seed to avoid seed collision. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, row_pooling_sequence, col_pooling_sequence). - -* `output`: A `Tensor`. Has the same type as `value`. output tensor after fractional max pooling. -* `row_pooling_sequence`: A `Tensor` of type `int64`. row pooling sequence, needed to calculate gradient. -* `col_pooling_sequence`: A `Tensor` of type `int64`. column pooling sequence, needed to calculate gradient. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.log_softmax.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.log_softmax.md deleted file mode 100644 index ac55b177d0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.log_softmax.md +++ /dev/null @@ -1,27 +0,0 @@ -### `tf.nn.log_softmax(logits, dim=-1, name=None)` {#log_softmax} - -Computes log softmax activations. - -For each batch `i` and class `j` we have - - logsoftmax = logits - log(reduce_sum(exp(logits), dim)) - -##### Args: - - -* `logits`: A non-empty `Tensor`. Must be one of the following types: `half`, - `float32`, `float64`. -* `dim`: The dimension softmax would be performed on. The default is -1 which - indicates the last dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `logits`. Same shape as `logits`. - -##### Raises: - - -* `InvalidArgumentError`: if `logits` is empty or `dim` is beyond the last - dimension of `logits`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.max_pool.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.max_pool.md deleted file mode 100644 index 05934c00e1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.max_pool.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.nn.max_pool(value, ksize, strides, padding, data_format='NHWC', name=None)` {#max_pool} - -Performs the max pooling on the input. - -##### Args: - - -* `value`: A 4-D `Tensor` with shape `[batch, height, width, channels]` and - type `tf.float32`. -* `ksize`: A list of ints that has length >= 4. The size of the window for - each dimension of the input tensor. -* `strides`: A list of ints that has length >= 4. The stride of the sliding - window for each dimension of the input tensor. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. - See the [comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `data_format`: A string. 'NHWC' and 'NCHW' are supported. -* `name`: Optional name for the operation. - -##### Returns: - - A `Tensor` with type `tf.float32`. The max pooled output tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.quantized_max_pool.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.quantized_max_pool.md deleted file mode 100644 index 3ddffd5b83..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.quantized_max_pool.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.nn.quantized_max_pool(input, min_input, max_input, ksize, strides, padding, name=None)` {#quantized_max_pool} - -Produces the max pool of the input tensor for quantized types. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `qint8`, `quint8`, `qint16`, `quint16`, `qint32`. - The 4D (batch x rows x cols x depth) Tensor to MaxReduce over. -* `min_input`: A `Tensor` of type `float32`. - The float value that the lowest quantized input value represents. -* `max_input`: A `Tensor` of type `float32`. - The float value that the highest quantized input value represents. -* `ksize`: A list of `ints`. - The size of the window for each dimension of the input tensor. - The length must be 4 to match the number of dimensions of the input. -* `strides`: A list of `ints`. - The stride of the sliding window for each dimension of the input - tensor. The length must be 4 to match the number of dimensions of the input. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, min_output, max_output). - -* `output`: A `Tensor`. Has the same type as `input`. -* `min_output`: A `Tensor` of type `float32`. The float value that the lowest quantized output value represents. -* `max_output`: A `Tensor` of type `float32`. The float value that the highest quantized output value represents. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.quantized_relu_x.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.quantized_relu_x.md deleted file mode 100644 index 2738a4bdab..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.quantized_relu_x.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.nn.quantized_relu_x(features, max_value, min_features, max_features, out_type=None, name=None)` {#quantized_relu_x} - -Computes Quantized Rectified Linear X: `min(max(features, 0), max_value)` - -##### Args: - - -* `features`: A `Tensor`. Must be one of the following types: `qint8`, `quint8`, `qint16`, `quint16`, `qint32`. -* `max_value`: A `Tensor` of type `float32`. -* `min_features`: A `Tensor` of type `float32`. - The float value that the lowest quantized value represents. -* `max_features`: A `Tensor` of type `float32`. - The float value that the highest quantized value represents. -* `out_type`: An optional `tf.DType` from: `tf.qint8, tf.quint8, tf.qint16, tf.quint16, tf.qint32`. Defaults to `tf.quint8`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (activations, min_activations, max_activations). - -* `activations`: A `Tensor` of type `out_type`. Has the same output shape as "features". -* `min_activations`: A `Tensor` of type `float32`. The float value that the lowest quantized value represents. -* `max_activations`: A `Tensor` of type `float32`. The float value that the highest quantized value represents. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.softsign.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.softsign.md deleted file mode 100644 index 971b2a8134..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.nn.softsign.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.nn.softsign(features, name=None)` {#softsign} - -Computes softsign: `features / (abs(features) + 1)`. - -##### Args: - - -* `features`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `features`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.parse_tensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.parse_tensor.md deleted file mode 100644 index 796eb39598..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.parse_tensor.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.parse_tensor(serialized, out_type, name=None)` {#parse_tensor} - -Transforms a serialized tensorflow.TensorProto proto into a Tensor. - -##### Args: - - -* `serialized`: A `Tensor` of type `string`. - A scalar string containing a serialized TensorProto proto. -* `out_type`: A `tf.DType`. - The type of the serialized tensor. The provided type must match the - type of the serialized tensor and no implicit conversion will take place. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `out_type`. A Tensor of type `out_type`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.placeholder.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.placeholder.md deleted file mode 100644 index 28cdc11cce..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.placeholder.md +++ /dev/null @@ -1,34 +0,0 @@ -### `tf.placeholder(dtype, shape=None, name=None)` {#placeholder} - -Inserts a placeholder for a tensor that will be always fed. - -**Important**: This tensor will produce an error if evaluated. Its value must -be fed using the `feed_dict` optional argument to `Session.run()`, -`Tensor.eval()`, or `Operation.run()`. - -For example: - -```python -x = tf.placeholder(tf.float32, shape=(1024, 1024)) -y = tf.matmul(x, x) - -with tf.Session() as sess: - print(sess.run(y)) # ERROR: will fail because x was not fed. - - rand_array = np.random.rand(1024, 1024) - print(sess.run(y, feed_dict={x: rand_array})) # Will succeed. -``` - -##### Args: - - -* `dtype`: The type of elements in the tensor to be fed. -* `shape`: The shape of the tensor to be fed (optional). If the shape is not - specified, you can feed a tensor of any shape. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` that may be used as a handle for feeding a value, but not - evaluated directly. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.random_gamma.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.random_gamma.md deleted file mode 100644 index 1d99f8c2f8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.random_gamma.md +++ /dev/null @@ -1,65 +0,0 @@ -### `tf.random_gamma(shape, alpha, beta=None, dtype=tf.float32, seed=None, name=None)` {#random_gamma} - -Draws `shape` samples from each of the given Gamma distribution(s). - -`alpha` is the shape parameter describing the distribution(s), and `beta` is -the inverse scale parameter(s). - -Example: - - samples = tf.random_gamma([10], [0.5, 1.5]) - # samples has shape [10, 2], where each slice [:, 0] and [:, 1] represents - # the samples drawn from each distribution - - samples = tf.random_gamma([7, 5], [0.5, 1.5]) - # samples has shape [7, 5, 2], where each slice [:, :, 0] and [:, :, 1] - # represents the 7x5 samples drawn from each of the two distributions - - samples = tf.random_gamma([30], [[1.],[3.],[5.]], beta=[[3., 4.]]) - # samples has shape [30, 3, 2], with 30 samples each of 3x2 distributions. - - Note that for small alpha values, there is a chance you will draw a value of - exactly 0, which gets worse for lower-precision dtypes, even though zero is - not in the support of the gamma distribution. - - Relevant cdfs (~chance you will draw a exactly-0 value): - ``` - stats.gamma(.01).cdf(np.finfo(np.float16).tiny) - 0.91269738769897879 - stats.gamma(.01).cdf(np.finfo(np.float32).tiny) - 0.41992668622045726 - stats.gamma(.01).cdf(np.finfo(np.float64).tiny) - 0.00084322740680686662 - stats.gamma(.35).cdf(np.finfo(np.float16).tiny) - 0.037583276135263931 - stats.gamma(.35).cdf(np.finfo(np.float32).tiny) - 5.9514895726818067e-14 - stats.gamma(.35).cdf(np.finfo(np.float64).tiny) - 2.3529843400647272e-108 - ``` - -##### Args: - - -* `shape`: A 1-D integer Tensor or Python array. The shape of the output samples - to be drawn per alpha/beta-parameterized distribution. -* `alpha`: A Tensor or Python value or N-D array of type `dtype`. `alpha` - provides the shape parameter(s) describing the gamma distribution(s) to - sample. Must be broadcastable with `beta`. -* `beta`: A Tensor or Python value or N-D array of type `dtype`. Defaults to 1. - `beta` provides the inverse scale parameter(s) of the gamma - distribution(s) to sample. Must be broadcastable with `alpha`. -* `dtype`: The type of alpha, beta, and the output: `float16`, `float32`, or - `float64`. -* `seed`: A Python integer. Used to create a random seed for the distributions. - See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: Optional name for the operation. - -##### Returns: - - -* `samples`: a `Tensor` of shape `tf.concat(shape, tf.shape(alpha + beta))` - with values of type `dtype`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.random_shuffle.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.random_shuffle.md deleted file mode 100644 index 14f40d64af..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.random_shuffle.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.random_shuffle(value, seed=None, name=None)` {#random_shuffle} - -Randomly shuffles a tensor along its first dimension. - -The tensor is shuffled along dimension 0, such that each `value[j]` is mapped -to one and only one `output[i]`. For example, a mapping that might occur for a -3x2 tensor is: - -```python -[[1, 2], [[5, 6], - [3, 4], ==> [1, 2], - [5, 6]] [3, 4]] -``` - -##### Args: - - -* `value`: A Tensor to be shuffled. -* `seed`: A Python integer. Used to create a random seed for the distribution. - See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: A name for the operation (optional). - -##### Returns: - - A tensor of same shape and type as `value`, shuffled along its first - dimension. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.reduce_min.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.reduce_min.md deleted file mode 100644 index f1b0ba6614..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.reduce_min.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.reduce_min(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_min} - -Computes the minimum of elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -##### Args: - - -* `input_tensor`: The tensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - -@compatibility(numpy) -Equivalent to np.min -@end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.register_tensor_conversion_function.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.register_tensor_conversion_function.md deleted file mode 100644 index dc55e629b4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.register_tensor_conversion_function.md +++ /dev/null @@ -1,44 +0,0 @@ -### `tf.register_tensor_conversion_function(base_type, conversion_func, priority=100)` {#register_tensor_conversion_function} - -Registers a function for converting objects of `base_type` to `Tensor`. - -The conversion function must have the following signature: - -```python - def conversion_func(value, dtype=None, name=None, as_ref=False): - # ... -``` - -It must return a `Tensor` with the given `dtype` if specified. If the -conversion function creates a new `Tensor`, it should use the given -`name` if specified. All exceptions will be propagated to the caller. - -The conversion function may return `NotImplemented` for some -inputs. In this case, the conversion process will continue to try -subsequent conversion functions. - -If `as_ref` is true, the function must return a `Tensor` reference, -such as a `Variable`. - -NOTE: The conversion functions will execute in order of priority, -followed by order of registration. To ensure that a conversion function -`F` runs before another conversion function `G`, ensure that `F` is -registered with a smaller priority than `G`. - -##### Args: - - -* `base_type`: The base type or tuple of base types for all objects that - `conversion_func` accepts. -* `conversion_func`: A function that converts instances of `base_type` to - `Tensor`. -* `priority`: Optional integer that indicates the priority for applying this - conversion function. Conversion functions with smaller priority values - run earlier than conversion functions with larger priority values. - Defaults to 100. - -##### Raises: - - -* `TypeError`: If the arguments do not have the appropriate type. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.scatter_mul.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.scatter_mul.md deleted file mode 100644 index 94da4712d4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.scatter_mul.md +++ /dev/null @@ -1,42 +0,0 @@ -### `tf.scatter_mul(ref, indices, updates, use_locking=None, name=None)` {#scatter_mul} - -Multiplies sparse updates into a variable reference. - -This operation computes - - # Scalar indices - ref[indices, ...] *= updates[...] - - # Vector indices (for each i) - ref[indices[i], ...] *= updates[i, ...] - - # High rank indices (for each i, ..., j) - ref[indices[i, ..., j], ...] *= updates[i, ..., j, ...] - -This operation outputs `ref` after the update is done. -This makes it easier to chain operations that need to use the reset value. - -Duplicate entries are handled correctly: if multiple `indices` reference -the same location, their contributions multiply. - -Requires `updates.shape = indices.shape + ref.shape[1:]`. - -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Should be from a `Variable` node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A tensor of indices into the first dimension of `ref`. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A tensor of updated values to multiply to `ref`. -* `use_locking`: An optional `bool`. Defaults to `False`. - If True, the operation will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as `ref`. Returned as a convenience for operations that want - to use the updated values after the update is done. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.scatter_nd_add.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.scatter_nd_add.md deleted file mode 100644 index 4d1472205d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.scatter_nd_add.md +++ /dev/null @@ -1,61 +0,0 @@ -### `tf.scatter_nd_add(ref, indices, updates, use_locking=None, name=None)` {#scatter_nd_add} - -Applies sparse addition between `updates` and individual values or slices - -within a given variable according to `indices`. - -`ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. - -`indices` must be integer tensor, containing indices into `ref`. -It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. - -The innermost dimension of `indices` (with length `K`) corresponds to -indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th -dimension of `ref`. - -`updates` is `Tensor` of rank `Q-1+P-K` with shape: - -``` -[d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]]. -``` - -For example, say we want to add 4 scattered elements to a rank-1 tensor to 8 -elements. In Python, that addition would look like this: - - ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8]) - indices = tf.constant([[4], [3], [1], [7]]) - updates = tf.constant([9, 10, 11, 12]) - add = tf.scatter_nd_add(ref, indices, updates) - with tf.Session() as sess: - print sess.run(add) - -The resulting update to ref would look like this: - - [1, 13, 3, 14, 14, 6, 7, 20] - -See [tf.scatter_nd](#scatter_nd) for more details about how to make updates to -slices. - -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - A mutable Tensor. Should be from a Variable node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A Tensor. Must be one of the following types: int32, int64. - A tensor of indices into ref. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A Tensor. Must have the same type as ref. A tensor of updated values - to add to ref. -* `use_locking`: An optional `bool`. Defaults to `False`. - An optional bool. Defaults to True. If True, the assignment will - be protected by a lock; otherwise the behavior is undefined, - but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - A mutable `Tensor`. Has the same type as `ref`. - Same as ref. Returned as a convenience for operations that want - to use the updated values after the update is done. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.segment_mean.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.segment_mean.md deleted file mode 100644 index 5d901859a9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.segment_mean.md +++ /dev/null @@ -1,32 +0,0 @@ -### `tf.segment_mean(data, segment_ids, name=None)` {#segment_mean} - -Computes the mean along segments of a tensor. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -Computes a tensor such that -\\(output_i = \frac{\sum_j data_j}{N}\\) where `mean` is -over `j` such that `segment_ids[j] == i` and `N` is the total number of -values summed. - -
- -
- -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `segment_ids`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor whose rank is equal to the rank of `data`'s - first dimension. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.shape.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.shape.md deleted file mode 100644 index 2032de86af..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.shape.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.shape(input, name=None, out_type=tf.int32)` {#shape} - -Returns the shape of a tensor. - -This operation returns a 1-D integer tensor representing the shape of `input`. - -For example: - -```python -# 't' is [[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]] -shape(t) ==> [2, 2, 3] -``` - -##### Args: - - -* `input`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). -* `out_type`: (Optional) The specified output type of the operation - (`int32` or `int64`). Defaults to `tf.int32`. - -##### Returns: - - A `Tensor` of type `out_type`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.sparse_concat.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.sparse_concat.md deleted file mode 100644 index 70cab998b4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.sparse_concat.md +++ /dev/null @@ -1,102 +0,0 @@ -### `tf.sparse_concat(axis, sp_inputs, name=None, expand_nonconcat_dim=False, concat_dim=None)` {#sparse_concat} - -Concatenates a list of `SparseTensor` along the specified dimension. - -Concatenation is with respect to the dense versions of each sparse input. -It is assumed that each inputs is a `SparseTensor` whose elements are ordered -along increasing dimension number. - -If expand_nonconcat_dim is False, all inputs' shapes must match, except for -the concat dimension. If expand_nonconcat_dim is True, then inputs' shapes are -allowed to vary among all inputs. - -The `indices`, `values`, and `shapes` lists must have the same length. - -If expand_nonconcat_dim is False, then the output shape is identical to the -inputs', except along the concat dimension, where it is the sum of the inputs' -sizes along that dimension. - -If expand_nonconcat_dim is True, then the output shape along the non-concat -dimensions will be expand to be the largest among all inputs, and it is the -sum of the inputs sizes along the concat dimension. - -The output elements will be resorted to preserve the sort order along -increasing dimension number. - -This op runs in `O(M log M)` time, where `M` is the total number of non-empty -values across all inputs. This is due to the need for an internal sort in -order to concatenate efficiently across an arbitrary dimension. - -For example, if `axis = 1` and the inputs are - - sp_inputs[0]: shape = [2, 3] - [0, 2]: "a" - [1, 0]: "b" - [1, 1]: "c" - - sp_inputs[1]: shape = [2, 4] - [0, 1]: "d" - [0, 2]: "e" - -then the output will be - - shape = [2, 7] - [0, 2]: "a" - [0, 4]: "d" - [0, 5]: "e" - [1, 0]: "b" - [1, 1]: "c" - -Graphically this is equivalent to doing - - [ a] concat [ d e ] = [ a d e ] - [b c ] [ ] [b c ] - -Another example, if 'axis = 1' and the inputs are - - sp_inputs[0]: shape = [3, 3] - [0, 2]: "a" - [1, 0]: "b" - [2, 1]: "c" - - sp_inputs[1]: shape = [2, 4] - [0, 1]: "d" - [0, 2]: "e" - -if expand_nonconcat_dim = False, this will result in an error. But if -expand_nonconcat_dim = True, this will result in: - - shape = [3, 7] - [0, 2]: "a" - [0, 4]: "d" - [0, 5]: "e" - [1, 0]: "b" - [2, 1]: "c" - -Graphically this is equivalent to doing - - [ a] concat [ d e ] = [ a d e ] - [b ] [ ] [b ] - [ c ] [ c ] - - -##### Args: - - -* `axis`: Dimension to concatenate along. Must be in range [-rank, rank), - where rank is the number of dimensions in each input `SparseTensor`. -* `sp_inputs`: List of `SparseTensor` to concatenate. -* `name`: A name prefix for the returned tensors (optional). -* `expand_nonconcat_dim`: Whether to allow the expansion in the non-concat - dimensions. Defaulted to False. -* `concat_dim`: The old (deprecated) name for axis. - -##### Returns: - - A `SparseTensor` with the concatenated output. - -##### Raises: - - -* `TypeError`: If `sp_inputs` is not a list of `SparseTensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.sparse_softmax.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.sparse_softmax.md deleted file mode 100644 index b2b5d4b9c3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.sparse_softmax.md +++ /dev/null @@ -1,52 +0,0 @@ -### `tf.sparse_softmax(sp_input, name=None)` {#sparse_softmax} - -Applies softmax to a batched N-D `SparseTensor`. - -The inputs represent an N-D SparseTensor with logical shape `[..., B, C]` -(where `N >= 2`), and with indices sorted in the canonical lexicographic -order. - -This op is equivalent to applying the normal `tf.nn.softmax()` to each -innermost logical submatrix with shape `[B, C]`, but with the catch that *the -implicitly zero elements do not participate*. Specifically, the algorithm is -equivalent to: - - (1) Applies `tf.nn.softmax()` to a densified view of each innermost - submatrix with shape `[B, C]`, along the size-C dimension; - (2) Masks out the original implicitly-zero locations; - (3) Renormalizes the remaining elements. - -Hence, the `SparseTensor` result has exactly the same non-zero indices and -shape. - -Example: - -```python -# First batch: -# [? e.] -# [1. ? ] -# Second batch: -# [e ? ] -# [e e ] -shape = [2, 2, 2] # 3-D SparseTensor -values = np.asarray([[[0., np.e], [1., 0.]], [[np.e, 0.], [np.e, np.e]]]) -indices = np.vstack(np.where(values)).astype(np.int64).T - -result = tf.sparse_softmax(tf.SparseTensor(indices, values, shape)) -# ...returning a 3-D SparseTensor, equivalent to: -# [? 1.] [1 ?] -# [1. ? ] and [.5 .5] -# where ? means implicitly zero. -``` - -##### Args: - - -* `sp_input`: N-D `SparseTensor`, where `N >= 2`. -* `name`: optional name of the operation. - -##### Returns: - - -* `output`: N-D `SparseTensor` representing the results. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.sparse_split.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.sparse_split.md deleted file mode 100644 index 11fa3f4465..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.sparse_split.md +++ /dev/null @@ -1,43 +0,0 @@ -### `tf.sparse_split(keyword_required=KeywordRequired(), sp_input=None, num_split=None, axis=None, name=None, split_dim=None)` {#sparse_split} - -Split a `SparseTensor` into `num_split` tensors along `axis`. - -If the `sp_input.dense_shape[axis]` is not an integer multiple of `num_split` -each slice starting from 0:`shape[axis] % num_split` gets extra one -dimension. For example, if `axis = 1` and `num_split = 2` and the -input is: - - input_tensor = shape = [2, 7] - [ a d e ] - [b c ] - -Graphically the output tensors are: - - output_tensor[0] = - [ a ] - [b c ] - - output_tensor[1] = - [ d e ] - [ ] - -##### Args: - - -* `keyword_required`: Python 2 standin for * (temporary for argument reorder) -* `sp_input`: The `SparseTensor` to split. -* `num_split`: A Python integer. The number of ways to split. -* `axis`: A 0-D `int32` `Tensor`. The dimension along which to split. -* `name`: A name for the operation (optional). -* `split_dim`: Deprecated old name for axis. - -##### Returns: - - `num_split` `SparseTensor` objects resulting from splitting `value`. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. -* `ValueError`: If the deprecated `split_dim` and `axis` are both non None. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.stop_gradient.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.stop_gradient.md deleted file mode 100644 index 53759f49ff..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.stop_gradient.md +++ /dev/null @@ -1,34 +0,0 @@ -### `tf.stop_gradient(input, name=None)` {#stop_gradient} - -Stops gradient computation. - -When executed in a graph, this op outputs its input tensor as-is. - -When building ops to compute gradients, this op prevents the contribution of -its inputs to be taken into account. Normally, the gradient generator adds ops -to a graph to compute the derivatives of a specified 'loss' by recursively -finding out inputs that contributed to its computation. If you insert this op -in the graph it inputs are masked from the gradient generator. They are not -taken into account for computing gradients. - -This is useful any time you want to compute a value with TensorFlow but need -to pretend that the value was a constant. Some examples include: - -* The *EM* algorithm where the *M-step* should not involve backpropagation - through the output of the *E-step*. -* Contrastive divergence training of Boltzmann machines where, when - differentiating the energy function, the training must not backpropagate - through the graph that generated the samples from the model. -* Adversarial training, where no backprop should happen through the adversarial - example generation process. - -##### Args: - - -* `input`: A `Tensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.substr.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.substr.md deleted file mode 100644 index 0f5a21cc14..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.substr.md +++ /dev/null @@ -1,92 +0,0 @@ -### `tf.substr(input, pos, len, name=None)` {#substr} - -Return substrings from `Tensor` of strings. - -For each string in the input `Tensor`, creates a substring starting at index -`pos` with a total length of `len`. - -If `len` defines a substring that would extend beyond the length of the input -string, then as many characters as possible are used. - -If `pos` is negative or specifies a character index larger than any of the input -strings, then an `InvalidArgumentError` is thrown. - -`pos` and `len` must have the same shape, otherwise a `ValueError` is thrown on -Op creation. - -*NOTE*: `Substr` supports broadcasting up to two dimensions. More about -broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - ---- - -Examples - -Using scalar `pos` and `len`: - -``` -input = [b'Hello', b'World'] -position = 1 -length = 3 - -output = [b'ell', b'orl'] -``` - -Using `pos` and `len` with same shape as `input`: - -``` -input = [[b'ten', b'eleven', b'twelve'], - [b'thirteen', b'fourteen', b'fifteen'], - [b'sixteen', b'seventeen', b'eighteen']] -position = [[1, 2, 3], - [1, 2, 3], - [1, 2, 3]] -length = [[2, 3, 4], - [4, 3, 2], - [5, 5, 5]] - -output = [[b'en', b'eve', b'lve'], - [b'hirt', b'urt', b'te'], - [b'ixtee', b'vente', b'hteen']] -``` - -Broadcasting `pos` and `len` onto `input`: - -``` -input = [[b'ten', b'eleven', b'twelve'], - [b'thirteen', b'fourteen', b'fifteen'], - [b'sixteen', b'seventeen', b'eighteen'], - [b'nineteen', b'twenty', b'twentyone']] -position = [1, 2, 3] -length = [1, 2, 3] - -output = [[b'e', b'ev', b'lve'], - [b'h', b'ur', b'tee'], - [b'i', b've', b'hte'], - [b'i', b'en', b'nty']] -``` - -Broadcasting `input` onto `pos` and `len`: - -``` -input = b'thirteen' -position = [1, 5, 7] -length = [3, 2, 1] - -output = [b'hir', b'ee', b'n"] -``` - -##### Args: - - -* `input`: A `Tensor` of type `string`. Tensor of strings -* `pos`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - Scalar defining the position of first character in each substring -* `len`: A `Tensor`. Must have the same type as `pos`. - Scalar defining the number of characters to include in each substring -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. Tensor of substrings - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.svd.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.svd.md deleted file mode 100644 index 74185ba7c9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.svd.md +++ /dev/null @@ -1,47 +0,0 @@ -### `tf.svd(tensor, full_matrices=False, compute_uv=True, name=None)` {#svd} - -Computes the singular value decompositions of one or more matrices. - -Computes the SVD of each inner matrix in `tensor` such that -`tensor[..., :, :] = u[..., :, :] * diag(s[..., :, :]) * transpose(v[..., :, -:])` - -```prettyprint -# a is a tensor. -# s is a tensor of singular values. -# u is a tensor of left singular vectors. -#v is a tensor of right singular vectors. -s, u, v = svd(a) -s = svd(a, compute_uv=False) -``` - -##### Args: - - -* `tensor`: `Tensor` of shape `[..., M, N]`. Let `P` be the minimum of `M` and - `N`. -* `full_matrices`: If true, compute full-sized `u` and `v`. If false - (the default), compute only the leading `P` singular vectors. - Ignored if `compute_uv` is `False`. -* `compute_uv`: If `True` then left and right singular vectors will be - computed and returned in `u` and `v`, respectively. Otherwise, only the - singular values will be computed, which can be significantly faster. -* `name`: string, optional name of the operation. - -##### Returns: - - -* `s`: Singular values. Shape is `[..., P]`. -* `u`: Right singular vectors. If `full_matrices` is `False` (default) then - shape is `[..., M, P]`; if `full_matrices` is `True` then shape is - `[..., M, M]`. Not returned if `compute_uv` is `False`. -* `v`: Left singular vectors. If `full_matrices` is `False` (default) then - shape is `[..., N, P]`. If `full_matrices` is `True` then shape is - `[..., N, N]`. Not returned if `compute_uv` is `False`. - -@compatibility(numpy) -Mostly equivalent to numpy.linalg.svd, except that the order of output -arguments here is `s`, `u`, `v` when `compute_uv` is `True`, as opposed to -`u`, `s`, `v` for numpy.linalg.svd. -@end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.test.compute_gradient_error.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.test.compute_gradient_error.md deleted file mode 100644 index d7175f3239..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.test.compute_gradient_error.md +++ /dev/null @@ -1,38 +0,0 @@ -### `tf.test.compute_gradient_error(x, x_shape, y, y_shape, x_init_value=None, delta=0.001, init_targets=None, extra_feed_dict=None)` {#compute_gradient_error} - -Computes the gradient error. - -Computes the maximum error for dy/dx between the computed Jacobian and the -numerically estimated Jacobian. - -This function will modify the tensors passed in as it adds more operations -and hence changing the consumers of the operations of the input tensors. - -This function adds operations to the current session. To compute the error -using a particular device, such as a GPU, use the standard methods for -setting a device (e.g. using with sess.graph.device() or setting a device -function in the session constructor). - -##### Args: - - -* `x`: a tensor or list of tensors -* `x_shape`: the dimensions of x as a tuple or an array of ints. If x is a list, - then this is the list of shapes. - -* `y`: a tensor -* `y_shape`: the dimensions of y as a tuple or an array of ints. -* `x_init_value`: (optional) a numpy array of the same shape as "x" - representing the initial value of x. If x is a list, this should be a list - of numpy arrays. If this is none, the function will pick a random tensor - as the initial value. -* `delta`: (optional) the amount of perturbation. -* `init_targets`: list of targets to run to initialize model params. - TODO(mrry): Remove this argument. -* `extra_feed_dict`: dict that allows fixing specified tensor values - during the Jacobian calculation. - -##### Returns: - - The maximum error in between the two Jacobians. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.test.gpu_device_name.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.test.gpu_device_name.md deleted file mode 100644 index f950d8e1f0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.test.gpu_device_name.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.test.gpu_device_name()` {#gpu_device_name} - -Returns the name of a GPU device if available or the empty string. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.test.test_src_dir_path.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.test.test_src_dir_path.md deleted file mode 100644 index 7811f29fac..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.test.test_src_dir_path.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.test.test_src_dir_path(relative_path)` {#test_src_dir_path} - -Creates an absolute test srcdir path given a relative path. - -##### Args: - - -* `relative_path`: a path relative to tensorflow root. - e.g. "core/platform". - -##### Returns: - - An absolute path to the linked in runfiles. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.to_double.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.to_double.md deleted file mode 100644 index 0cabea178e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.to_double.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.to_double(x, name='ToDouble')` {#to_double} - -Casts a tensor to type `float64`. - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` with same shape as `x` with type `float64`. - -##### Raises: - - -* `TypeError`: If `x` cannot be cast to the `float64`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.trace.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.trace.md deleted file mode 100644 index 666cb43a54..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.trace.md +++ /dev/null @@ -1,41 +0,0 @@ -### `tf.trace(x, name=None)` {#trace} - -Compute the trace of a tensor `x`. - -`trace(x)` returns the sum along the main diagonal of each inner-most matrix -in x. If x is of rank `k` with shape `[I, J, K, ..., L, M, N]`, then output -is a tensor of rank `k-2` with dimensions `[I, J, K, ..., L]` where - -`output[i, j, k, ..., l] = trace(x[i, j, i, ..., l, :, :])` - -For example: - -```python -# 'x' is [[1, 2], -# [3, 4]] -tf.trace(x) ==> 5 - -# 'x' is [[1,2,3], -# [4,5,6], -# [7,8,9]] -tf.trace(x) ==> 15 - -# 'x' is [[[1,2,3], -# [4,5,6], -# [7,8,9]], -# [[-1,-2,-3], -# [-4,-5,-6], -# [-7,-8,-9]]] -tf.trace(x) ==> [15,-15] -``` - -##### Args: - - -* `x`: tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - The trace of input tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.AdagradOptimizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.AdagradOptimizer.md deleted file mode 100644 index 75ed61cc9a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.AdagradOptimizer.md +++ /dev/null @@ -1,181 +0,0 @@ -Optimizer that implements the Adagrad algorithm. - -See this [paper](http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf) -or this -[intro](http://cs.stanford.edu/~ppasupat/a9online/uploads/proximal_notes.pdf). -- - - - -#### `tf.train.AdagradOptimizer.__init__(learning_rate, initial_accumulator_value=0.1, use_locking=False, name='Adagrad')` {#AdagradOptimizer.__init__} - -Construct a new Adagrad optimizer. - -##### Args: - - -* `learning_rate`: A `Tensor` or a floating point value. The learning rate. -* `initial_accumulator_value`: A floating point value. - Starting value for the accumulators, must be positive. -* `use_locking`: If `True` use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "Adagrad". - -##### Raises: - - -* `ValueError`: If the `initial_accumulator_value` is invalid. - - -- - - - -#### `tf.train.AdagradOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#AdagradOptimizer.apply_gradients} - -Apply gradients to variables. - -This is the second part of `minimize()`. It returns an `Operation` that -applies gradients. - -##### Args: - - -* `grads_and_vars`: List of (gradient, variable) pairs as returned by - `compute_gradients()`. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `name`: Optional name for the returned operation. Default to the - name passed to the `Optimizer` constructor. - -##### Returns: - - An `Operation` that applies the specified gradients. If `global_step` - was not None, that operation also increments `global_step`. - -##### Raises: - - -* `TypeError`: If `grads_and_vars` is malformed. -* `ValueError`: If none of the variables have gradients. - - -- - - - -#### `tf.train.AdagradOptimizer.compute_gradients(loss, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, grad_loss=None)` {#AdagradOptimizer.compute_gradients} - -Compute gradients of `loss` for the variables in `var_list`. - -This is the first part of `minimize()`. It returns a list -of (gradient, variable) pairs where "gradient" is the gradient -for "variable". Note that "gradient" can be a `Tensor`, an -`IndexedSlices`, or `None` if there is no gradient for the -given variable. - -##### Args: - - -* `loss`: A Tensor containing the value to minimize. -* `var_list`: Optional list of `tf.Variable` to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKey.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - A list of (gradient, variable) pairs. Variable is always present, but - gradient can be `None`. - -##### Raises: - - -* `TypeError`: If `var_list` contains anything else than `Variable` objects. -* `ValueError`: If some arguments are invalid. - - -- - - - -#### `tf.train.AdagradOptimizer.get_name()` {#AdagradOptimizer.get_name} - - - - -- - - - -#### `tf.train.AdagradOptimizer.get_slot(var, name)` {#AdagradOptimizer.get_slot} - -Return a slot named `name` created for `var` by the Optimizer. - -Some `Optimizer` subclasses use additional variables. For example -`Momentum` and `Adagrad` use variables to accumulate updates. This method -gives access to these `Variable` objects if for some reason you need them. - -Use `get_slot_names()` to get the list of slot names created by the -`Optimizer`. - -##### Args: - - -* `var`: A variable passed to `minimize()` or `apply_gradients()`. -* `name`: A string. - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - -- - - - -#### `tf.train.AdagradOptimizer.get_slot_names()` {#AdagradOptimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -See `get_slot()`. - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.train.AdagradOptimizer.minimize(loss, global_step=None, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, name=None, grad_loss=None)` {#AdagradOptimizer.minimize} - -Add operations to minimize `loss` by updating `var_list`. - -This method simply combines calls `compute_gradients()` and -`apply_gradients()`. If you want to process the gradient before applying -them call `compute_gradients()` and `apply_gradients()` explicitly instead -of using this function. - -##### Args: - - -* `loss`: A `Tensor` containing the value to minimize. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `name`: Optional name for the returned operation. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - An Operation that updates the variables in `var_list`. If `global_step` - was not `None`, that operation also increments `global_step`. - -##### Raises: - - -* `ValueError`: If some of the variables are not `Variable` objects. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.QueueRunner.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.QueueRunner.md deleted file mode 100644 index ea6f7cadbf..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.QueueRunner.md +++ /dev/null @@ -1,175 +0,0 @@ -Holds a list of enqueue operations for a queue, each to be run in a thread. - -Queues are a convenient TensorFlow mechanism to compute tensors -asynchronously using multiple threads. For example in the canonical 'Input -Reader' setup one set of threads generates filenames in a queue; a second set -of threads read records from the files, processes them, and enqueues tensors -on a second queue; a third set of threads dequeues these input records to -construct batches and runs them through training operations. - -There are several delicate issues when running multiple threads that way: -closing the queues in sequence as the input is exhausted, correctly catching -and reporting exceptions, etc. - -The `QueueRunner`, combined with the `Coordinator`, helps handle these issues. -- - - - -#### `tf.train.QueueRunner.__init__(queue=None, enqueue_ops=None, close_op=None, cancel_op=None, queue_closed_exception_types=None, queue_runner_def=None, import_scope=None)` {#QueueRunner.__init__} - -Create a QueueRunner. - -On construction the `QueueRunner` adds an op to close the queue. That op -will be run if the enqueue ops raise exceptions. - -When you later call the `create_threads()` method, the `QueueRunner` will -create one thread for each op in `enqueue_ops`. Each thread will run its -enqueue op in parallel with the other threads. The enqueue ops do not have -to all be the same op, but it is expected that they all enqueue tensors in -`queue`. - -##### Args: - - -* `queue`: A `Queue`. -* `enqueue_ops`: List of enqueue ops to run in threads later. -* `close_op`: Op to close the queue. Pending enqueue ops are preserved. -* `cancel_op`: Op to close the queue and cancel pending enqueue ops. -* `queue_closed_exception_types`: Optional tuple of Exception types that - indicate that the queue has been closed when raised during an enqueue - operation. Defaults to `(tf.errors.OutOfRangeError,)`. Another common - case includes `(tf.errors.OutOfRangeError, tf.errors.CancelledError)`, - when some of the enqueue ops may dequeue from other Queues. -* `queue_runner_def`: Optional `QueueRunnerDef` protocol buffer. If specified, - recreates the QueueRunner from its contents. `queue_runner_def` and the - other arguments are mutually exclusive. -* `import_scope`: Optional `string`. Name scope to add. Only used when - initializing from protocol buffer. - -##### Raises: - - -* `ValueError`: If both `queue_runner_def` and `queue` are both specified. -* `ValueError`: If `queue` or `enqueue_ops` are not provided when not - restoring from `queue_runner_def`. - - -- - - - -#### `tf.train.QueueRunner.cancel_op` {#QueueRunner.cancel_op} - - - - -- - - - -#### `tf.train.QueueRunner.close_op` {#QueueRunner.close_op} - - - - -- - - - -#### `tf.train.QueueRunner.create_threads(sess, coord=None, daemon=False, start=False)` {#QueueRunner.create_threads} - -Create threads to run the enqueue ops for the given session. - -This method requires a session in which the graph was launched. It creates -a list of threads, optionally starting them. There is one thread for each -op passed in `enqueue_ops`. - -The `coord` argument is an optional coordinator that the threads will use -to terminate together and report exceptions. If a coordinator is given, -this method starts an additional thread to close the queue when the -coordinator requests a stop. - -If previously created threads for the given session are still running, no -new threads will be created. - -##### Args: - - -* `sess`: A `Session`. -* `coord`: Optional `Coordinator` object for reporting errors and checking - stop conditions. -* `daemon`: Boolean. If `True` make the threads daemon threads. -* `start`: Boolean. If `True` starts the threads. If `False` the - caller must call the `start()` method of the returned threads. - -##### Returns: - - A list of threads. - - -- - - - -#### `tf.train.QueueRunner.enqueue_ops` {#QueueRunner.enqueue_ops} - - - - -- - - - -#### `tf.train.QueueRunner.exceptions_raised` {#QueueRunner.exceptions_raised} - -Exceptions raised but not handled by the `QueueRunner` threads. - -Exceptions raised in queue runner threads are handled in one of two ways -depending on whether or not a `Coordinator` was passed to -`create_threads()`: - -* With a `Coordinator`, exceptions are reported to the coordinator and - forgotten by the `QueueRunner`. -* Without a `Coordinator`, exceptions are captured by the `QueueRunner` and - made available in this `exceptions_raised` property. - -##### Returns: - - A list of Python `Exception` objects. The list is empty if no exception - was captured. (No exceptions are captured when using a Coordinator.) - - -- - - - -#### `tf.train.QueueRunner.from_proto(queue_runner_def, import_scope=None)` {#QueueRunner.from_proto} - -Returns a `QueueRunner` object created from `queue_runner_def`. - - -- - - - -#### `tf.train.QueueRunner.name` {#QueueRunner.name} - -The string name of the underlying Queue. - - -- - - - -#### `tf.train.QueueRunner.queue` {#QueueRunner.queue} - - - - -- - - - -#### `tf.train.QueueRunner.queue_closed_exception_types` {#QueueRunner.queue_closed_exception_types} - - - - -- - - - -#### `tf.train.QueueRunner.to_proto(export_scope=None)` {#QueueRunner.to_proto} - -Converts this `QueueRunner` to a `QueueRunnerDef` protocol buffer. - -##### Args: - - -* `export_scope`: Optional `string`. Name scope to remove. - -##### Returns: - - A `QueueRunnerDef` protocol buffer, or `None` if the `Variable` is not in - the specified name scope. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.Server.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.Server.md deleted file mode 100644 index a7113297ce..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.Server.md +++ /dev/null @@ -1,129 +0,0 @@ -An in-process TensorFlow server, for use in distributed training. - -A `tf.train.Server` instance encapsulates a set of devices and a -[`tf.Session`](../../api_docs/python/client.md#Session) target that -can participate in distributed training. A server belongs to a -cluster (specified by a [`tf.train.ClusterSpec`](#ClusterSpec)), and -corresponds to a particular task in a named job. The server can -communicate with any other server in the same cluster. - -- - - - -#### `tf.train.Server.__init__(server_or_cluster_def, job_name=None, task_index=None, protocol=None, config=None, start=True)` {#Server.__init__} - -Creates a new server with the given definition. - -The `job_name`, `task_index`, and `protocol` arguments are optional, and -override any information provided in `server_or_cluster_def`. - -##### Args: - - -* `server_or_cluster_def`: A `tf.train.ServerDef` or - `tf.train.ClusterDef` protocol buffer, or a - `tf.train.ClusterSpec` object, describing the server to be - created and/or the cluster of which it is a member. -* `job_name`: (Optional.) Specifies the name of the job of which the server - is a member. Defaults to the value in `server_or_cluster_def`, if - specified. -* `task_index`: (Optional.) Specifies the task index of the server in its - job. Defaults to the value in `server_or_cluster_def`, if specified. - Otherwise defaults to 0 if the server's job has only one task. -* `protocol`: (Optional.) Specifies the protocol to be used by the server. - Acceptable values include `"grpc"`. Defaults to the value in - `server_or_cluster_def`, if specified. Otherwise defaults to `"grpc"`. -* `config`: (Options.) A `tf.ConfigProto` that specifies default - configuration options for all sessions that run on this server. -* `start`: (Optional.) Boolean, indicating whether to start the server - after creating it. Defaults to `True`. - -##### Raises: - - tf.errors.OpError: Or one of its subclasses if an error occurs while - creating the TensorFlow server. - - -- - - - -#### `tf.train.Server.create_local_server(config=None, start=True)` {#Server.create_local_server} - -Creates a new single-process cluster running on the local host. - -This method is a convenience wrapper for creating a -`tf.train.Server` with a `tf.train.ServerDef` that specifies a -single-process cluster containing a single task in a job called -`"local"`. - -##### Args: - - -* `config`: (Options.) A `tf.ConfigProto` that specifies default - configuration options for all sessions that run on this server. -* `start`: (Optional.) Boolean, indicating whether to start the server after - creating it. Defaults to `True`. - -##### Returns: - - A local `tf.train.Server`. - - -- - - - -#### `tf.train.Server.target` {#Server.target} - -Returns the target for a `tf.Session` to connect to this server. - -To create a -[`tf.Session`](../../api_docs/python/client.md#Session) that -connects to this server, use the following snippet: - -```python -server = tf.train.Server(...) -with tf.Session(server.target): - # ... -``` - -##### Returns: - - A string containing a session target for this server. - - -- - - - -#### `tf.train.Server.server_def` {#Server.server_def} - -Returns the `tf.train.ServerDef` for this server. - -##### Returns: - - A `tf.train.ServerDef` protocol buffer that describes the configuration - of this server. - - - -- - - - -#### `tf.train.Server.start()` {#Server.start} - -Starts this server. - -##### Raises: - - tf.errors.OpError: Or one of its subclasses if an error occurs while - starting the TensorFlow server. - - -- - - - -#### `tf.train.Server.join()` {#Server.join} - -Blocks until the server has shut down. - -This method currently blocks forever. - -##### Raises: - - tf.errors.OpError: Or one of its subclasses if an error occurs while - joining the TensorFlow server. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.SyncReplicasOptimizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.SyncReplicasOptimizer.md deleted file mode 100644 index 84f1099ffe..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.SyncReplicasOptimizer.md +++ /dev/null @@ -1,268 +0,0 @@ -Class to synchronize, aggregate gradients and pass them to the optimizer. - -In a typical asynchronous training environment, it's common to have some -stale gradients. For example, with a N-replica asynchronous training, -gradients will be applied to the variables N times independently. Depending -on each replica's training speed, some gradients might be calculated from -copies of the variable from several steps back (N-1 steps on average). This -optimizer avoids stale gradients by collecting gradients from all replicas, -averaging them, then applying them to the variables in one shot, after -which replicas can fetch the new variables and continue. - -The following accumulators/queue are created: - -* N `gradient accumulators`, one per variable to train. Gradients are pushed - to them and the chief worker will wait until enough gradients are collected - and then average them before applying to variables. The accumulator will - drop all stale gradients (more details in the accumulator op). -* 1 `token` queue where the optimizer pushes the new global_step value after - all variables are updated. - -The following local variable is created: -* `sync_rep_local_step`, one per replica. Compared against the global_step in - each accumulator to check for staleness of the gradients. - -The optimizer adds nodes to the graph to collect gradients and pause the -trainers until variables are updated. -For the Parameter Server job: - -1. An accumulator is created for each variable, and each replica pushes the - gradients into the accumulators instead of directly applying them to the - variables. -2. Each accumulator averages once enough gradients (replicas_to_aggregate) - have been accumulated. -3. Apply the averaged gradients to the variables. -4. Only after all variables have been updated, increment the global step. -5. Only after step 4, pushes `global_step` in the `token_queue`, once for - each worker replica. The workers can now fetch the global step, use it to - update its local_step variable and start the next batch. - -For the replicas: - -1. Start a step: fetch variables and compute gradients. -2. Once the gradients have been computed, push them into gradient - accumulators. Each accumulator will check the staleness and drop the stale. -3. After pushing all the gradients, dequeue an updated value of global_step - from the token queue and record that step to its local_step variable. Note - that this is effectively a barrier. -4. Start the next batch. - -### Usage - -```python -# Create any optimizer to update the variables, say a simple SGD: -opt = GradientDescentOptimizer(learning_rate=0.1) - -# Wrap the optimizer with sync_replicas_optimizer with 50 replicas: at each -# step the optimizer collects 50 gradients before applying to variables. -# Note that if you want to have 2 backup replicas, you can change -# total_num_replicas=52 and make sure this number matches how many physical -# replicas you started in your job. -opt = tf.SyncReplicasOptimizer(opt, replicas_to_aggregate=50, - total_num_replicas=50) - -# Some models have startup_delays to help stabilize the model but when using -# sync_replicas training, set it to 0. - -# Now you can call `minimize()` or `compute_gradients()` and -# `apply_gradients()` normally -training_op = opt.minimize(total_loss, global_step=self.global_step) - - -# You can create the hook which handles initialization and queues. -sync_replicas_hook = opt.make_session_run_hook(is_chief) -``` - -In the training program, every worker will run the train_op as if not -synchronized. - -```python -with training.MonitoredTrainingSession( - master=workers[worker_id].target, is_chief=is_chief, - hooks=[sync_replicas_hook]) as mon_sess: - while not mon_sess.should_stop(): - mon_sess.run(training_op) -``` - -- - - - -#### `tf.train.SyncReplicasOptimizer.__init__(opt, replicas_to_aggregate, total_num_replicas=None, variable_averages=None, variables_to_average=None, use_locking=False, name='sync_replicas')` {#SyncReplicasOptimizer.__init__} - -Construct a sync_replicas optimizer. - -##### Args: - - -* `opt`: The actual optimizer that will be used to compute and apply the - gradients. Must be one of the Optimizer classes. -* `replicas_to_aggregate`: number of replicas to aggregate for each variable - update. -* `total_num_replicas`: Total number of tasks/workers/replicas, could be - different from replicas_to_aggregate. - If total_num_replicas > replicas_to_aggregate: it is backup_replicas + - replicas_to_aggregate. - If total_num_replicas < replicas_to_aggregate: Replicas compute - multiple batches per update to variables. -* `variable_averages`: Optional `ExponentialMovingAverage` object, used to - maintain moving averages for the variables passed in - `variables_to_average`. -* `variables_to_average`: a list of variables that need to be averaged. Only - needed if variable_averages is passed in. -* `use_locking`: If True use locks for update operation. -* `name`: string. Optional name of the returned operation. - - -- - - - -#### `tf.train.SyncReplicasOptimizer.compute_gradients(*args, **kwargs)` {#SyncReplicasOptimizer.compute_gradients} - -Compute gradients of "loss" for the variables in "var_list". - -This simply wraps the compute_gradients() from the real optimizer. The -gradients will be aggregated in the apply_gradients() so that user can -modify the gradients like clipping with per replica global norm if needed. -The global norm with aggregated gradients can be bad as one replica's huge -gradients can hurt the gradients from other replicas. - -##### Args: - - -* `*args`: Arguments for compute_gradients(). -* `**kwargs`: Keyword arguments for compute_gradients(). - -##### Returns: - - A list of (gradient, variable) pairs. - - -- - - - -#### `tf.train.SyncReplicasOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#SyncReplicasOptimizer.apply_gradients} - -Apply gradients to variables. - -This contains most of the synchronization implementation and also wraps the -apply_gradients() from the real optimizer. - -##### Args: - - -* `grads_and_vars`: List of (gradient, variable) pairs as returned by - compute_gradients(). -* `global_step`: Optional Variable to increment by one after the - variables have been updated. -* `name`: Optional name for the returned operation. Default to the - name passed to the Optimizer constructor. - -##### Returns: - - -* `train_op`: The op to dequeue a token so the replicas can exit this batch - and start the next one. This is executed by each replica. - -##### Raises: - - -* `ValueError`: If the grads_and_vars is empty. -* `ValueError`: If global step is not provided, the staleness cannot be - checked. - - -- - - - -#### `tf.train.SyncReplicasOptimizer.get_chief_queue_runner()` {#SyncReplicasOptimizer.get_chief_queue_runner} - -Returns the QueueRunner for the chief to execute. - -This includes the operations to synchronize replicas: aggregate gradients, -apply to variables, increment global step, insert tokens to token queue. - -Note that this can only be called after calling apply_gradients() which -actually generates this queuerunner. - -##### Returns: - - A `QueueRunner` for chief to execute. - -##### Raises: - - -* `ValueError`: If this is called before apply_gradients(). - - -- - - - -#### `tf.train.SyncReplicasOptimizer.get_init_tokens_op(num_tokens=-1)` {#SyncReplicasOptimizer.get_init_tokens_op} - -Returns the op to fill the sync_token_queue with the tokens. - -This is supposed to be executed in the beginning of the chief/sync thread -so that even if the total_num_replicas is less than replicas_to_aggregate, -the model can still proceed as the replicas can compute multiple steps per -variable update. Make sure: -`num_tokens >= replicas_to_aggregate - total_num_replicas`. - -##### Args: - - -* `num_tokens`: Number of tokens to add to the queue. - -##### Returns: - - An op for the chief/sync replica to fill the token queue. - -##### Raises: - - -* `ValueError`: If this is called before apply_gradients(). -* `ValueError`: If num_tokens are smaller than replicas_to_aggregate - - total_num_replicas. - - - -#### Other Methods -- - - - -#### `tf.train.SyncReplicasOptimizer.get_slot(*args, **kwargs)` {#SyncReplicasOptimizer.get_slot} - -Return a slot named "name" created for "var" by the Optimizer. - -This simply wraps the get_slot() from the actual optimizer. - -##### Args: - - -* `*args`: Arguments for get_slot(). -* `**kwargs`: Keyword arguments for get_slot(). - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - -- - - - -#### `tf.train.SyncReplicasOptimizer.get_slot_names(*args, **kwargs)` {#SyncReplicasOptimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -This simply wraps the get_slot_names() from the actual optimizer. - -##### Args: - - -* `*args`: Arguments for get_slot(). -* `**kwargs`: Keyword arguments for get_slot(). - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.train.SyncReplicasOptimizer.make_session_run_hook(is_chief, num_tokens=-1)` {#SyncReplicasOptimizer.make_session_run_hook} - -Creates a hook to handle SyncReplicasHook ops such as initialization. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.assert_global_step.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.assert_global_step.md deleted file mode 100644 index 2bc8feb0c2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.assert_global_step.md +++ /dev/null @@ -1,9 +0,0 @@ -### `tf.train.assert_global_step(global_step_tensor)` {#assert_global_step} - -Asserts `global_step_tensor` is a scalar int `Variable` or `Tensor`. - -##### Args: - - -* `global_step_tensor`: `Tensor` to test. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.batch_join.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.batch_join.md deleted file mode 100644 index d49358f4b5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.batch_join.md +++ /dev/null @@ -1,88 +0,0 @@ -### `tf.train.batch_join(tensors_list, batch_size, capacity=32, enqueue_many=False, shapes=None, dynamic_pad=False, allow_smaller_final_batch=False, shared_name=None, name=None)` {#batch_join} - -Runs a list of tensors to fill a queue to create batches of examples. - -The `tensors_list` argument is a list of tuples of tensors, or a list of -dictionaries of tensors. Each element in the list is treated similarly -to the `tensors` argument of `tf.train.batch()`. - -Enqueues a different list of tensors in different threads. -Implemented using a queue -- a `QueueRunner` for the queue -is added to the current `Graph`'s `QUEUE_RUNNER` collection. - -`len(tensors_list)` threads will be started, -with thread `i` enqueuing the tensors from -`tensors_list[i]`. `tensors_list[i1][j]` must match -`tensors_list[i2][j]` in type and shape, except in the first -dimension if `enqueue_many` is true. - -If `enqueue_many` is `False`, each `tensors_list[i]` is assumed -to represent a single example. An input tensor `x` will be output as a -tensor with shape `[batch_size] + x.shape`. - -If `enqueue_many` is `True`, `tensors_list[i]` is assumed to -represent a batch of examples, where the first dimension is indexed -by example, and all members of `tensors_list[i]` should have the -same size in the first dimension. The slices of any input tensor -`x` are treated as examples, and the output tensors will have shape -`[batch_size] + x.shape[1:]`. - -The `capacity` argument controls the how long the prefetching is allowed to -grow the queues. - -The returned operation is a dequeue operation and will throw -`tf.errors.OutOfRangeError` if the input queue is exhausted. If this -operation is feeding another input queue, its queue runner will catch -this exception, however, if this operation is used in your main thread -you are responsible for catching this yourself. - -*N.B.:* If `dynamic_pad` is `False`, you must ensure that either -(i) the `shapes` argument is passed, or (ii) all of the tensors in -`tensors_list` must have fully-defined shapes. `ValueError` will be -raised if neither of these conditions holds. - -If `dynamic_pad` is `True`, it is sufficient that the *rank* of the -tensors is known, but individual dimensions may have value `None`. -In this case, for each enqueue the dimensions with value `None` -may have a variable length; upon dequeue, the output tensors will be padded -on the right to the maximum shape of the tensors in the current minibatch. -For numbers, this padding takes value 0. For strings, this padding is -the empty string. See `PaddingFIFOQueue` for more info. - -If `allow_smaller_final_batch` is `True`, a smaller batch value than -`batch_size` is returned when the queue is closed and there are not enough -elements to fill the batch, otherwise the pending elements are discarded. -In addition, all output tensors' static shapes, as accessed via the -`get_shape` method will have a first `Dimension` value of `None`, and -operations that depend on fixed batch_size would fail. - -##### Args: - - -* `tensors_list`: A list of tuples or dictionaries of tensors to enqueue. -* `batch_size`: An integer. The new batch size pulled from the queue. -* `capacity`: An integer. The maximum number of elements in the queue. -* `enqueue_many`: Whether each tensor in `tensor_list_list` is a single - example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensor_list_list[i]`. -* `dynamic_pad`: Boolean. Allow variable dimensions in input shapes. - The given dimensions are padded upon dequeue so that tensors within a - batch have the same shapes. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (Optional) If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the same number and types as - `tensors_list[i]`. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensor_list_list`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.get_checkpoint_mtimes.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.get_checkpoint_mtimes.md deleted file mode 100644 index 0586e55851..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.get_checkpoint_mtimes.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.train.get_checkpoint_mtimes(checkpoint_prefixes)` {#get_checkpoint_mtimes} - -Returns the mtimes (modification timestamps) of the checkpoints. - -Globs for the checkpoints pointed to by `checkpoint_prefixes`. If the files -exist, collect their mtime. Both V2 and V1 checkpoints are considered, in -that priority. - -This is the recommended way to get the mtimes, since it takes into account -the naming difference between V1 and V2 formats. - -##### Args: - - -* `checkpoint_prefixes`: a list of checkpoint paths, typically the results of - `Saver.save()` or those of `tf.train.latest_checkpoint()`, regardless of - sharded/non-sharded or V1/V2. - -##### Returns: - - A list of mtimes (in microseconds) of the found checkpoints. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.range_input_producer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.range_input_producer.md deleted file mode 100644 index 51fac958ec..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.train.range_input_producer.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.train.range_input_producer(limit, num_epochs=None, shuffle=True, seed=None, capacity=32, shared_name=None, name=None)` {#range_input_producer} - -Produces the integers from 0 to limit-1 in a queue. - -Note: if `num_epochs` is not `None`, this function creates local counter -`epochs`. Use `local_variables_initializer()` to initialize local variables. - -##### Args: - - -* `limit`: An int32 scalar tensor. -* `num_epochs`: An integer (optional). If specified, `range_input_producer` - produces each integer `num_epochs` times before generating an - OutOfRange error. If not specified, `range_input_producer` can cycle - through the integers an unlimited number of times. -* `shuffle`: Boolean. If true, the integers are randomly shuffled within each - epoch. -* `seed`: An integer (optional). Seed used if shuffle == True. -* `capacity`: An integer. Sets the queue capacity. -* `shared_name`: (optional). If set, this queue will be shared under the given - name across multiple sessions. -* `name`: A name for the operations (optional). - -##### Returns: - - A Queue with the output integers. A `QueueRunner` for the Queue - is added to the current `Graph`'s `QUEUE_RUNNER` collection. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.truncatediv.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.truncatediv.md deleted file mode 100644 index 99c9d55cea..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.truncatediv.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.truncatediv(x, y, name=None)` {#truncatediv} - -Returns x / y element-wise for integer types. - -Truncation designates that negative numbers will round fractional quantities -toward zero. I.e. -7 / 5 = 1. This matches C semantics but it is different -than Python semantics. See `FloorDiv` for a division function that matches -Python Semantics. - -*NOTE*: `TruncateDiv` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `uint16`, `int16`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.unique_with_counts.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.unique_with_counts.md deleted file mode 100644 index 0228699c63..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf.unique_with_counts.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.unique_with_counts(x, out_idx=None, name=None)` {#unique_with_counts} - -Finds unique elements in a 1-D tensor. - -This operation returns a tensor `y` containing all of the unique elements of `x` -sorted in the same order that they occur in `x`. This operation also returns a -tensor `idx` the same size as `x` that contains the index of each value of `x` -in the unique output `y`. Finally, it returns a third tensor `count` that -contains the count of each element of `y` in `x`. In other words: - -`y[idx[i]] = x[i] for i in [0, 1,...,rank(x) - 1]` - -For example: - -```prettyprint -# tensor 'x' is [1, 1, 2, 4, 4, 4, 7, 8, 8] -y, idx, count = unique_with_counts(x) -y ==> [1, 2, 4, 7, 8] -idx ==> [0, 0, 1, 2, 2, 2, 3, 4, 4] -count ==> [2, 1, 3, 1, 2] -``` - -##### Args: - - -* `x`: A `Tensor`. 1-D. -* `out_idx`: An optional `tf.DType` from: `tf.int32, tf.int64`. Defaults to `tf.int32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (y, idx, count). - -* `y`: A `Tensor`. Has the same type as `x`. 1-D. -* `idx`: A `Tensor` of type `out_idx`. 1-D. -* `count`: A `Tensor` of type `out_idx`. 1-D. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.DebugTensorDatum.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.DebugTensorDatum.md deleted file mode 100644 index 853f2ef5f5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.DebugTensorDatum.md +++ /dev/null @@ -1,146 +0,0 @@ -A single tensor dumped by TensorFlow Debugger (tfdbg). - -Contains metadata about the dumped tensor, including `timestamp`, -`node_name`, `output_slot`, `debug_op`, and path to the dump file -(`file_path`). - -This type does not hold the generally space-expensive tensor value (numpy -array). Instead, it points to the file from which the tensor value can be -loaded (with the `get_tensor` method) if needed. -- - - - -#### `tf_debug.DebugTensorDatum.__init__(dump_root, debug_dump_rel_path)` {#DebugTensorDatum.__init__} - -`DebugTensorDatum` constructor. - -##### Args: - - -* `dump_root`: (`str`) Debug dump root directory. -* `debug_dump_rel_path`: (`str`) Path to a debug dump file, relative to the - `dump_root`. For example, suppose the debug dump root - directory is `/tmp/tfdbg_1` and the dump file is at - `/tmp/tfdbg_1/ns_1/node_a_0_DebugIdentity_123456789`, then - the value of the debug_dump_rel_path should be - `ns_1/node_a_0_DebugIdenity_1234456789`. - -##### Raises: - - -* `ValueError`: If the base file name of the dump file does not conform to - the dump file naming pattern: - `node_name`_`output_slot`_`debug_op`_`timestamp` - - -- - - - -#### `tf_debug.DebugTensorDatum.__repr__()` {#DebugTensorDatum.__repr__} - - - - -- - - - -#### `tf_debug.DebugTensorDatum.__str__()` {#DebugTensorDatum.__str__} - - - - -- - - - -#### `tf_debug.DebugTensorDatum.debug_op` {#DebugTensorDatum.debug_op} - -Name of the debug op. - -##### Returns: - - (`str`) debug op name (e.g., `DebugIdentity`). - - -- - - - -#### `tf_debug.DebugTensorDatum.dump_size_bytes` {#DebugTensorDatum.dump_size_bytes} - -Size of the dump file. - -Unit: byte. - -##### Returns: - - If the dump file exists, size of the dump file, in bytes. - If the dump file does not exist, None. - - -- - - - -#### `tf_debug.DebugTensorDatum.file_path` {#DebugTensorDatum.file_path} - -Path to the file which stores the value of the dumped tensor. - - -- - - - -#### `tf_debug.DebugTensorDatum.get_tensor()` {#DebugTensorDatum.get_tensor} - -Get tensor from the dump (`Event`) file. - -##### Returns: - - The tensor loaded from the dump (`Event`) file. - - -- - - - -#### `tf_debug.DebugTensorDatum.node_name` {#DebugTensorDatum.node_name} - -Name of the node from which the tensor value was dumped. - -##### Returns: - - (`str`) name of the node watched by the debug op. - - -- - - - -#### `tf_debug.DebugTensorDatum.output_slot` {#DebugTensorDatum.output_slot} - -Output slot index from which the tensor value was dumped. - -##### Returns: - - (`int`) output slot index watched by the debug op. - - -- - - - -#### `tf_debug.DebugTensorDatum.tensor_name` {#DebugTensorDatum.tensor_name} - -Name of the tensor watched by the debug op. - -##### Returns: - - (`str`) `Tensor` name, in the form of `node_name`:`output_slot` - - -- - - - -#### `tf_debug.DebugTensorDatum.timestamp` {#DebugTensorDatum.timestamp} - -Timestamp of when this tensor value was dumped. - -##### Returns: - - (`int`) The timestamp in microseconds. - - -- - - - -#### `tf_debug.DebugTensorDatum.watch_key` {#DebugTensorDatum.watch_key} - -Watch key identities a debug watch on a tensor. - -##### Returns: - - (`str`) A watch key, in the form of `tensor_name`:`debug_op`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.LocalCLIDebugWrapperSession.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.LocalCLIDebugWrapperSession.md deleted file mode 100644 index 8194e8ef07..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.LocalCLIDebugWrapperSession.md +++ /dev/null @@ -1,207 +0,0 @@ -Concrete subclass of BaseDebugWrapperSession implementing a local CLI. - -This class has all the methods that a `session.Session` object has, in order -to support debugging with minimal code changes. Invoking its `run()` method -will launch the command-line interface (CLI) of tfdbg. -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.__enter__()` {#LocalCLIDebugWrapperSession.__enter__} - - - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.__exit__(exec_type, exec_value, exec_tb)` {#LocalCLIDebugWrapperSession.__exit__} - - - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.__init__(sess, dump_root=None, log_usage=True, ui_type='curses')` {#LocalCLIDebugWrapperSession.__init__} - -Constructor of LocalCLIDebugWrapperSession. - -##### Args: - - -* `sess`: The TensorFlow `Session` object being wrapped. -* `dump_root`: (`str`) optional path to the dump root directory. Must be a - directory that does not exist or an empty directory. If the directory - does not exist, it will be created by the debugger core during debug - `run()` calls and removed afterwards. -* `log_usage`: (`bool`) whether the usage of this class is to be logged. -* `ui_type`: (`str`) requested UI type. Currently supported: - (curses | readline) - -##### Raises: - - -* `ValueError`: If dump_root is an existing and non-empty directory or if - dump_root is a file. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.add_tensor_filter(filter_name, tensor_filter)` {#LocalCLIDebugWrapperSession.add_tensor_filter} - -Add a tensor filter. - -##### Args: - - -* `filter_name`: (`str`) name of the filter. -* `tensor_filter`: (`callable`) the filter callable. See the doc string of - `DebugDumpDir.find()` for more details about its signature. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.close()` {#LocalCLIDebugWrapperSession.close} - - - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.graph` {#LocalCLIDebugWrapperSession.graph} - - - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.invoke_node_stepper(node_stepper, restore_variable_values_on_exit=True)` {#LocalCLIDebugWrapperSession.invoke_node_stepper} - -Overrides method in base class to implement interactive node stepper. - -##### Args: - - -* `node_stepper`: (`stepper.NodeStepper`) The underlying NodeStepper API - object. -* `restore_variable_values_on_exit`: (`bool`) Whether any variables whose - values have been altered during this node-stepper invocation should be - restored to their old values when this invocation ends. - -##### Returns: - - The same return values as the `Session.run()` call on the same fetches as - the NodeStepper. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.on_run_end(request)` {#LocalCLIDebugWrapperSession.on_run_end} - -Overrides on-run-end callback. - -##### Actions taken: - - 1) Load the debug dump. - 2) Bring up the Analyzer CLI. - -##### Args: - - -* `request`: An instance of OnSessionInitRequest. - -##### Returns: - - An instance of OnSessionInitResponse. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.on_run_start(request)` {#LocalCLIDebugWrapperSession.on_run_start} - -Overrides on-run-start callback. - -##### Invoke the CLI to let user choose what action to take: - - `run` / `invoke_stepper`. - -##### Args: - - -* `request`: An instance of `OnSessionInitRequest`. - -##### Returns: - - An instance of `OnSessionInitResponse`. - -##### Raises: - - -* `RuntimeError`: If user chooses to prematurely exit the debugger. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.on_session_init(request)` {#LocalCLIDebugWrapperSession.on_session_init} - -Overrides on-session-init callback. - -##### Args: - - -* `request`: An instance of `OnSessionInitRequest`. - -##### Returns: - - An instance of `OnSessionInitResponse`. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.partial_run(handle, fetches, feed_dict=None)` {#LocalCLIDebugWrapperSession.partial_run} - - - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.partial_run_setup(fetches, feeds=None)` {#LocalCLIDebugWrapperSession.partial_run_setup} - -Sets up the feeds and fetches for partial runs in the session. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#LocalCLIDebugWrapperSession.run} - -Wrapper around Session.run() that inserts tensor watch options. - -##### Args: - - -* `fetches`: Same as the `fetches` arg to regular `Session.run()`. -* `feed_dict`: Same as the `feed_dict` arg to regular `Session.run()`. -* `options`: Same as the `options` arg to regular `Session.run()`. -* `run_metadata`: Same as the `run_metadata` arg to regular `Session.run()`. - -##### Returns: - - Simply forwards the output of the wrapped `Session.run()` call. - -##### Raises: - - -* `ValueError`: On invalid `OnRunStartAction` value. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.sess_str` {#LocalCLIDebugWrapperSession.sess_str} - - - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.session` {#LocalCLIDebugWrapperSession.session} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.add_debug_tensor_watch.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.add_debug_tensor_watch.md deleted file mode 100644 index 1c79b12669..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.add_debug_tensor_watch.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf_debug.add_debug_tensor_watch(run_options, node_name, output_slot=0, debug_ops='DebugIdentity', debug_urls=None, global_step=-1)` {#add_debug_tensor_watch} - -Add watch on a `Tensor` to `RunOptions`. - -N.B.: Under certain circumstances, the `Tensor` may not be actually watched - (e.g., if the node of the `Tensor` is constant-folded during runtime). - -##### Args: - - -* `run_options`: An instance of `config_pb2.RunOptions` to be modified. -* `node_name`: (`str`) name of the node to watch. -* `output_slot`: (`int`) output slot index of the tensor from the watched node. -* `debug_ops`: (`str` or `list` of `str`) name(s) of the debug op(s). Can be a - `list` of `str` or a single `str`. The latter case is equivalent to a - `list` of `str` with only one element. -* `debug_urls`: (`str` or `list` of `str`) URL(s) to send debug values to, - e.g., `file:///tmp/tfdbg_dump_1`, `grpc://localhost:12345`. -* `global_step`: (`int`) Optional global_step count for this debug tensor - watch. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.load_tensor_from_event_file.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.load_tensor_from_event_file.md deleted file mode 100644 index 453be17643..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard3/tf_debug.load_tensor_from_event_file.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf_debug.load_tensor_from_event_file(event_file_path)` {#load_tensor_from_event_file} - -Load a tensor from an event file. - -Assumes that the event file contains a `Event` protobuf and the `Event` -protobuf contains a `Tensor` value. - -##### Args: - - -* `event_file_path`: (`str`) path to the event file. - -##### Returns: - - The tensor value loaded from the event file, as a `numpy.ndarray`. For - uninitialized Tensors, returns `None`. For Tensors of data types that - cannot be converted to `numpy.ndarray` (e.g., `tf.resource`), return - `None`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.Assert.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.Assert.md deleted file mode 100644 index 35325fadaa..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.Assert.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.Assert(condition, data, summarize=None, name=None)` {#Assert} - -Asserts that the given condition is true. - -If `condition` evaluates to false, print the list of tensors in `data`. -`summarize` determines how many entries of the tensors to print. - -NOTE: To ensure that Assert executes, one usually attaches a dependency: - -```python -# Ensure maximum element of x is smaller or equal to 1 -assert_op = tf.Assert(tf.less_equal(tf.reduce_max(x), 1.), [x]) -with tf.control_dependencies([assert_op]): - ... code using x ... -``` - -##### Args: - - -* `condition`: The condition to evaluate. -* `data`: The tensors to print out when condition is false. -* `summarize`: Print this many entries of each tensor. -* `name`: A name for this operation (optional). - -##### Returns: - - -* `assert_op`: An `Operation` that, when executed, raises a - `tf.errors.InvalidArgumentError` if `condition` is not true. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.ConditionalAccumulator.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.ConditionalAccumulator.md deleted file mode 100644 index e555239caa..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.ConditionalAccumulator.md +++ /dev/null @@ -1,136 +0,0 @@ -A conditional accumulator for aggregating gradients. - -Up-to-date gradients (i.e., time step at which gradient was computed is -equal to the accumulator's time step) are added to the accumulator. - -Extraction of the average gradient is blocked until the required number of -gradients has been accumulated. -- - - - -#### `tf.ConditionalAccumulator.__init__(dtype, shape=None, shared_name=None, name='conditional_accumulator')` {#ConditionalAccumulator.__init__} - -Creates a new ConditionalAccumulator. - -##### Args: - - -* `dtype`: Datatype of the accumulated gradients. -* `shape`: Shape of the accumulated gradients. -* `shared_name`: Optional. If non-empty, this accumulator will be shared under - the given name across multiple sessions. -* `name`: Optional name for the accumulator. - - -- - - - -#### `tf.ConditionalAccumulator.accumulator_ref` {#ConditionalAccumulator.accumulator_ref} - -The underlying accumulator reference. - - -- - - - -#### `tf.ConditionalAccumulator.apply_grad(grad, local_step=0, name=None)` {#ConditionalAccumulator.apply_grad} - -Attempts to apply a gradient to the accumulator. - -The attempt is silently dropped if the gradient is stale, i.e., local_step -is less than the accumulator's global time step. - -##### Args: - - -* `grad`: The gradient tensor to be applied. -* `local_step`: Time step at which the gradient was computed. -* `name`: Optional name for the operation. - -##### Returns: - - The operation that (conditionally) applies a gradient to the accumulator. - -##### Raises: - - -* `ValueError`: If grad is of the wrong shape - - -- - - - -#### `tf.ConditionalAccumulator.dtype` {#ConditionalAccumulator.dtype} - -The datatype of the gradients accumulated by this accumulator. - - -- - - - -#### `tf.ConditionalAccumulator.name` {#ConditionalAccumulator.name} - -The name of the underlying accumulator. - - -- - - - -#### `tf.ConditionalAccumulator.num_accumulated(name=None)` {#ConditionalAccumulator.num_accumulated} - -Number of gradients that have currently been aggregated in accumulator. - -##### Args: - - -* `name`: Optional name for the operation. - -##### Returns: - - Number of accumulated gradients currently in accumulator. - - -- - - - -#### `tf.ConditionalAccumulator.set_global_step(new_global_step, name=None)` {#ConditionalAccumulator.set_global_step} - -Sets the global time step of the accumulator. - -The operation logs a warning if we attempt to set to a time step that is -lower than the accumulator's own time step. - -##### Args: - - -* `new_global_step`: Value of new time step. Can be a variable or a constant -* `name`: Optional name for the operation. - -##### Returns: - - Operation that sets the accumulator's time step. - - -- - - - -#### `tf.ConditionalAccumulator.take_grad(num_required, name=None)` {#ConditionalAccumulator.take_grad} - -Attempts to extract the average gradient from the accumulator. - -The operation blocks until sufficient number of gradients have been -successfully applied to the accumulator. - -Once successful, the following actions are also triggered: -- Counter of accumulated gradients is reset to 0. -- Aggregated gradient is reset to 0 tensor. -- Accumulator's internal time step is incremented by 1. - -##### Args: - - -* `num_required`: Number of gradients that needs to have been aggregated -* `name`: Optional name for the operation - -##### Returns: - - A tensor holding the value of the average gradient. - -##### Raises: - - -* `InvalidArgumentError`: If num_required < 1 - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.FixedLengthRecordReader.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.FixedLengthRecordReader.md deleted file mode 100644 index 5e3ae19b93..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.FixedLengthRecordReader.md +++ /dev/null @@ -1,175 +0,0 @@ -A Reader that outputs fixed-length records from a file. - -See ReaderBase for supported methods. -- - - - -#### `tf.FixedLengthRecordReader.__init__(record_bytes, header_bytes=None, footer_bytes=None, name=None)` {#FixedLengthRecordReader.__init__} - -Create a FixedLengthRecordReader. - -##### Args: - - -* `record_bytes`: An int. -* `header_bytes`: An optional int. Defaults to 0. -* `footer_bytes`: An optional int. Defaults to 0. -* `name`: A name for the operation (optional). - - -- - - - -#### `tf.FixedLengthRecordReader.num_records_produced(name=None)` {#FixedLengthRecordReader.num_records_produced} - -Returns the number of records this reader has produced. - -This is the same as the number of Read executions that have -succeeded. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.FixedLengthRecordReader.num_work_units_completed(name=None)` {#FixedLengthRecordReader.num_work_units_completed} - -Returns the number of work units this reader has finished processing. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.FixedLengthRecordReader.read(queue, name=None)` {#FixedLengthRecordReader.read} - -Returns the next record (key, value pair) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g. when the -Reader needs to start reading from a new file since it has -finished with the previous file). - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (key, value). - -* `key`: A string scalar Tensor. -* `value`: A string scalar Tensor. - - -- - - - -#### `tf.FixedLengthRecordReader.read_up_to(queue, num_records, name=None)` {#FixedLengthRecordReader.read_up_to} - -Returns up to num_records (key, value pairs) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g., when the -Reader needs to start reading from a new file since it has -finished with the previous file). -It may return less than num_records even before the last batch. - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `num_records`: Number of records to read. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (keys, values). - -* `keys`: A 1-D string Tensor. -* `values`: A 1-D string Tensor. - - -- - - - -#### `tf.FixedLengthRecordReader.reader_ref` {#FixedLengthRecordReader.reader_ref} - -Op that implements the reader. - - -- - - - -#### `tf.FixedLengthRecordReader.reset(name=None)` {#FixedLengthRecordReader.reset} - -Restore a reader to its initial clean state. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.FixedLengthRecordReader.restore_state(state, name=None)` {#FixedLengthRecordReader.restore_state} - -Restore a reader to a previously saved state. - -Not all Readers support being restored, so this can produce an -Unimplemented error. - -##### Args: - - -* `state`: A string Tensor. - Result of a SerializeState of a Reader with matching type. -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.FixedLengthRecordReader.serialize_state(name=None)` {#FixedLengthRecordReader.serialize_state} - -Produce a string tensor that encodes the state of a reader. - -Not all Readers support being serialized, so this can produce an -Unimplemented error. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A string Tensor. - - -- - - - -#### `tf.FixedLengthRecordReader.supports_serialize` {#FixedLengthRecordReader.supports_serialize} - -Whether the Reader implementation can serialize its state. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.argmin.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.argmin.md deleted file mode 100644 index 344cb01ce9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.argmin.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.argmin(input, axis=None, name=None, dimension=None)` {#argmin} - -Returns the index with the smallest value across axes of a tensor. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `axis`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - int32, 0 <= axis < rank(input). Describes which axis - of the input Tensor to reduce across. For vectors, use axis = 0. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `int64`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.assert_less.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.assert_less.md deleted file mode 100644 index b6bc1000c7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.assert_less.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.assert_less(x, y, data=None, summarize=None, message=None, name=None)` {#assert_less} - -Assert the condition `x < y` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_less(x, y)]): - output = tf.reduce_sum(x) -``` - -This condition holds if for every pair of (possibly broadcast) elements -`x[i]`, `y[i]`, we have `x[i] < y[i]`. -If both `x` and `y` are empty, this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `y`: Numeric `Tensor`, same dtype as and broadcastable to `x`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`, `y`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_less". - -##### Returns: - - Op that raises `InvalidArgumentError` if `x < y` is False. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.broadcast_static_shape.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.broadcast_static_shape.md deleted file mode 100644 index 3d5e1ea96a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.broadcast_static_shape.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.broadcast_static_shape(shape_x, shape_y)` {#broadcast_static_shape} - -Returns the broadcasted static shape between `shape_x` and `shape_y`. - -##### Args: - - -* `shape_x`: A `TensorShape` -* `shape_y`: A `TensorShape` - -##### Returns: - - A `TensorShape` representing the broadcasted shape. - -##### Raises: - - -* `ValueError`: If the two shapes can not be broadcasted. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.clip_by_value.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.clip_by_value.md deleted file mode 100644 index 7cd7e0311e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.clip_by_value.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.clip_by_value(t, clip_value_min, clip_value_max, name=None)` {#clip_by_value} - -Clips tensor values to a specified min and max. - -Given a tensor `t`, this operation returns a tensor of the same type and -shape as `t` with its values clipped to `clip_value_min` and `clip_value_max`. -Any values less than `clip_value_min` are set to `clip_value_min`. Any values -greater than `clip_value_max` are set to `clip_value_max`. - -##### Args: - - -* `t`: A `Tensor`. -* `clip_value_min`: A 0-D (scalar) `Tensor`. The minimum value to clip by. -* `clip_value_max`: A 0-D (scalar) `Tensor`. The maximum value to clip by. -* `name`: A name for the operation (optional). - -##### Returns: - - A clipped `Tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.complex.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.complex.md deleted file mode 100644 index 79809ab1d6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.complex.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.complex(real, imag, name=None)` {#complex} - -Converts two real numbers to a complex number. - -Given a tensor `real` representing the real part of a complex number, and a -tensor `imag` representing the imaginary part of a complex number, this -operation returns complex numbers elementwise of the form \\(a + bj\\), where -*a* represents the `real` part and *b* represents the `imag` part. - -The input tensors `real` and `imag` must have the same shape. - -For example: - -``` -# tensor 'real' is [2.25, 3.25] -# tensor `imag` is [4.75, 5.75] -tf.complex(real, imag) ==> [[2.25 + 4.75j], [3.25 + 5.75j]] -``` - -##### Args: - - -* `real`: A `Tensor`. Must be one of the following types: `float32`, - `float64`. -* `imag`: A `Tensor`. Must have the same type as `real`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `complex64` or `complex128`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.md deleted file mode 100644 index 9589179897..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.md +++ /dev/null @@ -1,111 +0,0 @@ -StochasticTensor is a BaseStochasticTensor backed by a distribution. -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.__init__(dist, name='StochasticTensor', dist_value_type=None, loss_fn=score_function)` {#StochasticTensor.__init__} - -Construct a `StochasticTensor`. - -`StochasticTensor` is backed by the `dist` distribution and its `value` -method will return the same value each time it is called. What `value` is -returned is controlled by the `dist_value_type` (defaults to -`SampleValue`). - -Some distributions' sample functions are not differentiable (e.g. a sample -from a discrete distribution like a Bernoulli) and so to differentiate -wrt parameters upstream of the sample requires a gradient estimator like -the score function estimator. This is accomplished by passing a -differentiable `loss_fn` to the `StochasticTensor`, which -defaults to a function whose derivative is the score function estimator. -Calling `stochastic_graph.surrogate_loss(final_losses)` will call -`loss()` on every `StochasticTensor` upstream of final losses. - -`loss()` will return None for `StochasticTensor`s backed by -reparameterized distributions; it will also return None if the value type is -`MeanValueType` or if `loss_fn=None`. - -##### Args: - - -* `dist`: an instance of `Distribution`. -* `name`: a name for this `StochasticTensor` and its ops. -* `dist_value_type`: a `_StochasticValueType`, which will determine what the - `value` of this `StochasticTensor` will be. If not provided, the - value type set with the `value_type` context manager will be used. -* `loss_fn`: callable that takes - `(st, st.value(), influenced_loss)`, where - `st` is this `StochasticTensor`, and returns a `Tensor` loss. By - default, `loss_fn` is the `score_function`, or more precisely, the - integral of the score function, such that when the gradient is taken, - the score function results. See the `stochastic_gradient_estimators` - module for additional loss functions and baselines. - -##### Raises: - - -* `TypeError`: if `dist` is not an instance of `Distribution`. -* `TypeError`: if `loss_fn` is not `callable`. - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.distribution` {#StochasticTensor.distribution} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.dtype` {#StochasticTensor.dtype} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.entropy(name='entropy')` {#StochasticTensor.entropy} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.graph` {#StochasticTensor.graph} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.loss(final_loss, name='Loss')` {#StochasticTensor.loss} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.mean(name='mean')` {#StochasticTensor.mean} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.name` {#StochasticTensor.name} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.value(name='value')` {#StochasticTensor.value} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.StochasticTensor.value_type` {#StochasticTensor.value_type} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.bayesflow.variational_inference.ELBOForms.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.bayesflow.variational_inference.ELBOForms.md deleted file mode 100644 index 2d488ac3d0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.bayesflow.variational_inference.ELBOForms.md +++ /dev/null @@ -1,18 +0,0 @@ -Constants to control the `elbo` calculation. - -`analytic_kl` uses the analytic KL divergence between the -variational distribution(s) and the prior(s). - -`analytic_entropy` uses the analytic entropy of the variational -distribution(s). - -`sample` uses the sample KL or the sample entropy is the joint is provided. - -See `elbo` for what is used with `default`. -- - - - -#### `tf.contrib.bayesflow.variational_inference.ELBOForms.check_form(form)` {#ELBOForms.check_form} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.crf.viterbi_decode.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.crf.viterbi_decode.md deleted file mode 100644 index d0ebb5bab6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.crf.viterbi_decode.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.contrib.crf.viterbi_decode(score, transition_params)` {#viterbi_decode} - -Decode the highest scoring sequence of tags outside of TensorFlow. - -This should only be used at test time. - -##### Args: - - -* `score`: A [seq_len, num_tags] matrix of unary potentials. -* `transition_params`: A [num_tags, num_tags] matrix of binary potentials. - -##### Returns: - - -* `viterbi`: A [seq_len] list of integers containing the highest scoring tag - indicies. -* `viterbi_score`: A float containing the score for the Viterbi sequence. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.distributions.bijector.Invert.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.distributions.bijector.Invert.md deleted file mode 100644 index ceafe4514f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.distributions.bijector.Invert.md +++ /dev/null @@ -1,307 +0,0 @@ -Bijector which inverts another Bijector. - -Example Use: [ExpGammaDistribution (see Background & Context)]( -https://reference.wolfram.com/language/ref/ExpGammaDistribution.html) -models `Y=log(X)` where `X ~ Gamma`. - -```python -exp_gamma_distribution = TransformedDistribution( - distribution=Gamma(concentration=1., rate=2.), - bijector=bijector.Invert(bijector.Exp()) -``` -- - - - -#### `tf.contrib.distributions.bijector.Invert.__init__(bijector, validate_args=False, name=None)` {#Invert.__init__} - -Creates a `Bijector` which swaps the meaning of `inverse` and `forward`. - -Note: An inverted bijector's `inverse_log_det_jacobian` is often more -efficient if the base bijector implements `_forward_log_det_jacobian`. If -`_forward_log_det_jacobian` is not implemented then the following code is -used: - -```python -y = self.inverse(x, **kwargs) -return -self.inverse_log_det_jacobian(y, **kwargs) -``` - -##### Args: - - -* `bijector`: Bijector instance. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str`, name given to ops managed by this object. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.bijector` {#Invert.bijector} - - - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.dtype` {#Invert.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.event_ndims` {#Invert.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.forward(x, name='forward')` {#Invert.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.forward_event_shape(input_shape)` {#Invert.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Invert.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Invert.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.graph_parents` {#Invert.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.inverse(y, name='inverse')` {#Invert.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Invert.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.inverse_event_shape(output_shape)` {#Invert.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Invert.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Invert.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.is_constant_jacobian` {#Invert.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.name` {#Invert.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Invert.validate_args` {#Invert.validate_args} - -Returns True if Tensor arguments will be validated. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.distributions.bijector.Softplus.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.distributions.bijector.Softplus.md deleted file mode 100644 index 49527a0aea..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.distributions.bijector.Softplus.md +++ /dev/null @@ -1,295 +0,0 @@ -Bijector which computes `Y = g(X) = Log[1 + exp(X)]`. - -The softplus `Bijector` has the following two useful properties: - -* The domain is the positive real numbers -* `softplus(x) approx x`, for large `x`, so it does not overflow as easily as - the `Exp` `Bijector`. - - Example Use: - - ```python - # Create the Y=g(X)=softplus(X) transform which works only on Tensors with 1 - # batch ndim and 2 event ndims (i.e., vector of matrices). - softplus = Softplus(event_ndims=2) - x = [[[1., 2], - [3, 4]], - [[5, 6], - [7, 8]]] - log(1 + exp(x)) == softplus.forward(x) - log(exp(x) - 1) == softplus.inverse(x) - ``` - - Note: log(.) and exp(.) are applied element-wise but the Jacobian is a - reduction over the event space. -- - - - -#### `tf.contrib.distributions.bijector.Softplus.__init__(event_ndims=0, validate_args=False, name='softplus')` {#Softplus.__init__} - - - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.dtype` {#Softplus.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.event_ndims` {#Softplus.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.forward(x, name='forward')` {#Softplus.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.forward_event_shape(input_shape)` {#Softplus.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Softplus.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Softplus.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.graph_parents` {#Softplus.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.inverse(y, name='inverse')` {#Softplus.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Softplus.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.inverse_event_shape(output_shape)` {#Softplus.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Softplus.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Softplus.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.is_constant_jacobian` {#Softplus.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.name` {#Softplus.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Softplus.validate_args` {#Softplus.validate_args} - -Returns True if Tensor arguments will be validated. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.distributions.normal_conjugates_known_scale_predictive.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.distributions.normal_conjugates_known_scale_predictive.md deleted file mode 100644 index fdbae8aaf4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.distributions.normal_conjugates_known_scale_predictive.md +++ /dev/null @@ -1,55 +0,0 @@ -### `tf.contrib.distributions.normal_conjugates_known_scale_predictive(prior, scale, s, n)` {#normal_conjugates_known_scale_predictive} - -Posterior predictive Normal distribution w. conjugate prior on the mean. - -This model assumes that `n` observations (with sum `s`) come from a -Normal with unknown mean `loc` (described by the Normal `prior`) -and known variance `scale**2`. The "known scale predictive" -is the distribution of new observations, conditioned on the existing -observations and our prior. - -Accepts a prior Normal distribution object, having parameters -`loc0` and `scale0`, as well as known `scale` values of the predictive -distribution(s) (also assumed Normal), -and statistical estimates `s` (the sum(s) of the observations) and -`n` (the number(s) of observations). - -Calculates the Normal distribution(s) `p(x | sigma**2)`: - -``` -p(x | sigma**2) = int N(x | mu, sigma**2)N(mu | prior.loc, prior.scale**2) dmu - = N(x | prior.loc, 1 / (sigma**2 + prior.scale**2)) -``` - -Returns the predictive posterior distribution object, with parameters -`(loc', scale'**2)`, where: - -``` -sigma_n**2 = 1/(1/sigma0**2 + n/sigma**2), -mu' = (mu0/sigma0**2 + s/sigma**2) * sigma_n**2. -sigma'**2 = sigma_n**2 + sigma**2, -``` - -Distribution parameters from `prior`, as well as `scale`, `s`, and `n`. -will broadcast in the case of multidimensional sets of parameters. - -##### Args: - - -* `prior`: `Normal` object of type `dtype`: - the prior distribution having parameters `(loc0, scale0)`. -* `scale`: tensor of type `dtype`, taking values `scale > 0`. - The known stddev parameter(s). -* `s`: Tensor of type `dtype`. The sum(s) of observations. -* `n`: Tensor of type `int`. The number(s) of observations. - -##### Returns: - - A new Normal predictive distribution object. - -##### Raises: - - -* `TypeError`: if dtype of `s` does not match `dtype`, or `prior` is not a - Normal object. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.framework.VariableDeviceChooser.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.framework.VariableDeviceChooser.md deleted file mode 100644 index 0b25e06bae..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.framework.VariableDeviceChooser.md +++ /dev/null @@ -1,36 +0,0 @@ -Device chooser for variables. - -When using a parameter server it will assign them in a round-robin fashion. -When not using a parameter server it allows GPU or CPU placement. -- - - - -#### `tf.contrib.framework.VariableDeviceChooser.__call__(op)` {#VariableDeviceChooser.__call__} - - - - -- - - - -#### `tf.contrib.framework.VariableDeviceChooser.__init__(num_tasks=0, job_name='ps', device_type='CPU', device_index=0)` {#VariableDeviceChooser.__init__} - -Initialize VariableDeviceChooser. - -##### Usage: - - To use with 2 parameter servers: - VariableDeviceChooser(2) - - To use without parameter servers: - VariableDeviceChooser() - VariableDeviceChooser(device_type='GPU') # For GPU placement - -##### Args: - - -* `num_tasks`: number of tasks. -* `job_name`: String, a name for the parameter server job. -* `device_type`: Optional device type string (e.g. "CPU" or "GPU") -* `device_index`: int. Optional device index. If left - unspecified, device represents 'any' device_index. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.framework.add_arg_scope.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.framework.add_arg_scope.md deleted file mode 100644 index a726ebad96..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.framework.add_arg_scope.md +++ /dev/null @@ -1,13 +0,0 @@ -### `tf.contrib.framework.add_arg_scope(func)` {#add_arg_scope} - -Decorates a function with args so it can be used within an arg_scope. - -##### Args: - - -* `func`: function to decorate. - -##### Returns: - - A tuple with the decorated function func_with_args(). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.framework.load_variable.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.framework.load_variable.md deleted file mode 100644 index 410b18e466..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.framework.load_variable.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.contrib.framework.load_variable(checkpoint_dir, name)` {#load_variable} - -Returns a Tensor with the contents of the given variable in the checkpoint. - -##### Args: - - -* `checkpoint_dir`: Directory with checkpoints file or path to checkpoint. -* `name`: Name of the tensor to return. - -##### Returns: - - `Tensor` object. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.OpMatcher.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.OpMatcher.md deleted file mode 100644 index 61931afde5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.OpMatcher.md +++ /dev/null @@ -1,36 +0,0 @@ -Graph match class. -- - - - -#### `tf.contrib.graph_editor.OpMatcher.__call__(op)` {#OpMatcher.__call__} - -Evaluate if the op matches or not. - - -- - - - -#### `tf.contrib.graph_editor.OpMatcher.__init__(positive_filter)` {#OpMatcher.__init__} - -Graph match constructor. - - -- - - - -#### `tf.contrib.graph_editor.OpMatcher.control_input_ops(*args)` {#OpMatcher.control_input_ops} - -Add input matches. - - -- - - - -#### `tf.contrib.graph_editor.OpMatcher.input_ops(*args)` {#OpMatcher.input_ops} - -Add input matches. - - -- - - - -#### `tf.contrib.graph_editor.OpMatcher.output_ops(*args)` {#OpMatcher.output_ops} - -Add output matches. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.get_consuming_ops.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.get_consuming_ops.md deleted file mode 100644 index 2db80c07ad..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.get_consuming_ops.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.contrib.graph_editor.get_consuming_ops(ts)` {#get_consuming_ops} - -Return all the consuming ops of the tensors in ts. - -##### Args: - - -* `ts`: a list of `tf.Tensor` - -##### Returns: - - A list of all the consuming `tf.Operation` of the tensors in `ts`. - -##### Raises: - - -* `TypeError`: if ts cannot be converted to a list of `tf.Tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.graph_replace.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.graph_replace.md deleted file mode 100644 index 56143111a5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.graph_replace.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.contrib.graph_editor.graph_replace(target_ts, replacement_ts, dst_scope='', src_scope='', reuse_dst_scope=False)` {#graph_replace} - -Create a new graph which compute the targets from the replaced Tensors. - -##### Args: - - -* `target_ts`: a single tf.Tensor or an iterable of tf.Tensor. -* `replacement_ts`: dictionary mapping from original tensors to replaced tensors -* `dst_scope`: the destination scope. -* `src_scope`: the source scope. -* `reuse_dst_scope`: if True the dst_scope is re-used if it already exists. - Otherwise, the scope is given a unique name based on the one given - by appending an underscore followed by a digit (default). - -##### Returns: - - A single tf.Tensor or a list of target tf.Tensor, depending on - the type of the input argument `target_ts`. - The returned tensors are recomputed using the tensors from replacement_ts. - -##### Raises: - - -* `ValueError`: if the targets are not connected to replacement_ts. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.make_list_of_op.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.make_list_of_op.md deleted file mode 100644 index 61273bffc3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.make_list_of_op.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.contrib.graph_editor.make_list_of_op(ops, check_graph=True, allow_graph=True, ignore_ts=False)` {#make_list_of_op} - -Convert ops to a list of `tf.Operation`. - -##### Args: - - -* `ops`: can be an iterable of `tf.Operation`, a `tf.Graph` or a single - operation. -* `check_graph`: if `True` check if all the operations belong to the same graph. -* `allow_graph`: if `False` a `tf.Graph` cannot be converted. -* `ignore_ts`: if True, silently ignore `tf.Tensor`. - -##### Returns: - - A newly created list of `tf.Operation`. - -##### Raises: - - -* `TypeError`: if ops cannot be converted to a list of `tf.Operation` or, - if `check_graph` is `True`, if all the ops do not belong to the - same graph. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.reroute_outputs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.reroute_outputs.md deleted file mode 100644 index a00fe8e589..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.reroute_outputs.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.graph_editor.reroute_outputs(sgv0, sgv1)` {#reroute_outputs} - -Re-route all the outputs of sgv0 to sgv1 (see _reroute_outputs). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.sgv_scope.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.sgv_scope.md deleted file mode 100644 index 3be069140d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.graph_editor.sgv_scope.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.contrib.graph_editor.sgv_scope(scope, graph)` {#sgv_scope} - -Make a subgraph from a name scope. - -##### Args: - - -* `scope`: the name of the scope. -* `graph`: the `tf.Graph`. - -##### Returns: - - A subgraph view representing the given scope. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.avg_pool2d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.avg_pool2d.md deleted file mode 100644 index d5c41576c9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.avg_pool2d.md +++ /dev/null @@ -1,32 +0,0 @@ -### `tf.contrib.layers.avg_pool2d(*args, **kwargs)` {#avg_pool2d} - -Adds a 2D average pooling op. - -It is assumed that the pooling is done per image but not in batch or channels. - -##### Args: - - -* `inputs`: A 4-D tensor of shape `[batch_size, height, width, channels]` if - `data_format` is `NHWC`, and `[batch_size, channels, height, width]` if - `data_format` is `NCHW`. -* `kernel_size`: A list of length 2: [kernel_height, kernel_width] of the - pooling kernel over which the op is computed. Can be an int if both - values are the same. -* `stride`: A list of length 2: [stride_height, stride_width]. - Can be an int if both strides are the same. Note that presently - both strides must have the same value. -* `padding`: The padding method, either 'VALID' or 'SAME'. -* `data_format`: A string. `NHWC` (default) and `NCHW` are supported. -* `outputs_collections`: The collections to which the outputs are added. -* `scope`: Optional scope for name_scope. - -##### Returns: - - A `Tensor` representing the results of the pooling operation. - -##### Raises: - - -* `ValueError`: If `data_format` is neither `NHWC` nor `NCHW`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.batch_norm.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.batch_norm.md deleted file mode 100644 index d6f7271be8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.batch_norm.md +++ /dev/null @@ -1,83 +0,0 @@ -### `tf.contrib.layers.batch_norm(*args, **kwargs)` {#batch_norm} - -Adds a Batch Normalization layer from http://arxiv.org/abs/1502.03167. - - "Batch Normalization: Accelerating Deep Network Training by Reducing - Internal Covariate Shift" - - Sergey Ioffe, Christian Szegedy - -Can be used as a normalizer function for conv2d and fully_connected. - -Note: When is_training is True the moving_mean and moving_variance need to be -updated, by default the update_ops are placed in `tf.GraphKeys.UPDATE_OPS` so -they need to be added as a dependency to the `train_op`, example: - - update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS) - if update_ops: - updates = tf.group(*update_ops) - total_loss = control_flow_ops.with_dependencies([updates], total_loss) - -One can set updates_collections=None to force the updates in place, but that -can have speed penalty, especially in distributed settings. - -##### Args: - - -* `inputs`: A tensor with 2 or more dimensions, where the first dimension has - `batch_size`. The normalization is over all but the last dimension if - `data_format` is `NHWC` and the second dimension if `data_format` is - `NCHW`. -* `decay`: Decay for the moving average. Reasonable values for `decay` are close - to 1.0, typically in the multiple-nines range: 0.999, 0.99, 0.9, etc. - Lower `decay` value (recommend trying `decay`=0.9) if model experiences - reasonably good training performance but poor validation and/or test - performance. Try zero_debias_moving_mean=True for improved stability. -* `center`: If True, add offset of `beta` to normalized tensor. If False, `beta` - is ignored. -* `scale`: If True, multiply by `gamma`. If False, `gamma` is - not used. When the next layer is linear (also e.g. `nn.relu`), this can be - disabled since the scaling can be done by the next layer. -* `epsilon`: Small float added to variance to avoid dividing by zero. -* `activation_fn`: Activation function, default set to None to skip it and - maintain a linear activation. -* `param_initializers`: Optional initializers for beta, gamma, moving mean and - moving variance. -* `updates_collections`: Collections to collect the update ops for computation. - The updates_ops need to be executed with the train_op. - If None, a control dependency would be added to make sure the updates are - computed in place. -* `is_training`: Whether or not the layer is in training mode. In training mode - it would accumulate the statistics of the moments into `moving_mean` and - `moving_variance` using an exponential moving average with the given - `decay`. When it is not in training mode then it would use the values of - the `moving_mean` and the `moving_variance`. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional collections for the variables. -* `outputs_collections`: Collections to add the outputs. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see `tf.Variable`). -* `batch_weights`: An optional tensor of shape `[batch_size]`, - containing a frequency weight for each batch item. If present, - then the batch normalization uses weighted mean and - variance. (This can be used to correct for bias in training - example selection.) -* `fused`: Use nn.fused_batch_norm if True, nn.batch_normalization otherwise. -* `data_format`: A string. `NHWC` (default) and `NCHW` are supported. -* `zero_debias_moving_mean`: Use zero_debias for moving_mean. It creates a new - pair of variables 'moving_mean/biased' and 'moving_mean/local_step'. -* `scope`: Optional scope for `variable_scope`. - -##### Returns: - - A `Tensor` representing the output of the operation. - -##### Raises: - - -* `ValueError`: If `batch_weights` is not None and `fused` is True. -* `ValueError`: If `data_format` is neither `NHWC` nor `NCHW`. -* `ValueError`: If the rank of `inputs` is undefined. -* `ValueError`: If rank or channels dimension of `inputs` is undefined. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.check_feature_columns.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.check_feature_columns.md deleted file mode 100644 index 4b725e57d8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.check_feature_columns.md +++ /dev/null @@ -1,15 +0,0 @@ -### `tf.contrib.layers.check_feature_columns(feature_columns)` {#check_feature_columns} - -Checks the validity of the set of FeatureColumns. - -##### Args: - - -* `feature_columns`: An iterable of instances or subclasses of FeatureColumn. - -##### Raises: - - -* `ValueError`: If `feature_columns` is a dict. -* `ValueError`: If there are duplicate feature column keys. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.one_hot_column.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.one_hot_column.md deleted file mode 100644 index b79159f798..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.one_hot_column.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.contrib.layers.one_hot_column(sparse_id_column)` {#one_hot_column} - -Creates an `_OneHotColumn` for a one-hot or multi-hot repr in a DNN. - -##### Args: - - -* `sparse_id_column`: A _SparseColumn which is created by - `sparse_column_with_*` - or crossed_column functions. Note that `combiner` defined in - `sparse_id_column` is ignored. - -##### Returns: - - An _OneHotColumn. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.regression_target.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.regression_target.md deleted file mode 100644 index a75a8a8f74..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.regression_target.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.contrib.layers.regression_target(*args, **kwargs)` {#regression_target} - -Creates a _TargetColumn for linear regression. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-11-12. -Instructions for updating: -This file will be removed after the deprecation date.Please switch to third_party/tensorflow/contrib/learn/python/learn/estimators/head.py - -##### Args: - - -* `label_name`: String, name of the key in label dict. Can be null if label - is a tensor (single headed models). -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. It - will be multiplied by the loss of the example. -* `label_dimension`: dimension of the target for multilabels. - -##### Returns: - - An instance of _TargetColumn - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.unit_norm.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.unit_norm.md deleted file mode 100644 index 9b0752ff7f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.layers.unit_norm.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.contrib.layers.unit_norm(*args, **kwargs)` {#unit_norm} - -Normalizes the given input across the specified dimension to unit length. - -Note that the rank of `input` must be known. - -##### Args: - - -* `inputs`: A `Tensor` of arbitrary size. -* `dim`: The dimension along which the input is normalized. -* `epsilon`: A small value to add to the inputs to avoid dividing by zero. -* `scope`: Optional scope for variable_scope. - -##### Returns: - - The normalized `Tensor`. - -##### Raises: - - -* `ValueError`: If dim is smaller than the number of dimensions in 'inputs'. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.DNNClassifier.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.DNNClassifier.md deleted file mode 100644 index f58904ed71..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.DNNClassifier.md +++ /dev/null @@ -1,467 +0,0 @@ -A classifier for TensorFlow DNN models. - -Example: - -```python -sparse_feature_a = sparse_column_with_hash_bucket(...) -sparse_feature_b = sparse_column_with_hash_bucket(...) - -sparse_feature_a_emb = embedding_column(sparse_id_column=sparse_feature_a, - ...) -sparse_feature_b_emb = embedding_column(sparse_id_column=sparse_feature_b, - ...) - -estimator = DNNClassifier( - feature_columns=[sparse_feature_a_emb, sparse_feature_b_emb], - hidden_units=[1024, 512, 256]) - -# Or estimator using the ProximalAdagradOptimizer optimizer with -# regularization. -estimator = DNNClassifier( - feature_columns=[sparse_feature_a_emb, sparse_feature_b_emb], - hidden_units=[1024, 512, 256], - optimizer=tf.train.ProximalAdagradOptimizer( - learning_rate=0.1, - l1_regularization_strength=0.001 - )) - -# Input builders -def input_fn_train: # returns x, y (where y represents label's class index). - pass -estimator.fit(input_fn=input_fn_train) - -def input_fn_eval: # returns x, y (where y represents label's class index). - pass -estimator.evaluate(input_fn=input_fn_eval) -estimator.predict(x=x) # returns predicted labels (i.e. label's class index). -``` - -Input of `fit` and `evaluate` should have following features, - otherwise there will be a `KeyError`: - -* if `weight_column_name` is not `None`, a feature with - `key=weight_column_name` whose value is a `Tensor`. -* for each `column` in `feature_columns`: - - if `column` is a `SparseColumn`, a feature with `key=column.name` - whose `value` is a `SparseTensor`. - - if `column` is a `WeightedSparseColumn`, two features: the first with - `key` the id column name, the second with `key` the weight column name. - Both features' `value` must be a `SparseTensor`. - - if `column` is a `RealValuedColumn`, a feature with `key=column.name` - whose `value` is a `Tensor`. -- - - - -#### `tf.contrib.learn.DNNClassifier.__init__(hidden_units, feature_columns, model_dir=None, n_classes=2, weight_column_name=None, optimizer=None, activation_fn=relu, dropout=None, gradient_clip_norm=None, enable_centered_bias=False, config=None, feature_engineering_fn=None, embedding_lr_multipliers=None, input_layer_min_slice_size=None)` {#DNNClassifier.__init__} - -Initializes a DNNClassifier instance. - -##### Args: - - -* `hidden_units`: List of hidden units per layer. All layers are fully - connected. Ex. `[64, 32]` means first layer has 64 nodes and second one - has 32. -* `feature_columns`: An iterable containing all the feature columns used by - the model. All items in the set should be instances of classes derived - from `FeatureColumn`. -* `model_dir`: Directory to save model parameters, graph and etc. This can - also be used to load checkpoints from the directory into a estimator to - continue training a previously saved model. -* `n_classes`: number of label classes. Default is binary classification. - It must be greater than 1. Note: Class labels are integers representing - the class index (i.e. values from 0 to n_classes-1). For arbitrary - label values (e.g. string labels), convert to class indices first. -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. It - will be multiplied by the loss of the example. -* `optimizer`: An instance of `tf.Optimizer` used to train the model. If - `None`, will use an Adagrad optimizer. -* `activation_fn`: Activation function applied to each layer. If `None`, will - use `tf.nn.relu`. -* `dropout`: When not `None`, the probability we will drop out a given - coordinate. -* `gradient_clip_norm`: A float > 0. If provided, gradients are - clipped to their global norm with this clipping ratio. See - `tf.clip_by_global_norm` for more details. -* `enable_centered_bias`: A bool. If True, estimator will learn a centered - bias variable for each class. Rest of the model structure learns the - residual after centered bias. -* `config`: `RunConfig` object to configure the runtime settings. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into the model. -* `embedding_lr_multipliers`: Optional. A dictionary from `EmbeddingColumn` to - a `float` multiplier. Multiplier will be used to multiply with - learning rate for the embedding variables. -* `input_layer_min_slice_size`: Optional. The min slice size of input layer - partitions. If not provided, will use the default of 64M. - -##### Returns: - - A `DNNClassifier` estimator. - -##### Raises: - - -* `ValueError`: If `n_classes` < 2. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.__repr__()` {#DNNClassifier.__repr__} - - - - -- - - - -#### `tf.contrib.learn.DNNClassifier.bias_` {#DNNClassifier.bias_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - -- - - - -#### `tf.contrib.learn.DNNClassifier.config` {#DNNClassifier.config} - - - - -- - - - -#### `tf.contrib.learn.DNNClassifier.evaluate(*args, **kwargs)` {#DNNClassifier.evaluate} - -See `Evaluable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If at least one of `x` or `y` is provided, and at least one of - `input_fn` or `feed_fn` is provided. - Or if `metrics` is not `None` or `dict`. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.export(export_dir, input_fn=None, input_feature_key=None, use_deprecated_input_fn=True, signature_fn=None, default_batch_size=1, exports_to_keep=None)` {#DNNClassifier.export} - -See BaseEstimator.export. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#DNNClassifier.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.fit(*args, **kwargs)` {#DNNClassifier.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.get_params(deep=True)` {#DNNClassifier.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.get_variable_names()` {#DNNClassifier.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.get_variable_value(name)` {#DNNClassifier.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.model_dir` {#DNNClassifier.model_dir} - - - - -- - - - -#### `tf.contrib.learn.DNNClassifier.partial_fit(*args, **kwargs)` {#DNNClassifier.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.predict(*args, **kwargs)` {#DNNClassifier.predict} - -Returns predictions for given features. (deprecated arguments) (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2017-03-01. -Instructions for updating: -Please switch to predict_classes, or set `outputs` argument. - -By default, returns predicted classes. But this default will be dropped -soon. Users should either pass `outputs`, or call `predict_classes` method. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns classes. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted classes with shape [batch_size] (or an iterable - of predicted classes if as_iterable is True). Each predicted class is - represented by its class index (i.e. integer from 0 to n_classes-1). - If `outputs` is set, returns a dict of predictions. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.predict_classes(*args, **kwargs)` {#DNNClassifier.predict_classes} - -Returns predicted classes for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted classes with shape [batch_size] (or an iterable - of predicted classes if as_iterable is True). Each predicted class is - represented by its class index (i.e. integer from 0 to n_classes-1). - - -- - - - -#### `tf.contrib.learn.DNNClassifier.predict_proba(*args, **kwargs)` {#DNNClassifier.predict_proba} - -Returns predicted probabilities for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x and y must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted probabilities with shape [batch_size, n_classes] - (or an iterable of predicted probabilities if as_iterable is True). - - -- - - - -#### `tf.contrib.learn.DNNClassifier.set_params(**params)` {#DNNClassifier.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - -- - - - -#### `tf.contrib.learn.DNNClassifier.weights_` {#DNNClassifier.weights_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.DNNLinearCombinedClassifier.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.DNNLinearCombinedClassifier.md deleted file mode 100644 index 0c82c24515..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.DNNLinearCombinedClassifier.md +++ /dev/null @@ -1,493 +0,0 @@ -A classifier for TensorFlow Linear and DNN joined training models. - -Example: - -```python -sparse_feature_a = sparse_column_with_hash_bucket(...) -sparse_feature_b = sparse_column_with_hash_bucket(...) - -sparse_feature_a_x_sparse_feature_b = crossed_column(...) - -sparse_feature_a_emb = embedding_column(sparse_id_column=sparse_feature_a, - ...) -sparse_feature_b_emb = embedding_column(sparse_id_column=sparse_feature_b, - ...) - -estimator = DNNLinearCombinedClassifier( - # common settings - n_classes=n_classes, - weight_column_name=weight_column_name, - # wide settings - linear_feature_columns=[sparse_feature_a_x_sparse_feature_b], - linear_optimizer=tf.train.FtrlOptimizer(...), - # deep settings - dnn_feature_columns=[sparse_feature_a_emb, sparse_feature_b_emb], - dnn_hidden_units=[1000, 500, 100], - dnn_optimizer=tf.train.AdagradOptimizer(...)) - -# Input builders -def input_fn_train: # returns x, y (where y represents label's class index). - ... -def input_fn_eval: # returns x, y (where y represents label's class index). - ... -estimator.fit(input_fn=input_fn_train) -estimator.evaluate(input_fn=input_fn_eval) -estimator.predict(x=x) # returns predicted labels (i.e. label's class index). -``` - -Input of `fit` and `evaluate` should have following features, - otherwise there will be a `KeyError`: - if `weight_column_name` is not `None`, a feature with - `key=weight_column_name` whose value is a `Tensor`. - for each `column` in `dnn_feature_columns` + `linear_feature_columns`: - - if `column` is a `SparseColumn`, a feature with `key=column.name` - whose `value` is a `SparseTensor`. - - if `column` is a `WeightedSparseColumn`, two features: the first with - `key` the id column name, the second with `key` the weight column name. - Both features' `value` must be a `SparseTensor`. - - if `column` is a `RealValuedColumn, a feature with `key=column.name` - whose `value` is a `Tensor`. -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.__init__(model_dir=None, n_classes=2, weight_column_name=None, linear_feature_columns=None, linear_optimizer=None, _joint_linear_weights=False, dnn_feature_columns=None, dnn_optimizer=None, dnn_hidden_units=None, dnn_activation_fn=relu, dnn_dropout=None, gradient_clip_norm=None, enable_centered_bias=False, config=None, feature_engineering_fn=None, embedding_lr_multipliers=None, input_layer_min_slice_size=None)` {#DNNLinearCombinedClassifier.__init__} - -Constructs a DNNLinearCombinedClassifier instance. - -##### Args: - - -* `model_dir`: Directory to save model parameters, graph and etc. This can - also be used to load checkpoints from the directory into a estimator - to continue training a previously saved model. -* `n_classes`: number of label classes. Default is binary classification. - Note that class labels are integers representing the class index (i.e. - values from 0 to n_classes-1). For arbitrary label values (e.g. string - labels), convert to class indices first. -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. - It will be multiplied by the loss of the example. -* `linear_feature_columns`: An iterable containing all the feature columns - used by linear part of the model. All items in the set must be - instances of classes derived from `FeatureColumn`. -* `linear_optimizer`: An instance of `tf.Optimizer` used to apply gradients to - the linear part of the model. If `None`, will use a FTRL optimizer. - _joint_linear_weights: If True a single (possibly partitioned) variable - will be used to store the linear model weights. It's faster, but - requires all columns are sparse and have the 'sum' combiner. - -* `dnn_feature_columns`: An iterable containing all the feature columns used - by deep part of the model. All items in the set must be instances of - classes derived from `FeatureColumn`. -* `dnn_optimizer`: An instance of `tf.Optimizer` used to apply gradients to - the deep part of the model. If `None`, will use an Adagrad optimizer. -* `dnn_hidden_units`: List of hidden units per layer. All layers are fully - connected. -* `dnn_activation_fn`: Activation function applied to each layer. If `None`, - will use `tf.nn.relu`. -* `dnn_dropout`: When not None, the probability we will drop out - a given coordinate. -* `gradient_clip_norm`: A float > 0. If provided, gradients are clipped - to their global norm with this clipping ratio. See - tf.clip_by_global_norm for more details. -* `enable_centered_bias`: A bool. If True, estimator will learn a centered - bias variable for each class. Rest of the model structure learns the - residual after centered bias. -* `config`: RunConfig object to configure the runtime settings. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into the model. -* `embedding_lr_multipliers`: Optional. A dictionary from `EmbeddingColumn` to - a `float` multiplier. Multiplier will be used to multiply with - learning rate for the embedding variables. -* `input_layer_min_slice_size`: Optional. The min slice size of input layer - partitions. If not provided, will use the default of 64M. - -##### Raises: - - -* `ValueError`: If `n_classes` < 2. -* `ValueError`: If both `linear_feature_columns` and `dnn_features_columns` - are empty at the same time. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.__repr__()` {#DNNLinearCombinedClassifier.__repr__} - - - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.config` {#DNNLinearCombinedClassifier.config} - - - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.dnn_bias_` {#DNNLinearCombinedClassifier.dnn_bias_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.dnn_weights_` {#DNNLinearCombinedClassifier.dnn_weights_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.evaluate(*args, **kwargs)` {#DNNLinearCombinedClassifier.evaluate} - -See `Evaluable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If at least one of `x` or `y` is provided, and at least one of - `input_fn` or `feed_fn` is provided. - Or if `metrics` is not `None` or `dict`. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.export(export_dir, input_fn=None, input_feature_key=None, use_deprecated_input_fn=True, signature_fn=None, default_batch_size=1, exports_to_keep=None)` {#DNNLinearCombinedClassifier.export} - -See BasEstimator.export. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#DNNLinearCombinedClassifier.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.fit(*args, **kwargs)` {#DNNLinearCombinedClassifier.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.get_params(deep=True)` {#DNNLinearCombinedClassifier.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.get_variable_names()` {#DNNLinearCombinedClassifier.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.get_variable_value(name)` {#DNNLinearCombinedClassifier.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.linear_bias_` {#DNNLinearCombinedClassifier.linear_bias_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.linear_weights_` {#DNNLinearCombinedClassifier.linear_weights_} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-30. -Instructions for updating: -This method will be removed after the deprecation date. To inspect variables, use get_variable_names() and get_variable_value(). - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.model_dir` {#DNNLinearCombinedClassifier.model_dir} - - - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.partial_fit(*args, **kwargs)` {#DNNLinearCombinedClassifier.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.predict(*args, **kwargs)` {#DNNLinearCombinedClassifier.predict} - -Returns predictions for given features. (deprecated arguments) (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2017-03-01. -Instructions for updating: -Please switch to predict_classes, or set `outputs` argument. - -By default, returns predicted classes. But this default will be dropped -soon. Users should either pass `outputs`, or call `predict_classes` method. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns classes. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted classes with shape [batch_size] (or an iterable - of predicted classes if as_iterable is True). Each predicted class is - represented by its class index (i.e. integer from 0 to n_classes-1). - If `outputs` is set, returns a dict of predictions. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.predict_classes(*args, **kwargs)` {#DNNLinearCombinedClassifier.predict_classes} - -Returns predicted classes for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted classes with shape [batch_size] (or an iterable - of predicted classes if as_iterable is True). Each predicted class is - represented by its class index (i.e. integer from 0 to n_classes-1). - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.predict_proba(*args, **kwargs)` {#DNNLinearCombinedClassifier.predict_proba} - -Returns prediction probabilities for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x and y must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted probabilities with shape [batch_size, n_classes] - (or an iterable of predicted probabilities if as_iterable is True). - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedClassifier.set_params(**params)` {#DNNLinearCombinedClassifier.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.Evaluable.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.Evaluable.md deleted file mode 100644 index 8024c9f7d0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.Evaluable.md +++ /dev/null @@ -1,77 +0,0 @@ -Interface for objects that are evaluatable by, e.g., `Experiment`. -- - - - -#### `tf.contrib.learn.Evaluable.evaluate(x=None, y=None, input_fn=None, feed_fn=None, batch_size=None, steps=None, metrics=None, name=None, checkpoint_path=None, hooks=None)` {#Evaluable.evaluate} - -Evaluates given model with provided evaluation data. - -Stop conditions - we evaluate on the given input data until one of the -following: -- If `steps` is provided, and `steps` batches of size `batch_size` are -processed. -- If `input_fn` is provided, and it raises an end-of-input -exception (`OutOfRangeError` or `StopIteration`). -- If `x` is provided, and all items in `x` have been processed. - -The return value is a dict containing the metrics specified in `metrics`, as -well as an entry `global_step` which contains the value of the global step -for which this evaluation was performed. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...] or dictionary of many matrices - containing the input samples for fitting the model. Can be iterator that returns - arrays of features or dictionary of array of features. If set, `input_fn` must - be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs] containing the - label values (class labels in classification, real numbers in - regression) or dictionary of multiple vectors/matrices. Can be iterator - that returns array of targets or dictionary of array of targets. If set, - `input_fn` must be `None`. Note: For classification, label values must - be integers representing the class index (i.e. values from 0 to - n_classes-1). -* `input_fn`: Input function returning a tuple of: - features - Dictionary of string feature name to `Tensor` or `Tensor`. - labels - `Tensor` or dictionary of `Tensor` with labels. - If input_fn is set, `x`, `y`, and `batch_size` must be `None`. If - `steps` is not provided, this should raise `OutOfRangeError` or - `StopIteration` after the desired amount of data (e.g., one epoch) has - been provided. See "Stop conditions" above for specifics. -* `feed_fn`: Function creating a feed dict every time it is called. Called - once per iteration. Must be `None` if `input_fn` is provided. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`, if specified. Must be `None` if `input_fn` is - provided. -* `steps`: Number of steps for which to evaluate model. If `None`, evaluate - until `x` is consumed or `input_fn` raises an end-of-input exception. - See "Stop conditions" above for specifics. -* `metrics`: Dict of metrics to run. If None, the default metric functions - are used; if {}, no metrics are used. Otherwise, `metrics` should map - friendly names for the metric to a `MetricSpec` object defining which - model outputs to evaluate against which labels with which metric - function. - - Metric ops should support streaming, e.g., returning `update_op` and - `value` tensors. For example, see the options defined in - `../../../metrics/python/ops/metrics_ops.py`. - -* `name`: Name of the evaluation if user needs to run multiple evaluations on - different data sets, such as on training data vs test data. -* `checkpoint_path`: Path of a specific checkpoint to evaluate. If `None`, the - latest checkpoint in `model_dir` is used. -* `hooks`: List of `SessionRunHook` subclass instances. Used for callbacks - inside the evaluation call. - -##### Returns: - - Returns `dict` with evaluation results. - - -- - - - -#### `tf.contrib.learn.Evaluable.model_dir` {#Evaluable.model_dir} - -Returns a path in which the eval process will look for checkpoints. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.ExportStrategy.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.ExportStrategy.md deleted file mode 100644 index 513bb777b2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.ExportStrategy.md +++ /dev/null @@ -1,89 +0,0 @@ -A class representing a type of model export. - -Typically constructed by a utility function specific to the exporter, such as -`saved_model_export_utils.make_export_strategy()`. - -The fields are: - name: The directory name under the export base directory where exports of - this type will be written. - export_fn: A function that writes an export, given an estimator, a - destination path, and optionally a checkpoint path and an evaluation - result for that checkpoint. This export_fn() may be run repeatedly during - continuous training, or just once at the end of fixed-length training. - Note the export_fn() may choose whether or not to export based on the eval - result or based on an internal timer or any other criterion, if exports - are not desired for every checkpoint. - - The signature of this function must be one of: - * (estimator, export_path) -> export_path` - * (estimator, export_path, checkpoint_path) -> export_path` - * (estimator, export_path, checkpoint_path, eval_result) -> export_path` -- - - - -#### `tf.contrib.learn.ExportStrategy.__getnewargs__()` {#ExportStrategy.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.contrib.learn.ExportStrategy.__getstate__()` {#ExportStrategy.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.contrib.learn.ExportStrategy.__new__(_cls, name, export_fn)` {#ExportStrategy.__new__} - -Create new instance of ExportStrategy(name, export_fn) - - -- - - - -#### `tf.contrib.learn.ExportStrategy.__repr__()` {#ExportStrategy.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.contrib.learn.ExportStrategy.export(estimator, export_path, checkpoint_path=None, eval_result=None)` {#ExportStrategy.export} - -Exports the given Estimator to a specific format. - -##### Args: - - -* `estimator`: the Estimator to export. -* `export_path`: A string containing a directory where to write the export. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the strategy may locate a checkpoint (e.g. the most recent) by itself. -* `eval_result`: The output of Estimator.evaluate on this checkpoint. This - should be set only if checkpoint_path is provided (otherwise it is - unclear which checkpoint this eval refers to). - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if the export_fn does not have the required signature - - -- - - - -#### `tf.contrib.learn.ExportStrategy.export_fn` {#ExportStrategy.export_fn} - -Alias for field number 1 - - -- - - - -#### `tf.contrib.learn.ExportStrategy.name` {#ExportStrategy.name} - -Alias for field number 0 - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.RunConfig.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.RunConfig.md deleted file mode 100644 index c782975fa2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.RunConfig.md +++ /dev/null @@ -1,163 +0,0 @@ -This class specifies the configurations for an `Estimator` run. - -If you're a Google-internal user using command line flags with -`learn_runner.py` (for instance, to do distributed training or to use -parameter servers), you probably want to use `learn_runner.EstimatorConfig` -instead. -- - - - -#### `tf.contrib.learn.RunConfig.__init__(master=None, num_cores=0, log_device_placement=False, gpu_memory_fraction=1, tf_random_seed=None, save_summary_steps=100, save_checkpoints_secs=600, save_checkpoints_steps=None, keep_checkpoint_max=5, keep_checkpoint_every_n_hours=10000, evaluation_master='')` {#RunConfig.__init__} - -Constructor. - -Note that the superclass `ClusterConfig` may set properties like -`cluster_spec`, `is_chief`, `master` (if `None` in the args), -`num_ps_replicas`, `task_id`, and `task_type` based on the `TF_CONFIG` -environment variable. See `ClusterConfig` for more details. - -##### Args: - - -* `master`: TensorFlow master. Defaults to empty string for local. -* `num_cores`: Number of cores to be used. If 0, the system picks an - appropriate number (default: 0). -* `log_device_placement`: Log the op placement to devices (default: False). -* `gpu_memory_fraction`: Fraction of GPU memory used by the process on - each GPU uniformly on the same machine. -* `tf_random_seed`: Random seed for TensorFlow initializers. - Setting this value allows consistency between reruns. -* `save_summary_steps`: Save summaries every this many steps. -* `save_checkpoints_secs`: Save checkpoints every this many seconds. Can not - be specified with `save_checkpoints_steps`. -* `save_checkpoints_steps`: Save checkpoints every this many steps. Can not be - specified with `save_checkpoints_secs`. -* `keep_checkpoint_max`: The maximum number of recent checkpoint files to - keep. As new files are created, older files are deleted. If None or 0, - all checkpoint files are kept. Defaults to 5 (that is, the 5 most recent - checkpoint files are kept.) -* `keep_checkpoint_every_n_hours`: Number of hours between each checkpoint - to be saved. The default value of 10,000 hours effectively disables - the feature. -* `evaluation_master`: the master on which to perform evaluation. - - -- - - - -#### `tf.contrib.learn.RunConfig.cluster_spec` {#RunConfig.cluster_spec} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.environment` {#RunConfig.environment} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.evaluation_master` {#RunConfig.evaluation_master} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.get_task_id()` {#RunConfig.get_task_id} - -Returns task index from `TF_CONFIG` environmental variable. - -If you have a ClusterConfig instance, you can just access its task_id -property instead of calling this function and re-parsing the environmental -variable. - -##### Returns: - - `TF_CONFIG['task']['index']`. Defaults to 0. - - -- - - - -#### `tf.contrib.learn.RunConfig.is_chief` {#RunConfig.is_chief} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.keep_checkpoint_every_n_hours` {#RunConfig.keep_checkpoint_every_n_hours} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.keep_checkpoint_max` {#RunConfig.keep_checkpoint_max} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.master` {#RunConfig.master} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.num_ps_replicas` {#RunConfig.num_ps_replicas} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.save_checkpoints_secs` {#RunConfig.save_checkpoints_secs} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.save_checkpoints_steps` {#RunConfig.save_checkpoints_steps} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.save_summary_steps` {#RunConfig.save_summary_steps} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.task_id` {#RunConfig.task_id} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.task_type` {#RunConfig.task_type} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.tf_config` {#RunConfig.tf_config} - - - - -- - - - -#### `tf.contrib.learn.RunConfig.tf_random_seed` {#RunConfig.tf_random_seed} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.evaluate.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.evaluate.md deleted file mode 100644 index d98fb5061c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.evaluate.md +++ /dev/null @@ -1,57 +0,0 @@ -### `tf.contrib.learn.evaluate(*args, **kwargs)` {#evaluate} - -Evaluate a model loaded from a checkpoint. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-02-15. -Instructions for updating: -graph_actions.py will be deleted. Use tf.train.* utilities instead. You can use learn/estimators/estimator.py as an example. - -Given `graph`, a directory to write summaries to (`output_dir`), a checkpoint -to restore variables from, and a `dict` of `Tensor`s to evaluate, run an eval -loop for `max_steps` steps, or until an exception (generally, an -end-of-input signal from a reader operation) is raised from running -`eval_dict`. - -In each step of evaluation, all tensors in the `eval_dict` are evaluated, and -every `log_every_steps` steps, they are logged. At the very end of evaluation, -a summary is evaluated (finding the summary ops using `Supervisor`'s logic) -and written to `output_dir`. - -##### Args: - - -* `graph`: A `Graph` to train. It is expected that this graph is not in use - elsewhere. -* `output_dir`: A string containing the directory to write a summary to. -* `checkpoint_path`: A string containing the path to a checkpoint to restore. - Can be `None` if the graph doesn't require loading any variables. -* `eval_dict`: A `dict` mapping string names to tensors to evaluate. It is - evaluated in every logging step. The result of the final evaluation is - returned. If `update_op` is None, then it's evaluated in every step. If - `max_steps` is `None`, this should depend on a reader that will raise an - end-of-input exception when the inputs are exhausted. -* `update_op`: A `Tensor` which is run in every step. -* `global_step_tensor`: A `Variable` containing the global step. If `None`, - one is extracted from the graph using the same logic as in `Supervisor`. - Used to place eval summaries on training curves. -* `supervisor_master`: The master string to use when preparing the session. -* `log_every_steps`: Integer. Output logs every `log_every_steps` evaluation - steps. The logs contain the `eval_dict` and timing information. -* `feed_fn`: A function that is called every iteration to produce a `feed_dict` - passed to `session.run` calls. Optional. -* `max_steps`: Integer. Evaluate `eval_dict` this many times. - -##### Returns: - - A tuple `(eval_results, global_step)`: - -* `eval_results`: A `dict` mapping `string` to numeric values (`int`, `float`) - that are the result of running eval_dict in the last step. `None` if no - eval steps were run. -* `global_step`: The global step this evaluation corresponds to. - -##### Raises: - - -* `ValueError`: if `output_dir` is empty. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.infer_real_valued_columns_from_input.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.infer_real_valued_columns_from_input.md deleted file mode 100644 index b9de559b20..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.infer_real_valued_columns_from_input.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.contrib.learn.infer_real_valued_columns_from_input(x)` {#infer_real_valued_columns_from_input} - -Creates `FeatureColumn` objects for inputs defined by input `x`. - -This interprets all inputs as dense, fixed-length float values. - -##### Args: - - -* `x`: Real-valued matrix of shape [n_samples, n_features...]. Can be - iterator that returns arrays of features. - -##### Returns: - - List of `FeatureColumn` objects. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.monitors.SummaryWriterCache.clear.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.monitors.SummaryWriterCache.clear.md deleted file mode 100644 index b77f11673d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.monitors.SummaryWriterCache.clear.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.contrib.learn.monitors.SummaryWriterCache.clear()` {#SummaryWriterCache.clear} - -Clear cached summary writers. Currently only used for unit tests. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.monitors.get_default_monitors.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.monitors.get_default_monitors.md deleted file mode 100644 index 050df4d6a6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.monitors.get_default_monitors.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.contrib.learn.monitors.get_default_monitors(loss_op=None, summary_op=None, save_summary_steps=100, output_dir=None, summary_writer=None)` {#get_default_monitors} - -Returns a default set of typically-used monitors. - -##### Args: - - -* `loss_op`: `Tensor`, the loss tensor. This will be printed using `PrintTensor` - at the default interval. -* `summary_op`: See `SummarySaver`. -* `save_summary_steps`: See `SummarySaver`. -* `output_dir`: See `SummarySaver`. -* `summary_writer`: See `SummarySaver`. - -##### Returns: - - `list` of monitors. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.read_batch_features.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.read_batch_features.md deleted file mode 100644 index ca012afd17..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.read_batch_features.md +++ /dev/null @@ -1,46 +0,0 @@ -### `tf.contrib.learn.read_batch_features(file_pattern, batch_size, features, reader, randomize_input=True, num_epochs=None, queue_capacity=10000, feature_queue_capacity=100, reader_num_threads=1, parse_fn=None, name=None)` {#read_batch_features} - -Adds operations to read, queue, batch and parse `Example` protos. - -Given file pattern (or list of files), will setup a queue for file names, -read `Example` proto using provided `reader`, use batch queue to create -batches of examples of size `batch_size` and parse example given `features` -specification. - -All queue runners are added to the queue runners collection, and may be -started via `start_queue_runners`. - -All ops are added to the default graph. - -##### Args: - - -* `file_pattern`: List of files or pattern of file paths containing - `Example` records. See `tf.gfile.Glob` for pattern rules. -* `batch_size`: An int or scalar `Tensor` specifying the batch size to use. -* `features`: A `dict` mapping feature keys to `FixedLenFeature` or - `VarLenFeature` values. -* `reader`: A function or class that returns an object with - `read` method, (filename tensor) -> (example tensor). -* `randomize_input`: Whether the input should be randomized. -* `num_epochs`: Integer specifying the number of times to read through the - dataset. If None, cycles through the dataset forever. NOTE - If specified, - creates a variable that must be initialized, so call - tf.local_variables_initializer() and run the op in a session. -* `queue_capacity`: Capacity for input queue. -* `feature_queue_capacity`: Capacity of the parsed features queue. Set this - value to a small number, for example 5 if the parsed features are large. -* `reader_num_threads`: The number of threads to read examples. -* `parse_fn`: Parsing function, takes `Example` Tensor returns parsed - representation. If `None`, no parsing is done. -* `name`: Name of resulting op. - -##### Returns: - - A dict of `Tensor` or `SparseTensor` objects for each in `features`. - -##### Raises: - - -* `ValueError`: for invalid inputs. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.run_feeds.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.run_feeds.md deleted file mode 100644 index bfbb588773..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.learn.run_feeds.md +++ /dev/null @@ -1,8 +0,0 @@ -### `tf.contrib.learn.run_feeds(*args, **kwargs)` {#run_feeds} - -See run_feeds_iter(). Returns a `list` instead of an iterator. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-02-15. -Instructions for updating: -graph_actions.py will be deleted. Use tf.train.* utilities instead. You can use learn/estimators/estimator.py as an example. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.legacy_seq2seq.one2many_rnn_seq2seq.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.legacy_seq2seq.one2many_rnn_seq2seq.md deleted file mode 100644 index c4c90cc2be..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.legacy_seq2seq.one2many_rnn_seq2seq.md +++ /dev/null @@ -1,51 +0,0 @@ -### `tf.contrib.legacy_seq2seq.one2many_rnn_seq2seq(encoder_inputs, decoder_inputs_dict, enc_cell, dec_cells_dict, num_encoder_symbols, num_decoder_symbols_dict, embedding_size, feed_previous=False, dtype=None, scope=None)` {#one2many_rnn_seq2seq} - -One-to-many RNN sequence-to-sequence model (multi-task). - -This is a multi-task sequence-to-sequence model with one encoder and multiple -decoders. Reference to multi-task sequence-to-sequence learning can be found -here: http://arxiv.org/abs/1511.06114 - -##### Args: - - -* `encoder_inputs`: A list of 1D int32 Tensors of shape [batch_size]. -* `decoder_inputs_dict`: A dictionany mapping decoder name (string) to - the corresponding decoder_inputs; each decoder_inputs is a list of 1D - Tensors of shape [batch_size]; num_decoders is defined as - len(decoder_inputs_dict). -* `enc_cell`: core_rnn_cell.RNNCell defining the encoder cell function and size. -* `dec_cells_dict`: A dictionary mapping encoder name (string) to an - instance of core_rnn_cell.RNNCell. -* `num_encoder_symbols`: Integer; number of symbols on the encoder side. -* `num_decoder_symbols_dict`: A dictionary mapping decoder name (string) to an - integer specifying number of symbols for the corresponding decoder; - len(num_decoder_symbols_dict) must be equal to num_decoders. -* `embedding_size`: Integer, the length of the embedding vector for each symbol. -* `feed_previous`: Boolean or scalar Boolean Tensor; if True, only the first of - decoder_inputs will be used (the "GO" symbol), and all other decoder - inputs will be taken from previous outputs (as in embedding_rnn_decoder). - If False, decoder_inputs are used as given (the standard decoder case). -* `dtype`: The dtype of the initial state for both the encoder and encoder - rnn cells (default: tf.float32). -* `scope`: VariableScope for the created subgraph; defaults to - "one2many_rnn_seq2seq" - -##### Returns: - - A tuple of the form (outputs_dict, state_dict), where: - -* `outputs_dict`: A mapping from decoder name (string) to a list of the same - length as decoder_inputs_dict[name]; each element in the list is a 2D - Tensors with shape [batch_size x num_decoder_symbol_list[name]] - containing the generated outputs. -* `state_dict`: A mapping from decoder name (string) to the final state of the - corresponding decoder RNN; it is a 2D Tensor of shape - [batch_size x cell.state_size]. - -##### Raises: - - -* `TypeError`: if enc_cell or any of the dec_cells are not instances of RNNCell. -* `ValueError`: if len(dec_cells) != len(decoder_inputs_dict). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.losses.mean_squared_error.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.losses.mean_squared_error.md deleted file mode 100644 index 550dcd9eac..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.losses.mean_squared_error.md +++ /dev/null @@ -1,35 +0,0 @@ -### `tf.contrib.losses.mean_squared_error(*args, **kwargs)` {#mean_squared_error} - -Adds a Sum-of-Squares loss to the training procedure. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.mean_squared_error instead. - -`weights` acts as a coefficient for the loss. If a scalar is provided, then -the loss is simply scaled by the given value. If `weights` is a tensor of size -[batch_size], then the total loss for each sample of the batch is rescaled -by the corresponding element in the `weights` vector. If the shape of -`weights` matches the shape of `predictions`, then the loss of each -measurable element of `predictions` is scaled by the corresponding value of -`weights`. - -##### Args: - - -* `predictions`: The predicted outputs. -* `labels`: The ground truth output tensor, same dimensions as 'predictions'. -* `weights`: Coefficients for the loss a scalar, a tensor of shape - [batch_size] or a tensor whose shape matches `predictions`. -* `scope`: The scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the loss value. - -##### Raises: - - -* `ValueError`: If the shape of `predictions` doesn't match that of `labels` or - if the shape of `weights` is invalid. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.set_union.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.set_union.md deleted file mode 100644 index 1bc3ec99c9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.set_union.md +++ /dev/null @@ -1,63 +0,0 @@ -### `tf.contrib.metrics.set_union(a, b, validate_indices=True)` {#set_union} - -Compute set union of elements in last dimension of `a` and `b`. - -All but the last dimension of `a` and `b` must match. - -Example: - -```python - a = [ - [ - [ - [1, 2], - [3], - ], - [ - [4], - [5, 6], - ], - ], - ] - b = [ - [ - [ - [1, 3], - [2], - ], - [ - [4, 5], - [5, 6, 7, 8], - ], - ], - ] - set_union(a, b) = [ - [ - [ - [1, 2, 3], - [2, 3], - ], - [ - [4, 5], - [5, 6, 7, 8], - ], - ], - ] -``` - -##### Args: - - -* `a`: `Tensor` or `SparseTensor` of the same type as `b`. If sparse, indices - must be sorted in row-major order. -* `b`: `Tensor` or `SparseTensor` of the same type as `a`. If sparse, indices - must be sorted in row-major order. -* `validate_indices`: Whether to validate the order and range of sparse indices - in `a` and `b`. - -##### Returns: - - A `SparseTensor` whose shape is the same rank as `a` and `b`, and all but - the last dimension the same. Elements along the last dimension contain the - unions. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_precision_at_thresholds.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_precision_at_thresholds.md deleted file mode 100644 index 6c0a5f9220..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_precision_at_thresholds.md +++ /dev/null @@ -1,50 +0,0 @@ -### `tf.contrib.metrics.streaming_precision_at_thresholds(predictions, labels, thresholds, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_precision_at_thresholds} - -Computes precision values for different `thresholds` on `predictions`. - -The `streaming_precision_at_thresholds` function creates four local variables, -`true_positives`, `true_negatives`, `false_positives` and `false_negatives` -for various values of thresholds. `precision[i]` is defined as the total -weight of values in `predictions` above `thresholds[i]` whose corresponding -entry in `labels` is `True`, divided by the total weight of values in -`predictions` above `thresholds[i]` (`true_positives[i] / (true_positives[i] + -false_positives[i])`). - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`precision`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A floating point `Tensor` of arbitrary shape and whose values - are in the range `[0, 1]`. -* `labels`: A `bool` `Tensor` whose shape matches `predictions`. -* `thresholds`: A python list or tuple of float thresholds in `[0, 1]`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that `auc` should be - added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `precision`: A float `Tensor` of shape `[len(thresholds)]`. -* `update_op`: An operation that increments the `true_positives`, - `true_negatives`, `false_positives` and `false_negatives` variables that - are used in the computation of `precision`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_recall_at_k.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_recall_at_k.md deleted file mode 100644 index 1ddafd7da6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_recall_at_k.md +++ /dev/null @@ -1,55 +0,0 @@ -### `tf.contrib.metrics.streaming_recall_at_k(*args, **kwargs)` {#streaming_recall_at_k} - -Computes the recall@k of the predictions with respect to dense labels. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-11-08. -Instructions for updating: -Please use `streaming_sparse_recall_at_k`, and reshape labels from [batch_size] to [batch_size, 1]. - -The `streaming_recall_at_k` function creates two local variables, `total` and -`count`, that are used to compute the recall@k frequency. This frequency is -ultimately returned as `recall_at_`: an idempotent operation that simply -divides `total` by `count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`recall_at_`. Internally, an `in_top_k` operation computes a `Tensor` with -shape [batch_size] whose elements indicate whether or not the corresponding -label is in the top `k` `predictions`. Then `update_op` increments `total` -with the reduced sum of `weights` where `in_top_k` is `True`, and it -increments `count` with the reduced sum of `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A float `Tensor` of dimension [batch_size, num_classes]. -* `labels`: A `Tensor` of dimension [batch_size] whose type is in `int32`, - `int64`. -* `k`: The number of top elements to look at for computing recall. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that `recall_at_k` - should be added to. -* `updates_collections`: An optional list of collections `update_op` should be - added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `recall_at_k`: A `Tensor` representing the recall@k, the fraction of labels - which fall into the top `k` predictions. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `recall_at_k`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_sparse_precision_at_top_k.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_sparse_precision_at_top_k.md deleted file mode 100644 index bff835747e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_sparse_precision_at_top_k.md +++ /dev/null @@ -1,75 +0,0 @@ -### `tf.contrib.metrics.streaming_sparse_precision_at_top_k(top_k_predictions, labels, class_id=None, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_sparse_precision_at_top_k} - -Computes precision@k of top-k predictions with respect to sparse labels. - -If `class_id` is not specified, we calculate precision as the ratio of - true positives (i.e., correct predictions, items in `top_k_predictions` - that are found in the corresponding row in `labels`) to positives (all - `top_k_predictions`). -If `class_id` is specified, we calculate precision by considering only the - rows in the batch for which `class_id` is in the top `k` highest - `predictions`, and computing the fraction of them for which `class_id` is - in the corresponding row in `labels`. - -We expect precision to decrease as `k` increases. - -`streaming_sparse_precision_at_top_k` creates two local variables, -`true_positive_at_k` and `false_positive_at_k`, that are used to compute -the precision@k frequency. This frequency is ultimately returned as -`precision_at_k`: an idempotent operation that simply divides -`true_positive_at_k` by total (`true_positive_at_k` + `false_positive_at_k`). - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`precision_at_k`. Internally, set operations applied to `top_k_predictions` -and `labels` calculate the true positives and false positives weighted by -`weights`. Then `update_op` increments `true_positive_at_k` and -`false_positive_at_k` using these values. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `top_k_predictions`: Integer `Tensor` with shape [D1, ... DN, k] where - N >= 1. Commonly, N=1 and top_k_predictions has shape [batch size, k]. - The final dimension contains the indices of top-k labels. [D1, ... DN] - must match `labels`. -* `labels`: `int64` `Tensor` or `SparseTensor` with shape - [D1, ... DN, num_labels], where N >= 1 and num_labels is the number of - target classes for the associated prediction. Commonly, N=1 and `labels` - has shape [batch_size, num_labels]. [D1, ... DN] must match - `top_k_predictions`. Values should be in range [0, num_classes), where - num_classes is the last dimension of `predictions`. Values outside this - range are ignored. -* `class_id`: Integer class ID for which we want binary metrics. This should be - in range [0, num_classes), where num_classes is the last dimension of - `predictions`. If `class_id` is outside this range, the method returns - NAN. -* `weights`: `Tensor` whose rank is either 0, or n-1, where n is the rank of - `labels`. If the latter, it must be broadcastable to `labels` (i.e., all - dimensions must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that values should - be added to. -* `updates_collections`: An optional list of collections that updates should - be added to. -* `name`: Name of new update operation, and namespace for other dependent ops. - -##### Returns: - - -* `precision`: Scalar `float64` `Tensor` with the value of `true_positives` - divided by the sum of `true_positives` and `false_positives`. -* `update_op`: `Operation` that increments `true_positives` and - `false_positives` variables appropriately, and whose value matches - `precision`. - -##### Raises: - - -* `ValueError`: If `weights` is not `None` and its shape doesn't match - `predictions`, or if either `metrics_collections` or `updates_collections` - are not a list or tuple. -* `ValueError`: If `top_k_predictions` has rank < 2. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_true_positives.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_true_positives.md deleted file mode 100644 index a022639c94..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.metrics.streaming_true_positives.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.contrib.metrics.streaming_true_positives(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_true_positives} - -Sum the weights of true_positives. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: The predicted values, a `Tensor` of arbitrary dimensions. Will - be cast to `bool`. -* `labels`: The ground truth values, a `Tensor` whose dimensions must match - `predictions`. Will be cast to `bool`. -* `weights`: Optional `Tensor` whose rank is either 0, or the same rank as - `labels`, and must be broadcastable to `labels` (i.e., all dimensions - must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `value_tensor`: A `Tensor` representing the current value of the metric. -* `update_op`: An operation that accumulates the error from a batch of data. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.rnn.DeviceWrapper.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.rnn.DeviceWrapper.md deleted file mode 100644 index 7375b99f80..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.rnn.DeviceWrapper.md +++ /dev/null @@ -1,62 +0,0 @@ -Operator that ensures an RNNCell runs on a particular device. -- - - - -#### `tf.contrib.rnn.DeviceWrapper.__call__(inputs, state, scope=None)` {#DeviceWrapper.__call__} - -Run the cell on specified device. - - -- - - - -#### `tf.contrib.rnn.DeviceWrapper.__init__(cell, device)` {#DeviceWrapper.__init__} - -Construct a `DeviceWrapper` for `cell` with device `device`. - -Ensures the wrapped `cell` is called with `tf.device(device)`. - -##### Args: - - -* `cell`: An instance of `RNNCell`. -* `device`: A device string or function, for passing to `tf.device`. - - -- - - - -#### `tf.contrib.rnn.DeviceWrapper.output_size` {#DeviceWrapper.output_size} - -Integer or TensorShape: size of outputs produced by this cell. - - -- - - - -#### `tf.contrib.rnn.DeviceWrapper.state_size` {#DeviceWrapper.state_size} - -size(s) of state(s) used by this cell. - -It can be represented by an Integer, a TensorShape or a tuple of Integers -or TensorShapes. - - -- - - - -#### `tf.contrib.rnn.DeviceWrapper.zero_state(batch_size, dtype)` {#DeviceWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.rnn.LSTMBlockCell.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.rnn.LSTMBlockCell.md deleted file mode 100644 index 467baa90cb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.rnn.LSTMBlockCell.md +++ /dev/null @@ -1,67 +0,0 @@ -Basic LSTM recurrent network cell. - -The implementation is based on: http://arxiv.org/abs/1409.2329. - -We add `forget_bias` (default: 1) to the biases of the forget gate in order to -reduce the scale of forgetting in the beginning of the training. - -Unlike `core_rnn_cell.LSTMCell`, this is a monolithic op and should be much -faster. The weight and bias matrixes should be compatible as long as the -variable scope matches. -- - - - -#### `tf.contrib.rnn.LSTMBlockCell.__call__(x, states_prev, scope=None)` {#LSTMBlockCell.__call__} - -Long short-term memory cell (LSTM). - - -- - - - -#### `tf.contrib.rnn.LSTMBlockCell.__init__(num_units, forget_bias=1.0, use_peephole=False)` {#LSTMBlockCell.__init__} - -Initialize the basic LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell. -* `forget_bias`: float, The bias added to forget gates (see above). -* `use_peephole`: Whether to use peephole connections or not. - - -- - - - -#### `tf.contrib.rnn.LSTMBlockCell.output_size` {#LSTMBlockCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.LSTMBlockCell.state_size` {#LSTMBlockCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.LSTMBlockCell.zero_state(batch_size, dtype)` {#LSTMBlockCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.rnn.TimeFreqLSTMCell.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.rnn.TimeFreqLSTMCell.md deleted file mode 100644 index 575d927cfe..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.rnn.TimeFreqLSTMCell.md +++ /dev/null @@ -1,100 +0,0 @@ -Time-Frequency Long short-term memory unit (LSTM) recurrent network cell. - -This implementation is based on: - - Tara N. Sainath and Bo Li - "Modeling Time-Frequency Patterns with LSTM vs. Convolutional Architectures - for LVCSR Tasks." submitted to INTERSPEECH, 2016. - -It uses peep-hole connections and optional cell clipping. -- - - - -#### `tf.contrib.rnn.TimeFreqLSTMCell.__call__(inputs, state, scope=None)` {#TimeFreqLSTMCell.__call__} - -Run one step of LSTM. - -##### Args: - - -* `inputs`: input Tensor, 2D, batch x num_units. -* `state`: state Tensor, 2D, batch x state_size. -* `scope`: VariableScope for the created subgraph; defaults to - "TimeFreqLSTMCell". - -##### Returns: - - A tuple containing: - - A 2D, batch x output_dim, Tensor representing the output of the LSTM - after reading "inputs" when previous state was "state". - Here output_dim is num_units. - - A 2D, batch x state_size, Tensor representing the new state of LSTM - after reading "inputs" when previous state was "state". - -##### Raises: - - -* `ValueError`: if an input_size was specified and the provided inputs have - a different dimension. - - -- - - - -#### `tf.contrib.rnn.TimeFreqLSTMCell.__init__(num_units, use_peepholes=False, cell_clip=None, initializer=None, num_unit_shards=1, forget_bias=1.0, feature_size=None, frequency_skip=None)` {#TimeFreqLSTMCell.__init__} - -Initialize the parameters for an LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell -* `use_peepholes`: bool, set True to enable diagonal/peephole connections. -* `cell_clip`: (optional) A float value, if provided the cell state is clipped - by this value prior to the cell output activation. -* `initializer`: (optional) The initializer to use for the weight and - projection matrices. -* `num_unit_shards`: int, How to split the weight matrix. If >1, the weight - matrix is stored across num_unit_shards. -* `forget_bias`: float, Biases of the forget gate are initialized by default - to 1 in order to reduce the scale of forgetting at the beginning - of the training. -* `feature_size`: int, The size of the input feature the LSTM spans over. -* `frequency_skip`: int, The amount the LSTM filter is shifted by in - frequency. - - -- - - - -#### `tf.contrib.rnn.TimeFreqLSTMCell.output_size` {#TimeFreqLSTMCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.TimeFreqLSTMCell.state_size` {#TimeFreqLSTMCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.TimeFreqLSTMCell.zero_state(batch_size, dtype)` {#TimeFreqLSTMCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.training.NextQueuedSequenceBatch.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.training.NextQueuedSequenceBatch.md deleted file mode 100644 index fa1095c17b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.training.NextQueuedSequenceBatch.md +++ /dev/null @@ -1,265 +0,0 @@ -NextQueuedSequenceBatch stores deferred SequenceQueueingStateSaver data. - -This class is instantiated by `SequenceQueueingStateSaver` and is accessible -via its `next_batch` property. -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.__init__(state_saver)` {#NextQueuedSequenceBatch.__init__} - - - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.batch_size` {#NextQueuedSequenceBatch.batch_size} - -The batch_size of the given batch. - -Usually, this is the batch_size requested when initializing the SQSS, but -if allow_small_batch=True this will become smaller when inputs are -exhausted. - -##### Returns: - - A scalar integer tensor, the batch_size - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.context` {#NextQueuedSequenceBatch.context} - -A dict mapping keys of `input_context` to batched context. - -##### Returns: - - A dict mapping keys of `input_context` to tensors. - If we had at input: - - ```python - context["name"].get_shape() == [d1, d2, ...] - ``` - - then for this property: - - ```python - context["name"].get_shape() == [batch_size, d1, d2, ...] - ``` - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.insertion_index` {#NextQueuedSequenceBatch.insertion_index} - -The insertion indices of the examples (when they were first added). - -These indices start with the value -2**63 and increase with every -call to the prefetch op. Each whole example gets its own insertion -index, and this is used to prioritize the example so that its truncated -segments appear in adjacent iterations, even if new examples are inserted -by the prefetch op between iterations. - -##### Returns: - - An int64 vector of length `batch_size`, the insertion indices. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.key` {#NextQueuedSequenceBatch.key} - -The key names of the given truncated unrolled examples. - -The format of the key is: - -```python -"%05d_of_%05d:%s" % (sequence, sequence_count, original_key) -``` - -where `original_key` is the unique key read in by the prefetcher. - -##### Returns: - - A string vector of length `batch_size`, the keys. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.length` {#NextQueuedSequenceBatch.length} - -The lengths of the given truncated unrolled examples. - -For initial iterations, for which `sequence * num_unroll < length`, -this number is `num_unroll`. For the remainder, -this number is between `0` and `num_unroll`. - -##### Returns: - - An integer vector of length `batch_size`, the lengths. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.next_key` {#NextQueuedSequenceBatch.next_key} - -The key names of the next (in iteration) truncated unrolled examples. - -The format of the key is: - -```python -"%05d_of_%05d:%s" % (sequence + 1, sequence_count, original_key) -``` - -if `sequence + 1 < sequence_count`, otherwise: - -```python -"STOP:%s" % original_key -``` - -where `original_key` is the unique key read in by the prefetcher. - -##### Returns: - - A string vector of length `batch_size`, the keys. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.save_state(state_name, value, name=None)` {#NextQueuedSequenceBatch.save_state} - -Returns an op to save the current batch of state `state_name`. - -##### Args: - - -* `state_name`: string, matches a key provided in `initial_states`. -* `value`: A `Tensor`. - Its type must match that of `initial_states[state_name].dtype`. - If we had at input: - - ```python - initial_states[state_name].get_shape() == [d1, d2, ...] - ``` - - then the shape of `value` must match: - - ```python - tf.shape(value) == [batch_size, d1, d2, ...] - ``` - - -* `name`: string (optional). The name scope for newly created ops. - -##### Returns: - - A control flow op that stores the new state of each entry into - the state saver. This op must be run for every iteration that - accesses data from the state saver (otherwise the state saver - will never progress through its states and run out of capacity). - -##### Raises: - - -* `KeyError`: if `state_name` does not match any of the initial states - declared in `initial_states`. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.sequence` {#NextQueuedSequenceBatch.sequence} - -An int32 vector, length `batch_size`: the sequence index of each entry. - -When an input is split up, the sequence values -``` -0, 1, ..., sequence_count - 1 -``` -are assigned to each split. - -##### Returns: - - An int32 vector `Tensor`. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.sequence_count` {#NextQueuedSequenceBatch.sequence_count} - -An int32 vector, length `batch_size`: the sequence count of each entry. - -When an input is split up, the number of splits is equal to: -`padded_length / num_unroll`. This is the sequence_count. - -##### Returns: - - An int32 vector `Tensor`. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.sequences` {#NextQueuedSequenceBatch.sequences} - -A dict mapping keys of `input_sequences` to split and rebatched data. - -##### Returns: - - A dict mapping keys of `input_sequences` to tensors. - If we had at input: - - ```python - sequences["name"].get_shape() == [None, d1, d2, ...] - ``` - - where `None` meant the sequence time was dynamic, then for this property: - - ```python - sequences["name"].get_shape() == [batch_size, num_unroll, d1, d2, ...]. - ``` - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.state(state_name)` {#NextQueuedSequenceBatch.state} - -Returns batched state tensors. - -##### Args: - - -* `state_name`: string, matches a key provided in `initial_states`. - -##### Returns: - - A `Tensor`: a batched set of states, either initial states (if this is - the first run of the given example), or a value as stored during - a previous iteration via `save_state` control flow. - Its type is the same as `initial_states["state_name"].dtype`. - If we had at input: - - ```python - initial_states[state_name].get_shape() == [d1, d2, ...], - ``` - - then - - ```python - state(state_name).get_shape() == [batch_size, d1, d2, ...] - ``` - -##### Raises: - - -* `KeyError`: if `state_name` does not match any of the initial states - declared in `initial_states`. - - -- - - - -#### `tf.contrib.training.NextQueuedSequenceBatch.total_length` {#NextQueuedSequenceBatch.total_length} - -The lengths of the original (non-truncated) unrolled examples. - -##### Returns: - - An integer vector of length `batch_size`, the total lengths. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.training.batch_sequences_with_states.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.training.batch_sequences_with_states.md deleted file mode 100644 index 63c3a47229..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.training.batch_sequences_with_states.md +++ /dev/null @@ -1,167 +0,0 @@ -### `tf.contrib.training.batch_sequences_with_states(input_key, input_sequences, input_context, input_length, initial_states, num_unroll, batch_size, num_threads=3, capacity=1000, allow_small_batch=True, pad=True, make_keys_unique=False, make_keys_unique_seed=None, name=None)` {#batch_sequences_with_states} - -Creates batches of segments of sequential input. - -This method creates a `SequenceQueueingStateSaver` (SQSS) and adds it to -the queuerunners. It returns a `NextQueuedSequenceBatch`. - -It accepts one example at a time identified by a unique `input_key`. -`input_sequence` is a dict with values that are tensors with time as first -dimension. This time dimension must be the same across those tensors of an -example. It can vary across examples. Although it always has to be a multiple -of `num_unroll`. Hence, padding may be necessary and it is turned on by -default by `pad=True`. - -`input_length` is a Tensor scalar or an int recording the time dimension prior -to padding. It should be between 0 and the time dimension. One reason we want -to keep track of it is so that we can take it into consideration when -computing the loss. If `pad=True` then `input_length` can be `None` and will -be inferred. - -This methods segments `input_sequence` into segments of length `num_unroll`. -It batches input sequences from `batch_size` many examples. These mini-batches -are available through the `sequence` property of the output. Moreover, for -each entry in the batch we can access its original `input_key` in `key` and -its input length in `total_length`. `length` records within this segment how -many non-padded time steps there are. - -Static features of an example that do not vary across time can be part of the -`input_context`, a dict with Tensor values. This method copies the context for -each segment and makes it available in the `context` of the output. - -This method can maintain and update a state for each example. It accepts some -initial_states as a dict with Tensor values. The first mini-batch an example -is contained has initial_states as entry of the `state`. If save_state is -called then the next segment will have the updated entry of the `state`. -See `NextQueuedSequenceBatch` for a complete list of properties and methods. - -Example usage: - -```python -batch_size = 32 -num_unroll = 20 -num_enqueue_threads = 3 -lstm_size = 8 -cell = tf.contrib.rnn.BasicLSTMCell(num_units=lstm_size) - -key, sequences, context = my_parser(raw_data) -initial_state_values = tf.zeros((state_size,), dtype=tf.float32) -initial_states = {"lstm_state": initial_state_values} -batch = tf.batch_sequences_with_states( - input_key=key, - input_sequences=sequences, - input_context=context, - initial_states=initial_states, - num_unroll=num_unroll, - batch_size=batch_size, - num_threads=num_enqueue_threads, - capacity=batch_size * num_enqueue_threads * 2) - -inputs = batch.sequences["input"] -context_label = batch.context["label"] - -inputs_by_time = tf.split(value=inputs, num_or_size_splits=num_unroll, axis=1) -assert len(inputs_by_time) == num_unroll - -lstm_output, _ = tf.contrib.rnn.static_state_saving_rnn( - cell, - inputs_by_time, - state_saver=batch, - state_name="lstm_state") - -# Start a prefetcher in the background -sess = tf.Session() - -tf.train.start_queue_runners(sess=session) - -while True: - # Step through batches, perform training or inference... - session.run([lstm_output]) -``` - -##### Args: - - -* `input_key`: A string scalar `Tensor`, the **unique** key for the given - input example. This is used to keep track of the split minibatch elements - of this input. Batched keys of the current iteration are made - accessible via the `key` property. The shape of `input_key` (scalar) must - be fully specified. Consider setting `make_keys_unique` to True when - iterating over the same input multiple times. - - **Note**: if `make_keys_unique=False` then `input_key`s must be unique. - -* `input_sequences`: A dict mapping string names to `Tensor` values. The values - must all have matching first dimension, called `value_length`. They may - vary from input to input. The remainder of the shape (other than the first - dimension) must be fully specified. - The `SequenceQueueingStateSaver` will split these tensors along - this first dimension into minibatch elements of dimension `num_unrolled`. - Batched and segmented sequences of the current iteration are made - accessible via the `sequences` property. - - **Note**: if `pad=False`, then `value_length` must always be a multiple - of `num_unroll`. - -* `input_context`: A dict mapping string names to `Tensor` values. The values - are treated as "global" across all time splits of the given input example, - and will be copied across for all minibatch elements accordingly. - Batched and copied context of the current iteration are made - accessible via the `context` property. - - **Note**: All input_context values must have fully defined shapes. - -* `input_length`: None or an int32 scalar `Tensor`, the length of the sequence - prior to padding. If `input_length=None` and `pad=True` then the length - will be inferred and will be equal to `value_length`. If `pad=False` then - `input_length` cannot be `None`: `input_length` must be specified. Its - shape of `input_length` (scalar) must be fully specified. Its value may be - at most `value_length` for any given input (see above for the definition - of `value_length`). Batched and total lengths of the current iteration are - made accessible via the `length` and `total_length` properties. -* `initial_states`: A dict mapping string state names to multi-dimensional - values (e.g. constants or tensors). This input defines the set of - states that will be kept track of during computing iterations, and - which can be accessed via the `state` and `save_state` methods. - - **Note**: All initial_state values must have fully defined shapes. - -* `num_unroll`: Python integer, how many time steps to unroll at a time. - The input sequences of length k are then split into k / num_unroll many - segments. -* `batch_size`: int or int32 scalar `Tensor`, how large minibatches should - be when accessing the `state()` method and `context`, `sequences`, etc, - properties. -* `num_threads`: The int number of threads enqueuing input examples into a - queue. -* `capacity`: The max capacity of the queue in number of examples. Needs to be - at least `batch_size`. Defaults to 1000. When iterating over the same - input example multiple times reusing their keys the `capacity` must be - smaller than the number of examples. -* `allow_small_batch`: If true, the queue will return smaller batches when - there aren't enough input examples to fill a whole batch and the end of - the input has been reached. -* `pad`: If `True`, `input_sequences` will be padded to multiple of - `num_unroll`. In that case `input_length` may be `None` and is assumed to - be the length of first dimension of values in `input_sequences` - (i.e. `value_length`). -* `make_keys_unique`: Whether to append a random integer to the `input_key` in - an effort to make it unique. The seed can be set via - `make_keys_unique_seed`. -* `make_keys_unique_seed`: If `make_keys_unique=True` this fixes the seed with - which a random postfix is generated. -* `name`: An op name string (optional). - -##### Returns: - - A NextQueuedSequenceBatch with segmented and batched inputs and their - states. - -##### Raises: - - -* `TypeError`: if any of the inputs is not an expected type. -* `ValueError`: if any of the input values is inconsistent, e.g. if - not enough shape information is available from inputs to build - the state saver. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.util.stripped_op_list_for_graph.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.util.stripped_op_list_for_graph.md deleted file mode 100644 index 23bfb28542..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.contrib.util.stripped_op_list_for_graph.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.contrib.util.stripped_op_list_for_graph(graph_def)` {#stripped_op_list_for_graph} - -Collect the stripped OpDefs for ops used by a graph. - -This function computes the `stripped_op_list` field of `MetaGraphDef` and -similar protos. The result can be communicated from the producer to the -consumer, which can then use the C++ function -`RemoveNewDefaultAttrsFromGraphDef` to improve forwards compatibility. - -##### Args: - - -* `graph_def`: A `GraphDef` proto, as from `graph.as_graph_def()`. - -##### Returns: - - An `OpList` of ops used by the graph. - -##### Raises: - - -* `ValueError`: If an unregistered op is used. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.decode_base64.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.decode_base64.md deleted file mode 100644 index 0d490e313b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.decode_base64.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.decode_base64(input, name=None)` {#decode_base64} - -Decode web-safe base64-encoded strings. - -Input may or may not have padding at the end. See EncodeBase64 for padding. -Web-safe means that input must use - and _ instead of + and /. - -##### Args: - - -* `input`: A `Tensor` of type `string`. Base64 strings to decode. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. Decoded strings. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.errors.FailedPreconditionError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.errors.FailedPreconditionError.md deleted file mode 100644 index 1cbd338bf9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.errors.FailedPreconditionError.md +++ /dev/null @@ -1,13 +0,0 @@ -Operation was rejected because the system is not in a state to execute it. - -This exception is most commonly raised when running an operation -that reads a [`tf.Variable`](../../api_docs/python/state_ops.md#Variable) -before it has been initialized. - -- - - - -#### `tf.errors.FailedPreconditionError.__init__(node_def, op, message)` {#FailedPreconditionError.__init__} - -Creates a `FailedPreconditionError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.extract_image_patches.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.extract_image_patches.md deleted file mode 100644 index 9732ad8de4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.extract_image_patches.md +++ /dev/null @@ -1,40 +0,0 @@ -### `tf.extract_image_patches(images, ksizes, strides, rates, padding, name=None)` {#extract_image_patches} - -Extract `patches` from `images` and put them in the "depth" output dimension. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. - 4-D Tensor with shape `[batch, in_rows, in_cols, depth]`. -* `ksizes`: A list of `ints` that has length `>= 4`. - The size of the sliding window for each dimension of `images`. -* `strides`: A list of `ints` that has length `>= 4`. - 1-D of length 4. How far the centers of two consecutive patches are in - the images. Must be: `[1, stride_rows, stride_cols, 1]`. -* `rates`: A list of `ints` that has length `>= 4`. - 1-D of length 4. Must be: `[1, rate_rows, rate_cols, 1]`. This is the - input stride, specifying how far two consecutive patch samples are in the - input. Equivalent to extracting patches with - `patch_sizes_eff = patch_sizes + (patch_sizes - 1) * (rates - 1)`, followed by - subsampling them spatially by a factor of `rates`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. - - We specify the size-related attributes as: - - ```python - ksizes = [1, ksize_rows, ksize_cols, 1] - strides = [1, strides_rows, strides_cols, 1] - rates = [1, rates_rows, rates_cols, 1] - ``` - -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `images`. - 4-D Tensor with shape `[batch, out_rows, out_cols, ksize_rows * - ksize_cols * depth]` containing image patches with size - `ksize_rows x ksize_cols x depth` vectorized in the "depth" dimension. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.fixed_size_partitioner.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.fixed_size_partitioner.md deleted file mode 100644 index fdeea7f207..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.fixed_size_partitioner.md +++ /dev/null @@ -1,15 +0,0 @@ -### `tf.fixed_size_partitioner(num_shards, axis=0)` {#fixed_size_partitioner} - -Partitioner to specify a fixed number of shards along given axis. - -##### Args: - - -* `num_shards`: `int`, number of shards to partition variable. -* `axis`: `int`, axis to partition on. - -##### Returns: - - A partition function usable as the `partitioner` argument to - `variable_scope`, `get_variable`, and `get_partitioned_variable_list`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.floor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.floor.md deleted file mode 100644 index 4aadcff6ef..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.floor.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.floor(x, name=None)` {#floor} - -Returns element-wise largest integer not greater than x. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.greater.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.greater.md deleted file mode 100644 index 99b34aaca4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.greater.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.greater(x, y, name=None)` {#greater} - -Returns the truth value of (x > y) element-wise. - -*NOTE*: `Greater` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.histogram_fixed_width.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.histogram_fixed_width.md deleted file mode 100644 index 3334d6d09d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.histogram_fixed_width.md +++ /dev/null @@ -1,38 +0,0 @@ -### `tf.histogram_fixed_width(values, value_range, nbins=100, dtype=tf.int32, name=None)` {#histogram_fixed_width} - -Return histogram of values. - -Given the tensor `values`, this operation returns a rank 1 histogram counting -the number of entries in `values` that fell into every bin. The bins are -equal width and determined by the arguments `value_range` and `nbins`. - -##### Args: - - -* `values`: Numeric `Tensor`. -* `value_range`: Shape [2] `Tensor`. new_values <= value_range[0] will be - mapped to hist[0], values >= value_range[1] will be mapped to hist[-1]. - Must be same dtype as new_values. -* `nbins`: Scalar `int32 Tensor`. Number of histogram bins. -* `dtype`: dtype for returned histogram. -* `name`: A name for this operation (defaults to 'histogram_fixed_width'). - -##### Returns: - - A 1-D `Tensor` holding histogram of values. - - -* `Examples`: - -```python -# Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf) -nbins = 5 -value_range = [0.0, 5.0] -new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15] - -with tf.default_session() as sess: - hist = tf.histogram_fixed_width(new_values, value_range, nbins=5) - variables.global_variables_initializer().run() - sess.run(hist) => [2, 1, 1, 0, 2] -``` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.image.hsv_to_rgb.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.image.hsv_to_rgb.md deleted file mode 100644 index 9bb9c51198..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.image.hsv_to_rgb.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.image.hsv_to_rgb(images, name=None)` {#hsv_to_rgb} - -Convert one or more images from HSV to RGB. - -Outputs a tensor of the same shape as the `images` tensor, containing the RGB -value of the pixels. The output is only well defined if the value in `images` -are in `[0,1]`. - -See `rgb_to_hsv` for a description of the HSV encoding. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `float32`, `float64`. - 1-D or higher rank. HSV data to convert. Last dimension must be size 3. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `images`. `images` converted to RGB. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.initialize_variables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.initialize_variables.md deleted file mode 100644 index 3ab51c4b3c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.initialize_variables.md +++ /dev/null @@ -1,8 +0,0 @@ -### `tf.initialize_variables(*args, **kwargs)` {#initialize_variables} - -See `tf.variables_initializer`. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-02. -Instructions for updating: -Use `tf.variables_initializer` instead. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.log.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.log.md deleted file mode 100644 index a6c085b5cf..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.log.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.log(x, name=None)` {#log} - -Computes natural logarithm of x element-wise. - -I.e., \\(y = \log_e x\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.conv2d_backprop_input.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.conv2d_backprop_input.md deleted file mode 100644 index dc223e8ec1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.conv2d_backprop_input.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.nn.conv2d_backprop_input(input_sizes, filter, out_backprop, strides, padding, use_cudnn_on_gpu=None, data_format=None, name=None)` {#conv2d_backprop_input} - -Computes the gradients of convolution with respect to the input. - -##### Args: - - -* `input_sizes`: A `Tensor` of type `int32`. - An integer vector representing the shape of `input`, - where `input` is a 4-D `[batch, height, width, channels]` tensor. -* `filter`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. - 4-D with shape - `[filter_height, filter_width, in_channels, out_channels]`. -* `out_backprop`: A `Tensor`. Must have the same type as `filter`. - 4-D with shape `[batch, out_height, out_width, out_channels]`. - Gradients w.r.t. the output of the convolution. -* `strides`: A list of `ints`. - The stride of the sliding window for each dimension of the input - of the convolution. Must be in the same order as the dimension specified with - format. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `use_cudnn_on_gpu`: An optional `bool`. Defaults to `True`. -* `data_format`: An optional `string` from: `"NHWC", "NCHW"`. Defaults to `"NHWC"`. - Specify the data format of the input and output data. With the - default format "NHWC", the data is stored in the order of: - [batch, in_height, in_width, in_channels]. - Alternatively, the format could be "NCHW", the data storage order of: - [batch, in_channels, in_height, in_width]. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `filter`. - 4-D with shape `[batch, in_height, in_width, in_channels]`. Gradient - w.r.t. the input of the convolution. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.conv2d_transpose.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.conv2d_transpose.md deleted file mode 100644 index b5a2ed50de..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.conv2d_transpose.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.nn.conv2d_transpose(value, filter, output_shape, strides, padding='SAME', data_format='NHWC', name=None)` {#conv2d_transpose} - -The transpose of `conv2d`. - -This operation is sometimes called "deconvolution" after [Deconvolutional -Networks](http://www.matthewzeiler.com/pubs/cvpr2010/cvpr2010.pdf), but is -actually the transpose (gradient) of `conv2d` rather than an actual -deconvolution. - -##### Args: - - -* `value`: A 4-D `Tensor` of type `float` and shape - `[batch, height, width, in_channels]` for `NHWC` data format or - `[batch, in_channels, height, width]` for `NCHW` data format. -* `filter`: A 4-D `Tensor` with the same type as `value` and shape - `[height, width, output_channels, in_channels]`. `filter`'s - `in_channels` dimension must match that of `value`. -* `output_shape`: A 1-D `Tensor` representing the output shape of the - deconvolution op. -* `strides`: A list of ints. The stride of the sliding window for each - dimension of the input tensor. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. - See the [comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `data_format`: A string. 'NHWC' and 'NCHW' are supported. -* `name`: Optional name for the returned tensor. - -##### Returns: - - A `Tensor` with the same type as `value`. - -##### Raises: - - -* `ValueError`: If input/output depth does not match `filter`'s shape, or if - padding is other than `'VALID'` or `'SAME'`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.ctc_beam_search_decoder.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.ctc_beam_search_decoder.md deleted file mode 100644 index e02a076cb3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.ctc_beam_search_decoder.md +++ /dev/null @@ -1,42 +0,0 @@ -### `tf.nn.ctc_beam_search_decoder(inputs, sequence_length, beam_width=100, top_paths=1, merge_repeated=True)` {#ctc_beam_search_decoder} - -Performs beam search decoding on the logits given in input. - -**Note** The `ctc_greedy_decoder` is a special case of the -`ctc_beam_search_decoder` with `top_paths=1` and `beam_width=1` (but -that decoder is faster for this special case). - -If `merge_repeated` is `True`, merge repeated classes in the output beams. -This means that if consecutive entries in a beam are the same, -only the first of these is emitted. That is, when the top path -is `A B B B B`, the return value is: - - * `A B` if `merge_repeated = True`. - * `A B B B B` if `merge_repeated = False`. - -##### Args: - - -* `inputs`: 3-D `float` `Tensor`, size - `[max_time x batch_size x num_classes]`. The logits. -* `sequence_length`: 1-D `int32` vector containing sequence lengths, - having size `[batch_size]`. -* `beam_width`: An int scalar >= 0 (beam search beam width). -* `top_paths`: An int scalar >= 0, <= beam_width (controls output size). -* `merge_repeated`: Boolean. Default: True. - -##### Returns: - - A tuple `(decoded, log_probabilities)` where - -* `decoded`: A list of length top_paths, where `decoded[j]` - is a `SparseTensor` containing the decoded outputs: - `decoded[j].indices`: Indices matrix `(total_decoded_outputs[j] x 2)` - The rows store: [batch, time]. - `decoded[j].values`: Values vector, size `(total_decoded_outputs[j])`. - The vector stores the decoded classes for beam j. - `decoded[j].shape`: Shape vector, size `(2)`. - The shape values are: `[batch_size, max_decoded_length[j]]`. -* `log_probability`: A `float` matrix `(batch_size x top_paths)` containing - sequence log-probabilities. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.depthwise_conv2d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.depthwise_conv2d.md deleted file mode 100644 index fbb0a9f09a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.depthwise_conv2d.md +++ /dev/null @@ -1,45 +0,0 @@ -### `tf.nn.depthwise_conv2d(input, filter, strides, padding, rate=None, name=None)` {#depthwise_conv2d} - -Depthwise 2-D convolution. - -Given an input tensor of shape `[batch, in_height, in_width, in_channels]` -and a filter tensor of shape -`[filter_height, filter_width, in_channels, channel_multiplier]` -containing `in_channels` convolutional filters of depth 1, `depthwise_conv2d` -applies a different filter to each input channel (expanding from 1 channel -to `channel_multiplier` channels for each), then concatenates the results -together. The output has `in_channels * channel_multiplier` channels. - -In detail, - - output[b, i, j, k * channel_multiplier + q] = sum_{di, dj} - filter[di, dj, k, q] * input[b, strides[1] * i + rate[0] * di, - strides[2] * j + rate[1] * dj, k] - -Must have `strides[0] = strides[3] = 1`. For the most common case of the -same horizontal and vertical strides, `strides = [1, stride, stride, 1]`. -If any value in `rate` is greater than 1, we perform atrous depthwise -convolution, in which case all values in the `strides` tensor must be equal -to 1. - -##### Args: - - -* `input`: 4-D with shape `[batch, in_height, in_width, in_channels]`. -* `filter`: 4-D with shape - `[filter_height, filter_width, in_channels, channel_multiplier]`. -* `strides`: 1-D of size 4. The stride of the sliding window for each - dimension of `input`. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. - See the [comment - here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `rate`: 1-D of size 2. The dilation rate in which we sample input values - across the `height` and `width` dimensions in atrous convolution. If it is - greater than 1, then all values of strides must be 1. -* `name`: A name for this operation (optional). - -##### Returns: - - A 4-D `Tensor` of shape - `[batch, out_height, out_width, in_channels * channel_multiplier].` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.depthwise_conv2d_native.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.depthwise_conv2d_native.md deleted file mode 100644 index c2736f1ba9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.depthwise_conv2d_native.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.nn.depthwise_conv2d_native(input, filter, strides, padding, name=None)` {#depthwise_conv2d_native} - -Computes a 2-D depthwise convolution given 4-D `input` and `filter` tensors. - -Given an input tensor of shape `[batch, in_height, in_width, in_channels]` -and a filter / kernel tensor of shape -`[filter_height, filter_width, in_channels, channel_multiplier]`, containing -`in_channels` convolutional filters of depth 1, `depthwise_conv2d` applies -a different filter to each input channel (expanding from 1 channel to -`channel_multiplier` channels for each), then concatenates the results -together. Thus, the output has `in_channels * channel_multiplier` channels. - -for k in 0..in_channels-1 - for q in 0..channel_multiplier-1 - output[b, i, j, k * channel_multiplier + q] = - sum_{di, dj} input[b, strides[1] * i + di, strides[2] * j + dj, k] * - filter[di, dj, k, q] - -Must have `strides[0] = strides[3] = 1`. For the most common case of the same -horizontal and vertices strides, `strides = [1, stride, stride, 1]`. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `filter`: A `Tensor`. Must have the same type as `input`. -* `strides`: A list of `ints`. - 1-D of length 4. The stride of the sliding window for each dimension - of `input`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.dilation2d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.dilation2d.md deleted file mode 100644 index b9cf01da19..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.dilation2d.md +++ /dev/null @@ -1,50 +0,0 @@ -### `tf.nn.dilation2d(input, filter, strides, rates, padding, name=None)` {#dilation2d} - -Computes the grayscale dilation of 4-D `input` and 3-D `filter` tensors. - -The `input` tensor has shape `[batch, in_height, in_width, depth]` and the -`filter` tensor has shape `[filter_height, filter_width, depth]`, i.e., each -input channel is processed independently of the others with its own structuring -function. The `output` tensor has shape -`[batch, out_height, out_width, depth]`. The spatial dimensions of the output -tensor depend on the `padding` algorithm. We currently only support the default -"NHWC" `data_format`. - -In detail, the grayscale morphological 2-D dilation is the max-sum correlation -(for consistency with `conv2d`, we use unmirrored filters): - - output[b, y, x, c] = - max_{dy, dx} input[b, - strides[1] * y + rates[1] * dy, - strides[2] * x + rates[2] * dx, - c] + - filter[dy, dx, c] - -Max-pooling is a special case when the filter has size equal to the pooling -kernel size and contains all zeros. - -Note on duality: The dilation of `input` by the `filter` is equal to the -negation of the erosion of `-input` by the reflected `filter`. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. - 4-D with shape `[batch, in_height, in_width, depth]`. -* `filter`: A `Tensor`. Must have the same type as `input`. - 3-D with shape `[filter_height, filter_width, depth]`. -* `strides`: A list of `ints` that has length `>= 4`. - The stride of the sliding window for each dimension of the input - tensor. Must be: `[1, stride_height, stride_width, 1]`. -* `rates`: A list of `ints` that has length `>= 4`. - The input stride for atrous morphological dilation. Must be: - `[1, rate_height, rate_width, 1]`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - 4-D with shape `[batch, out_height, out_width, depth]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.l2_loss.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.l2_loss.md deleted file mode 100644 index fd648ca642..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.l2_loss.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.nn.l2_loss(t, name=None)` {#l2_loss} - -L2 Loss. - -Computes half the L2 norm of a tensor without the `sqrt`: - - output = sum(t ** 2) / 2 - -##### Args: - - -* `t`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Typically 2-D, but may have any dimensions. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `t`. 0-D. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.log_poisson_loss.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.log_poisson_loss.md deleted file mode 100644 index cf5cbe4740..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.log_poisson_loss.md +++ /dev/null @@ -1,44 +0,0 @@ -### `tf.nn.log_poisson_loss(targets, log_input, compute_full_loss=False, name=None)` {#log_poisson_loss} - -Computes log Poisson loss given `log_input`. - -Gives the log-likelihood loss between the prediction and the target under the -assumption that the target has a Poisson distribution. -Caveat: By default, this is not the exact loss, but the loss minus a - constant term [log(z!)]. That has no effect for optimization, but - does not play well with relative loss comparisons. To compute an - approximation of the log factorial term, specify - compute_full_loss=True to enable Stirling's Approximation. - -For brevity, let `c = log(x) = log_input`, `z = targets`. The log Poisson -loss is - - -log(exp(-x) * (x^z) / z!) - = -log(exp(-x) * (x^z)) + log(z!) - ~ -log(exp(-x)) - log(x^z) [+ z * log(z) - z + 0.5 * log(2 * pi * z)] - [ Note the second term is the Stirling's Approximation for log(z!). - It is invariant to x and does not affect optimization, though - important for correct relative loss comparisons. It is only - computed when compute_full_loss == True. ] - = x - z * log(x) [+ z * log(z) - z + 0.5 * log(2 * pi * z)] - = exp(c) - z * c [+ z * log(z) - z + 0.5 * log(2 * pi * z)] - -##### Args: - - -* `targets`: A `Tensor` of the same type and shape as `log_input`. -* `log_input`: A `Tensor` of type `float32` or `float64`. -* `compute_full_loss`: whether to compute the full loss. If false, a constant - term is dropped in favor of more efficient optimization. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of the same shape as `log_input` with the componentwise - logistic losses. - -##### Raises: - - -* `ValueError`: If `log_input` and `targets` do not have the same shape. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.max_pool3d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.max_pool3d.md deleted file mode 100644 index 960b322c6c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.max_pool3d.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.nn.max_pool3d(input, ksize, strides, padding, name=None)` {#max_pool3d} - -Performs 3D max pooling on the input. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Shape `[batch, depth, rows, cols, channels]` tensor to pool over. -* `ksize`: A list of `ints` that has length `>= 5`. - 1-D tensor of length 5. The size of the window for each dimension of - the input tensor. Must have `ksize[0] = ksize[4] = 1`. -* `strides`: A list of `ints` that has length `>= 5`. - 1-D tensor of length 5. The stride of the sliding window for each - dimension of `input`. Must have `strides[0] = strides[4] = 1`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. The max pooled output tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.nce_loss.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.nce_loss.md deleted file mode 100644 index 7cb440b70d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.nce_loss.md +++ /dev/null @@ -1,58 +0,0 @@ -### `tf.nn.nce_loss(weights, biases, labels, inputs, num_sampled, num_classes, num_true=1, sampled_values=None, remove_accidental_hits=False, partition_strategy='mod', name='nce_loss')` {#nce_loss} - -Computes and returns the noise-contrastive estimation training loss. - -See [Noise-contrastive estimation: A new estimation principle for -unnormalized statistical -models](http://www.jmlr.org/proceedings/papers/v9/gutmann10a/gutmann10a.pdf). -Also see our [Candidate Sampling Algorithms -Reference](../../extras/candidate_sampling.pdf) - -Note: By default this uses a log-uniform (Zipfian) distribution for sampling, -so your labels must be sorted in order of decreasing frequency to achieve -good results. For more details, see -[log_uniform_candidate_sampler](#log_uniform_candidate_sampler). - -Note: In the case where `num_true` > 1, we assign to each target class -the target probability 1 / `num_true` so that the target probabilities -sum to 1 per-example. - -Note: It would be useful to allow a variable number of target classes per -example. We hope to provide this functionality in a future release. -For now, if you have a variable number of target classes, you can pad them -out to a constant number by either repeating them or by padding -with an otherwise unused class. - -##### Args: - - -* `weights`: A `Tensor` of shape `[num_classes, dim]`, or a list of `Tensor` - objects whose concatenation along dimension 0 has shape - [num_classes, dim]. The (possibly-partitioned) class embeddings. -* `biases`: A `Tensor` of shape `[num_classes]`. The class biases. -* `labels`: A `Tensor` of type `int64` and shape `[batch_size, - num_true]`. The target classes. -* `inputs`: A `Tensor` of shape `[batch_size, dim]`. The forward - activations of the input network. -* `num_sampled`: An `int`. The number of classes to randomly sample per batch. -* `num_classes`: An `int`. The number of possible classes. -* `num_true`: An `int`. The number of target classes per training example. -* `sampled_values`: a tuple of (`sampled_candidates`, `true_expected_count`, - `sampled_expected_count`) returned by a `*_candidate_sampler` function. - (if None, we default to `log_uniform_candidate_sampler`) -* `remove_accidental_hits`: A `bool`. Whether to remove "accidental hits" - where a sampled class equals one of the target classes. If set to - `True`, this is a "Sampled Logistic" loss instead of NCE, and we are - learning to generate log-odds instead of log probabilities. See - our [Candidate Sampling Algorithms Reference] - (../../extras/candidate_sampling.pdf). - Default is False. -* `partition_strategy`: A string specifying the partitioning strategy, relevant - if `len(weights) > 1`. Currently `"div"` and `"mod"` are supported. - Default is `"mod"`. See `tf.nn.embedding_lookup` for more details. -* `name`: A name for the operation (optional). - -##### Returns: - - A `batch_size` 1-D tensor of per-example NCE losses. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.softplus.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.softplus.md deleted file mode 100644 index c0faef9687..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.softplus.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.nn.softplus(features, name=None)` {#softplus} - -Computes softplus: `log(exp(features) + 1)`. - -##### Args: - - -* `features`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `features`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.sparse_softmax_cross_entropy_with_logits.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.sparse_softmax_cross_entropy_with_logits.md deleted file mode 100644 index 0aa696ba2f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.nn.sparse_softmax_cross_entropy_with_logits.md +++ /dev/null @@ -1,50 +0,0 @@ -### `tf.nn.sparse_softmax_cross_entropy_with_logits(_sentinel=None, labels=None, logits=None, name=None)` {#sparse_softmax_cross_entropy_with_logits} - -Computes sparse softmax cross entropy between `logits` and `labels`. - -Measures the probability error in discrete classification tasks in which the -classes are mutually exclusive (each entry is in exactly one class). For -example, each CIFAR-10 image is labeled with one and only one label: an image -can be a dog or a truck, but not both. - -**NOTE:** For this operation, the probability of a given label is considered -exclusive. That is, soft classes are not allowed, and the `labels` vector -must provide a single specific index for the true class for each row of -`logits` (each minibatch entry). For soft softmax classification with -a probability distribution for each entry, see -`softmax_cross_entropy_with_logits`. - -**WARNING:** This op expects unscaled logits, since it performs a softmax -on `logits` internally for efficiency. Do not call this op with the -output of `softmax`, as it will produce incorrect results. - -A common use case is to have logits of shape `[batch_size, num_classes]` and -labels of shape `[batch_size]`. But higher dimensions are supported. - -**Note that to avoid confusion, it is required to pass only named arguments to -this function.** - -##### Args: - - _sentinel: Used to prevent positional parameters. Internal, do not use. - -* `labels`: `Tensor` of shape `[d_0, d_1, ..., d_{r-1}]` (where `r` is rank of - `labels` and result) and dtype `int32` or `int64`. Each entry in `labels` - must be an index in `[0, num_classes)`. Other values will raise an - exception when this op is run on CPU, and return `NaN` for corresponding - loss and gradient rows on GPU. -* `logits`: Unscaled log probabilities of shape - `[d_0, d_1, ..., d_{r-1}, num_classes]` and dtype `float32` or `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of the same shape as `labels` and of the same type as `logits` - with the softmax cross entropy loss. - -##### Raises: - - -* `ValueError`: If logits are scalars (need to have rank >= 1) or if the rank - of the labels is not equal to the rank of the labels minus one. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.placeholder_with_default.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.placeholder_with_default.md deleted file mode 100644 index 2f3cdd593c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.placeholder_with_default.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.placeholder_with_default(input, shape, name=None)` {#placeholder_with_default} - -A placeholder op that passes through `input` when its output is not fed. - -##### Args: - - -* `input`: A `Tensor`. The default value to produce when `output` is not fed. -* `shape`: A `tf.TensorShape` or list of `ints`. - The (possibly partial) shape of the tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - A placeholder tensor that defaults to `input` if it is not fed. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.python_io.TFRecordCompressionType.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.python_io.TFRecordCompressionType.md deleted file mode 100644 index 8b9cbe0445..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.python_io.TFRecordCompressionType.md +++ /dev/null @@ -1 +0,0 @@ -The type of compression for the record. diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.reduce_all.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.reduce_all.md deleted file mode 100644 index 7ce5d55ccc..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.reduce_all.md +++ /dev/null @@ -1,40 +0,0 @@ -### `tf.reduce_all(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_all} - -Computes the "logical and" of elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -For example: - -```python -# 'x' is [[True, True] -# [False, False]] -tf.reduce_all(x) ==> False -tf.reduce_all(x, 0) ==> [False, False] -tf.reduce_all(x, 1) ==> [True, False] -``` - -##### Args: - - -* `input_tensor`: The boolean tensor to reduce. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - -@compatibility(numpy) -Equivalent to np.all -@end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.reduce_mean.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.reduce_mean.md deleted file mode 100644 index 1c6948ffa3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.reduce_mean.md +++ /dev/null @@ -1,40 +0,0 @@ -### `tf.reduce_mean(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_mean} - -Computes the mean of elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -For example: - -```python -# 'x' is [[1., 1.] -# [2., 2.]] -tf.reduce_mean(x) ==> 1.5 -tf.reduce_mean(x, 0) ==> [1.5, 1.5] -tf.reduce_mean(x, 1) ==> [1., 2.] -``` - -##### Args: - - -* `input_tensor`: The tensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - -@compatibility(numpy) -Equivalent to np.mean -@end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.segment_max.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.segment_max.md deleted file mode 100644 index c9d7a28900..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.segment_max.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.segment_max(data, segment_ids, name=None)` {#segment_max} - -Computes the maximum along segments of a tensor. - -Read [the section on Segmentation](../../api_docs/python/math_ops.md#segmentation) -for an explanation of segments. - -Computes a tensor such that -\\(output_i = \max_j(data_j)\\) where `max` is over `j` such -that `segment_ids[j] == i`. - -
- -
- -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `segment_ids`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor whose rank is equal to the rank of `data`'s - first dimension. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.self_adjoint_eigvals.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.self_adjoint_eigvals.md deleted file mode 100644 index c52a82a49a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.self_adjoint_eigvals.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.self_adjoint_eigvals(tensor, name=None)` {#self_adjoint_eigvals} - -Computes the eigenvalues of one or more self-adjoint matrices. - -##### Args: - - -* `tensor`: `Tensor` of shape `[..., N, N]`. -* `name`: string, optional name of the operation. - -##### Returns: - - -* `e`: Eigenvalues. Shape is `[..., N]`. The vector `e[..., :]` contains the `N` - eigenvalues of `tensor[..., :, :]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.sparse_add.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.sparse_add.md deleted file mode 100644 index 3a3c88db49..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.sparse_add.md +++ /dev/null @@ -1,55 +0,0 @@ -### `tf.sparse_add(a, b, thresh=0)` {#sparse_add} - -Adds two tensors, at least one of each is a `SparseTensor`. - -If one `SparseTensor` and one `Tensor` are passed in, returns a `Tensor`. If -both arguments are `SparseTensor`s, this returns a `SparseTensor`. The order -of arguments does not matter. Use vanilla `tf.add()` for adding two dense -`Tensor`s. - -The indices of any input `SparseTensor` are assumed ordered in standard -lexicographic order. If this is not the case, before this step run -`SparseReorder` to restore index ordering. - -If both arguments are sparse, we perform "clipping" as follows. By default, -if two values sum to zero at some index, the output `SparseTensor` would still -include that particular location in its index, storing a zero in the -corresponding value slot. To override this, callers can specify `thresh`, -indicating that if the sum has a magnitude strictly smaller than `thresh`, its -corresponding value and index would then not be included. In particular, -`thresh == 0.0` (default) means everything is kept and actual thresholding -happens only for a positive value. - -For example, suppose the logical sum of two sparse operands is (densified): - - [ 2] - [.1 0] - [ 6 -.2] - -Then, - - * `thresh == 0` (the default): all 5 index/value pairs will be returned. - * `thresh == 0.11`: only .1 and 0 will vanish, and the remaining three - index/value pairs will be returned. - * `thresh == 0.21`: .1, 0, and -.2 will vanish. - -##### Args: - - -* `a`: The first operand; `SparseTensor` or `Tensor`. -* `b`: The second operand; `SparseTensor` or `Tensor`. At least one operand - must be sparse. -* `thresh`: A 0-D `Tensor`. The magnitude threshold that determines if an - output value/index pair takes space. Its dtype should match that of the - values if they are real; if the latter are complex64/complex128, then the - dtype should be float32/float64, correspondingly. - -##### Returns: - - A `SparseTensor` or a `Tensor`, representing the sum. - -##### Raises: - - -* `TypeError`: If both `a` and `b` are `Tensor`s. Use `tf.add()` instead. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.sparse_to_indicator.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.sparse_to_indicator.md deleted file mode 100644 index ede12c08fe..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.sparse_to_indicator.md +++ /dev/null @@ -1,52 +0,0 @@ -### `tf.sparse_to_indicator(sp_input, vocab_size, name=None)` {#sparse_to_indicator} - -Converts a `SparseTensor` of ids into a dense bool indicator tensor. - -The last dimension of `sp_input.indices` is discarded and replaced with -the values of `sp_input`. If `sp_input.dense_shape = [D0, D1, ..., Dn, K]`, -then `output.shape = [D0, D1, ..., Dn, vocab_size]`, where - - output[d_0, d_1, ..., d_n, sp_input[d_0, d_1, ..., d_n, k]] = True - -and False elsewhere in `output`. - -For example, if `sp_input.dense_shape = [2, 3, 4]` with non-empty values: - - [0, 0, 0]: 0 - [0, 1, 0]: 10 - [1, 0, 3]: 103 - [1, 1, 2]: 150 - [1, 1, 3]: 149 - [1, 1, 4]: 150 - [1, 2, 1]: 121 - -and `vocab_size = 200`, then the output will be a `[2, 3, 200]` dense bool -tensor with False everywhere except at positions - - (0, 0, 0), (0, 1, 10), (1, 0, 103), (1, 1, 149), (1, 1, 150), - (1, 2, 121). - -Note that repeats are allowed in the input SparseTensor. -This op is useful for converting `SparseTensor`s into dense formats for -compatibility with ops that expect dense tensors. - -The input `SparseTensor` must be in row-major order. - -##### Args: - - -* `sp_input`: A `SparseTensor` with `values` property of type `int32` or - `int64`. -* `vocab_size`: A scalar int64 Tensor (or Python int) containing the new size - of the last dimension, `all(0 <= sp_input.values < vocab_size)`. -* `name`: A name prefix for the returned tensors (optional) - -##### Returns: - - A dense bool indicator tensor representing the indices with specified value. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.stack.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.stack.md deleted file mode 100644 index 51f81c1000..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.stack.md +++ /dev/null @@ -1,44 +0,0 @@ -### `tf.stack(values, axis=0, name='stack')` {#stack} - -Stacks a list of rank-`R` tensors into one rank-`(R+1)` tensor. - -Packs the list of tensors in `values` into a tensor with rank one higher than -each tensor in `values`, by packing them along the `axis` dimension. -Given a list of length `N` of tensors of shape `(A, B, C)`; - -if `axis == 0` then the `output` tensor will have the shape `(N, A, B, C)`. -if `axis == 1` then the `output` tensor will have the shape `(A, N, B, C)`. -Etc. - -For example: - -```prettyprint -# 'x' is [1, 4] -# 'y' is [2, 5] -# 'z' is [3, 6] -stack([x, y, z]) => [[1, 4], [2, 5], [3, 6]] # Pack along first dim. -stack([x, y, z], axis=1) => [[1, 2, 3], [4, 5, 6]] -``` - -This is the opposite of unstack. The numpy equivalent is - - tf.stack([x, y, z]) = np.asarray([x, y, z]) - -##### Args: - - -* `values`: A list of `Tensor` objects with the same shape and type. -* `axis`: An `int`. The axis to stack along. Defaults to the first dimension. - Supports negative indexes. -* `name`: A name for this operation (optional). - -##### Returns: - - -* `output`: A stacked `Tensor` with the same type as `values`. - -##### Raises: - - -* `ValueError`: If `axis` is out of the range [-(R+1), R+1). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.string_to_hash_bucket_fast.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.string_to_hash_bucket_fast.md deleted file mode 100644 index e684058326..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.string_to_hash_bucket_fast.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.string_to_hash_bucket_fast(input, num_buckets, name=None)` {#string_to_hash_bucket_fast} - -Converts each string in the input Tensor to its hash mod by a number of buckets. - -The hash function is deterministic on the content of the string within the -process and will never change. However, it is not suitable for cryptography. -This function may be used when CPU time is scarce and inputs are trusted or -unimportant. There is a risk of adversaries constructing inputs that all hash -to the same bucket. To prevent this problem, use a strong hash function with -`tf.string_to_hash_bucket_strong`. - -##### Args: - - -* `input`: A `Tensor` of type `string`. The strings to assign a hash bucket. -* `num_buckets`: An `int` that is `>= 1`. The number of buckets. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `int64`. - A Tensor of the same shape as the input `string_tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.summary.SummaryDescription.RegisterExtension.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.summary.SummaryDescription.RegisterExtension.md deleted file mode 100644 index 3cfd7103d7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.summary.SummaryDescription.RegisterExtension.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.summary.SummaryDescription.RegisterExtension(extension_handle)` {#SummaryDescription.RegisterExtension} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.tile.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.tile.md deleted file mode 100644 index 0c31e73c98..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.tile.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.tile(input, multiples, name=None)` {#tile} - -Constructs a tensor by tiling a given tensor. - -This operation creates a new tensor by replicating `input` `multiples` times. -The output tensor's i'th dimension has `input.dims(i) * multiples[i]` elements, -and the values of `input` are replicated `multiples[i]` times along the 'i'th -dimension. For example, tiling `[a b c d]` by `[2]` produces -`[a b c d a b c d]`. - -##### Args: - - -* `input`: A `Tensor`. 1-D or higher. -* `multiples`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 1-D. Length must be the same as the number of dimensions in `input` -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.SingularMonitoredSession.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.SingularMonitoredSession.md deleted file mode 100644 index 09271a91a1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.SingularMonitoredSession.md +++ /dev/null @@ -1,131 +0,0 @@ -Session-like object that handles initialization, restoring, and hooks. - -Please note that this utility is not recommended for distributed settings. -For distributed settings, please use `tf.train.MonitoredSession`. The -differences between `MonitoredSession` and `SingularMonitoredSession` are: -* `MonitoredSession` handles `AbortedError` for distributed settings, - but `SingularMonitoredSession` does not. -* `MonitoredSession` can be created in `chief` or `worker` modes. - `SingularMonitoredSession` is always created as `chief`. -* You can access the raw `tf.Session` object used by - `SingularMonitoredSession`, whereas in MonitoredSession the raw session is - private. This can be used: - - To `run` without hooks. - - To save and restore. -* All other functionality is identical. - -Example usage: -```python -saver_hook = CheckpointSaverHook(...) -summary_hook = SummaryHook(...) -with SingularMonitoredSession(hooks=[saver_hook, summary_hook]) as sess: - while not sess.should_stop(): - sess.run(train_op) -``` - -Initialization: At creation time the hooked session does following things -in given order: - -* calls `hook.begin()` for each given hook -* finalizes the graph via `scaffold.finalize()` -* create session -* initializes the model via initialization ops provided by `Scaffold` -* restores variables if a checkpoint exists -* launches queue runners - -Run: When `run()` is called, the hooked session does following things: - -* calls `hook.before_run()` -* calls TensorFlow `session.run()` with merged fetches and feed_dict -* calls `hook.after_run()` -* returns result of `session.run()` asked by user - -Exit: At the `close()`, the hooked session does following things in order: - -* calls `hook.end()` -* closes the queue runners and the session -* surpresses `OutOfRange` error which indicates that all inputs have been - processed if the `SingularMonitoredSession` is used as a context. -- - - - -#### `tf.train.SingularMonitoredSession.__enter__()` {#SingularMonitoredSession.__enter__} - - - - -- - - - -#### `tf.train.SingularMonitoredSession.__exit__(exception_type, exception_value, traceback)` {#SingularMonitoredSession.__exit__} - - - - -- - - - -#### `tf.train.SingularMonitoredSession.__init__(hooks=None, scaffold=None, master='', config=None, checkpoint_dir=None, stop_grace_period_secs=120)` {#SingularMonitoredSession.__init__} - -Creates a SingularMonitoredSession. - -##### Args: - - -* `hooks`: An iterable of `SessionRunHook' objects. -* `scaffold`: A `Scaffold` used for gathering or building supportive ops. If - not specified a default one is created. It's used to finalize the graph. -* `master`: `String` representation of the TensorFlow master to use. -* `config`: `ConfigProto` proto used to configure the session. -* `checkpoint_dir`: A string. Optional path to a directory where to restore - variables. -* `stop_grace_period_secs`: Number of seconds given to threads to stop after - `close()` has been called. - - -- - - - -#### `tf.train.SingularMonitoredSession.close()` {#SingularMonitoredSession.close} - - - - -- - - - -#### `tf.train.SingularMonitoredSession.graph` {#SingularMonitoredSession.graph} - -The graph that was launched in this session. - - -- - - - -#### `tf.train.SingularMonitoredSession.raw_session()` {#SingularMonitoredSession.raw_session} - -Returns underlying `TensorFlow.Session` object. - - -- - - - -#### `tf.train.SingularMonitoredSession.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#SingularMonitoredSession.run} - -Run ops in the monitored session. - -This method is completely compatible with the `tf.Session.run()` method. - -##### Args: - - -* `fetches`: Same as `tf.Session.run()`. -* `feed_dict`: Same as `tf.Session.run()`. -* `options`: Same as `tf.Session.run()`. -* `run_metadata`: Same as `tf.Session.run()`. - -##### Returns: - - Same as `tf.Session.run()`. - - -- - - - -#### `tf.train.SingularMonitoredSession.should_stop()` {#SingularMonitoredSession.should_stop} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.WorkerSessionCreator.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.WorkerSessionCreator.md deleted file mode 100644 index 9ba1affc6b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.WorkerSessionCreator.md +++ /dev/null @@ -1,23 +0,0 @@ -Creates a tf.Session for a worker. -- - - - -#### `tf.train.WorkerSessionCreator.__init__(scaffold=None, master='', config=None)` {#WorkerSessionCreator.__init__} - -Initializes a worker session creator. - -##### Args: - - -* `scaffold`: A `Scaffold` used for gathering or building supportive ops. If - not specified a default one is created. It's used to finalize the graph. -* `master`: `String` representation of the TensorFlow master to use. -* `config`: `ConfigProto` proto used to configure the session. - - -- - - - -#### `tf.train.WorkerSessionCreator.create_session()` {#WorkerSessionCreator.create_session} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.match_filenames_once.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.match_filenames_once.md deleted file mode 100644 index db62d20223..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.match_filenames_once.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.train.match_filenames_once(pattern, name=None)` {#match_filenames_once} - -Save the list of files matching pattern, so it is only computed once. - -##### Args: - - -* `pattern`: A file pattern (glob), or 1D tensor of file patterns. -* `name`: A name for the operations (optional). - -##### Returns: - - A variable that is initialized to the list of files matching the pattern(s). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.maybe_batch_join.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.maybe_batch_join.md deleted file mode 100644 index 477c0e7bd9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.maybe_batch_join.md +++ /dev/null @@ -1,42 +0,0 @@ -### `tf.train.maybe_batch_join(tensors_list, keep_input, batch_size, capacity=32, enqueue_many=False, shapes=None, dynamic_pad=False, allow_smaller_final_batch=False, shared_name=None, name=None)` {#maybe_batch_join} - -Runs a list of tensors to conditionally fill a queue to create batches. - -See docstring in `batch_join` for more details. - -##### Args: - - -* `tensors_list`: A list of tuples or dictionaries of tensors to enqueue. -* `keep_input`: A `bool` Tensor. This tensor controls whether the input is - added to the queue or not. If it is a scalar and evaluates `True`, then - `tensors` are all added to the queue. If it is a vector and `enqueue_many` - is `True`, then each example is added to the queue only if the - corresonding value in `keep_input` is `True`. This tensor essentially acts - as a filtering mechanism. -* `batch_size`: An integer. The new batch size pulled from the queue. -* `capacity`: An integer. The maximum number of elements in the queue. -* `enqueue_many`: Whether each tensor in `tensor_list_list` is a single - example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensor_list_list[i]`. -* `dynamic_pad`: Boolean. Allow variable dimensions in input shapes. - The given dimensions are padded upon dequeue so that tensors within a - batch have the same shapes. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (Optional) If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the same number and types as - `tensors_list[i]`. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensor_list_list`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.update_checkpoint_state.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.update_checkpoint_state.md deleted file mode 100644 index 68747fc0c7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.update_checkpoint_state.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.train.update_checkpoint_state(save_dir, model_checkpoint_path, all_model_checkpoint_paths=None, latest_filename=None)` {#update_checkpoint_state} - -Updates the content of the 'checkpoint' file. - -This updates the checkpoint file containing a CheckpointState -proto. - -##### Args: - - -* `save_dir`: Directory where the model was saved. -* `model_checkpoint_path`: The checkpoint file. -* `all_model_checkpoint_paths`: List of strings. Paths to all not-yet-deleted - checkpoints, sorted from oldest to newest. If this is a non-empty list, - the last element must be equal to model_checkpoint_path. These paths - are also saved in the CheckpointState proto. -* `latest_filename`: Optional name of the checkpoint file. Default to - 'checkpoint'. - -##### Raises: - - -* `RuntimeError`: If the save paths conflict. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.write_graph.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.write_graph.md deleted file mode 100644 index 33e1f1c591..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.train.write_graph.md +++ /dev/null @@ -1,33 +0,0 @@ -### `tf.train.write_graph(graph_or_graph_def, logdir, name, as_text=True)` {#write_graph} - -Writes a graph proto to a file. - -The graph is written as a binary proto unless `as_text` is `True`. - -```python -v = tf.Variable(0, name='my_variable') -sess = tf.Session() -tf.train.write_graph(sess.graph_def, '/tmp/my-model', 'train.pbtxt') -``` - -or - -```python -v = tf.Variable(0, name='my_variable') -sess = tf.Session() -tf.train.write_graph(sess.graph, '/tmp/my-model', 'train.pbtxt') -``` - -##### Args: - - -* `graph_or_graph_def`: A `Graph` or a `GraphDef` protocol buffer. -* `logdir`: Directory where to write the graph. This can refer to remote - filesystems, such as Google Cloud Storage (GCS). -* `name`: Filename for the graph. -* `as_text`: If `True`, writes the graph as an ASCII proto. - -##### Returns: - - The path of the output proto file. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.unsorted_segment_sum.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.unsorted_segment_sum.md deleted file mode 100644 index c02d39e96a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.unsorted_segment_sum.md +++ /dev/null @@ -1,38 +0,0 @@ -### `tf.unsorted_segment_sum(data, segment_ids, num_segments, name=None)` {#unsorted_segment_sum} - -Computes the sum along segments of a tensor. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -Computes a tensor such that -`(output[i] = sum_{j...} data[j...]` where the sum is over tuples `j...` such -that `segment_ids[j...] == i`. Unlike `SegmentSum`, `segment_ids` -need not be sorted and need not cover all values in the full -range of valid values. - -If the sum is empty for a given segment ID `i`, `output[i] = 0`. - -`num_segments` should equal the number of distinct segment IDs. - -
- -
- -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `segment_ids`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A tensor whose shape is a prefix of `data.shape`. -* `num_segments`: A `Tensor` of type `int32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for the first `segment_ids.rank` - dimensions, which are replaced with a single dimension which has size - `num_segments`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.while_loop.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.while_loop.md deleted file mode 100644 index da39478841..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf.while_loop.md +++ /dev/null @@ -1,117 +0,0 @@ -### `tf.while_loop(cond, body, loop_vars, shape_invariants=None, parallel_iterations=10, back_prop=True, swap_memory=False, name=None)` {#while_loop} - -Repeat `body` while the condition `cond` is true. - -`cond` is a callable returning a boolean scalar tensor. `body` is a callable -returning a (possibly nested) tuple, namedtuple or list of tensors of the same -arity (length and structure) and types as `loop_vars`. `loop_vars` is a -(possibly nested) tuple, namedtuple or list of tensors that is passed to both -`cond` and `body`. `cond` and `body` both take as many arguments as there are -`loop_vars`. - -While `cond` evaluates to true, `body` is executed. - -In addition to regular Tensors or IndexedSlices, the body may accept and -return TensorArray objects. The flows of the TensorArray objects will -be appropriately forwarded between loops and during gradient calculations. - -For correctness, `tf.while_loop()` strictly enforces shape invariants for -the loop variables. A shape invariant is a (possibly partial) shape that -is unchanged across the iterations of the loop. An error will be raised -if the shape of a loop variable after an iteration is determined to be more -general than or incompatible with its shape invariant. For example, a shape -of [11, None] is more general than a shape of [11, 17], and [11, 21] is not -compatible with [11, 17]. By default (if the argument `shape_invariants` is -not specified), it is assumed that the initial shape of each tensor in -`loop_vars` is the same in every iteration. The `shape_invariants` argument -allows the caller to specify a less specific shape invariant for each loop -variable, which is needed if the shape varies between iterations. The -[`Tensor.set_shape()`](../../api_docs/python/framework.md#Tensor.set_shape) -function may also be used in the `body` function to indicate that -the output loop variable has a particular shape. The shape invariant for -SparseTensor and IndexedSlices are treated specially as follows: - -a) If a loop variable is a SparseTensor, the shape invariant must be -TensorShape([r]) where r is the rank of the dense tensor represented -by the sparse tensor. It means the shapes of the three tensors of the -SparseTensor are ([None], [None, r], [r]). NOTE: The shape invariant here -is the shape of the SparseTensor.dense_shape property. It must be the shape of -a vector. - -b) If a loop variable is an IndexedSlices, the shape invariant must be -a shape invariant of the values tensor of the IndexedSlices. It means -the shapes of the three tensors of the IndexedSlices are (shape, [shape[0]], -[shape.ndims]). - -`while_loop` implements non-strict semantics, enabling multiple iterations -to run in parallel. The maximum number of parallel iterations can be -controlled by `parallel_iterations`, which gives users some control over -memory consumption and execution order. For correct programs, `while_loop` -should return the same result for any parallel_iterations > 0. - -For training, TensorFlow remembers the tensors that are produced in the -forward inference but needed in back propagation. These tensors can be a -main source of memory consumption and often cause OOM problems when training -on GPUs. When the flag swap_memory is true, we swap out these tensors from -GPU to CPU. This for example allows us to train RNN models with very long -sequences and large batches. - -##### Args: - - -* `cond`: A callable that represents the termination condition of the loop. -* `body`: A callable that represents the loop body. -* `loop_vars`: A (possibly nested) tuple, namedtuple or list of numpy array, - `Tensor`, and `TensorArray` objects. -* `shape_invariants`: The shape invariants for the loop variables. -* `parallel_iterations`: The number of iterations allowed to run in parallel. - It must be a positive integer. -* `back_prop`: Whether backprop is enabled for this while loop. -* `swap_memory`: Whether GPU-CPU memory swap is enabled for this loop. -* `name`: Optional name prefix for the returned tensors. - -##### Returns: - - The output tensors for the loop variables after the loop. When the length - of `loop_vars` is 1 this is a Tensor, TensorArray or IndexedSlice and when - the length of `loop_vars` is greater than 1 it returns a list. - -##### Raises: - - -* `TypeError`: if `cond` or `body` is not callable. -* `ValueError`: if `loop_vars` is empty. - - -* `Example`: - - ```python - i = tf.constant(0) - c = lambda i: tf.less(i, 10) - b = lambda i: tf.add(i, 1) - r = tf.while_loop(c, b, [i]) - ``` - -Example with nesting and a namedtuple: - - ```python - import collections - Pair = collections.namedtuple('Pair', 'j, k') - ijk_0 = (tf.constant(0), Pair(tf.constant(1), tf.constant(2))) - c = lambda i, p: i < 10 - b = lambda i, p: (i + 1, Pair((p.j + p.k), (p.j - p.k))) - ijk_final = tf.while_loop(c, b, ijk_0) - ``` - -Example using shape_invariants: - - ```python - i0 = tf.constant(0) - m0 = tf.ones([2, 2]) - c = lambda i, m: i < 10 - b = lambda i, m: [i+1, tf.concat([m, m], axis=0)] - tf.while_loop( - c, b, loop_vars=[i0, m0], - shape_invariants=[i0.get_shape(), tf.TensorShape([None, 2])]) - ``` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf_debug.DebugDumpDir.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf_debug.DebugDumpDir.md deleted file mode 100644 index 4b60562c32..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf_debug.DebugDumpDir.md +++ /dev/null @@ -1,548 +0,0 @@ -Data set from a debug-dump directory on filesystem. - -An instance of `DebugDumpDir` contains all `DebugTensorDatum` instances -in a tfdbg dump root directory. -- - - - -#### `tf_debug.DebugDumpDir.__init__(dump_root, partition_graphs=None, validate=True)` {#DebugDumpDir.__init__} - -`DebugDumpDir` constructor. - -##### Args: - - -* `dump_root`: (`str`) path to the dump root directory. -* `partition_graphs`: A repeated field of GraphDefs representing the - partition graphs executed by the TensorFlow runtime. -* `validate`: (`bool`) whether the dump files are to be validated against the - partition graphs. - -##### Raises: - - -* `IOError`: If dump_root does not exist as a directory. - - -- - - - -#### `tf_debug.DebugDumpDir.core_metadata` {#DebugDumpDir.core_metadata} - -Metadata about the `Session.run()` call from the core runtime. - -Of the three counters available in the return value, `global_step` is -supplied by the caller of the debugged `Session.run()`, while -`session_run_count` and `executor_step_count` are determined by the state -of the core runtime, automatically. For the same fetch list, feed keys and -debug tensor watch options, the same executor will be used and -`executor_step_count` should increase by one at a time. However, runs with -different fetch lists, feed keys and debug_tensor watch options that all -share the same `Session` object can lead to gaps in `session_run_count`. - -##### Returns: - - If core metadata are loaded, a `namedtuple` with the fields: - `global_step`: A global step count supplied by the caller of - `Session.run()`. It is optional to the caller. If the caller did not - supply this parameter, its value will be -1. - `session_run_count`: A counter for Run() calls to the underlying - TensorFlow `Session` object. - `executor_step_count`: A counter for invocations of a given runtime - executor. The same executor is re-used for the same fetched tensors, - target nodes, input feed keys and debug tensor watch options. - `input_names`: Names of the input (feed) Tensors. - `output_names`: Names of the output (fetched) Tensors. - `target_nodes`: Names of the target nodes. - If the core metadata have not been loaded, `None`. - - -- - - - -#### `tf_debug.DebugDumpDir.debug_watch_keys(node_name)` {#DebugDumpDir.debug_watch_keys} - -Get all tensor watch keys of given node according to partition graphs. - -##### Args: - - -* `node_name`: (`str`) name of the node. - -##### Returns: - - (`list` of `str`) all debug tensor watch keys. Returns an empty list if - the node name does not correspond to any debug watch keys. - -##### Raises: - - `LookupError`: If debug watch information has not been loaded from - partition graphs yet. - - -- - - - -#### `tf_debug.DebugDumpDir.devices()` {#DebugDumpDir.devices} - -Get the list of devices. - -##### Returns: - - (`list` of `str`) names of the devices. - -##### Raises: - - -* `LookupError`: If node inputs and control inputs have not been loaded - from partition graphs yet. - - -- - - - -#### `tf_debug.DebugDumpDir.dumped_tensor_data` {#DebugDumpDir.dumped_tensor_data} - - - - -- - - - -#### `tf_debug.DebugDumpDir.find(predicate, first_n=0)` {#DebugDumpDir.find} - -Find dumped tensor data by a certain predicate. - -##### Args: - - -* `predicate`: A callable that takes two input arguments: - - ```python - def predicate(debug_tensor_datum, tensor): - # returns a bool - ``` - - where `debug_tensor_datum` is an instance of `DebugTensorDatum`, which - carries the metadata, such as the `Tensor`'s node name, output slot - timestamp, debug op name, etc.; and `tensor` is the dumped tensor value - as a `numpy.ndarray`. - -* `first_n`: (`int`) return only the first n `DebugTensotDatum` instances (in - time order) for which the predicate returns True. To return all the - `DebugTensotDatum` instances, let first_n be <= 0. - -##### Returns: - - A list of all `DebugTensorDatum` objects in this `DebugDumpDir` object - for which predicate returns True, sorted in ascending order of the - timestamp. - - -- - - - -#### `tf_debug.DebugDumpDir.get_dump_sizes_bytes(node_name, output_slot, debug_op)` {#DebugDumpDir.get_dump_sizes_bytes} - -Get the sizes of the dump files for a debug-dumped tensor. - -Unit of the file size: byte. - -##### Args: - - -* `node_name`: (`str`) name of the node that the tensor is produced by. -* `output_slot`: (`int`) output slot index of tensor. -* `debug_op`: (`str`) name of the debug op. - -##### Returns: - - (`list` of `int`): list of dump file sizes in bytes. - -##### Raises: - - -* `ValueError`: If the tensor watch key does not exist in the debug dump data. - - -- - - - -#### `tf_debug.DebugDumpDir.get_rel_timestamps(node_name, output_slot, debug_op)` {#DebugDumpDir.get_rel_timestamps} - -Get the relative timestamp from for a debug-dumped tensor. - -Relative timestamp means (absolute timestamp - `t0`), where `t0` is the -absolute timestamp of the first dumped tensor in the dump root. The tensor -may be dumped multiple times in the dump root directory, so a list of -relative timestamps (`numpy.ndarray`) is returned. - -##### Args: - - -* `node_name`: (`str`) name of the node that the tensor is produced by. -* `output_slot`: (`int`) output slot index of tensor. -* `debug_op`: (`str`) name of the debug op. - -##### Returns: - - (`list` of `int`) list of relative timestamps. - -##### Raises: - - -* `ValueError`: If the tensor watch key does not exist in the debug dump data. - - -- - - - -#### `tf_debug.DebugDumpDir.get_tensor_file_paths(node_name, output_slot, debug_op)` {#DebugDumpDir.get_tensor_file_paths} - -Get the file paths from a debug-dumped tensor. - -##### Args: - - -* `node_name`: (`str`) name of the node that the tensor is produced by. -* `output_slot`: (`int`) output slot index of tensor. -* `debug_op`: (`str`) name of the debug op. - -##### Returns: - - List of file path(s) loaded. This is a list because each debugged tensor - may be dumped multiple times. - -##### Raises: - - -* `ValueError`: If the tensor does not exist in the debug-dump data. - - -- - - - -#### `tf_debug.DebugDumpDir.get_tensors(node_name, output_slot, debug_op)` {#DebugDumpDir.get_tensors} - -Get the tensor value from for a debug-dumped tensor. - -The tensor may be dumped multiple times in the dump root directory, so a -list of tensors (`numpy.ndarray`) is returned. - -##### Args: - - -* `node_name`: (`str`) name of the node that the tensor is produced by. -* `output_slot`: (`int`) output slot index of tensor. -* `debug_op`: (`str`) name of the debug op. - -##### Returns: - - List of tensors (`numpy.ndarray`) loaded from the debug-dump file(s). - -##### Raises: - - -* `ValueError`: If the tensor does not exist in the debug-dump data. - - -- - - - -#### `tf_debug.DebugDumpDir.loaded_partition_graphs()` {#DebugDumpDir.loaded_partition_graphs} - -Test whether partition graphs have been loaded. - - -- - - - -#### `tf_debug.DebugDumpDir.node_attributes(node_name)` {#DebugDumpDir.node_attributes} - -Get the attributes of a node. - -##### Args: - - -* `node_name`: Name of the node in question. - -##### Returns: - - Attributes of the node. - -##### Raises: - - -* `LookupError`: If no partition graphs have been loaded. -* `ValueError`: If no node named node_name exists. - - -- - - - -#### `tf_debug.DebugDumpDir.node_device(node_name)` {#DebugDumpDir.node_device} - -Get the device of a node. - -##### Args: - - -* `node_name`: (`str`) name of the node. - -##### Returns: - - (`str`) name of the device on which the node is placed. - -##### Raises: - - -* `LookupError`: If node inputs and control inputs have not been loaded - from partition graphs yet. -* `ValueError`: If the node does not exist in partition graphs. - - -- - - - -#### `tf_debug.DebugDumpDir.node_exists(node_name)` {#DebugDumpDir.node_exists} - -Test if a node exists in the partition graphs. - -##### Args: - - -* `node_name`: (`str`) name of the node to be checked. - -##### Returns: - - A boolean indicating whether the node exists. - -##### Raises: - - -* `LookupError`: If no partition graphs have been loaded yet. - - -- - - - -#### `tf_debug.DebugDumpDir.node_inputs(node_name, is_control=False)` {#DebugDumpDir.node_inputs} - -Get the inputs of given node according to partition graphs. - -##### Args: - - -* `node_name`: Name of the node. -* `is_control`: (`bool`) Whether control inputs, rather than non-control - inputs, are to be returned. - -##### Returns: - - (`list` of `str`) inputs to the node, as a list of node names. - -##### Raises: - - -* `LookupError`: If node inputs and control inputs have not been loaded - from partition graphs yet. -* `ValueError`: If the node does not exist in partition graphs. - - -- - - - -#### `tf_debug.DebugDumpDir.node_op_type(node_name)` {#DebugDumpDir.node_op_type} - -Get the op type of given node. - -##### Args: - - -* `node_name`: (`str`) name of the node. - -##### Returns: - - (`str`) op type of the node. - -##### Raises: - - -* `LookupError`: If node op types have not been loaded - from partition graphs yet. -* `ValueError`: If the node does not exist in partition graphs. - - -- - - - -#### `tf_debug.DebugDumpDir.node_recipients(node_name, is_control=False)` {#DebugDumpDir.node_recipients} - -Get recipient of the given node's output according to partition graphs. - -##### Args: - - -* `node_name`: (`str`) name of the node. -* `is_control`: (`bool`) whether control outputs, rather than non-control - outputs, are to be returned. - -##### Returns: - - (`list` of `str`) all inputs to the node, as a list of node names. - -##### Raises: - - -* `LookupError`: If node inputs and control inputs have not been loaded - from partition graphs yet. -* `ValueError`: If the node does not exist in partition graphs. - - -- - - - -#### `tf_debug.DebugDumpDir.node_traceback(element_name)` {#DebugDumpDir.node_traceback} - -Try to retrieve the Python traceback of node's construction. - -##### Args: - - -* `element_name`: (`str`) Name of a graph element (node or tensor). - -##### Returns: - - (list) The traceback list object as returned by the `extract_trace` - method of Python's traceback module. - -##### Raises: - - -* `LookupError`: If Python graph is not available for traceback lookup. -* `KeyError`: If the node cannot be found in the Python graph loaded. - - -- - - - -#### `tf_debug.DebugDumpDir.nodes()` {#DebugDumpDir.nodes} - -Get a list of all nodes from the partition graphs. - -##### Returns: - - All nodes' names, as a list of str. - -##### Raises: - - -* `LookupError`: If no partition graphs have been loaded. - - -- - - - -#### `tf_debug.DebugDumpDir.partition_graphs()` {#DebugDumpDir.partition_graphs} - -Get the partition graphs. - -##### Returns: - - Partition graphs as repeated fields of GraphDef. - -##### Raises: - - -* `LookupError`: If no partition graphs have been loaded. - - -- - - - -#### `tf_debug.DebugDumpDir.run_feed_keys_info` {#DebugDumpDir.run_feed_keys_info} - -Get a str representation of the feed_dict used in the Session.run() call. - -##### Returns: - - If the information is available, a `str` obtained from `repr(feed_dict)`. - If the information is not available, `None`. - - -- - - - -#### `tf_debug.DebugDumpDir.run_fetches_info` {#DebugDumpDir.run_fetches_info} - -Get a str representation of the fetches used in the Session.run() call. - -##### Returns: - - If the information is available, a `str` obtained from `repr(fetches)`. - If the information is not available, `None`. - - -- - - - -#### `tf_debug.DebugDumpDir.set_python_graph(python_graph)` {#DebugDumpDir.set_python_graph} - -Provide Python `Graph` object to the wrapper. - -Unlike the partition graphs, which are protobuf `GraphDef` objects, `Graph` -is a Python object and carries additional information such as the traceback -of the construction of the nodes in the graph. - -##### Args: - - -* `python_graph`: (ops.Graph) The Python Graph object. - - -- - - - -#### `tf_debug.DebugDumpDir.size` {#DebugDumpDir.size} - -Total number of dumped tensors in the dump root directory. - -##### Returns: - - (`int`) total number of dumped tensors in the dump root directory. - - -- - - - -#### `tf_debug.DebugDumpDir.t0` {#DebugDumpDir.t0} - -Absolute timestamp of the first dumped tensor. - -##### Returns: - - (`int`) absolute timestamp of the first dumped tensor, in microseconds. - - -- - - - -#### `tf_debug.DebugDumpDir.transitive_inputs(node_name, include_control=True)` {#DebugDumpDir.transitive_inputs} - -Get the transitive inputs of given node according to partition graphs. - -##### Args: - - -* `node_name`: Name of the node -* `include_control`: Include control inputs (True by default). - -##### Returns: - - (`list` of `str`) all transitive inputs to the node, as a list of node - names. - -##### Raises: - - -* `LookupError`: If node inputs and control inputs have not been loaded - from partition graphs yet. -* `ValueError`: If the node does not exist in partition graphs. - - -- - - - -#### `tf_debug.DebugDumpDir.watch_key_to_data(debug_watch_key)` {#DebugDumpDir.watch_key_to_data} - -Get all `DebugTensorDatum` instances corresponding to a debug watch key. - -##### Args: - - -* `debug_watch_key`: (`str`) debug watch key. - -##### Returns: - - A list of `DebugTensorDatum` instances that correspond to the debug watch - key. If the watch key does not exist, returns an empty list. - -##### Raises: - - -* `ValueError`: If the debug watch key does not exist. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf_debug.DumpingDebugHook.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf_debug.DumpingDebugHook.md deleted file mode 100644 index 7a2b8936b3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf_debug.DumpingDebugHook.md +++ /dev/null @@ -1,185 +0,0 @@ -A debugger hook that dumps debug data to filesystem. - -Can be used as a monitor/hook for `tf.train.MonitoredSession`s and -`tf.contrib.learn`'s `Estimator`s and `Experiment`s. -- - - - -#### `tf_debug.DumpingDebugHook.__enter__()` {#DumpingDebugHook.__enter__} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.__exit__(exec_type, exec_value, exec_tb)` {#DumpingDebugHook.__exit__} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.__init__(session_root, watch_fn=None, log_usage=True)` {#DumpingDebugHook.__init__} - -Create a local debugger command-line interface (CLI) hook. - -##### Args: - - -* `session_root`: See doc of - `dumping_wrapper.DumpingDebugWrapperSession.__init__`. -* `watch_fn`: See doc of - `dumping_wrapper.DumpingDebugWrapperSession.__init__`. -* `log_usage`: (bool) Whether usage is to be logged. - - -- - - - -#### `tf_debug.DumpingDebugHook.after_create_session(session, coord)` {#DumpingDebugHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf_debug.DumpingDebugHook.after_run(run_context, run_values)` {#DumpingDebugHook.after_run} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.before_run(run_context)` {#DumpingDebugHook.before_run} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.begin()` {#DumpingDebugHook.begin} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.close()` {#DumpingDebugHook.close} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.end(session)` {#DumpingDebugHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - -- - - - -#### `tf_debug.DumpingDebugHook.graph` {#DumpingDebugHook.graph} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.invoke_node_stepper(node_stepper, restore_variable_values_on_exit=True)` {#DumpingDebugHook.invoke_node_stepper} - -See doc of BaseDebugWrapperSession.invoke_node_stepper. - - -- - - - -#### `tf_debug.DumpingDebugHook.on_run_end(request)` {#DumpingDebugHook.on_run_end} - -See doc of BaseDebugWrapperSession.on_run_end. - - -- - - - -#### `tf_debug.DumpingDebugHook.on_run_start(request)` {#DumpingDebugHook.on_run_start} - -See doc of BaseDebugWrapperSession.on_run_start. - - -- - - - -#### `tf_debug.DumpingDebugHook.on_session_init(request)` {#DumpingDebugHook.on_session_init} - -See doc of BaseDebugWrapperSession.on_run_start. - - -- - - - -#### `tf_debug.DumpingDebugHook.partial_run(handle, fetches, feed_dict=None)` {#DumpingDebugHook.partial_run} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.partial_run_setup(fetches, feeds=None)` {#DumpingDebugHook.partial_run_setup} - -Sets up the feeds and fetches for partial runs in the session. - - -- - - - -#### `tf_debug.DumpingDebugHook.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#DumpingDebugHook.run} - -Wrapper around Session.run() that inserts tensor watch options. - -##### Args: - - -* `fetches`: Same as the `fetches` arg to regular `Session.run()`. -* `feed_dict`: Same as the `feed_dict` arg to regular `Session.run()`. -* `options`: Same as the `options` arg to regular `Session.run()`. -* `run_metadata`: Same as the `run_metadata` arg to regular `Session.run()`. - -##### Returns: - - Simply forwards the output of the wrapped `Session.run()` call. - -##### Raises: - - -* `ValueError`: On invalid `OnRunStartAction` value. - - -- - - - -#### `tf_debug.DumpingDebugHook.sess_str` {#DumpingDebugHook.sess_str} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.session` {#DumpingDebugHook.session} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf_debug.has_inf_or_nan.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf_debug.has_inf_or_nan.md deleted file mode 100644 index c896055789..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard4/tf_debug.has_inf_or_nan.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf_debug.has_inf_or_nan(datum, tensor)` {#has_inf_or_nan} - -A predicate for whether a tensor consists of any bad numerical values. - -This predicate is common enough to merit definition in this module. -Bad numerical values include `nan`s and `inf`s. -The signature of this function follows the requirement of the method -`DebugDumpDir.find()`. - -##### Args: - - -* `datum`: (`DebugTensorDatum`) Datum metadata. -* `tensor`: (`numpy.ndarray` or None) Value of the tensor. None represents - an uninitialized tensor. - -##### Returns: - - (`bool`) True if and only if tensor consists of any nan or inf values. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.OpError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.OpError.md deleted file mode 100644 index 650139bf1e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.OpError.md +++ /dev/null @@ -1,66 +0,0 @@ -A generic error that is raised when TensorFlow execution fails. - -Whenever possible, the session will raise a more specific subclass -of `OpError` from the `tf.errors` module. -- - - - -#### `tf.OpError.__init__(node_def, op, message, error_code)` {#OpError.__init__} - -Creates a new `OpError` indicating that a particular op failed. - -##### Args: - - -* `node_def`: The `node_def_pb2.NodeDef` proto representing the op that - failed, if known; otherwise None. -* `op`: The `ops.Operation` that failed, if known; otherwise None. -* `message`: The message string describing the failure. -* `error_code`: The `error_codes_pb2.Code` describing the error. - - -- - - - -#### `tf.OpError.__str__()` {#OpError.__str__} - - - - -- - - - -#### `tf.OpError.error_code` {#OpError.error_code} - -The integer error code that describes the error. - - -- - - - -#### `tf.OpError.message` {#OpError.message} - -The error message that describes the error. - - -- - - - -#### `tf.OpError.node_def` {#OpError.node_def} - -The `NodeDef` proto representing the op that failed. - - -- - - - -#### `tf.OpError.op` {#OpError.op} - -The operation that failed, if known. - -*N.B.* If the failed op was synthesized at runtime, e.g. a `Send` -or `Recv` op, there will be no corresponding -[`Operation`](../../api_docs/python/framework.md#Operation) -object. In that case, this will return `None`, and you should -instead use the [`OpError.node_def`](#OpError.node_def) to -discover information about the op. - -##### Returns: - - The `Operation` that failed, or None. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.RandomShuffleQueue.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.RandomShuffleQueue.md deleted file mode 100644 index 04cf93cec1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.RandomShuffleQueue.md +++ /dev/null @@ -1,312 +0,0 @@ -A queue implementation that dequeues elements in a random order. - -See [`tf.QueueBase`](#QueueBase) for a description of the methods on -this class. -- - - - -#### `tf.RandomShuffleQueue.__init__(capacity, min_after_dequeue, dtypes, shapes=None, names=None, seed=None, shared_name=None, name='random_shuffle_queue')` {#RandomShuffleQueue.__init__} - -Create a queue that dequeues elements in a random order. - -A `RandomShuffleQueue` has bounded capacity; supports multiple -concurrent producers and consumers; and provides exactly-once -delivery. - -A `RandomShuffleQueue` holds a list of up to `capacity` -elements. Each element is a fixed-length tuple of tensors whose -dtypes are described by `dtypes`, and whose shapes are optionally -described by the `shapes` argument. - -If the `shapes` argument is specified, each component of a queue -element must have the respective fixed shape. If it is -unspecified, different queue elements may have different shapes, -but the use of `dequeue_many` is disallowed. - -The `min_after_dequeue` argument allows the caller to specify a -minimum number of elements that will remain in the queue after a -`dequeue` or `dequeue_many` operation completes, to ensure a -minimum level of mixing of elements. This invariant is maintained -by blocking those operations until sufficient elements have been -enqueued. The `min_after_dequeue` argument is ignored after the -queue has been closed. - -##### Args: - - -* `capacity`: An integer. The upper bound on the number of elements - that may be stored in this queue. -* `min_after_dequeue`: An integer (described above). -* `dtypes`: A list of `DType` objects. The length of `dtypes` must equal - the number of tensors in each queue element. -* `shapes`: (Optional.) A list of fully-defined `TensorShape` objects - with the same length as `dtypes`, or `None`. -* `names`: (Optional.) A list of string naming the components in the queue - with the same length as `dtypes`, or `None`. If specified the dequeue - methods return a dictionary with the names as keys. -* `seed`: A Python integer. Used to create a random seed. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `shared_name`: (Optional.) If non-empty, this queue will be shared under - the given name across multiple sessions. -* `name`: Optional name for the queue operation. - - -- - - - -#### `tf.RandomShuffleQueue.close(cancel_pending_enqueues=False, name=None)` {#RandomShuffleQueue.close} - -Closes this queue. - -This operation signals that no more elements will be enqueued in -the given queue. Subsequent `enqueue` and `enqueue_many` -operations will fail. Subsequent `dequeue` and `dequeue_many` -operations will continue to succeed if sufficient elements remain -in the queue. Subsequent `dequeue` and `dequeue_many` operations -that would block will fail immediately. - -If `cancel_pending_enqueues` is `True`, all pending requests will also -be cancelled. - -##### Args: - - -* `cancel_pending_enqueues`: (Optional.) A boolean, defaulting to - `False` (described above). -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that closes the queue. - - -- - - - -#### `tf.RandomShuffleQueue.dequeue(name=None)` {#RandomShuffleQueue.dequeue} - -Dequeues one element from this queue. - -If the queue is empty when this operation executes, it will block -until there is an element to dequeue. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue is empty, and there are no pending -enqueue operations that can fulfill this request, -`tf.errors.OutOfRangeError` will be raised. If the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of tensors that was dequeued. - - -- - - - -#### `tf.RandomShuffleQueue.dequeue_many(n, name=None)` {#RandomShuffleQueue.dequeue_many} - -Dequeues and concatenates `n` elements from this queue. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. All of the -components in the dequeued tuple will have size `n` in the 0th dimension. - -If the queue is closed and there are less than `n` elements left, then an -`OutOfRange` exception is raised. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue contains fewer than `n` elements, and -there are no pending enqueue operations that can fulfill this -request, `tf.errors.OutOfRangeError` will be raised. If the -session is [closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.RandomShuffleQueue.dequeue_up_to(n, name=None)` {#RandomShuffleQueue.dequeue_up_to} - -Dequeues and concatenates `n` elements from this queue. - -**Note** This operation is not supported by all queues. If a queue does not -support DequeueUpTo, then a `tf.errors.UnimplementedError` is raised. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. If the queue -has not been closed, all of the components in the dequeued tuple -will have size `n` in the 0th dimension. - -If the queue is closed and there are more than `0` but fewer than -`n` elements remaining, then instead of raising a -`tf.errors.OutOfRangeError` like [`dequeue_many`](#QueueBase.dequeue_many), -less than `n` elements are returned immediately. If the queue is -closed and there are `0` elements left in the queue, then a -`tf.errors.OutOfRangeError` is raised just like in `dequeue_many`. -Otherwise the behavior is identical to `dequeue_many`. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.RandomShuffleQueue.dtypes` {#RandomShuffleQueue.dtypes} - -The list of dtypes for each component of a queue element. - - -- - - - -#### `tf.RandomShuffleQueue.enqueue(vals, name=None)` {#RandomShuffleQueue.enqueue} - -Enqueues one element to this queue. - -If the queue is full when this operation executes, it will block -until the element has been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary containing - the values to enqueue. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a new tuple of tensors to the queue. - - -- - - - -#### `tf.RandomShuffleQueue.enqueue_many(vals, name=None)` {#RandomShuffleQueue.enqueue_many} - -Enqueues zero or more elements to this queue. - -This operation slices each component tensor along the 0th dimension to -make multiple queue elements. All of the tensors in `vals` must have the -same size in the 0th dimension. - -If the queue is full when this operation executes, it will block -until all of the elements have been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary - from which the queue elements are taken. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a batch of tuples of tensors to the queue. - - -- - - - -#### `tf.RandomShuffleQueue.from_list(index, queues)` {#RandomShuffleQueue.from_list} - -Create a queue using the queue reference from `queues[index]`. - -##### Args: - - -* `index`: An integer scalar tensor that determines the input that gets - selected. -* `queues`: A list of `QueueBase` objects. - -##### Returns: - - A `QueueBase` object. - -##### Raises: - - -* `TypeError`: When `queues` is not a list of `QueueBase` objects, - or when the data types of `queues` are not all the same. - - -- - - - -#### `tf.RandomShuffleQueue.name` {#RandomShuffleQueue.name} - -The name of the underlying queue. - - -- - - - -#### `tf.RandomShuffleQueue.names` {#RandomShuffleQueue.names} - -The list of names for each component of a queue element. - - -- - - - -#### `tf.RandomShuffleQueue.queue_ref` {#RandomShuffleQueue.queue_ref} - -The underlying queue reference. - - -- - - - -#### `tf.RandomShuffleQueue.shapes` {#RandomShuffleQueue.shapes} - -The list of shapes for each component of a queue element. - - -- - - - -#### `tf.RandomShuffleQueue.size(name=None)` {#RandomShuffleQueue.size} - -Compute the number of elements in this queue. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A scalar tensor containing the number of elements in this queue. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.add.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.add.md deleted file mode 100644 index da82da6076..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.add.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.add(x, y, name=None)` {#add} - -Returns x + y element-wise. - -*NOTE*: `Add` supports broadcasting. `AddN` does not. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`, `complex64`, `complex128`, `string`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.asin.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.asin.md deleted file mode 100644 index 64ec024b4c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.asin.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.asin(x, name=None)` {#asin} - -Computes asin of x element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.assert_greater.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.assert_greater.md deleted file mode 100644 index 7020081952..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.assert_greater.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.assert_greater(x, y, data=None, summarize=None, message=None, name=None)` {#assert_greater} - -Assert the condition `x > y` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_greater(x, y)]): - output = tf.reduce_sum(x) -``` - -This condition holds if for every pair of (possibly broadcast) elements -`x[i]`, `y[i]`, we have `x[i] > y[i]`. -If both `x` and `y` are empty, this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `y`: Numeric `Tensor`, same dtype as and broadcastable to `x`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`, `y`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_greater". - -##### Returns: - - Op that raises `InvalidArgumentError` if `x > y` is False. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.assert_integer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.assert_integer.md deleted file mode 100644 index b0cb7d2dbb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.assert_integer.md +++ /dev/null @@ -1,27 +0,0 @@ -### `tf.assert_integer(x, message=None, name=None)` {#assert_integer} - -Assert that `x` is of integer dtype. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_integer(x)]): - output = tf.reduce_sum(x) -``` - -##### Args: - - -* `x`: `Tensor` whose basetype is integer and is not quantized. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_integer". - -##### Raises: - - -* `TypeError`: If `x.dtype` is anything other than non-quantized integer. - -##### Returns: - - A `no_op` that does nothing. Type can be determined statically. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.boolean_mask.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.boolean_mask.md deleted file mode 100644 index 2f6c39a700..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.boolean_mask.md +++ /dev/null @@ -1,43 +0,0 @@ -### `tf.boolean_mask(tensor, mask, name='boolean_mask')` {#boolean_mask} - -Apply boolean mask to tensor. Numpy equivalent is `tensor[mask]`. - -```python -# 1-D example -tensor = [0, 1, 2, 3] -mask = np.array([True, False, True, False]) -boolean_mask(tensor, mask) ==> [0, 2] -``` - -In general, `0 < dim(mask) = K <= dim(tensor)`, and `mask`'s shape must match -the first K dimensions of `tensor`'s shape. We then have: - `boolean_mask(tensor, mask)[i, j1,...,jd] = tensor[i1,...,iK,j1,...,jd]` -where `(i1,...,iK)` is the ith `True` entry of `mask` (row-major order). - -##### Args: - - -* `tensor`: N-D tensor. -* `mask`: K-D boolean tensor, K <= N and K must be known statically. -* `name`: A name for this operation (optional). - -##### Returns: - - (N-K+1)-dimensional tensor populated by entries in `tensor` corresponding - to `True` values in `mask`. - -##### Raises: - - -* `ValueError`: If shapes do not conform. - - -* `Examples`: - -```python -# 2-D example -tensor = [[1, 2], [3, 4], [5, 6]] -mask = np.array([True, False, True]) -boolean_mask(tensor, mask) ==> [[1, 2], [5, 6]] -``` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.broadcast_dynamic_shape.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.broadcast_dynamic_shape.md deleted file mode 100644 index 5dc534473a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.broadcast_dynamic_shape.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.broadcast_dynamic_shape(shape_x, shape_y)` {#broadcast_dynamic_shape} - -Returns the broadcasted dynamic shape between `shape_x` and `shape_y`. - -##### Args: - - -* `shape_x`: A rank 1 integer `Tensor`, representing the shape of x. -* `shape_y`: A rank 1 integer `Tensor`, representing the shape of x. - -##### Returns: - - A rank 1 integer `Tensor` representing the broadcasted shape. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.cast.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.cast.md deleted file mode 100644 index 9571f87afe..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.cast.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.cast(x, dtype, name=None)` {#cast} - -Casts a tensor to a new type. - -The operation casts `x` (in case of `Tensor`) or `x.values` -(in case of `SparseTensor`) to `dtype`. - -For example: - -```python -# tensor `a` is [1.8, 2.2], dtype=tf.float -tf.cast(a, tf.int32) ==> [1, 2] # dtype=tf.int32 -``` - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. -* `dtype`: The destination type. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` with same shape as `x`. - -##### Raises: - - -* `TypeError`: If `x` cannot be cast to the `dtype`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.clip_by_global_norm.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.clip_by_global_norm.md deleted file mode 100644 index a40f621bf4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.clip_by_global_norm.md +++ /dev/null @@ -1,50 +0,0 @@ -### `tf.clip_by_global_norm(t_list, clip_norm, use_norm=None, name=None)` {#clip_by_global_norm} - -Clips values of multiple tensors by the ratio of the sum of their norms. - -Given a tuple or list of tensors `t_list`, and a clipping ratio `clip_norm`, -this operation returns a list of clipped tensors `list_clipped` -and the global norm (`global_norm`) of all tensors in `t_list`. Optionally, -if you've already computed the global norm for `t_list`, you can specify -the global norm with `use_norm`. - -To perform the clipping, the values `t_list[i]` are set to: - - t_list[i] * clip_norm / max(global_norm, clip_norm) - -where: - - global_norm = sqrt(sum([l2norm(t)**2 for t in t_list])) - -If `clip_norm > global_norm` then the entries in `t_list` remain as they are, -otherwise they're all shrunk by the global ratio. - -Any of the entries of `t_list` that are of type `None` are ignored. - -This is the correct way to perform gradient clipping (for example, see -[Pascanu et al., 2012](http://arxiv.org/abs/1211.5063) -([pdf](http://arxiv.org/pdf/1211.5063.pdf))). - -However, it is slower than `clip_by_norm()` because all the parameters must be -ready before the clipping operation can be performed. - -##### Args: - - -* `t_list`: A tuple or list of mixed `Tensors`, `IndexedSlices`, or None. -* `clip_norm`: A 0-D (scalar) `Tensor` > 0. The clipping ratio. -* `use_norm`: A 0-D (scalar) `Tensor` of type `float` (optional). The global - norm to use. If not provided, `global_norm()` is used to compute the norm. -* `name`: A name for the operation (optional). - -##### Returns: - - -* `list_clipped`: A list of `Tensors` of the same type as `list_t`. -* `global_norm`: A 0-D (scalar) `Tensor` representing the global norm. - -##### Raises: - - -* `TypeError`: If `t_list` is not a sequence. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.clip_by_norm.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.clip_by_norm.md deleted file mode 100644 index 22a642aed9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.clip_by_norm.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.clip_by_norm(t, clip_norm, axes=None, name=None)` {#clip_by_norm} - -Clips tensor values to a maximum L2-norm. - -Given a tensor `t`, and a maximum clip value `clip_norm`, this operation -normalizes `t` so that its L2-norm is less than or equal to `clip_norm`, -along the dimensions given in `axes`. Specifically, in the default case -where all dimensions are used for calculation, if the L2-norm of `t` is -already less than or equal to `clip_norm`, then `t` is not modified. If -the L2-norm is greater than `clip_norm`, then this operation returns a -tensor of the same type and shape as `t` with its values set to: - -`t * clip_norm / l2norm(t)` - -In this case, the L2-norm of the output tensor is `clip_norm`. - -As another example, if `t` is a matrix and `axes == [1]`, then each row -of the output will have L2-norm equal to `clip_norm`. If `axes == [0]` -instead, each column of the output will be clipped. - -This operation is typically used to clip gradients before applying them with -an optimizer. - -##### Args: - - -* `t`: A `Tensor`. -* `clip_norm`: A 0-D (scalar) `Tensor` > 0. A maximum clipping value. -* `axes`: A 1-D (vector) `Tensor` of type int32 containing the dimensions - to use for computing the L2-norm. If `None` (the default), uses all - dimensions. -* `name`: A name for the operation (optional). - -##### Returns: - - A clipped `Tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.container.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.container.md deleted file mode 100644 index 44221cd098..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.container.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.container(container_name)` {#container} - -Wrapper for `Graph.container()` using the default graph. - -##### Args: - - -* `container_name`: The container string to use in the context. - -##### Returns: - - A context manager that specifies the default container to use for newly - created stateful ops. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.bayesflow.stochastic_graph.surrogate_loss.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.bayesflow.stochastic_graph.surrogate_loss.md deleted file mode 100644 index 0928e5d001..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.bayesflow.stochastic_graph.surrogate_loss.md +++ /dev/null @@ -1,34 +0,0 @@ -### `tf.contrib.bayesflow.stochastic_graph.surrogate_loss(sample_losses, stochastic_tensors=None, name='SurrogateLoss')` {#surrogate_loss} - -Surrogate loss for stochastic graphs. - -This function will call `loss_fn` on each `StochasticTensor` -upstream of `sample_losses`, passing the losses that it influenced. - -Note that currently `surrogate_loss` does not work with `StochasticTensor`s -instantiated in `while_loop`s or other control structures. - -##### Args: - - -* `sample_losses`: a list or tuple of final losses. Each loss should be per - example in the batch (and possibly per sample); that is, it should have - dimensionality of 1 or greater. All losses should have the same shape. -* `stochastic_tensors`: a list of `StochasticTensor`s to add loss terms for. - If None, defaults to all `StochasticTensor`s in the graph upstream of - the `Tensor`s in `sample_losses`. -* `name`: the name with which to prepend created ops. - -##### Returns: - - `Tensor` loss, which is the sum of `sample_losses` and the - `loss_fn`s returned by the `StochasticTensor`s. - -##### Raises: - - -* `TypeError`: if `sample_losses` is not a list or tuple, or if its elements - are not `Tensor`s. -* `ValueError`: if any loss in `sample_losses` does not have dimensionality 1 - or greater. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.crf.crf_log_norm.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.crf.crf_log_norm.md deleted file mode 100644 index 830a38940f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.crf.crf_log_norm.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.contrib.crf.crf_log_norm(inputs, sequence_lengths, transition_params)` {#crf_log_norm} - -Computes the normalization for a CRF. - -##### Args: - - -* `inputs`: A [batch_size, max_seq_len, num_tags] tensor of unary potentials - to use as input to the CRF layer. -* `sequence_lengths`: A [batch_size] vector of true sequence lengths. -* `transition_params`: A [num_tags, num_tags] transition matrix. - -##### Returns: - - -* `log_norm`: A [batch_size] vector of normalizers for a CRF. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.distributions.bijector.Affine.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.distributions.bijector.Affine.md deleted file mode 100644 index 09cbf17110..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.distributions.bijector.Affine.md +++ /dev/null @@ -1,399 +0,0 @@ -Compute `Y = g(X; shift, scale) = scale @ X + shift`. - -Here `scale = c * I + diag(D1) + tril(L) + V @ diag(D2) @ V.T`. - -In TF parlance, the `scale` term is logically equivalent to: - -```python -scale = ( - scale_identity_multiplier * tf.diag(tf.ones(d)) + - tf.diag(scale_diag) + - scale_tril + - scale_perturb_factor @ diag(scale_perturb_diag) @ - tf.transpose([scale_perturb_factor]) -) -``` - -The `scale` term is applied without necessarily materializing constituent -matrices, i.e., the matmul is [matrix-free]( -https://en.wikipedia.org/wiki/Matrix-free_methods) when possible. - -Examples: - -```python -# Y = X -b = Affine() - -# Y = X + shift -b = Affine(shift=[1., 2, 3]) - -# Y = 2 * I @ X.T + shift -b = Affine(shift=[1., 2, 3], - scale_identity_multiplier=2.) - -# Y = tf.diag(d1) @ X.T + shift -b = Affine(shift=[1., 2, 3], - scale_diag=[-1., 2, 1]) # Implicitly 3x3. - -# Y = (I + v * v.T) @ X.T + shift -b = Affine(shift=[1., 2, 3], - scale_perturb_factor=[[1., 0], - [0, 1], - [1, 1]]) - -# Y = (diag(d1) + v * diag(d2) * v.T) @ X.T + shift -b = Affine(shift=[1., 2, 3], - scale_diag=[1., 3, 3], # Implicitly 3x3. - scale_perturb_diag=[2., 1], # Implicitly 2x2. - scale_perturb_factor=[[1., 0], - [0, 1], - [1, 1]]) - -``` -- - - - -#### `tf.contrib.distributions.bijector.Affine.__init__(shift=None, scale_identity_multiplier=None, scale_diag=None, scale_tril=None, scale_perturb_factor=None, scale_perturb_diag=None, event_ndims=1, validate_args=False, name='affine')` {#Affine.__init__} - -Instantiates the `Affine` bijector. - -This `Bijector` is initialized with `shift` `Tensor` and `scale` arguments, -giving the forward operation: - -```none -Y = g(X) = scale @ X + shift -``` - -where the `scale` term is logically equivalent to: - -```python -scale = ( - scale_identity_multiplier * tf.diag(tf.ones(d)) + - tf.diag(scale_diag) + - scale_tril + - scale_perturb_factor @ diag(scale_perturb_diag) @ - tf.transpose([scale_perturb_factor]) -) -``` - -If none of `scale_identity_multiplier`, `scale_diag`, or `scale_tril` are -specified then `scale += IdentityMatrix`. Otherwise specifying a -`scale` argument has the semantics of `scale += Expand(arg)`, i.e., -`scale_diag != None` means `scale += tf.diag(scale_diag)`. - -##### Args: - - -* `shift`: Floating-point `Tensor`. If this is set to `None`, no shift is - applied. -* `scale_identity_multiplier`: floating point rank 0 `Tensor` representing a - scaling done to the identity matrix. - When `scale_identity_multiplier = scale_diag = scale_tril = None` then - `scale += IdentityMatrix`. Otherwise no scaled-identity-matrix is added - to `scale`. -* `scale_diag`: Floating-point `Tensor` representing the diagonal matrix. - `scale_diag` has shape [N1, N2, ... k], which represents a k x k - diagonal matrix. - When `None` no diagonal term is added to `scale`. -* `scale_tril`: Floating-point `Tensor` representing the diagonal matrix. - `scale_diag` has shape [N1, N2, ... k, k], which represents a k x k - lower triangular matrix. - When `None` no `scale_tril` term is added to `scale`. - The upper triangular elements above the diagonal are ignored. -* `scale_perturb_factor`: Floating-point `Tensor` representing factor matrix - with last two dimensions of shape `(k, r)`. When `None`, no rank-r - update is added to `scale`. -* `scale_perturb_diag`: Floating-point `Tensor` representing the diagonal - matrix. `scale_perturb_diag` has shape [N1, N2, ... r], which - represents an `r x r` diagonal matrix. When `None` low rank updates will - take the form `scale_perturb_factor * scale_perturb_factor.T`. -* `event_ndims`: Scalar `int32` `Tensor` indicating the number of dimensions - associated with a particular draw from the distribution. Must be 0 or 1. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str` name given to ops managed by this object. - -##### Raises: - - -* `ValueError`: if `perturb_diag` is specified but not `perturb_factor`. -* `TypeError`: if `shift` has different `dtype` from `scale` arguments. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.dtype` {#Affine.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.event_ndims` {#Affine.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.forward(x, name='forward')` {#Affine.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.forward_event_shape(input_shape)` {#Affine.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Affine.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Affine.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.graph_parents` {#Affine.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.inverse(y, name='inverse')` {#Affine.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Affine.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.inverse_event_shape(output_shape)` {#Affine.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Affine.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Affine.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.is_constant_jacobian` {#Affine.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.name` {#Affine.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.scale` {#Affine.scale} - -The `scale` `LinearOperator` in `Y = scale @ X + shift`. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.shift` {#Affine.shift} - -The `shift` `Tensor` in `Y = scale @ X + shift`. - - -- - - - -#### `tf.contrib.distributions.bijector.Affine.validate_args` {#Affine.validate_args} - -Returns True if Tensor arguments will be validated. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.distributions.bijector.Chain.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.distributions.bijector.Chain.md deleted file mode 100644 index 98a4130981..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.distributions.bijector.Chain.md +++ /dev/null @@ -1,324 +0,0 @@ -Bijector which applies a sequence of bijectors. - -Example Use: - -```python -chain = Chain([Exp(), Softplus()], name="one_plus_exp") -``` - -Results in: - -* Forward: - - ```python - exp = Exp() - softplus = Softplus() - Chain([exp, softplus]).forward(x) - = exp.forward(softplus.forward(x)) - = tf.exp(tf.log(1. + tf.exp(x))) - = 1. + tf.exp(x) - ``` - -* Inverse: - - ```python - exp = Exp() - softplus = Softplus() - Chain([exp, softplus]).inverse(y) - = softplus.inverse(exp.inverse(y)) - = tf.log(tf.exp(tf.log(y)) - 1.) - = tf.log(y - 1.) - ``` -- - - - -#### `tf.contrib.distributions.bijector.Chain.__init__(bijectors=(), validate_args=False, name=None)` {#Chain.__init__} - -Instantiates `Chain` bijector. - -##### Args: - - -* `bijectors`: Python list of bijector instances. An empty list makes this - bijector equivalent to the `Identity` bijector. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str`, name given to ops managed by this object. Default: - E.g., `Chain([Exp(), Softplus()]).name == "chain_of_exp_of_softplus"`. - -##### Raises: - - -* `ValueError`: if bijectors have different dtypes. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.bijectors` {#Chain.bijectors} - - - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.dtype` {#Chain.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.event_ndims` {#Chain.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.forward(x, name='forward')` {#Chain.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.forward_event_shape(input_shape)` {#Chain.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Chain.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Chain.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.graph_parents` {#Chain.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.inverse(y, name='inverse')` {#Chain.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Chain.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.inverse_event_shape(output_shape)` {#Chain.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Chain.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Chain.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.is_constant_jacobian` {#Chain.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.name` {#Chain.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Chain.validate_args` {#Chain.validate_args} - -Returns True if Tensor arguments will be validated. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.distributions.bijector.Exp.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.distributions.bijector.Exp.md deleted file mode 100644 index 9fde10ec22..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.distributions.bijector.Exp.md +++ /dev/null @@ -1,305 +0,0 @@ -Compute `Y = g(X) = exp(X)`. - -Example Use: - -```python -# Create the Y=g(X)=exp(X) transform which works only on Tensors with 1 -# batch ndim and 2 event ndims (i.e., vector of matrices). -exp = Exp(event_ndims=2) -x = [[[1., 2], - [3, 4]], - [[5, 6], - [7, 8]]] -exp(x) == exp.forward(x) -log(x) == exp.inverse(x) -``` - -Note: the exp(.) is applied element-wise but the Jacobian is a reduction -over the event space. -- - - - -#### `tf.contrib.distributions.bijector.Exp.__init__(event_ndims=0, validate_args=False, name='exp')` {#Exp.__init__} - -Instantiates the `Exp` bijector. - -##### Args: - - -* `event_ndims`: Scalar `int32` `Tensor` indicating the number of dimensions - associated with a particular draw from the distribution. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str` name given to ops managed by this object. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.dtype` {#Exp.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.event_ndims` {#Exp.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.forward(x, name='forward')` {#Exp.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.forward_event_shape(input_shape)` {#Exp.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Exp.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Exp.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.graph_parents` {#Exp.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.inverse(y, name='inverse')` {#Exp.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Exp.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.inverse_event_shape(output_shape)` {#Exp.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Exp.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Exp.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.is_constant_jacobian` {#Exp.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.name` {#Exp.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.power` {#Exp.power} - -The `c` in: `Y = g(X) = (1 + X * c)**(1 / c)`. - - -- - - - -#### `tf.contrib.distributions.bijector.Exp.validate_args` {#Exp.validate_args} - -Returns True if Tensor arguments will be validated. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.arg_scoped_arguments.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.arg_scoped_arguments.md deleted file mode 100644 index 507c28206d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.arg_scoped_arguments.md +++ /dev/null @@ -1,13 +0,0 @@ -### `tf.contrib.framework.arg_scoped_arguments(func)` {#arg_scoped_arguments} - -Returns the list kwargs that arg_scope can set for a func. - -##### Args: - - -* `func`: function which has been decorated with @add_arg_scope. - -##### Returns: - - a list of kwargs names. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.get_variables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.get_variables.md deleted file mode 100644 index e74c25d4a4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.get_variables.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.contrib.framework.get_variables(scope=None, suffix=None, collection='variables')` {#get_variables} - -Gets the list of variables, filtered by scope and/or suffix. - -##### Args: - - -* `scope`: an optional scope for filtering the variables to return. Can be a - variable scope or a string. -* `suffix`: an optional suffix for filtering the variables to return. -* `collection`: in which collection search for. Defaults to - `GraphKeys.GLOBAL_VARIABLES`. - -##### Returns: - - a list of variables in collection with scope and suffix. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.list_variables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.list_variables.md deleted file mode 100644 index fc8cceb6b1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.list_variables.md +++ /dev/null @@ -1,13 +0,0 @@ -### `tf.contrib.framework.list_variables(checkpoint_dir)` {#list_variables} - -Returns list of all variables in the latest checkpoint. - -##### Args: - - -* `checkpoint_dir`: Directory with checkpoints file or path to checkpoint. - -##### Returns: - - List of tuples `(name, shape)`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.variable.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.variable.md deleted file mode 100644 index 79081d4e9f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.framework.variable.md +++ /dev/null @@ -1,33 +0,0 @@ -### `tf.contrib.framework.variable(*args, **kwargs)` {#variable} - -Gets an existing variable with these parameters or creates a new one. - -##### Args: - - -* `name`: the name of the new or existing variable. -* `shape`: shape of the new or existing variable. -* `dtype`: type of the new or existing variable (defaults to `DT_FLOAT`). -* `initializer`: initializer for the variable if one is created. -* `regularizer`: a (Tensor -> Tensor or None) function; the result of - applying it on a newly created variable will be added to the collection - GraphKeys.REGULARIZATION_LOSSES and can be used for regularization. -* `trainable`: If `True` also add the variable to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see `tf.Variable`). -* `collections`: A list of collection names to which the Variable will be added. - If None it would default to `tf.GraphKeys.GLOBAL_VARIABLES`. -* `caching_device`: Optional device string or function describing where the - Variable should be cached for reading. Defaults to the Variable's - device. -* `device`: Optional device to place the variable. It can be an string or a - function that is called to get the device for the variable. -* `partitioner`: Optional callable that accepts a fully defined `TensorShape` - and dtype of the `Variable` to be created, and returns a list of - partitions for each axis (currently only one axis can be partitioned). -* `custom_getter`: Callable that allows overwriting the internal - get_variable method and has to have the same signature. - -##### Returns: - - The created or existing variable. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.bypass.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.bypass.md deleted file mode 100644 index 987a242d90..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.bypass.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.contrib.graph_editor.bypass(sgv)` {#bypass} - -Bypass the given subgraph by connecting its inputs to its outputs. - -##### Args: - - -* `sgv`: the subgraph view to be bypassed. This argument is converted to a - subgraph using the same rules than the function subgraph.make_view. - Note that sgv is modified in place. - -##### Returns: - - A tuple `(sgv, detached_inputs)` where: - `sgv` is a new subgraph view of the bypassed subgraph; - `detached_inputs` is a list of the created input placeholders. - -##### Raises: - - -* `StandardError`: if sgv cannot be converted to a SubGraphView using - the same rules than the function subgraph.make_view. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.can_be_regex.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.can_be_regex.md deleted file mode 100644 index 212faafdc4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.can_be_regex.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.graph_editor.can_be_regex(obj)` {#can_be_regex} - -Return True if obj can be turned into a regular expression. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.detach_control_outputs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.detach_control_outputs.md deleted file mode 100644 index 4488755c9b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.detach_control_outputs.md +++ /dev/null @@ -1,11 +0,0 @@ -### `tf.contrib.graph_editor.detach_control_outputs(sgv, control_outputs)` {#detach_control_outputs} - -Detach all the external control outputs of the subgraph sgv. - -##### Args: - - -* `sgv`: the subgraph view to be detached. This argument is converted to a - subgraph using the same rules as the function subgraph.make_view. -* `control_outputs`: a util.ControlOutputs instance. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.get_walks_intersection_ops.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.get_walks_intersection_ops.md deleted file mode 100644 index 355b6301f8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.get_walks_intersection_ops.md +++ /dev/null @@ -1,39 +0,0 @@ -### `tf.contrib.graph_editor.get_walks_intersection_ops(forward_seed_ops, backward_seed_ops, forward_inclusive=True, backward_inclusive=True, within_ops=None, control_inputs=False, control_outputs=None, control_ios=None)` {#get_walks_intersection_ops} - -Return the intersection of a forward and a backward walk. - -##### Args: - - -* `forward_seed_ops`: an iterable of operations from which the forward graph - walk starts. If a list of tensors is given instead, the seed_ops are set - to be the consumers of those tensors. -* `backward_seed_ops`: an iterable of operations from which the backward graph - walk starts. If a list of tensors is given instead, the seed_ops are set - to be the generators of those tensors. -* `forward_inclusive`: if True the given forward_seed_ops are also part of the - resulting set. -* `backward_inclusive`: if True the given backward_seed_ops are also part of the - resulting set. -* `within_ops`: an iterable of tf.Operation within which the search is - restricted. If within_ops is None, the search is performed within - the whole graph. -* `control_inputs`: A boolean indicating whether control inputs are enabled. -* `control_outputs`: An instance of util.ControlOutputs or None. If not None, - control outputs are enabled. -* `control_ios`: An instance of util.ControlOutputs or None. If not None, both - control inputs and control outputs are enabled. This is equivalent to set - control_inputs to True and control_outputs to the util.ControlOutputs - instance. - -##### Returns: - - A Python set of all the tf.Operation in the intersection of a forward and a - backward walk. - -##### Raises: - - -* `TypeError`: if `forward_seed_ops` or `backward_seed_ops` or `within_ops` - cannot be converted to a list of `tf.Operation`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.make_regex.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.make_regex.md deleted file mode 100644 index e0aaae10b7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.make_regex.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.contrib.graph_editor.make_regex(obj)` {#make_regex} - -Return a compiled regular expression. - -##### Args: - - -* `obj`: a string or a regular expression. - -##### Returns: - - A compiled regular expression. - -##### Raises: - - -* `ValueError`: if obj could not be converted to a regular expression. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.remove_control_inputs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.remove_control_inputs.md deleted file mode 100644 index 59b3630485..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.graph_editor.remove_control_inputs.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.contrib.graph_editor.remove_control_inputs(op, cops)` {#remove_control_inputs} - -Remove the control inputs cops from co. - -Warning: this function is directly manipulating the internals of the -`tf.Graph`. - -##### Args: - - -* `op`: a `tf.Operation` from which to remove the control inputs. -* `cops`: an object convertible to a list of `tf.Operation`. - -##### Raises: - - -* `TypeError`: if op is not a `tf.Operation`. -* `ValueError`: if any cop in cops is not a control input of op. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.convolution2d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.convolution2d.md deleted file mode 100644 index 40141a83f6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.convolution2d.md +++ /dev/null @@ -1,75 +0,0 @@ -### `tf.contrib.layers.convolution2d(*args, **kwargs)` {#convolution2d} - -Adds an N-D convolution followed by an optional batch_norm layer. - -It is required that 1 <= N <= 3. - -`convolution` creates a variable called `weights`, representing the -convolutional kernel, that is convolved (actually cross-correlated) with the -`inputs` to produce a `Tensor` of activations. If a `normalizer_fn` is -provided (such as `batch_norm`), it is then applied. Otherwise, if -`normalizer_fn` is None and a `biases_initializer` is provided then a `biases` -variable would be created and added the activations. Finally, if -`activation_fn` is not `None`, it is applied to the activations as well. - -Performs a'trous convolution with input stride/dilation rate equal to `rate` -if a value > 1 for any dimension of `rate` is specified. In this case -`stride` values != 1 are not supported. - -##### Args: - - -* `inputs`: A Tensor of rank N+2 of shape - `[batch_size] + input_spatial_shape + [in_channels]` if data_format does - not start with "NC" (default), or - `[batch_size, in_channels] + input_spatial_shape` if data_format starts - with "NC". -* `num_outputs`: Integer, the number of output filters. -* `kernel_size`: A sequence of N positive integers specifying the spatial - dimensions of of the filters. Can be a single integer to specify the same - value for all spatial dimensions. -* `stride`: A sequence of N positive integers specifying the stride at which to - compute output. Can be a single integer to specify the same value for all - spatial dimensions. Specifying any `stride` value != 1 is incompatible - with specifying any `rate` value != 1. -* `padding`: One of `"VALID"` or `"SAME"`. -* `data_format`: A string or None. Specifies whether the channel dimension of - the `input` and output is the last dimension (default, or if `data_format` - does not start with "NC"), or the second dimension (if `data_format` - starts with "NC"). For N=1, the valid values are "NWC" (default) and - "NCW". For N=2, the valid values are "NHWC" (default) and "NCHW". For - N=3, currently the only valid value is "NDHWC". -* `rate`: A sequence of N positive integers specifying the dilation rate to use - for a'trous convolution. Can be a single integer to specify the same - value for all spatial dimensions. Specifying any `rate` value != 1 is - incompatible with specifying any `stride` value != 1. -* `activation_fn`: Activation function. The default value is a ReLU function. - Explicitly set it to None to skip it and maintain a linear activation. -* `normalizer_fn`: Normalization function to use instead of `biases`. If - `normalizer_fn` is provided then `biases_initializer` and - `biases_regularizer` are ignored and `biases` are not created nor added. - default set to None for no normalizer function -* `normalizer_params`: Normalization function parameters. -* `weights_initializer`: An initializer for the weights. -* `weights_regularizer`: Optional regularizer for the weights. -* `biases_initializer`: An initializer for the biases. If None skip biases. -* `biases_regularizer`: Optional regularizer for the biases. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional list of collections for all the variables or - a dictionary containing a different list of collection per variable. -* `outputs_collections`: Collection to add the outputs. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for `variable_scope`. - -##### Returns: - - A tensor representing the output of the operation. - -##### Raises: - - -* `ValueError`: If `data_format` is invalid. -* `ValueError`: Both 'rate' and `stride` are not uniformly 1. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.fully_connected.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.fully_connected.md deleted file mode 100644 index 846a09e3bb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.fully_connected.md +++ /dev/null @@ -1,50 +0,0 @@ -### `tf.contrib.layers.fully_connected(*args, **kwargs)` {#fully_connected} - -Adds a fully connected layer. - -`fully_connected` creates a variable called `weights`, representing a fully -connected weight matrix, which is multiplied by the `inputs` to produce a -`Tensor` of hidden units. If a `normalizer_fn` is provided (such as -`batch_norm`), it is then applied. Otherwise, if `normalizer_fn` is -None and a `biases_initializer` is provided then a `biases` variable would be -created and added the hidden units. Finally, if `activation_fn` is not `None`, -it is applied to the hidden units as well. - -Note: that if `inputs` have a rank greater than 2, then `inputs` is flattened -prior to the initial matrix multiply by `weights`. - -##### Args: - - -* `inputs`: A tensor of at least rank 2 and static value for the last dimension; - i.e. `[batch_size, depth]`, `[None, None, None, channels]`. -* `num_outputs`: Integer or long, the number of output units in the layer. -* `activation_fn`: Activation function. The default value is a ReLU function. - Explicitly set it to None to skip it and maintain a linear activation. -* `normalizer_fn`: Normalization function to use instead of `biases`. If - `normalizer_fn` is provided then `biases_initializer` and - `biases_regularizer` are ignored and `biases` are not created nor added. - default set to None for no normalizer function -* `normalizer_params`: Normalization function parameters. -* `weights_initializer`: An initializer for the weights. -* `weights_regularizer`: Optional regularizer for the weights. -* `biases_initializer`: An initializer for the biases. If None skip biases. -* `biases_regularizer`: Optional regularizer for the biases. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional list of collections for all the variables or - a dictionary containing a different list of collections per variable. -* `outputs_collections`: Collection to add the outputs. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for variable_scope. - -##### Returns: - - The tensor variable representing the result of the series of operations. - -##### Raises: - - -* `ValueError`: If x has rank less than 2 or if its last dimension is not set. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.legacy_fully_connected.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.legacy_fully_connected.md deleted file mode 100644 index f10993af30..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.legacy_fully_connected.md +++ /dev/null @@ -1,73 +0,0 @@ -### `tf.contrib.layers.legacy_fully_connected(x, num_output_units, activation_fn=None, weight_init=_initializer, bias_init=Zeros(), name=None, weight_collections=('weights',), bias_collections=('biases',), output_collections=('activations',), trainable=True, weight_regularizer=None, bias_regularizer=None)` {#legacy_fully_connected} - -Adds the parameters for a fully connected layer and returns the output. - -A fully connected layer is generally defined as a matrix multiply: -`y = f(w * x + b)` where `f` is given by `activation_fn`. If -`activation_fn` is `None`, the result of `y = w * x + b` is -returned. - -If `x` has shape [\\\(\\text{dim}_0, \\text{dim}_1, ..., \\text{dim}_n\\\)] -with more than 2 dimensions (\\\(n > 1\\\)), then we repeat the matrix -multiply along the first dimensions. The result r is a tensor of shape -[\\\(\\text{dim}_0, ..., \\text{dim}_{n-1},\\\) `num_output_units`], -where \\\( r_{i_0, ..., i_{n-1}, k} = -\\sum_{0 \\leq j < \\text{dim}_n} x_{i_0, ... i_{n-1}, j} \cdot w_{j, k}\\\). -This is accomplished by reshaping `x` to 2-D -[\\\(\\text{dim}_0 \\cdot ... \\cdot \\text{dim}_{n-1}, \\text{dim}_n\\\)] -before the matrix multiply and afterwards reshaping it to -[\\\(\\text{dim}_0, ..., \\text{dim}_{n-1},\\\) `num_output_units`]. - -This op creates `w` and optionally `b`. Bias (`b`) can be disabled by setting -`bias_init` to `None`. - -The variable creation is compatible with `tf.variable_scope` and so can be -reused with `tf.variable_scope` or `tf.make_template`. - -Most of the details of variable creation can be controlled by specifying the -initializers (`weight_init` and `bias_init`) and in which collections to place -the created variables (`weight_collections` and `bias_collections`; note that -the variables are always added to the `VARIABLES` collection). The output of -the layer can be placed in custom collections using `output_collections`. -The collections arguments default to `WEIGHTS`, `BIASES` and `ACTIVATIONS`, -respectively. - -A per layer regularization can be specified by setting `weight_regularizer` -and `bias_regularizer`, which are applied to the weights and biases -respectively, and whose output is added to the `REGULARIZATION_LOSSES` -collection. - -##### Args: - - -* `x`: The input `Tensor`. -* `num_output_units`: The size of the output. -* `activation_fn`: Activation function, default set to None to skip it and - maintain a linear activation. -* `weight_init`: An optional weight initialization, defaults to - `xavier_initializer`. -* `bias_init`: An initializer for the bias, defaults to 0. Set to `None` in - order to disable bias. -* `name`: The name for this operation is used to name operations and to find - variables. If specified it must be unique for this scope, otherwise a - unique name starting with "fully_connected" will be created. See - `tf.variable_scope` for details. -* `weight_collections`: List of graph collections to which weights are added. -* `bias_collections`: List of graph collections to which biases are added. -* `output_collections`: List of graph collections to which outputs are added. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `weight_regularizer`: A regularizer like the result of - `l1_regularizer` or `l2_regularizer`. Used for weights. -* `bias_regularizer`: A regularizer like the result of - `l1_regularizer` or `l2_regularizer`. Used for biases. - -##### Returns: - - The output of the fully connected layer. - -##### Raises: - - -* `ValueError`: If x has rank less than 2 or if its last dimension is not set. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.multi_class_target.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.multi_class_target.md deleted file mode 100644 index a1ef504e4e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.multi_class_target.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.contrib.layers.multi_class_target(*args, **kwargs)` {#multi_class_target} - -Creates a _TargetColumn for multi class single label classification. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-11-12. -Instructions for updating: -This file will be removed after the deprecation date.Please switch to third_party/tensorflow/contrib/learn/python/learn/estimators/head.py - -The target column uses softmax cross entropy loss. - -##### Args: - - -* `n_classes`: Integer, number of classes, must be >= 2 -* `label_name`: String, name of the key in label dict. Can be null if label - is a tensor (single headed models). -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. It - will be multiplied by the loss of the example. - -##### Returns: - - An instance of _MultiClassTargetColumn. - -##### Raises: - - -* `ValueError`: if n_classes is < 2 - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.one_hot_encoding.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.one_hot_encoding.md deleted file mode 100644 index 7cc66041ea..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.one_hot_encoding.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.contrib.layers.one_hot_encoding(*args, **kwargs)` {#one_hot_encoding} - -Transform numeric labels into onehot_labels using `tf.one_hot`. - -##### Args: - - -* `labels`: [batch_size] target labels. -* `num_classes`: Total number of classes. -* `on_value`: A scalar defining the on-value. -* `off_value`: A scalar defining the off-value. -* `outputs_collections`: Collection to add the outputs. -* `scope`: Optional scope for name_scope. - -##### Returns: - - One-hot encoding of the labels. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.scattered_embedding_column.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.scattered_embedding_column.md deleted file mode 100644 index b905120ec4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.scattered_embedding_column.md +++ /dev/null @@ -1,51 +0,0 @@ -### `tf.contrib.layers.scattered_embedding_column(column_name, size, dimension, hash_key, combiner='mean', initializer=None)` {#scattered_embedding_column} - -Creates an embedding column of a sparse feature using parameter hashing. - -The i-th embedding component of a value v is found by retrieving an -embedding weight whose index is a fingerprint of the pair (v,i). - -An embedding column with sparse_column_with_hash_bucket such as - embedding_column( - sparse_column_with_hash_bucket(column_name, bucket_size), - dimension) - -could be replaced by - scattered_embedding_column( - column_name, size=bucket_size * dimension, dimension=dimension, - hash_key=tf.contrib.layers.SPARSE_FEATURE_CROSS_DEFAULT_HASH_KEY) - -for the same number of embedding parameters and hopefully reduced impact of -collisions with a cost of slowing down training. - -##### Args: - - -* `column_name`: A string defining sparse column name. -* `size`: An integer specifying the number of parameters in the embedding layer. -* `dimension`: An integer specifying dimension of the embedding. -* `hash_key`: Specify the hash_key that will be used by the `FingerprintCat64` - function to combine the crosses fingerprints on SparseFeatureCrossOp. -* `combiner`: A string specifying how to reduce if there are multiple entries - in a single row. Currently "mean", "sqrtn" and "sum" are supported, with - "mean" the default. "sqrtn" often achieves good accuracy, in particular - with bag-of-words columns. Each of this can be thought as example level - normalizations on the column: - * "sum": do not normalize features in the column - * "mean": do l1 normalization on features in the column - * "sqrtn": do l2 normalization on features in the column - For more information: `tf.embedding_lookup_sparse`. -* `initializer`: A variable initializer function to be used in embedding - variable initialization. If not specified, defaults to - `tf.truncated_normal_initializer` with mean 0 and standard deviation 0.1. - -##### Returns: - - A _ScatteredEmbeddingColumn. - -##### Raises: - - -* `ValueError`: if dimension or size is not a positive integer; or if combiner - is not supported. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.sum_regularizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.sum_regularizer.md deleted file mode 100644 index 4ea32c2135..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.sum_regularizer.md +++ /dev/null @@ -1,15 +0,0 @@ -### `tf.contrib.layers.sum_regularizer(regularizer_list, scope=None)` {#sum_regularizer} - -Returns a function that applies the sum of multiple regularizers. - -##### Args: - - -* `regularizer_list`: A list of regularizers to apply. -* `scope`: An optional scope name - -##### Returns: - - A function with signature `sum_reg(weights)` that applies the - sum of all the input regularizers. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.summarize_collection.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.summarize_collection.md deleted file mode 100644 index b1b5f56056..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.layers.summarize_collection.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.layers.summarize_collection(collection, name_filter=None, summarizer=summarize_tensor)` {#summarize_collection} - -Summarize a graph collection of tensors, possibly filtered by name. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.monitors.BaseMonitor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.monitors.BaseMonitor.md deleted file mode 100644 index bea2cc6516..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.monitors.BaseMonitor.md +++ /dev/null @@ -1,187 +0,0 @@ -Base class for Monitors. - -Defines basic interfaces of Monitors. -Monitors can either be run on all workers or, more commonly, restricted -to run exclusively on the elected chief worker. -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.__init__(*args, **kwargs)` {#BaseMonitor.__init__} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-05. -Instructions for updating: -Monitors are deprecated. Please use tf.train.SessionRunHook. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.begin(max_steps=None)` {#BaseMonitor.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.end(session=None)` {#BaseMonitor.end} - -Callback at the end of training/evaluation. - -##### Args: - - -* `session`: A `tf.Session` object that can be used to run ops. - -##### Raises: - - -* `ValueError`: if we've not begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.epoch_begin(epoch)` {#BaseMonitor.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.epoch_end(epoch)` {#BaseMonitor.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.post_step(step, session)` {#BaseMonitor.post_step} - -Callback after the step is finished. - -Called after step_end and receives session to perform extra session.run -calls. If failure occurred in the process, will be called as well. - -##### Args: - - -* `step`: `int`, global step of the model. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.run_on_all_workers` {#BaseMonitor.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.set_estimator(estimator)` {#BaseMonitor.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.step_begin(step)` {#BaseMonitor.step_begin} - -Callback before training step begins. - -You may use this callback to request evaluation of additional tensors -in the graph. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - List of `Tensor` objects or string tensor names to be run. - -##### Raises: - - -* `ValueError`: if we've already begun a step, or `step` < 0, or - `step` > `max_steps`. - - -- - - - -#### `tf.contrib.learn.monitors.BaseMonitor.step_end(step, output)` {#BaseMonitor.step_end} - -Callback after training step finished. - -This callback provides access to the tensors/ops evaluated at this step, -including the additional tensors for which evaluation was requested in -`step_begin`. - -In addition, the callback has the opportunity to stop training by returning -`True`. This is useful for early stopping, for example. - -Note that this method is not called if the call to `Session.run()` that -followed the last call to `step_begin()` failed. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`. True if training should stop. - -##### Raises: - - -* `ValueError`: if we've not begun a step, or `step` number does not match. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.monitors.CheckpointSaver.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.monitors.CheckpointSaver.md deleted file mode 100644 index 310b927376..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.monitors.CheckpointSaver.md +++ /dev/null @@ -1,146 +0,0 @@ -Saves checkpoints every N steps or N seconds. -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.__init__(checkpoint_dir, save_secs=None, save_steps=None, saver=None, checkpoint_basename='model.ckpt', scaffold=None)` {#CheckpointSaver.__init__} - -Initialize CheckpointSaver monitor. - -##### Args: - - -* `checkpoint_dir`: `str`, base directory for the checkpoint files. -* `save_secs`: `int`, save every N secs. -* `save_steps`: `int`, save every N steps. -* `saver`: `Saver` object, used for saving. -* `checkpoint_basename`: `str`, base name for the checkpoint files. -* `scaffold`: `Scaffold`, use to get saver object. - -##### Raises: - - -* `ValueError`: If both `save_steps` and `save_secs` are not `None`. -* `ValueError`: If both `save_steps` and `save_secs` are `None`. - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.begin(max_steps=None)` {#CheckpointSaver.begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.end(session=None)` {#CheckpointSaver.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.epoch_begin(epoch)` {#CheckpointSaver.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.epoch_end(epoch)` {#CheckpointSaver.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.post_step(step, session)` {#CheckpointSaver.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.run_on_all_workers` {#CheckpointSaver.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.set_estimator(estimator)` {#CheckpointSaver.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.step_begin(step)` {#CheckpointSaver.step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.CheckpointSaver.step_end(step, output)` {#CheckpointSaver.step_end} - -Callback after training step finished. - -This callback provides access to the tensors/ops evaluated at this step, -including the additional tensors for which evaluation was requested in -`step_begin`. - -In addition, the callback has the opportunity to stop training by returning -`True`. This is useful for early stopping, for example. - -Note that this method is not called if the call to `Session.run()` that -followed the last call to `step_begin()` failed. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`. True if training should stop. - -##### Raises: - - -* `ValueError`: if we've not begun a step, or `step` number does not match. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.monitors.RunHookAdapterForMonitors.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.monitors.RunHookAdapterForMonitors.md deleted file mode 100644 index 4f1e3dcc94..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.monitors.RunHookAdapterForMonitors.md +++ /dev/null @@ -1,57 +0,0 @@ -Wraps monitors into a SessionRunHook. -- - - - -#### `tf.contrib.learn.monitors.RunHookAdapterForMonitors.__init__(monitors)` {#RunHookAdapterForMonitors.__init__} - - - - -- - - - -#### `tf.contrib.learn.monitors.RunHookAdapterForMonitors.after_create_session(session, coord)` {#RunHookAdapterForMonitors.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.contrib.learn.monitors.RunHookAdapterForMonitors.after_run(run_context, run_values)` {#RunHookAdapterForMonitors.after_run} - - - - -- - - - -#### `tf.contrib.learn.monitors.RunHookAdapterForMonitors.before_run(run_context)` {#RunHookAdapterForMonitors.before_run} - - - - -- - - - -#### `tf.contrib.learn.monitors.RunHookAdapterForMonitors.begin()` {#RunHookAdapterForMonitors.begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.RunHookAdapterForMonitors.end(session)` {#RunHookAdapterForMonitors.end} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.run_n.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.run_n.md deleted file mode 100644 index 69abb2628d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.learn.run_n.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.contrib.learn.run_n(*args, **kwargs)` {#run_n} - -Run `output_dict` tensors `n` times, with the same `feed_dict` each run. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-02-15. -Instructions for updating: -graph_actions.py will be deleted. Use tf.train.* utilities instead. You can use learn/estimators/estimator.py as an example. - -##### Args: - - -* `output_dict`: A `dict` mapping string names to tensors to run. Must all be - from the same graph. -* `feed_dict`: `dict` of input values to feed each run. -* `restore_checkpoint_path`: A string containing the path to a checkpoint to - restore. -* `n`: Number of times to repeat. - -##### Returns: - - A list of `n` `dict` objects, each containing values read from `output_dict` - tensors. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.legacy_seq2seq.sequence_loss_by_example.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.legacy_seq2seq.sequence_loss_by_example.md deleted file mode 100644 index a7b6c99c9a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.legacy_seq2seq.sequence_loss_by_example.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.contrib.legacy_seq2seq.sequence_loss_by_example(logits, targets, weights, average_across_timesteps=True, softmax_loss_function=None, name=None)` {#sequence_loss_by_example} - -Weighted cross-entropy loss for a sequence of logits (per example). - -##### Args: - - -* `logits`: List of 2D Tensors of shape [batch_size x num_decoder_symbols]. -* `targets`: List of 1D batch-sized int32 Tensors of the same length as logits. -* `weights`: List of 1D batch-sized float-Tensors of the same length as logits. -* `average_across_timesteps`: If set, divide the returned cost by the total - label weight. -* `softmax_loss_function`: Function (labels-batch, inputs-batch) -> loss-batch - to be used instead of the standard softmax (the default if this is None). -* `name`: Optional name for this operation, default: "sequence_loss_by_example". - -##### Returns: - - 1D batch-sized float Tensor: The log-perplexity for each sequence. - -##### Raises: - - -* `ValueError`: If len(logits) is different from len(targets) or len(weights). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.losses.sigmoid_cross_entropy.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.losses.sigmoid_cross_entropy.md deleted file mode 100644 index 9917476e28..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.losses.sigmoid_cross_entropy.md +++ /dev/null @@ -1,39 +0,0 @@ -### `tf.contrib.losses.sigmoid_cross_entropy(*args, **kwargs)` {#sigmoid_cross_entropy} - -Creates a cross-entropy loss using tf.nn.sigmoid_cross_entropy_with_logits. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.sigmoid_cross_entropy instead. Note that the order of the predictions and labels arguments was changed. - -`weights` acts as a coefficient for the loss. If a scalar is provided, -then the loss is simply scaled by the given value. If `weights` is a -tensor of size [`batch_size`], then the loss weights apply to each -corresponding sample. - -If `label_smoothing` is nonzero, smooth the labels towards 1/2: - - new_multiclass_labels = multiclass_labels * (1 - label_smoothing) - + 0.5 * label_smoothing - -##### Args: - - -* `logits`: [batch_size, num_classes] logits outputs of the network . -* `multi_class_labels`: [batch_size, num_classes] labels in (0, 1). -* `weights`: Coefficients for the loss. The tensor must be a scalar, a tensor of - shape [batch_size] or shape [batch_size, num_classes]. -* `label_smoothing`: If greater than 0 then smooth the labels. -* `scope`: The scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the loss value. - -##### Raises: - - -* `ValueError`: If the shape of `logits` doesn't match that of - `multi_class_labels` or if the shape of `weights` is invalid, or if - `weights` is None. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.accuracy.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.accuracy.md deleted file mode 100644 index 71a82cb248..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.accuracy.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.contrib.metrics.accuracy(predictions, labels, weights=None)` {#accuracy} - -Computes the percentage of times that predictions matches labels. - -##### Args: - - -* `predictions`: the predicted values, a `Tensor` whose dtype and shape - matches 'labels'. -* `labels`: the ground truth values, a `Tensor` of any shape and - bool, integer, or string dtype. -* `weights`: None or `Tensor` of float values to reweight the accuracy. - -##### Returns: - - Accuracy `Tensor`. - -##### Raises: - - -* `ValueError`: if dtypes don't match or - if dtype is not bool, integer, or string. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.streaming_false_positives.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.streaming_false_positives.md deleted file mode 100644 index d3f748fec7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.streaming_false_positives.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.contrib.metrics.streaming_false_positives(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_false_positives} - -Sum the weights of false positives. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: The predicted values, a `Tensor` of arbitrary dimensions. Will - be cast to `bool`. -* `labels`: The ground truth values, a `Tensor` whose dimensions must match - `predictions`. Will be cast to `bool`. -* `weights`: Optional `Tensor` whose rank is either 0, or the same rank as - `labels`, and must be broadcastable to `labels` (i.e., all dimensions - must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `value_tensor`: A `Tensor` representing the current value of the metric. -* `update_op`: An operation that accumulates the error from a batch of data. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.streaming_percentage_less.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.streaming_percentage_less.md deleted file mode 100644 index 829c15ee81..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.streaming_percentage_less.md +++ /dev/null @@ -1,43 +0,0 @@ -### `tf.contrib.metrics.streaming_percentage_less(values, threshold, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_percentage_less} - -Computes the percentage of values less than the given threshold. - -The `streaming_percentage_less` function creates two local variables, -`total` and `count` that are used to compute the percentage of `values` that -fall below `threshold`. This rate is weighted by `weights`, and it is -ultimately returned as `percentage` which is an idempotent operation that -simply divides `total` by `count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`percentage`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `values`: A numeric `Tensor` of arbitrary size. -* `threshold`: A scalar threshold. -* `weights`: An optional `Tensor` whose shape is broadcastable to `values`. -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `percentage`: A `Tensor` representing the current mean, the value of `total` - divided by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately. - -##### Raises: - - -* `ValueError`: If `weights` is not `None` and its shape doesn't match `values`, - or if either `metrics_collections` or `updates_collections` are not a list - or tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.streaming_recall_at_thresholds.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.streaming_recall_at_thresholds.md deleted file mode 100644 index 10c3c2a29c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.metrics.streaming_recall_at_thresholds.md +++ /dev/null @@ -1,48 +0,0 @@ -### `tf.contrib.metrics.streaming_recall_at_thresholds(predictions, labels, thresholds, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_recall_at_thresholds} - -Computes various recall values for different `thresholds` on `predictions`. - -The `streaming_recall_at_thresholds` function creates four local variables, -`true_positives`, `true_negatives`, `false_positives` and `false_negatives` -for various values of thresholds. `recall[i]` is defined as the total weight -of values in `predictions` above `thresholds[i]` whose corresponding entry in -`labels` is `True`, divided by the total weight of `True` values in `labels` -(`true_positives[i] / (true_positives[i] + false_negatives[i])`). - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the `recall`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A floating point `Tensor` of arbitrary shape and whose values - are in the range `[0, 1]`. -* `labels`: A `bool` `Tensor` whose shape matches `predictions`. -* `thresholds`: A python list or tuple of float thresholds in `[0, 1]`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that `recall` should be - added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `recall`: A float `Tensor` of shape `[len(thresholds)]`. -* `update_op`: An operation that increments the `true_positives`, - `true_negatives`, `false_positives` and `false_negatives` variables that - are used in the computation of `recall`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.rnn.EmbeddingWrapper.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.rnn.EmbeddingWrapper.md deleted file mode 100644 index 4e1b78cd8b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.rnn.EmbeddingWrapper.md +++ /dev/null @@ -1,71 +0,0 @@ -Operator adding input embedding to the given cell. - -Note: in many cases it may be more efficient to not use this wrapper, -but instead concatenate the whole sequence of your inputs in time, -do the embedding on this batch-concatenated sequence, then split it and -feed into your RNN. -- - - - -#### `tf.contrib.rnn.EmbeddingWrapper.__call__(inputs, state, scope=None)` {#EmbeddingWrapper.__call__} - -Run the cell on embedded inputs. - - -- - - - -#### `tf.contrib.rnn.EmbeddingWrapper.__init__(cell, embedding_classes, embedding_size, initializer=None)` {#EmbeddingWrapper.__init__} - -Create a cell with an added input embedding. - -##### Args: - - -* `cell`: an RNNCell, an embedding will be put before its inputs. -* `embedding_classes`: integer, how many symbols will be embedded. -* `embedding_size`: integer, the size of the vectors we embed into. -* `initializer`: an initializer to use when creating the embedding; - if None, the initializer from variable scope or a default one is used. - -##### Raises: - - -* `TypeError`: if cell is not an RNNCell. -* `ValueError`: if embedding_classes is not positive. - - -- - - - -#### `tf.contrib.rnn.EmbeddingWrapper.output_size` {#EmbeddingWrapper.output_size} - - - - -- - - - -#### `tf.contrib.rnn.EmbeddingWrapper.state_size` {#EmbeddingWrapper.state_size} - - - - -- - - - -#### `tf.contrib.rnn.EmbeddingWrapper.zero_state(batch_size, dtype)` {#EmbeddingWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.rnn.RNNCell.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.rnn.RNNCell.md deleted file mode 100644 index fa2d4f17d0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.contrib.rnn.RNNCell.md +++ /dev/null @@ -1,85 +0,0 @@ -Abstract object representing an RNN cell. - -The definition of cell in this package differs from the definition used in the -literature. In the literature, cell refers to an object with a single scalar -output. The definition in this package refers to a horizontal array of such -units. - -An RNN cell, in the most abstract setting, is anything that has -a state and performs some operation that takes a matrix of inputs. -This operation results in an output matrix with `self.output_size` columns. -If `self.state_size` is an integer, this operation also results in a new -state matrix with `self.state_size` columns. If `self.state_size` is a -tuple of integers, then it results in a tuple of `len(state_size)` state -matrices, each with a column size corresponding to values in `state_size`. - -This module provides a number of basic commonly used RNN cells, such as -LSTM (Long Short Term Memory) or GRU (Gated Recurrent Unit), and a number -of operators that allow add dropouts, projections, or embeddings for inputs. -Constructing multi-layer cells is supported by the class `MultiRNNCell`, -or by calling the `rnn` ops several times. Every `RNNCell` must have the -properties below and implement `__call__` with the following signature. -- - - - -#### `tf.contrib.rnn.RNNCell.__call__(inputs, state, scope=None)` {#RNNCell.__call__} - -Run this RNN cell on inputs, starting from the given state. - -##### Args: - - -* `inputs`: `2-D` tensor with shape `[batch_size x input_size]`. -* `state`: if `self.state_size` is an integer, this should be a `2-D Tensor` - with shape `[batch_size x self.state_size]`. Otherwise, if - `self.state_size` is a tuple of integers, this should be a tuple - with shapes `[batch_size x s] for s in self.state_size`. -* `scope`: VariableScope for the created subgraph; defaults to class name. - -##### Returns: - - A pair containing: - - - Output: A `2-D` tensor with shape `[batch_size x self.output_size]`. - - New state: Either a single `2-D` tensor, or a tuple of tensors matching - the arity and shapes of `state`. - - -- - - - -#### `tf.contrib.rnn.RNNCell.output_size` {#RNNCell.output_size} - -Integer or TensorShape: size of outputs produced by this cell. - - -- - - - -#### `tf.contrib.rnn.RNNCell.state_size` {#RNNCell.state_size} - -size(s) of state(s) used by this cell. - -It can be represented by an Integer, a TensorShape or a tuple of Integers -or TensorShapes. - - -- - - - -#### `tf.contrib.rnn.RNNCell.zero_state(batch_size, dtype)` {#RNNCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.cos.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.cos.md deleted file mode 100644 index faf84ea9d3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.cos.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.cos(x, name=None)` {#cos} - -Computes cos of x element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.count_nonzero.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.count_nonzero.md deleted file mode 100644 index e464a8f8d3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.count_nonzero.md +++ /dev/null @@ -1,43 +0,0 @@ -### `tf.count_nonzero(input_tensor, axis=None, keep_dims=False, dtype=tf.int64, name=None, reduction_indices=None)` {#count_nonzero} - -Computes number of nonzero elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -**NOTE** Floating point comparison to zero is done by exact floating point -equality check. Small values are **not** rounded to zero for purposes of -the nonzero check. - -For example: - -```python -# 'x' is [[0, 1, 0] -# [1, 1, 0]] -tf.count_nonzero(x) ==> 3 -tf.count_nonzero(x, 0) ==> [1, 2, 0] -tf.count_nonzero(x, 1) ==> [1, 2] -tf.count_nonzero(x, 1, keep_dims=True) ==> [[1], [2]] -tf.count_nonzero(x, [0, 1]) ==> 3 -``` - -##### Args: - - -* `input_tensor`: The tensor to reduce. Should be of numeric type, or `bool`. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `dtype`: The output dtype; defaults to `tf.int64`. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor (number of nonzero values). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.diag_part.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.diag_part.md deleted file mode 100644 index 845a45669b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.diag_part.md +++ /dev/null @@ -1,34 +0,0 @@ -### `tf.diag_part(input, name=None)` {#diag_part} - -Returns the diagonal part of the tensor. - -This operation returns a tensor with the `diagonal` part -of the `input`. The `diagonal` part is computed as follows: - -Assume `input` has dimensions `[D1,..., Dk, D1,..., Dk]`, then the output is a -tensor of rank `k` with dimensions `[D1,..., Dk]` where: - -`diagonal[i1,..., ik] = input[i1, ..., ik, i1,..., ik]`. - -For example: - -```prettyprint -# 'input' is [[1, 0, 0, 0] - [0, 2, 0, 0] - [0, 0, 3, 0] - [0, 0, 0, 4]] - -tf.diag_part(input) ==> [1, 2, 3, 4] -``` - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. - Rank k tensor where k is 2, 4, or 6. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. The extracted diagonal. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.div.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.div.md deleted file mode 100644 index 8c25e24373..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.div.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.div(x, y, name=None)` {#div} - -Divides x / y elementwise (using Python 2 division operator semantics). - -NOTE: Prefer using the Tensor division operator or tf.divide which obey Python -division operator semantics. - -This function divides `x` and `y`, forcing Python 2.7 semantics. That is, -if one of `x` or `y` is a float, then the result will be a float. -Otherwise, the output will be an integer type. Flooring semantics are used -for integer division. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` returns the quotient of x and y. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.errors.PermissionDeniedError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.errors.PermissionDeniedError.md deleted file mode 100644 index a8a81494c8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.errors.PermissionDeniedError.md +++ /dev/null @@ -1,14 +0,0 @@ -Raised when the caller does not have permission to run an operation. - -For example, running the -[`tf.WholeFileReader.read()`](../../api_docs/python/io_ops.md#WholeFileReader) -operation could raise `PermissionDeniedError` if it receives the name of a -file for which the user does not have the read file permission. - -- - - - -#### `tf.errors.PermissionDeniedError.__init__(node_def, op, message)` {#PermissionDeniedError.__init__} - -Creates a `PermissionDeniedError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.errors.UnavailableError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.errors.UnavailableError.md deleted file mode 100644 index e212ae94ec..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.errors.UnavailableError.md +++ /dev/null @@ -1,11 +0,0 @@ -Raised when the runtime is currently unavailable. - -This exception is not currently used. - -- - - - -#### `tf.errors.UnavailableError.__init__(node_def, op, message)` {#UnavailableError.__init__} - -Creates an `UnavailableError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.errors.raise_exception_on_not_ok_status.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.errors.raise_exception_on_not_ok_status.md deleted file mode 100644 index a8d96ff97b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.errors.raise_exception_on_not_ok_status.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.errors.raise_exception_on_not_ok_status()` {#raise_exception_on_not_ok_status} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.floordiv.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.floordiv.md deleted file mode 100644 index cf389be85b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.floordiv.md +++ /dev/null @@ -1,32 +0,0 @@ -### `tf.floordiv(x, y, name=None)` {#floordiv} - -Divides `x / y` elementwise, rounding toward the most negative integer. - -The same as `tf.div(x,y)` for integers, but uses `tf.floor(tf.div(x,y))` for -floating point arguments so that the result is always an integer (though -possibly an integer represented as floating point). This op is generated by -`x // y` floor division in Python 3 and in Python 2.7 with -`from __future__ import division`. - -Note that for efficiency, `floordiv` uses C semantics for negative numbers -(unlike Python and Numpy). - -`x` and `y` must have the same type, and the result will have the same type -as well. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` rounded down (except possibly towards zero for negative integers). - -##### Raises: - - -* `TypeError`: If the inputs are complex. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.decode_image.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.decode_image.md deleted file mode 100644 index 46395cad62..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.decode_image.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.image.decode_image(contents, channels=None, name=None)` {#decode_image} - -Convenience function for `decode_gif`, `decode_jpeg`, and `decode_png`. -Detects whether an image is a GIF, JPEG, or PNG, and performs the appropriate -operation to convert the input bytes `string` into a `Tensor` of type `uint8`. - -Note: `decode_gif` returns a 4-D array `[num_frames, height, width, 3]`, as -opposed to `decode_jpeg` and `decode_png`, which return 3-D arrays -`[height, width, num_channels]`. Make sure to take this into account when -constructing your graph if you are intermixing GIF files with JPEG and/or PNG -files. - -##### Args: - - -* `contents`: 0-D `string`. The encoded image bytes. -* `channels`: An optional `int`. Defaults to `0`. Number of color channels for - the decoded image. -* `name`: A name for the operation (optional) - -##### Returns: - - `Tensor` with type `uint8` with shape `[height, width, num_channels]` for - JPEG and PNG images and shape `[num_frames, height, width, 3]` for GIF - images. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.flip_left_right.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.flip_left_right.md deleted file mode 100644 index ac8c99806e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.flip_left_right.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.image.flip_left_right(image)` {#flip_left_right} - -Flip an image horizontally (left to right). - -Outputs the contents of `image` flipped along the second dimension, which is -`width`. - -See also `reverse()`. - -##### Args: - - -* `image`: A 3-D tensor of shape `[height, width, channels].` - -##### Returns: - - A 3-D tensor of the same type and shape as `image`. - -##### Raises: - - -* `ValueError`: if the shape of `image` not supported. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.flip_up_down.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.flip_up_down.md deleted file mode 100644 index ed92277f8a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.flip_up_down.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.image.flip_up_down(image)` {#flip_up_down} - -Flip an image horizontally (upside down). - -Outputs the contents of `image` flipped along the first dimension, which is -`height`. - -See also `reverse()`. - -##### Args: - - -* `image`: A 3-D tensor of shape `[height, width, channels].` - -##### Returns: - - A 3-D tensor of the same type and shape as `image`. - -##### Raises: - - -* `ValueError`: if the shape of `image` not supported. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.pad_to_bounding_box.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.pad_to_bounding_box.md deleted file mode 100644 index c731fb2d2a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.pad_to_bounding_box.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.image.pad_to_bounding_box(image, offset_height, offset_width, target_height, target_width)` {#pad_to_bounding_box} - -Pad `image` with zeros to the specified `height` and `width`. - -Adds `offset_height` rows of zeros on top, `offset_width` columns of -zeros on the left, and then pads the image on the bottom and right -with zeros until it has dimensions `target_height`, `target_width`. - -This op does nothing if `offset_*` is zero and the image already has size -`target_height` by `target_width`. - -##### Args: - - -* `image`: 3-D tensor with shape `[height, width, channels]` -* `offset_height`: Number of rows of zeros to add on top. -* `offset_width`: Number of columns of zeros to add on the left. -* `target_height`: Height of output image. -* `target_width`: Width of output image. - -##### Returns: - - 3-D tensor of shape `[target_height, target_width, channels]` - -##### Raises: - - -* `ValueError`: If the shape of `image` is incompatible with the `offset_*` or - `target_*` arguments, or either `offset_height` or `offset_width` is - negative. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.resize_image_with_crop_or_pad.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.resize_image_with_crop_or_pad.md deleted file mode 100644 index 24104b647c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.resize_image_with_crop_or_pad.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.image.resize_image_with_crop_or_pad(image, target_height, target_width)` {#resize_image_with_crop_or_pad} - -Crops and/or pads an image to a target width and height. - -Resizes an image to a target width and height by either centrally -cropping the image or padding it evenly with zeros. - -If `width` or `height` is greater than the specified `target_width` or -`target_height` respectively, this op centrally crops along that dimension. -If `width` or `height` is smaller than the specified `target_width` or -`target_height` respectively, this op centrally pads with 0 along that -dimension. - -##### Args: - - -* `image`: 3-D tensor of shape `[height, width, channels]` -* `target_height`: Target height. -* `target_width`: Target width. - -##### Raises: - - -* `ValueError`: if `target_height` or `target_width` are zero or negative. - -##### Returns: - - Cropped and/or padded image of shape - `[target_height, target_width, channels]` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.resize_nearest_neighbor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.resize_nearest_neighbor.md deleted file mode 100644 index ba72e73ebd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.resize_nearest_neighbor.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.image.resize_nearest_neighbor(images, size, align_corners=None, name=None)` {#resize_nearest_neighbor} - -Resize `images` to `size` using nearest neighbor interpolation. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int16`, `int32`, `int64`, `half`, `float32`, `float64`. - 4-D with shape `[batch, height, width, channels]`. -* `size`: A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The - new size for the images. -* `align_corners`: An optional `bool`. Defaults to `False`. - If true, rescale input by (new_height - 1) / (height - 1), which - exactly aligns the 4 corners of images and resized images. If false, rescale - by new_height / height. Treat similarly the width dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `images`. 4-D with shape - `[batch, new_height, new_width, channels]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.rot90.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.rot90.md deleted file mode 100644 index 3923d715ab..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.rot90.md +++ /dev/null @@ -1,15 +0,0 @@ -### `tf.image.rot90(image, k=1, name=None)` {#rot90} - -Rotate an image counter-clockwise by 90 degrees. - -##### Args: - - -* `image`: A 3-D tensor of shape `[height, width, channels]`. -* `k`: A scalar integer. The number of times the image is rotated by 90 degrees. -* `name`: A name for this operation (optional). - -##### Returns: - - A rotated 3-D tensor of the same type and shape as `image`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.sample_distorted_bounding_box.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.sample_distorted_bounding_box.md deleted file mode 100644 index aeef14c3b6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.sample_distorted_bounding_box.md +++ /dev/null @@ -1,89 +0,0 @@ -### `tf.image.sample_distorted_bounding_box(image_size, bounding_boxes, seed=None, seed2=None, min_object_covered=None, aspect_ratio_range=None, area_range=None, max_attempts=None, use_image_if_no_bounding_boxes=None, name=None)` {#sample_distorted_bounding_box} - -Generate a single randomly distorted bounding box for an image. - -Bounding box annotations are often supplied in addition to ground-truth labels -in image recognition or object localization tasks. A common technique for -training such a system is to randomly distort an image while preserving -its content, i.e. *data augmentation*. This Op outputs a randomly distorted -localization of an object, i.e. bounding box, given an `image_size`, -`bounding_boxes` and a series of constraints. - -The output of this Op is a single bounding box that may be used to crop the -original image. The output is returned as 3 tensors: `begin`, `size` and -`bboxes`. The first 2 tensors can be fed directly into `tf.slice` to crop the -image. The latter may be supplied to `tf.image.draw_bounding_boxes` to visualize -what the bounding box looks like. - -Bounding boxes are supplied and returned as `[y_min, x_min, y_max, x_max]`. The -bounding box coordinates are floats in `[0.0, 1.0]` relative to the width and -height of the underlying image. - -For example, - -```python - # Generate a single distorted bounding box. - begin, size, bbox_for_draw = tf.image.sample_distorted_bounding_box( - tf.shape(image), - bounding_boxes=bounding_boxes) - - # Draw the bounding box in an image summary. - image_with_box = tf.image.draw_bounding_boxes(tf.expand_dims(image, 0), - bbox_for_draw) - tf.image_summary('images_with_box', image_with_box) - - # Employ the bounding box to distort the image. - distorted_image = tf.slice(image, begin, size) -``` - -Note that if no bounding box information is available, setting -`use_image_if_no_bounding_boxes = true` will assume there is a single implicit -bounding box covering the whole image. If `use_image_if_no_bounding_boxes` is -false and no bounding boxes are supplied, an error is raised. - -##### Args: - - -* `image_size`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int16`, `int32`, `int64`. - 1-D, containing `[height, width, channels]`. -* `bounding_boxes`: A `Tensor` of type `float32`. - 3-D with shape `[batch, N, 4]` describing the N bounding boxes - associated with the image. -* `seed`: An optional `int`. Defaults to `0`. - If either `seed` or `seed2` are set to non-zero, the random number - generator is seeded by the given `seed`. Otherwise, it is seeded by a random - seed. -* `seed2`: An optional `int`. Defaults to `0`. - A second seed to avoid seed collision. -* `min_object_covered`: An optional `float`. Defaults to `0.1`. - The cropped area of the image must contain at least this - fraction of any bounding box supplied. The value of this parameter should be - non-negative. In the case of 0, the cropped area does not need to overlap - any of the bounding boxes supplied. -* `aspect_ratio_range`: An optional list of `floats`. Defaults to `[0.75, 1.33]`. - The cropped area of the image must have an aspect ratio = - width / height within this range. -* `area_range`: An optional list of `floats`. Defaults to `[0.05, 1]`. - The cropped area of the image must contain a fraction of the - supplied image within in this range. -* `max_attempts`: An optional `int`. Defaults to `100`. - Number of attempts at generating a cropped region of the image - of the specified constraints. After `max_attempts` failures, return the entire - image. -* `use_image_if_no_bounding_boxes`: An optional `bool`. Defaults to `False`. - Controls behavior if no bounding boxes supplied. - If true, assume an implicit bounding box covering the whole input. If false, - raise an error. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (begin, size, bboxes). - -* `begin`: A `Tensor`. Has the same type as `image_size`. 1-D, containing `[offset_height, offset_width, 0]`. Provide as input to - `tf.slice`. -* `size`: A `Tensor`. Has the same type as `image_size`. 1-D, containing `[target_height, target_width, -1]`. Provide as input to - `tf.slice`. -* `bboxes`: A `Tensor` of type `float32`. 3-D with shape `[1, 1, 4]` containing the distorted bounding box. - Provide as input to `tf.image.draw_bounding_boxes`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.total_variation.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.total_variation.md deleted file mode 100644 index 03fec86c85..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.image.total_variation.md +++ /dev/null @@ -1,40 +0,0 @@ -### `tf.image.total_variation(images, name=None)` {#total_variation} - -Calculate and return the total variation for one or more images. - -The total variation is the sum of the absolute differences for neighboring -pixel-values in the input images. This measures how much noise is in the -images. - -This can be used as a loss-function during optimization so as to suppress -noise in images. If you have a batch of images, then you should calculate -the scalar loss-value as the sum: -`loss = tf.reduce_sum(tf.image.total_variation(images))` - -This implements the anisotropic 2-D version of the formula described here: - -https://en.wikipedia.org/wiki/Total_variation_denoising - -##### Args: - - -* `images`: 4-D Tensor of shape `[batch, height, width, channels]` or - 3-D Tensor of shape `[height, width, channels]`. - - -* `name`: A name for the operation (optional). - -##### Raises: - - -* `ValueError`: if images.shape is not a 3-D or 4-D vector. - -##### Returns: - - The total variation of `images`. - - If `images` was 4-D, return a 1-D float Tensor of shape `[batch]` with the - total variation for each image in the batch. - If `images` was 3-D, return a scalar float with the total variation for - that image. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.load_file_system_library.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.load_file_system_library.md deleted file mode 100644 index 60d768a624..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.load_file_system_library.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.load_file_system_library(library_filename)` {#load_file_system_library} - -Loads a TensorFlow plugin, containing file system implementation. - -Pass `library_filename` to a platform-specific mechanism for dynamically -loading a library. The rules for determining the exact location of the -library are platform-specific and are not documented here. - -##### Args: - - -* `library_filename`: Path to the plugin. - Relative or absolute filesystem path to a dynamic library file. - -##### Returns: - - None. - -##### Raises: - - -* `RuntimeError`: when unable to load the library. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.logical_and.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.logical_and.md deleted file mode 100644 index 2b5f011ccd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.logical_and.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.logical_and(x, y, name=None)` {#logical_and} - -Returns the truth value of x AND y element-wise. - -*NOTE*: `LogicalAnd` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.logical_not.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.logical_not.md deleted file mode 100644 index 40a0bb2e43..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.logical_not.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.logical_not(x, name=None)` {#logical_not} - -Returns the truth value of NOT x element-wise. - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.make_template.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.make_template.md deleted file mode 100644 index 99814cacc5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.make_template.md +++ /dev/null @@ -1,111 +0,0 @@ -### `tf.make_template(name_, func_, create_scope_now_=False, unique_name_=None, custom_getter_=None, **kwargs)` {#make_template} - -Given an arbitrary function, wrap it so that it does variable sharing. - -This wraps `func_` in a Template and partially evaluates it. Templates are -functions that create variables the first time they are called and reuse them -thereafter. In order for `func_` to be compatible with a `Template` it must -have the following properties: - -* The function should create all trainable variables and any variables that - should be reused by calling `tf.get_variable`. If a trainable variable is - created using `tf.Variable`, then a ValueError will be thrown. Variables - that are intended to be locals can be created by specifying - `tf.Variable(..., trainable=false)`. -* The function may use variable scopes and other templates internally to - create and reuse variables, but it shouldn't use `tf.global_variables` to - capture variables that are defined outside of the scope of the function. -* Internal scopes and variable names should not depend on any arguments that - are not supplied to `make_template`. In general you will get a ValueError - telling you that you are trying to reuse a variable that doesn't exist - if you make a mistake. - -In the following example, both `z` and `w` will be scaled by the same `y`. It -is important to note that if we didn't assign `scalar_name` and used a -different name for z and w that a `ValueError` would be thrown because it -couldn't reuse the variable. - -```python -def my_op(x, scalar_name): - var1 = tf.get_variable(scalar_name, - shape=[], - initializer=tf.constant_initializer(1)) - return x * var1 - -scale_by_y = tf.make_template('scale_by_y', my_op, scalar_name='y') - -z = scale_by_y(input1) -w = scale_by_y(input2) -``` - -As a safe-guard, the returned function will raise a `ValueError` after the -first call if trainable variables are created by calling `tf.Variable`. - -If all of these are true, then 2 properties are enforced by the template: - -1. Calling the same template multiple times will share all non-local - variables. -2. Two different templates are guaranteed to be unique, unless you reenter the - same variable scope as the initial definition of a template and redefine - it. An examples of this exception: - -```python -def my_op(x, scalar_name): - var1 = tf.get_variable(scalar_name, - shape=[], - initializer=tf.constant_initializer(1)) - return x * var1 - -with tf.variable_scope('scope') as vs: - scale_by_y = tf.make_template('scale_by_y', my_op, scalar_name='y') - z = scale_by_y(input1) - w = scale_by_y(input2) - -# Creates a template that reuses the variables above. -with tf.variable_scope(vs, reuse=True): - scale_by_y2 = tf.make_template('scale_by_y', my_op, scalar_name='y') - z2 = scale_by_y2(input1) - w2 = scale_by_y2(input2) -``` - -Depending on the value of `create_scope_now_`, the full variable scope may be -captured either at the time of first call or at the time of construction. If -this option is set to True, then all Tensors created by repeated calls to the -template will have an extra trailing _N+1 to their name, as the first time the -scope is entered in the Template constructor no Tensors are created. - -Note: `name_`, `func_` and `create_scope_now_` have a trailing underscore to -reduce the likelihood of collisions with kwargs. - -##### Args: - - -* `name_`: A name for the scope created by this template. If necessary, the name - will be made unique by appending `_N` to the name. -* `func_`: The function to wrap. -* `create_scope_now_`: Boolean controlling whether the scope should be created - when the template is constructed or when the template is called. Default - is False, meaning the scope is created when the template is called. -* `unique_name_`: When used, it overrides name_ and is not made unique. If a - template of the same scope/unique_name already exists and reuse is false, - an error is raised. Defaults to None. -* `custom_getter_`: Optional custom getter for variables used in `func_`. See - the [`get_variable`](#get_variable) `custom_getter` documentation for - more information. -* `**kwargs`: Keyword arguments to apply to `func_`. - -##### Returns: - - A function to encapsulate a set of variables which should be created once - and reused. An enclosing scope will created, either where `make_template` - is called, or wherever the result is called, depending on the value of - `create_scope_now_`. Regardless of the value, the first time the template - is called it will enter the scope with no reuse, and call `func_` to create - variables, which are guaranteed to be unique. All subsequent calls will - re-enter the scope and reuse those variables. - -##### Raises: - - -* `ValueError`: if the name is None. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.model_variables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.model_variables.md deleted file mode 100644 index f0bba3c637..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.model_variables.md +++ /dev/null @@ -1,8 +0,0 @@ -### `tf.model_variables()` {#model_variables} - -Returns all variables in the MODEL_VARIABLES collection. - -##### Returns: - - A list of local Variable objects. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.atrous_conv2d_transpose.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.atrous_conv2d_transpose.md deleted file mode 100644 index a4caa46258..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.atrous_conv2d_transpose.md +++ /dev/null @@ -1,43 +0,0 @@ -### `tf.nn.atrous_conv2d_transpose(value, filters, output_shape, rate, padding, name=None)` {#atrous_conv2d_transpose} - -The transpose of `atrous_conv2d`. - -This operation is sometimes called "deconvolution" after [Deconvolutional -Networks](http://www.matthewzeiler.com/pubs/cvpr2010/cvpr2010.pdf), but is -actually the transpose (gradient) of `atrous_conv2d` rather than an actual -deconvolution. - -##### Args: - - -* `value`: A 4-D `Tensor` of type `float`. It needs to be in the default `NHWC` - format. Its shape is `[batch, in_height, in_width, in_channels]`. -* `filters`: A 4-D `Tensor` with the same type as `value` and shape - `[filter_height, filter_width, out_channels, in_channels]`. `filters`' - `in_channels` dimension must match that of `value`. Atrous convolution is - equivalent to standard convolution with upsampled filters with effective - height `filter_height + (filter_height - 1) * (rate - 1)` and effective - width `filter_width + (filter_width - 1) * (rate - 1)`, produced by - inserting `rate - 1` zeros along consecutive elements across the - `filters`' spatial dimensions. -* `output_shape`: A 1-D `Tensor` of shape representing the output shape of the - deconvolution op. -* `rate`: A positive int32. The stride with which we sample input values across - the `height` and `width` dimensions. Equivalently, the rate by which we - upsample the filter values by inserting zeros across the `height` and - `width` dimensions. In the literature, the same parameter is sometimes - called `input stride` or `dilation`. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. -* `name`: Optional name for the returned tensor. - -##### Returns: - - A `Tensor` with the same type as `value`. - -##### Raises: - - -* `ValueError`: If input/output depth does not match `filters`' shape, or if - padding is other than `'VALID'` or `'SAME'`, or if the `rate` is less - than one, or if the output_shape is not a tensor with 4 elements. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.conv3d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.conv3d.md deleted file mode 100644 index cbac47eb58..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.conv3d.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.nn.conv3d(input, filter, strides, padding, name=None)` {#conv3d} - -Computes a 3-D convolution given 5-D `input` and `filter` tensors. - -In signal processing, cross-correlation is a measure of similarity of -two waveforms as a function of a time-lag applied to one of them. This -is also known as a sliding dot product or sliding inner-product. - -Our Conv3D implements a form of cross-correlation. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Shape `[batch, in_depth, in_height, in_width, in_channels]`. -* `filter`: A `Tensor`. Must have the same type as `input`. - Shape `[filter_depth, filter_height, filter_width, in_channels, - out_channels]`. `in_channels` must match between `input` and `filter`. -* `strides`: A list of `ints` that has length `>= 5`. - 1-D tensor of length 5. The stride of the sliding window for each - dimension of `input`. Must have `strides[0] = strides[4] = 1`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.sigmoid_cross_entropy_with_logits.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.sigmoid_cross_entropy_with_logits.md deleted file mode 100644 index 55e1b178ea..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.sigmoid_cross_entropy_with_logits.md +++ /dev/null @@ -1,49 +0,0 @@ -### `tf.nn.sigmoid_cross_entropy_with_logits(_sentinel=None, labels=None, logits=None, name=None)` {#sigmoid_cross_entropy_with_logits} - -Computes sigmoid cross entropy given `logits`. - -Measures the probability error in discrete classification tasks in which each -class is independent and not mutually exclusive. For instance, one could -perform multilabel classification where a picture can contain both an elephant -and a dog at the same time. - -For brevity, let `x = logits`, `z = labels`. The logistic loss is - - z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) - = z * -log(1 / (1 + exp(-x))) + (1 - z) * -log(exp(-x) / (1 + exp(-x))) - = z * log(1 + exp(-x)) + (1 - z) * (-log(exp(-x)) + log(1 + exp(-x))) - = z * log(1 + exp(-x)) + (1 - z) * (x + log(1 + exp(-x)) - = (1 - z) * x + log(1 + exp(-x)) - = x - x * z + log(1 + exp(-x)) - -For x < 0, to avoid overflow in exp(-x), we reformulate the above - - x - x * z + log(1 + exp(-x)) - = log(exp(x)) - x * z + log(1 + exp(-x)) - = - x * z + log(1 + exp(x)) - -Hence, to ensure stability and avoid overflow, the implementation uses this -equivalent formulation - - max(x, 0) - x * z + log(1 + exp(-abs(x))) - -`logits` and `labels` must have the same type and shape. - -##### Args: - - _sentinel: Used to prevent positional parameters. Internal, do not use. - -* `labels`: A `Tensor` of the same type and shape as `logits`. -* `logits`: A `Tensor` of type `float32` or `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of the same shape as `logits` with the componentwise - logistic losses. - -##### Raises: - - -* `ValueError`: If `logits` and `labels` do not have the same shape. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.top_k.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.top_k.md deleted file mode 100644 index 819c0ad068..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.nn.top_k.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.nn.top_k(input, k=1, sorted=True, name=None)` {#top_k} - -Finds values and indices of the `k` largest entries for the last dimension. - -If the input is a vector (rank-1), finds the `k` largest entries in the vector -and outputs their values and indices as vectors. Thus `values[j]` is the -`j`-th largest entry in `input`, and its index is `indices[j]`. - -For matrices (resp. higher rank input), computes the top `k` entries in each -row (resp. vector along the last dimension). Thus, - - values.shape = indices.shape = input.shape[:-1] + [k] - -If two elements are equal, the lower-index element appears first. - -##### Args: - - -* `input`: 1-D or higher `Tensor` with last dimension at least `k`. -* `k`: 0-D `int32` `Tensor`. Number of top elements to look for along the last - dimension (along each row for matrices). -* `sorted`: If true the resulting `k` elements will be sorted by the values in - descending order. -* `name`: Optional name for the operation. - -##### Returns: - - -* `values`: The `k` largest elements along each last dimensional slice. -* `indices`: The indices of `values` within the last dimension of `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.no_op.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.no_op.md deleted file mode 100644 index c1b5c0824b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.no_op.md +++ /dev/null @@ -1,13 +0,0 @@ -### `tf.no_op(name=None)` {#no_op} - -Does nothing. Only useful as a placeholder for control edges. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.range.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.range.md deleted file mode 100644 index 90f8e7aa50..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.range.md +++ /dev/null @@ -1,52 +0,0 @@ -### `tf.range(start, limit=None, delta=1, dtype=None, name='range')` {#range} - -Creates a sequence of numbers. - -Creates a sequence of numbers that begins at `start` and extends by -increments of `delta` up to but not including `limit`. - -The dtype of the resulting tensor is inferred from the inputs unless -it is provided explicitly. - -Like the Python builtin `range`, `start` defaults to 0, so that -`range(n) = range(0, n)`. - -For example: - -```python -# 'start' is 3 -# 'limit' is 18 -# 'delta' is 3 -tf.range(start, limit, delta) ==> [3, 6, 9, 12, 15] - -# 'start' is 3 -# 'limit' is 1 -# 'delta' is -0.5 -tf.range(start, limit, delta) ==> [3, 2.5, 2, 1.5] - -# 'limit' is 5 -tf.range(limit) ==> [0, 1, 2, 3, 4] -``` - -##### Args: - - -* `start`: A 0-D `Tensor` (scalar). Acts as first entry in the range if - `limit` is not None; otherwise, acts as range limit and first entry - defaults to 0. -* `limit`: A 0-D `Tensor` (scalar). Upper limit of sequence, - exclusive. If None, defaults to the value of `start` while the first - entry of the range defaults to 0. -* `delta`: A 0-D `Tensor` (scalar). Number that increments - `start`. Defaults to 1. -* `dtype`: The type of the elements of the resulting tensor. -* `name`: A name for the operation. Defaults to "range". - -##### Returns: - - An 1-D `Tensor` of type `dtype`. - -@compatibility(numpy) -Equivalent to np.arange -@end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.reverse_v2.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.reverse_v2.md deleted file mode 100644 index 073f0bda7b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.reverse_v2.md +++ /dev/null @@ -1,64 +0,0 @@ -### `tf.reverse_v2(tensor, axis, name=None)` {#reverse_v2} - -Reverses specific dimensions of a tensor. - -NOTE `tf.reverse` has now changed behavior in preparation for 1.0. -`tf.reverse_v2` is currently an alias that will be deprecated before TF 1.0. - -Given a `tensor`, and a `int32` tensor `axis` representing the set of -dimensions of `tensor` to reverse. This operation reverses each dimension -`i` for which there exists `j` s.t. `axis[j] == i`. - -`tensor` can have up to 8 dimensions. The number of dimensions specified -in `axis` may be 0 or more entries. If an index is specified more than -once, a InvalidArgument error is raised. - -For example: - -```prettyprint -# tensor 't' is [[[[ 0, 1, 2, 3], -# [ 4, 5, 6, 7], -# [ 8, 9, 10, 11]], -# [[12, 13, 14, 15], -# [16, 17, 18, 19], -# [20, 21, 22, 23]]]] -# tensor 't' shape is [1, 2, 3, 4] - -# 'dims' is [3] or 'dims' is -1 -reverse(t, dims) ==> [[[[ 3, 2, 1, 0], - [ 7, 6, 5, 4], - [ 11, 10, 9, 8]], - [[15, 14, 13, 12], - [19, 18, 17, 16], - [23, 22, 21, 20]]]] - -# 'dims' is '[1]' (or 'dims' is '[-3]') -reverse(t, dims) ==> [[[[12, 13, 14, 15], - [16, 17, 18, 19], - [20, 21, 22, 23] - [[ 0, 1, 2, 3], - [ 4, 5, 6, 7], - [ 8, 9, 10, 11]]]] - -# 'dims' is '[2]' (or 'dims' is '[-2]') -reverse(t, dims) ==> [[[[8, 9, 10, 11], - [4, 5, 6, 7], - [0, 1, 2, 3]] - [[20, 21, 22, 23], - [16, 17, 18, 19], - [12, 13, 14, 15]]]] -``` - -##### Args: - - -* `tensor`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int32`, `int64`, `bool`, `half`, `float32`, `float64`, `complex64`, `complex128`. - Up to 8-D. -* `axis`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 1-D. The indices of the dimensions to reverse. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `tensor`. The same shape as `tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.scatter_nd.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.scatter_nd.md deleted file mode 100644 index c4d448d9d8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.scatter_nd.md +++ /dev/null @@ -1,94 +0,0 @@ -### `tf.scatter_nd(indices, updates, shape, name=None)` {#scatter_nd} - -Creates a new tensor by applying sparse `updates` to individual - -values or slices within a zero tensor of the given `shape` tensor according to -indices. This operator is the inverse of the [tf.gather_nd](#gather_nd) -operator which extracts values or slices from a given tensor. - -TODO(simister): Add a link to Variable.__getitem__ documentation on slice -syntax. - -`shape` is a `TensorShape` with rank `P` and `indices` is a `Tensor` of rank -`Q`. - -`indices` must be integer tensor, containing indices into `shape`. -It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. - -The innermost dimension of `indices` (with length `K`) corresponds to -indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th -dimension of `shape`. - -`updates` is Tensor of rank `Q-1+P-K` with shape: - -``` -[d_0, ..., d_{Q-2}, shape[K], ..., shape[P-1]]. -``` - -The simplest form of scatter is to insert individual elements in a tensor by -index. For example, say we want to insert 4 scattered elements in a rank-1 -tensor with 8 elements. - -
- -
- -In Python, this scatter operation would look like this: - - indices = tf.constant([[4], [3], [1], [7]]) - updates = tf.constant([9, 10, 11, 12]) - shape = tf.constant([8]) - scatter = tf.scatter_nd(indices, updates, shape) - with tf.Session() as sess: - print sess.run(scatter) - -The resulting tensor would look like this: - - [0, 11, 0, 10, 9, 0, 0, 12] - -We can also, insert entire slices of a higher rank tensor all at once. For -example, if we wanted to insert two slices in the first dimension of a -rank-3 tensor with two matrices of new values. - -
- -
- -In Python, this scatter operation would look like this: - - indices = tf.constant([[0], [2]]) - updates = tf.constant([[[5, 5, 5, 5], [6, 6, 6, 6], - [7, 7, 7, 7], [8, 8, 8, 8]], - [[5, 5, 5, 5], [6, 6, 6, 6], - [7, 7, 7, 7], [8, 8, 8, 8]]]) - shape = tf.constant([4, 4, 4]) - scatter = tf.scatter_nd(indices, updates, shape) - with tf.Session() as sess: - print sess.run(scatter) - -The resulting tensor would look like this: - - [[[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]], - [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], - [[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]], - [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]] - -##### Args: - - -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A Tensor. Must be one of the following types: int32, int64. - A tensor of indices into ref. -* `updates`: A `Tensor`. - A Tensor. Must have the same type as tensor. A tensor of updated values - to store in ref. -* `shape`: A `Tensor`. Must have the same type as `indices`. - A vector. The shape of the resulting tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `updates`. - A new tensor with the given shape and updates applied according - to the indices. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.sign.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.sign.md deleted file mode 100644 index e7fa339847..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.sign.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.sign(x, name=None)` {#sign} - -Returns an element-wise indication of the sign of a number. - -`y = sign(x) = -1` if `x < 0`; 0 if `x == 0`; 1 if `x > 0`. - -For complex numbers, `y = sign(x) = x / |x|` if `x != 0`, otherwise `y = 0`. - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. Must be one of the following types: `half`, - `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor`, respectively. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.sparse_maximum.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.sparse_maximum.md deleted file mode 100644 index 2f2759f2c6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.sparse_maximum.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.sparse_maximum(sp_a, sp_b, name=None)` {#sparse_maximum} - -Returns the element-wise max of two SparseTensors. - -Assumes the two SparseTensors have the same shape, i.e., no broadcasting. -Example: - -```python -sp_zero = sparse_tensor.SparseTensor([[0]], [0], [7]) -sp_one = sparse_tensor.SparseTensor([[1]], [1], [7]) -res = tf.sparse_maximum(sp_zero, sp_one).eval() -# "res" should be equal to SparseTensor([[0], [1]], [0, 1], [7]). -``` - -##### Args: - - -* `sp_a`: a `SparseTensor` operand whose dtype is real, and indices - lexicographically ordered. -* `sp_b`: the other `SparseTensor` operand with the same requirements (and the - same shape). -* `name`: optional name of the operation. - -##### Returns: - - -* `output`: the output SparseTensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.summary.FileWriterCache.get.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.summary.FileWriterCache.get.md deleted file mode 100644 index 0f416a5909..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.summary.FileWriterCache.get.md +++ /dev/null @@ -1,13 +0,0 @@ -#### `tf.summary.FileWriterCache.get(logdir)` {#FileWriterCache.get} - -Returns the FileWriter for the specified directory. - -##### Args: - - -* `logdir`: str, name of the directory. - -##### Returns: - - A `FileWriter`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.summary.SummaryDescription.FromString.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.summary.SummaryDescription.FromString.md deleted file mode 100644 index 24a3b3f10c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.summary.SummaryDescription.FromString.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.summary.SummaryDescription.FromString(s)` {#SummaryDescription.FromString} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.summary.image.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.summary.image.md deleted file mode 100644 index 64d16619f0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.summary.image.md +++ /dev/null @@ -1,47 +0,0 @@ -### `tf.summary.image(name, tensor, max_outputs=3, collections=None)` {#image} - -Outputs a `Summary` protocol buffer with images. - -The summary has up to `max_outputs` summary values containing images. The -images are built from `tensor` which must be 4-D with shape `[batch_size, -height, width, channels]` and where `channels` can be: - -* 1: `tensor` is interpreted as Grayscale. -* 3: `tensor` is interpreted as RGB. -* 4: `tensor` is interpreted as RGBA. - -The images have the same number of channels as the input tensor. For float -input, the values are normalized one image at a time to fit in the range -`[0, 255]`. `uint8` values are unchanged. The op uses two different -normalization algorithms: - -* If the input values are all positive, they are rescaled so the largest one - is 255. - -* If any input value is negative, the values are shifted so input value 0.0 - is at 127. They are then rescaled so that either the smallest value is 0, - or the largest one is 255. - -The `tag` in the outputted Summary.Value protobufs is generated based on the -name, with a suffix depending on the max_outputs setting: - -* If `max_outputs` is 1, the summary value tag is '*name*/image'. -* If `max_outputs` is greater than 1, the summary value tags are - generated sequentially as '*name*/image/0', '*name*/image/1', etc. - -##### Args: - - -* `name`: A name for the generated node. Will also serve as a series name in - TensorBoard. -* `tensor`: A 4-D `uint8` or `float32` `Tensor` of shape `[batch_size, height, - width, channels]` where `channels` is 1, 3, or 4. -* `max_outputs`: Max number of batch elements to generate images for. -* `collections`: Optional list of ops.GraphKeys. The collections to add the - summary to. Defaults to [_ops.GraphKeys.SUMMARIES] - -##### Returns: - - A scalar `Tensor` of type `string`. The serialized `Summary` protocol - buffer. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.tan.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.tan.md deleted file mode 100644 index cb05f1427b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.tan.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.tan(x, name=None)` {#tan} - -Computes tan of x element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.test.main.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.test.main.md deleted file mode 100644 index 4a9fbf12bf..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.test.main.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.test.main(argv=None)` {#main} - -Runs all unit tests. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.to_int64.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.to_int64.md deleted file mode 100644 index 0762822b3d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.to_int64.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.to_int64(x, name='ToInt64')` {#to_int64} - -Casts a tensor to type `int64`. - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` with same shape as `x` with type `int64`. - -##### Raises: - - -* `TypeError`: If `x` cannot be cast to the `int64`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.ChiefSessionCreator.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.ChiefSessionCreator.md deleted file mode 100644 index e5c7a3953a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.ChiefSessionCreator.md +++ /dev/null @@ -1,26 +0,0 @@ -Creates a tf.Session for a chief. -- - - - -#### `tf.train.ChiefSessionCreator.__init__(scaffold=None, master='', config=None, checkpoint_dir=None, checkpoint_filename_with_path=None)` {#ChiefSessionCreator.__init__} - -Initializes a chief session creator. - -##### Args: - - -* `scaffold`: A `Scaffold` used for gathering or building supportive ops. If - not specified a default one is created. It's used to finalize the graph. -* `master`: `String` representation of the TensorFlow master to use. -* `config`: `ConfigProto` proto used to configure the session. -* `checkpoint_dir`: A string. Optional path to a directory where to restore - variables. -* `checkpoint_filename_with_path`: Full file name path to the checkpoint file. - - -- - - - -#### `tf.train.ChiefSessionCreator.create_session()` {#ChiefSessionCreator.create_session} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.FtrlOptimizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.FtrlOptimizer.md deleted file mode 100644 index c1b1755ed8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.FtrlOptimizer.md +++ /dev/null @@ -1,185 +0,0 @@ -Optimizer that implements the FTRL algorithm. - -See this [paper]( -https://www.eecs.tufts.edu/~dsculley/papers/ad-click-prediction.pdf). -- - - - -#### `tf.train.FtrlOptimizer.__init__(learning_rate, learning_rate_power=-0.5, initial_accumulator_value=0.1, l1_regularization_strength=0.0, l2_regularization_strength=0.0, use_locking=False, name='Ftrl')` {#FtrlOptimizer.__init__} - -Construct a new FTRL optimizer. - -##### Args: - - -* `learning_rate`: A float value or a constant float `Tensor`. -* `learning_rate_power`: A float value, must be less or equal to zero. -* `initial_accumulator_value`: The starting value for accumulators. - Only positive values are allowed. -* `l1_regularization_strength`: A float value, must be greater than or - equal to zero. -* `l2_regularization_strength`: A float value, must be greater than or - equal to zero. -* `use_locking`: If `True` use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "Ftrl". - -##### Raises: - - -* `ValueError`: If one of the arguments is invalid. - - -- - - - -#### `tf.train.FtrlOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#FtrlOptimizer.apply_gradients} - -Apply gradients to variables. - -This is the second part of `minimize()`. It returns an `Operation` that -applies gradients. - -##### Args: - - -* `grads_and_vars`: List of (gradient, variable) pairs as returned by - `compute_gradients()`. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `name`: Optional name for the returned operation. Default to the - name passed to the `Optimizer` constructor. - -##### Returns: - - An `Operation` that applies the specified gradients. If `global_step` - was not None, that operation also increments `global_step`. - -##### Raises: - - -* `TypeError`: If `grads_and_vars` is malformed. -* `ValueError`: If none of the variables have gradients. - - -- - - - -#### `tf.train.FtrlOptimizer.compute_gradients(loss, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, grad_loss=None)` {#FtrlOptimizer.compute_gradients} - -Compute gradients of `loss` for the variables in `var_list`. - -This is the first part of `minimize()`. It returns a list -of (gradient, variable) pairs where "gradient" is the gradient -for "variable". Note that "gradient" can be a `Tensor`, an -`IndexedSlices`, or `None` if there is no gradient for the -given variable. - -##### Args: - - -* `loss`: A Tensor containing the value to minimize. -* `var_list`: Optional list of `tf.Variable` to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKey.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - A list of (gradient, variable) pairs. Variable is always present, but - gradient can be `None`. - -##### Raises: - - -* `TypeError`: If `var_list` contains anything else than `Variable` objects. -* `ValueError`: If some arguments are invalid. - - -- - - - -#### `tf.train.FtrlOptimizer.get_name()` {#FtrlOptimizer.get_name} - - - - -- - - - -#### `tf.train.FtrlOptimizer.get_slot(var, name)` {#FtrlOptimizer.get_slot} - -Return a slot named `name` created for `var` by the Optimizer. - -Some `Optimizer` subclasses use additional variables. For example -`Momentum` and `Adagrad` use variables to accumulate updates. This method -gives access to these `Variable` objects if for some reason you need them. - -Use `get_slot_names()` to get the list of slot names created by the -`Optimizer`. - -##### Args: - - -* `var`: A variable passed to `minimize()` or `apply_gradients()`. -* `name`: A string. - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - -- - - - -#### `tf.train.FtrlOptimizer.get_slot_names()` {#FtrlOptimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -See `get_slot()`. - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.train.FtrlOptimizer.minimize(loss, global_step=None, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, name=None, grad_loss=None)` {#FtrlOptimizer.minimize} - -Add operations to minimize `loss` by updating `var_list`. - -This method simply combines calls `compute_gradients()` and -`apply_gradients()`. If you want to process the gradient before applying -them call `compute_gradients()` and `apply_gradients()` explicitly instead -of using this function. - -##### Args: - - -* `loss`: A `Tensor` containing the value to minimize. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `name`: Optional name for the returned operation. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - An Operation that updates the variables in `var_list`. If `global_step` - was not `None`, that operation also increments `global_step`. - -##### Raises: - - -* `ValueError`: If some of the variables are not `Variable` objects. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.LooperThread.loop.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.LooperThread.loop.md deleted file mode 100644 index 6665ca7369..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.LooperThread.loop.md +++ /dev/null @@ -1,22 +0,0 @@ -#### `tf.train.LooperThread.loop(coord, timer_interval_secs, target, args=None, kwargs=None)` {#LooperThread.loop} - -Start a LooperThread that calls a function periodically. - -If `timer_interval_secs` is None the thread calls `target(args)` -repeatedly. Otherwise `target(args)` is called every `timer_interval_secs` -seconds. The thread terminates when a stop of the coordinator is -requested. - -##### Args: - - -* `coord`: A Coordinator. -* `timer_interval_secs`: Number. Time boundaries at which to call `target`. -* `target`: A callable object. -* `args`: Optional arguments to pass to `target` when calling it. -* `kwargs`: Optional keyword arguments to pass to `target` when calling it. - -##### Returns: - - The started thread. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.NewCheckpointReader.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.NewCheckpointReader.md deleted file mode 100644 index 324dcf80c5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.NewCheckpointReader.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.train.NewCheckpointReader(filepattern)` {#NewCheckpointReader} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.Optimizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.Optimizer.md deleted file mode 100644 index 626a0a87ab..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.Optimizer.md +++ /dev/null @@ -1,265 +0,0 @@ -Base class for optimizers. - -This class defines the API to add Ops to train a model. You never use this -class directly, but instead instantiate one of its subclasses such as -`GradientDescentOptimizer`, `AdagradOptimizer`, or `MomentumOptimizer`. - -### Usage - -```python -# Create an optimizer with the desired parameters. -opt = GradientDescentOptimizer(learning_rate=0.1) -# Add Ops to the graph to minimize a cost by updating a list of variables. -# "cost" is a Tensor, and the list of variables contains tf.Variable -# objects. -opt_op = opt.minimize(cost, var_list=) -``` - -In the training program you will just have to run the returned Op. - -```python -# Execute opt_op to do one step of training: -opt_op.run() -``` - -### Processing gradients before applying them. - -Calling `minimize()` takes care of both computing the gradients and -applying them to the variables. If you want to process the gradients -before applying them you can instead use the optimizer in three steps: - -1. Compute the gradients with `compute_gradients()`. -2. Process the gradients as you wish. -3. Apply the processed gradients with `apply_gradients()`. - -Example: - -```python -# Create an optimizer. -opt = GradientDescentOptimizer(learning_rate=0.1) - -# Compute the gradients for a list of variables. -grads_and_vars = opt.compute_gradients(loss, ) - -# grads_and_vars is a list of tuples (gradient, variable). Do whatever you -# need to the 'gradient' part, for example cap them, etc. -capped_grads_and_vars = [(MyCapper(gv[0]), gv[1]) for gv in grads_and_vars] - -# Ask the optimizer to apply the capped gradients. -opt.apply_gradients(capped_grads_and_vars) -``` - -- - - - -#### `tf.train.Optimizer.__init__(use_locking, name)` {#Optimizer.__init__} - -Create a new Optimizer. - -This must be called by the constructors of subclasses. - -##### Args: - - -* `use_locking`: Bool. If True apply use locks to prevent concurrent updates - to variables. -* `name`: A non-empty string. The name to use for accumulators created - for the optimizer. - -##### Raises: - - -* `ValueError`: If name is malformed. - - - -- - - - -#### `tf.train.Optimizer.minimize(loss, global_step=None, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, name=None, grad_loss=None)` {#Optimizer.minimize} - -Add operations to minimize `loss` by updating `var_list`. - -This method simply combines calls `compute_gradients()` and -`apply_gradients()`. If you want to process the gradient before applying -them call `compute_gradients()` and `apply_gradients()` explicitly instead -of using this function. - -##### Args: - - -* `loss`: A `Tensor` containing the value to minimize. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `name`: Optional name for the returned operation. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - An Operation that updates the variables in `var_list`. If `global_step` - was not `None`, that operation also increments `global_step`. - -##### Raises: - - -* `ValueError`: If some of the variables are not `Variable` objects. - - -- - - - -#### `tf.train.Optimizer.compute_gradients(loss, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, grad_loss=None)` {#Optimizer.compute_gradients} - -Compute gradients of `loss` for the variables in `var_list`. - -This is the first part of `minimize()`. It returns a list -of (gradient, variable) pairs where "gradient" is the gradient -for "variable". Note that "gradient" can be a `Tensor`, an -`IndexedSlices`, or `None` if there is no gradient for the -given variable. - -##### Args: - - -* `loss`: A Tensor containing the value to minimize. -* `var_list`: Optional list of `tf.Variable` to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKey.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - A list of (gradient, variable) pairs. Variable is always present, but - gradient can be `None`. - -##### Raises: - - -* `TypeError`: If `var_list` contains anything else than `Variable` objects. -* `ValueError`: If some arguments are invalid. - - -- - - - -#### `tf.train.Optimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#Optimizer.apply_gradients} - -Apply gradients to variables. - -This is the second part of `minimize()`. It returns an `Operation` that -applies gradients. - -##### Args: - - -* `grads_and_vars`: List of (gradient, variable) pairs as returned by - `compute_gradients()`. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `name`: Optional name for the returned operation. Default to the - name passed to the `Optimizer` constructor. - -##### Returns: - - An `Operation` that applies the specified gradients. If `global_step` - was not None, that operation also increments `global_step`. - -##### Raises: - - -* `TypeError`: If `grads_and_vars` is malformed. -* `ValueError`: If none of the variables have gradients. - - - -### Gating Gradients - -Both `minimize()` and `compute_gradients()` accept a `gate_gradients` -argument that controls the degree of parallelism during the application of -the gradients. - -The possible values are: `GATE_NONE`, `GATE_OP`, and `GATE_GRAPH`. - -`GATE_NONE`: Compute and apply gradients in parallel. This provides -the maximum parallelism in execution, at the cost of some non-reproducibility -in the results. For example the two gradients of `matmul` depend on the input -values: With `GATE_NONE` one of the gradients could be applied to one of the -inputs _before_ the other gradient is computed resulting in non-reproducible -results. - -`GATE_OP`: For each Op, make sure all gradients are computed before -they are used. This prevents race conditions for Ops that generate gradients -for multiple inputs where the gradients depend on the inputs. - -`GATE_GRAPH`: Make sure all gradients for all variables are computed -before any one of them is used. This provides the least parallelism but can -be useful if you want to process all gradients before applying any of them. - -### Slots - -Some optimizer subclasses, such as `MomentumOptimizer` and `AdagradOptimizer` -allocate and manage additional variables associated with the variables to -train. These are called Slots. Slots have names and you can ask the -optimizer for the names of the slots that it uses. Once you have a slot name -you can ask the optimizer for the variable it created to hold the slot value. - -This can be useful if you want to log debug a training algorithm, report stats -about the slots, etc. - -- - - - -#### `tf.train.Optimizer.get_slot_names()` {#Optimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -See `get_slot()`. - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.train.Optimizer.get_slot(var, name)` {#Optimizer.get_slot} - -Return a slot named `name` created for `var` by the Optimizer. - -Some `Optimizer` subclasses use additional variables. For example -`Momentum` and `Adagrad` use variables to accumulate updates. This method -gives access to these `Variable` objects if for some reason you need them. - -Use `get_slot_names()` to get the list of slot names created by the -`Optimizer`. - -##### Args: - - -* `var`: A variable passed to `minimize()` or `apply_gradients()`. -* `name`: A string. - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - - -#### Other Methods -- - - - -#### `tf.train.Optimizer.get_name()` {#Optimizer.get_name} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.Saver.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.Saver.md deleted file mode 100644 index d44000649a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.Saver.md +++ /dev/null @@ -1,372 +0,0 @@ -Saves and restores variables. - -See [Variables](../../how_tos/variables/index.md) -for an overview of variables, saving and restoring. - -The `Saver` class adds ops to save and restore variables to and from -*checkpoints*. It also provides convenience methods to run these ops. - -Checkpoints are binary files in a proprietary format which map variable names -to tensor values. The best way to examine the contents of a checkpoint is to -load it using a `Saver`. - -Savers can automatically number checkpoint filenames with a provided counter. -This lets you keep multiple checkpoints at different steps while training a -model. For example you can number the checkpoint filenames with the training -step number. To avoid filling up disks, savers manage checkpoint files -automatically. For example, they can keep only the N most recent files, or -one checkpoint for every N hours of training. - -You number checkpoint filenames by passing a value to the optional -`global_step` argument to `save()`: - -```python -saver.save(sess, 'my-model', global_step=0) ==> filename: 'my-model-0' -... -saver.save(sess, 'my-model', global_step=1000) ==> filename: 'my-model-1000' -``` - -Additionally, optional arguments to the `Saver()` constructor let you control -the proliferation of checkpoint files on disk: - -* `max_to_keep` indicates the maximum number of recent checkpoint files to - keep. As new files are created, older files are deleted. If None or 0, - all checkpoint files are kept. Defaults to 5 (that is, the 5 most recent - checkpoint files are kept.) - -* `keep_checkpoint_every_n_hours`: In addition to keeping the most recent - `max_to_keep` checkpoint files, you might want to keep one checkpoint file - for every N hours of training. This can be useful if you want to later - analyze how a model progressed during a long training session. For - example, passing `keep_checkpoint_every_n_hours=2` ensures that you keep - one checkpoint file for every 2 hours of training. The default value of - 10,000 hours effectively disables the feature. - -Note that you still have to call the `save()` method to save the model. -Passing these arguments to the constructor will not save variables -automatically for you. - -A training program that saves regularly looks like: - -```python -... -# Create a saver. -saver = tf.train.Saver(...variables...) -# Launch the graph and train, saving the model every 1,000 steps. -sess = tf.Session() -for step in xrange(1000000): - sess.run(..training_op..) - if step % 1000 == 0: - # Append the step number to the checkpoint name: - saver.save(sess, 'my-model', global_step=step) -``` - -In addition to checkpoint files, savers keep a protocol buffer on disk with -the list of recent checkpoints. This is used to manage numbered checkpoint -files and by `latest_checkpoint()`, which makes it easy to discover the path -to the most recent checkpoint. That protocol buffer is stored in a file named -'checkpoint' next to the checkpoint files. - -If you create several savers, you can specify a different filename for the -protocol buffer file in the call to `save()`. - -- - - - -#### `tf.train.Saver.__init__(var_list=None, reshape=False, sharded=False, max_to_keep=5, keep_checkpoint_every_n_hours=10000.0, name=None, restore_sequentially=False, saver_def=None, builder=None, defer_build=False, allow_empty=False, write_version=2, pad_step_number=False)` {#Saver.__init__} - -Creates a `Saver`. - -The constructor adds ops to save and restore variables. - -`var_list` specifies the variables that will be saved and restored. It can -be passed as a `dict` or a list: - -* A `dict` of names to variables: The keys are the names that will be - used to save or restore the variables in the checkpoint files. -* A list of variables: The variables will be keyed with their op name in - the checkpoint files. - -For example: - -```python -v1 = tf.Variable(..., name='v1') -v2 = tf.Variable(..., name='v2') - -# Pass the variables as a dict: -saver = tf.train.Saver({'v1': v1, 'v2': v2}) - -# Or pass them as a list. -saver = tf.train.Saver([v1, v2]) -# Passing a list is equivalent to passing a dict with the variable op names -# as keys: -saver = tf.train.Saver({v.op.name: v for v in [v1, v2]}) -``` - -The optional `reshape` argument, if `True`, allows restoring a variable from -a save file where the variable had a different shape, but the same number -of elements and type. This is useful if you have reshaped a variable and -want to reload it from an older checkpoint. - -The optional `sharded` argument, if `True`, instructs the saver to shard -checkpoints per device. - -##### Args: - - -* `var_list`: A list of `Variable`/`SaveableObject`, or a dictionary mapping - names to `SaveableObject`s. If `None`, defaults to the list of all - saveable objects. -* `reshape`: If `True`, allows restoring parameters from a checkpoint - where the variables have a different shape. -* `sharded`: If `True`, shard the checkpoints, one per device. -* `max_to_keep`: Maximum number of recent checkpoints to keep. - Defaults to 5. -* `keep_checkpoint_every_n_hours`: How often to keep checkpoints. - Defaults to 10,000 hours. -* `name`: String. Optional name to use as a prefix when adding operations. -* `restore_sequentially`: A `Bool`, which if true, causes restore of different - variables to happen sequentially within each device. This can lower - memory usage when restoring very large models. -* `saver_def`: Optional `SaverDef` proto to use instead of running the - builder. This is only useful for specialty code that wants to recreate - a `Saver` object for a previously built `Graph` that had a `Saver`. - The `saver_def` proto should be the one returned by the - `as_saver_def()` call of the `Saver` that was created for that `Graph`. -* `builder`: Optional `SaverBuilder` to use if a `saver_def` was not provided. - Defaults to `BaseSaverBuilder()`. -* `defer_build`: If `True`, defer adding the save and restore ops to the - `build()` call. In that case `build()` should be called before - finalizing the graph or using the saver. -* `allow_empty`: If `False` (default) raise an error if there are no - variables in the graph. Otherwise, construct the saver anyway and make - it a no-op. -* `write_version`: controls what format to use when saving checkpoints. It - also affects certain filepath matching logic. The V2 format is the - recommended choice: it is much more optimized than V1 in terms of - memory required and latency incurred during restore. Regardless of - this flag, the Saver is able to restore from both V2 and V1 checkpoints. -* `pad_step_number`: if True, pads the global step number in the checkpoint - filepaths to some fixed width (8 by default). This is turned off by - default. - -##### Raises: - - -* `TypeError`: If `var_list` is invalid. -* `ValueError`: If any of the keys or values in `var_list` are not unique. - - -- - - - -#### `tf.train.Saver.save(sess, save_path, global_step=None, latest_filename=None, meta_graph_suffix='meta', write_meta_graph=True, write_state=True)` {#Saver.save} - -Saves variables. - -This method runs the ops added by the constructor for saving variables. -It requires a session in which the graph was launched. The variables to -save must also have been initialized. - -The method returns the path of the newly created checkpoint file. This -path can be passed directly to a call to `restore()`. - -##### Args: - - -* `sess`: A Session to use to save the variables. -* `save_path`: String. Path to the checkpoint filename. If the saver is - `sharded`, this is the prefix of the sharded checkpoint filename. -* `global_step`: If provided the global step number is appended to - `save_path` to create the checkpoint filename. The optional argument - can be a `Tensor`, a `Tensor` name or an integer. -* `latest_filename`: Optional name for the protocol buffer file that will - contains the list of most recent checkpoint filenames. That file, - kept in the same directory as the checkpoint files, is automatically - managed by the saver to keep track of recent checkpoints. Defaults to - 'checkpoint'. -* `meta_graph_suffix`: Suffix for `MetaGraphDef` file. Defaults to 'meta'. -* `write_meta_graph`: `Boolean` indicating whether or not to write the meta - graph file. -* `write_state`: `Boolean` indicating whether or not to write the - `CheckpointStateProto`. - -##### Returns: - - A string: path at which the variables were saved. If the saver is - sharded, this string ends with: '-?????-of-nnnnn' where 'nnnnn' - is the number of shards created. - If the saver is empty, returns None. - -##### Raises: - - -* `TypeError`: If `sess` is not a `Session`. -* `ValueError`: If `latest_filename` contains path components, or if it - collides with `save_path`. -* `RuntimeError`: If save and restore ops weren't built. - - -- - - - -#### `tf.train.Saver.restore(sess, save_path)` {#Saver.restore} - -Restores previously saved variables. - -This method runs the ops added by the constructor for restoring variables. -It requires a session in which the graph was launched. The variables to -restore do not have to have been initialized, as restoring is itself a way -to initialize variables. - -The `save_path` argument is typically a value previously returned from a -`save()` call, or a call to `latest_checkpoint()`. - -##### Args: - - -* `sess`: A `Session` to use to restore the parameters. -* `save_path`: Path where parameters were previously saved. - - - -Other utility methods. - -- - - - -#### `tf.train.Saver.last_checkpoints` {#Saver.last_checkpoints} - -List of not-yet-deleted checkpoint filenames. - -You can pass any of the returned values to `restore()`. - -##### Returns: - - A list of checkpoint filenames, sorted from oldest to newest. - - -- - - - -#### `tf.train.Saver.set_last_checkpoints_with_time(last_checkpoints_with_time)` {#Saver.set_last_checkpoints_with_time} - -Sets the list of old checkpoint filenames and timestamps. - -##### Args: - - -* `last_checkpoints_with_time`: A list of tuples of checkpoint filenames and - timestamps. - -##### Raises: - - -* `AssertionError`: If last_checkpoints_with_time is not a list. - - -- - - - -#### `tf.train.Saver.recover_last_checkpoints(checkpoint_paths)` {#Saver.recover_last_checkpoints} - -Recovers the internal saver state after a crash. - -This method is useful for recovering the "self._last_checkpoints" state. - -Globs for the checkpoints pointed to by `checkpoint_paths`. If the files -exist, use their mtime as the checkpoint timestamp. - -##### Args: - - -* `checkpoint_paths`: a list of checkpoint paths. - - -- - - - -#### `tf.train.Saver.as_saver_def()` {#Saver.as_saver_def} - -Generates a `SaverDef` representation of this saver. - -##### Returns: - - A `SaverDef` proto. - - - -#### Other Methods -- - - - -#### `tf.train.Saver.build()` {#Saver.build} - -Builds saver_def. - - -- - - - -#### `tf.train.Saver.export_meta_graph(filename=None, collection_list=None, as_text=False, export_scope=None, clear_devices=False)` {#Saver.export_meta_graph} - -Writes `MetaGraphDef` to save_path/filename. - -##### Args: - - -* `filename`: Optional meta_graph filename including the path. -* `collection_list`: List of string keys to collect. -* `as_text`: If `True`, writes the meta_graph as an ASCII proto. -* `export_scope`: Optional `string`. Name scope to remove. -* `clear_devices`: Whether or not to clear the device field for an `Operation` - or `Tensor` during export. - -##### Returns: - - A `MetaGraphDef` proto. - - -- - - - -#### `tf.train.Saver.from_proto(saver_def, import_scope=None)` {#Saver.from_proto} - -Returns a `Saver` object created from `saver_def`. - -##### Args: - - -* `saver_def`: a `SaveDef` protocol buffer. -* `import_scope`: Optional `string`. Name scope to use. - -##### Returns: - - A `Saver` built from saver_def. - - -- - - - -#### `tf.train.Saver.set_last_checkpoints(last_checkpoints)` {#Saver.set_last_checkpoints} - -DEPRECATED: Use set_last_checkpoints_with_time. - -Sets the list of old checkpoint filenames. - -##### Args: - - -* `last_checkpoints`: A list of checkpoint filenames. - -##### Raises: - - -* `AssertionError`: If last_checkpoints is not a list. - - -- - - - -#### `tf.train.Saver.to_proto(export_scope=None)` {#Saver.to_proto} - -Converts this `Saver` to a `SaverDef` protocol buffer. - -##### Args: - - -* `export_scope`: Optional `string`. Name scope to remove. - -##### Returns: - - A `SaverDef` protocol buffer. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.SessionManager.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.SessionManager.md deleted file mode 100644 index c142b2aca8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.SessionManager.md +++ /dev/null @@ -1,209 +0,0 @@ -Training helper that restores from checkpoint and creates session. - -This class is a small wrapper that takes care of session creation and -checkpoint recovery. It also provides functions that to facilitate -coordination among multiple training threads or processes. - -* Checkpointing trained variables as the training progresses. -* Initializing variables on startup, restoring them from the most recent - checkpoint after a crash, or wait for checkpoints to become available. - -### Usage: - -```python -with tf.Graph().as_default(): - ...add operations to the graph... - # Create a SessionManager that will checkpoint the model in '/tmp/mydir'. - sm = SessionManager() - sess = sm.prepare_session(master, init_op, saver, checkpoint_dir) - # Use the session to train the graph. - while True: - sess.run() -``` - -`prepare_session()` initializes or restores a model. It requires `init_op` -and `saver` as an argument. - -A second process could wait for the model to be ready by doing the following: - -```python -with tf.Graph().as_default(): - ...add operations to the graph... - # Create a SessionManager that will wait for the model to become ready. - sm = SessionManager() - sess = sm.wait_for_session(master) - # Use the session to train the graph. - while True: - sess.run() -``` - -`wait_for_session()` waits for a model to be initialized by other processes. -- - - - -#### `tf.train.SessionManager.__init__(local_init_op=None, ready_op=None, ready_for_local_init_op=None, graph=None, recovery_wait_secs=30)` {#SessionManager.__init__} - -Creates a SessionManager. - -The `local_init_op` is an `Operation` that is run always after a new session -was created. If `None`, this step is skipped. - -The `ready_op` is an `Operation` used to check if the model is ready. The -model is considered ready if that operation returns an empty 1D string -tensor. If the operation returns a non empty 1D string tensor, the elements -are concatenated and used to indicate to the user why the model is not -ready. - -The `ready_for_local_init_op` is an `Operation` used to check if the model -is ready to run local_init_op. The model is considered ready if that -operation returns an empty 1D string tensor. If the operation returns a non -empty 1D string tensor, the elements are concatenated and used to indicate -to the user why the model is not ready. - -If `ready_op` is `None`, the model is not checked for readiness. - -`recovery_wait_secs` is the number of seconds between checks that -the model is ready. It is used by processes to wait for a model to -be initialized or restored. Defaults to 30 seconds. - -##### Args: - - -* `local_init_op`: An `Operation` run immediately after session creation. - Usually used to initialize tables and local variables. -* `ready_op`: An `Operation` to check if the model is initialized. -* `ready_for_local_init_op`: An `Operation` to check if the model is ready - to run local_init_op. -* `graph`: The `Graph` that the model will use. -* `recovery_wait_secs`: Seconds between checks for the model to be ready. - -##### Raises: - - -* `ValueError`: If ready_for_local_init_op is not None but local_init_op is - None - - -- - - - -#### `tf.train.SessionManager.prepare_session(master, init_op=None, saver=None, checkpoint_dir=None, checkpoint_filename_with_path=None, wait_for_checkpoint=False, max_wait_secs=7200, config=None, init_feed_dict=None, init_fn=None)` {#SessionManager.prepare_session} - -Creates a `Session`. Makes sure the model is ready to be used. - -Creates a `Session` on 'master'. If a `saver` object is passed in, and -`checkpoint_dir` points to a directory containing valid checkpoint -files, then it will try to recover the model from checkpoint. If -no checkpoint files are available, and `wait_for_checkpoint` is -`True`, then the process would check every `recovery_wait_secs`, -up to `max_wait_secs`, for recovery to succeed. - -If the model cannot be recovered successfully then it is initialized by -either running the provided `init_op`, or calling the provided `init_fn`. -The local_init_op is also run after init_op and init_fn, regardless of -whether the model was recovered successfully, but only if -ready_for_local_init_op passes. - -It is an error if the model cannot be recovered and no `init_op` -or `init_fn` or `local_init_op` are passed. - -##### Args: - - -* `master`: `String` representation of the TensorFlow master to use. -* `init_op`: Optional `Operation` used to initialize the model. -* `saver`: A `Saver` object used to restore a model. -* `checkpoint_dir`: Path to the checkpoint files. The latest checkpoint in the - dir will be used to restore. -* `checkpoint_filename_with_path`: Full file name path to the checkpoint file. -* `wait_for_checkpoint`: Whether to wait for checkpoint to become available. -* `max_wait_secs`: Maximum time to wait for checkpoints to become available. -* `config`: Optional `ConfigProto` proto used to configure the session. -* `init_feed_dict`: Optional dictionary that maps `Tensor` objects to feed - values. This feed dictionary is passed to the session `run()` call when - running the init op. -* `init_fn`: Optional callable used to initialize the model. Called after the - optional `init_op` is called. The callable must accept one argument, - the session being initialized. - -##### Returns: - - A `Session` object that can be used to drive the model. - -##### Raises: - - -* `RuntimeError`: If the model cannot be initialized or recovered. - -##### Raises: - - -* `ValueError`: If both checkpoint_dir and checkpoint_filename_with_path are - set. - - -- - - - -#### `tf.train.SessionManager.recover_session(master, saver=None, checkpoint_dir=None, checkpoint_filename_with_path=None, wait_for_checkpoint=False, max_wait_secs=7200, config=None)` {#SessionManager.recover_session} - -Creates a `Session`, recovering if possible. - -Creates a new session on 'master'. If the session is not initialized -and can be recovered from a checkpoint, recover it. - -##### Args: - - -* `master`: `String` representation of the TensorFlow master to use. -* `saver`: A `Saver` object used to restore a model. -* `checkpoint_dir`: Path to the checkpoint files. The latest checkpoint in the - dir will be used to restore. -* `checkpoint_filename_with_path`: Full file name path to the checkpoint file. -* `wait_for_checkpoint`: Whether to wait for checkpoint to become available. -* `max_wait_secs`: Maximum time to wait for checkpoints to become available. -* `config`: Optional `ConfigProto` proto used to configure the session. - -##### Returns: - - A pair (sess, initialized) where 'initialized' is `True` if - the session could be recovered and initialized, `False` otherwise. - -##### Raises: - - -* `ValueError`: If both checkpoint_dir and checkpoint_filename_with_path are - set. - - -- - - - -#### `tf.train.SessionManager.wait_for_session(master, config=None, max_wait_secs=inf)` {#SessionManager.wait_for_session} - -Creates a new `Session` and waits for model to be ready. - -Creates a new `Session` on 'master'. Waits for the model to be -initialized or recovered from a checkpoint. It's expected that -another thread or process will make the model ready, and that this -is intended to be used by threads/processes that participate in a -distributed training configuration where a different thread/process -is responsible for initializing or recovering the model being trained. - -NB: The amount of time this method waits for the session is bounded -by max_wait_secs. By default, this function will wait indefinitely. - -##### Args: - - -* `master`: `String` representation of the TensorFlow master to use. -* `config`: Optional ConfigProto proto used to configure the session. -* `max_wait_secs`: Maximum time to wait for the session to become available. - -##### Returns: - - A `Session`. May be None if the operation exceeds the timeout - specified by config.operation_timeout_in_ms. - -##### Raises: - - tf.DeadlineExceededError: if the session is not available after - max_wait_secs. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.checkpoint_exists.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.checkpoint_exists.md deleted file mode 100644 index f28e994e52..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.checkpoint_exists.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.train.checkpoint_exists(checkpoint_prefix)` {#checkpoint_exists} - -Checks whether a V1 or V2 checkpoint exists with the specified prefix. - -This is the recommended way to check if a checkpoint exists, since it takes -into account the naming difference between V1 and V2 formats. - -##### Args: - - -* `checkpoint_prefix`: the prefix of a V1 or V2 checkpoint, with V2 taking - priority. Typically the result of `Saver.save()` or that of - `tf.train.latest_checkpoint()`, regardless of sharded/non-sharded or - V1/V2. - -##### Returns: - - A bool, true iff a checkpoint referred to by `checkpoint_prefix` exists. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.maybe_shuffle_batch.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.maybe_shuffle_batch.md deleted file mode 100644 index 2c90ddfafe..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.maybe_shuffle_batch.md +++ /dev/null @@ -1,41 +0,0 @@ -### `tf.train.maybe_shuffle_batch(tensors, batch_size, capacity, min_after_dequeue, keep_input, num_threads=1, seed=None, enqueue_many=False, shapes=None, allow_smaller_final_batch=False, shared_name=None, name=None)` {#maybe_shuffle_batch} - -Creates batches by randomly shuffling conditionally-enqueued tensors. - -See docstring in `shuffle_batch` for more details. - -##### Args: - - -* `tensors`: The list or dictionary of tensors to enqueue. -* `batch_size`: The new batch size pulled from the queue. -* `capacity`: An integer. The maximum number of elements in the queue. -* `min_after_dequeue`: Minimum number elements in the queue after a - dequeue, used to ensure a level of mixing of elements. -* `keep_input`: A `bool` Tensor. This tensor controls whether the input is - added to the queue or not. If it is a scalar and evaluates `True`, then - `tensors` are all added to the queue. If it is a vector and `enqueue_many` - is `True`, then each example is added to the queue only if the - corresonding value in `keep_input` is `True`. This tensor essentially acts - as a filtering mechanism. -* `num_threads`: The number of threads enqueuing `tensor_list`. -* `seed`: Seed for the random shuffling within the queue. -* `enqueue_many`: Whether each tensor in `tensor_list` is a single example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensor_list`. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (Optional) If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the types as `tensors`. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensors`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.piecewise_constant.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.piecewise_constant.md deleted file mode 100644 index b41f38eb49..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.piecewise_constant.md +++ /dev/null @@ -1,41 +0,0 @@ -### `tf.train.piecewise_constant(x, boundaries, values, name=None)` {#piecewise_constant} - -Piecewise constant from boundaries and interval values. - -Example: use a learning rate that's 1.0 for the first 100000 steps, 0.5 - for steps 100001 to 110000, and 0.1 for any additional steps. - -```python -global_step = tf.Variable(0, trainable=False) -boundaries = [100000, 110000] -values = [1.0, 0.5, 0.1] -learning_rate = tf.train.piecewise_constant(global_step, boundaries, values) - -# Later, whenever we perform an optimization step, we increment global_step. -``` - -##### Args: - - -* `x`: A 0-D scalar `Tensor`. Must be one of the following types: `float32`, - `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`. -* `boundaries`: A list of `Tensor`s or `int`s or `float`s with strictly - increasing entries, and with all elements having the same type as `x`. -* `values`: A list of `Tensor`s or float`s or `int`s that specifies the values - for the intervals defined by `boundaries`. It should have one more element - than `boundaries`, and all elements should have the same type. -* `name`: A string. Optional name of the operation. Defaults to - 'PiecewiseConstant'. - -##### Returns: - - A 0-D Tensor. Its value is `values[0]` when `x <= boundaries[0]`, - `values[1]` when `x > boundaries[0]` and `x <= boundaries[1]`, ..., - and values[-1] when `x > boundaries[-1]`. - -##### Raises: - - -* `ValueError`: if types of `x` and `buondaries` do not match, or types of all - `values` do not match. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.polynomial_decay.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.polynomial_decay.md deleted file mode 100644 index 64a365fb08..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.polynomial_decay.md +++ /dev/null @@ -1,78 +0,0 @@ -### `tf.train.polynomial_decay(learning_rate, global_step, decay_steps, end_learning_rate=0.0001, power=1.0, cycle=False, name=None)` {#polynomial_decay} - -Applies a polynomial decay to the learning rate. - -It is commonly observed that a monotonically decreasing learning rate, whose -degree of change is carefully chosen, results in a better performing model. -This function applies a polynomial decay function to a provided initial -`learning_rate` to reach an `end_learning_rate` in the given `decay_steps`. - -It requires a `global_step` value to compute the decayed learning rate. You -can just pass a TensorFlow variable that you increment at each training step. - -The function returns the decayed learning rate. It is computed as: - -```python -global_step = min(global_step, decay_steps) -decayed_learning_rate = (learning_rate - end_learning_rate) * - (1 - global_step / decay_steps) ^ (power) + - end_learning_rate - -``` - -If `cycle` is True then a multiple of `decay_steps` is used, the first one -that is bigger than `global_steps`. - -```python -decay_steps = decay_steps * ceil(global_step / decay_steps) -decayed_learning_rate = (learning_rate - end_learning_rate) * - (1 - global_step / decay_steps) ^ (power) + - end_learning_rate - -``` - -Example: decay from 0.1 to 0.01 in 10000 steps using sqrt (i.e. power=0.5): - -```python -... -global_step = tf.Variable(0, trainable=False) -starter_learning_rate = 0.1 -end_learning_rate = 0.01 -decay_steps = 10000 -learning_rate = tf.train.polynomial_decay(starter_learning_rate, global_step, - decay_steps, end_learning_rate, - power=0.5) -# Passing global_step to minimize() will increment it at each step. -learning_step = ( - tf.train.GradientDescentOptimizer(learning_rate) - .minimize(...my loss..., global_step=global_step) -) -``` - -##### Args: - - -* `learning_rate`: A scalar `float32` or `float64` `Tensor` or a - Python number. The initial learning rate. -* `global_step`: A scalar `int32` or `int64` `Tensor` or a Python number. - Global step to use for the decay computation. Must not be negative. -* `decay_steps`: A scalar `int32` or `int64` `Tensor` or a Python number. - Must be positive. See the decay computation above. -* `end_learning_rate`: A scalar `float32` or `float64` `Tensor` or a - Python number. The minimal end learning rate. -* `power`: A scalar `float32` or `float64` `Tensor` or a - Python number. The power of the polynomial. Defaults to sqrt, i.e. 0.5. -* `cycle`: A boolean, whether or not it should cycle beyond decay_steps. -* `name`: String. Optional name of the operation. Defaults to - 'PolynomialDecay'. - -##### Returns: - - A scalar `Tensor` of the same type as `learning_rate`. The decayed - learning rate. - -##### Raises: - - -* `ValueError`: if `global_step` is not supplied. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.replica_device_setter.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.replica_device_setter.md deleted file mode 100644 index 4009cc9b30..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.train.replica_device_setter.md +++ /dev/null @@ -1,63 +0,0 @@ -### `tf.train.replica_device_setter(ps_tasks=0, ps_device='/job:ps', worker_device='/job:worker', merge_devices=True, cluster=None, ps_ops=None, ps_strategy=None)` {#replica_device_setter} - -Return a `device function` to use when building a Graph for replicas. - -Device Functions are used in `with tf.device(device_function):` statement to -automatically assign devices to `Operation` objects as they are constructed, -Device constraints are added from the inner-most context first, working -outwards. The merging behavior adds constraints to fields that are yet unset -by a more inner context. Currently the fields are (job, task, cpu/gpu). - -If `cluster` is `None`, and `ps_tasks` is 0, the returned function is a no-op. -Otherwise, the value of `ps_tasks` is derived from `cluster`. - -By default, only Variable ops are placed on ps tasks, and the placement -strategy is round-robin over all ps tasks. A custom `ps_strategy` may be used -to do more intelligent placement, such as -`tf.contrib.training.GreedyLoadBalancingStrategy`. - -For example, - -```python -# To build a cluster with two ps jobs on hosts ps0 and ps1, and 3 worker -# jobs on hosts worker0, worker1 and worker2. -cluster_spec = { - "ps": ["ps0:2222", "ps1:2222"], - "worker": ["worker0:2222", "worker1:2222", "worker2:2222"]} -with tf.device(tf.train.replica_device_setter(cluster=cluster_spec)): - # Build your graph - v1 = tf.Variable(...) # assigned to /job:ps/task:0 - v2 = tf.Variable(...) # assigned to /job:ps/task:1 - v3 = tf.Variable(...) # assigned to /job:ps/task:0 -# Run compute -``` - -##### Args: - - -* `ps_tasks`: Number of tasks in the `ps` job. Ignored if `cluster` is - provided. -* `ps_device`: String. Device of the `ps` job. If empty no `ps` job is used. - Defaults to `ps`. -* `worker_device`: String. Device of the `worker` job. If empty no `worker` - job is used. -* `merge_devices`: `Boolean`. If `True`, merges or only sets a device if the - device constraint is completely unset. merges device specification rather - than overriding them. -* `cluster`: `ClusterDef` proto or `ClusterSpec`. -* `ps_ops`: List of strings representing `Operation` types that need to be - placed on `ps` devices. If `None`, defaults to `["Variable"]`. -* `ps_strategy`: A callable invoked for every ps `Operation` (i.e. matched by - `ps_ops`), that takes the `Operation` and returns the ps task index to - use. If `None`, defaults to a round-robin strategy across all `ps` - devices. - -##### Returns: - - A function to pass to `tf.device()`. - -##### Raises: - - TypeError if `cluster` is not a dictionary or `ClusterDef` protocol buffer, - or if `ps_strategy` is provided but not a callable. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.transpose.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.transpose.md deleted file mode 100644 index c6b76c7824..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.transpose.md +++ /dev/null @@ -1,49 +0,0 @@ -### `tf.transpose(a, perm=None, name='transpose')` {#transpose} - -Transposes `a`. Permutes the dimensions according to `perm`. - -The returned tensor's dimension i will correspond to the input dimension -`perm[i]`. If `perm` is not given, it is set to (n-1...0), where n is -the rank of the input tensor. Hence by default, this operation performs a -regular matrix transpose on 2-D input Tensors. - -For example: - -```python -# 'x' is [[1 2 3] -# [4 5 6]] -tf.transpose(x) ==> [[1 4] - [2 5] - [3 6]] - -# Equivalently -tf.transpose(x, perm=[1, 0]) ==> [[1 4] - [2 5] - [3 6]] - -# 'perm' is more useful for n-dimensional tensors, for n > 2 -# 'x' is [[[1 2 3] -# [4 5 6]] -# [[7 8 9] -# [10 11 12]]] -# Take the transpose of the matrices in dimension-0 -tf.transpose(x, perm=[0, 2, 1]) ==> [[[1 4] - [2 5] - [3 6]] - - [[7 10] - [8 11] - [9 12]]] -``` - -##### Args: - - -* `a`: A `Tensor`. -* `perm`: A permutation of the dimensions of `a`. -* `name`: A name for the operation (optional). - -##### Returns: - - A transposed `Tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.truncated_normal_initializer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.truncated_normal_initializer.md deleted file mode 100644 index 7ccec1074a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.truncated_normal_initializer.md +++ /dev/null @@ -1,30 +0,0 @@ -Initializer that generates a truncated normal distribution. - -These values are similar to values from a `random_normal_initializer` -except that values more than two standard deviations from the mean -are discarded and re-drawn. This is the recommended initializer for -neural network weights and filters. - -Args: - mean: a python scalar or a scalar tensor. Mean of the random values - to generate. - stddev: a python scalar or a scalar tensor. Standard deviation of the - random values to generate. - seed: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - dtype: The data type. Only floating point types are supported. -- - - - -#### `tf.truncated_normal_initializer.__call__(shape, dtype=None, partition_info=None)` {#truncated_normal_initializer.__call__} - - - - -- - - - -#### `tf.truncated_normal_initializer.__init__(mean=0.0, stddev=1.0, seed=None, dtype=tf.float32)` {#truncated_normal_initializer.__init__} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.variable_op_scope.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.variable_op_scope.md deleted file mode 100644 index 266ac318e4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.variable_op_scope.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.variable_op_scope(values, name_or_scope, default_name=None, initializer=None, regularizer=None, caching_device=None, partitioner=None, custom_getter=None, reuse=None, dtype=None, use_resource=None)` {#variable_op_scope} - -Deprecated: context manager for defining an op that creates variables. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.verify_tensor_all_finite.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.verify_tensor_all_finite.md deleted file mode 100644 index 37fa105df5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard5/tf.verify_tensor_all_finite.md +++ /dev/null @@ -1,15 +0,0 @@ -### `tf.verify_tensor_all_finite(t, msg, name=None)` {#verify_tensor_all_finite} - -Assert that the tensor does not contain any NaN's or Inf's. - -##### Args: - - -* `t`: Tensor to check. -* `msg`: Message to log on failure. -* `name`: A name for this operation (optional). - -##### Returns: - - Same tensor as `t`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.Dimension.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.Dimension.md deleted file mode 100644 index 18d6d04fc0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.Dimension.md +++ /dev/null @@ -1,361 +0,0 @@ -Represents the value of one dimension in a TensorShape. -- - - - -#### `tf.Dimension.__add__(other)` {#Dimension.__add__} - -Returns the sum of `self` and `other`. - -Dimensions are summed as follows: - - Dimension(m) + Dimension(n) == Dimension(m + n) - Dimension(m) + Dimension(None) == Dimension(None) - Dimension(None) + Dimension(n) == Dimension(None) - Dimension(None) + Dimension(None) == Dimension(None) - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - A Dimension whose value is the sum of `self` and `other`. - - -- - - - -#### `tf.Dimension.__div__(other)` {#Dimension.__div__} - -DEPRECATED: Use `__floordiv__` via `x // y` instead. - -This function exists only for backwards compatibility purposes; new code -should use `__floordiv__` via the syntax `x // y`. Using `x // y` -communicates clearly that the result rounds down, and is forward compatible -to Python 3. - -##### Args: - - -* `other`: Another `Dimension`. - -##### Returns: - - A `Dimension` whose value is the integer quotient of `self` and `other`. - - -- - - - -#### `tf.Dimension.__eq__(other)` {#Dimension.__eq__} - -Returns true if `other` has the same known value as this Dimension. - - -- - - - -#### `tf.Dimension.__floordiv__(other)` {#Dimension.__floordiv__} - -Returns the quotient of `self` and `other` rounded down. - -Dimensions are divided as follows: - - Dimension(m) // Dimension(n) == Dimension(m // n) - Dimension(m) // Dimension(None) == Dimension(None) - Dimension(None) // Dimension(n) == Dimension(None) - Dimension(None) // Dimension(None) == Dimension(None) - -##### Args: - - -* `other`: Another `Dimension`. - -##### Returns: - - A `Dimension` whose value is the integer quotient of `self` and `other`. - - -- - - - -#### `tf.Dimension.__ge__(other)` {#Dimension.__ge__} - -Returns True if `self` is known to be greater than or equal to `other`. - -Dimensions are compared as follows: - - Dimension(m) >= Dimension(n) == m >= n - Dimension(m) >= Dimension(None) == None - Dimension(None) >= Dimension(n) == None - Dimension(None) >= Dimension(None) == None - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - The value of `self.value >= other.value` if both are known, otherwise - None. - - -- - - - -#### `tf.Dimension.__gt__(other)` {#Dimension.__gt__} - -Returns True if `self` is known to be greater than `other`. - -Dimensions are compared as follows: - - Dimension(m) > Dimension(n) == m > n - Dimension(m) > Dimension(None) == None - Dimension(None) > Dimension(n) == None - Dimension(None) > Dimension(None) == None - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - The value of `self.value > other.value` if both are known, otherwise - None. - - -- - - - -#### `tf.Dimension.__index__()` {#Dimension.__index__} - - - - -- - - - -#### `tf.Dimension.__init__(value)` {#Dimension.__init__} - -Creates a new Dimension with the given value. - - -- - - - -#### `tf.Dimension.__int__()` {#Dimension.__int__} - - - - -- - - - -#### `tf.Dimension.__le__(other)` {#Dimension.__le__} - -Returns True if `self` is known to be less than or equal to `other`. - -Dimensions are compared as follows: - - Dimension(m) <= Dimension(n) == m <= n - Dimension(m) <= Dimension(None) == None - Dimension(None) <= Dimension(n) == None - Dimension(None) <= Dimension(None) == None - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - The value of `self.value <= other.value` if both are known, otherwise - None. - - -- - - - -#### `tf.Dimension.__lt__(other)` {#Dimension.__lt__} - -Returns True if `self` is known to be less than `other`. - -Dimensions are compared as follows: - - Dimension(m) < Dimension(n) == m < n - Dimension(m) < Dimension(None) == None - Dimension(None) < Dimension(n) == None - Dimension(None) < Dimension(None) == None - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - The value of `self.value < other.value` if both are known, otherwise - None. - - -- - - - -#### `tf.Dimension.__mod__(other)` {#Dimension.__mod__} - -Returns `self` modulo `other. - -Dimension moduli are computed as follows: - - Dimension(m) % Dimension(n) == Dimension(m % n) - Dimension(m) % Dimension(None) == Dimension(None) - Dimension(None) % Dimension(n) == Dimension(None) - Dimension(None) % Dimension(None) == Dimension(None) - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - A Dimension whose value is `self` modulo `other`. - - -- - - - -#### `tf.Dimension.__mul__(other)` {#Dimension.__mul__} - -Returns the product of `self` and `other`. - -Dimensions are summed as follows: - -``` - Dimension(m) * Dimension(n) == Dimension(m * n) - Dimension(m) * Dimension(None) == Dimension(None) - Dimension(None) * Dimension(n) == Dimension(None) - Dimension(None) * Dimension(None) == Dimension(None) -``` - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - A Dimension whose value is the product of `self` and `other`. - - -- - - - -#### `tf.Dimension.__ne__(other)` {#Dimension.__ne__} - -Returns true if `other` has a different known value from `self`. - - -- - - - -#### `tf.Dimension.__repr__()` {#Dimension.__repr__} - - - - -- - - - -#### `tf.Dimension.__str__()` {#Dimension.__str__} - - - - -- - - - -#### `tf.Dimension.__sub__(other)` {#Dimension.__sub__} - -Returns the subtraction of `other` from `self`. - -Dimensions are subtracted as follows: - - Dimension(m) - Dimension(n) == Dimension(m - n) - Dimension(m) - Dimension(None) == Dimension(None) - Dimension(None) - Dimension(n) == Dimension(None) - Dimension(None) - Dimension(None) == Dimension(None) - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - A Dimension whose value is the subtraction of sum of `other` from `self`. - - -- - - - -#### `tf.Dimension.assert_is_compatible_with(other)` {#Dimension.assert_is_compatible_with} - -Raises an exception if `other` is not compatible with this Dimension. - -##### Args: - - -* `other`: Another Dimension. - -##### Raises: - - -* `ValueError`: If `self` and `other` are not compatible (see - is_compatible_with). - - -- - - - -#### `tf.Dimension.is_compatible_with(other)` {#Dimension.is_compatible_with} - -Returns true if `other` is compatible with this Dimension. - -Two known Dimensions are compatible if they have the same value. -An unknown Dimension is compatible with all other Dimensions. - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - True if this Dimension and `other` are compatible. - - -- - - - -#### `tf.Dimension.merge_with(other)` {#Dimension.merge_with} - -Returns a Dimension that combines the information in `self` and `other`. - -Dimensions are combined as follows: - -```python - Dimension(n) .merge_with(Dimension(n)) == Dimension(n) - Dimension(n) .merge_with(Dimension(None)) == Dimension(n) - Dimension(None).merge_with(Dimension(n)) == Dimension(n) - Dimension(None).merge_with(Dimension(None)) == Dimension(None) - Dimension(n) .merge_with(Dimension(m)) raises ValueError for n != m -``` - -##### Args: - - -* `other`: Another Dimension. - -##### Returns: - - A Dimension containing the combined information of `self` and - `other`. - -##### Raises: - - -* `ValueError`: If `self` and `other` are not compatible (see - is_compatible_with). - - -- - - - -#### `tf.Dimension.value` {#Dimension.value} - -The value of this dimension, or None if it is unknown. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.FixedLenSequenceFeature.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.FixedLenSequenceFeature.md deleted file mode 100644 index 49d7b07cb4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.FixedLenSequenceFeature.md +++ /dev/null @@ -1,59 +0,0 @@ -Configuration for a dense input feature in a sequence item. - -To treat a sparse input as dense, provide `allow_missing=True`; otherwise, -the parse functions will fail on any examples missing this feature. - -Fields: - shape: Shape of input data. - dtype: Data type of input. - allow_missing: Whether to allow this feature to be missing from a feature - list item. -- - - - -#### `tf.FixedLenSequenceFeature.__getnewargs__()` {#FixedLenSequenceFeature.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.FixedLenSequenceFeature.__getstate__()` {#FixedLenSequenceFeature.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.FixedLenSequenceFeature.__new__(_cls, shape, dtype, allow_missing=False)` {#FixedLenSequenceFeature.__new__} - -Create new instance of FixedLenSequenceFeature(shape, dtype, allow_missing) - - -- - - - -#### `tf.FixedLenSequenceFeature.__repr__()` {#FixedLenSequenceFeature.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.FixedLenSequenceFeature.allow_missing` {#FixedLenSequenceFeature.allow_missing} - -Alias for field number 2 - - -- - - - -#### `tf.FixedLenSequenceFeature.dtype` {#FixedLenSequenceFeature.dtype} - -Alias for field number 1 - - -- - - - -#### `tf.FixedLenSequenceFeature.shape` {#FixedLenSequenceFeature.shape} - -Alias for field number 0 - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.PaddingFIFOQueue.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.PaddingFIFOQueue.md deleted file mode 100644 index eaf4408c9f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.PaddingFIFOQueue.md +++ /dev/null @@ -1,313 +0,0 @@ -A FIFOQueue that supports batching variable-sized tensors by padding. - -A `PaddingFIFOQueue` may contain components with dynamic shape, while also -supporting `dequeue_many`. See the constructor for more details. - -See [`tf.QueueBase`](#QueueBase) for a description of the methods on -this class. -- - - - -#### `tf.PaddingFIFOQueue.__init__(capacity, dtypes, shapes, names=None, shared_name=None, name='padding_fifo_queue')` {#PaddingFIFOQueue.__init__} - -Creates a queue that dequeues elements in a first-in first-out order. - -A `PaddingFIFOQueue` has bounded capacity; supports multiple concurrent -producers and consumers; and provides exactly-once delivery. - -A `PaddingFIFOQueue` holds a list of up to `capacity` elements. Each -element is a fixed-length tuple of tensors whose dtypes are -described by `dtypes`, and whose shapes are described by the `shapes` -argument. - -The `shapes` argument must be specified; each component of a queue -element must have the respective shape. Shapes of fixed -rank but variable size are allowed by setting any shape dimension to None. -In this case, the inputs' shape may vary along the given dimension, and -`dequeue_many` will pad the given dimension with zeros up to the maximum -shape of all elements in the given batch. - -##### Args: - - -* `capacity`: An integer. The upper bound on the number of elements - that may be stored in this queue. -* `dtypes`: A list of `DType` objects. The length of `dtypes` must equal - the number of tensors in each queue element. -* `shapes`: A list of `TensorShape` objects, with the same length as - `dtypes`. Any dimension in the `TensorShape` containing value - `None` is dynamic and allows values to be enqueued with - variable size in that dimension. -* `names`: (Optional.) A list of string naming the components in the queue - with the same length as `dtypes`, or `None`. If specified the dequeue - methods return a dictionary with the names as keys. -* `shared_name`: (Optional.) If non-empty, this queue will be shared under - the given name across multiple sessions. -* `name`: Optional name for the queue operation. - -##### Raises: - - -* `ValueError`: If shapes is not a list of shapes, or the lengths of dtypes - and shapes do not match, or if names is specified and the lengths of - dtypes and names do not match. - - -- - - - -#### `tf.PaddingFIFOQueue.close(cancel_pending_enqueues=False, name=None)` {#PaddingFIFOQueue.close} - -Closes this queue. - -This operation signals that no more elements will be enqueued in -the given queue. Subsequent `enqueue` and `enqueue_many` -operations will fail. Subsequent `dequeue` and `dequeue_many` -operations will continue to succeed if sufficient elements remain -in the queue. Subsequent `dequeue` and `dequeue_many` operations -that would block will fail immediately. - -If `cancel_pending_enqueues` is `True`, all pending requests will also -be cancelled. - -##### Args: - - -* `cancel_pending_enqueues`: (Optional.) A boolean, defaulting to - `False` (described above). -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that closes the queue. - - -- - - - -#### `tf.PaddingFIFOQueue.dequeue(name=None)` {#PaddingFIFOQueue.dequeue} - -Dequeues one element from this queue. - -If the queue is empty when this operation executes, it will block -until there is an element to dequeue. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue is empty, and there are no pending -enqueue operations that can fulfill this request, -`tf.errors.OutOfRangeError` will be raised. If the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of tensors that was dequeued. - - -- - - - -#### `tf.PaddingFIFOQueue.dequeue_many(n, name=None)` {#PaddingFIFOQueue.dequeue_many} - -Dequeues and concatenates `n` elements from this queue. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. All of the -components in the dequeued tuple will have size `n` in the 0th dimension. - -If the queue is closed and there are less than `n` elements left, then an -`OutOfRange` exception is raised. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue contains fewer than `n` elements, and -there are no pending enqueue operations that can fulfill this -request, `tf.errors.OutOfRangeError` will be raised. If the -session is [closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.PaddingFIFOQueue.dequeue_up_to(n, name=None)` {#PaddingFIFOQueue.dequeue_up_to} - -Dequeues and concatenates `n` elements from this queue. - -**Note** This operation is not supported by all queues. If a queue does not -support DequeueUpTo, then a `tf.errors.UnimplementedError` is raised. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. If the queue -has not been closed, all of the components in the dequeued tuple -will have size `n` in the 0th dimension. - -If the queue is closed and there are more than `0` but fewer than -`n` elements remaining, then instead of raising a -`tf.errors.OutOfRangeError` like [`dequeue_many`](#QueueBase.dequeue_many), -less than `n` elements are returned immediately. If the queue is -closed and there are `0` elements left in the queue, then a -`tf.errors.OutOfRangeError` is raised just like in `dequeue_many`. -Otherwise the behavior is identical to `dequeue_many`. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.PaddingFIFOQueue.dtypes` {#PaddingFIFOQueue.dtypes} - -The list of dtypes for each component of a queue element. - - -- - - - -#### `tf.PaddingFIFOQueue.enqueue(vals, name=None)` {#PaddingFIFOQueue.enqueue} - -Enqueues one element to this queue. - -If the queue is full when this operation executes, it will block -until the element has been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary containing - the values to enqueue. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a new tuple of tensors to the queue. - - -- - - - -#### `tf.PaddingFIFOQueue.enqueue_many(vals, name=None)` {#PaddingFIFOQueue.enqueue_many} - -Enqueues zero or more elements to this queue. - -This operation slices each component tensor along the 0th dimension to -make multiple queue elements. All of the tensors in `vals` must have the -same size in the 0th dimension. - -If the queue is full when this operation executes, it will block -until all of the elements have been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary - from which the queue elements are taken. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a batch of tuples of tensors to the queue. - - -- - - - -#### `tf.PaddingFIFOQueue.from_list(index, queues)` {#PaddingFIFOQueue.from_list} - -Create a queue using the queue reference from `queues[index]`. - -##### Args: - - -* `index`: An integer scalar tensor that determines the input that gets - selected. -* `queues`: A list of `QueueBase` objects. - -##### Returns: - - A `QueueBase` object. - -##### Raises: - - -* `TypeError`: When `queues` is not a list of `QueueBase` objects, - or when the data types of `queues` are not all the same. - - -- - - - -#### `tf.PaddingFIFOQueue.name` {#PaddingFIFOQueue.name} - -The name of the underlying queue. - - -- - - - -#### `tf.PaddingFIFOQueue.names` {#PaddingFIFOQueue.names} - -The list of names for each component of a queue element. - - -- - - - -#### `tf.PaddingFIFOQueue.queue_ref` {#PaddingFIFOQueue.queue_ref} - -The underlying queue reference. - - -- - - - -#### `tf.PaddingFIFOQueue.shapes` {#PaddingFIFOQueue.shapes} - -The list of shapes for each component of a queue element. - - -- - - - -#### `tf.PaddingFIFOQueue.size(name=None)` {#PaddingFIFOQueue.size} - -Compute the number of elements in this queue. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A scalar tensor containing the number of elements in this queue. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.QueueBase.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.QueueBase.md deleted file mode 100644 index 941f8f5dec..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.QueueBase.md +++ /dev/null @@ -1,305 +0,0 @@ -Base class for queue implementations. - -A queue is a TensorFlow data structure that stores tensors across -multiple steps, and exposes operations that enqueue and dequeue -tensors. - -Each queue element is a tuple of one or more tensors, where each -tuple component has a static dtype, and may have a static shape. The -queue implementations support versions of enqueue and dequeue that -handle single elements, versions that support enqueuing and -dequeuing a batch of elements at once. - -See [`tf.FIFOQueue`](#FIFOQueue) and -[`tf.RandomShuffleQueue`](#RandomShuffleQueue) for concrete -implementations of this class, and instructions on how to create -them. -- - - - -#### `tf.QueueBase.__init__(dtypes, shapes, names, queue_ref)` {#QueueBase.__init__} - -Constructs a queue object from a queue reference. - -The two optional lists, `shapes` and `names`, must be of the same length -as `dtypes` if provided. The values at a given index `i` indicate the -shape and name to use for the corresponding queue component in `dtypes`. - -##### Args: - - -* `dtypes`: A list of types. The length of dtypes must equal the number - of tensors in each element. -* `shapes`: Constraints on the shapes of tensors in an element: - A list of shape tuples or None. This list is the same length - as dtypes. If the shape of any tensors in the element are constrained, - all must be; shapes can be None if the shapes should not be constrained. -* `names`: Optional list of names. If provided, the `enqueue()` and - `dequeue()` methods will use dictionaries with these names as keys. - Must be None or a list or tuple of the same length as `dtypes`. -* `queue_ref`: The queue reference, i.e. the output of the queue op. - -##### Raises: - - -* `ValueError`: If one of the arguments is invalid. - - -- - - - -#### `tf.QueueBase.close(cancel_pending_enqueues=False, name=None)` {#QueueBase.close} - -Closes this queue. - -This operation signals that no more elements will be enqueued in -the given queue. Subsequent `enqueue` and `enqueue_many` -operations will fail. Subsequent `dequeue` and `dequeue_many` -operations will continue to succeed if sufficient elements remain -in the queue. Subsequent `dequeue` and `dequeue_many` operations -that would block will fail immediately. - -If `cancel_pending_enqueues` is `True`, all pending requests will also -be cancelled. - -##### Args: - - -* `cancel_pending_enqueues`: (Optional.) A boolean, defaulting to - `False` (described above). -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that closes the queue. - - -- - - - -#### `tf.QueueBase.dequeue(name=None)` {#QueueBase.dequeue} - -Dequeues one element from this queue. - -If the queue is empty when this operation executes, it will block -until there is an element to dequeue. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue is empty, and there are no pending -enqueue operations that can fulfill this request, -`tf.errors.OutOfRangeError` will be raised. If the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of tensors that was dequeued. - - -- - - - -#### `tf.QueueBase.dequeue_many(n, name=None)` {#QueueBase.dequeue_many} - -Dequeues and concatenates `n` elements from this queue. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. All of the -components in the dequeued tuple will have size `n` in the 0th dimension. - -If the queue is closed and there are less than `n` elements left, then an -`OutOfRange` exception is raised. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue contains fewer than `n` elements, and -there are no pending enqueue operations that can fulfill this -request, `tf.errors.OutOfRangeError` will be raised. If the -session is [closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.QueueBase.dequeue_up_to(n, name=None)` {#QueueBase.dequeue_up_to} - -Dequeues and concatenates `n` elements from this queue. - -**Note** This operation is not supported by all queues. If a queue does not -support DequeueUpTo, then a `tf.errors.UnimplementedError` is raised. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. If the queue -has not been closed, all of the components in the dequeued tuple -will have size `n` in the 0th dimension. - -If the queue is closed and there are more than `0` but fewer than -`n` elements remaining, then instead of raising a -`tf.errors.OutOfRangeError` like [`dequeue_many`](#QueueBase.dequeue_many), -less than `n` elements are returned immediately. If the queue is -closed and there are `0` elements left in the queue, then a -`tf.errors.OutOfRangeError` is raised just like in `dequeue_many`. -Otherwise the behavior is identical to `dequeue_many`. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.QueueBase.dtypes` {#QueueBase.dtypes} - -The list of dtypes for each component of a queue element. - - -- - - - -#### `tf.QueueBase.enqueue(vals, name=None)` {#QueueBase.enqueue} - -Enqueues one element to this queue. - -If the queue is full when this operation executes, it will block -until the element has been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary containing - the values to enqueue. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a new tuple of tensors to the queue. - - -- - - - -#### `tf.QueueBase.enqueue_many(vals, name=None)` {#QueueBase.enqueue_many} - -Enqueues zero or more elements to this queue. - -This operation slices each component tensor along the 0th dimension to -make multiple queue elements. All of the tensors in `vals` must have the -same size in the 0th dimension. - -If the queue is full when this operation executes, it will block -until all of the elements have been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary - from which the queue elements are taken. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a batch of tuples of tensors to the queue. - - -- - - - -#### `tf.QueueBase.from_list(index, queues)` {#QueueBase.from_list} - -Create a queue using the queue reference from `queues[index]`. - -##### Args: - - -* `index`: An integer scalar tensor that determines the input that gets - selected. -* `queues`: A list of `QueueBase` objects. - -##### Returns: - - A `QueueBase` object. - -##### Raises: - - -* `TypeError`: When `queues` is not a list of `QueueBase` objects, - or when the data types of `queues` are not all the same. - - -- - - - -#### `tf.QueueBase.name` {#QueueBase.name} - -The name of the underlying queue. - - -- - - - -#### `tf.QueueBase.names` {#QueueBase.names} - -The list of names for each component of a queue element. - - -- - - - -#### `tf.QueueBase.queue_ref` {#QueueBase.queue_ref} - -The underlying queue reference. - - -- - - - -#### `tf.QueueBase.shapes` {#QueueBase.shapes} - -The list of shapes for each component of a queue element. - - -- - - - -#### `tf.QueueBase.size(name=None)` {#QueueBase.size} - -Compute the number of elements in this queue. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A scalar tensor containing the number of elements in this queue. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.SparseConditionalAccumulator.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.SparseConditionalAccumulator.md deleted file mode 100644 index f0329e8cbb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.SparseConditionalAccumulator.md +++ /dev/null @@ -1,209 +0,0 @@ -A conditional accumulator for aggregating sparse gradients. - -Sparse gradients are represented by IndexedSlices. - -Up-to-date gradients (i.e., time step at which gradient was computed is -equal to the accumulator's time step) are added to the accumulator. - -Extraction of the average gradient is blocked until the required number of -gradients has been accumulated. - -Args: - dtype: Datatype of the accumulated gradients. - shape: Shape of the accumulated gradients. - shared_name: Optional. If non-empty, this accumulator will be shared under - the given name across multiple sessions. - name: Optional name for the accumulator. -- - - - -#### `tf.SparseConditionalAccumulator.__init__(dtype, shape=None, shared_name=None, name='sparse_conditional_accumulator')` {#SparseConditionalAccumulator.__init__} - - - - -- - - - -#### `tf.SparseConditionalAccumulator.accumulator_ref` {#SparseConditionalAccumulator.accumulator_ref} - -The underlying accumulator reference. - - -- - - - -#### `tf.SparseConditionalAccumulator.apply_grad(grad_indices, grad_values, grad_shape=None, local_step=0, name=None)` {#SparseConditionalAccumulator.apply_grad} - -Attempts to apply a sparse gradient to the accumulator. - -The attempt is silently dropped if the gradient is stale, i.e., local_step -is less than the accumulator's global time step. - -A sparse gradient is represented by its indices, values and possibly empty -or None shape. Indices must be a vector representing the locations of -non-zero entries in the tensor. Values are the non-zero slices of the -gradient, and must have the same first dimension as indices, i.e., the nnz -represented by indices and values must be consistent. Shape, if not empty or -None, must be consistent with the accumulator's shape (if also provided). - -##### Example: - - A tensor [[0, 0], [0. 1], [2, 3]] can be represented - -* `indices`: [1,2] -* `values`: [[0,1],[2,3]] -* `shape`: [3, 2] - -##### Args: - - -* `grad_indices`: Indices of the sparse gradient to be applied. -* `grad_values`: Values of the sparse gradient to be applied. -* `grad_shape`: Shape of the sparse gradient to be applied. -* `local_step`: Time step at which the gradient was computed. -* `name`: Optional name for the operation. - -##### Returns: - - The operation that (conditionally) applies a gradient to the accumulator. - -##### Raises: - - -* `InvalidArgumentError`: If grad is of the wrong shape - - -- - - - -#### `tf.SparseConditionalAccumulator.apply_indexed_slices_grad(grad, local_step=0, name=None)` {#SparseConditionalAccumulator.apply_indexed_slices_grad} - -Attempts to apply a gradient to the accumulator. - -The attempt is silently dropped if the gradient is stale, i.e., local_step -is less than the accumulator's global time step. - -##### Args: - - -* `grad`: The gradient IndexedSlices to be applied. -* `local_step`: Time step at which the gradient was computed. -* `name`: Optional name for the operation. - -##### Returns: - - The operation that (conditionally) applies a gradient to the accumulator. - -##### Raises: - - -* `InvalidArgumentError`: If grad is of the wrong shape - - -- - - - -#### `tf.SparseConditionalAccumulator.dtype` {#SparseConditionalAccumulator.dtype} - -The datatype of the gradients accumulated by this accumulator. - - -- - - - -#### `tf.SparseConditionalAccumulator.name` {#SparseConditionalAccumulator.name} - -The name of the underlying accumulator. - - -- - - - -#### `tf.SparseConditionalAccumulator.num_accumulated(name=None)` {#SparseConditionalAccumulator.num_accumulated} - -Number of gradients that have currently been aggregated in accumulator. - -##### Args: - - -* `name`: Optional name for the operation. - -##### Returns: - - Number of accumulated gradients currently in accumulator. - - -- - - - -#### `tf.SparseConditionalAccumulator.set_global_step(new_global_step, name=None)` {#SparseConditionalAccumulator.set_global_step} - -Sets the global time step of the accumulator. - -The operation logs a warning if we attempt to set to a time step that is -lower than the accumulator's own time step. - -##### Args: - - -* `new_global_step`: Value of new time step. Can be a variable or a constant -* `name`: Optional name for the operation. - -##### Returns: - - Operation that sets the accumulator's time step. - - -- - - - -#### `tf.SparseConditionalAccumulator.take_grad(num_required, name=None)` {#SparseConditionalAccumulator.take_grad} - -Attempts to extract the average gradient from the accumulator. - -The operation blocks until sufficient number of gradients have been -successfully applied to the accumulator. - -Once successful, the following actions are also triggered: -- Counter of accumulated gradients is reset to 0. -- Aggregated gradient is reset to 0 tensor. -- Accumulator's internal time step is incremented by 1. - -##### Args: - - -* `num_required`: Number of gradients that needs to have been aggregated -* `name`: Optional name for the operation - -##### Returns: - - A tuple of indices, values, and shape representing the average gradient. - -##### Raises: - - -* `InvalidArgumentError`: If num_required < 1 - - -- - - - -#### `tf.SparseConditionalAccumulator.take_indexed_slices_grad(num_required, name=None)` {#SparseConditionalAccumulator.take_indexed_slices_grad} - -Attempts to extract the average gradient from the accumulator. - -The operation blocks until sufficient number of gradients have been -successfully applied to the accumulator. - -Once successful, the following actions are also triggered: -- Counter of accumulated gradients is reset to 0. -- Aggregated gradient is reset to 0 tensor. -- Accumulator's internal time step is incremented by 1. - -##### Args: - - -* `num_required`: Number of gradients that needs to have been aggregated -* `name`: Optional name for the operation - -##### Returns: - - An IndexedSlices holding the value of the average gradient. - -##### Raises: - - -* `InvalidArgumentError`: If num_required < 1 - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.abs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.abs.md deleted file mode 100644 index 8a5ae1b9ac..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.abs.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.abs(x, name=None)` {#abs} - -Computes the absolute value of a tensor. - -Given a tensor of real numbers `x`, this operation returns a tensor -containing the absolute value of each element in `x`. For example, if x is -an input element and y is an output element, this operation computes -\\(y = |x|\\). - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor` of type `float32`, `float64`, `int32`, or - `int64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` the same size and type as `x` with absolute - values. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.as_string.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.as_string.md deleted file mode 100644 index 0217ad3113..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.as_string.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.as_string(input, precision=None, scientific=None, shortest=None, width=None, fill=None, name=None)` {#as_string} - -Converts each entry in the given tensor to strings. Supports many numeric - -types and boolean. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `complex64`, `float32`, `float64`, `bool`, `int8`. -* `precision`: An optional `int`. Defaults to `-1`. - The post-decimal precision to use for floating point numbers. - Only used if precision > -1. -* `scientific`: An optional `bool`. Defaults to `False`. - Use scientific notation for floating point numbers. -* `shortest`: An optional `bool`. Defaults to `False`. - Use shortest representation (either scientific or standard) for - floating point numbers. -* `width`: An optional `int`. Defaults to `-1`. - Pad pre-decimal numbers to this width. - Applies to both floating point and integer numbers. - Only used if width > -1. -* `fill`: An optional `string`. Defaults to `""`. - The value to pad if width > -1. If empty, pads with spaces. - Another typical value is '0'. String cannot be longer than 1 character. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.assert_positive.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.assert_positive.md deleted file mode 100644 index ee73f2f9a5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.assert_positive.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.assert_positive(x, data=None, summarize=None, message=None, name=None)` {#assert_positive} - -Assert the condition `x > 0` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_positive(x)]): - output = tf.reduce_sum(x) -``` - -Positive means, for every element `x[i]` of `x`, we have `x[i] > 0`. -If `x` is empty this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_positive". - -##### Returns: - - Op raising `InvalidArgumentError` unless `x` is all positive. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.bitcast.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.bitcast.md deleted file mode 100644 index 9e60ab2144..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.bitcast.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.bitcast(input, type, name=None)` {#bitcast} - -Bitcasts a tensor from one type to another without copying data. - -Given a tensor `input`, this operation returns a tensor that has the same buffer -data as `input` with datatype `type`. - -If the input datatype `T` is larger than the output datatype `type` then the -shape changes from [...] to [..., sizeof(`T`)/sizeof(`type`)]. - -If `T` is smaller than `type`, the operator requires that the rightmost -dimension be equal to sizeof(`type`)/sizeof(`T`). The shape then goes from -[..., sizeof(`type`)/sizeof(`T`)] to [...]. - -*NOTE*: Bitcast is implemented as a low-level cast, so machines with different -endian orderings will give different results. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `type`: A `tf.DType` from: `tf.float32, tf.float64, tf.int64, tf.int32, tf.uint8, tf.uint16, tf.int16, tf.int8, tf.complex64, tf.complex128, tf.qint8, tf.quint8, tf.qint32, tf.half`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `type`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.concat.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.concat.md deleted file mode 100644 index 321429967e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.concat.md +++ /dev/null @@ -1,58 +0,0 @@ -### `tf.concat(values, axis, name='concat')` {#concat} - -Concatenates tensors along one dimension. - -Concatenates the list of tensors `values` along dimension `axis`. If -`values[i].shape = [D0, D1, ... Daxis(i), ...Dn]`, the concatenated -result has shape - - [D0, D1, ... Raxis, ...Dn] - -where - - Raxis = sum(Daxis(i)) - -That is, the data from the input tensors is joined along the `axis` -dimension. - -The number of dimensions of the input tensors must match, and all dimensions -except `axis` must be equal. - -For example: - -```python -t1 = [[1, 2, 3], [4, 5, 6]] -t2 = [[7, 8, 9], [10, 11, 12]] -tf.concat([t1, t2], 0) ==> [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] -tf.concat([t1, t2], 1) ==> [[1, 2, 3, 7, 8, 9], [4, 5, 6, 10, 11, 12]] - -# tensor t3 with shape [2, 3] -# tensor t4 with shape [2, 3] -tf.shape(tf.concat([t3, t4], 0)) ==> [4, 3] -tf.shape(tf.concat([t3, t4], 1)) ==> [2, 6] -``` - -Note: If you are concatenating along a new axis consider using stack. -E.g. - -```python -tf.concat([tf.expand_dims(t, axis) for t in tensors], axis) -``` - -can be rewritten as - -```python -tf.stack(tensors, axis=axis) -``` - -##### Args: - - -* `values`: A list of `Tensor` objects or a single `Tensor`. -* `axis`: 0-D `int32` `Tensor`. Dimension along which to concatenate. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` resulting from concatenation of the input tensors. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.conj.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.conj.md deleted file mode 100644 index e7491301cb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.conj.md +++ /dev/null @@ -1,33 +0,0 @@ -### `tf.conj(x, name=None)` {#conj} - -Returns the complex conjugate of a complex number. - -Given a tensor `input` of complex numbers, this operation returns a tensor of -complex numbers that are the complex conjugate of each element in `input`. The -complex numbers in `input` must be of the form \\(a + bj\\), where *a* is the -real part and *b* is the imaginary part. - -The complex conjugate returned by this operation is of the form \\(a - bj\\). - -For example: - - # tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j] - tf.conj(input) ==> [-2.25 - 4.75j, 3.25 - 5.75j] - -If `x` is real, it is returned unchanged. - -##### Args: - - -* `x`: `Tensor` to conjugate. Must have numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` that is the conjugate of `x` (with the same type). - -##### Raises: - - -* `TypeError`: If `x` is not a numeric tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.entropy.elbo_ratio.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.entropy.elbo_ratio.md deleted file mode 100644 index 0419408ce4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.entropy.elbo_ratio.md +++ /dev/null @@ -1,68 +0,0 @@ -### `tf.contrib.bayesflow.entropy.elbo_ratio(log_p, q, z=None, n=None, seed=None, form=None, name='elbo_ratio')` {#elbo_ratio} - -Estimate of the ratio appearing in the `ELBO` and `KL` divergence. - -With `p(z) := exp{log_p(z)}`, this `Op` returns an approximation of - -``` -E_q[ Log[p(Z) / q(Z)] ] -``` - -The term `E_q[ Log[p(Z)] ]` is always computed as a sample mean. -The term `E_q[ Log[q(z)] ]` can be computed with samples, or an exact formula -if `q.entropy()` is defined. This is controlled with the kwarg `form`. - -This log-ratio appears in different contexts: - -#### `KL[q || p]` - -If `log_p(z) = Log[p(z)]` for distribution `p`, this `Op` approximates -the negative Kullback-Leibler divergence. - -``` -elbo_ratio(log_p, q, n=100) = -1 * KL[q || p], -KL[q || p] = E[ Log[q(Z)] - Log[p(Z)] ] -``` - -Note that if `p` is a `Distribution`, then `distributions.kl(q, p)` may be -defined and available as an exact result. - -#### ELBO - -If `log_p(z) = Log[p(z, x)]` is the log joint of a distribution `p`, this is -the Evidence Lower BOund (ELBO): - -``` -ELBO ~= E[ Log[p(Z, x)] - Log[q(Z)] ] - = Log[p(x)] - KL[q || p] - <= Log[p(x)] -``` - -User supplies either `Tensor` of samples `z`, or number of samples to draw `n` - -##### Args: - - -* `log_p`: Callable mapping samples from `q` to `Tensors` with - shape broadcastable to `q.batch_shape`. - For example, `log_p` works "just like" `q.log_prob`. -* `q`: `tf.contrib.distributions.Distribution`. -* `z`: `Tensor` of samples from `q`, produced by `q.sample(n)` for some `n`. -* `n`: Integer `Tensor`. Number of samples to generate if `z` is not provided. -* `seed`: Python integer to seed the random number generator. -* `form`: Either `ELBOForms.analytic_entropy` (use formula for entropy of `q`) - or `ELBOForms.sample` (sample estimate of entropy), or `ELBOForms.default` - (attempt analytic entropy, fallback on sample). - Default value is `ELBOForms.default`. -* `name`: A name to give this `Op`. - -##### Returns: - - Scalar `Tensor` holding sample mean KL divergence. `shape` is the batch - shape of `q`, and `dtype` is the same as `q`. - -##### Raises: - - -* `ValueError`: If `form` is not handled by this function. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.entropy.renyi_alpha.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.entropy.renyi_alpha.md deleted file mode 100644 index bf65d1a823..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.entropy.renyi_alpha.md +++ /dev/null @@ -1,38 +0,0 @@ -### `tf.contrib.bayesflow.entropy.renyi_alpha(step, decay_time, alpha_min, alpha_max=0.99999, name='renyi_alpha')` {#renyi_alpha} - -Exponentially decaying `Tensor` appropriate for Renyi ratios. - -When minimizing the Renyi divergence for `0 <= alpha < 1` (or maximizing the -Renyi equivalent of elbo) in high dimensions, it is not uncommon to experience -`NaN` and `inf` values when `alpha` is far from `1`. - -For that reason, it is often desirable to start the optimization with `alpha` -very close to 1, and reduce it to a final `alpha_min` according to some -schedule. The user may even want to optimize using `elbo_ratio` for -some fixed time before switching to Renyi based methods. - -This `Op` returns an `alpha` decaying exponentially with step: - -``` -s(step) = (exp{step / decay_time} - 1) / (e - 1) -t(s) = max(0, min(s, 1)), (smooth growth from 0 to 1) -alpha(t) = (1 - t) alpha_min + t alpha_max -``` - -##### Args: - - -* `step`: Non-negative scalar `Tensor`. Typically the global step or an - offset version thereof. -* `decay_time`: Positive scalar `Tensor`. -* `alpha_min`: `float` or `double` `Tensor`. - The minimal, final value of `alpha`, achieved when `step >= decay_time` -* `alpha_max`: `Tensor` of same `dtype` as `alpha_min`. - The maximal, beginning value of `alpha`, achieved when `step == 0` -* `name`: A name to give this `Op`. - -##### Returns: - - -* `alpha`: A `Tensor` of same `dtype` as `alpha_min`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.monte_carlo.expectation_importance_sampler.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.monte_carlo.expectation_importance_sampler.md deleted file mode 100644 index 9dce634e13..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.monte_carlo.expectation_importance_sampler.md +++ /dev/null @@ -1,43 +0,0 @@ -### `tf.contrib.bayesflow.monte_carlo.expectation_importance_sampler(f, log_p, sampling_dist_q, z=None, n=None, seed=None, name='expectation_importance_sampler')` {#expectation_importance_sampler} - -Monte Carlo estimate of `E_p[f(Z)] = E_q[f(Z) p(Z) / q(Z)]`. - -With `p(z) := exp{log_p(z)}`, this `Op` returns - -``` -n^{-1} sum_{i=1}^n [ f(z_i) p(z_i) / q(z_i) ], z_i ~ q, -\approx E_q[ f(Z) p(Z) / q(Z) ] -= E_p[f(Z)] -``` - -This integral is done in log-space with max-subtraction to better handle the -often extreme values that `f(z) p(z) / q(z)` can take on. - -If `f >= 0`, it is up to 2x more efficient to exponentiate the result of -`expectation_importance_sampler_logspace` applied to `Log[f]`. - -User supplies either `Tensor` of samples `z`, or number of samples to draw `n` - -##### Args: - - -* `f`: Callable mapping samples from `sampling_dist_q` to `Tensors` with shape - broadcastable to `q.batch_shape`. - For example, `f` works "just like" `q.log_prob`. -* `log_p`: Callable mapping samples from `sampling_dist_q` to `Tensors` with - shape broadcastable to `q.batch_shape`. - For example, `log_p` works "just like" `sampling_dist_q.log_prob`. -* `sampling_dist_q`: The sampling distribution. - `tf.contrib.distributions.Distribution`. - `float64` `dtype` recommended. - `log_p` and `q` should be supported on the same set. -* `z`: `Tensor` of samples from `q`, produced by `q.sample` for some `n`. -* `n`: Integer `Tensor`. Number of samples to generate if `z` is not provided. -* `seed`: Python integer to seed the random number generator. -* `name`: A name to give this `Op`. - -##### Returns: - - The importance sampling estimate. `Tensor` with `shape` equal - to batch shape of `q`, and `dtype` = `q.dtype`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.stochastic_tensor.value_type.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.stochastic_tensor.value_type.md deleted file mode 100644 index f1182cb21c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.bayesflow.stochastic_tensor.value_type.md +++ /dev/null @@ -1,35 +0,0 @@ -### `tf.contrib.bayesflow.stochastic_tensor.value_type(dist_value_type)` {#value_type} - -Creates a value type context for any StochasticTensor created within. - -Typical usage: - -``` -with sg.value_type(sg.MeanValue(stop_gradients=True)): - st = sg.StochasticTensor(tf.contrib.distributions.Normal, mu=mu, - sigma=sigma) -``` - -In the example above, `st.value()` (or equivalently, `tf.identity(st)`) will -be the mean value of the Normal distribution, i.e., `mu` (possibly -broadcasted to the shape of `sigma`). Furthermore, because the `MeanValue` -was marked with `stop_gradients=True`, this value will have been wrapped -in a `stop_gradients` call to disable any possible backpropagation. - -##### Args: - - -* `dist_value_type`: An instance of `MeanValue`, `SampleValue`, or - any other stochastic value type. - -##### Yields: - - A context for `StochasticTensor` objects that controls the - value created when they are initialized. - -##### Raises: - - -* `TypeError`: if `dist_value_type` is not an instance of a stochastic value - type. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.copy_graph.copy_variable_to_graph.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.copy_graph.copy_variable_to_graph.md deleted file mode 100644 index 85e336a29b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.copy_graph.copy_variable_to_graph.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.contrib.copy_graph.copy_variable_to_graph(org_instance, to_graph, scope='')` {#copy_variable_to_graph} - -Given a `Variable` instance from one `Graph`, initializes and returns -a copy of it from another `Graph`, under the specified scope -(default `""`). - -Args: -org_instance: A `Variable` from some `Graph`. -to_graph: The `Graph` to copy the `Variable` to. -scope: A scope for the new `Variable` (default `""`). - -##### Returns: - - The copied `Variable` from `to_graph`. - -##### Raises: - - -* `TypeError`: If `org_instance` is not a `Variable`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.crf.crf_sequence_score.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.crf.crf_sequence_score.md deleted file mode 100644 index 95cbf2e8eb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.crf.crf_sequence_score.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.contrib.crf.crf_sequence_score(inputs, tag_indices, sequence_lengths, transition_params)` {#crf_sequence_score} - -Computes the unnormalized score for a tag sequence. - -##### Args: - - -* `inputs`: A [batch_size, max_seq_len, num_tags] tensor of unary potentials - to use as input to the CRF layer. -* `tag_indices`: A [batch_size, max_seq_len] matrix of tag indices for which we - compute the unnormalized score. -* `sequence_lengths`: A [batch_size] vector of true sequence lengths. -* `transition_params`: A [num_tags, num_tags] transition matrix. - -##### Returns: - - -* `sequence_scores`: A [batch_size] vector of unnormalized sequence scores. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.crf.crf_unary_score.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.crf.crf_unary_score.md deleted file mode 100644 index 4a344623ce..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.crf.crf_unary_score.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.contrib.crf.crf_unary_score(tag_indices, sequence_lengths, inputs)` {#crf_unary_score} - -Computes the unary scores of tag sequences. - -##### Args: - - -* `tag_indices`: A [batch_size, max_seq_len] matrix of tag indices. -* `sequence_lengths`: A [batch_size] vector of true sequence lengths. -* `inputs`: A [batch_size, max_seq_len, num_tags] tensor of unary potentials. - -##### Returns: - - -* `unary_scores`: A [batch_size] vector of unary scores. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.BernoulliWithSigmoidProbs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.BernoulliWithSigmoidProbs.md deleted file mode 100644 index b0a926f8ed..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.BernoulliWithSigmoidProbs.md +++ /dev/null @@ -1,563 +0,0 @@ -Bernoulli with `probs = nn.sigmoid(logits)`. -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.__init__(logits=None, dtype=tf.int32, validate_args=False, allow_nan_stats=True, name='BernoulliWithSigmoidProbs')` {#BernoulliWithSigmoidProbs.__init__} - - - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.allow_nan_stats` {#BernoulliWithSigmoidProbs.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.batch_shape` {#BernoulliWithSigmoidProbs.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.batch_shape_tensor(name='batch_shape_tensor')` {#BernoulliWithSigmoidProbs.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.cdf(value, name='cdf')` {#BernoulliWithSigmoidProbs.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.copy(**override_parameters_kwargs)` {#BernoulliWithSigmoidProbs.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.covariance(name='covariance')` {#BernoulliWithSigmoidProbs.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.dtype` {#BernoulliWithSigmoidProbs.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.entropy(name='entropy')` {#BernoulliWithSigmoidProbs.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.event_shape` {#BernoulliWithSigmoidProbs.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.event_shape_tensor(name='event_shape_tensor')` {#BernoulliWithSigmoidProbs.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.is_continuous` {#BernoulliWithSigmoidProbs.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.is_scalar_batch(name='is_scalar_batch')` {#BernoulliWithSigmoidProbs.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.is_scalar_event(name='is_scalar_event')` {#BernoulliWithSigmoidProbs.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_cdf(value, name='log_cdf')` {#BernoulliWithSigmoidProbs.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_prob(value, name='log_prob')` {#BernoulliWithSigmoidProbs.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.log_survival_function(value, name='log_survival_function')` {#BernoulliWithSigmoidProbs.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.logits` {#BernoulliWithSigmoidProbs.logits} - -Log-odds of a `1` outcome (vs `0`). - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.mean(name='mean')` {#BernoulliWithSigmoidProbs.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.mode(name='mode')` {#BernoulliWithSigmoidProbs.mode} - -Mode. - -Additional documentation from `Bernoulli`: - -Returns `1` if `prob > 0.5` and `0` otherwise. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.name` {#BernoulliWithSigmoidProbs.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#BernoulliWithSigmoidProbs.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.param_static_shapes(cls, sample_shape)` {#BernoulliWithSigmoidProbs.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.parameters` {#BernoulliWithSigmoidProbs.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.prob(value, name='prob')` {#BernoulliWithSigmoidProbs.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.probs` {#BernoulliWithSigmoidProbs.probs} - -Probability of a `1` outcome (vs `0`). - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.reparameterization_type` {#BernoulliWithSigmoidProbs.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.sample(sample_shape=(), seed=None, name='sample')` {#BernoulliWithSigmoidProbs.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.stddev(name='stddev')` {#BernoulliWithSigmoidProbs.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.survival_function(value, name='survival_function')` {#BernoulliWithSigmoidProbs.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.validate_args` {#BernoulliWithSigmoidProbs.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.BernoulliWithSigmoidProbs.variance(name='variance')` {#BernoulliWithSigmoidProbs.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.Beta.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.Beta.md deleted file mode 100644 index ed9f312153..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.Beta.md +++ /dev/null @@ -1,689 +0,0 @@ -Beta distribution. - -The Beta distribution is defined over the `(0, 1)` interval using parameters -`concentration1` (aka "alpha") and `concentration0` (aka "beta"). - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; alpha, beta) = x**(alpha - 1) (1 - x)**(beta - 1) / Z -Z = Gamma(alpha) Gamma(beta) / Gamma(alpha + beta) -``` - -where: - -* `concentration1 = alpha`, -* `concentration0 = beta`, -* `Z` is the normalization constant, and, -* `Gamma` is the [gamma function]( - https://en.wikipedia.org/wiki/Gamma_function). - -The concentration parameters represent mean total counts of a `1` or a `0`, -i.e., - -```none -concentration1 = alpha = mean * total_concentration -concentration0 = beta = (1. - mean) * total_concentration -``` - -where `mean` in `(0, 1)` and `total_concentration` is a positive real number -representing a mean `total_count = concentration1 + concentration0`. - -Distribution parameters are automatically broadcast in all functions; see -examples for details. - -#### Examples - -```python -# Create a batch of three Beta distributions. -alpha = [1, 2, 3] -beta = [1, 2, 3] -dist = Beta(alpha, beta) - -dist.sample([4, 5]) # Shape [4, 5, 3] - -# `x` has three batch entries, each with two samples. -x = [[.1, .4, .5], - [.2, .3, .5]] -# Calculate the probability of each pair of samples under the corresponding -# distribution in `dist`. -dist.prob(x) # Shape [2, 3] -``` - -```python -# Create batch_shape=[2, 3] via parameter broadcast: -alpha = [[1.], [2]] # Shape [2, 1] -beta = [3., 4, 5] # Shape [3] -dist = Beta(alpha, beta) - -# alpha broadcast as: [[1., 1, 1,], -# [2, 2, 2]] -# beta broadcast as: [[3., 4, 5], -# [3, 4, 5]] -# batch_Shape [2, 3] -dist.sample([4, 5]) # Shape [4, 5, 2, 3] - -x = [.2, .3, .5] -# x will be broadcast as [[.2, .3, .5], -# [.2, .3, .5]], -# thus matching batch_shape [2, 3]. -dist.prob(x) # Shape [2, 3] -``` -- - - - -#### `tf.contrib.distributions.Beta.__init__(concentration1=None, concentration0=None, validate_args=False, allow_nan_stats=True, name='Beta')` {#Beta.__init__} - -Initialize a batch of Beta distributions. - -##### Args: - - -* `concentration1`: Positive floating-point `Tensor` indicating mean - number of successes; aka "alpha". Implies `self.dtype` and - `self.batch_shape`, i.e., - `concentration1.shape = [N1, N2, ..., Nm] = self.batch_shape`. -* `concentration0`: Positive floating-point `Tensor` indicating mean - number of failures; aka "beta". Otherwise has same semantics as - `concentration1`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Beta.allow_nan_stats` {#Beta.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Beta.batch_shape` {#Beta.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Beta.batch_shape_tensor(name='batch_shape_tensor')` {#Beta.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Beta.cdf(value, name='cdf')` {#Beta.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Beta.concentration0` {#Beta.concentration0} - -Concentration parameter associated with a `0` outcome. - - -- - - - -#### `tf.contrib.distributions.Beta.concentration1` {#Beta.concentration1} - -Concentration parameter associated with a `1` outcome. - - -- - - - -#### `tf.contrib.distributions.Beta.copy(**override_parameters_kwargs)` {#Beta.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Beta.covariance(name='covariance')` {#Beta.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Beta.dtype` {#Beta.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Beta.entropy(name='entropy')` {#Beta.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Beta.event_shape` {#Beta.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Beta.event_shape_tensor(name='event_shape_tensor')` {#Beta.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Beta.is_continuous` {#Beta.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Beta.is_scalar_batch(name='is_scalar_batch')` {#Beta.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Beta.is_scalar_event(name='is_scalar_event')` {#Beta.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Beta.log_cdf(value, name='log_cdf')` {#Beta.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Beta.log_prob(value, name='log_prob')` {#Beta.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Beta.log_survival_function(value, name='log_survival_function')` {#Beta.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Beta.mean(name='mean')` {#Beta.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Beta.mode(name='mode')` {#Beta.mode} - -Mode. - -Additional documentation from `Beta`: - -Note: The mode is undefined when `concentration1 <= 1` or -`concentration0 <= 1`. If `self.allow_nan_stats` is `True`, `NaN` -is used for undefined modes. If `self.allow_nan_stats` is `False` an -exception is raised when one or more modes are undefined. - - -- - - - -#### `tf.contrib.distributions.Beta.name` {#Beta.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Beta.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Beta.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Beta.param_static_shapes(cls, sample_shape)` {#Beta.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Beta.parameters` {#Beta.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Beta.prob(value, name='prob')` {#Beta.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Beta.reparameterization_type` {#Beta.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Beta.sample(sample_shape=(), seed=None, name='sample')` {#Beta.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Beta.stddev(name='stddev')` {#Beta.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Beta.survival_function(value, name='survival_function')` {#Beta.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Beta.total_concentration` {#Beta.total_concentration} - -Sum of concentration parameters. - - -- - - - -#### `tf.contrib.distributions.Beta.validate_args` {#Beta.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Beta.variance(name='variance')` {#Beta.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.Laplace.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.Laplace.md deleted file mode 100644 index 3f31604508..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.Laplace.md +++ /dev/null @@ -1,607 +0,0 @@ -The Laplace distribution with location `loc` and `scale` parameters. - -#### Mathematical details - -The probability density function (pdf) of this distribution is, - -```none -pdf(x; mu, sigma) = exp(-|x - mu| / sigma) / Z -Z = 2 sigma -``` - -where `loc = mu`, `scale = sigma`, and `Z` is the normalization constant. - -Note that the Laplace distribution can be thought of two exponential -distributions spliced together "back-to-back." - -The Lpalce distribution is a member of the [location-scale family]( -https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be -constructed as, - -```none -X ~ Laplace(loc=0, scale=1) -Y = loc + scale * X -``` -- - - - -#### `tf.contrib.distributions.Laplace.__init__(loc, scale, validate_args=False, allow_nan_stats=True, name='Laplace')` {#Laplace.__init__} - -Construct Laplace distribution with parameters `loc` and `scale`. - -The parameters `loc` and `scale` must be shaped in a way that supports -broadcasting (e.g., `loc / scale` is a valid operation). - -##### Args: - - -* `loc`: Floating point tensor which characterizes the location (center) - of the distribution. -* `scale`: Positive floating point tensor which characterizes the spread of - the distribution. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, - statistics (e.g., mean, mode, variance) use the value "`NaN`" to - indicate the result is undefined. When `False`, an exception is raised - if one or more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `TypeError`: if `loc` and `scale` are of different dtype. - - -- - - - -#### `tf.contrib.distributions.Laplace.allow_nan_stats` {#Laplace.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Laplace.batch_shape` {#Laplace.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Laplace.batch_shape_tensor(name='batch_shape_tensor')` {#Laplace.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Laplace.cdf(value, name='cdf')` {#Laplace.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Laplace.copy(**override_parameters_kwargs)` {#Laplace.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Laplace.covariance(name='covariance')` {#Laplace.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Laplace.dtype` {#Laplace.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Laplace.entropy(name='entropy')` {#Laplace.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Laplace.event_shape` {#Laplace.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Laplace.event_shape_tensor(name='event_shape_tensor')` {#Laplace.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Laplace.is_continuous` {#Laplace.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Laplace.is_scalar_batch(name='is_scalar_batch')` {#Laplace.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Laplace.is_scalar_event(name='is_scalar_event')` {#Laplace.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Laplace.loc` {#Laplace.loc} - -Distribution parameter for the location. - - -- - - - -#### `tf.contrib.distributions.Laplace.log_cdf(value, name='log_cdf')` {#Laplace.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Laplace.log_prob(value, name='log_prob')` {#Laplace.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Laplace.log_survival_function(value, name='log_survival_function')` {#Laplace.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Laplace.mean(name='mean')` {#Laplace.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Laplace.mode(name='mode')` {#Laplace.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Laplace.name` {#Laplace.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Laplace.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Laplace.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Laplace.param_static_shapes(cls, sample_shape)` {#Laplace.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Laplace.parameters` {#Laplace.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Laplace.prob(value, name='prob')` {#Laplace.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Laplace.reparameterization_type` {#Laplace.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Laplace.sample(sample_shape=(), seed=None, name='sample')` {#Laplace.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Laplace.scale` {#Laplace.scale} - -Distribution parameter for scale. - - -- - - - -#### `tf.contrib.distributions.Laplace.stddev(name='stddev')` {#Laplace.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Laplace.survival_function(value, name='survival_function')` {#Laplace.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Laplace.validate_args` {#Laplace.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Laplace.variance(name='variance')` {#Laplace.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.LaplaceWithSoftplusScale.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.LaplaceWithSoftplusScale.md deleted file mode 100644 index 998d117e8f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.LaplaceWithSoftplusScale.md +++ /dev/null @@ -1,559 +0,0 @@ -Laplace with softplus applied to `scale`. -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.__init__(loc, scale, validate_args=False, allow_nan_stats=True, name='LaplaceWithSoftplusScale')` {#LaplaceWithSoftplusScale.__init__} - - - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.allow_nan_stats` {#LaplaceWithSoftplusScale.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.batch_shape` {#LaplaceWithSoftplusScale.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.batch_shape_tensor(name='batch_shape_tensor')` {#LaplaceWithSoftplusScale.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.cdf(value, name='cdf')` {#LaplaceWithSoftplusScale.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.copy(**override_parameters_kwargs)` {#LaplaceWithSoftplusScale.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.covariance(name='covariance')` {#LaplaceWithSoftplusScale.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.dtype` {#LaplaceWithSoftplusScale.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.entropy(name='entropy')` {#LaplaceWithSoftplusScale.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.event_shape` {#LaplaceWithSoftplusScale.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.event_shape_tensor(name='event_shape_tensor')` {#LaplaceWithSoftplusScale.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.is_continuous` {#LaplaceWithSoftplusScale.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.is_scalar_batch(name='is_scalar_batch')` {#LaplaceWithSoftplusScale.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.is_scalar_event(name='is_scalar_event')` {#LaplaceWithSoftplusScale.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.loc` {#LaplaceWithSoftplusScale.loc} - -Distribution parameter for the location. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.log_cdf(value, name='log_cdf')` {#LaplaceWithSoftplusScale.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.log_prob(value, name='log_prob')` {#LaplaceWithSoftplusScale.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.log_survival_function(value, name='log_survival_function')` {#LaplaceWithSoftplusScale.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.mean(name='mean')` {#LaplaceWithSoftplusScale.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.mode(name='mode')` {#LaplaceWithSoftplusScale.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.name` {#LaplaceWithSoftplusScale.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#LaplaceWithSoftplusScale.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.param_static_shapes(cls, sample_shape)` {#LaplaceWithSoftplusScale.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.parameters` {#LaplaceWithSoftplusScale.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.prob(value, name='prob')` {#LaplaceWithSoftplusScale.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.reparameterization_type` {#LaplaceWithSoftplusScale.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.sample(sample_shape=(), seed=None, name='sample')` {#LaplaceWithSoftplusScale.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.scale` {#LaplaceWithSoftplusScale.scale} - -Distribution parameter for scale. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.stddev(name='stddev')` {#LaplaceWithSoftplusScale.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.survival_function(value, name='survival_function')` {#LaplaceWithSoftplusScale.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.validate_args` {#LaplaceWithSoftplusScale.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.LaplaceWithSoftplusScale.variance(name='variance')` {#LaplaceWithSoftplusScale.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.Logistic.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.Logistic.md deleted file mode 100644 index 6f0d4f2210..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.Logistic.md +++ /dev/null @@ -1,637 +0,0 @@ -The Logistic distribution with location `loc` and `scale` parameters. - -#### Mathematical details - -The cumulative density function of this distribution is: - -```none -cdf(x; mu, sigma) = 1 / (1 + exp(-(x - mu) / sigma)) -``` - -where `loc = mu` and `scale = sigma`. - -The Logistic distribution is a member of the [location-scale family]( -https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be -constructed as, - -```none -X ~ Logistic(loc=0, scale=1) -Y = loc + scale * X -``` - -#### Examples - -Examples of initialization of one or a batch of distributions. - -```python -# Define a single scalar Logistic distribution. -dist = tf.contrib.distributions.Logistic(loc=0., scale=3.) - -# Evaluate the cdf at 1, returning a scalar. -dist.cdf(1.) - -# Define a batch of two scalar valued Logistics. -# The first has mean 1 and scale 11, the second 2 and 22. -dist = tf.contrib.distributions.Logistic(loc=[1, 2.], scale=[11, 22.]) - -# Evaluate the pdf of the first distribution on 0, and the second on 1.5, -# returning a length two tensor. -dist.prob([0, 1.5]) - -# Get 3 samples, returning a 3 x 2 tensor. -dist.sample([3]) -``` - -Arguments are broadcast when possible. - -```python -# Define a batch of two scalar valued Logistics. -# Both have mean 1, but different scales. -dist = tf.contrib.distributions.Logistic(loc=1., scale=[11, 22.]) - -# Evaluate the pdf of both distributions on the same point, 3.0, -# returning a length 2 tensor. -dist.prob(3.0) -``` -- - - - -#### `tf.contrib.distributions.Logistic.__init__(loc, scale, validate_args=False, allow_nan_stats=True, name='Logistic')` {#Logistic.__init__} - -Construct Logistic distributions with mean and scale `loc` and `scale`. - -The parameters `loc` and `scale` must be shaped in a way that supports -broadcasting (e.g. `loc + scale` is a valid operation). - -##### Args: - - -* `loc`: Floating point tensor, the means of the distribution(s). -* `scale`: Floating point tensor, the scales of the distribution(s). Must - contain only positive values. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: The name to give Ops created by the initializer. - -##### Raises: - - -* `TypeError`: if loc and scale are different dtypes. - - -- - - - -#### `tf.contrib.distributions.Logistic.allow_nan_stats` {#Logistic.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Logistic.batch_shape` {#Logistic.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Logistic.batch_shape_tensor(name='batch_shape_tensor')` {#Logistic.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Logistic.cdf(value, name='cdf')` {#Logistic.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Logistic.copy(**override_parameters_kwargs)` {#Logistic.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Logistic.covariance(name='covariance')` {#Logistic.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Logistic.dtype` {#Logistic.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Logistic.entropy(name='entropy')` {#Logistic.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Logistic.event_shape` {#Logistic.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Logistic.event_shape_tensor(name='event_shape_tensor')` {#Logistic.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Logistic.is_continuous` {#Logistic.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Logistic.is_scalar_batch(name='is_scalar_batch')` {#Logistic.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Logistic.is_scalar_event(name='is_scalar_event')` {#Logistic.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Logistic.loc` {#Logistic.loc} - -Distribution parameter for the location. - - -- - - - -#### `tf.contrib.distributions.Logistic.log_cdf(value, name='log_cdf')` {#Logistic.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Logistic.log_prob(value, name='log_prob')` {#Logistic.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Logistic.log_survival_function(value, name='log_survival_function')` {#Logistic.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Logistic.mean(name='mean')` {#Logistic.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Logistic.mode(name='mode')` {#Logistic.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Logistic.name` {#Logistic.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Logistic.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Logistic.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Logistic.param_static_shapes(cls, sample_shape)` {#Logistic.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Logistic.parameters` {#Logistic.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Logistic.prob(value, name='prob')` {#Logistic.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Logistic.reparameterization_type` {#Logistic.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Logistic.sample(sample_shape=(), seed=None, name='sample')` {#Logistic.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Logistic.scale` {#Logistic.scale} - -Distribution parameter for scale. - - -- - - - -#### `tf.contrib.distributions.Logistic.stddev(name='stddev')` {#Logistic.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Logistic.survival_function(value, name='survival_function')` {#Logistic.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Logistic.validate_args` {#Logistic.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Logistic.variance(name='variance')` {#Logistic.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.bijector.AffineLinearOperator.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.bijector.AffineLinearOperator.md deleted file mode 100644 index 034f96e6cf..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.bijector.AffineLinearOperator.md +++ /dev/null @@ -1,358 +0,0 @@ -Compute `Y = g(X; shift, scale) = scale @ X + shift`. - -`shift` is a numeric `Tensor` and `scale` is a `LinearOperator`. - -If `X` is a scalar then the forward transformation is: `scale * X + shift` -where `*` denotes the scalar product. - -Note: we don't always simply transpose `X` (but write it this way for -brevity). Actually the input `X` undergoes the following transformation -before being premultiplied by `scale`: - -1. If there are no sample dims, we call `X = tf.expand_dims(X, 0)`, i.e., - `new_sample_shape = [1]`. Otherwise do nothing. -2. The sample shape is flattened to have one dimension, i.e., - `new_sample_shape = [n]` where `n = tf.reduce_prod(old_sample_shape)`. -3. The sample dim is cyclically rotated left by 1, i.e., - `new_shape = [B1,...,Bb, k, n]` where `n` is as above, `k` is the - event_shape, and `B1,...,Bb` are the batch shapes for each of `b` batch - dimensions. - -(For more details see `shape.make_batch_of_event_sample_matrices`.) - -The result of the above transformation is that `X` can be regarded as a batch -of matrices where each column is a draw from the distribution. After -premultiplying by `scale`, we take the inverse of this procedure. The input -`Y` also undergoes the same transformation before/after premultiplying by -`inv(scale)`. - -Example Use: - -```python -linalg = tf.contrib.linalg - -x = [1., 2, 3] - -shift = [-1., 0., 1] -diag = [1., 2, 3] -scale = linalg.LinearOperatorDiag(diag) -affine = AffineLinearOperator(shift, scale) -# In this case, `forward` is equivalent to: -# y = scale @ x + shift -y = affine.forward(x) # [0., 4, 10] - -shift = [2., 3, 1] -tril = [[1., 0, 0], - [2, 1, 0], - [3, 2, 1]] -scale = linalg.LinearOperatorTriL(tril) -affine = AffineLinearOperator(shift, scale) -# In this case, `forward` is equivalent to: -# np.squeeze(np.matmul(tril, np.expand_dims(x, -1)), -1) + shift -y = affine.forward(x) # [3., 7, 11] -``` -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.__init__(shift=None, scale=None, event_ndims=1, validate_args=False, name='affine_linear_operator')` {#AffineLinearOperator.__init__} - -Instantiates the `AffineLinearOperator` bijector. - -##### Args: - - -* `shift`: Floating-point `Tensor`. -* `scale`: Subclass of `LinearOperator`. Represents the (batch) positive - definite matrix `M` in `R^{k x k}`. -* `event_ndims`: Scalar `integer` `Tensor` indicating the number of dimensions - associated with a particular draw from the distribution. Must be 0 or 1. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str` name given to ops managed by this object. - -##### Raises: - - -* `ValueError`: if `event_ndims` is not 0 or 1. -* `TypeError`: if `scale` is not a `LinearOperator`. -* `TypeError`: if `shift.dtype` does not match `scale.dtype`. -* `ValueError`: if not `scale.is_non_singular`. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.dtype` {#AffineLinearOperator.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.event_ndims` {#AffineLinearOperator.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.forward(x, name='forward')` {#AffineLinearOperator.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.forward_event_shape(input_shape)` {#AffineLinearOperator.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#AffineLinearOperator.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#AffineLinearOperator.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.graph_parents` {#AffineLinearOperator.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.inverse(y, name='inverse')` {#AffineLinearOperator.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#AffineLinearOperator.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.inverse_event_shape(output_shape)` {#AffineLinearOperator.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#AffineLinearOperator.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#AffineLinearOperator.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.is_constant_jacobian` {#AffineLinearOperator.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.name` {#AffineLinearOperator.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.scale` {#AffineLinearOperator.scale} - -The `scale` `LinearOperator` in `Y = scale @ X + shift`. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.shift` {#AffineLinearOperator.shift} - -The `shift` `Tensor` in `Y = scale @ X + shift`. - - -- - - - -#### `tf.contrib.distributions.bijector.AffineLinearOperator.validate_args` {#AffineLinearOperator.validate_args} - -Returns True if Tensor arguments will be validated. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.bijector.Identity.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.bijector.Identity.md deleted file mode 100644 index a6045db420..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.distributions.bijector.Identity.md +++ /dev/null @@ -1,283 +0,0 @@ -Compute Y = g(X) = X. - -Example Use: - -```python -# Create the Y=g(X)=X transform which is intended for Tensors with 1 batch -# ndim and 1 event ndim (i.e., vector of vectors). -identity = Identity(event_ndims=1) -x = [[1., 2], - [3, 4]] -x == identity.forward(x) == identity.inverse(x) -``` -- - - - -#### `tf.contrib.distributions.bijector.Identity.__init__(validate_args=False, event_ndims=0, name='identity')` {#Identity.__init__} - - - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.dtype` {#Identity.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.event_ndims` {#Identity.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.forward(x, name='forward')` {#Identity.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.forward_event_shape(input_shape)` {#Identity.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Identity.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Identity.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.graph_parents` {#Identity.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.inverse(y, name='inverse')` {#Identity.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Identity.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.inverse_event_shape(output_shape)` {#Identity.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Identity.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Identity.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.is_constant_jacobian` {#Identity.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.name` {#Identity.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Identity.validate_args` {#Identity.validate_args} - -Returns True if Tensor arguments will be validated. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.assert_scalar.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.assert_scalar.md deleted file mode 100644 index d3618fa38c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.assert_scalar.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.framework.assert_scalar(tensor, name=None)` {#assert_scalar} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.assign_from_values.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.assign_from_values.md deleted file mode 100644 index 6560f08281..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.assign_from_values.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.contrib.framework.assign_from_values(var_names_to_values)` {#assign_from_values} - -Creates an assignment operation from a given mapping. - -This function provides a mechanism for performing assignment of variables -to values in a way that does not fill the graph with large assignment values. - -##### Args: - - -* `var_names_to_values`: A map from variable names to values. - -##### Returns: - - -* `assign_op`: An `Operation` that assigns each of the given variables to the - requested values. -* `feed_dict`: The feed dictionary to use when evaluating `assign_op`. - -##### Raises: - - -* `ValueError`: if any of the given variable names were not found. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.create_global_step.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.create_global_step.md deleted file mode 100644 index d41c8eb95a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.create_global_step.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.contrib.framework.create_global_step(graph=None)` {#create_global_step} - -Create global step tensor in graph. - -##### Args: - - -* `graph`: The graph in which to create the global step. If missing, use default - graph. - -##### Returns: - - Global step tensor. - -##### Raises: - - -* `ValueError`: if global step key is already defined. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.deprecated.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.deprecated.md deleted file mode 100644 index 2daecf41e2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.deprecated.md +++ /dev/null @@ -1,34 +0,0 @@ -### `tf.contrib.framework.deprecated(date, instructions)` {#deprecated} - -Decorator for marking functions or methods deprecated. - -This decorator logs a deprecation warning whenever the decorated function is -called. It has the following format: - - (from ) is deprecated and will be removed after . - Instructions for updating: - - - will include the class name if it is a method. - -It also edits the docstring of the function: ' (deprecated)' is appended -to the first line of the docstring and a deprecation notice is prepended -to the rest of the docstring. - -##### Args: - - -* `date`: String. The date the function is scheduled to be removed. Must be - ISO 8601 (YYYY-MM-DD). -* `instructions`: String. Instructions on how to update code using the - deprecated function. - -##### Returns: - - Decorated function or method. - -##### Raises: - - -* `ValueError`: If date is not in ISO 8601 format, or instructions are empty. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.reduce_sum_n.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.reduce_sum_n.md deleted file mode 100644 index 06b9822278..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.framework.reduce_sum_n.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.contrib.framework.reduce_sum_n(tensors, name=None)` {#reduce_sum_n} - -Reduce tensors to a scalar sum. - -This reduces each tensor in `tensors` to a scalar via `tf.reduce_sum`, then -adds them via `tf.add_n`. - -##### Args: - - -* `tensors`: List of tensors, all of the same numeric type. -* `name`: Tensor name, and scope for all other ops. - -##### Returns: - - Total loss tensor, or None if no losses have been configured. - -##### Raises: - - -* `ValueError`: if `losses` is missing or empty. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.assign_renamed_collections_handler.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.assign_renamed_collections_handler.md deleted file mode 100644 index b1bab3eec0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.assign_renamed_collections_handler.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.contrib.graph_editor.assign_renamed_collections_handler(info, elem, elem_)` {#assign_renamed_collections_handler} - -Add the transformed elem to the (renamed) collections of elem. - -A collection is renamed only if is not a known key, as described in -`tf.GraphKeys`. - -##### Args: - - -* `info`: Transform._TmpInfo instance. -* `elem`: the original element (`tf.Tensor` or `tf.Operation`) -* `elem_`: the transformed element - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.detach_control_inputs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.detach_control_inputs.md deleted file mode 100644 index cbdf5a943f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.detach_control_inputs.md +++ /dev/null @@ -1,10 +0,0 @@ -### `tf.contrib.graph_editor.detach_control_inputs(sgv)` {#detach_control_inputs} - -Detach all the external control inputs of the subgraph sgv. - -##### Args: - - -* `sgv`: the subgraph view to be detached. This argument is converted to a - subgraph using the same rules as the function subgraph.make_view. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.get_forward_walk_ops.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.get_forward_walk_ops.md deleted file mode 100644 index 7ac8cc0748..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.get_forward_walk_ops.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.contrib.graph_editor.get_forward_walk_ops(seed_ops, inclusive=True, within_ops=None, stop_at_ts=(), control_outputs=None)` {#get_forward_walk_ops} - -Do a forward graph walk and return all the visited ops. - -##### Args: - - -* `seed_ops`: an iterable of operations from which the forward graph - walk starts. If a list of tensors is given instead, the seed_ops are set - to be the consumers of those tensors. -* `inclusive`: if True the given seed_ops are also part of the resulting set. -* `within_ops`: an iterable of `tf.Operation` within which the search is - restricted. If `within_ops` is `None`, the search is performed within - the whole graph. -* `stop_at_ts`: an iterable of tensors at which the graph walk stops. -* `control_outputs`: a `util.ControlOutputs` instance or None. - If not `None`, it will be used while walking the graph forward. - -##### Returns: - - A Python set of all the `tf.Operation` ahead of `seed_ops`. - -##### Raises: - - -* `TypeError`: if `seed_ops` or `within_ops` cannot be converted to a list of - `tf.Operation`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.get_tensors.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.get_tensors.md deleted file mode 100644 index c000b26faa..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.get_tensors.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.contrib.graph_editor.get_tensors(graph)` {#get_tensors} - -get all the tensors which are input or output of an op in the graph. - -##### Args: - - -* `graph`: a `tf.Graph`. - -##### Returns: - - A list of `tf.Tensor`. - -##### Raises: - - -* `TypeError`: if graph is not a `tf.Graph`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.replace_t_with_placeholder_handler.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.replace_t_with_placeholder_handler.md deleted file mode 100644 index a808129fa1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.replace_t_with_placeholder_handler.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.contrib.graph_editor.replace_t_with_placeholder_handler(info, t)` {#replace_t_with_placeholder_handler} - -Transform a tensor into a placeholder tensor. - -This handler is typically used to transform a subgraph input tensor into a -placeholder. - -##### Args: - - -* `info`: Transform._TmpInfo instance. -* `t`: tensor whose input must be transformed into a place holder. - -##### Returns: - - The tensor generated by the newly created place holder. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.select_ops_and_ts.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.select_ops_and_ts.md deleted file mode 100644 index 02fae6be8f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.select_ops_and_ts.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.contrib.graph_editor.select_ops_and_ts(*args, **kwargs)` {#select_ops_and_ts} - -Helper to select operations and tensors. - -##### Args: - - -* `*args`: list of 1) regular expressions (compiled or not) or 2) (array of) - `tf.Operation` 3) (array of) tf.Tensor. Regular expressions matching - tensors must start with the comment `"(?#ts)"`, for instance: - `"(?#ts)^foo/.*"`. -* `**kwargs`: 'graph': `tf.Graph` in which to perform the regex query.This is - required when using regex. - 'positive_filter': an elem if selected only if `positive_filter(elem)` is - `True`. This is optional. - -##### Returns: - - A tuple `(ops, ts)` where: - `ops` is a list of `tf.Operation`, and - `ts` is a list of `tf.Tensor` - -##### Raises: - - -* `TypeError`: if the optional keyword argument graph is not a `tf.Graph` - or if an argument in args is not an (array of) `tf.Tensor` - or an (array of) `tf.Operation` or a string or a regular expression. -* `ValueError`: if one of the keyword arguments is unexpected or if a regular - expression is used without passing a graph as a keyword argument. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.swap_ts.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.swap_ts.md deleted file mode 100644 index 2f2883b76e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.graph_editor.swap_ts.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.contrib.graph_editor.swap_ts(ts0, ts1, can_modify=None, cannot_modify=None)` {#swap_ts} - -For each tensor's pair, swap the end of (t0,t1). - -B0 B1 B0 B1 -| | => X -A0 A1 A0 A1 - -##### Args: - - -* `ts0`: an object convertible to a list of `tf.Tensor`. -* `ts1`: an object convertible to a list of `tf.Tensor`. -* `can_modify`: iterable of operations which can be modified. Any operation - outside within_ops will be left untouched by this function. -* `cannot_modify`: iterable of operations which cannot be modified. - Any operation within cannot_modify will be left untouched by this - function. - -##### Returns: - - The number of individual modifications made by the function. - -##### Raises: - - -* `TypeError`: if ts0 or ts1 cannot be converted to a list of tf.Tensor. -* `TypeError`: if can_modify or cannot_modify is not None and cannot be - converted to a list of tf.Operation. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.layers.bucketized_column.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.layers.bucketized_column.md deleted file mode 100644 index fa69df86d9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.layers.bucketized_column.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.contrib.layers.bucketized_column(source_column, boundaries)` {#bucketized_column} - -Creates a _BucketizedColumn for discretizing dense input. - -##### Args: - - -* `source_column`: A _RealValuedColumn defining dense column. -* `boundaries`: A list of floats specifying the boundaries. It has to be sorted. - -##### Returns: - - A _BucketizedColumn. - -##### Raises: - - -* `ValueError`: if 'boundaries' is empty or not sorted. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.layers.embed_sequence.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.layers.embed_sequence.md deleted file mode 100644 index 8ad845ba64..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.layers.embed_sequence.md +++ /dev/null @@ -1,34 +0,0 @@ -### `tf.contrib.layers.embed_sequence(ids, vocab_size=None, embed_dim=None, unique=False, initializer=None, regularizer=None, trainable=True, scope=None, reuse=None)` {#embed_sequence} - -Maps a sequence of symbols to a sequence of embeddings. - -Typical use case would be reusing embeddings between an encoder and decoder. - -##### Args: - - -* `ids`: `[batch_size, doc_length]` `Tensor` of type `int32` or `int64` - with symbol ids. -* `vocab_size`: Integer number of symbols in vocabulary. -* `embed_dim`: Integer number of dimensions for embedding matrix. -* `unique`: If `True`, will first compute the unique set of indices, and then - lookup each embedding once, repeating them in the output as needed. -* `initializer`: An initializer for the embeddings, if `None` default for - current scope is used. -* `regularizer`: Optional regularizer for the embeddings. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see `tf.Variable`). -* `scope`: Optional string specifying the variable scope for the op, required - if `reuse=True`. -* `reuse`: If `True`, variables inside the op will be reused. - -##### Returns: - - `Tensor` of `[batch_size, doc_length, embed_dim]` with embedded sequences. - -##### Raises: - - -* `ValueError`: if `embed_dim` or `vocab_size` are not specified when not - `reuse` is `None` or `False`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.layers.summarize_activations.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.layers.summarize_activations.md deleted file mode 100644 index dc2e7a6044..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.layers.summarize_activations.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.layers.summarize_activations(name_filter=None, summarizer=summarize_activation)` {#summarize_activations} - -Summarize activations, using `summarize_activation` to summarize. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.ExportStrategy.__new__.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.ExportStrategy.__new__.md deleted file mode 100644 index 68f3c7c314..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.ExportStrategy.__new__.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.contrib.learn.ExportStrategy.__new__(_cls, name, export_fn)` {#ExportStrategy.__new__} - -Create new instance of ExportStrategy(name, export_fn) - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.MetricSpec.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.MetricSpec.md deleted file mode 100644 index 20b689f0a3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.MetricSpec.md +++ /dev/null @@ -1,181 +0,0 @@ -MetricSpec connects a model to metric functions. - -The MetricSpec class contains all information necessary to connect the -output of a `model_fn` to the metrics (usually, streaming metrics) that are -used in evaluation. - -It is passed in the `metrics` argument of `Estimator.evaluate`. The -`Estimator` then knows which predictions, labels, and weight to use to call a -given metric function. - -When building the ops to run in evaluation, `Estimator` will call -`create_metric_ops`, which will connect the given `metric_fn` to the model -as detailed in the docstring for `create_metric_ops`, and return the metric. - -Example: - -Assuming a model has an input function which returns inputs containing -(among other things) a tensor with key "input_key", and a labels dictionary -containing "label_key". Let's assume that the `model_fn` for this model -returns a prediction with key "prediction_key". - -In order to compute the accuracy of the "prediction_key" prediction, we -would add - -``` -"prediction accuracy": MetricSpec(metric_fn=prediction_accuracy_fn, - prediction_key="prediction_key", - label_key="label_key") -``` - -to the metrics argument to `evaluate`. `prediction_accuracy_fn` can be either -a predefined function in metric_ops (e.g., `streaming_accuracy`) or a custom -function you define. - -If we would like the accuracy to be weighted by "input_key", we can add that -as the `weight_key` argument. - -``` -"prediction accuracy": MetricSpec(metric_fn=prediction_accuracy_fn, - prediction_key="prediction_key", - label_key="label_key", - weight_key="input_key") -``` - -An end-to-end example is as follows: - -``` -estimator = tf.contrib.learn.Estimator(...) -estimator.fit(...) -_ = estimator.evaluate( - input_fn=input_fn, - steps=1, - metrics={ - 'prediction accuracy': - metric_spec.MetricSpec( - metric_fn=prediction_accuracy_fn, - prediction_key="prediction_key", - label_key="label_key") - }) -``` -- - - - -#### `tf.contrib.learn.MetricSpec.__init__(metric_fn, prediction_key=None, label_key=None, weight_key=None)` {#MetricSpec.__init__} - -Constructor. - -Creates a MetricSpec. - -##### Args: - - -* `metric_fn`: A function to use as a metric. See `_adapt_metric_fn` for - rules on how `predictions`, `labels`, and `weights` are passed to this - function. This must return either a single `Tensor`, which is - interpreted as a value of this metric, or a pair - `(value_op, update_op)`, where `value_op` is the op to call to - obtain the value of the metric, and `update_op` should be run for - each batch to update internal state. -* `prediction_key`: The key for a tensor in the `predictions` dict (output - from the `model_fn`) to use as the `predictions` input to the - `metric_fn`. Optional. If `None`, the `model_fn` must return a single - tensor or a dict with only a single entry as `predictions`. -* `label_key`: The key for a tensor in the `labels` dict (output from the - `input_fn`) to use as the `labels` input to the `metric_fn`. - Optional. If `None`, the `input_fn` must return a single tensor or a - dict with only a single entry as `labels`. -* `weight_key`: The key for a tensor in the `inputs` dict (output from the - `input_fn`) to use as the `weights` input to the `metric_fn`. - Optional. If `None`, no weights will be passed to the `metric_fn`. - - -- - - - -#### `tf.contrib.learn.MetricSpec.__str__()` {#MetricSpec.__str__} - - - - -- - - - -#### `tf.contrib.learn.MetricSpec.create_metric_ops(inputs, labels, predictions)` {#MetricSpec.create_metric_ops} - -Connect our `metric_fn` to the specified members of the given dicts. - -This function will call the `metric_fn` given in our constructor as follows: - -``` - metric_fn(predictions[self.prediction_key], - labels[self.label_key], - weights=weights[self.weight_key]) -``` - -And returns the result. The `weights` argument is only passed if -`self.weight_key` is not `None`. - -`predictions` and `labels` may be single tensors as well as dicts. If -`predictions` is a single tensor, `self.prediction_key` must be `None`. If -`predictions` is a single element dict, `self.prediction_key` is allowed to -be `None`. Conversely, if `labels` is a single tensor, `self.label_key` must -be `None`. If `labels` is a single element dict, `self.label_key` is allowed -to be `None`. - -##### Args: - - -* `inputs`: A dict of inputs produced by the `input_fn` -* `labels`: A dict of labels or a single label tensor produced by the - `input_fn`. -* `predictions`: A dict of predictions or a single tensor produced by the - `model_fn`. - -##### Returns: - - The result of calling `metric_fn`. - -##### Raises: - - -* `ValueError`: If `predictions` or `labels` is a single `Tensor` and - `self.prediction_key` or `self.label_key` is not `None`; or if - `self.label_key` is `None` but `labels` is a dict with more than one - element, or if `self.prediction_key` is `None` but `predictions` is a - dict with more than one element. - - -- - - - -#### `tf.contrib.learn.MetricSpec.label_key` {#MetricSpec.label_key} - - - - -- - - - -#### `tf.contrib.learn.MetricSpec.metric_fn` {#MetricSpec.metric_fn} - -Metric function. - -This function accepts named args: `predictions`, `labels`, `weights`. It -returns a single `Tensor` or `(value_op, update_op)` pair. See `metric_fn` -constructor argument for more details. - -##### Returns: - - Function, see `metric_fn` constructor argument for more details. - - -- - - - -#### `tf.contrib.learn.MetricSpec.prediction_key` {#MetricSpec.prediction_key} - - - - -- - - - -#### `tf.contrib.learn.MetricSpec.weight_key` {#MetricSpec.weight_key} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.NotFittedError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.NotFittedError.md deleted file mode 100644 index 6101ade1da..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.NotFittedError.md +++ /dev/null @@ -1,17 +0,0 @@ -Exception class to raise if estimator is used before fitting. - -This class inherits from both ValueError and AttributeError to help with -exception handling and backward compatibility. - -Examples: ->>> from sklearn.svm import LinearSVC ->>> from sklearn.exceptions import NotFittedError ->>> try: -... LinearSVC().predict([[1, 2], [2, 3], [3, 4]]) -... except NotFittedError as e: -... print(repr(e)) -... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS -NotFittedError('This LinearSVC instance is not fitted yet',) - -Copied from -https://github.com/scikit-learn/scikit-learn/master/sklearn/exceptions.py diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.RunConfig.get_task_id.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.RunConfig.get_task_id.md deleted file mode 100644 index 1c2856df21..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.RunConfig.get_task_id.md +++ /dev/null @@ -1,12 +0,0 @@ -#### `tf.contrib.learn.RunConfig.get_task_id()` {#RunConfig.get_task_id} - -Returns task index from `TF_CONFIG` environmental variable. - -If you have a ClusterConfig instance, you can just access its task_id -property instead of calling this function and re-parsing the environmental -variable. - -##### Returns: - - `TF_CONFIG['task']['index']`. Defaults to 0. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.extract_dask_labels.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.extract_dask_labels.md deleted file mode 100644 index 2ccdd8a8e2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.extract_dask_labels.md +++ /dev/null @@ -1,27 +0,0 @@ -### `tf.contrib.learn.extract_dask_labels(labels)` {#extract_dask_labels} - -Extract data from dask.Series or dask.DataFrame for labels. - -Given a distributed dask.DataFrame or dask.Series containing exactly one -column or name, this operation returns a single dask.DataFrame or dask.Series -that can be iterated over. - -##### Args: - - -* `labels`: A distributed dask.DataFrame or dask.Series with exactly one - column or name. - -##### Returns: - - A dask.DataFrame or dask.Series that can be iterated over. - If the supplied argument is neither a dask.DataFrame nor a dask.Series this - operation returns it without modification. - -##### Raises: - - -* `ValueError`: If the supplied dask.DataFrame contains more than one - column or the supplied dask.Series contains more than - one name. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.monitors.PrintTensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.monitors.PrintTensor.md deleted file mode 100644 index 4044c2ad30..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.monitors.PrintTensor.md +++ /dev/null @@ -1,187 +0,0 @@ -Prints given tensors every N steps. - -This is an `EveryN` monitor and has consistent semantic for `every_n` -and `first_n`. - -The tensors will be printed to the log, with `INFO` severity. -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.__init__(tensor_names, every_n=100, first_n=1)` {#PrintTensor.__init__} - -Initializes a PrintTensor monitor. - -##### Args: - - -* `tensor_names`: `dict` of tag to tensor names or - `iterable` of tensor names (strings). -* `every_n`: `int`, print every N steps. See `PrintN.` -* `first_n`: `int`, also print the first N steps. See `PrintN.` - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.begin(max_steps=None)` {#PrintTensor.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.end(session=None)` {#PrintTensor.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.epoch_begin(epoch)` {#PrintTensor.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.epoch_end(epoch)` {#PrintTensor.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.every_n_post_step(step, session)` {#PrintTensor.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.every_n_step_begin(step)` {#PrintTensor.every_n_step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.every_n_step_end(step, outputs)` {#PrintTensor.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.post_step(step, session)` {#PrintTensor.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.run_on_all_workers` {#PrintTensor.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.set_estimator(estimator)` {#PrintTensor.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.step_begin(step)` {#PrintTensor.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.PrintTensor.step_end(step, output)` {#PrintTensor.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.read_batch_examples.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.read_batch_examples.md deleted file mode 100644 index 4f389b2bc9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.learn.read_batch_examples.md +++ /dev/null @@ -1,46 +0,0 @@ -### `tf.contrib.learn.read_batch_examples(file_pattern, batch_size, reader, randomize_input=True, num_epochs=None, queue_capacity=10000, num_threads=1, read_batch_size=1, parse_fn=None, name=None, seed=None)` {#read_batch_examples} - -Adds operations to read, queue, batch `Example` protos. - -Given file pattern (or list of files), will setup a queue for file names, -read `Example` proto using provided `reader`, use batch queue to create -batches of examples of size `batch_size`. - -All queue runners are added to the queue runners collection, and may be -started via `start_queue_runners`. - -All ops are added to the default graph. - -Use `parse_fn` if you need to do parsing / processing on single examples. - -##### Args: - - -* `file_pattern`: List of files or pattern of file paths containing - `Example` records. See `tf.gfile.Glob` for pattern rules. -* `batch_size`: An int or scalar `Tensor` specifying the batch size to use. -* `reader`: A function or class that returns an object with - `read` method, (filename tensor) -> (example tensor). -* `randomize_input`: Whether the input should be randomized. -* `num_epochs`: Integer specifying the number of times to read through the - dataset. If `None`, cycles through the dataset forever. - NOTE - If specified, creates a variable that must be initialized, so call - `tf.global_variables_initializer()` and run the op in a session. -* `queue_capacity`: Capacity for input queue. -* `num_threads`: The number of threads enqueuing examples. -* `read_batch_size`: An int or scalar `Tensor` specifying the number of - records to read at once -* `parse_fn`: Parsing function, takes `Example` Tensor returns parsed - representation. If `None`, no parsing is done. -* `name`: Name of resulting op. -* `seed`: An integer (optional). Seed used if randomize_input == True. - -##### Returns: - - String `Tensor` of batched `Example` proto. - -##### Raises: - - -* `ValueError`: for invalid inputs. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.linalg.LinearOperatorMatrix.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.linalg.LinearOperatorMatrix.md deleted file mode 100644 index 0f07a4457d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.linalg.LinearOperatorMatrix.md +++ /dev/null @@ -1,519 +0,0 @@ -`LinearOperator` that wraps a [batch] matrix. - -This operator wraps a [batch] matrix `A` (which is a `Tensor`) with shape -`[B1,...,Bb, M, N]` for some `b >= 0`. The first `b` indices index a -batch member. For every batch index `(i1,...,ib)`, `A[i1,...,ib, : :]` is -an `M x N` matrix. - -```python -# Create a 2 x 2 linear operator. -matrix = [[1., 2.], [3., 4.]] -operator = LinearOperatorMatrix(matrix) - -operator.to_dense() -==> [[1., 2.] - [3., 4.]] - -operator.shape -==> [2, 2] - -operator.log_determinant() -==> scalar Tensor - -x = ... Shape [2, 4] Tensor -operator.apply(x) -==> Shape [2, 4] Tensor - -# Create a [2, 3] batch of 4 x 4 linear operators. -matrix = tf.random_normal(shape=[2, 3, 4, 4]) -operator = LinearOperatorMatrix(matrix) -``` - -#### Shape compatibility - -This operator acts on [batch] matrix with compatible shape. -`x` is a batch matrix with compatible shape for `apply` and `solve` if - -``` -operator.shape = [B1,...,Bb] + [M, N], with b >= 0 -x.shape = [B1,...,Bb] + [N, R], with R >= 0. -``` - -#### Performance - -`LinearOperatorMatrix` has exactly the same performance as would be achieved -by using standard `TensorFlow` matrix ops. Intelligent choices are made -based on the following initialization hints. - -* If `dtype` is real, and `is_self_adjoint` and `is_positive_definite`, a - Cholesky factorization is used for the determinant and solve. - -In all cases, suppose `operator` is a `LinearOperatorMatrix` of shape -`[M, N]`, and `x.shape = [N, R]`. Then - -* `operator.apply(x)` is `O(M * N * R)`. -* If `M=N`, `operator.solve(x)` is `O(N^3 * R)`. -* If `M=N`, `operator.determinant()` is `O(N^3)`. - -If instead `operator` and `x` have shape `[B1,...,Bb, M, N]` and -`[B1,...,Bb, N, R]`, every operation increases in complexity by `B1*...*Bb`. - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite`. -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.__init__(matrix, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, name='LinearOperatorMatrix')` {#LinearOperatorMatrix.__init__} - -Initialize a `LinearOperatorMatrix`. - -##### Args: - - -* `matrix`: Shape `[B1,...,Bb, M, N]` with `b >= 0`, `M, N >= 0`. - Allowed dtypes: `float32`, `float64`, `complex64`, `complex128`. -* `is_non_singular`: Expect that this operator is non-singular. -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. -* `is_positive_definite`: Expect that this operator is positive definite, - meaning the real part of all eigenvalues is positive. We do not require - the operator to be self-adjoint to be positive-definite. See: -* `https`: //en.wikipedia.org/wiki/Positive-definite_matrix - #Extension_for_non_symmetric_matrices -* `name`: A name for this `LinearOperator`. - -##### Raises: - - -* `TypeError`: If `diag.dtype` is not an allowed type. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.add_to_tensor(x, name='add_to_tensor')` {#LinearOperatorMatrix.add_to_tensor} - -Add matrix represented by this operator to `x`. Equivalent to `A + x`. - -##### Args: - - -* `x`: `Tensor` with same `dtype` and shape broadcastable to `self.shape`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.apply(x, adjoint=False, name='apply')` {#LinearOperatorMatrix.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.assert_non_singular(name='assert_non_singular')` {#LinearOperatorMatrix.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.assert_positive_definite(name='assert_positive_definite')` {#LinearOperatorMatrix.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperatorMatrix.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.batch_shape` {#LinearOperatorMatrix.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperatorMatrix.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.determinant(name='det')` {#LinearOperatorMatrix.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.diag_part(name='diag_part')` {#LinearOperatorMatrix.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.domain_dimension` {#LinearOperatorMatrix.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperatorMatrix.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.dtype` {#LinearOperatorMatrix.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.graph_parents` {#LinearOperatorMatrix.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.is_non_singular` {#LinearOperatorMatrix.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.is_positive_definite` {#LinearOperatorMatrix.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.is_self_adjoint` {#LinearOperatorMatrix.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.is_square` {#LinearOperatorMatrix.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.log_abs_determinant(name='log_abs_det')` {#LinearOperatorMatrix.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.name` {#LinearOperatorMatrix.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.range_dimension` {#LinearOperatorMatrix.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperatorMatrix.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.shape` {#LinearOperatorMatrix.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.shape_tensor(name='shape_tensor')` {#LinearOperatorMatrix.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.solve(rhs, adjoint=False, name='solve')` {#LinearOperatorMatrix.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.tensor_rank` {#LinearOperatorMatrix.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperatorMatrix.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorMatrix.to_dense(name='to_dense')` {#LinearOperatorMatrix.to_dense} - -Return a dense (batch) matrix representing this operator. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.losses.log_loss.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.losses.log_loss.md deleted file mode 100644 index 2d786d790f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.losses.log_loss.md +++ /dev/null @@ -1,36 +0,0 @@ -### `tf.contrib.losses.log_loss(*args, **kwargs)` {#log_loss} - -Adds a Log Loss term to the training procedure. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.log_loss instead. Note that the order of the predictions and labels arguments was changed. - -`weights` acts as a coefficient for the loss. If a scalar is provided, then -the loss is simply scaled by the given value. If `weights` is a tensor of size -[batch_size], then the total loss for each sample of the batch is rescaled -by the corresponding element in the `weights` vector. If the shape of -`weights` matches the shape of `predictions`, then the loss of each -measurable element of `predictions` is scaled by the corresponding value of -`weights`. - -##### Args: - - -* `predictions`: The predicted outputs. -* `labels`: The ground truth output tensor, same dimensions as 'predictions'. -* `weights`: Coefficients for the loss a scalar, a tensor of shape - [batch_size] or a tensor whose shape matches `predictions`. -* `epsilon`: A small increment to add to avoid taking a log of zero. -* `scope`: The scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the loss value. - -##### Raises: - - -* `ValueError`: If the shape of `predictions` doesn't match that of `labels` or - if the shape of `weights` is invalid. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.set_intersection.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.set_intersection.md deleted file mode 100644 index fce0131626..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.set_intersection.md +++ /dev/null @@ -1,63 +0,0 @@ -### `tf.contrib.metrics.set_intersection(a, b, validate_indices=True)` {#set_intersection} - -Compute set intersection of elements in last dimension of `a` and `b`. - -All but the last dimension of `a` and `b` must match. - -Example: - -```python - a = [ - [ - [ - [1, 2], - [3], - ], - [ - [4], - [5, 6], - ], - ], - ] - b = [ - [ - [ - [1, 3], - [2], - ], - [ - [4, 5], - [5, 6, 7, 8], - ], - ], - ] - set_intersection(a, b) = [ - [ - [ - [1], - [], - ], - [ - [4], - [5, 6], - ], - ], - ] -``` - -##### Args: - - -* `a`: `Tensor` or `SparseTensor` of the same type as `b`. If sparse, indices - must be sorted in row-major order. -* `b`: `Tensor` or `SparseTensor` of the same type as `a`. If sparse, indices - must be sorted in row-major order. -* `validate_indices`: Whether to validate the order and range of sparse indices - in `a` and `b`. - -##### Returns: - - A `SparseTensor` whose shape is the same rank as `a` and `b`, and all but - the last dimension the same. Elements along the last dimension contain the - intersections. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_false_positives_at_thresholds.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_false_positives_at_thresholds.md deleted file mode 100644 index c8a078eecd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_false_positives_at_thresholds.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.metrics.streaming_false_positives_at_thresholds(predictions, labels, thresholds, weights=None)` {#streaming_false_positives_at_thresholds} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_mean_iou.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_mean_iou.md deleted file mode 100644 index e6e5cae097..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_mean_iou.md +++ /dev/null @@ -1,51 +0,0 @@ -### `tf.contrib.metrics.streaming_mean_iou(predictions, labels, num_classes, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_mean_iou} - -Calculate per-step mean Intersection-Over-Union (mIOU). - -Mean Intersection-Over-Union is a common evaluation metric for -semantic image segmentation, which first computes the IOU for each -semantic class and then computes the average over classes. - -##### IOU is defined as follows: - - IOU = true_positive / (true_positive + false_positive + false_negative). -The predictions are accumulated in a confusion matrix, weighted by `weights`, -and mIOU is then calculated from it. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the `mean_iou`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A `Tensor` of prediction results for semantic labels, whose - shape is [batch size] and type `int32` or `int64`. The tensor will be - flattened, if its rank > 1. -* `labels`: A `Tensor` of ground truth labels with shape [batch size] and of - type `int32` or `int64`. The tensor will be flattened, if its rank > 1. -* `num_classes`: The possible number of labels the prediction task can - have. This value must be provided, since a confusion matrix of - dimension = [num_classes, num_classes] will be allocated. -* `weights`: An optional `Tensor` whose shape is broadcastable to `predictions`. -* `metrics_collections`: An optional list of collections that `mean_iou` - should be added to. -* `updates_collections`: An optional list of collections `update_op` should be - added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `mean_iou`: A `Tensor` representing the mean intersection-over-union. -* `update_op`: An operation that increments the confusion matrix. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_recall.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_recall.md deleted file mode 100644 index 7b9e286f13..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_recall.md +++ /dev/null @@ -1,47 +0,0 @@ -### `tf.contrib.metrics.streaming_recall(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_recall} - -Computes the recall of the predictions with respect to the labels. - -The `streaming_recall` function creates two local variables, `true_positives` -and `false_negatives`, that are used to compute the recall. This value is -ultimately returned as `recall`, an idempotent operation that simply divides -`true_positives` by the sum of `true_positives` and `false_negatives`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` that updates these variables and returns the `recall`. `update_op` -weights each prediction by the corresponding value in `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: The predicted values, a `bool` `Tensor` of arbitrary shape. -* `labels`: The ground truth values, a `bool` `Tensor` whose dimensions must - match `predictions`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that `recall` should - be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `recall`: Scalar float `Tensor` with the value of `true_positives` divided - by the sum of `true_positives` and `false_negatives`. -* `update_op`: `Operation` that increments `true_positives` and - `false_negatives` variables appropriately and whose value matches - `recall`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_root_mean_squared_error.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_root_mean_squared_error.md deleted file mode 100644 index 7bdd57690e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.metrics.streaming_root_mean_squared_error.md +++ /dev/null @@ -1,51 +0,0 @@ -### `tf.contrib.metrics.streaming_root_mean_squared_error(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_root_mean_squared_error} - -Computes the root mean squared error between the labels and predictions. - -The `streaming_root_mean_squared_error` function creates two local variables, -`total` and `count` that are used to compute the root mean squared error. -This average is weighted by `weights`, and it is ultimately returned as -`root_mean_squared_error`: an idempotent operation that takes the square root -of the division of `total` by `count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`root_mean_squared_error`. Internally, a `squared_error` operation computes -the element-wise square of the difference between `predictions` and `labels`. -Then `update_op` increments `total` with the reduced sum of the product of -`weights` and `squared_error`, and it increments `count` with the reduced sum -of `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A `Tensor` of arbitrary shape. -* `labels`: A `Tensor` of the same shape as `predictions`. -* `weights`: Optional `Tensor` indicating the frequency with which an example is - sampled. Rank must be 0, or the same rank as `labels`, and must be - broadcastable to `labels` (i.e., all dimensions must be either `1`, or - the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that - `root_mean_squared_error` should be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `root_mean_squared_error`: A `Tensor` representing the current mean, the value - of `total` divided by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `root_mean_squared_error`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.rnn.LSTMStateTuple.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.rnn.LSTMStateTuple.md deleted file mode 100644 index 7db1e1277e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.rnn.LSTMStateTuple.md +++ /dev/null @@ -1,54 +0,0 @@ -Tuple used by LSTM Cells for `state_size`, `zero_state`, and output state. - -Stores two elements: `(c, h)`, in that order. - -Only used when `state_is_tuple=True`. -- - - - -#### `tf.contrib.rnn.LSTMStateTuple.__getnewargs__()` {#LSTMStateTuple.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.contrib.rnn.LSTMStateTuple.__getstate__()` {#LSTMStateTuple.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.contrib.rnn.LSTMStateTuple.__new__(_cls, c, h)` {#LSTMStateTuple.__new__} - -Create new instance of LSTMStateTuple(c, h) - - -- - - - -#### `tf.contrib.rnn.LSTMStateTuple.__repr__()` {#LSTMStateTuple.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.contrib.rnn.LSTMStateTuple.c` {#LSTMStateTuple.c} - -Alias for field number 0 - - -- - - - -#### `tf.contrib.rnn.LSTMStateTuple.dtype` {#LSTMStateTuple.dtype} - - - - -- - - - -#### `tf.contrib.rnn.LSTMStateTuple.h` {#LSTMStateTuple.h} - -Alias for field number 1 - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.rnn.LayerNormBasicLSTMCell.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.rnn.LayerNormBasicLSTMCell.md deleted file mode 100644 index 814388a1a2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.rnn.LayerNormBasicLSTMCell.md +++ /dev/null @@ -1,84 +0,0 @@ -LSTM unit with layer normalization and recurrent dropout. - -This class adds layer normalization and recurrent dropout to a -basic LSTM unit. Layer normalization implementation is based on: - - https://arxiv.org/abs/1607.06450. - -"Layer Normalization" -Jimmy Lei Ba, Jamie Ryan Kiros, Geoffrey E. Hinton - -and is applied before the internal nonlinearities. -Recurrent dropout is base on: - - https://arxiv.org/abs/1603.05118 - -"Recurrent Dropout without Memory Loss" -Stanislau Semeniuta, Aliaksei Severyn, Erhardt Barth. -- - - - -#### `tf.contrib.rnn.LayerNormBasicLSTMCell.__call__(inputs, state, scope=None)` {#LayerNormBasicLSTMCell.__call__} - -LSTM cell with layer normalization and recurrent dropout. - - -- - - - -#### `tf.contrib.rnn.LayerNormBasicLSTMCell.__init__(num_units, forget_bias=1.0, input_size=None, activation=tanh, layer_norm=True, norm_gain=1.0, norm_shift=0.0, dropout_keep_prob=1.0, dropout_prob_seed=None)` {#LayerNormBasicLSTMCell.__init__} - -Initializes the basic LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell. -* `forget_bias`: float, The bias added to forget gates (see above). -* `input_size`: Deprecated and unused. -* `activation`: Activation function of the inner states. -* `layer_norm`: If `True`, layer normalization will be applied. -* `norm_gain`: float, The layer normalization gain initial value. If - `layer_norm` has been set to `False`, this argument will be ignored. -* `norm_shift`: float, The layer normalization shift initial value. If - `layer_norm` has been set to `False`, this argument will be ignored. -* `dropout_keep_prob`: unit Tensor or float between 0 and 1 representing the - recurrent dropout probability value. If float and 1.0, no dropout will - be applied. -* `dropout_prob_seed`: (optional) integer, the randomness seed. - - -- - - - -#### `tf.contrib.rnn.LayerNormBasicLSTMCell.output_size` {#LayerNormBasicLSTMCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.LayerNormBasicLSTMCell.state_size` {#LayerNormBasicLSTMCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.LayerNormBasicLSTMCell.zero_state(batch_size, dtype)` {#LayerNormBasicLSTMCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.util.make_tensor_proto.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.util.make_tensor_proto.md deleted file mode 100644 index 0f6470c317..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.contrib.util.make_tensor_proto.md +++ /dev/null @@ -1,46 +0,0 @@ -### `tf.contrib.util.make_tensor_proto(values, dtype=None, shape=None, verify_shape=False)` {#make_tensor_proto} - -Create a TensorProto. - -##### Args: - - -* `values`: Values to put in the TensorProto. -* `dtype`: Optional tensor_pb2 DataType value. -* `shape`: List of integers representing the dimensions of tensor. -* `verify_shape`: Boolean that enables verification of a shape of values. - -##### Returns: - - A TensorProto. Depending on the type, it may contain data in the - "tensor_content" attribute, which is not directly useful to Python programs. - To access the values you should convert the proto back to a numpy ndarray - with tensor_util.MakeNdarray(proto). - -##### Raises: - - -* `TypeError`: if unsupported types are provided. -* `ValueError`: if arguments have inappropriate values or if verify_shape is - True and shape of values is not equals to a shape from the argument. - -make_tensor_proto accepts "values" of a python scalar, a python list, a -numpy ndarray, or a numpy scalar. - -If "values" is a python scalar or a python list, make_tensor_proto -first convert it to numpy ndarray. If dtype is None, the -conversion tries its best to infer the right numpy data -type. Otherwise, the resulting numpy array has a compatible data -type with the given dtype. - -In either case above, the numpy ndarray (either the caller provided -or the auto converted) must have the compatible type with dtype. - -make_tensor_proto then converts the numpy array to a tensor proto. - -If "shape" is None, the resulting tensor proto represents the numpy -array precisely. - -Otherwise, "shape" specifies the tensor's shape and the numpy array -can not have more elements than what "shape" specifies. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.cumsum.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.cumsum.md deleted file mode 100644 index baa00e57d5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.cumsum.md +++ /dev/null @@ -1,42 +0,0 @@ -### `tf.cumsum(x, axis=0, exclusive=False, reverse=False, name=None)` {#cumsum} - -Compute the cumulative sum of the tensor `x` along `axis`. - -By default, this op performs an inclusive cumsum, which means that the first -element of the input is identical to the first element of the output: -```prettyprint -tf.cumsum([a, b, c]) ==> [a, a + b, a + b + c] -``` - -By setting the `exclusive` kwarg to `True`, an exclusive cumsum is performed -instead: -```prettyprint -tf.cumsum([a, b, c], exclusive=True) ==> [0, a, a + b] -``` - -By setting the `reverse` kwarg to `True`, the cumsum is performed in the -opposite direction: -```prettyprint -tf.cumsum([a, b, c], reverse=True) ==> [a + b + c, b + c, c] -``` -This is more efficient than using separate `tf.reverse` ops. - -The `reverse` and `exclusive` kwargs can also be combined: -```prettyprint -tf.cumsum([a, b, c], exclusive=True, reverse=True) ==> [b + c, c, 0] -``` - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, - `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, - `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `axis`: A `Tensor` of type `int32` (default: 0). -* `reverse`: A `bool` (default: False). -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.decode_json_example.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.decode_json_example.md deleted file mode 100644 index bf5184c40a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.decode_json_example.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.decode_json_example(json_examples, name=None)` {#decode_json_example} - -Convert JSON-encoded Example records to binary protocol buffer strings. - -This op translates a tensor containing Example records, encoded using -the [standard JSON -mapping](https://developers.google.com/protocol-buffers/docs/proto3#json), -into a tensor containing the same records encoded as binary protocol -buffers. The resulting tensor can then be fed to any of the other -Example-parsing ops. - -##### Args: - - -* `json_examples`: A `Tensor` of type `string`. - Each string is a JSON object serialized according to the JSON - mapping of the Example proto. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. - Each string is a binary Example protocol buffer corresponding - to the respective element of `json_examples`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.dequantize.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.dequantize.md deleted file mode 100644 index edf0de7a04..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.dequantize.md +++ /dev/null @@ -1,52 +0,0 @@ -### `tf.dequantize(input, min_range, max_range, mode=None, name=None)` {#dequantize} - -Dequantize the 'input' tensor into a float Tensor. - -[min_range, max_range] are scalar floats that specify the range for -the 'input' data. The 'mode' attribute controls exactly which calculations are -used to convert the float values to their quantized equivalents. - -In 'MIN_COMBINED' mode, each value of the tensor will undergo the following: - -``` -if T == qint8, in[i] += (range(T) + 1)/ 2.0 -out[i] = min_range + (in[i]* (max_range - min_range) / range(T)) -``` -here `range(T) = numeric_limits::max() - numeric_limits::min()` - -*MIN_COMBINED Mode Example* - -If the input comes from a QuantizedRelu6, the output type is -quint8 (range of 0-255) but the possible range of QuantizedRelu6 is -0-6. The min_range and max_range values are therefore 0.0 and 6.0. -Dequantize on quint8 will take each value, cast to float, and multiply -by 6 / 255. -Note that if quantizedtype is qint8, the operation will additionally add -each value by 128 prior to casting. - -If the mode is 'MIN_FIRST', then this approach is used: - -``` -number_of_steps = 1 << (# of bits in T) -range_adjust = number_of_steps / (number_of_steps - 1) -range = (range_max - range_min) * range_adjust -range_scale = range / number_of_steps -const double offset_input = static_cast(input) - lowest_quantized; -result = range_min + ((input - numeric_limits::min()) * range_scale) -``` - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `qint8`, `quint8`, `qint16`, `quint16`, `qint32`. -* `min_range`: A `Tensor` of type `float32`. - The minimum scalar value possibly produced for the input. -* `max_range`: A `Tensor` of type `float32`. - The maximum scalar value possibly produced for the input. -* `mode`: An optional `string` from: `"MIN_COMBINED", "MIN_FIRST"`. Defaults to `"MIN_COMBINED"`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.dynamic_partition.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.dynamic_partition.md deleted file mode 100644 index e24bc8c39e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.dynamic_partition.md +++ /dev/null @@ -1,54 +0,0 @@ -### `tf.dynamic_partition(data, partitions, num_partitions, name=None)` {#dynamic_partition} - -Partitions `data` into `num_partitions` tensors using indices from `partitions`. - -For each index tuple `js` of size `partitions.ndim`, the slice `data[js, ...]` -becomes part of `outputs[partitions[js]]`. The slices with `partitions[js] = i` -are placed in `outputs[i]` in lexicographic order of `js`, and the first -dimension of `outputs[i]` is the number of entries in `partitions` equal to `i`. -In detail, - -```python - outputs[i].shape = [sum(partitions == i)] + data.shape[partitions.ndim:] - - outputs[i] = pack([data[js, ...] for js if partitions[js] == i]) -``` - -`data.shape` must start with `partitions.shape`. - -For example: - -```python - # Scalar partitions. - partitions = 1 - num_partitions = 2 - data = [10, 20] - outputs[0] = [] # Empty with shape [0, 2] - outputs[1] = [[10, 20]] - - # Vector partitions. - partitions = [0, 0, 1, 1, 0] - num_partitions = 2 - data = [10, 20, 30, 40, 50] - outputs[0] = [10, 20, 50] - outputs[1] = [30, 40] -``` - -
- -
- -##### Args: - - -* `data`: A `Tensor`. -* `partitions`: A `Tensor` of type `int32`. - Any shape. Indices in the range `[0, num_partitions)`. -* `num_partitions`: An `int` that is `>= 1`. - The number of partitions to output. -* `name`: A name for the operation (optional). - -##### Returns: - - A list of `num_partitions` `Tensor` objects of the same type as data. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.erfc.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.erfc.md deleted file mode 100644 index 62c13418f7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.erfc.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.erfc(x, name=None)` {#erfc} - -Computes the complementary error function of `x` element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.AbortedError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.AbortedError.md deleted file mode 100644 index f2bc775dcb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.AbortedError.md +++ /dev/null @@ -1,15 +0,0 @@ -The operation was aborted, typically due to a concurrent action. - -For example, running a -[`queue.enqueue()`](../../api_docs/python/io_ops.md#QueueBase.enqueue) -operation may raise `AbortedError` if a -[`queue.close()`](../../api_docs/python/io_ops.md#QueueBase.close) operation -previously ran. - -- - - - -#### `tf.errors.AbortedError.__init__(node_def, op, message)` {#AbortedError.__init__} - -Creates an `AbortedError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.InternalError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.InternalError.md deleted file mode 100644 index dd229d2a3d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.InternalError.md +++ /dev/null @@ -1,12 +0,0 @@ -Raised when the system experiences an internal error. - -This exception is raised when some invariant expected by the runtime -has been broken. Catching this exception is not recommended. - -- - - - -#### `tf.errors.InternalError.__init__(node_def, op, message)` {#InternalError.__init__} - -Creates an `InternalError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.NotFoundError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.NotFoundError.md deleted file mode 100644 index 49fec3c55c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.NotFoundError.md +++ /dev/null @@ -1,14 +0,0 @@ -Raised when a requested entity (e.g., a file or directory) was not found. - -For example, running the -[`tf.WholeFileReader.read()`](../../api_docs/python/io_ops.md#WholeFileReader) -operation could raise `NotFoundError` if it receives the name of a file that -does not exist. - -- - - - -#### `tf.errors.NotFoundError.__init__(node_def, op, message)` {#NotFoundError.__init__} - -Creates a `NotFoundError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.UnimplementedError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.UnimplementedError.md deleted file mode 100644 index 945daa1a22..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.errors.UnimplementedError.md +++ /dev/null @@ -1,15 +0,0 @@ -Raised when an operation has not been implemented. - -Some operations may raise this error when passed otherwise-valid -arguments that it does not currently support. For example, running -the [`tf.nn.max_pool()`](../../api_docs/python/nn.md#max_pool) operation -would raise this error if pooling was requested on the batch dimension, -because this is not yet supported. - -- - - - -#### `tf.errors.UnimplementedError.__init__(node_def, op, message)` {#UnimplementedError.__init__} - -Creates an `UnimplementedError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.fake_quant_with_min_max_args.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.fake_quant_with_min_max_args.md deleted file mode 100644 index fcad8cb500..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.fake_quant_with_min_max_args.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.fake_quant_with_min_max_args(inputs, min=None, max=None, name=None)` {#fake_quant_with_min_max_args} - -Fake-quantize the 'inputs' tensor, type float to 'outputs' tensor of same type. - -Attributes [min; max] define the clamping range for the 'inputs' data. Op -divides this range into 255 steps (total of 256 values), then replaces each -'inputs' value with the closest of the quantized step values. - -Quantization is called fake since the output is still in floating point. - -##### Args: - - -* `inputs`: A `Tensor` of type `float32`. -* `min`: An optional `float`. Defaults to `-6`. -* `max`: An optional `float`. Defaults to `6`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.igamma.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.igamma.md deleted file mode 100644 index 92b5fbe851..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.igamma.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.igamma(a, x, name=None)` {#igamma} - -Compute the lower regularized incomplete Gamma function `Q(a, x)`. - -The lower regularized incomplete Gamma function is defined as: - -``` -P(a, x) = gamma(a, x) / Gamma(a) = 1 - Q(a, x) -``` -where -``` -gamma(a, x) = int_{0}^{x} t^{a-1} exp(-t) dt -``` -is the lower incomplete Gamma function. - -Note, above `Q(a, x)` (`Igammac`) is the upper regularized complete -Gamma function. - -##### Args: - - -* `a`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `x`: A `Tensor`. Must have the same type as `a`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `a`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.image.decode_gif.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.image.decode_gif.md deleted file mode 100644 index 45e7ab9d22..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.image.decode_gif.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.image.decode_gif(contents, name=None)` {#decode_gif} - -Decode the first frame of a GIF-encoded image to a uint8 tensor. - -GIF with frame or transparency compression are not supported -convert animated GIF from compressed to uncompressed by: - -convert $src.gif -coalesce $dst.gif - -##### Args: - - -* `contents`: A `Tensor` of type `string`. 0-D. The GIF-encoded image. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `uint8`. - 4-D with shape `[num_frames, height, width, 3]`. RGB order - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.image.extract_glimpse.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.image.extract_glimpse.md deleted file mode 100644 index 83482124e7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.image.extract_glimpse.md +++ /dev/null @@ -1,56 +0,0 @@ -### `tf.image.extract_glimpse(input, size, offsets, centered=None, normalized=None, uniform_noise=None, name=None)` {#extract_glimpse} - -Extracts a glimpse from the input tensor. - -Returns a set of windows called glimpses extracted at location -`offsets` from the input tensor. If the windows only partially -overlaps the inputs, the non overlapping areas will be filled with -random noise. - -The result is a 4-D tensor of shape `[batch_size, glimpse_height, -glimpse_width, channels]`. The channels and batch dimensions are the -same as that of the input tensor. The height and width of the output -windows are specified in the `size` parameter. - -The argument `normalized` and `centered` controls how the windows are built: - -* If the coordinates are normalized but not centered, 0.0 and 1.0 - correspond to the minimum and maximum of each height and width - dimension. -* If the coordinates are both normalized and centered, they range from - -1.0 to 1.0. The coordinates (-1.0, -1.0) correspond to the upper - left corner, the lower right corner is located at (1.0, 1.0) and the - center is at (0, 0). -* If the coordinates are not normalized they are interpreted as - numbers of pixels. - -##### Args: - - -* `input`: A `Tensor` of type `float32`. - A 4-D float tensor of shape `[batch_size, height, width, channels]`. -* `size`: A `Tensor` of type `int32`. - A 1-D tensor of 2 elements containing the size of the glimpses - to extract. The glimpse height must be specified first, following - by the glimpse width. -* `offsets`: A `Tensor` of type `float32`. - A 2-D integer tensor of shape `[batch_size, 2]` containing - the x, y locations of the center of each window. -* `centered`: An optional `bool`. Defaults to `True`. - indicates if the offset coordinates are centered relative to - the image, in which case the (0, 0) offset is relative to the center - of the input images. If false, the (0,0) offset corresponds to the - upper left corner of the input images. -* `normalized`: An optional `bool`. Defaults to `True`. - indicates if the offset coordinates are normalized. -* `uniform_noise`: An optional `bool`. Defaults to `True`. - indicates if the noise should be generated using a - uniform distribution or a Gaussian distribution. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. - A tensor representing the glimpses `[batch_size, - glimpse_height, glimpse_width, channels]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.image.rgb_to_hsv.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.image.rgb_to_hsv.md deleted file mode 100644 index c08a086b88..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.image.rgb_to_hsv.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.image.rgb_to_hsv(images, name=None)` {#rgb_to_hsv} - -Converts one or more images from RGB to HSV. - -Outputs a tensor of the same shape as the `images` tensor, containing the HSV -value of the pixels. The output is only well defined if the value in `images` -are in `[0,1]`. - -`output[..., 0]` contains hue, `output[..., 1]` contains saturation, and -`output[..., 2]` contains value. All HSV values are in `[0,1]`. A hue of 0 -corresponds to pure red, hue 1/3 is pure green, and 2/3 is pure blue. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `float32`, `float64`. - 1-D or higher rank. RGB data to convert. Last dimension must be size 3. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `images`. `images` converted to HSV. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.import_graph_def.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.import_graph_def.md deleted file mode 100644 index 6afe7e1fc5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.import_graph_def.md +++ /dev/null @@ -1,50 +0,0 @@ -### `tf.import_graph_def(graph_def, input_map=None, return_elements=None, name=None, op_dict=None, producer_op_list=None)` {#import_graph_def} - -Imports the graph from `graph_def` into the current default `Graph`. - -This function provides a way to import a serialized TensorFlow -[`GraphDef`](https://www.tensorflow.org/code/tensorflow/core/framework/graph.proto) -protocol buffer, and extract individual objects in the `GraphDef` as -[`Tensor`](#Tensor) and [`Operation`](#Operation) objects. Once extracted, -these objects are placed into the current default `Graph`. See -[`Graph.as_graph_def()`](#Graph.as_graph_def) for a way to create a `GraphDef` -proto. - -##### Args: - - -* `graph_def`: A `GraphDef` proto containing operations to be imported into - the default graph. -* `input_map`: A dictionary mapping input names (as strings) in `graph_def` - to `Tensor` objects. The values of the named input tensors in the - imported graph will be re-mapped to the respective `Tensor` values. -* `return_elements`: A list of strings containing operation names in - `graph_def` that will be returned as `Operation` objects; and/or - tensor names in `graph_def` that will be returned as `Tensor` objects. -* `name`: (Optional.) A prefix that will be prepended to the names in - `graph_def`. Defaults to `"import"`. -* `op_dict`: (Optional.) A dictionary mapping op type names to `OpDef` protos. - Must contain an `OpDef` proto for each op type named in `graph_def`. - If omitted, uses the `OpDef` protos registered in the global registry. -* `producer_op_list`: (Optional.) An `OpList` proto with the (possibly stripped) - list of `OpDef`s used by the producer of the graph. If provided, attrs - for ops in `graph_def` that are not in `op_dict` that have their default - value according to `producer_op_list` will be removed. This will allow - some more `GraphDef`s produced by later binaries to be accepted by - earlier binaries. - -##### Returns: - - A list of `Operation` and/or `Tensor` objects from the imported graph, - corresponding to the names in `return_elements`. - -##### Raises: - - -* `TypeError`: If `graph_def` is not a `GraphDef` proto, - `input_map` is not a dictionary mapping strings to `Tensor` objects, - or `return_elements` is not a list of strings. -* `ValueError`: If `input_map`, or `return_elements` contains names that - do not appear in `graph_def`, or `graph_def` is not well-formed (e.g. - it refers to an unknown tensor). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.initialize_all_tables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.initialize_all_tables.md deleted file mode 100644 index 4309820b84..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.initialize_all_tables.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.initialize_all_tables(*args, **kwargs)` {#initialize_all_tables} - -Returns an Op that initializes all tables of the default graph. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-02. -Instructions for updating: -Use `tf.tables_initializer` instead. - -##### Args: - - -* `name`: Optional name for the initialization op. - -##### Returns: - - An Op that initializes all tables. Note that if there are - not tables the returned Op is a NoOp. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.load_op_library.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.load_op_library.md deleted file mode 100644 index 4d6c027482..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.load_op_library.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.load_op_library(library_filename)` {#load_op_library} - -Loads a TensorFlow plugin, containing custom ops and kernels. - -Pass "library_filename" to a platform-specific mechanism for dynamically -loading a library. The rules for determining the exact location of the -library are platform-specific and are not documented here. When the -library is loaded, ops and kernels registered in the library via the -`REGISTER_*` macros are made available in the TensorFlow process. Note -that ops with the same name as an existing op are rejected and not -registered with the process. - -##### Args: - - -* `library_filename`: Path to the plugin. - Relative or absolute filesystem path to a dynamic library file. - -##### Returns: - - A python module containing the Python wrappers for Ops defined in - the plugin. - -##### Raises: - - -* `RuntimeError`: when unable to load the library or get the python wrappers. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.maximum.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.maximum.md deleted file mode 100644 index aec816dcba..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.maximum.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.maximum(x, y, name=None)` {#maximum} - -Returns the max of x and y (i.e. x > y ? x : y) element-wise. - -*NOTE*: `Maximum` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.min_max_variable_partitioner.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.min_max_variable_partitioner.md deleted file mode 100644 index c301044187..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.min_max_variable_partitioner.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.min_max_variable_partitioner(max_partitions=1, axis=0, min_slice_size=262144, bytes_per_string_element=16)` {#min_max_variable_partitioner} - -Partitioner to allocate minimum size per slice. - -Returns a partitioner that partitions the variable of given shape and dtype -such that each partition has a minimum of `min_slice_size` slice of the -variable. The maximum number of such partitions (upper bound) is given by -`max_partitions`. - -##### Args: - - -* `max_partitions`: Upper bound on the number of partitions. Defaults to 1. -* `axis`: Axis along which to partition the variable. Defaults to 0. -* `min_slice_size`: Minimum size of the variable slice per partition. Defaults - to 256K. -* `bytes_per_string_element`: If the `Variable` is of type string, this provides - an estimate of how large each scalar in the `Variable` is. - -##### Returns: - - A partition function usable as the `partitioner` argument to - `variable_scope`, `get_variable`, and `get_partitioned_variable_list`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.moving_average_variables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.moving_average_variables.md deleted file mode 100644 index 467a666e2c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.moving_average_variables.md +++ /dev/null @@ -1,13 +0,0 @@ -### `tf.moving_average_variables()` {#moving_average_variables} - -Returns all variables that maintain their moving averages. - -If an `ExponentialMovingAverage` object is created and the `apply()` -method is called on a list of variables, these variables will -be added to the `GraphKeys.MOVING_AVERAGE_VARIABLES` collection. -This convenience function returns the contents of that collection. - -##### Returns: - - A list of Variable objects. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.multiply.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.multiply.md deleted file mode 100644 index f1647ee45b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.multiply.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.multiply(x, y, name=None)` {#multiply} - -Returns x * y element-wise. - -*NOTE*: ``tf.multiply`` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `uint16`, `int16`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.batch_norm_with_global_normalization.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.batch_norm_with_global_normalization.md deleted file mode 100644 index a95bd71a04..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.batch_norm_with_global_normalization.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.nn.batch_norm_with_global_normalization(t, m, v, beta, gamma, variance_epsilon, scale_after_normalization, name=None)` {#batch_norm_with_global_normalization} - -Batch normalization. - -This op is deprecated. See `tf.nn.batch_normalization`. - -##### Args: - - -* `t`: A 4D input Tensor. -* `m`: A 1D mean Tensor with size matching the last dimension of t. - This is the first output from tf.nn.moments, - or a saved moving average thereof. -* `v`: A 1D variance Tensor with size matching the last dimension of t. - This is the second output from tf.nn.moments, - or a saved moving average thereof. -* `beta`: A 1D beta Tensor with size matching the last dimension of t. - An offset to be added to the normalized tensor. -* `gamma`: A 1D gamma Tensor with size matching the last dimension of t. - If "scale_after_normalization" is true, this tensor will be multiplied - with the normalized tensor. -* `variance_epsilon`: A small float number to avoid dividing by 0. -* `scale_after_normalization`: A bool indicating whether the resulted tensor - needs to be multiplied with gamma. -* `name`: A name for this operation (optional). - -##### Returns: - - A batch-normalized `t`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.ctc_greedy_decoder.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.ctc_greedy_decoder.md deleted file mode 100644 index 1435f8cb5e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.ctc_greedy_decoder.md +++ /dev/null @@ -1,40 +0,0 @@ -### `tf.nn.ctc_greedy_decoder(inputs, sequence_length, merge_repeated=True)` {#ctc_greedy_decoder} - -Performs greedy decoding on the logits given in input (best path). - -Note: Regardless of the value of merge_repeated, if the maximum index of a -given time and batch corresponds to the blank index `(num_classes - 1)`, no -new element is emitted. - -If `merge_repeated` is `True`, merge repeated classes in output. -This means that if consecutive logits' maximum indices are the same, -only the first of these is emitted. The sequence `A B B * B * B` (where '*' -is the blank label) becomes - - * `A B B B` if `merge_repeated=True`. - * `A B B B B` if `merge_repeated=False`. - -##### Args: - - -* `inputs`: 3-D `float` `Tensor` sized - `[max_time x batch_size x num_classes]`. The logits. -* `sequence_length`: 1-D `int32` vector containing sequence lengths, - having size `[batch_size]`. -* `merge_repeated`: Boolean. Default: True. - -##### Returns: - - A tuple `(decoded, log_probabilities)` where - -* `decoded`: A single-element list. `decoded[0]` - is an `SparseTensor` containing the decoded outputs s.t.: - `decoded.indices`: Indices matrix `(total_decoded_outputs x 2)`. - The rows store: `[batch, time]`. - `decoded.values`: Values vector, size `(total_decoded_outputs)`. - The vector stores the decoded classes. - `decoded.shape`: Shape vector, size `(2)`. - The shape values are: `[batch_size, max_decoded_length]` -* `log_probability`: A `float` matrix `(batch_size x 1)` containing sequence - log-probabilities. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.depthwise_conv2d_native_backprop_filter.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.depthwise_conv2d_native_backprop_filter.md deleted file mode 100644 index 5096756d7c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.depthwise_conv2d_native_backprop_filter.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.nn.depthwise_conv2d_native_backprop_filter(input, filter_sizes, out_backprop, strides, padding, name=None)` {#depthwise_conv2d_native_backprop_filter} - -Computes the gradients of depthwise convolution with respect to the filter. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`. - 4-D with shape `[batch, in_height, in_width, in_channels]`. -* `filter_sizes`: A `Tensor` of type `int32`. - An integer vector representing the tensor shape of `filter`, - where `filter` is a 4-D - `[filter_height, filter_width, in_channels, depthwise_multiplier]` tensor. -* `out_backprop`: A `Tensor`. Must have the same type as `input`. - 4-D with shape `[batch, out_height, out_width, out_channels]`. - Gradients w.r.t. the output of the convolution. -* `strides`: A list of `ints`. - The stride of the sliding window for each dimension of the input - of the convolution. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. 4-D with shape - `[filter_height, filter_width, in_channels, out_channels]`. Gradient w.r.t. - the `filter` input of the convolution. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.elu.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.elu.md deleted file mode 100644 index 8ffeeca65c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.elu.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.nn.elu(features, name=None)` {#elu} - -Computes exponential linear: `exp(features) - 1` if < 0, `features` otherwise. - -See [Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs) -](http://arxiv.org/abs/1511.07289) - -##### Args: - - -* `features`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `features`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.separable_conv2d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.separable_conv2d.md deleted file mode 100644 index 24e2688831..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.separable_conv2d.md +++ /dev/null @@ -1,54 +0,0 @@ -### `tf.nn.separable_conv2d(input, depthwise_filter, pointwise_filter, strides, padding, rate=None, name=None)` {#separable_conv2d} - -2-D convolution with separable filters. - -Performs a depthwise convolution that acts separately on channels followed by -a pointwise convolution that mixes channels. Note that this is separability -between dimensions `[1, 2]` and `3`, not spatial separability between -dimensions `1` and `2`. - -In detail, - - output[b, i, j, k] = sum_{di, dj, q, r] - input[b, strides[1] * i + di, strides[2] * j + dj, q] * - depthwise_filter[di, dj, q, r] * - pointwise_filter[0, 0, q * channel_multiplier + r, k] - -`strides` controls the strides for the depthwise convolution only, since -the pointwise convolution has implicit strides of `[1, 1, 1, 1]`. Must have -`strides[0] = strides[3] = 1`. For the most common case of the same -horizontal and vertical strides, `strides = [1, stride, stride, 1]`. -If any value in `rate` is greater than 1, we perform atrous depthwise -convolution, in which case all values in the `strides` tensor must be equal -to 1. - -##### Args: - - -* `input`: 4-D `Tensor` with shape `[batch, in_height, in_width, in_channels]`. -* `depthwise_filter`: 4-D `Tensor` with shape - `[filter_height, filter_width, in_channels, channel_multiplier]`. - Contains `in_channels` convolutional filters of depth 1. -* `pointwise_filter`: 4-D `Tensor` with shape - `[1, 1, channel_multiplier * in_channels, out_channels]`. Pointwise - filter to mix channels after `depthwise_filter` has convolved spatially. -* `strides`: 1-D of size 4. The strides for the depthwise convolution for - each dimension of `input`. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. - See the [comment - here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `rate`: 1-D of size 2. The dilation rate in which we sample input values - across the `height` and `width` dimensions in atrous convolution. If it is - greater than 1, then all values of strides must be 1. -* `name`: A name for this operation (optional). - -##### Returns: - - A 4-D `Tensor` of shape `[batch, out_height, out_width, out_channels]`. - -##### Raises: - - -* `ValueError`: If channel_multiplier * in_channels > out_channels, - which means that the separable convolution is overparameterized. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.softmax.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.softmax.md deleted file mode 100644 index 65da6889d9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.softmax.md +++ /dev/null @@ -1,27 +0,0 @@ -### `tf.nn.softmax(logits, dim=-1, name=None)` {#softmax} - -Computes softmax activations. - -For each batch `i` and class `j` we have - - softmax = exp(logits) / reduce_sum(exp(logits), dim) - -##### Args: - - -* `logits`: A non-empty `Tensor`. Must be one of the following types: `half`, - `float32`, `float64`. -* `dim`: The dimension softmax would be performed on. The default is -1 which - indicates the last dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `logits`. Same shape as `logits`. - -##### Raises: - - -* `InvalidArgumentError`: if `logits` is empty or `dim` is beyond the last - dimension of `logits`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.with_space_to_batch.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.with_space_to_batch.md deleted file mode 100644 index ced972a78d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.nn.with_space_to_batch.md +++ /dev/null @@ -1,133 +0,0 @@ -### `tf.nn.with_space_to_batch(input, dilation_rate, padding, op, filter_shape=None, spatial_dims=None)` {#with_space_to_batch} - -Performs `op` on the space-to-batch representation of `input`. - -This has the effect of transforming sliding window operations into the -corresponding "atrous" operation in which the input is sampled at the -specified `dilation_rate`. - -In the special case that `dilation_rate` is uniformly 1, this simply returns: - - op(input, num_spatial_dims, padding) - -Otherwise, it returns: - - batch_to_space_nd( - op(space_to_batch_nd(input, adjusted_dilation_rate, adjusted_paddings), - num_spatial_dims, - "VALID") - adjusted_dilation_rate, - adjusted_crops), - -where: - - adjusted_dilation_rate is an int64 tensor of shape [max(spatial_dims)], - adjusted_{paddings,crops} are int64 tensors of shape [max(spatial_dims), 2] - -defined as follows: - -We first define two int64 tensors `paddings` and `crops` of shape -`[num_spatial_dims, 2]` based on the value of `padding` and the spatial -dimensions of the `input`: - -If `padding = "VALID"`, then: - - paddings, crops = required_space_to_batch_paddings( - input_shape[spatial_dims], - dilation_rate) - -If `padding = "SAME"`, then: - - dilated_filter_shape = - filter_shape + (filter_shape - 1) * (dilation_rate - 1) - - paddings, crops = required_space_to_batch_paddings( - input_shape[spatial_dims], - dilation_rate, - [(dilated_filter_shape - 1) // 2, - dilated_filter_shape - 1 - (dilated_filter_shape - 1) // 2]) - -Because `space_to_batch_nd` and `batch_to_space_nd` assume that the spatial -dimensions are contiguous starting at the second dimension, but the specified -`spatial_dims` may not be, we must adjust `dilation_rate`, `paddings` and -`crops` in order to be usable with these operations. For a given dimension, -if the block size is 1, and both the starting and ending padding and crop -amounts are 0, then space_to_batch_nd effectively leaves that dimension alone, -which is what is needed for dimensions not part of `spatial_dims`. -Furthermore, `space_to_batch_nd` and `batch_to_space_nd` handle this case -efficiently for any number of leading and trailing dimensions. - -For 0 <= i < len(spatial_dims), we assign: - - adjusted_dilation_rate[spatial_dims[i] - 1] = dilation_rate[i] - adjusted_paddings[spatial_dims[i] - 1, :] = paddings[i, :] - adjusted_crops[spatial_dims[i] - 1, :] = crops[i, :] - -All unassigned values of `adjusted_dilation_rate` default to 1, while all -unassigned values of `adjusted_paddings` and `adjusted_crops` default to 0. - -Note in the case that `dilation_rate` is not uniformly 1, specifying "VALID" -padding is equivalent to specifying `padding = "SAME"` with a filter_shape of -`[1]*N`. - -Advanced usage. Note the following optimization: A sequence of -`with_space_to_batch` operations with identical (not uniformly 1) -`dilation_rate` parameters and "VALID" padding - - net = with_space_to_batch(net, dilation_rate, "VALID", op_1) - ... - net = with_space_to_batch(net, dilation_rate, "VALID", op_k) - -can be combined into a single `with_space_to_batch` operation as follows: - - def combined_op(converted_input, num_spatial_dims, _): - result = op_1(converted_input, num_spatial_dims, "VALID") - ... - result = op_k(result, num_spatial_dims, "VALID") - - net = with_space_to_batch(net, dilation_rate, "VALID", combined_op) - -This eliminates the overhead of `k-1` calls to `space_to_batch_nd` and -`batch_to_space_nd`. - -Similarly, a sequence of `with_space_to_batch` operations with identical (not -uniformly 1) `dilation_rate` parameters, "SAME" padding, and odd filter -dimensions - - net = with_space_to_batch(net, dilation_rate, "SAME", op_1, filter_shape_1) - ... - net = with_space_to_batch(net, dilation_rate, "SAME", op_k, filter_shape_k) - -can be combined into a single `with_space_to_batch` operation as follows: - - def combined_op(converted_input, num_spatial_dims, _): - result = op_1(converted_input, num_spatial_dims, "SAME") - ... - result = op_k(result, num_spatial_dims, "SAME") - - net = with_space_to_batch(net, dilation_rate, "VALID", combined_op) - -##### Args: - - -* `input`: Tensor of rank > max(spatial_dims). -* `dilation_rate`: int32 Tensor of *known* shape [num_spatial_dims]. -* `padding`: str constant equal to "VALID" or "SAME" -* `op`: Function that maps (input, num_spatial_dims, padding) -> output -* `filter_shape`: If padding = "SAME", specifies the shape of the convolution - kernel/pooling window as an integer Tensor of shape [>=num_spatial_dims]. - If padding = "VALID", filter_shape is ignored and need not be specified. -* `spatial_dims`: Monotonically increasing sequence of `num_spatial_dims` - integers (which are >= 1) specifying the spatial dimensions of `input` - and output. Defaults to: `range(1, num_spatial_dims+1)`. - -##### Returns: - - The output Tensor as described above. - -##### Raises: - - -* `ValueError`: if `padding` is invalid or the arguments are incompatible. -* `ValueError`: if `spatial_dims` are invalid. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.one_hot.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.one_hot.md deleted file mode 100644 index 7fe09d8cd0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.one_hot.md +++ /dev/null @@ -1,131 +0,0 @@ -### `tf.one_hot(indices, depth, on_value=None, off_value=None, axis=None, dtype=None, name=None)` {#one_hot} - -Returns a one-hot tensor. - -The locations represented by indices in `indices` take value `on_value`, -while all other locations take value `off_value`. - -`on_value` and `off_value` must have matching data types. If `dtype` is also -provided, they must be the same data type as specified by `dtype`. - -If `on_value` is not provided, it will default to the value `1` with type -`dtype` - -If `off_value` is not provided, it will default to the value `0` with type -`dtype` - -If the input `indices` is rank `N`, the output will have rank `N+1`. The -new axis is created at dimension `axis` (default: the new axis is appended -at the end). - -If `indices` is a scalar the output shape will be a vector of length `depth` - -If `indices` is a vector of length `features`, the output shape will be: - -``` - features x depth if axis == -1 - depth x features if axis == 0 -``` - -If `indices` is a matrix (batch) with shape `[batch, features]`, the output -shape will be: - -``` - batch x features x depth if axis == -1 - batch x depth x features if axis == 1 - depth x batch x features if axis == 0 -``` - -If `dtype` is not provided, it will attempt to assume the data type of -`on_value` or `off_value`, if one or both are passed in. If none of -`on_value`, `off_value`, or `dtype` are provided, `dtype` will default to the -value `tf.float32`. - -Note: If a non-numeric data type output is desired (`tf.string`, `tf.bool`, -etc.), both `on_value` and `off_value` _must_ be provided to `one_hot`. - -Examples -========= - -Suppose that - -```python - indices = [0, 2, -1, 1] - depth = 3 - on_value = 5.0 - off_value = 0.0 - axis = -1 -``` - -Then output is `[4 x 3]`: - -```python - output = - [5.0 0.0 0.0] // one_hot(0) - [0.0 0.0 5.0] // one_hot(2) - [0.0 0.0 0.0] // one_hot(-1) - [0.0 5.0 0.0] // one_hot(1) -``` - -Suppose that - -```python - indices = [[0, 2], [1, -1]] - depth = 3 - on_value = 1.0 - off_value = 0.0 - axis = -1 -``` - -Then output is `[2 x 2 x 3]`: - -```python - output = - [ - [1.0, 0.0, 0.0] // one_hot(0) - [0.0, 0.0, 1.0] // one_hot(2) - ][ - [0.0, 1.0, 0.0] // one_hot(1) - [0.0, 0.0, 0.0] // one_hot(-1) - ] -``` - -Using default values for `on_value` and `off_value`: - -```python - indices = [0, 1, 2] - depth = 3 -``` - -The output will be - -```python - output = - [[1., 0., 0.], - [0., 1., 0.], - [0., 0., 1.]] -``` - -##### Args: - - -* `indices`: A `Tensor` of indices. -* `depth`: A scalar defining the depth of the one hot dimension. -* `on_value`: A scalar defining the value to fill in output when `indices[j] - = i`. (default: 1) -* `off_value`: A scalar defining the value to fill in output when `indices[j] - != i`. (default: 0) -* `axis`: The axis to fill (default: -1, a new inner-most axis). -* `dtype`: The data type of the output tensor. - -##### Returns: - - -* `output`: The one-hot tensor. - -##### Raises: - - -* `TypeError`: If dtype of either `on_value` or `off_value` don't match `dtype` -* `TypeError`: If dtype of `on_value` and `off_value` don't match one another - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.op_scope.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.op_scope.md deleted file mode 100644 index 0aaac5e657..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.op_scope.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.op_scope(values, name, default_name=None)` {#op_scope} - -DEPRECATED. Same as name_scope above, just different argument order. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.parse_example.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.parse_example.md deleted file mode 100644 index 3616124c18..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.parse_example.md +++ /dev/null @@ -1,197 +0,0 @@ -### `tf.parse_example(serialized, features, name=None, example_names=None)` {#parse_example} - -Parses `Example` protos into a `dict` of tensors. - -Parses a number of serialized [`Example`](https://www.tensorflow.org/code/tensorflow/core/example/example.proto) -protos given in `serialized`. - -`example_names` may contain descriptive names for the corresponding serialized -protos. These may be useful for debugging purposes, but they have no effect on -the output. If not `None`, `example_names` must be the same length as -`serialized`. - -This op parses serialized examples into a dictionary mapping keys to `Tensor` -and `SparseTensor` objects. `features` is a dict from keys to `VarLenFeature`, -`SparseFeature`, and `FixedLenFeature` objects. Each `VarLenFeature` -and `SparseFeature` is mapped to a `SparseTensor`, and each -`FixedLenFeature` is mapped to a `Tensor`. - -Each `VarLenFeature` maps to a `SparseTensor` of the specified type -representing a ragged matrix. Its indices are `[batch, index]` where `batch` -is the batch entry the value is from in `serialized`, and `index` is the -value's index in the list of values associated with that feature and example. - -Each `SparseFeature` maps to a `SparseTensor` of the specified type -representing a sparse matrix of shape -`(serialized.size(), SparseFeature.size)`. Its indices are `[batch, index]` -where `batch` is the batch entry the value is from in `serialized`, and -`index` is the value's index is given by the values in the -`SparseFeature.index_key` feature column. - -Each `FixedLenFeature` `df` maps to a `Tensor` of the specified type (or -`tf.float32` if not specified) and shape `(serialized.size(),) + df.shape`. - -`FixedLenFeature` entries with a `default_value` are optional. With no default -value, we will fail if that `Feature` is missing from any example in -`serialized`. - -Examples: - -For example, if one expects a `tf.float32` sparse feature `ft` and three -serialized `Example`s are provided: - -``` -serialized = [ - features - { feature { key: "ft" value { float_list { value: [1.0, 2.0] } } } }, - features - { feature []}, - features - { feature { key: "ft" value { float_list { value: [3.0] } } } -] -``` - -then the output will look like: - -``` -{"ft": SparseTensor(indices=[[0, 0], [0, 1], [2, 0]], - values=[1.0, 2.0, 3.0], - dense_shape=(3, 2)) } -``` - -Given two `Example` input protos in `serialized`: - -``` -[ - features { - feature { key: "kw" value { bytes_list { value: [ "knit", "big" ] } } } - feature { key: "gps" value { float_list { value: [] } } } - }, - features { - feature { key: "kw" value { bytes_list { value: [ "emmy" ] } } } - feature { key: "dank" value { int64_list { value: [ 42 ] } } } - feature { key: "gps" value { } } - } -] -``` - -And arguments - -``` -example_names: ["input0", "input1"], -features: { - "kw": VarLenFeature(tf.string), - "dank": VarLenFeature(tf.int64), - "gps": VarLenFeature(tf.float32), -} -``` - -Then the output is a dictionary: - -```python -{ - "kw": SparseTensor( - indices=[[0, 0], [0, 1], [1, 0]], - values=["knit", "big", "emmy"] - dense_shape=[2, 2]), - "dank": SparseTensor( - indices=[[1, 0]], - values=[42], - dense_shape=[2, 1]), - "gps": SparseTensor( - indices=[], - values=[], - dense_shape=[2, 0]), -} -``` - -For dense results in two serialized `Example`s: - -``` -[ - features { - feature { key: "age" value { int64_list { value: [ 0 ] } } } - feature { key: "gender" value { bytes_list { value: [ "f" ] } } } - }, - features { - feature { key: "age" value { int64_list { value: [] } } } - feature { key: "gender" value { bytes_list { value: [ "f" ] } } } - } -] -``` - -We can use arguments: - -``` -example_names: ["input0", "input1"], -features: { - "age": FixedLenFeature([], dtype=tf.int64, default_value=-1), - "gender": FixedLenFeature([], dtype=tf.string), -} -``` - -And the expected output is: - -```python -{ - "age": [[0], [-1]], - "gender": [["f"], ["f"]], -} -``` - -Given two `Example` input protos in `serialized`: - -``` -[ - features { - feature { key: "val" value { float_list { value: [ 0.5, -1.0 ] } } } - feature { key: "ix" value { int64_list { value: [ 3, 20 ] } } } - }, - features { - feature { key: "val" value { float_list { value: [ 0.0 ] } } } - feature { key: "ix" value { int64_list { value: [ 42 ] } } } - } -] -``` - -And arguments - -``` -example_names: ["input0", "input1"], -features: { - "sparse": SparseFeature( - index_key="ix", value_key="val", dtype=tf.float32, size=100), -} -``` - -Then the output is a dictionary: - -```python -{ - "sparse": SparseTensor( - indices=[[0, 3], [0, 20], [1, 42]], - values=[0.5, -1.0, 0.0] - dense_shape=[2, 100]), -} -``` - -##### Args: - - -* `serialized`: A vector (1-D Tensor) of strings, a batch of binary - serialized `Example` protos. -* `features`: A `dict` mapping feature keys to `FixedLenFeature`, - `VarLenFeature`, and `SparseFeature` values. -* `name`: A name for this operation (optional). -* `example_names`: A vector (1-D Tensor) of strings (optional), the names of - the serialized protos in the batch. - -##### Returns: - - A `dict` mapping feature keys to `Tensor` and `SparseTensor` values. - -##### Raises: - - -* `ValueError`: if any feature is invalid. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.pow.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.pow.md deleted file mode 100644 index fbb53fc9a1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.pow.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.pow(x, y, name=None)` {#pow} - -Computes the power of one value to another. - -Given a tensor `x` and a tensor `y`, this operation computes \\(x^y\\) for -corresponding elements in `x` and `y`. For example: - -``` -# tensor 'x' is [[2, 2], [3, 3]] -# tensor 'y' is [[8, 16], [2, 3]] -tf.pow(x, y) ==> [[256, 65536], [9, 27]] -``` - -##### Args: - - -* `x`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `y`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.python_io.tf_record_iterator.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.python_io.tf_record_iterator.md deleted file mode 100644 index 92550fe57a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.python_io.tf_record_iterator.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.python_io.tf_record_iterator(path, options=None)` {#tf_record_iterator} - -An iterator that read the records from a TFRecords file. - -##### Args: - - -* `path`: The path to the TFRecords file. -* `options`: (optional) A TFRecordOptions object. - -##### Yields: - - Strings. - -##### Raises: - - -* `IOError`: If `path` cannot be opened for reading. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.random_crop.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.random_crop.md deleted file mode 100644 index d389872919..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.random_crop.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.random_crop(value, size, seed=None, name=None)` {#random_crop} - -Randomly crops a tensor to a given size. - -Slices a shape `size` portion out of `value` at a uniformly chosen offset. -Requires `value.shape >= size`. - -If a dimension should not be cropped, pass the full size of that dimension. -For example, RGB images can be cropped with -`size = [crop_height, crop_width, 3]`. - -##### Args: - - -* `value`: Input tensor to crop. -* `size`: 1-D tensor with size the rank of `value`. -* `seed`: Python integer. Used to create a random seed. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: A name for this operation (optional). - -##### Returns: - - A cropped tensor of the same rank as `value` and shape `size`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.random_normal_initializer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.random_normal_initializer.md deleted file mode 100644 index f8932bee2e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.random_normal_initializer.md +++ /dev/null @@ -1,25 +0,0 @@ -Initializer that generates tensors with a normal distribution. - -Args: - mean: a python scalar or a scalar tensor. Mean of the random values - to generate. - stddev: a python scalar or a scalar tensor. Standard deviation of the - random values to generate. - seed: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - dtype: The data type. Only floating point types are supported. -- - - - -#### `tf.random_normal_initializer.__call__(shape, dtype=None, partition_info=None)` {#random_normal_initializer.__call__} - - - - -- - - - -#### `tf.random_normal_initializer.__init__(mean=0.0, stddev=1.0, seed=None, dtype=tf.float32)` {#random_normal_initializer.__init__} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.rank.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.rank.md deleted file mode 100644 index 32f62a93a0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.rank.md +++ /dev/null @@ -1,32 +0,0 @@ -### `tf.rank(input, name=None)` {#rank} - -Returns the rank of a tensor. - -This operation returns an integer representing the rank of `input`. - -For example: - -```python -# 't' is [[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]] -# shape of tensor 't' is [2, 2, 3] -rank(t) ==> 3 -``` - -**Note**: The rank of a tensor is not the same as the rank of a matrix. The -rank of a tensor is the number of indices required to uniquely select each -element of the tensor. Rank is also known as "order", "degree", or "ndims." - -##### Args: - - -* `input`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `int32`. - -@compatibility(numpy) -Equivalent to np.ndim -@end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.reciprocal.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.reciprocal.md deleted file mode 100644 index d340aa5178..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.reciprocal.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.reciprocal(x, name=None)` {#reciprocal} - -Computes the reciprocal of x element-wise. - -I.e., \\(y = 1 / x\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.self_adjoint_eig.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.self_adjoint_eig.md deleted file mode 100644 index 08d5903aa9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.self_adjoint_eig.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.self_adjoint_eig(tensor, name=None)` {#self_adjoint_eig} - -Computes the eigen decomposition of a batch of self-adjoint matrices. - -Computes the eigenvalues and eigenvectors of the innermost N-by-N matrices -in `tensor` such that -`tensor[...,:,:] * v[..., :,i] = e[..., i] * v[...,:,i]`, for i=0...N-1. - -##### Args: - - -* `tensor`: `Tensor` of shape `[..., N, N]`. Only the lower triangular part of - each inner inner matrix is referenced. -* `name`: string, optional name of the operation. - -##### Returns: - - -* `e`: Eigenvalues. Shape is `[..., N]`. -* `v`: Eigenvectors. Shape is `[..., N, N]`. The columns of the inner most - matrices contain eigenvectors of the corresponding matrices in `tensor` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sigmoid.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sigmoid.md deleted file mode 100644 index 8ee71e1370..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sigmoid.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.sigmoid(x, name=None)` {#sigmoid} - -Computes sigmoid of `x` element-wise. - -Specifically, `y = 1 / (1 + exp(-x))`. - -##### Args: - - -* `x`: A Tensor with type `float32`, `float64`, `int32`, `complex64`, `int64`, - or `qint32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A Tensor with the same type as `x` if `x.dtype != qint32` - otherwise the return type is `quint8`. - -@compatibility(numpy) -Equivalent to np.scipy.special.expit -@end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.slice.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.slice.md deleted file mode 100644 index aaaf6208e3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.slice.md +++ /dev/null @@ -1,47 +0,0 @@ -### `tf.slice(input_, begin, size, name=None)` {#slice} - -Extracts a slice from a tensor. - -This operation extracts a slice of size `size` from a tensor `input` starting -at the location specified by `begin`. The slice `size` is represented as a -tensor shape, where `size[i]` is the number of elements of the 'i'th dimension -of `input` that you want to slice. The starting location (`begin`) for the -slice is represented as an offset in each dimension of `input`. In other -words, `begin[i]` is the offset into the 'i'th dimension of `input` that you -want to slice from. - -`begin` is zero-based; `size` is one-based. If `size[i]` is -1, -all remaining elements in dimension i are included in the -slice. In other words, this is equivalent to setting: - -`size[i] = input.dim_size(i) - begin[i]` - -This operation requires that: - -`0 <= begin[i] <= begin[i] + size[i] <= Di for i in [0, n]` - -For example: - -```python -# 'input' is [[[1, 1, 1], [2, 2, 2]], -# [[3, 3, 3], [4, 4, 4]], -# [[5, 5, 5], [6, 6, 6]]] -tf.slice(input, [1, 0, 0], [1, 1, 3]) ==> [[[3, 3, 3]]] -tf.slice(input, [1, 0, 0], [1, 2, 3]) ==> [[[3, 3, 3], - [4, 4, 4]]] -tf.slice(input, [1, 0, 0], [2, 1, 3]) ==> [[[3, 3, 3]], - [[5, 5, 5]]] -``` - -##### Args: - - -* `input_`: A `Tensor`. -* `begin`: An `int32` or `int64` `Tensor`. -* `size`: An `int32` or `int64` `Tensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` the same type as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.space_to_depth.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.space_to_depth.md deleted file mode 100644 index afffa0d148..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.space_to_depth.md +++ /dev/null @@ -1,87 +0,0 @@ -### `tf.space_to_depth(input, block_size, name=None)` {#space_to_depth} - -SpaceToDepth for tensors of type T. - -Rearranges blocks of spatial data, into depth. More specifically, -this op outputs a copy of the input tensor where values from the `height` -and `width` dimensions are moved to the `depth` dimension. -The attr `block_size` indicates the input block size and how the data is moved. - - * Non-overlapping blocks of size `block_size x block size` are rearranged - into depth at each location. - * The depth of the output tensor is `input_depth * block_size * block_size`. - * The input tensor's height and width must be divisible by block_size. - -That is, assuming the input is in the shape: -`[batch, height, width, depth]`, -the shape of the output will be: -`[batch, height/block_size, width/block_size, depth*block_size*block_size]` - -This operation requires that the input tensor be of rank 4, and that -`block_size` be >=1 and a divisor of both the input `height` and `width`. - -This operation is useful for resizing the activations between convolutions -(but keeping all data), e.g. instead of pooling. It is also useful for training -purely convolutional models. - -For example, given this input of shape `[1, 2, 2, 1]`, and block_size of 2: - -```prettyprint -x = [[[[1], [2]], - [[3], [4]]]] -``` - -This operation will output a tensor of shape `[1, 1, 1, 4]`: - -```prettyprint -[[[[1, 2, 3, 4]]]] -``` - -Here, the input has a batch of 1 and each batch element has shape `[2, 2, 1]`, -the corresponding output will have a single element (i.e. width and height are -both 1) and will have a depth of 4 channels (1 * block_size * block_size). -The output element shape is `[1, 1, 4]`. - -For an input tensor with larger depth, here of shape `[1, 2, 2, 3]`, e.g. - -```prettyprint -x = [[[[1, 2, 3], [4, 5, 6]], - [[7, 8, 9], [10, 11, 12]]]] -``` - -This operation, for block_size of 2, will return the following tensor of shape -`[1, 1, 1, 12]` - -```prettyprint -[[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]] -``` - -Similarly, for the following input of shape `[1 4 4 1]`, and a block size of 2: - -```prettyprint -x = [[[[1], [2], [5], [6]], - [[3], [4], [7], [8]], - [[9], [10], [13], [14]], - [[11], [12], [15], [16]]]] -``` - -the operator will return the following tensor of shape `[1 2 2 4]`: - -```prettyprint -x = [[[[1, 2, 3, 4], - [5, 6, 7, 8]], - [[9, 10, 11, 12], - [13, 14, 15, 16]]]] -``` - -##### Args: - - -* `input`: A `Tensor`. -* `block_size`: An `int` that is `>= 2`. The size of the spatial block. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_reduce_sum_sparse.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_reduce_sum_sparse.md deleted file mode 100644 index 96a53cc87a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_reduce_sum_sparse.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.sparse_reduce_sum_sparse(sp_input, axis=None, keep_dims=False, reduction_axes=None)` {#sparse_reduce_sum_sparse} - -Computes the sum of elements across dimensions of a SparseTensor. - -This Op takes a SparseTensor and is the sparse counterpart to -`tf.reduce_sum()`. In contrast to SparseReduceSum, this Op returns a -SparseTensor. - -Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless -`keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in -`reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained -with length 1. - -If `reduction_axes` has no entries, all dimensions are reduced, and a tensor -with a single element is returned. Additionally, the axes can be negative, -which are interpreted according to the indexing rules in Python. - -##### Args: - - -* `sp_input`: The SparseTensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce; list or scalar. If `None` (the - default), reduces all dimensions. -* `keep_dims`: If true, retain reduced dimensions with length 1. -* `reduction_axes`: Deprecated name of axis - -##### Returns: - - The reduced SparseTensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_reset_shape.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_reset_shape.md deleted file mode 100644 index 363b4cc9e3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_reset_shape.md +++ /dev/null @@ -1,60 +0,0 @@ -### `tf.sparse_reset_shape(sp_input, new_shape=None)` {#sparse_reset_shape} - -Resets the shape of a `SparseTensor` with indices and values unchanged. - -If `new_shape` is None, returns a copy of `sp_input` with its shape reset -to the tight bounding box of `sp_input`. - -If `new_shape` is provided, then it must be larger or equal in all dimensions -compared to the shape of `sp_input`. When this condition is met, the returned -SparseTensor will have its shape reset to `new_shape` and its indices and -values unchanged from that of `sp_input.` - -For example: - - Consider a `sp_input` with shape [2, 3, 5]: - - [0, 0, 1]: a - [0, 1, 0]: b - [0, 2, 2]: c - [1, 0, 3]: d - - - It is an error to set `new_shape` as [3, 7] since this represents a - rank-2 tensor while `sp_input` is rank-3. This is either a ValueError - during graph construction (if both shapes are known) or an OpError during - run time. - - - Setting `new_shape` as [2, 3, 6] will be fine as this shape is larger or - equal in every dimension compared to the original shape [2, 3, 5]. - - - On the other hand, setting new_shape as [2, 3, 4] is also an error: The - third dimension is smaller than the original shape [2, 3, 5] (and an - `InvalidArgumentError` will be raised). - - - If `new_shape` is None, the returned SparseTensor will have a shape - [2, 3, 4], which is the tight bounding box of `sp_input`. - -##### Args: - - -* `sp_input`: The input `SparseTensor`. -* `new_shape`: None or a vector representing the new shape for the returned - `SparseTensor`. - -##### Returns: - - A `SparseTensor` indices and values unchanged from `input_sp`. Its shape is - `new_shape` if that is set. Otherwise it is the tight bounding box of - `input_sp` - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. -* `ValueError`: If `new_shape` represents a tensor with a different rank from - that of `sp_input` (if shapes are known when graph is constructed). -* `OpError`: - - If `new_shape` has dimension sizes that are too small. - - If shapes are not known during graph construction time, and during run - time it is found out that the ranks do not match. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_segment_mean.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_segment_mean.md deleted file mode 100644 index af7affaa9f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_segment_mean.md +++ /dev/null @@ -1,27 +0,0 @@ -### `tf.sparse_segment_mean(data, indices, segment_ids, name=None)` {#sparse_segment_mean} - -Computes the mean along sparse segments of a tensor. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -Like `SegmentMean`, but `segment_ids` can have rank less than `data`'s first -dimension, selecting a subset of dimension 0, specified by `indices`. - -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor. Has same rank as `segment_ids`. -* `segment_ids`: A `Tensor` of type `int32`. - A 1-D tensor. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_segment_sum.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_segment_sum.md deleted file mode 100644 index e48ae891c3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_segment_sum.md +++ /dev/null @@ -1,50 +0,0 @@ -### `tf.sparse_segment_sum(data, indices, segment_ids, name=None)` {#sparse_segment_sum} - -Computes the sum along sparse segments of a tensor. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -Like `SegmentSum`, but `segment_ids` can have rank less than `data`'s first -dimension, selecting a subset of dimension 0, specified by `indices`. - -For example: - -```prettyprint -c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]]) - -# Select two rows, one segment. -tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 0])) - ==> [[0 0 0 0]] - -# Select two rows, two segment. -tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 1])) - ==> [[ 1 2 3 4] - [-1 -2 -3 -4]] - -# Select all rows, two segments. -tf.sparse_segment_sum(c, tf.constant([0, 1, 2]), tf.constant([0, 0, 1])) - ==> [[0 0 0 0] - [5 6 7 8]] - -# Which is equivalent to: -tf.segment_sum(c, tf.constant([0, 0, 1])) -``` - -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor. Has same rank as `segment_ids`. -* `segment_ids`: A `Tensor` of type `int32`. - A 1-D tensor. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_transpose.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_transpose.md deleted file mode 100644 index fa4176a764..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.sparse_transpose.md +++ /dev/null @@ -1,40 +0,0 @@ -### `tf.sparse_transpose(sp_input, perm=None, name=None)` {#sparse_transpose} - -Transposes a `SparseTensor` - -The returned tensor's dimension i will correspond to the input dimension -`perm[i]`. If `perm` is not given, it is set to (n-1...0), where n is -the rank of the input tensor. Hence by default, this operation performs a -regular matrix transpose on 2-D input Tensors. - -For example, if `sp_input` has shape `[4, 5]` and `indices` / `values`: - - [0, 3]: b - [0, 1]: a - [3, 1]: d - [2, 0]: c - -then the output will be a `SparseTensor` of shape `[5, 4]` and -`indices` / `values`: - - [0, 2]: c - [1, 0]: a - [1, 3]: d - [3, 0]: b - -##### Args: - - -* `sp_input`: The input `SparseTensor`. -* `perm`: A permutation of the dimensions of `sp_input`. -* `name`: A name prefix for the returned tensors (optional) - -##### Returns: - - A transposed `SparseTensor`. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.string_join.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.string_join.md deleted file mode 100644 index b81537a70c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.string_join.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.string_join(inputs, separator=None, name=None)` {#string_join} - -Joins the strings in the given list of string tensors into one tensor; - -with the given separator (default is an empty separator). - -##### Args: - - -* `inputs`: A list of at least 1 `Tensor` objects of type `string`. - A list of string tensors. The tensors must all have the same shape, - or be scalars. Scalars may be mixed in; these will be broadcast to the shape - of non-scalar inputs. -* `separator`: An optional `string`. Defaults to `""`. - string, an optional join separator. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.summary.TaggedRunMetadata.RegisterExtension.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.summary.TaggedRunMetadata.RegisterExtension.md deleted file mode 100644 index f2d0c042d7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.summary.TaggedRunMetadata.RegisterExtension.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.summary.TaggedRunMetadata.RegisterExtension(extension_handle)` {#TaggedRunMetadata.RegisterExtension} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.summary.get_summary_description.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.summary.get_summary_description.md deleted file mode 100644 index 2e0189dfa8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.summary.get_summary_description.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.summary.get_summary_description(node_def)` {#get_summary_description} - -Given a TensorSummary node_def, retrieve its SummaryDescription. - -When a Summary op is instantiated, a SummaryDescription of associated -metadata is stored in its NodeDef. This method retrieves the description. - -##### Args: - - -* `node_def`: the node_def_pb2.NodeDef of a TensorSummary op - -##### Returns: - - a summary_pb2.SummaryDescription - -##### Raises: - - -* `ValueError`: if the node is not a summary op. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.summary.scalar.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.summary.scalar.md deleted file mode 100644 index 3ae39cb1d9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.summary.scalar.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.summary.scalar(name, tensor, collections=None)` {#scalar} - -Outputs a `Summary` protocol buffer containing a single scalar value. - -The generated Summary has a Tensor.proto containing the input Tensor. - -##### Args: - - -* `name`: A name for the generated node. Will also serve as the series name in - TensorBoard. -* `tensor`: A real numeric Tensor containing a single value. -* `collections`: Optional list of graph collections keys. The new summary op is - added to these collections. Defaults to `[GraphKeys.SUMMARIES]`. - -##### Returns: - - A scalar `Tensor` of type `string`. Which contains a `Summary` protobuf. - -##### Raises: - - -* `ValueError`: If tensor has the wrong shape or type. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.to_float.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.to_float.md deleted file mode 100644 index b45b49b982..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.to_float.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.to_float(x, name='ToFloat')` {#to_float} - -Casts a tensor to type `float32`. - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` with same shape as `x` with type `float32`. - -##### Raises: - - -* `TypeError`: If `x` cannot be cast to the `float32`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.AdamOptimizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.AdamOptimizer.md deleted file mode 100644 index 04d2ec6d0b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.AdamOptimizer.md +++ /dev/null @@ -1,206 +0,0 @@ -Optimizer that implements the Adam algorithm. - -See [Kingma et. al., 2014](http://arxiv.org/abs/1412.6980) -([pdf](http://arxiv.org/pdf/1412.6980.pdf)). -- - - - -#### `tf.train.AdamOptimizer.__init__(learning_rate=0.001, beta1=0.9, beta2=0.999, epsilon=1e-08, use_locking=False, name='Adam')` {#AdamOptimizer.__init__} - -Construct a new Adam optimizer. - -Initialization: - -``` -m_0 <- 0 (Initialize initial 1st moment vector) -v_0 <- 0 (Initialize initial 2nd moment vector) -t <- 0 (Initialize timestep) -``` - -The update rule for `variable` with gradient `g` uses an optimization -described at the end of section2 of the paper: - -``` -t <- t + 1 -lr_t <- learning_rate * sqrt(1 - beta2^t) / (1 - beta1^t) - -m_t <- beta1 * m_{t-1} + (1 - beta1) * g -v_t <- beta2 * v_{t-1} + (1 - beta2) * g * g -variable <- variable - lr_t * m_t / (sqrt(v_t) + epsilon) -``` - -The default value of 1e-8 for epsilon might not be a good default in -general. For example, when training an Inception network on ImageNet a -current good choice is 1.0 or 0.1. - -Note that in dense implement of this algorithm, m_t, v_t and variable will -update even if g is zero, but in sparse implement, m_t, v_t and variable -will not update in iterations g is zero. - -##### Args: - - -* `learning_rate`: A Tensor or a floating point value. The learning rate. -* `beta1`: A float value or a constant float tensor. - The exponential decay rate for the 1st moment estimates. -* `beta2`: A float value or a constant float tensor. - The exponential decay rate for the 2nd moment estimates. -* `epsilon`: A small constant for numerical stability. -* `use_locking`: If True use locks for update operations. -* `name`: Optional name for the operations created when applying gradients. - Defaults to "Adam". - - -- - - - -#### `tf.train.AdamOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#AdamOptimizer.apply_gradients} - -Apply gradients to variables. - -This is the second part of `minimize()`. It returns an `Operation` that -applies gradients. - -##### Args: - - -* `grads_and_vars`: List of (gradient, variable) pairs as returned by - `compute_gradients()`. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `name`: Optional name for the returned operation. Default to the - name passed to the `Optimizer` constructor. - -##### Returns: - - An `Operation` that applies the specified gradients. If `global_step` - was not None, that operation also increments `global_step`. - -##### Raises: - - -* `TypeError`: If `grads_and_vars` is malformed. -* `ValueError`: If none of the variables have gradients. - - -- - - - -#### `tf.train.AdamOptimizer.compute_gradients(loss, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, grad_loss=None)` {#AdamOptimizer.compute_gradients} - -Compute gradients of `loss` for the variables in `var_list`. - -This is the first part of `minimize()`. It returns a list -of (gradient, variable) pairs where "gradient" is the gradient -for "variable". Note that "gradient" can be a `Tensor`, an -`IndexedSlices`, or `None` if there is no gradient for the -given variable. - -##### Args: - - -* `loss`: A Tensor containing the value to minimize. -* `var_list`: Optional list of `tf.Variable` to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKey.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - A list of (gradient, variable) pairs. Variable is always present, but - gradient can be `None`. - -##### Raises: - - -* `TypeError`: If `var_list` contains anything else than `Variable` objects. -* `ValueError`: If some arguments are invalid. - - -- - - - -#### `tf.train.AdamOptimizer.get_name()` {#AdamOptimizer.get_name} - - - - -- - - - -#### `tf.train.AdamOptimizer.get_slot(var, name)` {#AdamOptimizer.get_slot} - -Return a slot named `name` created for `var` by the Optimizer. - -Some `Optimizer` subclasses use additional variables. For example -`Momentum` and `Adagrad` use variables to accumulate updates. This method -gives access to these `Variable` objects if for some reason you need them. - -Use `get_slot_names()` to get the list of slot names created by the -`Optimizer`. - -##### Args: - - -* `var`: A variable passed to `minimize()` or `apply_gradients()`. -* `name`: A string. - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - -- - - - -#### `tf.train.AdamOptimizer.get_slot_names()` {#AdamOptimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -See `get_slot()`. - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.train.AdamOptimizer.minimize(loss, global_step=None, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, name=None, grad_loss=None)` {#AdamOptimizer.minimize} - -Add operations to minimize `loss` by updating `var_list`. - -This method simply combines calls `compute_gradients()` and -`apply_gradients()`. If you want to process the gradient before applying -them call `compute_gradients()` and `apply_gradients()` explicitly instead -of using this function. - -##### Args: - - -* `loss`: A `Tensor` containing the value to minimize. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `name`: Optional name for the returned operation. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - An Operation that updates the variables in `var_list`. If `global_step` - was not `None`, that operation also increments `global_step`. - -##### Raises: - - -* `ValueError`: If some of the variables are not `Variable` objects. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.Coordinator.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.Coordinator.md deleted file mode 100644 index 25a4025fc9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.Coordinator.md +++ /dev/null @@ -1,266 +0,0 @@ -A coordinator for threads. - -This class implements a simple mechanism to coordinate the termination of a -set of threads. - -#### Usage: - -```python -# Create a coordinator. -coord = Coordinator() -# Start a number of threads, passing the coordinator to each of them. -...start thread 1...(coord, ...) -...start thread N...(coord, ...) -# Wait for all the threads to terminate. -coord.join(threads) -``` - -Any of the threads can call `coord.request_stop()` to ask for all the threads -to stop. To cooperate with the requests, each thread must check for -`coord.should_stop()` on a regular basis. `coord.should_stop()` returns -`True` as soon as `coord.request_stop()` has been called. - -A typical thread running with a coordinator will do something like: - -```python -while not coord.should_stop(): - ...do some work... -``` - -#### Exception handling: - -A thread can report an exception to the coordinator as part of the -`should_stop()` call. The exception will be re-raised from the -`coord.join()` call. - -Thread code: - -```python -try: - while not coord.should_stop(): - ...do some work... -except Exception as e: - coord.request_stop(e) -``` - -Main code: - -```python -try: - ... - coord = Coordinator() - # Start a number of threads, passing the coordinator to each of them. - ...start thread 1...(coord, ...) - ...start thread N...(coord, ...) - # Wait for all the threads to terminate. - coord.join(threads) -except Exception as e: - ...exception that was passed to coord.request_stop() -``` - -To simplify the thread implementation, the Coordinator provides a -context handler `stop_on_exception()` that automatically requests a stop if -an exception is raised. Using the context handler the thread code above -can be written as: - -```python -with coord.stop_on_exception(): - while not coord.should_stop(): - ...do some work... -``` - -#### Grace period for stopping: - -After a thread has called `coord.request_stop()` the other threads have a -fixed time to stop, this is called the 'stop grace period' and defaults to 2 -minutes. If any of the threads is still alive after the grace period expires -`coord.join()` raises a RuntimeException reporting the laggards. - -```python -try: - ... - coord = Coordinator() - # Start a number of threads, passing the coordinator to each of them. - ...start thread 1...(coord, ...) - ...start thread N...(coord, ...) - # Wait for all the threads to terminate, give them 10s grace period - coord.join(threads, stop_grace_period_secs=10) -except RuntimeException: - ...one of the threads took more than 10s to stop after request_stop() - ...was called. -except Exception: - ...exception that was passed to coord.request_stop() -``` -- - - - -#### `tf.train.Coordinator.__init__(clean_stop_exception_types=None)` {#Coordinator.__init__} - -Create a new Coordinator. - -##### Args: - - -* `clean_stop_exception_types`: Optional tuple of Exception types that should - cause a clean stop of the coordinator. If an exception of one of these - types is reported to `request_stop(ex)` the coordinator will behave as - if `request_stop(None)` was called. Defaults to - `(tf.errors.OutOfRangeError,)` which is used by input queues to signal - the end of input. When feeding training data from a Python iterator it - is common to add `StopIteration` to this list. - - -- - - - -#### `tf.train.Coordinator.clear_stop()` {#Coordinator.clear_stop} - -Clears the stop flag. - -After this is called, calls to `should_stop()` will return `False`. - - -- - - - -#### `tf.train.Coordinator.join(threads=None, stop_grace_period_secs=120, ignore_live_threads=False)` {#Coordinator.join} - -Wait for threads to terminate. - -This call blocks until a set of threads have terminated. The set of thread -is the union of the threads passed in the `threads` argument and the list -of threads that registered with the coordinator by calling -`Coordinator.register_thread()`. - -After the threads stop, if an `exc_info` was passed to `request_stop`, that -exception is re-raised. - -Grace period handling: When `request_stop()` is called, threads are given -'stop_grace_period_secs' seconds to terminate. If any of them is still -alive after that period expires, a `RuntimeError` is raised. Note that if -an `exc_info` was passed to `request_stop()` then it is raised instead of -that `RuntimeError`. - -##### Args: - - -* `threads`: List of `threading.Threads`. The started threads to join in - addition to the registered threads. -* `stop_grace_period_secs`: Number of seconds given to threads to stop after - `request_stop()` has been called. -* `ignore_live_threads`: If `False`, raises an error if any of the threads are - still alive after `stop_grace_period_secs`. - -##### Raises: - - -* `RuntimeError`: If any thread is still alive after `request_stop()` - is called and the grace period expires. - - -- - - - -#### `tf.train.Coordinator.joined` {#Coordinator.joined} - - - - -- - - - -#### `tf.train.Coordinator.raise_requested_exception()` {#Coordinator.raise_requested_exception} - -If an exception has been passed to `request_stop`, this raises it. - - -- - - - -#### `tf.train.Coordinator.register_thread(thread)` {#Coordinator.register_thread} - -Register a thread to join. - -##### Args: - - -* `thread`: A Python thread to join. - - -- - - - -#### `tf.train.Coordinator.request_stop(ex=None)` {#Coordinator.request_stop} - -Request that the threads stop. - -After this is called, calls to `should_stop()` will return `True`. - -Note: If an exception is being passed in, in must be in the context of -handling the exception (i.e. `try: ... except Exception as ex: ...`) and not -a newly created one. - -##### Args: - - -* `ex`: Optional `Exception`, or Python `exc_info` tuple as returned by - `sys.exc_info()`. If this is the first call to `request_stop()` the - corresponding exception is recorded and re-raised from `join()`. - - -- - - - -#### `tf.train.Coordinator.should_stop()` {#Coordinator.should_stop} - -Check if stop was requested. - -##### Returns: - - True if a stop was requested. - - -- - - - -#### `tf.train.Coordinator.stop_on_exception()` {#Coordinator.stop_on_exception} - -Context manager to request stop when an Exception is raised. - -Code that uses a coordinator must catch exceptions and pass -them to the `request_stop()` method to stop the other threads -managed by the coordinator. - -This context handler simplifies the exception handling. -Use it as follows: - -```python -with coord.stop_on_exception(): - # Any exception raised in the body of the with - # clause is reported to the coordinator before terminating - # the execution of the body. - ...body... -``` - -This is completely equivalent to the slightly longer code: - -```python -try: - ...body... -exception Exception as ex: - coord.request_stop(ex) -``` - -##### Yields: - - nothing. - - -- - - - -#### `tf.train.Coordinator.wait_for_stop(timeout=None)` {#Coordinator.wait_for_stop} - -Wait till the Coordinator is told to stop. - -##### Args: - - -* `timeout`: Float. Sleep for up to that many seconds waiting for - should_stop() to become True. - -##### Returns: - - True if the Coordinator is told stop, False if the timeout expired. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.QueueRunner.from_proto.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.QueueRunner.from_proto.md deleted file mode 100644 index e7b5bc70e3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.QueueRunner.from_proto.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.train.QueueRunner.from_proto(queue_runner_def, import_scope=None)` {#QueueRunner.from_proto} - -Returns a `QueueRunner` object created from `queue_runner_def`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.RMSPropOptimizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.RMSPropOptimizer.md deleted file mode 100644 index 499b65cc84..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.RMSPropOptimizer.md +++ /dev/null @@ -1,30 +0,0 @@ -Optimizer that implements the RMSProp algorithm. - -See the [paper](http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf). - -- - - - -#### `tf.train.RMSPropOptimizer.__init__(learning_rate, decay=0.9, momentum=0.0, epsilon=1e-10, use_locking=False, centered=False, name='RMSProp')` {#RMSPropOptimizer.__init__} - -Construct a new RMSProp optimizer. - -Note that in dense implement of this algorithm, m_t and v_t will -update even if g is zero, but in sparse implement, m_t and v_t -will not update in iterations g is zero. - -##### Args: - - -* `learning_rate`: A Tensor or a floating point value. The learning rate. -* `decay`: Discounting factor for the history/coming gradient -* `momentum`: A scalar tensor. -* `epsilon`: Small value to avoid zero denominator. -* `use_locking`: If True use locks for update operation. -* `centered`: If True, gradients are normalized by the estimated variance of - the gradient; if False, by the uncentered second moment. Setting this to - True may help with training, but is slightly more expensive in terms of - computation and memory. Defaults to False. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "RMSProp". - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.Scaffold.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.Scaffold.md deleted file mode 100644 index 8882f4710d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.Scaffold.md +++ /dev/null @@ -1,144 +0,0 @@ -Structure to create or gather pieces commonly needed to train a model. - -When you build a model for training you usually need ops to initialize -variables, a `Saver` to checkpoint them, an op to collect summaries for -the visualizer, and so on. - -Various libraries built on top of the core TensorFlow library take care of -creating some or all of these pieces and storing them in well known -collections in the graph. The `Scaffold` class helps pick these pieces from -the graph collections, creating and adding them to the collections if needed. - -If you call the scaffold constructor without any arguments, it will pick -pieces from the collections, creating default ones if needed when -`scaffold.finalize()` is called. You can pass arguments to the constructor to -provide your own pieces. Pieces that you pass to the constructor are not -added to the graph collections. - -The following pieces are directly accessible as attributes of the `Scaffold` -object: - -* `saver`: A `tf.Saver` object taking care of saving the variables. Picked - from and stored into the `SAVERS` collection in the graph by default. -* `init_op`: An op to run to initialize the variables. Picked from and - stored into the `INIT_OP` collection in the graph by default. -* `ready_op`: An op to verify that the variables are initialized. Picked - from and stored into the `READY_OP` collection in the graph by default. -* `ready_for_local_init_op`: An op to verify that global state has been - initialized and it is alright to run `local_init_op`. Picked from and - stored into the `READY_FOR_LOCAL_INIT_OP` collection in the graph by - default. This is needed when the initialization of local variables depends - on the values of global variables. -* `local_init_op`: An op to initialize the local variables. Picked - from and stored into the `LOCAL_INIT_OP` collection in the graph by default. -* `summary_op`: An op to run and merge the summaries in the graph. Picked - from and stored into the `SUMMARY_OP` collection in the graph by default. -* `global_step`: A tensor containing the global step counter. Picked - from and stored into the `GLOBAL_STEP` collection in the graph by default. - -You can also pass the following additional pieces to the constructor: - -* `init_feed_dict`: A sessionn feed dictionary that should be used when - running the init op. -* `init_fn`: A callable to run run after the init op to perform additional - initializations. The callable will be called as - `init_fn(scaffold, session)`. -- - - - -#### `tf.train.Scaffold.__init__(init_op=None, init_feed_dict=None, init_fn=None, ready_op=None, ready_for_local_init_op=None, local_init_op=None, summary_op=None, saver=None)` {#Scaffold.__init__} - -Create a scaffold. - -##### Args: - - -* `init_op`: Optional op for initializing variables. -* `init_feed_dict`: Optional session feed dictionary to use when running the - init_op. -* `init_fn`: Optional function to use to initialize the model after running - the init_op. Will be called as `init_fn(scaffold, session)`. -* `ready_op`: Optional op to verify that the variables are initialized. Must - return an empty 1D string tensor when the variables are initialized, or - a non-empty 1D string tensor listing the names of the non-initialized - variables. -* `ready_for_local_init_op`: Optional op to verify that the global variables - are initialized and `local_init_op` can be run. Must return an empty - 1D string tensor when the global variables are initialized, or a - non-empty 1D string tensor listing the names of the non-initialized - global variables. -* `local_init_op`: Optional op to initialize local variables. -* `summary_op`: Optional op to gather all summaries. Must return a scalar - string tensor containing a serialized `Summary` proto. -* `saver`: Optional `tf.Saver` object to use to save and restore variables. - - -- - - - -#### `tf.train.Scaffold.finalize()` {#Scaffold.finalize} - -Creates operations if needed and finalizes the graph. - - -- - - - -#### `tf.train.Scaffold.get_or_default(arg_name, collection_key, default_constructor)` {#Scaffold.get_or_default} - -Get from cache or create a default operation. - - -- - - - -#### `tf.train.Scaffold.init_feed_dict` {#Scaffold.init_feed_dict} - - - - -- - - - -#### `tf.train.Scaffold.init_fn` {#Scaffold.init_fn} - - - - -- - - - -#### `tf.train.Scaffold.init_op` {#Scaffold.init_op} - - - - -- - - - -#### `tf.train.Scaffold.local_init_op` {#Scaffold.local_init_op} - - - - -- - - - -#### `tf.train.Scaffold.ready_for_local_init_op` {#Scaffold.ready_for_local_init_op} - - - - -- - - - -#### `tf.train.Scaffold.ready_op` {#Scaffold.ready_op} - - - - -- - - - -#### `tf.train.Scaffold.saver` {#Scaffold.saver} - - - - -- - - - -#### `tf.train.Scaffold.summary_op` {#Scaffold.summary_op} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.SessionRunContext.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.SessionRunContext.md deleted file mode 100644 index ce3e764795..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.SessionRunContext.md +++ /dev/null @@ -1,57 +0,0 @@ -Provides information about the `session.run()` call being made. - -Provides information about original request to `Session.Run()` function. -SessionRunHook objects can stop the loop by calling `request_stop()` of -`run_context`. In the future we may use this object to add more information -about run without changing the Hook API. -- - - - -#### `tf.train.SessionRunContext.__init__(original_args, session)` {#SessionRunContext.__init__} - -Initializes SessionRunContext. - - -- - - - -#### `tf.train.SessionRunContext.original_args` {#SessionRunContext.original_args} - -A `SessionRunArgs` object holding the original arguments of `run()`. - -If user called `MonitoredSession.run(fetches=a, feed_dict=b)`, then this -field is equal to SessionRunArgs(a, b). - -##### Returns: - - A `SessionRunArgs` object - - -- - - - -#### `tf.train.SessionRunContext.request_stop()` {#SessionRunContext.request_stop} - -Sets stop requested field. - -Hooks can use this function to request stop of iterations. -`MonitoredSession` checks whether this is called or not. - - -- - - - -#### `tf.train.SessionRunContext.session` {#SessionRunContext.session} - -A TensorFlow session object which will execute the `run`. - - -- - - - -#### `tf.train.SessionRunContext.stop_requested` {#SessionRunContext.stop_requested} - -Returns whether a stop is requested or not. - -If true, `MonitoredSession` stops iterations. - -##### Returns: - - A `bool` - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.StopAtStepHook.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.StopAtStepHook.md deleted file mode 100644 index e599bfc21a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.StopAtStepHook.md +++ /dev/null @@ -1,85 +0,0 @@ -Monitor to request stop at a specified step. -- - - - -#### `tf.train.StopAtStepHook.__init__(num_steps=None, last_step=None)` {#StopAtStepHook.__init__} - -Create a StopAtStep Hook. - -This hook requests stop after either a number of steps have been -executed or a last step has been reached. Only of the two options can be -specified. - -if `num_steps` is specified, it indicates the number of steps to execute -after `begin()` is called. If instead `last_step` is specified, it -indicates the last step we want to execute, as passed to the `after_run()` -call. - -##### Args: - - -* `num_steps`: Number of steps to execute. -* `last_step`: Step after which to stop. - -##### Raises: - - -* `ValueError`: If one of the arguments is invalid. - - -- - - - -#### `tf.train.StopAtStepHook.after_create_session(session, coord)` {#StopAtStepHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.StopAtStepHook.after_run(run_context, run_values)` {#StopAtStepHook.after_run} - - - - -- - - - -#### `tf.train.StopAtStepHook.before_run(run_context)` {#StopAtStepHook.before_run} - - - - -- - - - -#### `tf.train.StopAtStepHook.begin()` {#StopAtStepHook.begin} - - - - -- - - - -#### `tf.train.StopAtStepHook.end(session)` {#StopAtStepHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.Supervisor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.Supervisor.md deleted file mode 100644 index d6c6693a5a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.Supervisor.md +++ /dev/null @@ -1,859 +0,0 @@ -A training helper that checkpoints models and computes summaries. - -The Supervisor is a small wrapper around a `Coordinator`, a `Saver`, -and a `SessionManager` that takes care of common needs of TensorFlow -training programs. - -#### Use for a single program - -```python -with tf.Graph().as_default(): - ...add operations to the graph... - # Create a Supervisor that will checkpoint the model in '/tmp/mydir'. - sv = Supervisor(logdir='/tmp/mydir') - # Get a TensorFlow session managed by the supervisor. - with sv.managed_session(FLAGS.master) as sess: - # Use the session to train the graph. - while not sv.should_stop(): - sess.run() -``` - -Within the `with sv.managed_session()` block all variables in the graph have -been initialized. In addition, a few services have been started to -checkpoint the model and add summaries to the event log. - -If the program crashes and is restarted, the managed session automatically -reinitialize variables from the most recent checkpoint. - -The supervisor is notified of any exception raised by one of the services. -After an exception is raised, `should_stop()` returns `True`. In that case -the training loop should also stop. This is why the training loop has to -check for `sv.should_stop()`. - -Exceptions that indicate that the training inputs have been exhausted, -`tf.errors.OutOfRangeError`, also cause `sv.should_stop()` to return `True` -but are not re-raised from the `with` block: they indicate a normal -termination. - -#### Use for multiple replicas - -To train with replicas you deploy the same program in a `Cluster`. -One of the tasks must be identified as the *chief*: the task that handles -initialization, checkpoints, summaries, and recovery. The other tasks -depend on the *chief* for these services. - -The only change you have to do to the single program code is to indicate -if the program is running as the *chief*. - -```python -# Choose a task as the chief. This could be based on server_def.task_index, -# or job_def.name, or job_def.tasks. It's entirely up to the end user. -# But there can be only one *chief*. -is_chief = (server_def.task_index == 0) -server = tf.train.Server(server_def) - -with tf.Graph().as_default(): - ...add operations to the graph... - # Create a Supervisor that uses log directory on a shared file system. - # Indicate if you are the 'chief' - sv = Supervisor(logdir='/shared_directory/...', is_chief=is_chief) - # Get a Session in a TensorFlow server on the cluster. - with sv.managed_session(server.target) as sess: - # Use the session to train the graph. - while not sv.should_stop(): - sess.run() -``` - -In the *chief* task, the `Supervisor` works exactly as in the first example -above. In the other tasks `sv.managed_session()` waits for the Model to have -been initialized before returning a session to the training code. The -non-chief tasks depend on the chief task for initializing the model. - -If one of the tasks crashes and restarts, `managed_session()` -checks if the Model is initialized. If yes, it just creates a session and -returns it to the training code that proceeds normally. If the model needs -to be initialized, the chief task takes care of reinitializing it; the other -tasks just wait for the model to have been initialized. - -NOTE: This modified program still works fine as a single program. -The single program marks itself as the chief. - -#### What `master` string to use - -Whether you are running on your machine or in the cluster you can use the -following values for the --master flag: - -* Specifying `''` requests an in-process session that does not use RPC. - -* Specifying `'local'` requests a session that uses the RPC-based - "Master interface" to run TensorFlow programs. See - [`tf.train.Server.create_local_server()`](#Server.create_local_server) for - details. - -* Specifying `'grpc://hostname:port'` requests a session that uses - the RPC interface to a specific host, and also allows the in-process - master to access remote tensorflow workers. Often, it is - appropriate to pass `server.target` (for some `tf.train.Server` - named `server). - -#### Advanced use - -##### Launching additional services - -`managed_session()` launches the Checkpoint and Summary services (threads). -If you need more services to run you can simply launch them in the block -controlled by `managed_session()`. - -Example: Start a thread to print losses. We want this thread to run -every 60 seconds, so we launch it with `sv.loop()`. - - ```python - ... - sv = Supervisor(logdir='/tmp/mydir') - with sv.managed_session(FLAGS.master) as sess: - sv.loop(60, print_loss, (sess, )) - while not sv.should_stop(): - sess.run(my_train_op) - ``` - -##### Launching fewer services - -`managed_session()` launches the "summary" and "checkpoint" threads which use -either the optionally `summary_op` and `saver` passed to the constructor, or -default ones created automatically by the supervisor. If you want to run -your own summary and checkpointing logic, disable these services by passing -`None` to the `summary_op` and `saver` parameters. - -Example: Create summaries manually every 100 steps in the chief. - - ```python - # Create a Supervisor with no automatic summaries. - sv = Supervisor(logdir='/tmp/mydir', is_chief=is_chief, summary_op=None) - # As summary_op was None, managed_session() does not start the - # summary thread. - with sv.managed_session(FLAGS.master) as sess: - for step in xrange(1000000): - if sv.should_stop(): - break - if is_chief and step % 100 == 0: - # Create the summary every 100 chief steps. - sv.summary_computed(sess, sess.run(my_summary_op)) - else: - # Train normally - sess.run(my_train_op) - ``` - -##### Custom model initialization - -`managed_session()` only supports initializing the model by running an -`init_op` or restoring from the latest checkpoint. If you have special -initialization needs, see how to specify a `local_init_op` when creating the -supervisor. You can also use the `SessionManager` directly to create a -session and check if it could be initialized automatically. - -- - - - -#### `tf.train.Supervisor.__init__(graph=None, ready_op=0, ready_for_local_init_op=0, is_chief=True, init_op=0, init_feed_dict=None, local_init_op=0, logdir=None, summary_op=0, saver=0, global_step=0, save_summaries_secs=120, save_model_secs=600, recovery_wait_secs=30, stop_grace_secs=120, checkpoint_basename='model.ckpt', session_manager=None, summary_writer=0, init_fn=None)` {#Supervisor.__init__} - -Create a `Supervisor`. - -##### Args: - - -* `graph`: A `Graph`. The graph that the model will use. Defaults to the - default `Graph`. The supervisor may add operations to the graph before - creating a session, but the graph should not be modified by the caller - after passing it to the supervisor. -* `ready_op`: 1-D string `Tensor`. This tensor is evaluated by supervisors in - `prepare_or_wait_for_session()` to check if the model is ready to use. - The model is considered ready if it returns an empty array. Defaults to - the tensor returned from `tf.report_uninitialized_variables()` If - `None`, the model is not checked for readiness. -* `ready_for_local_init_op`: 1-D string `Tensor`. This tensor is evaluated by - supervisors in `prepare_or_wait_for_session()` to check if the model is - ready to run the local_init_op. - The model is considered ready if it returns an empty array. Defaults to - the tensor returned from - `tf.report_uninitialized_variables(tf.global_variables())`. If `None`, - the model is not checked for readiness before running local_init_op. -* `is_chief`: If True, create a chief supervisor in charge of initializing - and restoring the model. If False, create a supervisor that relies - on a chief supervisor for inits and restore. -* `init_op`: `Operation`. Used by chief supervisors to initialize the model - when it can not be recovered. Defaults to an `Operation` that - initializes all variables. If `None`, no initialization is done - automatically unless you pass a value for `init_fn`, see below. -* `init_feed_dict`: A dictionary that maps `Tensor` objects to feed values. - This feed dictionary will be used when `init_op` is evaluated. -* `local_init_op`: `Operation`. Used by all supervisors to run initializations - that should run for every new supervisor instance. By default these - are table initializers and initializers for local variables. - If `None`, no further per supervisor-instance initialization is - done automatically. -* `logdir`: A string. Optional path to a directory where to checkpoint the - model and log events for the visualizer. Used by chief supervisors. - The directory will be created if it does not exist. -* `summary_op`: An `Operation` that returns a Summary for the event logs. - Used by chief supervisors if a `logdir` was specified. Defaults to the - operation returned from summary.merge_all(). If `None`, summaries are - not computed automatically. -* `saver`: A Saver object. Used by chief supervisors if a `logdir` was - specified. Defaults to the saved returned by Saver(). - If `None`, the model is not saved automatically. -* `global_step`: An integer Tensor of size 1 that counts steps. The value - from 'global_step' is used in summaries and checkpoint filenames. - Default to the op named 'global_step' in the graph if it exists, is of - rank 1, size 1, and of type tf.int32 or tf.int64. If `None` the global - step is not recorded in summaries and checkpoint files. Used by chief - supervisors if a `logdir` was specified. -* `save_summaries_secs`: Number of seconds between the computation of - summaries for the event log. Defaults to 120 seconds. Pass 0 to - disable summaries. -* `save_model_secs`: Number of seconds between the creation of model - checkpoints. Defaults to 600 seconds. Pass 0 to disable checkpoints. -* `recovery_wait_secs`: Number of seconds between checks that the model - is ready. Used by supervisors when waiting for a chief supervisor - to initialize or restore the model. Defaults to 30 seconds. -* `stop_grace_secs`: Grace period, in seconds, given to running threads to - stop when `stop()` is called. Defaults to 120 seconds. -* `checkpoint_basename`: The basename for checkpoint saving. -* `session_manager`: `SessionManager`, which manages Session creation and - recovery. If it is `None`, a default `SessionManager` will be created - with the set of arguments passed in for backwards compatibility. -* `summary_writer`: `SummaryWriter` to use or `USE_DEFAULT`. Can be `None` - to indicate that no summaries should be written. -* `init_fn`: Optional callable used to initialize the model. Called - after the optional `init_op` is called. The callable must accept one - argument, the session being initialized. - -##### Returns: - - A `Supervisor`. - - -- - - - -#### `tf.train.Supervisor.managed_session(master='', config=None, start_standard_services=True, close_summary_writer=True)` {#Supervisor.managed_session} - -Returns a context manager for a managed session. - -This context manager creates and automatically recovers a session. It -optionally starts the standard services that handle checkpoints and -summaries. It monitors exceptions raised from the `with` block or from the -services and stops the supervisor as needed. - -The context manager is typically used as follows: - -```python -def train(): - sv = tf.train.Supervisor(...) - with sv.managed_session() as sess: - for step in xrange(..): - if sv.should_stop(): - break - sess.run() - ...do other things needed at each training step... -``` - -An exception raised from the `with` block or one of the service threads is -raised again when the block exits. This is done after stopping all threads -and closing the session. For example, an `AbortedError` exception, raised -in case of preemption of one of the workers in a distributed model, is -raised again when the block exits. - -If you want to retry the training loop in case of preemption you can do it -as follows: - -```python -def main(...): - while True - try: - train() - except tf.errors.Aborted: - pass -``` - -As a special case, exceptions used for control flow, such as -`OutOfRangeError` which reports that input queues are exhausted, are not -raised again from the `with` block: they indicate a clean termination of -the training loop and are considered normal termination. - -##### Args: - - -* `master`: name of the TensorFlow master to use. See the `tf.Session` - constructor for how this is interpreted. -* `config`: Optional `ConfigProto` proto used to configure the session. - Passed as-is to create the session. -* `start_standard_services`: Whether to start the standard services, - such as checkpoint, summary and step counter. -* `close_summary_writer`: Whether to close the summary writer when - closing the session. Defaults to True. - -##### Returns: - - A context manager that yields a `Session` restored from the latest - checkpoint or initialized from scratch if not checkpoint exists. The - session is closed when the `with` block exits. - - -- - - - -#### `tf.train.Supervisor.prepare_or_wait_for_session(master='', config=None, wait_for_checkpoint=False, max_wait_secs=7200, start_standard_services=True)` {#Supervisor.prepare_or_wait_for_session} - -Make sure the model is ready to be used. - -Create a session on 'master', recovering or initializing the model as -needed, or wait for a session to be ready. If running as the chief -and `start_standard_service` is set to True, also call the session -manager to start the standard services. - -##### Args: - - -* `master`: name of the TensorFlow master to use. See the `tf.Session` - constructor for how this is interpreted. -* `config`: Optional ConfigProto proto used to configure the session, - which is passed as-is to create the session. -* `wait_for_checkpoint`: Whether we should wait for the availability of a - checkpoint before creating Session. Defaults to False. -* `max_wait_secs`: Maximum time to wait for the session to become available. -* `start_standard_services`: Whether to start the standard services and the - queue runners. - -##### Returns: - - A Session object that can be used to drive the model. - - -- - - - -#### `tf.train.Supervisor.start_standard_services(sess)` {#Supervisor.start_standard_services} - -Start the standard services for 'sess'. - -This starts services in the background. The services started depend -on the parameters to the constructor and may include: - - - A Summary thread computing summaries every save_summaries_secs. - - A Checkpoint thread saving the model every save_model_secs. - - A StepCounter thread measure step time. - -##### Args: - - -* `sess`: A Session. - -##### Returns: - - A list of threads that are running the standard services. You can use - the Supervisor's Coordinator to join these threads with: - sv.coord.Join() - -##### Raises: - - -* `RuntimeError`: If called with a non-chief Supervisor. -* `ValueError`: If not `logdir` was passed to the constructor as the - services need a log directory. - - -- - - - -#### `tf.train.Supervisor.start_queue_runners(sess, queue_runners=None)` {#Supervisor.start_queue_runners} - -Start threads for `QueueRunners`. - -Note that the queue runners collected in the graph key `QUEUE_RUNNERS` -are already started automatically when you create a session with the -supervisor, so unless you have non-collected queue runners to start -you do not need to call this explicitly. - -##### Args: - - -* `sess`: A `Session`. -* `queue_runners`: A list of `QueueRunners`. If not specified, we'll use the - list of queue runners gathered in the graph under the key - `GraphKeys.QUEUE_RUNNERS`. - -##### Returns: - - The list of threads started for the `QueueRunners`. - - -- - - - -#### `tf.train.Supervisor.summary_computed(sess, summary, global_step=None)` {#Supervisor.summary_computed} - -Indicate that a summary was computed. - -##### Args: - - -* `sess`: A `Session` object. -* `summary`: A Summary proto, or a string holding a serialized summary proto. -* `global_step`: Int. global step this summary is associated with. If `None`, - it will try to fetch the current step. - -##### Raises: - - -* `TypeError`: if 'summary' is not a Summary proto or a string. -* `RuntimeError`: if the Supervisor was created without a `logdir`. - - - -- - - - -#### `tf.train.Supervisor.stop(threads=None, close_summary_writer=True)` {#Supervisor.stop} - -Stop the services and the coordinator. - -This does not close the session. - -##### Args: - - -* `threads`: Optional list of threads to join with the coordinator. If - `None`, defaults to the threads running the standard services, the - threads started for `QueueRunners`, and the threads started by the - `loop()` method. To wait on additional threads, pass the - list in this parameter. -* `close_summary_writer`: Whether to close the `summary_writer`. Defaults to - `True` if the summary writer was created by the supervisor, `False` - otherwise. - - -- - - - -#### `tf.train.Supervisor.request_stop(ex=None)` {#Supervisor.request_stop} - -Request that the coordinator stop the threads. - -See `Coordinator.request_stop()`. - -##### Args: - - -* `ex`: Optional `Exception`, or Python `exc_info` tuple as returned by - `sys.exc_info()`. If this is the first call to `request_stop()` the - corresponding exception is recorded and re-raised from `join()`. - - -- - - - -#### `tf.train.Supervisor.should_stop()` {#Supervisor.should_stop} - -Check if the coordinator was told to stop. - -See `Coordinator.should_stop()`. - -##### Returns: - - True if the coordinator was told to stop, False otherwise. - - -- - - - -#### `tf.train.Supervisor.stop_on_exception()` {#Supervisor.stop_on_exception} - -Context handler to stop the supervisor when an exception is raised. - -See `Coordinator.stop_on_exception()`. - -##### Returns: - - A context handler. - - -- - - - -#### `tf.train.Supervisor.wait_for_stop()` {#Supervisor.wait_for_stop} - -Block waiting for the coordinator to stop. - - - -#### Other Methods -- - - - -#### `tf.train.Supervisor.Loop(timer_interval_secs, target, args=None, kwargs=None)` {#Supervisor.Loop} - -Start a LooperThread that calls a function periodically. - -If `timer_interval_secs` is None the thread calls `target(*args, **kwargs)` -repeatedly. Otherwise it calls it every `timer_interval_secs` -seconds. The thread terminates when a stop is requested. - -The started thread is added to the list of threads managed by the supervisor -so it does not need to be passed to the `stop()` method. - -##### Args: - - -* `timer_interval_secs`: Number. Time boundaries at which to call `target`. -* `target`: A callable object. -* `args`: Optional arguments to pass to `target` when calling it. -* `kwargs`: Optional keyword arguments to pass to `target` when calling it. - -##### Returns: - - The started thread. - - -- - - - -#### `tf.train.Supervisor.PrepareSession(master='', config=None, wait_for_checkpoint=False, max_wait_secs=7200, start_standard_services=True)` {#Supervisor.PrepareSession} - -Make sure the model is ready to be used. - -Create a session on 'master', recovering or initializing the model as -needed, or wait for a session to be ready. If running as the chief -and `start_standard_service` is set to True, also call the session -manager to start the standard services. - -##### Args: - - -* `master`: name of the TensorFlow master to use. See the `tf.Session` - constructor for how this is interpreted. -* `config`: Optional ConfigProto proto used to configure the session, - which is passed as-is to create the session. -* `wait_for_checkpoint`: Whether we should wait for the availability of a - checkpoint before creating Session. Defaults to False. -* `max_wait_secs`: Maximum time to wait for the session to become available. -* `start_standard_services`: Whether to start the standard services and the - queue runners. - -##### Returns: - - A Session object that can be used to drive the model. - - -- - - - -#### `tf.train.Supervisor.RequestStop(ex=None)` {#Supervisor.RequestStop} - -Request that the coordinator stop the threads. - -See `Coordinator.request_stop()`. - -##### Args: - - -* `ex`: Optional `Exception`, or Python `exc_info` tuple as returned by - `sys.exc_info()`. If this is the first call to `request_stop()` the - corresponding exception is recorded and re-raised from `join()`. - - -- - - - -#### `tf.train.Supervisor.ShouldStop()` {#Supervisor.ShouldStop} - -Check if the coordinator was told to stop. - -See `Coordinator.should_stop()`. - -##### Returns: - - True if the coordinator was told to stop, False otherwise. - - -- - - - -#### `tf.train.Supervisor.StartQueueRunners(sess, queue_runners=None)` {#Supervisor.StartQueueRunners} - -Start threads for `QueueRunners`. - -Note that the queue runners collected in the graph key `QUEUE_RUNNERS` -are already started automatically when you create a session with the -supervisor, so unless you have non-collected queue runners to start -you do not need to call this explicitly. - -##### Args: - - -* `sess`: A `Session`. -* `queue_runners`: A list of `QueueRunners`. If not specified, we'll use the - list of queue runners gathered in the graph under the key - `GraphKeys.QUEUE_RUNNERS`. - -##### Returns: - - The list of threads started for the `QueueRunners`. - - -- - - - -#### `tf.train.Supervisor.StartStandardServices(sess)` {#Supervisor.StartStandardServices} - -Start the standard services for 'sess'. - -This starts services in the background. The services started depend -on the parameters to the constructor and may include: - - - A Summary thread computing summaries every save_summaries_secs. - - A Checkpoint thread saving the model every save_model_secs. - - A StepCounter thread measure step time. - -##### Args: - - -* `sess`: A Session. - -##### Returns: - - A list of threads that are running the standard services. You can use - the Supervisor's Coordinator to join these threads with: - sv.coord.Join() - -##### Raises: - - -* `RuntimeError`: If called with a non-chief Supervisor. -* `ValueError`: If not `logdir` was passed to the constructor as the - services need a log directory. - - -- - - - -#### `tf.train.Supervisor.Stop(threads=None, close_summary_writer=True)` {#Supervisor.Stop} - -Stop the services and the coordinator. - -This does not close the session. - -##### Args: - - -* `threads`: Optional list of threads to join with the coordinator. If - `None`, defaults to the threads running the standard services, the - threads started for `QueueRunners`, and the threads started by the - `loop()` method. To wait on additional threads, pass the - list in this parameter. -* `close_summary_writer`: Whether to close the `summary_writer`. Defaults to - `True` if the summary writer was created by the supervisor, `False` - otherwise. - - -- - - - -#### `tf.train.Supervisor.StopOnException()` {#Supervisor.StopOnException} - -Context handler to stop the supervisor when an exception is raised. - -See `Coordinator.stop_on_exception()`. - -##### Returns: - - A context handler. - - -- - - - -#### `tf.train.Supervisor.SummaryComputed(sess, summary, global_step=None)` {#Supervisor.SummaryComputed} - -Indicate that a summary was computed. - -##### Args: - - -* `sess`: A `Session` object. -* `summary`: A Summary proto, or a string holding a serialized summary proto. -* `global_step`: Int. global step this summary is associated with. If `None`, - it will try to fetch the current step. - -##### Raises: - - -* `TypeError`: if 'summary' is not a Summary proto or a string. -* `RuntimeError`: if the Supervisor was created without a `logdir`. - - -- - - - -#### `tf.train.Supervisor.WaitForStop()` {#Supervisor.WaitForStop} - -Block waiting for the coordinator to stop. - - -- - - - -#### `tf.train.Supervisor.coord` {#Supervisor.coord} - -Return the Coordinator used by the Supervisor. - -The Coordinator can be useful if you want to run multiple threads -during your training. - -##### Returns: - - A Coordinator object. - - -- - - - -#### `tf.train.Supervisor.global_step` {#Supervisor.global_step} - -Return the global_step Tensor used by the supervisor. - -##### Returns: - - An integer Tensor for the global_step. - - -- - - - -#### `tf.train.Supervisor.init_feed_dict` {#Supervisor.init_feed_dict} - -Return the feed dictionary used when evaluating the `init_op`. - -##### Returns: - - A feed dictionary or `None`. - - -- - - - -#### `tf.train.Supervisor.init_op` {#Supervisor.init_op} - -Return the Init Op used by the supervisor. - -##### Returns: - - An Op or `None`. - - -- - - - -#### `tf.train.Supervisor.is_chief` {#Supervisor.is_chief} - -Return True if this is a chief supervisor. - -##### Returns: - - A bool. - - -- - - - -#### `tf.train.Supervisor.loop(timer_interval_secs, target, args=None, kwargs=None)` {#Supervisor.loop} - -Start a LooperThread that calls a function periodically. - -If `timer_interval_secs` is None the thread calls `target(*args, **kwargs)` -repeatedly. Otherwise it calls it every `timer_interval_secs` -seconds. The thread terminates when a stop is requested. - -The started thread is added to the list of threads managed by the supervisor -so it does not need to be passed to the `stop()` method. - -##### Args: - - -* `timer_interval_secs`: Number. Time boundaries at which to call `target`. -* `target`: A callable object. -* `args`: Optional arguments to pass to `target` when calling it. -* `kwargs`: Optional keyword arguments to pass to `target` when calling it. - -##### Returns: - - The started thread. - - -- - - - -#### `tf.train.Supervisor.ready_for_local_init_op` {#Supervisor.ready_for_local_init_op} - - - - -- - - - -#### `tf.train.Supervisor.ready_op` {#Supervisor.ready_op} - -Return the Ready Op used by the supervisor. - -##### Returns: - - An Op or `None`. - - -- - - - -#### `tf.train.Supervisor.save_model_secs` {#Supervisor.save_model_secs} - -Return the delay between checkpoints. - -##### Returns: - - A timestamp. - - -- - - - -#### `tf.train.Supervisor.save_path` {#Supervisor.save_path} - -Return the save path used by the supervisor. - -##### Returns: - - A string. - - -- - - - -#### `tf.train.Supervisor.save_summaries_secs` {#Supervisor.save_summaries_secs} - -Return the delay between summary computations. - -##### Returns: - - A timestamp. - - -- - - - -#### `tf.train.Supervisor.saver` {#Supervisor.saver} - -Return the Saver used by the supervisor. - -##### Returns: - - A Saver object. - - -- - - - -#### `tf.train.Supervisor.session_manager` {#Supervisor.session_manager} - -Return the SessionManager used by the Supervisor. - -##### Returns: - - A SessionManager object. - - -- - - - -#### `tf.train.Supervisor.summary_op` {#Supervisor.summary_op} - -Return the Summary Tensor used by the chief supervisor. - -##### Returns: - - A string Tensor for the summary or `None`. - - -- - - - -#### `tf.train.Supervisor.summary_writer` {#Supervisor.summary_writer} - -Return the SummaryWriter used by the chief supervisor. - -##### Returns: - - A SummaryWriter. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.exponential_decay.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.exponential_decay.md deleted file mode 100644 index 4fb1a2b575..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.exponential_decay.md +++ /dev/null @@ -1,60 +0,0 @@ -### `tf.train.exponential_decay(learning_rate, global_step, decay_steps, decay_rate, staircase=False, name=None)` {#exponential_decay} - -Applies exponential decay to the learning rate. - -When training a model, it is often recommended to lower the learning rate as -the training progresses. This function applies an exponential decay function -to a provided initial learning rate. It requires a `global_step` value to -compute the decayed learning rate. You can just pass a TensorFlow variable -that you increment at each training step. - -The function returns the decayed learning rate. It is computed as: - -```python -decayed_learning_rate = learning_rate * - decay_rate ^ (global_step / decay_steps) -``` - -If the argument `staircase` is `True`, then `global_step / decay_steps` is an -integer division and the decayed learning rate follows a staircase function. - -Example: decay every 100000 steps with a base of 0.96: - -```python -... -global_step = tf.Variable(0, trainable=False) -starter_learning_rate = 0.1 -learning_rate = tf.train.exponential_decay(starter_learning_rate, global_step, - 100000, 0.96, staircase=True) -# Passing global_step to minimize() will increment it at each step. -learning_step = ( - tf.train.GradientDescentOptimizer(learning_rate) - .minimize(...my loss..., global_step=global_step) -) -``` - -##### Args: - - -* `learning_rate`: A scalar `float32` or `float64` `Tensor` or a - Python number. The initial learning rate. -* `global_step`: A scalar `int32` or `int64` `Tensor` or a Python number. - Global step to use for the decay computation. Must not be negative. -* `decay_steps`: A scalar `int32` or `int64` `Tensor` or a Python number. - Must be positive. See the decay computation above. -* `decay_rate`: A scalar `float32` or `float64` `Tensor` or a - Python number. The decay rate. -* `staircase`: Boolean. If `True` decay the learning rate at discrete intervals -* `name`: String. Optional name of the operation. Defaults to - 'ExponentialDecay'. - -##### Returns: - - A scalar `Tensor` of the same type as `learning_rate`. The decayed - learning rate. - -##### Raises: - - -* `ValueError`: if `global_step` is not supplied. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.slice_input_producer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.slice_input_producer.md deleted file mode 100644 index da888d0fc2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.train.slice_input_producer.md +++ /dev/null @@ -1,35 +0,0 @@ -### `tf.train.slice_input_producer(tensor_list, num_epochs=None, shuffle=True, seed=None, capacity=32, shared_name=None, name=None)` {#slice_input_producer} - -Produces a slice of each `Tensor` in `tensor_list`. - -Implemented using a Queue -- a `QueueRunner` for the Queue -is added to the current `Graph`'s `QUEUE_RUNNER` collection. - -##### Args: - - -* `tensor_list`: A list of `Tensor` objects. Every `Tensor` in - `tensor_list` must have the same size in the first dimension. -* `num_epochs`: An integer (optional). If specified, `slice_input_producer` - produces each slice `num_epochs` times before generating - an `OutOfRange` error. If not specified, `slice_input_producer` can cycle - through the slices an unlimited number of times. -* `shuffle`: Boolean. If true, the integers are randomly shuffled within each - epoch. -* `seed`: An integer (optional). Seed used if shuffle == True. -* `capacity`: An integer. Sets the queue capacity. -* `shared_name`: (optional). If set, this queue will be shared under the given - name across multiple sessions. -* `name`: A name for the operations (optional). - -##### Returns: - - A list of tensors, one for each element of `tensor_list`. If the tensor - in `tensor_list` has shape `[N, a, b, .., z]`, then the corresponding output - tensor will have shape `[a, b, ..., z]`. - -##### Raises: - - -* `ValueError`: if `slice_input_producer` produces nothing from `tensor_list`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.trainable_variables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.trainable_variables.md deleted file mode 100644 index 894d64a2b4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.trainable_variables.md +++ /dev/null @@ -1,13 +0,0 @@ -### `tf.trainable_variables()` {#trainable_variables} - -Returns all variables created with `trainable=True`. - -When passed `trainable=True`, the `Variable()` constructor automatically -adds new variables to the graph collection -`GraphKeys.TRAINABLE_VARIABLES`. This convenience function returns the -contents of that collection. - -##### Returns: - - A list of Variable objects. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.truncated_normal.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.truncated_normal.md deleted file mode 100644 index 9ae13882d3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf.truncated_normal.md +++ /dev/null @@ -1,27 +0,0 @@ -### `tf.truncated_normal(shape, mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None)` {#truncated_normal} - -Outputs random values from a truncated normal distribution. - -The generated values follow a normal distribution with specified mean and -standard deviation, except that values whose magnitude is more than 2 standard -deviations from the mean are dropped and re-picked. - -##### Args: - - -* `shape`: A 1-D integer Tensor or Python array. The shape of the output tensor. -* `mean`: A 0-D Tensor or Python value of type `dtype`. The mean of the - truncated normal distribution. -* `stddev`: A 0-D Tensor or Python value of type `dtype`. The standard deviation - of the truncated normal distribution. -* `dtype`: The type of the output. -* `seed`: A Python integer. Used to create a random seed for the distribution. - See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: A name for the operation (optional). - -##### Returns: - - A tensor of the specified shape filled with random truncated normal values. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf_debug.watch_graph.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf_debug.watch_graph.md deleted file mode 100644 index 5f206435bd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard6/tf_debug.watch_graph.md +++ /dev/null @@ -1,32 +0,0 @@ -### `tf_debug.watch_graph(run_options, graph, debug_ops='DebugIdentity', debug_urls=None, node_name_regex_whitelist=None, op_type_regex_whitelist=None, global_step=-1)` {#watch_graph} - -Add debug watches to `RunOptions` for a TensorFlow graph. - -To watch all `Tensor`s on the graph, let both `node_name_regex_whitelist` -and `op_type_regex_whitelist` be the default (`None`). - -N.B.: Under certain circumstances, not all specified `Tensor`s will be - actually watched (e.g., nodes that are constant-folded during runtime will - not be watched). - -##### Args: - - -* `run_options`: An instance of `config_pb2.RunOptions` to be modified. -* `graph`: An instance of `ops.Graph`. -* `debug_ops`: (`str` or `list` of `str`) name(s) of the debug op(s) to use. -* `debug_urls`: URLs to send debug values to. Can be a list of strings, - a single string, or None. The case of a single string is equivalent to - a list consisting of a single string, e.g., `file:///tmp/tfdbg_dump_1`, - `grpc://localhost:12345`. -* `node_name_regex_whitelist`: Regular-expression whitelist for node_name, - e.g., `"(weight_[0-9]+|bias_.*)"` -* `op_type_regex_whitelist`: Regular-expression whitelist for the op type of - nodes, e.g., `"(Variable|Add)"`. - If both `node_name_regex_whitelist` and `op_type_regex_whitelist` - are set, the two filtering operations will occur in a logical `AND` - relation. In other words, a node will be included if and only if it - hits both whitelists. -* `global_step`: (`int`) Optional global_step count for this debug tensor - watch. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.DeviceSpec.from_string.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.DeviceSpec.from_string.md deleted file mode 100644 index 5cbba0ada6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.DeviceSpec.from_string.md +++ /dev/null @@ -1,18 +0,0 @@ -#### `tf.DeviceSpec.from_string(spec)` {#DeviceSpec.from_string} - -Construct a `DeviceSpec` from a string. - -##### Args: - - -* `spec`: a string of the form - /job:/replica:/task:/device:CPU: - or - /job:/replica:/task:/device:GPU: - as cpu and gpu are mutually exclusive. - All entries are optional. - -##### Returns: - - A DeviceSpec. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.FixedLenFeature.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.FixedLenFeature.md deleted file mode 100644 index 55a007852a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.FixedLenFeature.md +++ /dev/null @@ -1,59 +0,0 @@ -Configuration for parsing a fixed-length input feature. - -To treat sparse input as dense, provide a `default_value`; otherwise, -the parse functions will fail on any examples missing this feature. - -Fields: - shape: Shape of input data. - dtype: Data type of input. - default_value: Value to be used if an example is missing this feature. It - must be compatible with `dtype`. -- - - - -#### `tf.FixedLenFeature.__getnewargs__()` {#FixedLenFeature.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.FixedLenFeature.__getstate__()` {#FixedLenFeature.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.FixedLenFeature.__new__(_cls, shape, dtype, default_value=None)` {#FixedLenFeature.__new__} - -Create new instance of FixedLenFeature(shape, dtype, default_value) - - -- - - - -#### `tf.FixedLenFeature.__repr__()` {#FixedLenFeature.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.FixedLenFeature.default_value` {#FixedLenFeature.default_value} - -Alias for field number 2 - - -- - - - -#### `tf.FixedLenFeature.dtype` {#FixedLenFeature.dtype} - -Alias for field number 1 - - -- - - - -#### `tf.FixedLenFeature.shape` {#FixedLenFeature.shape} - -Alias for field number 0 - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.Operation.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.Operation.md deleted file mode 100644 index 08323b592f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.Operation.md +++ /dev/null @@ -1,234 +0,0 @@ -Represents a graph node that performs computation on tensors. - -An `Operation` is a node in a TensorFlow `Graph` that takes zero or -more `Tensor` objects as input, and produces zero or more `Tensor` -objects as output. Objects of type `Operation` are created by -calling a Python op constructor (such as -[`tf.matmul()`](../../api_docs/python/math_ops.md#matmul)) -or [`Graph.create_op()`](../../api_docs/python/framework.md#Graph.create_op). - -For example `c = tf.matmul(a, b)` creates an `Operation` of type -"MatMul" that takes tensors `a` and `b` as input, and produces `c` -as output. - -After the graph has been launched in a session, an `Operation` can -be executed by passing it to -[`Session.run()`](../../api_docs/python/client.md#Session.run). -`op.run()` is a shortcut for calling `tf.get_default_session().run(op)`. -- - - - -#### `tf.Operation.__init__(node_def, g, inputs=None, output_types=None, control_inputs=None, input_types=None, original_op=None, op_def=None)` {#Operation.__init__} - -Creates an `Operation`. - -NOTE: This constructor validates the name of the `Operation` (passed -as `node_def.name`). Valid `Operation` names match the following -regular expression: - - [A-Za-z0-9.][A-Za-z0-9_.\\-/]* - -##### Args: - - -* `node_def`: `node_def_pb2.NodeDef`. `NodeDef` for the `Operation`. - Used for attributes of `node_def_pb2.NodeDef`, typically `name`, - `op`, and `device`. The `input` attribute is irrelevant here - as it will be computed when generating the model. -* `g`: `Graph`. The parent graph. -* `inputs`: list of `Tensor` objects. The inputs to this `Operation`. -* `output_types`: list of `DType` objects. List of the types of the - `Tensors` computed by this operation. The length of this list indicates - the number of output endpoints of the `Operation`. -* `control_inputs`: list of operations or tensors from which to have a - control dependency. -* `input_types`: List of `DType` objects representing the - types of the tensors accepted by the `Operation`. By default - uses `[x.dtype.base_dtype for x in inputs]`. Operations that expect - reference-typed inputs must specify these explicitly. -* `original_op`: Optional. Used to associate the new `Operation` with an - existing `Operation` (for example, a replica with the op that was - replicated). -* `op_def`: Optional. The `op_def_pb2.OpDef` proto that describes the - op type that this `Operation` represents. - -##### Raises: - - -* `TypeError`: if control inputs are not Operations or Tensors, - or if `node_def` is not a `NodeDef`, - or if `g` is not a `Graph`, - or if `inputs` are not tensors, - or if `inputs` and `input_types` are incompatible. -* `ValueError`: if the `node_def` name is not valid. - - -- - - - -#### `tf.Operation.__repr__()` {#Operation.__repr__} - - - - -- - - - -#### `tf.Operation.__str__()` {#Operation.__str__} - - - - -- - - - -#### `tf.Operation.colocation_groups()` {#Operation.colocation_groups} - -Returns the list of colocation groups of the op. - - -- - - - -#### `tf.Operation.control_inputs` {#Operation.control_inputs} - -The `Operation` objects on which this op has a control dependency. - -Before this op is executed, TensorFlow will ensure that the -operations in `self.control_inputs` have finished executing. This -mechanism can be used to run ops sequentially for performance -reasons, or to ensure that the side effects of an op are observed -in the correct order. - -##### Returns: - - A list of `Operation` objects. - - -- - - - -#### `tf.Operation.device` {#Operation.device} - -The name of the device to which this op has been assigned, if any. - -##### Returns: - - The string name of the device to which this op has been - assigned, or an empty string if it has not been assigned to a - device. - - -- - - - -#### `tf.Operation.get_attr(name)` {#Operation.get_attr} - -Returns the value of the attr of this op with the given `name`. - -##### Args: - - -* `name`: The name of the attr to fetch. - -##### Returns: - - The value of the attr, as a Python object. - -##### Raises: - - -* `ValueError`: If this op does not have an attr with the given `name`. - - -- - - - -#### `tf.Operation.graph` {#Operation.graph} - -The `Graph` that contains this operation. - - -- - - - -#### `tf.Operation.inputs` {#Operation.inputs} - -The list of `Tensor` objects representing the data inputs of this op. - - -- - - - -#### `tf.Operation.name` {#Operation.name} - -The full name of this operation. - - -- - - - -#### `tf.Operation.node_def` {#Operation.node_def} - -Returns a serialized `NodeDef` representation of this operation. - -##### Returns: - - A - [`NodeDef`](https://www.tensorflow.org/code/tensorflow/core/framework/node_def.proto) - protocol buffer. - - -- - - - -#### `tf.Operation.op_def` {#Operation.op_def} - -Returns the `OpDef` proto that represents the type of this op. - -##### Returns: - - An - [`OpDef`](https://www.tensorflow.org/code/tensorflow/core/framework/op_def.proto) - protocol buffer. - - -- - - - -#### `tf.Operation.outputs` {#Operation.outputs} - -The list of `Tensor` objects representing the outputs of this op. - - -- - - - -#### `tf.Operation.run(feed_dict=None, session=None)` {#Operation.run} - -Runs this operation in a `Session`. - -Calling this method will execute all preceding operations that -produce the inputs needed for this operation. - -*N.B.* Before invoking `Operation.run()`, its graph must have been -launched in a session, and either a default session must be -available, or `session` must be specified explicitly. - -##### Args: - - -* `feed_dict`: A dictionary that maps `Tensor` objects to feed values. - See [`Session.run()`](../../api_docs/python/client.md#Session.run) - for a description of the valid feed values. -* `session`: (Optional.) The `Session` to be used to run to this operation. If - none, the default session will be used. - - -- - - - -#### `tf.Operation.traceback` {#Operation.traceback} - -Returns the call stack from when this operation was constructed. - - -- - - - -#### `tf.Operation.type` {#Operation.type} - -The type of the op (e.g. `"MatMul"`). - - -- - - - -#### `tf.Operation.values()` {#Operation.values} - -DEPRECATED: Use outputs. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.PaddingFIFOQueue.from_list.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.PaddingFIFOQueue.from_list.md deleted file mode 100644 index 105b0fd4c6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.PaddingFIFOQueue.from_list.md +++ /dev/null @@ -1,21 +0,0 @@ -#### `tf.PaddingFIFOQueue.from_list(index, queues)` {#PaddingFIFOQueue.from_list} - -Create a queue using the queue reference from `queues[index]`. - -##### Args: - - -* `index`: An integer scalar tensor that determines the input that gets - selected. -* `queues`: A list of `QueueBase` objects. - -##### Returns: - - A `QueueBase` object. - -##### Raises: - - -* `TypeError`: When `queues` is not a list of `QueueBase` objects, - or when the data types of `queues` are not all the same. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.QueueBase.from_list.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.QueueBase.from_list.md deleted file mode 100644 index d9a2e7c71f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.QueueBase.from_list.md +++ /dev/null @@ -1,21 +0,0 @@ -#### `tf.QueueBase.from_list(index, queues)` {#QueueBase.from_list} - -Create a queue using the queue reference from `queues[index]`. - -##### Args: - - -* `index`: An integer scalar tensor that determines the input that gets - selected. -* `queues`: A list of `QueueBase` objects. - -##### Returns: - - A `QueueBase` object. - -##### Raises: - - -* `TypeError`: When `queues` is not a list of `QueueBase` objects, - or when the data types of `queues` are not all the same. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.as_dtype.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.as_dtype.md deleted file mode 100644 index 50a048aacb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.as_dtype.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.as_dtype(type_value)` {#as_dtype} - -Converts the given `type_value` to a `DType`. - -##### Args: - - -* `type_value`: A value that can be converted to a `tf.DType` - object. This may currently be a `tf.DType` object, a - [`DataType` enum](https://www.tensorflow.org/code/tensorflow/core/framework/types.proto), - a string type name, or a `numpy.dtype`. - -##### Returns: - - A `DType` corresponding to `type_value`. - -##### Raises: - - -* `TypeError`: If `type_value` cannot be converted to a `DType`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.assert_equal.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.assert_equal.md deleted file mode 100644 index b50abb29dd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.assert_equal.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.assert_equal(x, y, data=None, summarize=None, message=None, name=None)` {#assert_equal} - -Assert the condition `x == y` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_equal(x, y)]): - output = tf.reduce_sum(x) -``` - -This condition holds if for every pair of (possibly broadcast) elements -`x[i]`, `y[i]`, we have `x[i] == y[i]`. -If both `x` and `y` are empty, this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `y`: Numeric `Tensor`, same dtype as and broadcastable to `x`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`, `y`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_equal". - -##### Returns: - - Op that raises `InvalidArgumentError` if `x == y` is False. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.assert_variables_initialized.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.assert_variables_initialized.md deleted file mode 100644 index ac8604579d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.assert_variables_initialized.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.assert_variables_initialized(var_list=None)` {#assert_variables_initialized} - -Returns an Op to check if variables are initialized. - -NOTE: This function is obsolete and will be removed in 6 months. Please -change your implementation to use `report_uninitialized_variables()`. - -When run, the returned Op will raise the exception `FailedPreconditionError` -if any of the variables has not yet been initialized. - -Note: This function is implemented by trying to fetch the values of the -variables. If one of the variables is not initialized a message may be -logged by the C++ runtime. This is expected. - -##### Args: - - -* `var_list`: List of `Variable` objects to check. Defaults to the - value of `global_variables().` - -##### Returns: - - An Op, or None if there are no variables. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.bayesflow.entropy.renyi_ratio.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.bayesflow.entropy.renyi_ratio.md deleted file mode 100644 index 5b801848fc..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.bayesflow.entropy.renyi_ratio.md +++ /dev/null @@ -1,103 +0,0 @@ -### `tf.contrib.bayesflow.entropy.renyi_ratio(log_p, q, alpha, z=None, n=None, seed=None, name='renyi_ratio')` {#renyi_ratio} - -Monte Carlo estimate of the ratio appearing in Renyi divergence. - -This can be used to compute the Renyi (alpha) divergence, or a log evidence -approximation based on Renyi divergence. - -#### Definition - -With `z_i` iid samples from `q`, and `exp{log_p(z)} = p(z)`, this `Op` returns -the (biased for finite `n`) estimate: - -``` -(1 - alpha)^{-1} Log[ n^{-1} sum_{i=1}^n ( p(z_i) / q(z_i) )^{1 - alpha}, -\approx (1 - alpha)^{-1} Log[ E_q[ (p(Z) / q(Z))^{1 - alpha} ] ] -``` - -This ratio appears in different contexts: - -#### Renyi divergence - -If `log_p(z) = Log[p(z)]` is the log prob of a distribution, and -`alpha > 0`, `alpha != 1`, this `Op` approximates `-1` times Renyi divergence: - -``` -# Choose reasonably high n to limit bias, see below. -renyi_ratio(log_p, q, alpha, n=100) - \approx -1 * D_alpha[q || p], where -D_alpha[q || p] := (1 - alpha)^{-1} Log E_q[(p(Z) / q(Z))^{1 - alpha}] -``` - -The Renyi (or "alpha") divergence is non-negative and equal to zero iff -`q = p`. Various limits of `alpha` lead to different special case results: - -``` -alpha D_alpha[q || p] ------ --------------- ---> 0 Log[ int_{q > 0} p(z) dz ] -= 0.5, -2 Log[1 - Hel^2[q || p]], (\propto squared Hellinger distance) ---> 1 KL[q || p] -= 2 Log[ 1 + chi^2[q || p] ], (\propto squared Chi-2 divergence) ---> infty Log[ max_z{q(z) / p(z)} ], (min description length principle). -``` - -See "Renyi Divergence Variational Inference", by Li and Turner. - -#### Log evidence approximation - -If `log_p(z) = Log[p(z, x)]` is the log of the joint distribution `p`, this is -an alternative to the ELBO common in variational inference. - -``` -L_alpha(q, p) = Log[p(x)] - D_alpha[q || p] -``` - -If `q` and `p` have the same support, and `0 < a <= b < 1`, one can show -`ELBO <= D_b <= D_a <= Log[p(x)]`. Thus, this `Op` allows a smooth -interpolation between the ELBO and the true evidence. - -#### Stability notes - -Note that when `1 - alpha` is not small, the ratio `(p(z) / q(z))^{1 - alpha}` -is subject to underflow/overflow issues. For that reason, it is evaluated in -log-space after centering. Nonetheless, infinite/NaN results may occur. For -that reason, one may wish to shrink `alpha` gradually. See the `Op` -`renyi_alpha`. Using `float64` will also help. - - -#### Bias for finite sample size - -Due to nonlinearity of the logarithm, for random variables `{X_1,...,X_n}`, -`E[ Log[sum_{i=1}^n X_i] ] != Log[ E[sum_{i=1}^n X_i] ]`. As a result, this -estimate is biased for finite `n`. For `alpha < 1`, it is non-decreasing -with `n` (in expectation). For example, if `n = 1`, this estimator yields the -same result as `elbo_ratio`, and as `n` increases the expected value -of the estimator increases. - -#### Call signature - -User supplies either `Tensor` of samples `z`, or number of samples to draw `n` - -##### Args: - - -* `log_p`: Callable mapping samples from `q` to `Tensors` with - shape broadcastable to `q.batch_shape`. - For example, `log_p` works "just like" `q.log_prob`. -* `q`: `tf.contrib.distributions.Distribution`. - `float64` `dtype` recommended. - `log_p` and `q` should be supported on the same set. -* `alpha`: `Tensor` with shape `q.batch_shape` and values not equal to 1. -* `z`: `Tensor` of samples from `q`, produced by `q.sample` for some `n`. -* `n`: Integer `Tensor`. The number of samples to use if `z` is not provided. - Note that this can be highly biased for small `n`, see docstring. -* `seed`: Python integer to seed the random number generator. -* `name`: A name to give this `Op`. - -##### Returns: - - -* `renyi_result`: The scaled log of sample mean. `Tensor` with `shape` equal - to batch shape of `q`, and `dtype` = `q.dtype`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.ConditionalTransformedDistribution.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.ConditionalTransformedDistribution.md deleted file mode 100644 index 6607f5a275..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.ConditionalTransformedDistribution.md +++ /dev/null @@ -1,489 +0,0 @@ -A TransformedDistribution that allows intrinsic conditioning. -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.__init__(distribution, bijector=None, batch_shape=None, event_shape=None, validate_args=False, name=None)` {#ConditionalTransformedDistribution.__init__} - -Construct a Transformed Distribution. - -##### Args: - - -* `distribution`: The base distribution instance to transform. Typically an - instance of `Distribution`. -* `bijector`: The object responsible for calculating the transformation. - Typically an instance of `Bijector`. `None` means `Identity()`. -* `batch_shape`: `integer` vector `Tensor` which overrides `distribution` - `batch_shape`; valid only if `distribution.is_scalar_batch()`. -* `event_shape`: `integer` vector `Tensor` which overrides `distribution` - `event_shape`; valid only if `distribution.is_scalar_event()`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `name`: Python `str` name prefixed to Ops created by this class. Default: - `bijector.name + distribution.name`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.allow_nan_stats` {#ConditionalTransformedDistribution.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.batch_shape` {#ConditionalTransformedDistribution.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.batch_shape_tensor(name='batch_shape_tensor')` {#ConditionalTransformedDistribution.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.bijector` {#ConditionalTransformedDistribution.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.cdf(*args, **kwargs)` {#ConditionalTransformedDistribution.cdf} - -Additional documentation from `ConditionalTransformedDistribution`: - -##### `kwargs`: - -* `bijector_kwargs`: Python dictionary of arg names/values forwarded to the bijector. -* `distribution_kwargs`: Python dictionary of arg names/values forwarded to the distribution. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.copy(**override_parameters_kwargs)` {#ConditionalTransformedDistribution.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.covariance(name='covariance')` {#ConditionalTransformedDistribution.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.distribution` {#ConditionalTransformedDistribution.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.dtype` {#ConditionalTransformedDistribution.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.entropy(name='entropy')` {#ConditionalTransformedDistribution.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.event_shape` {#ConditionalTransformedDistribution.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.event_shape_tensor(name='event_shape_tensor')` {#ConditionalTransformedDistribution.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.is_continuous` {#ConditionalTransformedDistribution.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.is_scalar_batch(name='is_scalar_batch')` {#ConditionalTransformedDistribution.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.is_scalar_event(name='is_scalar_event')` {#ConditionalTransformedDistribution.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.log_cdf(*args, **kwargs)` {#ConditionalTransformedDistribution.log_cdf} - -Additional documentation from `ConditionalTransformedDistribution`: - -##### `kwargs`: - -* `bijector_kwargs`: Python dictionary of arg names/values forwarded to the bijector. -* `distribution_kwargs`: Python dictionary of arg names/values forwarded to the distribution. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.log_prob(*args, **kwargs)` {#ConditionalTransformedDistribution.log_prob} - -Additional documentation from `ConditionalTransformedDistribution`: - -##### `kwargs`: - -* `bijector_kwargs`: Python dictionary of arg names/values forwarded to the bijector. -* `distribution_kwargs`: Python dictionary of arg names/values forwarded to the distribution. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.log_survival_function(*args, **kwargs)` {#ConditionalTransformedDistribution.log_survival_function} - -Additional documentation from `ConditionalTransformedDistribution`: - -##### `kwargs`: - -* `bijector_kwargs`: Python dictionary of arg names/values forwarded to the bijector. -* `distribution_kwargs`: Python dictionary of arg names/values forwarded to the distribution. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.mean(name='mean')` {#ConditionalTransformedDistribution.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.mode(name='mode')` {#ConditionalTransformedDistribution.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.name` {#ConditionalTransformedDistribution.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#ConditionalTransformedDistribution.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.param_static_shapes(cls, sample_shape)` {#ConditionalTransformedDistribution.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.parameters` {#ConditionalTransformedDistribution.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.prob(*args, **kwargs)` {#ConditionalTransformedDistribution.prob} - -Additional documentation from `ConditionalTransformedDistribution`: - -##### `kwargs`: - -* `bijector_kwargs`: Python dictionary of arg names/values forwarded to the bijector. -* `distribution_kwargs`: Python dictionary of arg names/values forwarded to the distribution. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.reparameterization_type` {#ConditionalTransformedDistribution.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.sample(*args, **kwargs)` {#ConditionalTransformedDistribution.sample} - -##### `kwargs`: - -* `**condition_kwargs`: Named arguments forwarded to subclass implementation. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.stddev(name='stddev')` {#ConditionalTransformedDistribution.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.survival_function(*args, **kwargs)` {#ConditionalTransformedDistribution.survival_function} - -Additional documentation from `ConditionalTransformedDistribution`: - -##### `kwargs`: - -* `bijector_kwargs`: Python dictionary of arg names/values forwarded to the bijector. -* `distribution_kwargs`: Python dictionary of arg names/values forwarded to the distribution. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.validate_args` {#ConditionalTransformedDistribution.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.ConditionalTransformedDistribution.variance(name='variance')` {#ConditionalTransformedDistribution.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.ExponentialWithSoftplusRate.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.ExponentialWithSoftplusRate.md deleted file mode 100644 index d5ccf96744..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.ExponentialWithSoftplusRate.md +++ /dev/null @@ -1,565 +0,0 @@ -Exponential with softplus transform on `rate`. -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.__init__(rate, validate_args=False, allow_nan_stats=True, name='ExponentialWithSoftplusRate')` {#ExponentialWithSoftplusRate.__init__} - - - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.allow_nan_stats` {#ExponentialWithSoftplusRate.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.batch_shape` {#ExponentialWithSoftplusRate.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.batch_shape_tensor(name='batch_shape_tensor')` {#ExponentialWithSoftplusRate.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.cdf(value, name='cdf')` {#ExponentialWithSoftplusRate.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.concentration` {#ExponentialWithSoftplusRate.concentration} - -Concentration parameter. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.copy(**override_parameters_kwargs)` {#ExponentialWithSoftplusRate.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.covariance(name='covariance')` {#ExponentialWithSoftplusRate.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.dtype` {#ExponentialWithSoftplusRate.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.entropy(name='entropy')` {#ExponentialWithSoftplusRate.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.event_shape` {#ExponentialWithSoftplusRate.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.event_shape_tensor(name='event_shape_tensor')` {#ExponentialWithSoftplusRate.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.is_continuous` {#ExponentialWithSoftplusRate.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.is_scalar_batch(name='is_scalar_batch')` {#ExponentialWithSoftplusRate.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.is_scalar_event(name='is_scalar_event')` {#ExponentialWithSoftplusRate.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.log_cdf(value, name='log_cdf')` {#ExponentialWithSoftplusRate.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.log_prob(value, name='log_prob')` {#ExponentialWithSoftplusRate.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.log_survival_function(value, name='log_survival_function')` {#ExponentialWithSoftplusRate.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.mean(name='mean')` {#ExponentialWithSoftplusRate.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.mode(name='mode')` {#ExponentialWithSoftplusRate.mode} - -Mode. - -Additional documentation from `Gamma`: - -The mode of a gamma distribution is `(shape - 1) / rate` when -`shape > 1`, and `NaN` otherwise. If `self.allow_nan_stats` is `False`, -an exception will be raised rather than returning `NaN`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.name` {#ExponentialWithSoftplusRate.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#ExponentialWithSoftplusRate.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.param_static_shapes(cls, sample_shape)` {#ExponentialWithSoftplusRate.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.parameters` {#ExponentialWithSoftplusRate.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.prob(value, name='prob')` {#ExponentialWithSoftplusRate.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.rate` {#ExponentialWithSoftplusRate.rate} - - - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.reparameterization_type` {#ExponentialWithSoftplusRate.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.sample(sample_shape=(), seed=None, name='sample')` {#ExponentialWithSoftplusRate.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.stddev(name='stddev')` {#ExponentialWithSoftplusRate.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.survival_function(value, name='survival_function')` {#ExponentialWithSoftplusRate.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.validate_args` {#ExponentialWithSoftplusRate.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.ExponentialWithSoftplusRate.variance(name='variance')` {#ExponentialWithSoftplusRate.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.md deleted file mode 100644 index c5650c8055..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.md +++ /dev/null @@ -1,792 +0,0 @@ -The multivariate normal distribution on `R^k`. - -The Multivariate Normal distribution is defined over `R^k` and parameterized -by a (batch of) length-`k` `loc` vector (aka "mu") and a (batch of) `k x k` -`scale` matrix; `covariance = scale @ scale.T` where `@` denotes -matrix-multiplication. - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; loc, scale) = exp(-0.5 ||y||**2) / Z, -y = inv(scale) @ (x - loc), -Z = (2 pi)**(0.5 k) |det(scale)|, -``` - -where: - -* `loc` is a vector in `R^k`, -* `scale` is a linear operator in `R^{k x k}`, `cov = scale @ scale.T`, -* `Z` denotes the normalization constant, and, -* `||y||**2` denotes the squared Euclidean norm of `y`. - -A (non-batch) `scale` matrix is: - -```none -scale = diag(scale_diag + scale_identity_multiplier ones(k)) + - scale_perturb_factor @ diag(scale_perturb_diag) @ scale_perturb_factor.T -``` - -where: - -* `scale_diag.shape = [k]`, -* `scale_identity_multiplier.shape = []`, -* `scale_perturb_factor.shape = [k, r]`, typically `k >> r`, and, -* `scale_perturb_diag.shape = [r]`. - -Additional leading dimensions (if any) will index batches. - -If both `scale_diag` and `scale_identity_multiplier` are `None`, then -`scale` is the Identity matrix. - -The MultivariateNormal distribution is a member of the [location-scale -family](https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be -constructed as, - -```none -X ~ MultivariateNormal(loc=0, scale=1) # Identity scale, zero shift. -Y = scale @ X + loc -``` - -#### Examples - -```python -ds = tf.contrib.distributions - -# Initialize a single 3-variate Gaussian with covariance `cov = S @ S.T`, -# `S = diag(d) + U @ diag(m) @ U.T`. The perturbation, `U @ diag(m) @ U.T`, is -# a rank-2 update. -mu = [-0.5., 0, 0.5] # shape: [3] -d = [1.5, 0.5, 2] # shape: [3] -U = [[1., 2], - [-1, 1], - [2, -0.5]] # shape: [3, 2] -m = [4., 5] # shape: [2] -mvn = ds.MultivariateNormalDiagPlusLowRank( - loc=mu - scale_diag=d - scale_perturb_factor=U, - scale_perturb_diag=m) - -# Evaluate this on an observation in `R^3`, returning a scalar. -mvn.prob([-1, 0, 1]).eval() # shape: [] - -# Initialize a 2-batch of 3-variate Gaussians; `S = diag(d) + U @ U.T`. -mu = [[1., 2, 3], - [11, 22, 33]] # shape: [b, k] = [2, 3] -U = [[[1., 2], - [3, 4], - [5, 6]], - [[0.5, 0.75], - [1,0, 0.25], - [1.5, 1.25]]] # shape: [b, k, r] = [2, 3, 2] -m = [[0.1, 0.2], - [0.4, 0.5]] # shape: [b, r] = [2, 2] - -mvn = ds.MultivariateNormalDiagPlusLowRank( - loc=mu, - scale_perturb_factor=U, - scale_perturb_diag=m) - -mvn.covariance().eval() # shape: [2, 3, 3] -# ==> [[[ 15.63 31.57 48.51] -# [ 31.57 69.31 105.05] -# [ 48.51 105.05 162.59]] -# -# [[ 2.59 1.41 3.35] -# [ 1.41 2.71 3.34] -# [ 3.35 3.34 8.35]]] - -# Compute the pdf of two `R^3` observations (one from each batch); -# return a length-2 vector. -x = [[-0.9, 0, 0.1], - [-10, 0, 9]] # shape: [2, 3] -mvn.prob(x).eval() # shape: [2] -``` -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.__init__(loc=None, scale_diag=None, scale_identity_multiplier=None, scale_perturb_factor=None, scale_perturb_diag=None, validate_args=False, allow_nan_stats=True, name='MultivariateNormalDiagPlusLowRank')` {#MultivariateNormalDiagPlusLowRank.__init__} - -Construct Multivariate Normal distribution on `R^k`. - -The `batch_shape` is the broadcast shape between `loc` and `scale` -arguments. - -The `event_shape` is given by the last dimension of `loc` or the last -dimension of the matrix implied by `scale`. - -Recall that `covariance = scale @ scale.T`. A (non-batch) `scale` matrix is: - -```none -scale = diag(scale_diag + scale_identity_multiplier ones(k)) + - scale_perturb_factor @ diag(scale_perturb_diag) @ scale_perturb_factor.T -``` - -where: - -* `scale_diag.shape = [k]`, -* `scale_identity_multiplier.shape = []`, -* `scale_perturb_factor.shape = [k, r]`, typically `k >> r`, and, -* `scale_perturb_diag.shape = [r]`. - -Additional leading dimensions (if any) will index batches. - -If both `scale_diag` and `scale_identity_multiplier` are `None`, then -`scale` is the Identity matrix. - -##### Args: - - -* `loc`: Floating-point `Tensor`. If this is set to `None`, `loc` is - implicitly `0`. When specified, may have shape `[B1, ..., Bb, k]` where - `b >= 0` and `k` is the event size. -* `scale_diag`: Non-zero, floating-point `Tensor` representing a diagonal - matrix added to `scale`. May have shape `[B1, ..., Bb, k]`, `b >= 0`, - and characterizes `b`-batches of `k x k` diagonal matrices added to - `scale`. When both `scale_identity_multiplier` and `scale_diag` are - `None` then `scale` is the `Identity`. -* `scale_identity_multiplier`: Non-zero, floating-point `Tensor` representing - a scaled-identity-matrix added to `scale`. May have shape - `[B1, ..., Bb]`, `b >= 0`, and characterizes `b`-batches of scaled - `k x k` identity matrices added to `scale`. When both - `scale_identity_multiplier` and `scale_diag` are `None` then `scale` is - the `Identity`. -* `scale_perturb_factor`: Floating-point `Tensor` representing a rank-`r` - perturbation added to `scale`. May have shape `[B1, ..., Bb, k, r]`, - `b >= 0`, and characterizes `b`-batches of rank-`r` updates to `scale`. - When `None`, no rank-`r` update is added to `scale`. -* `scale_perturb_diag`: Floating-point `Tensor` representing a diagonal matrix - inside the rank-`r` perturbation added to `scale`. May have shape - `[B1, ..., Bb, r]`, `b >= 0`, and characterizes `b`-batches of `r x r` - diagonal matrices inside the perturbation added to `scale`. When - `None`, an identity matrix is used inside the perturbation. Can only be - specified if `scale_perturb_factor` is also specified. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, - statistics (e.g., mean, mode, variance) use the value "`NaN`" to - indicate the result is undefined. When `False`, an exception is raised - if one or more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `ValueError`: if at most `scale_identity_multiplier` is specified. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.allow_nan_stats` {#MultivariateNormalDiagPlusLowRank.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.batch_shape` {#MultivariateNormalDiagPlusLowRank.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.batch_shape_tensor(name='batch_shape_tensor')` {#MultivariateNormalDiagPlusLowRank.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.bijector` {#MultivariateNormalDiagPlusLowRank.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.cdf(value, name='cdf')` {#MultivariateNormalDiagPlusLowRank.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.copy(**override_parameters_kwargs)` {#MultivariateNormalDiagPlusLowRank.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.covariance(name='covariance')` {#MultivariateNormalDiagPlusLowRank.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.det_covariance(name='det_covariance')` {#MultivariateNormalDiagPlusLowRank.det_covariance} - -Determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.distribution` {#MultivariateNormalDiagPlusLowRank.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.dtype` {#MultivariateNormalDiagPlusLowRank.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.entropy(name='entropy')` {#MultivariateNormalDiagPlusLowRank.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.event_shape` {#MultivariateNormalDiagPlusLowRank.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.event_shape_tensor(name='event_shape_tensor')` {#MultivariateNormalDiagPlusLowRank.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.is_continuous` {#MultivariateNormalDiagPlusLowRank.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.is_scalar_batch(name='is_scalar_batch')` {#MultivariateNormalDiagPlusLowRank.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.is_scalar_event(name='is_scalar_event')` {#MultivariateNormalDiagPlusLowRank.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.loc` {#MultivariateNormalDiagPlusLowRank.loc} - -The `loc` `Tensor` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.log_cdf(value, name='log_cdf')` {#MultivariateNormalDiagPlusLowRank.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.log_det_covariance(name='log_det_covariance')` {#MultivariateNormalDiagPlusLowRank.log_det_covariance} - -Log of determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.log_prob(value, name='log_prob')` {#MultivariateNormalDiagPlusLowRank.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalDiagPlusLowRank.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.mean(name='mean')` {#MultivariateNormalDiagPlusLowRank.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.mode(name='mode')` {#MultivariateNormalDiagPlusLowRank.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.name` {#MultivariateNormalDiagPlusLowRank.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#MultivariateNormalDiagPlusLowRank.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.param_static_shapes(cls, sample_shape)` {#MultivariateNormalDiagPlusLowRank.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.parameters` {#MultivariateNormalDiagPlusLowRank.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.prob(value, name='prob')` {#MultivariateNormalDiagPlusLowRank.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.reparameterization_type` {#MultivariateNormalDiagPlusLowRank.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.sample(sample_shape=(), seed=None, name='sample')` {#MultivariateNormalDiagPlusLowRank.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.scale` {#MultivariateNormalDiagPlusLowRank.scale} - -The `scale` `LinearOperator` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.stddev(name='stddev')` {#MultivariateNormalDiagPlusLowRank.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.survival_function(value, name='survival_function')` {#MultivariateNormalDiagPlusLowRank.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.validate_args` {#MultivariateNormalDiagPlusLowRank.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalDiagPlusLowRank.variance(name='variance')` {#MultivariateNormalDiagPlusLowRank.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.Normal.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.Normal.md deleted file mode 100644 index 5454ae907f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.Normal.md +++ /dev/null @@ -1,639 +0,0 @@ -The Normal distribution with location `loc` and `scale` parameters. - -#### Mathematical details - -The probability density function (pdf) is, - -```none -pdf(x; mu, sigma) = exp(-0.5 (x - mu)**2 / sigma**2) / Z -Z = (2 pi sigma**2)**0.5 -``` - -where `loc = mu` is the mean, `scale = sigma` is the std. deviation, and, `Z` -is the normalization constant. - -The Normal distribution is a member of the [location-scale family]( -https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be -constructed as, - -```none -X ~ Normal(loc=0, scale=1) -Y = loc + scale * X -``` - -#### Examples - -Examples of initialization of one or a batch of distributions. - -```python -# Define a single scalar Normal distribution. -dist = tf.contrib.distributions.Normal(loc=0., scale=3.) - -# Evaluate the cdf at 1, returning a scalar. -dist.cdf(1.) - -# Define a batch of two scalar valued Normals. -# The first has mean 1 and standard deviation 11, the second 2 and 22. -dist = tf.contrib.distributions.Normal(loc=[1, 2.], scale=[11, 22.]) - -# Evaluate the pdf of the first distribution on 0, and the second on 1.5, -# returning a length two tensor. -dist.prob([0, 1.5]) - -# Get 3 samples, returning a 3 x 2 tensor. -dist.sample([3]) -``` - -Arguments are broadcast when possible. - -```python -# Define a batch of two scalar valued Normals. -# Both have mean 1, but different standard deviations. -dist = tf.contrib.distributions.Normal(loc=1., scale=[11, 22.]) - -# Evaluate the pdf of both distributions on the same point, 3.0, -# returning a length 2 tensor. -dist.prob(3.0) -``` -- - - - -#### `tf.contrib.distributions.Normal.__init__(loc, scale, validate_args=False, allow_nan_stats=True, name='Normal')` {#Normal.__init__} - -Construct Normal distributions with mean and stddev `loc` and `scale`. - -The parameters `loc` and `scale` must be shaped in a way that supports -broadcasting (e.g. `loc + scale` is a valid operation). - -##### Args: - - -* `loc`: Floating point tensor; the means of the distribution(s). -* `scale`: Floating point tensor; the stddevs of the distribution(s). - Must contain only positive values. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, - statistics (e.g., mean, mode, variance) use the value "`NaN`" to - indicate the result is undefined. When `False`, an exception is raised - if one or more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `TypeError`: if `loc` and `scale` have different `dtype`. - - -- - - - -#### `tf.contrib.distributions.Normal.allow_nan_stats` {#Normal.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Normal.batch_shape` {#Normal.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Normal.batch_shape_tensor(name='batch_shape_tensor')` {#Normal.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Normal.cdf(value, name='cdf')` {#Normal.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Normal.copy(**override_parameters_kwargs)` {#Normal.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Normal.covariance(name='covariance')` {#Normal.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Normal.dtype` {#Normal.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Normal.entropy(name='entropy')` {#Normal.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Normal.event_shape` {#Normal.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Normal.event_shape_tensor(name='event_shape_tensor')` {#Normal.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Normal.is_continuous` {#Normal.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Normal.is_scalar_batch(name='is_scalar_batch')` {#Normal.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Normal.is_scalar_event(name='is_scalar_event')` {#Normal.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Normal.loc` {#Normal.loc} - -Distribution parameter for the mean. - - -- - - - -#### `tf.contrib.distributions.Normal.log_cdf(value, name='log_cdf')` {#Normal.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Normal.log_prob(value, name='log_prob')` {#Normal.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Normal.log_survival_function(value, name='log_survival_function')` {#Normal.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Normal.mean(name='mean')` {#Normal.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Normal.mode(name='mode')` {#Normal.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Normal.name` {#Normal.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Normal.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Normal.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Normal.param_static_shapes(cls, sample_shape)` {#Normal.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Normal.parameters` {#Normal.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Normal.prob(value, name='prob')` {#Normal.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Normal.reparameterization_type` {#Normal.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Normal.sample(sample_shape=(), seed=None, name='sample')` {#Normal.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Normal.scale` {#Normal.scale} - -Distribution parameter for standard deviation. - - -- - - - -#### `tf.contrib.distributions.Normal.stddev(name='stddev')` {#Normal.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Normal.survival_function(value, name='survival_function')` {#Normal.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Normal.validate_args` {#Normal.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Normal.variance(name='variance')` {#Normal.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.RelaxedBernoulli.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.RelaxedBernoulli.md deleted file mode 100644 index f7af72d0f2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.RelaxedBernoulli.md +++ /dev/null @@ -1,706 +0,0 @@ -RelaxedBernoulli distribution with temperature and logits parameters. - -The RelaxedBernoulli is a distribution over the unit interval (0,1), which -continuously approximates a Bernoulli. The degree of approximation is -controlled by a temperature: as the temperaturegoes to 0 the RelaxedBernoulli -becomes discrete with a distribution described by the `logits` or `probs` -parameters, as the temperature goes to infinity the RelaxedBernoulli -becomes the constant distribution that is identically 0.5. - -The RelaxedBernoulli distribution is a reparameterized continuous -distribution that is the binary special case of the RelaxedOneHotCategorical -distribution (Maddison et al., 2016; Jang et al., 2016). For details on the -binary special case see the appendix of Maddison et al. (2016) where it is -referred to as BinConcrete. If you use this distribution, please cite both -papers. - -Some care needs to be taken for loss functions that depend on the -log-probability of RelaxedBernoullis, because computing log-probabilities of -the RelaxedBernoulli can suffer from underflow issues. In many case loss -functions such as these are invariant under invertible transformations of -the random variables. The KL divergence, found in the variational autoencoder -loss, is an example. Because RelaxedBernoullis are sampled by by a Logistic -random variable followed by a `tf.sigmoid` op, one solution is to treat -the Logistic as the random variable and `tf.sigmoid` as downstream. The -KL divergences of two Logistics, which are always followed by a `tf.sigmoid` -op, is equivalent to evaluating KL divergences of RelaxedBernoulli samples. -See Maddison et al., 2016 for more details where this distribution is called -the BinConcrete. - -An alternative approach is to evaluate Bernoulli log probability or KL -directly on relaxed samples, as done in Jang et al., 2016. In this case, -guarantees on the loss are usually violated. For instance, using a Bernoulli -KL in a relaxed ELBO is no longer a lower bound on the log marginal -probability of the observation. Thus care and early stopping are important. - -#### Examples - -Creates three continuous distributions, which approximate 3 Bernoullis with -probabilities (0.1, 0.5, 0.4). Samples from these distributions will be in -the unit interval (0,1). - -```python -temperature = 0.5 -p = [0.1, 0.5, 0.4] -dist = RelaxedBernoulli(temperature, probs=p) -``` - -Creates three continuous distributions, which approximate 3 Bernoullis with -logits (-2, 2, 0). Samples from these distributions will be in -the unit interval (0,1). - -```python -temperature = 0.5 -logits = [-2, 2, 0] -dist = RelaxedBernoulli(temperature, logits=logits) -``` - -Creates three continuous distributions, whose sigmoid approximate 3 Bernoullis -with logits (-2, 2, 0). - -```python -temperature = 0.5 -logits = [-2, 2, 0] -dist = Logistic(logits/temperature, 1./temperature) -samples = dist.sample() -sigmoid_samples = tf.sigmoid(samples) -# sigmoid_samples has the same distribution as samples from -# RelaxedBernoulli(temperature, logits=logits) -``` - -Creates three continuous distributions, which approximate 3 Bernoullis with -logits (-2, 2, 0). Samples from these distributions will be in -the unit interval (0,1). Because the temperature is very low, samples from -these distributions are almost discrete, usually taking values very close to 0 -or 1. - -```python -temperature = 1e-5 -logits = [-2, 2, 0] -dist = RelaxedBernoulli(temperature, logits=logits) -``` - -Creates three continuous distributions, which approximate 3 Bernoullis with -logits (-2, 2, 0). Samples from these distributions will be in -the unit interval (0,1). Because the temperature is very high, samples from -these distributions are usually close to the (0.5, 0.5, 0.5) vector. - -```python -temperature = 100 -logits = [-2, 2, 0] -dist = RelaxedBernoulli(temperature, logits=logits) -``` - -Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The Concrete Distribution: -A Continuous Relaxation of Discrete Random Variables. 2016. - -Eric Jang, Shixiang Gu, and Ben Poole. Categorical Reparameterization with -Gumbel-Softmax. 2016. -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.__init__(temperature, logits=None, probs=None, validate_args=False, allow_nan_stats=True, name='RelaxedBernoulli')` {#RelaxedBernoulli.__init__} - -Construct RelaxedBernoulli distributions. - -##### Args: - - -* `temperature`: An 0-D `Tensor`, representing the temperature - of a set of RelaxedBernoulli distributions. The temperature should be - positive. -* `logits`: An N-D `Tensor` representing the log-odds - of a positive event. Each entry in the `Tensor` parametrizes - an independent RelaxedBernoulli distribution where the probability of an - event is sigmoid(logits). Only one of `logits` or `probs` should be - passed in. -* `probs`: An N-D `Tensor` representing the probability of a positive event. - Each entry in the `Tensor` parameterizes an independent Bernoulli - distribution. Only one of `logits` or `probs` should be passed in. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `ValueError`: If both `probs` and `logits` are passed, or if neither. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.allow_nan_stats` {#RelaxedBernoulli.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.batch_shape` {#RelaxedBernoulli.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.batch_shape_tensor(name='batch_shape_tensor')` {#RelaxedBernoulli.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.bijector` {#RelaxedBernoulli.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.cdf(value, name='cdf')` {#RelaxedBernoulli.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.copy(**override_parameters_kwargs)` {#RelaxedBernoulli.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.covariance(name='covariance')` {#RelaxedBernoulli.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.distribution` {#RelaxedBernoulli.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.dtype` {#RelaxedBernoulli.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.entropy(name='entropy')` {#RelaxedBernoulli.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.event_shape` {#RelaxedBernoulli.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.event_shape_tensor(name='event_shape_tensor')` {#RelaxedBernoulli.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.is_continuous` {#RelaxedBernoulli.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.is_scalar_batch(name='is_scalar_batch')` {#RelaxedBernoulli.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.is_scalar_event(name='is_scalar_event')` {#RelaxedBernoulli.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.log_cdf(value, name='log_cdf')` {#RelaxedBernoulli.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.log_prob(value, name='log_prob')` {#RelaxedBernoulli.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.log_survival_function(value, name='log_survival_function')` {#RelaxedBernoulli.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.logits` {#RelaxedBernoulli.logits} - -Log-odds of `1`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.mean(name='mean')` {#RelaxedBernoulli.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.mode(name='mode')` {#RelaxedBernoulli.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.name` {#RelaxedBernoulli.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#RelaxedBernoulli.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.param_static_shapes(cls, sample_shape)` {#RelaxedBernoulli.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.parameters` {#RelaxedBernoulli.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.prob(value, name='prob')` {#RelaxedBernoulli.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.probs` {#RelaxedBernoulli.probs} - -Probability of `1`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.reparameterization_type` {#RelaxedBernoulli.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.sample(sample_shape=(), seed=None, name='sample')` {#RelaxedBernoulli.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.stddev(name='stddev')` {#RelaxedBernoulli.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.survival_function(value, name='survival_function')` {#RelaxedBernoulli.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.temperature` {#RelaxedBernoulli.temperature} - -Distribution parameter for the location. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.validate_args` {#RelaxedBernoulli.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.RelaxedBernoulli.variance(name='variance')` {#RelaxedBernoulli.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.bijector.Inline.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.bijector.Inline.md deleted file mode 100644 index c941b5ef65..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.bijector.Inline.md +++ /dev/null @@ -1,308 +0,0 @@ -Bijector constructed from custom callables. - -Example Use: - -```python -exp = Inline( - forward_fn=tf.exp, - inverse_fn=tf.log, - inverse_log_det_jacobian_fn=( - lambda y: -tf.reduce_sum(tf.log(y), axis=-1)), - name="exp") -``` - -The above example is equivalent to the `Bijector` `Exp(event_ndims=1)`. -- - - - -#### `tf.contrib.distributions.bijector.Inline.__init__(forward_fn=None, inverse_fn=None, inverse_log_det_jacobian_fn=None, forward_log_det_jacobian_fn=None, forward_event_shape_fn=None, forward_event_shape_tensor_fn=None, inverse_event_shape_fn=None, inverse_event_shape_tensor_fn=None, is_constant_jacobian=False, validate_args=False, name='inline')` {#Inline.__init__} - -Creates a `Bijector` from callables. - -##### Args: - - -* `forward_fn`: Python callable implementing the forward transformation. -* `inverse_fn`: Python callable implementing the inverse transformation. -* `inverse_log_det_jacobian_fn`: Python callable implementing the - log o det o jacobian of the inverse transformation. -* `forward_log_det_jacobian_fn`: Python callable implementing the - log o det o jacobian of the forward transformation. -* `forward_event_shape_fn`: Python callable implementing non-identical - static event shape changes. Default: shape is assumed unchanged. -* `forward_event_shape_tensor_fn`: Python callable implementing non-identical - event shape changes. Default: shape is assumed unchanged. -* `inverse_event_shape_fn`: Python callable implementing non-identical - static event shape changes. Default: shape is assumed unchanged. -* `inverse_event_shape_tensor_fn`: Python callable implementing non-identical - event shape changes. Default: shape is assumed unchanged. -* `is_constant_jacobian`: Python `bool` indicating that the Jacobian is - constant for all input arguments. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str`, name given to ops managed by this object. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.dtype` {#Inline.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.event_ndims` {#Inline.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.forward(x, name='forward')` {#Inline.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.forward_event_shape(input_shape)` {#Inline.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#Inline.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#Inline.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.graph_parents` {#Inline.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.inverse(y, name='inverse')` {#Inline.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#Inline.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.inverse_event_shape(output_shape)` {#Inline.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#Inline.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#Inline.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.is_constant_jacobian` {#Inline.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.name` {#Inline.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.Inline.validate_args` {#Inline.validate_args} - -Returns True if Tensor arguments will be validated. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.bijector.PowerTransform.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.bijector.PowerTransform.md deleted file mode 100644 index d95946499f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.bijector.PowerTransform.md +++ /dev/null @@ -1,301 +0,0 @@ -Compute `Y = g(X) = (1 + X * c)**(1 / c), X >= -1 / c`. - -The [power transform](https://en.wikipedia.org/wiki/Power_transform) maps -inputs from `[0, inf]` to `[-1/c, inf]`; this is equivalent to the `inverse` -of this bijector. - -This bijector is equivalent to the `Exp` bijector when `c=0`. -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.__init__(power=0.0, event_ndims=0, validate_args=False, name='power_transform')` {#PowerTransform.__init__} - -Instantiates the `PowerTransform` bijector. - -##### Args: - - -* `power`: Python `float` scalar indicating the transform power, i.e., - `Y = g(X) = (1 + X * c)**(1 / c)` where `c` is the `power`. -* `event_ndims`: Python scalar indicating the number of dimensions associated - with a particular draw from the distribution. -* `validate_args`: Python `bool` indicating whether arguments should be - checked for correctness. -* `name`: Python `str` name given to ops managed by this object. - -##### Raises: - - -* `ValueError`: if `power < 0` or is not known statically. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.dtype` {#PowerTransform.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.event_ndims` {#PowerTransform.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.forward(x, name='forward')` {#PowerTransform.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.forward_event_shape(input_shape)` {#PowerTransform.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#PowerTransform.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#PowerTransform.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.graph_parents` {#PowerTransform.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.inverse(y, name='inverse')` {#PowerTransform.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#PowerTransform.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.inverse_event_shape(output_shape)` {#PowerTransform.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#PowerTransform.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#PowerTransform.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.is_constant_jacobian` {#PowerTransform.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.name` {#PowerTransform.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.power` {#PowerTransform.power} - -The `c` in: `Y = g(X) = (1 + X * c)**(1 / c)`. - - -- - - - -#### `tf.contrib.distributions.bijector.PowerTransform.validate_args` {#PowerTransform.validate_args} - -Returns True if Tensor arguments will be validated. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.kl.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.kl.md deleted file mode 100644 index 59a41b2dd4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.distributions.kl.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.contrib.distributions.kl(dist_a, dist_b, allow_nan=False, name=None)` {#kl} - -Get the KL-divergence KL(dist_a || dist_b). - -If there is no KL method registered specifically for `type(dist_a)` and -`type(dist_b)`, then the class hierarchies of these types are searched. - -If one KL method is registered between any pairs of classes in these two -parent hierarchies, it is used. - -If more than one such registered method exists, the method whose registered -classes have the shortest sum MRO paths to the input types is used. - -If more than one such shortest path exists, the first method -identified in the search is used (favoring a shorter MRO distance to -`type(dist_a)`). - -##### Args: - - -* `dist_a`: The first distribution. -* `dist_b`: The second distribution. -* `allow_nan`: If `False` (default), a runtime error is raised - if the KL returns NaN values for any batch entry of the given - distributions. If `True`, the KL may return a NaN for the given entry. -* `name`: (optional) Name scope to use for created operations. - -##### Returns: - - A Tensor with the batchwise KL-divergence between dist_a and dist_b. - -##### Raises: - - -* `NotImplementedError`: If no KL method is defined for distribution types - of dist_a and dist_b. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.assert_or_get_global_step.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.assert_or_get_global_step.md deleted file mode 100644 index 0e67be8589..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.assert_or_get_global_step.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.contrib.framework.assert_or_get_global_step(graph=None, global_step_tensor=None)` {#assert_or_get_global_step} - -Verifies that a global step tensor is valid or gets one if None is given. - -If `global_step_tensor` is not None, check that it is a valid global step -tensor (using `assert_global_step`). Otherwise find a global step tensor using -`get_global_step` and return it. - -##### Args: - - -* `graph`: The graph to find the global step tensor for. -* `global_step_tensor`: The tensor to check for suitability as a global step. - If None is given (the default), find a global step tensor. - -##### Returns: - - A tensor suitable as a global step, or `None` if none was provided and none - was found. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.assign_from_values_fn.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.assign_from_values_fn.md deleted file mode 100644 index 9a5a82c8c4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.assign_from_values_fn.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.contrib.framework.assign_from_values_fn(var_names_to_values)` {#assign_from_values_fn} - -Returns a function that assigns specific variables from the given values. - -This function provides a mechanism for performing assignment of variables -to values in a way that does not fill the graph with large assignment values. - -##### Args: - - -* `var_names_to_values`: A map from variable names to values. - -##### Returns: - - A function that takes a single argument, a `tf.Session`, that applies the - assignment operation. - -##### Raises: - - -* `ValueError`: if any of the given variable names were not found. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.filter_variables.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.filter_variables.md deleted file mode 100644 index 1574edb406..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.filter_variables.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.contrib.framework.filter_variables(var_list, include_patterns=None, exclude_patterns=None, reg_search=True)` {#filter_variables} - -Filter a list of variables using regular expressions. - -First includes variables according to the list of include_patterns. -Afterwards, eliminates variables according to the list of exclude_patterns. - -For example, one can obtain a list of variables with the weights of all -convolutional layers (depending on the network definition) by: - -```python -variables = tf.contrib.framework.get_model_variables() -conv_weight_variables = tf.contrib.framework.filter_variables( - variables, - include_patterns=['Conv'], - exclude_patterns=['biases', 'Logits']) -``` - -##### Args: - - -* `var_list`: list of variables. -* `include_patterns`: list of regular expressions to include. Defaults to None, - which means all variables are selected according to the include rules. - A variable is included if it matches any of the include_patterns. -* `exclude_patterns`: list of regular expressions to exclude. Defaults to None, - which means all variables are selected according to the exclude rules. - A variable is excluded if it matches any of the exclude_patterns. -* `reg_search`: boolean. If True (default), performs re.search to find matches - (i.e. pattern can match any substring of the variable name). If False, - performs re.match (i.e. regexp should match from the beginning of the - variable name). - -##### Returns: - - filtered list of variables. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.get_variables_by_suffix.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.get_variables_by_suffix.md deleted file mode 100644 index a25cf9006e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.get_variables_by_suffix.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.contrib.framework.get_variables_by_suffix(suffix, scope=None)` {#get_variables_by_suffix} - -Gets the list of variables that end with the given suffix. - -##### Args: - - -* `suffix`: suffix for filtering the variables to return. -* `scope`: an optional scope for filtering the variables to return. - -##### Returns: - - a copied list of variables with the given name and prefix. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.has_arg_scope.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.has_arg_scope.md deleted file mode 100644 index 92f4a772ed..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.has_arg_scope.md +++ /dev/null @@ -1,13 +0,0 @@ -### `tf.contrib.framework.has_arg_scope(func)` {#has_arg_scope} - -Checks whether a func has been decorated with @add_arg_scope or not. - -##### Args: - - -* `func`: function to check. - -##### Returns: - - a boolean. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.with_shape.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.with_shape.md deleted file mode 100644 index 460c9c522c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.framework.with_shape.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.contrib.framework.with_shape(expected_shape, tensor)` {#with_shape} - -Asserts tensor has expected shape. - -If tensor shape and expected_shape, are fully defined, assert they match. -Otherwise, add assert op that will validate the shape when tensor is -evaluated, and set shape on tensor. - -##### Args: - - -* `expected_shape`: Expected shape to assert, as a 1D array of ints, or tensor - of same. -* `tensor`: Tensor whose shape we're validating. - -##### Returns: - - tensor, perhaps with a dependent assert operation. - -##### Raises: - - -* `ValueError`: if tensor has an invalid shape. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.make_placeholder_from_dtype_and_shape.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.make_placeholder_from_dtype_and_shape.md deleted file mode 100644 index b504100d0c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.make_placeholder_from_dtype_and_shape.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.contrib.graph_editor.make_placeholder_from_dtype_and_shape(dtype, shape=None, scope=None)` {#make_placeholder_from_dtype_and_shape} - -Create a tf.placeholder for the Graph Editor. - -Note that the correct graph scope must be set by the calling function. -The placeholder is named using the function placeholder_name (with no -tensor argument). - -##### Args: - - -* `dtype`: the tensor type. -* `shape`: the tensor shape (optional). -* `scope`: absolute scope within which to create the placeholder. None - means that the scope of t is preserved. "" means the root scope. - -##### Returns: - - A newly created tf.placeholder. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.make_view.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.make_view.md deleted file mode 100644 index b95f857600..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.make_view.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.contrib.graph_editor.make_view(*args, **kwargs)` {#make_view} - -Create a SubGraphView from selected operations and passthrough tensors. - -##### Args: - - -* `*args`: list of 1) regular expressions (compiled or not) or 2) (array of) - `tf.Operation` 3) (array of) `tf.Tensor`. Those objects will be converted - into a list of operations and a list of candidate for passthrough tensors. -* `**kwargs`: keyword graph is used 1) to check that the ops and ts are from - the correct graph 2) for regular expression query - -##### Returns: - - A subgraph view. - -##### Raises: - - -* `TypeError`: if the optional keyword argument graph is not a `tf.Graph` - or if an argument in args is not an (array of) `tf.Tensor` - or an (array of) `tf.Operation` or a string or a regular expression. -* `ValueError`: if one of the keyword arguments is unexpected. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.ph.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.ph.md deleted file mode 100644 index c765240585..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.ph.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.contrib.graph_editor.ph(dtype, shape=None, scope=None)` {#ph} - -Create a tf.placeholder for the Graph Editor. - -Note that the correct graph scope must be set by the calling function. -The placeholder is named using the function placeholder_name (with no -tensor argument). - -##### Args: - - -* `dtype`: the tensor type. -* `shape`: the tensor shape (optional). -* `scope`: absolute scope within which to create the placeholder. None - means that the scope of t is preserved. "" means the root scope. - -##### Returns: - - A newly created tf.placeholder. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.sgv.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.sgv.md deleted file mode 100644 index 80805e574f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.graph_editor.sgv.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.contrib.graph_editor.sgv(*args, **kwargs)` {#sgv} - -Create a SubGraphView from selected operations and passthrough tensors. - -##### Args: - - -* `*args`: list of 1) regular expressions (compiled or not) or 2) (array of) - `tf.Operation` 3) (array of) `tf.Tensor`. Those objects will be converted - into a list of operations and a list of candidate for passthrough tensors. -* `**kwargs`: keyword graph is used 1) to check that the ops and ts are from - the correct graph 2) for regular expression query - -##### Returns: - - A subgraph view. - -##### Raises: - - -* `TypeError`: if the optional keyword argument graph is not a `tf.Graph` - or if an argument in args is not an (array of) `tf.Tensor` - or an (array of) `tf.Operation` or a string or a regular expression. -* `ValueError`: if one of the keyword arguments is unexpected. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.convolution2d_transpose.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.convolution2d_transpose.md deleted file mode 100644 index 5a2ea65784..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.convolution2d_transpose.md +++ /dev/null @@ -1,52 +0,0 @@ -### `tf.contrib.layers.convolution2d_transpose(*args, **kwargs)` {#convolution2d_transpose} - -Adds a convolution2d_transpose with an optional batch normalization layer. - -The function creates a variable called `weights`, representing the -kernel, that is convolved with the input. If `batch_norm_params` is `None`, a -second variable called 'biases' is added to the result of the operation. - -##### Args: - - -* `inputs`: A 4-D `Tensor` of type `float` and shape - `[batch, height, width, in_channels]` for `NHWC` data format or - `[batch, in_channels, height, width]` for `NCHW` data format. -* `num_outputs`: Integer, the number of output filters. -* `kernel_size`: A list of length 2 holding the [kernel_height, kernel_width] of - of the filters. Can be an int if both values are the same. -* `stride`: A list of length 2: [stride_height, stride_width]. - Can be an int if both strides are the same. Note that presently - both strides must have the same value. -* `padding`: One of 'VALID' or 'SAME'. -* `data_format`: A string. `NHWC` (default) and `NCHW` are supported. -* `activation_fn`: Activation function. The default value is a ReLU function. - Explicitly set it to None to skip it and maintain a linear activation. -* `normalizer_fn`: Normalization function to use instead of `biases`. If - `normalizer_fn` is provided then `biases_initializer` and - `biases_regularizer` are ignored and `biases` are not created nor added. - default set to None for no normalizer function -* `normalizer_params`: Normalization function parameters. -* `weights_initializer`: An initializer for the weights. -* `weights_regularizer`: Optional regularizer for the weights. -* `biases_initializer`: An initializer for the biases. If None skip biases. -* `biases_regularizer`: Optional regularizer for the biases. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional list of collections for all the variables or - a dictionary containing a different list of collection per variable. -* `outputs_collections`: Collection to add the outputs. -* `trainable`: Whether or not the variables should be trainable or not. -* `scope`: Optional scope for variable_scope. - -##### Returns: - - A tensor representing the output of the operation. - -##### Raises: - - -* `ValueError`: If 'kernel_size' is not a list of length 2. -* `ValueError`: If `data_format` is neither `NHWC` nor `NCHW`. -* `ValueError`: If `C` dimension of `inputs` is None. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.input_from_feature_columns.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.input_from_feature_columns.md deleted file mode 100644 index e0d5391be9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.input_from_feature_columns.md +++ /dev/null @@ -1,58 +0,0 @@ -### `tf.contrib.layers.input_from_feature_columns(columns_to_tensors, feature_columns, weight_collections=None, trainable=True, scope=None)` {#input_from_feature_columns} - -A tf.contrib.layer style input layer builder based on FeatureColumns. - -Generally a single example in training data is described with feature columns. -At the first layer of the model, this column oriented data should be converted -to a single tensor. Each feature column needs a different kind of operation -during this conversion. For example sparse features need a totally different -handling than continuous features. - -Example: - -```python - # Building model for training - columns_to_tensor = tf.parse_example(...) - first_layer = input_from_feature_columns( - columns_to_tensors=columns_to_tensor, - feature_columns=feature_columns) - second_layer = fully_connected(inputs=first_layer, ...) - ... -``` - -where feature_columns can be defined as follows: - -```python - sparse_feature = sparse_column_with_hash_bucket( - column_name="sparse_col", ...) - sparse_feature_emb = embedding_column(sparse_id_column=sparse_feature, ...) - real_valued_feature = real_valued_column(...) - real_valued_buckets = bucketized_column( - source_column=real_valued_feature, ...) - - feature_columns=[sparse_feature_emb, real_valued_buckets] -``` - -##### Args: - - -* `columns_to_tensors`: A mapping from feature column to tensors. 'string' key - means a base feature (not-transformed). It can have FeatureColumn as a - key too. That means that FeatureColumn is already transformed by input - pipeline. For example, `inflow` may have handled transformations. -* `feature_columns`: A set containing all the feature columns. All items in the - set should be instances of classes derived by FeatureColumn. -* `weight_collections`: List of graph collections to which weights are added. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for variable_scope. - -##### Returns: - - A Tensor which can be consumed by hidden layers in the neural network. - -##### Raises: - - -* `ValueError`: if FeatureColumn cannot be consumed by a neural network. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.layer_norm.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.layer_norm.md deleted file mode 100644 index 277976dacf..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.layer_norm.md +++ /dev/null @@ -1,39 +0,0 @@ -### `tf.contrib.layers.layer_norm(*args, **kwargs)` {#layer_norm} - -Adds a Layer Normalization layer from https://arxiv.org/abs/1607.06450. - - "Layer Normalization" - - Jimmy Lei Ba, Jamie Ryan Kiros, Geoffrey E. Hinton - -Can be used as a normalizer function for conv2d and fully_connected. - -##### Args: - - -* `inputs`: A tensor with 2 or more dimensions. The normalization - occurs over all but the first dimension. -* `center`: If True, add offset of `beta` to normalized tensor. If False, `beta` - is ignored. -* `scale`: If True, multiply by `gamma`. If False, `gamma` is - not used. When the next layer is linear (also e.g. `nn.relu`), this can be - disabled since the scaling can be done by the next layer. -* `activation_fn`: Activation function, default set to None to skip it and - maintain a linear activation. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional collections for the variables. -* `outputs_collections`: Collections to add the outputs. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for `variable_scope`. - -##### Returns: - - A `Tensor` representing the output of the operation. - -##### Raises: - - -* `ValueError`: If rank or last dimension of `inputs` is undefined. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.sequence_input_from_feature_columns.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.sequence_input_from_feature_columns.md deleted file mode 100644 index 937cc2db48..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.sequence_input_from_feature_columns.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.contrib.layers.sequence_input_from_feature_columns(*args, **kwargs)` {#sequence_input_from_feature_columns} - -Builds inputs for sequence models from `FeatureColumn`s. (experimental) - -THIS FUNCTION IS EXPERIMENTAL. It may change or be removed at any time, and without warning. - - -See documentation for `input_from_feature_columns`. The following types of -`FeatureColumn` are permitted in `feature_columns`: `_OneHotColumn`, -`_EmbeddingColumn`, `_ScatteredEmbeddingColumn`, `_RealValuedColumn`, -`_DataFrameColumn`. In addition, columns in `feature_columns` may not be -constructed using any of the following: `ScatteredEmbeddingColumn`, -`BucketizedColumn`, `CrossedColumn`. - -##### Args: - - -* `columns_to_tensors`: A mapping from feature column to tensors. 'string' key - means a base feature (not-transformed). It can have FeatureColumn as a - key too. That means that FeatureColumn is already transformed by input - pipeline. For example, `inflow` may have handled transformations. -* `feature_columns`: A set containing all the feature columns. All items in the - set should be instances of classes derived by FeatureColumn. -* `weight_collections`: List of graph collections to which weights are added. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for variable_scope. - -##### Returns: - - A Tensor which can be consumed by hidden layers in the neural network. - -##### Raises: - - -* `ValueError`: if FeatureColumn cannot be consumed by a neural network. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.sparse_column_with_hash_bucket.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.sparse_column_with_hash_bucket.md deleted file mode 100644 index 0d00e31a68..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.layers.sparse_column_with_hash_bucket.md +++ /dev/null @@ -1,33 +0,0 @@ -### `tf.contrib.layers.sparse_column_with_hash_bucket(column_name, hash_bucket_size, combiner='sum', dtype=tf.string)` {#sparse_column_with_hash_bucket} - -Creates a _SparseColumn with hashed bucket configuration. - -Use this when your sparse features are in string or integer format, but you -don't have a vocab file that maps each value to an integer ID. -output_id = Hash(input_feature_string) % bucket_size - -##### Args: - - -* `column_name`: A string defining sparse column name. -* `hash_bucket_size`: An int that is > 1. The number of buckets. -* `combiner`: A string specifying how to reduce if the sparse column is - multivalent. Currently "mean", "sqrtn" and "sum" are supported, with "sum" - the default. "sqrtn" often achieves good accuracy, in particular with - bag-of-words columns. - * "sum": do not normalize features in the column - * "mean": do l1 normalization on features in the column - * "sqrtn": do l2 normalization on features in the column - For more information: `tf.embedding_lookup_sparse`. -* `dtype`: The type of features. Only string and integer types are supported. - -##### Returns: - - A _SparseColumn with hashed bucket configuration - -##### Raises: - - -* `ValueError`: hash_bucket_size is not greater than 2. -* `ValueError`: dtype is neither string nor integer. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.learn.InputFnOps.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.learn.InputFnOps.md deleted file mode 100644 index 4d65b070a1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.learn.InputFnOps.md +++ /dev/null @@ -1,64 +0,0 @@ -A return type for an input_fn. - -This return type is currently only supported for serving input_fn. -Training and eval input_fn should return a `(features, labels)` tuple. - -The expected return values are: - features: A dict of string to `Tensor` or `SparseTensor`, specifying the - features to be passed to the model. - labels: A `Tensor`, `SparseTensor`, or a dict of string to `Tensor` or - `SparseTensor`, specifying labels for training or eval. For serving, set - `labels` to `None`. - default_inputs: a dict of string to `Tensor` or `SparseTensor`, specifying - the input placeholders (if any) that this input_fn expects to be fed. - Typically, this is used by a serving input_fn, which expects to be fed - serialized `tf.Example` protos. -- - - - -#### `tf.contrib.learn.InputFnOps.__getnewargs__()` {#InputFnOps.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.contrib.learn.InputFnOps.__getstate__()` {#InputFnOps.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.contrib.learn.InputFnOps.__new__(_cls, features, labels, default_inputs)` {#InputFnOps.__new__} - -Create new instance of InputFnOps(features, labels, default_inputs) - - -- - - - -#### `tf.contrib.learn.InputFnOps.__repr__()` {#InputFnOps.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.contrib.learn.InputFnOps.default_inputs` {#InputFnOps.default_inputs} - -Alias for field number 2 - - -- - - - -#### `tf.contrib.learn.InputFnOps.features` {#InputFnOps.features} - -Alias for field number 0 - - -- - - - -#### `tf.contrib.learn.InputFnOps.labels` {#InputFnOps.labels} - -Alias for field number 1 - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.learn.build_parsing_serving_input_fn.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.learn.build_parsing_serving_input_fn.md deleted file mode 100644 index 41ee38cccc..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.learn.build_parsing_serving_input_fn.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.contrib.learn.build_parsing_serving_input_fn(feature_spec, default_batch_size=None)` {#build_parsing_serving_input_fn} - -Build an input_fn appropriate for serving, expecting fed tf.Examples. - -Creates an input_fn that expects a serialized tf.Example fed into a string -placeholder. The function parses the tf.Example according to the provided -feature_spec, and returns all parsed Tensors as features. This input_fn is -for use at serving time, so the labels return value is always None. - -##### Args: - - -* `feature_spec`: a dict of string to `VarLenFeature`/`FixedLenFeature`. -* `default_batch_size`: the number of query examples expected per batch. - Leave unset for variable batch size (recommended). - -##### Returns: - - An input_fn suitable for use in serving. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.learn.monitors.EveryN.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.learn.monitors.EveryN.md deleted file mode 100644 index 0caa4f902e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.learn.monitors.EveryN.md +++ /dev/null @@ -1,232 +0,0 @@ -Base class for monitors that execute callbacks every N steps. - -This class adds three new callbacks: - - every_n_step_begin - - every_n_step_end - - every_n_post_step - -The callbacks are executed every n steps, or optionally every step for the -first m steps, where m and n can both be user-specified. - -When extending this class, note that if you wish to use any of the -`BaseMonitor` callbacks, you must call their respective super implementation: - - def step_begin(self, step): - super(ExampleMonitor, self).step_begin(step) - return [] - -Failing to call the super implementation will cause unpredictable behavior. - -The `every_n_post_step()` callback is also called after the last step if it -was not already called through the regular conditions. Note that -`every_n_step_begin()` and `every_n_step_end()` do not receive that special -treatment. -- - - - -#### `tf.contrib.learn.monitors.EveryN.__init__(every_n_steps=100, first_n_steps=1)` {#EveryN.__init__} - -Initializes an `EveryN` monitor. - -##### Args: - - -* `every_n_steps`: `int`, the number of steps to allow between callbacks. -* `first_n_steps`: `int`, specifying the number of initial steps during - which the callbacks will always be executed, regardless of the value - of `every_n_steps`. Note that this value is relative to the global step - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.begin(max_steps=None)` {#EveryN.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.end(session=None)` {#EveryN.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.epoch_begin(epoch)` {#EveryN.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.epoch_end(epoch)` {#EveryN.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.every_n_post_step(step, session)` {#EveryN.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.every_n_step_begin(step)` {#EveryN.every_n_step_begin} - -Callback before every n'th step begins. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list` of tensors that will be evaluated at this step. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.every_n_step_end(step, outputs)` {#EveryN.every_n_step_end} - -Callback after every n'th step finished. - -This callback provides access to the tensors/ops evaluated at this step, -including the additional tensors for which evaluation was requested in -`step_begin`. - -In addition, the callback has the opportunity to stop training by returning -`True`. This is useful for early stopping, for example. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `outputs`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`. True if training should stop. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.post_step(step, session)` {#EveryN.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.run_on_all_workers` {#EveryN.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.set_estimator(estimator)` {#EveryN.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.step_begin(step)` {#EveryN.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.EveryN.step_end(step, output)` {#EveryN.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.legacy_seq2seq.model_with_buckets.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.legacy_seq2seq.model_with_buckets.md deleted file mode 100644 index 5bd387a527..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.legacy_seq2seq.model_with_buckets.md +++ /dev/null @@ -1,43 +0,0 @@ -### `tf.contrib.legacy_seq2seq.model_with_buckets(encoder_inputs, decoder_inputs, targets, weights, buckets, seq2seq, softmax_loss_function=None, per_example_loss=False, name=None)` {#model_with_buckets} - -Create a sequence-to-sequence model with support for bucketing. - -The seq2seq argument is a function that defines a sequence-to-sequence model, -e.g., seq2seq = lambda x, y: basic_rnn_seq2seq( - x, y, core_rnn_cell.GRUCell(24)) - -##### Args: - - -* `encoder_inputs`: A list of Tensors to feed the encoder; first seq2seq input. -* `decoder_inputs`: A list of Tensors to feed the decoder; second seq2seq input. -* `targets`: A list of 1D batch-sized int32 Tensors (desired output sequence). -* `weights`: List of 1D batch-sized float-Tensors to weight the targets. -* `buckets`: A list of pairs of (input size, output size) for each bucket. -* `seq2seq`: A sequence-to-sequence model function; it takes 2 input that - agree with encoder_inputs and decoder_inputs, and returns a pair - consisting of outputs and states (as, e.g., basic_rnn_seq2seq). -* `softmax_loss_function`: Function (inputs-batch, labels-batch) -> loss-batch - to be used instead of the standard softmax (the default if this is None). -* `per_example_loss`: Boolean. If set, the returned loss will be a batch-sized - tensor of losses for each sequence in the batch. If unset, it will be - a scalar with the averaged loss from all examples. -* `name`: Optional name for this operation, defaults to "model_with_buckets". - -##### Returns: - - A tuple of the form (outputs, losses), where: - -* `outputs`: The outputs for each bucket. Its j'th element consists of a list - of 2D Tensors. The shape of output tensors can be either - [batch_size x output_size] or [batch_size x num_decoder_symbols] - depending on the seq2seq model used. -* `losses`: List of scalar Tensors, representing losses for each bucket, or, - if per_example_loss is set, a list of 1D batch-sized float Tensors. - -##### Raises: - - -* `ValueError`: If length of encoder_inputsut, targets, or weights is smaller - than the largest (last) bucket. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.losses.softmax_cross_entropy.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.losses.softmax_cross_entropy.md deleted file mode 100644 index 2e4c434cd2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.losses.softmax_cross_entropy.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.contrib.losses.softmax_cross_entropy(*args, **kwargs)` {#softmax_cross_entropy} - -Creates a cross-entropy loss using tf.nn.softmax_cross_entropy_with_logits. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.softmax_cross_entropy instead. Note that the order of the logits and labels arguments has been changed. - -`weights` acts as a coefficient for the loss. If a scalar is provided, -then the loss is simply scaled by the given value. If `weights` is a -tensor of size [`batch_size`], then the loss weights apply to each -corresponding sample. - -If `label_smoothing` is nonzero, smooth the labels towards 1/num_classes: - new_onehot_labels = onehot_labels * (1 - label_smoothing) - + label_smoothing / num_classes - -##### Args: - - -* `logits`: [batch_size, num_classes] logits outputs of the network . -* `onehot_labels`: [batch_size, num_classes] one-hot-encoded labels. -* `weights`: Coefficients for the loss. The tensor must be a scalar or a tensor - of shape [batch_size]. -* `label_smoothing`: If greater than 0 then smooth the labels. -* `scope`: the scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the mean loss value. - -##### Raises: - - -* `ValueError`: If the shape of `logits` doesn't match that of `onehot_labels` - or if the shape of `weights` is invalid or if `weights` is None. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_mean_absolute_error.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_mean_absolute_error.md deleted file mode 100644 index 7b1f257677..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_mean_absolute_error.md +++ /dev/null @@ -1,51 +0,0 @@ -### `tf.contrib.metrics.streaming_mean_absolute_error(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_mean_absolute_error} - -Computes the mean absolute error between the labels and predictions. - -The `streaming_mean_absolute_error` function creates two local variables, -`total` and `count` that are used to compute the mean absolute error. This -average is weighted by `weights`, and it is ultimately returned as -`mean_absolute_error`: an idempotent operation that simply divides `total` by -`count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`mean_absolute_error`. Internally, an `absolute_errors` operation computes the -absolute value of the differences between `predictions` and `labels`. Then -`update_op` increments `total` with the reduced sum of the product of -`weights` and `absolute_errors`, and it increments `count` with the reduced -sum of `weights` - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A `Tensor` of arbitrary shape. -* `labels`: A `Tensor` of the same shape as `predictions`. -* `weights`: Optional `Tensor` indicating the frequency with which an example is - sampled. Rank must be 0, or the same rank as `labels`, and must be - broadcastable to `labels` (i.e., all dimensions must be either `1`, or - the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that - `mean_absolute_error` should be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `mean_absolute_error`: A `Tensor` representing the current mean, the value of - `total` divided by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `mean_absolute_error`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_precision.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_precision.md deleted file mode 100644 index 34a3eb0640..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_precision.md +++ /dev/null @@ -1,49 +0,0 @@ -### `tf.contrib.metrics.streaming_precision(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_precision} - -Computes the precision of the predictions with respect to the labels. - -The `streaming_precision` function creates two local variables, -`true_positives` and `false_positives`, that are used to compute the -precision. This value is ultimately returned as `precision`, an idempotent -operation that simply divides `true_positives` by the sum of `true_positives` -and `false_positives`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`precision`. `update_op` weights each prediction by the corresponding value in -`weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: The predicted values, a `bool` `Tensor` of arbitrary shape. -* `labels`: The ground truth values, a `bool` `Tensor` whose dimensions must - match `predictions`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that `precision` should - be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `precision`: Scalar float `Tensor` with the value of `true_positives` - divided by the sum of `true_positives` and `false_positives`. -* `update_op`: `Operation` that increments `true_positives` and - `false_positives` variables appropriately and whose value matches - `precision`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_sensitivity_at_specificity.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_sensitivity_at_specificity.md deleted file mode 100644 index 979083617d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_sensitivity_at_specificity.md +++ /dev/null @@ -1,56 +0,0 @@ -### `tf.contrib.metrics.streaming_sensitivity_at_specificity(predictions, labels, specificity, weights=None, num_thresholds=200, metrics_collections=None, updates_collections=None, name=None)` {#streaming_sensitivity_at_specificity} - -Computes the specificity at a given sensitivity. - -The `streaming_sensitivity_at_specificity` function creates four local -variables, `true_positives`, `true_negatives`, `false_positives` and -`false_negatives` that are used to compute the sensitivity at the given -specificity value. The threshold for the given specificity value is computed -and used to evaluate the corresponding sensitivity. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`sensitivity`. `update_op` increments the `true_positives`, `true_negatives`, -`false_positives` and `false_negatives` counts with the weight of each case -found in the `predictions` and `labels`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -For additional information about specificity and sensitivity, see the -following: https://en.wikipedia.org/wiki/Sensitivity_and_specificity - -##### Args: - - -* `predictions`: A floating point `Tensor` of arbitrary shape and whose values - are in the range `[0, 1]`. -* `labels`: A `bool` `Tensor` whose shape matches `predictions`. -* `specificity`: A scalar value in range `[0, 1]`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `num_thresholds`: The number of thresholds to use for matching the given - specificity. -* `metrics_collections`: An optional list of collections that `sensitivity` - should be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `sensitivity`: A scalar `Tensor` representing the sensitivity at the given - `specificity` value. -* `update_op`: An operation that increments the `true_positives`, - `true_negatives`, `false_positives` and `false_negatives` variables - appropriately and whose value matches `sensitivity`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, if - `weights` is not `None` and its shape doesn't match `predictions`, or if - `specificity` is not between 0 and 1, or if either `metrics_collections` - or `updates_collections` are not a list or tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_specificity_at_sensitivity.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_specificity_at_sensitivity.md deleted file mode 100644 index ed12bd4657..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_specificity_at_sensitivity.md +++ /dev/null @@ -1,56 +0,0 @@ -### `tf.contrib.metrics.streaming_specificity_at_sensitivity(predictions, labels, sensitivity, weights=None, num_thresholds=200, metrics_collections=None, updates_collections=None, name=None)` {#streaming_specificity_at_sensitivity} - -Computes the specificity at a given sensitivity. - -The `streaming_specificity_at_sensitivity` function creates four local -variables, `true_positives`, `true_negatives`, `false_positives` and -`false_negatives` that are used to compute the specificity at the given -sensitivity value. The threshold for the given sensitivity value is computed -and used to evaluate the corresponding specificity. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`specificity`. `update_op` increments the `true_positives`, `true_negatives`, -`false_positives` and `false_negatives` counts with the weight of each case -found in the `predictions` and `labels`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -For additional information about specificity and sensitivity, see the -following: https://en.wikipedia.org/wiki/Sensitivity_and_specificity - -##### Args: - - -* `predictions`: A floating point `Tensor` of arbitrary shape and whose values - are in the range `[0, 1]`. -* `labels`: A `bool` `Tensor` whose shape matches `predictions`. -* `sensitivity`: A scalar value in range `[0, 1]`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `num_thresholds`: The number of thresholds to use for matching the given - sensitivity. -* `metrics_collections`: An optional list of collections that `specificity` - should be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `specificity`: A scalar `Tensor` representing the specificity at the given - `specificity` value. -* `update_op`: An operation that increments the `true_positives`, - `true_negatives`, `false_positives` and `false_negatives` variables - appropriately and whose value matches `specificity`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, if - `weights` is not `None` and its shape doesn't match `predictions`, or if - `sensitivity` is not between 0 and 1, or if either `metrics_collections` - or `updates_collections` are not a list or tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_true_positives_at_thresholds.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_true_positives_at_thresholds.md deleted file mode 100644 index 685b0ba5e9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.metrics.streaming_true_positives_at_thresholds.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.metrics.streaming_true_positives_at_thresholds(predictions, labels, thresholds, weights=None)` {#streaming_true_positives_at_thresholds} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.opt.ExternalOptimizerInterface.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.opt.ExternalOptimizerInterface.md deleted file mode 100644 index 7a9d543863..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.opt.ExternalOptimizerInterface.md +++ /dev/null @@ -1,56 +0,0 @@ -Base class for interfaces with external optimization algorithms. - -Subclass this and implement `_minimize` in order to wrap a new optimization -algorithm. - -`ExternalOptimizerInterface` should not be instantiated directly; instead use -e.g. `ScipyOptimizerInterface`. - -- - - - -#### `tf.contrib.opt.ExternalOptimizerInterface.__init__(loss, var_list=None, equalities=None, inequalities=None, **optimizer_kwargs)` {#ExternalOptimizerInterface.__init__} - -Initialize a new interface instance. - -##### Args: - - -* `loss`: A scalar `Tensor` to be minimized. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `equalities`: Optional list of equality constraint scalar `Tensor`s to be - held equal to zero. -* `inequalities`: Optional list of inequality constraint scalar `Tensor`s - to be kept nonnegative. -* `**optimizer_kwargs`: Other subclass-specific keyword arguments. - - - -- - - - -#### `tf.contrib.opt.ExternalOptimizerInterface.minimize(session=None, feed_dict=None, fetches=None, step_callback=None, loss_callback=None)` {#ExternalOptimizerInterface.minimize} - -Minimize a scalar `Tensor`. - -Variables subject to optimization are updated in-place at the end of -optimization. - -Note that this method does *not* just return a minimization `Op`, unlike -`Optimizer.minimize()`; instead it actually performs minimization by -executing commands to control a `Session`. - -##### Args: - - -* `session`: A `Session` instance. -* `feed_dict`: A feed dict to be passed to calls to `session.run`. -* `fetches`: A list of `Tensor`s to fetch and supply to `loss_callback` - as positional arguments. -* `step_callback`: A function to be called at each optimization step; - arguments are the current values of all optimization variables - flattened into a single vector. -* `loss_callback`: A function to be called every time the loss and gradients - are computed, with evaluated fetches supplied as positional arguments. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.BasicRNNCell.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.BasicRNNCell.md deleted file mode 100644 index 9f13497f47..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.BasicRNNCell.md +++ /dev/null @@ -1,51 +0,0 @@ -The most basic RNN cell. -- - - - -#### `tf.contrib.rnn.BasicRNNCell.__call__(inputs, state, scope=None)` {#BasicRNNCell.__call__} - -Most basic RNN: output = new_state = act(W * input + U * state + B). - - -- - - - -#### `tf.contrib.rnn.BasicRNNCell.__init__(num_units, input_size=None, activation=tanh)` {#BasicRNNCell.__init__} - - - - -- - - - -#### `tf.contrib.rnn.BasicRNNCell.output_size` {#BasicRNNCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.BasicRNNCell.state_size` {#BasicRNNCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.BasicRNNCell.zero_state(batch_size, dtype)` {#BasicRNNCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.FusedRNNCellAdaptor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.FusedRNNCellAdaptor.md deleted file mode 100644 index 18ee35ad47..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.FusedRNNCellAdaptor.md +++ /dev/null @@ -1,21 +0,0 @@ -This is an adaptor for RNNCell classes to be used with `FusedRNNCell`. -- - - - -#### `tf.contrib.rnn.FusedRNNCellAdaptor.__call__(inputs, initial_state=None, dtype=None, sequence_length=None, scope=None)` {#FusedRNNCellAdaptor.__call__} - - - - -- - - - -#### `tf.contrib.rnn.FusedRNNCellAdaptor.__init__(cell, use_dynamic_rnn=False)` {#FusedRNNCellAdaptor.__init__} - -Initialize the adaptor. - -##### Args: - - -* `cell`: an instance of a subclass of a `rnn_cell.RNNCell`. -* `use_dynamic_rnn`: whether to use dynamic (or static) RNN. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.LSTMBlockFusedCell.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.LSTMBlockFusedCell.md deleted file mode 100644 index ccd8831ec6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.LSTMBlockFusedCell.md +++ /dev/null @@ -1,72 +0,0 @@ -FusedRNNCell implementation of LSTM. - -This is an extremely efficient LSTM implementation, that uses a single TF op -for the entire LSTM. It should be both faster and more memory-efficient than -LSTMBlockCell defined above. - -The implementation is based on: http://arxiv.org/abs/1409.2329. - -We add forget_bias (default: 1) to the biases of the forget gate in order to -reduce the scale of forgetting in the beginning of the training. - -The variable naming is consistent with `core_rnn_cell.LSTMCell`. -- - - - -#### `tf.contrib.rnn.LSTMBlockFusedCell.__call__(inputs, initial_state=None, dtype=None, sequence_length=None, scope=None)` {#LSTMBlockFusedCell.__call__} - -Run this LSTM on inputs, starting from the given state. - -##### Args: - - -* `inputs`: `3-D` tensor with shape `[time_len, batch_size, input_size]` - or a list of `time_len` tensors of shape `[batch_size, input_size]`. -* `initial_state`: a tuple `(initial_cell_state, initial_output)` with tensors - of shape `[batch_size, self._num_units]`. If this is not provided, the - cell is expected to create a zero initial state of type `dtype`. -* `dtype`: The data type for the initial state and expected output. Required - if `initial_state` is not provided or RNN state has a heterogeneous - dtype. -* `sequence_length`: Specifies the length of each sequence in inputs. An - `int32` or `int64` vector (tensor) size `[batch_size]`, values in `[0, - time_len).` - Defaults to `time_len` for each element. -* `scope`: `VariableScope` for the created subgraph; defaults to class name. - -##### Returns: - - A pair containing: - - - Output: A `3-D` tensor of shape `[time_len, batch_size, output_size]` - or a list of time_len tensors of shape `[batch_size, output_size]`, - to match the type of the `inputs`. - - Final state: a tuple `(cell_state, output)` matching `initial_state`. - -##### Raises: - - -* `ValueError`: in case of shape mismatches - - -- - - - -#### `tf.contrib.rnn.LSTMBlockFusedCell.__init__(num_units, forget_bias=1.0, cell_clip=None, use_peephole=False)` {#LSTMBlockFusedCell.__init__} - -Initialize the LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell. -* `forget_bias`: float, The bias added to forget gates (see above). -* `cell_clip`: clip the cell to this value. Defaults to `3`. -* `use_peephole`: Whether to use peephole connections or not. - - -- - - - -#### `tf.contrib.rnn.LSTMBlockFusedCell.num_units` {#LSTMBlockFusedCell.num_units} - -Number of units in this cell (output dimension). - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.LSTMCell.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.LSTMCell.md deleted file mode 100644 index 0d380d1e2e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.LSTMCell.md +++ /dev/null @@ -1,124 +0,0 @@ -Long short-term memory unit (LSTM) recurrent network cell. - -The default non-peephole implementation is based on: - - http://deeplearning.cs.cmu.edu/pdfs/Hochreiter97_lstm.pdf - -S. Hochreiter and J. Schmidhuber. -"Long Short-Term Memory". Neural Computation, 9(8):1735-1780, 1997. - -The peephole implementation is based on: - - https://research.google.com/pubs/archive/43905.pdf - -Hasim Sak, Andrew Senior, and Francoise Beaufays. -"Long short-term memory recurrent neural network architectures for - large scale acoustic modeling." INTERSPEECH, 2014. - -The class uses optional peep-hole connections, optional cell clipping, and -an optional projection layer. -- - - - -#### `tf.contrib.rnn.LSTMCell.__call__(inputs, state, scope=None)` {#LSTMCell.__call__} - -Run one step of LSTM. - -##### Args: - - -* `inputs`: input Tensor, 2D, batch x num_units. -* `state`: if `state_is_tuple` is False, this must be a state Tensor, - `2-D, batch x state_size`. If `state_is_tuple` is True, this must be a - tuple of state Tensors, both `2-D`, with column sizes `c_state` and - `m_state`. -* `scope`: VariableScope for the created subgraph; defaults to "lstm_cell". - -##### Returns: - - A tuple containing: - - - A `2-D, [batch x output_dim]`, Tensor representing the output of the - LSTM after reading `inputs` when previous state was `state`. - Here output_dim is: - num_proj if num_proj was set, - num_units otherwise. - - Tensor(s) representing the new state of LSTM after reading `inputs` when - the previous state was `state`. Same type and shape(s) as `state`. - -##### Raises: - - -* `ValueError`: If input size cannot be inferred from inputs via - static shape inference. - - -- - - - -#### `tf.contrib.rnn.LSTMCell.__init__(num_units, input_size=None, use_peepholes=False, cell_clip=None, initializer=None, num_proj=None, proj_clip=None, num_unit_shards=None, num_proj_shards=None, forget_bias=1.0, state_is_tuple=True, activation=tanh)` {#LSTMCell.__init__} - -Initialize the parameters for an LSTM cell. - -##### Args: - - -* `num_units`: int, The number of units in the LSTM cell -* `input_size`: Deprecated and unused. -* `use_peepholes`: bool, set True to enable diagonal/peephole connections. -* `cell_clip`: (optional) A float value, if provided the cell state is clipped - by this value prior to the cell output activation. -* `initializer`: (optional) The initializer to use for the weight and - projection matrices. -* `num_proj`: (optional) int, The output dimensionality for the projection - matrices. If None, no projection is performed. -* `proj_clip`: (optional) A float value. If `num_proj > 0` and `proj_clip` is - provided, then the projected values are clipped elementwise to within - `[-proj_clip, proj_clip]`. -* `num_unit_shards`: Deprecated, will be removed by Jan. 2017. - Use a variable_scope partitioner instead. -* `num_proj_shards`: Deprecated, will be removed by Jan. 2017. - Use a variable_scope partitioner instead. -* `forget_bias`: Biases of the forget gate are initialized by default to 1 - in order to reduce the scale of forgetting at the beginning of - the training. -* `state_is_tuple`: If True, accepted and returned states are 2-tuples of - the `c_state` and `m_state`. If False, they are concatenated - along the column axis. This latter behavior will soon be deprecated. -* `activation`: Activation function of the inner states. - - -- - - - -#### `tf.contrib.rnn.LSTMCell.output_size` {#LSTMCell.output_size} - - - - -- - - - -#### `tf.contrib.rnn.LSTMCell.state_size` {#LSTMCell.state_size} - - - - -- - - - -#### `tf.contrib.rnn.LSTMCell.zero_state(batch_size, dtype)` {#LSTMCell.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.ResidualWrapper.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.ResidualWrapper.md deleted file mode 100644 index 7434d63eba..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.rnn.ResidualWrapper.md +++ /dev/null @@ -1,73 +0,0 @@ -RNNCell wrapper that ensures cell inputs are added to the outputs. -- - - - -#### `tf.contrib.rnn.ResidualWrapper.__call__(inputs, state, scope=None)` {#ResidualWrapper.__call__} - -Run the cell and add its inputs to its outputs. - -##### Args: - - -* `inputs`: cell inputs. -* `state`: cell state. -* `scope`: optional cell scope. - -##### Returns: - - Tuple of cell outputs and new state. - -##### Raises: - - -* `TypeError`: If cell inputs and outputs have different structure (type). -* `ValueError`: If cell inputs and outputs have different structure (value). - - -- - - - -#### `tf.contrib.rnn.ResidualWrapper.__init__(cell)` {#ResidualWrapper.__init__} - -Constructs a `ResidualWrapper` for `cell`. - -##### Args: - - -* `cell`: An instance of `RNNCell`. - - -- - - - -#### `tf.contrib.rnn.ResidualWrapper.output_size` {#ResidualWrapper.output_size} - - - - -- - - - -#### `tf.contrib.rnn.ResidualWrapper.state_size` {#ResidualWrapper.state_size} - - - - -- - - - -#### `tf.contrib.rnn.ResidualWrapper.zero_state(batch_size, dtype)` {#ResidualWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.util.make_ndarray.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.util.make_ndarray.md deleted file mode 100644 index 7b2a81d48e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.contrib.util.make_ndarray.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.contrib.util.make_ndarray(tensor)` {#make_ndarray} - -Create a numpy ndarray from a tensor. - -Create a numpy ndarray with the same shape and data as the tensor. - -##### Args: - - -* `tensor`: A TensorProto. - -##### Returns: - - A numpy array with the tensor contents. - -##### Raises: - - -* `TypeError`: if tensor has unsupported type. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.count_up_to.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.count_up_to.md deleted file mode 100644 index 97f802372c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.count_up_to.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.count_up_to(ref, limit, name=None)` {#count_up_to} - -Increments 'ref' until it reaches 'limit'. - -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: `int32`, `int64`. - Should be from a scalar `Variable` node. -* `limit`: An `int`. - If incrementing ref would bring it above limit, instead generates an - 'OutOfRange' error. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `ref`. - A copy of the input before increment. If nothing else modifies the - input, the values produced will all be distinct. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.dynamic_stitch.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.dynamic_stitch.md deleted file mode 100644 index 3eaba84d7c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.dynamic_stitch.md +++ /dev/null @@ -1,59 +0,0 @@ -### `tf.dynamic_stitch(indices, data, name=None)` {#dynamic_stitch} - -Interleave the values from the `data` tensors into a single tensor. - -Builds a merged tensor such that - -```python - merged[indices[m][i, ..., j], ...] = data[m][i, ..., j, ...] -``` - -For example, if each `indices[m]` is scalar or vector, we have - -```python - # Scalar indices: - merged[indices[m], ...] = data[m][...] - - # Vector indices: - merged[indices[m][i], ...] = data[m][i, ...] -``` - -Each `data[i].shape` must start with the corresponding `indices[i].shape`, -and the rest of `data[i].shape` must be constant w.r.t. `i`. That is, we -must have `data[i].shape = indices[i].shape + constant`. In terms of this -`constant`, the output shape is - - merged.shape = [max(indices)] + constant - -Values are merged in order, so if an index appears in both `indices[m][i]` and -`indices[n][j]` for `(m,i) < (n,j)` the slice `data[n][j]` will appear in the -merged result. - -For example: - -```python - indices[0] = 6 - indices[1] = [4, 1] - indices[2] = [[5, 2], [0, 3]] - data[0] = [61, 62] - data[1] = [[41, 42], [11, 12]] - data[2] = [[[51, 52], [21, 22]], [[1, 2], [31, 32]]] - merged = [[1, 2], [11, 12], [21, 22], [31, 32], [41, 42], - [51, 52], [61, 62]] -``` - -
- -
- -##### Args: - - -* `indices`: A list of at least 1 `Tensor` objects of type `int32`. -* `data`: A list with the same number of `Tensor` objects as `indices` of `Tensor` objects of the same type. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.errors.error_code_from_exception_type.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.errors.error_code_from_exception_type.md deleted file mode 100644 index fce6574c6b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.errors.error_code_from_exception_type.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.errors.error_code_from_exception_type(cls)` {#error_code_from_exception_type} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.errors.exception_type_from_error_code.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.errors.exception_type_from_error_code.md deleted file mode 100644 index c635c56a01..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.errors.exception_type_from_error_code.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.errors.exception_type_from_error_code(error_code)` {#exception_type_from_error_code} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.fft3d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.fft3d.md deleted file mode 100644 index a1cf358fe2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.fft3d.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.fft3d(input, name=None)` {#fft3d} - -Compute the 3-dimensional discrete Fourier Transform over the inner-most 3 - -dimensions of `input`. - -##### Args: - - -* `input`: A `Tensor` of type `complex64`. A complex64 tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `complex64`. - A complex64 tensor of the same shape as `input`. The inner-most 3 - dimensions of `input` are replaced with their 3D Fourier Transform. - - @compatibility(numpy) - Equivalent to np.fft3 - @end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.get_collection.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.get_collection.md deleted file mode 100644 index fc0044b490..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.get_collection.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.get_collection(key, scope=None)` {#get_collection} - -Wrapper for `Graph.get_collection()` using the default graph. - -See [`Graph.get_collection()`](../../api_docs/python/framework.md#Graph.get_collection) -for more details. - -##### Args: - - -* `key`: The key for the collection. For example, the `GraphKeys` class - contains many standard names for collections. -* `scope`: (Optional.) If supplied, the resulting list is filtered to include - only items whose `name` attribute matches using `re.match`. Items - without a `name` attribute are never returned if a scope is supplied and - the choice or `re.match` means that a `scope` without special tokens - filters by prefix. - -##### Returns: - - The list of values in the collection with the given `name`, or - an empty list if no value has been added to that collection. The - list contains the values in the order under which they were - collected. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.get_collection_ref.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.get_collection_ref.md deleted file mode 100644 index c393da2233..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.get_collection_ref.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.get_collection_ref(key)` {#get_collection_ref} - -Wrapper for `Graph.get_collection_ref()` using the default graph. - -See [`Graph.get_collection_ref()`](../../api_docs/python/framework.md#Graph.get_collection_ref) -for more details. - -##### Args: - - -* `key`: The key for the collection. For example, the `GraphKeys` class - contains many standard names for collections. - -##### Returns: - - The list of values in the collection with the given `name`, or an empty - list if no value has been added to that collection. Note that this returns - the collection list itself, which can be modified in place to change the - collection. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.get_session_tensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.get_session_tensor.md deleted file mode 100644 index 42623f6706..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.get_session_tensor.md +++ /dev/null @@ -1,36 +0,0 @@ -### `tf.get_session_tensor(handle, dtype, name=None)` {#get_session_tensor} - -Get the tensor of type `dtype` by feeding a tensor handle. - -This is EXPERIMENTAL and subject to change. - -Get the value of the tensor from a tensor handle. The tensor -is produced in a previous run() and stored in the state of the -session. - -##### Args: - - -* `handle`: The string representation of a persistent tensor handle. -* `dtype`: The type of the output tensor. -* `name`: Optional name prefix for the return tensor. - -##### Returns: - - A pair of tensors. The first is a placeholder for feeding a - tensor handle and the second is the tensor in the session state - keyed by the tensor handle. - - -* `Example`: - -```python -c = tf.multiply(a, b) -h = tf.get_session_handle(c) -h = sess.run(h) - -p, a = tf.get_session_tensor(h.handle, tf.float32) -b = tf.multiply(a, 10) -c = sess.run(b, feed_dict={p: h.handle}) -``` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.ifft.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.ifft.md deleted file mode 100644 index 4e8b5c691d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.ifft.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.ifft(input, name=None)` {#ifft} - -Compute the inverse 1-dimensional discrete Fourier Transform over the inner-most - -dimension of `input`. - -##### Args: - - -* `input`: A `Tensor` of type `complex64`. A complex64 tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `complex64`. - A complex64 tensor of the same shape as `input`. The inner-most - dimension of `input` is replaced with its inverse 1D Fourier Transform. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.image.non_max_suppression.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.image.non_max_suppression.md deleted file mode 100644 index d6b354a3d2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.image.non_max_suppression.md +++ /dev/null @@ -1,45 +0,0 @@ -### `tf.image.non_max_suppression(boxes, scores, max_output_size, iou_threshold=None, name=None)` {#non_max_suppression} - -Greedily selects a subset of bounding boxes in descending order of score, - -pruning away boxes that have high intersection-over-union (IOU) overlap -with previously selected boxes. Bounding boxes are supplied as -[y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any -diagonal pair of box corners and the coordinates can be provided as normalized -(i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm -is agnostic to where the origin is in the coordinate system. Note that this -algorithm is invariant to orthogonal transformations and translations -of the coordinate system; thus translating or reflections of the coordinate -system result in the same boxes being selected by the algorithm. - -The output of this operation is a set of integers indexing into the input -collection of bounding boxes representing the selected boxes. The bounding -box coordinates corresponding to the selected indices can then be obtained -using the `tf.gather operation`. For example: - - selected_indices = tf.image.non_max_suppression( - boxes, scores, max_output_size, iou_threshold) - selected_boxes = tf.gather(boxes, selected_indices) - -##### Args: - - -* `boxes`: A `Tensor` of type `float32`. - A 2-D float tensor of shape `[num_boxes, 4]`. -* `scores`: A `Tensor` of type `float32`. - A 1-D float tensor of shape `[num_boxes]` representing a single - score corresponding to each box (each row of boxes). -* `max_output_size`: A `Tensor` of type `int32`. - A scalar integer tensor representing the maximum number of - boxes to be selected by non max suppression. -* `iou_threshold`: An optional `float`. Defaults to `0.5`. - A float representing the threshold for deciding whether boxes - overlap too much with respect to IOU. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `int32`. - A 1-D integer tensor of shape `[M]` representing the selected - indices from the boxes tensor, where `M <= max_output_size`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.image.random_flip_left_right.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.image.random_flip_left_right.md deleted file mode 100644 index d063895136..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.image.random_flip_left_right.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.image.random_flip_left_right(image, seed=None)` {#random_flip_left_right} - -Randomly flip an image horizontally (left to right). - -With a 1 in 2 chance, outputs the contents of `image` flipped along the -second dimension, which is `width`. Otherwise output the image as-is. - -##### Args: - - -* `image`: A 3-D tensor of shape `[height, width, channels].` -* `seed`: A Python integer. Used to create a random seed. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - -##### Returns: - - A 3-D tensor of the same type and shape as `image`. - -##### Raises: - - -* `ValueError`: if the shape of `image` not supported. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.image.resize_area.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.image.resize_area.md deleted file mode 100644 index dbc6fd1bcd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.image.resize_area.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.image.resize_area(images, size, align_corners=None, name=None)` {#resize_area} - -Resize `images` to `size` using area interpolation. - -Input images can be of different types but output images are always float. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int16`, `int32`, `int64`, `half`, `float32`, `float64`. - 4-D with shape `[batch, height, width, channels]`. -* `size`: A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The - new size for the images. -* `align_corners`: An optional `bool`. Defaults to `False`. - If true, rescale input by (new_height - 1) / (height - 1), which - exactly aligns the 4 corners of images and resized images. If false, rescale - by new_height / height. Treat similarly the width dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. 4-D with shape - `[batch, new_height, new_width, channels]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.less.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.less.md deleted file mode 100644 index 3a00afa8db..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.less.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.less(x, y, name=None)` {#less} - -Returns the truth value of (x < y) element-wise. - -*NOTE*: `Less` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.lgamma.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.lgamma.md deleted file mode 100644 index a4add48fb4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.lgamma.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.lgamma(x, name=None)` {#lgamma} - -Computes the log of the absolute value of `Gamma(x)` element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.logical_or.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.logical_or.md deleted file mode 100644 index e04b6a15d2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.logical_or.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.logical_or(x, y, name=None)` {#logical_or} - -Returns the truth value of x OR y element-wise. - -*NOTE*: `LogicalOr` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_band_part.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_band_part.md deleted file mode 100644 index 87bd745c2a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_band_part.md +++ /dev/null @@ -1,61 +0,0 @@ -### `tf.matrix_band_part(input, num_lower, num_upper, name=None)` {#matrix_band_part} - -Copy a tensor setting everything outside a central band in each innermost matrix - -to zero. - -The `band` part is computed as follows: -Assume `input` has `k` dimensions `[I, J, K, ..., M, N]`, then the output is a -tensor with the same shape where - -`band[i, j, k, ..., m, n] = in_band(m, n) * input[i, j, k, ..., m, n]`. - -The indicator function - -`in_band(m, n) = (num_lower < 0 || (m-n) <= num_lower)) && - (num_upper < 0 || (n-m) <= num_upper)`. - -For example: - -```prettyprint -# if 'input' is [[ 0, 1, 2, 3] - [-1, 0, 1, 2] - [-2, -1, 0, 1] - [-3, -2, -1, 0]], - -tf.matrix_band_part(input, 1, -1) ==> [[ 0, 1, 2, 3] - [-1, 0, 1, 2] - [ 0, -1, 0, 1] - [ 0, 0, -1, 0]], - -tf.matrix_band_part(input, 2, 1) ==> [[ 0, 1, 0, 0] - [-1, 0, 1, 0] - [-2, -1, 0, 1] - [ 0, -2, -1, 0]] -``` - -Useful special cases: - -```prettyprint - tf.matrix_band_part(input, 0, -1) ==> Upper triangular part. - tf.matrix_band_part(input, -1, 0) ==> Lower triangular part. - tf.matrix_band_part(input, 0, 0) ==> Diagonal. -``` - -##### Args: - - -* `input`: A `Tensor`. Rank `k` tensor. -* `num_lower`: A `Tensor` of type `int64`. - 0-D tensor. Number of subdiagonals to keep. If negative, keep entire - lower triangle. -* `num_upper`: A `Tensor` of type `int64`. - 0-D tensor. Number of superdiagonals to keep. If negative, keep - entire upper triangle. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - Rank `k` tensor of the same shape as input. The extracted banded tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_diag.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_diag.md deleted file mode 100644 index 16ba620c83..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_diag.md +++ /dev/null @@ -1,42 +0,0 @@ -### `tf.matrix_diag(diagonal, name=None)` {#matrix_diag} - -Returns a batched diagonal tensor with a given batched diagonal values. - -Given a `diagonal`, this operation returns a tensor with the `diagonal` and -everything else padded with zeros. The diagonal is computed as follows: - -Assume `diagonal` has `k` dimensions `[I, J, K, ..., N]`, then the output is a -tensor of rank `k+1` with dimensions [I, J, K, ..., N, N]` where: - -`output[i, j, k, ..., m, n] = 1{m=n} * diagonal[i, j, k, ..., n]`. - -For example: - -```prettyprint -# 'diagonal' is [[1, 2, 3, 4], [5, 6, 7, 8]] - -and diagonal.shape = (2, 4) - -tf.matrix_diag(diagonal) ==> [[[1, 0, 0, 0] - [0, 2, 0, 0] - [0, 0, 3, 0] - [0, 0, 0, 4]], - [[5, 0, 0, 0] - [0, 6, 0, 0] - [0, 0, 7, 0] - [0, 0, 0, 8]]] - -which has shape (2, 4, 4) -``` - -##### Args: - - -* `diagonal`: A `Tensor`. Rank `k`, where `k >= 1`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `diagonal`. - Rank `k+1`, with `output.shape = diagonal.shape + [diagonal.shape[-1]]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_diag_part.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_diag_part.md deleted file mode 100644 index efaf772f6b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_diag_part.md +++ /dev/null @@ -1,45 +0,0 @@ -### `tf.matrix_diag_part(input, name=None)` {#matrix_diag_part} - -Returns the batched diagonal part of a batched tensor. - -This operation returns a tensor with the `diagonal` part -of the batched `input`. The `diagonal` part is computed as follows: - -Assume `input` has `k` dimensions `[I, J, K, ..., M, N]`, then the output is a -tensor of rank `k - 1` with dimensions `[I, J, K, ..., min(M, N)]` where: - -`diagonal[i, j, k, ..., n] = input[i, j, k, ..., n, n]`. - -The input must be at least a matrix. - -For example: - -```prettyprint -# 'input' is [[[1, 0, 0, 0] - [0, 2, 0, 0] - [0, 0, 3, 0] - [0, 0, 0, 4]], - [[5, 0, 0, 0] - [0, 6, 0, 0] - [0, 0, 7, 0] - [0, 0, 0, 8]]] - -and input.shape = (2, 4, 4) - -tf.matrix_diag_part(input) ==> [[1, 2, 3, 4], [5, 6, 7, 8]] - -which has shape (2, 4) -``` - -##### Args: - - -* `input`: A `Tensor`. Rank `k` tensor where `k >= 2`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - The extracted diagonal(s) having shape - `diagonal.shape = input.shape[:-2] + [min(input.shape[-2:])]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_solve.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_solve.md deleted file mode 100644 index 88d037f2fa..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_solve.md +++ /dev/null @@ -1,27 +0,0 @@ -### `tf.matrix_solve(matrix, rhs, adjoint=None, name=None)` {#matrix_solve} - -Solves systems of linear equations. - -`Matrix` is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions -form square matrices. `Rhs` is a tensor of shape `[..., M, K]`. The `output` is -a tensor shape `[..., M, K]`. If `adjoint` is `False` then each output matrix -satisfies `matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]`. -If `adjoint` is `True` then each output matrix satisfies -`adjoint(matrix[..., :, :]) * output[..., :, :] = rhs[..., :, :]`. - -##### Args: - - -* `matrix`: A `Tensor`. Must be one of the following types: `float64`, `float32`, `complex64`, `complex128`. - Shape is `[..., M, M]`. -* `rhs`: A `Tensor`. Must have the same type as `matrix`. - Shape is `[..., M, K]`. -* `adjoint`: An optional `bool`. Defaults to `False`. - Boolean indicating whether to solve with `matrix` or its (block-wise) - adjoint. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `matrix`. Shape is `[..., M, K]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_solve_ls.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_solve_ls.md deleted file mode 100644 index 7c163ae7f0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_solve_ls.md +++ /dev/null @@ -1,56 +0,0 @@ -### `tf.matrix_solve_ls(matrix, rhs, l2_regularizer=0.0, fast=True, name=None)` {#matrix_solve_ls} - -Solves one or more linear least-squares problems. - -`matrix` is a tensor of shape `[..., M, N]` whose inner-most 2 dimensions -form `M`-by-`N` matrices. Rhs is a tensor of shape `[..., M, K]` whose -inner-most 2 dimensions form `M`-by-`K` matrices. The computed output is a -`Tensor` of shape `[..., N, K]` whose inner-most 2 dimensions form `M`-by-`K` -matrices that solve the equations -`matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]` in the least squares -sense. - -Below we will use the following notation for each pair of matrix and -right-hand sides in the batch: - -`matrix`=\\(A \in \Re^{m \times n}\\), -`rhs`=\\(B \in \Re^{m \times k}\\), -`output`=\\(X \in \Re^{n \times k}\\), -`l2_regularizer`=\\(\lambda\\). - -If `fast` is `True`, then the solution is computed by solving the normal -equations using Cholesky decomposition. Specifically, if \\(m \ge n\\) then -\\(X = (A^T A + \lambda I)^{-1} A^T B\\), which solves the least-squares -problem \\(X = \mathrm{argmin}_{Z \in \Re^{n \times k}} ||A Z - B||_F^2 + -\lambda ||Z||_F^2\\). If \\(m \lt n\\) then `output` is computed as -\\(X = A^T (A A^T + \lambda I)^{-1} B\\), which (for \\(\lambda = 0\\)) is -the minimum-norm solution to the under-determined linear system, i.e. -\\(X = \mathrm{argmin}_{Z \in \Re^{n \times k}} ||Z||_F^2 \\), subject to -\\(A Z = B\\). Notice that the fast path is only numerically stable when -\\(A\\) is numerically full rank and has a condition number -\\(\mathrm{cond}(A) \lt \frac{1}{\sqrt{\epsilon_{mach}}}\\) or\\(\lambda\\) -is sufficiently large. - -If `fast` is `False` an algorithm based on the numerically robust complete -orthogonal decomposition is used. This computes the minimum-norm -least-squares solution, even when \\(A\\) is rank deficient. This path is -typically 6-7 times slower than the fast path. If `fast` is `False` then -`l2_regularizer` is ignored. - -##### Args: - - -* `matrix`: `Tensor` of shape `[..., M, N]`. -* `rhs`: `Tensor` of shape `[..., M, K]`. -* `l2_regularizer`: 0-D `double` `Tensor`. Ignored if `fast=False`. -* `fast`: bool. Defaults to `True`. -* `name`: string, optional name of the operation. - -##### Returns: - - -* `output`: `Tensor` of shape `[..., N, K]` whose inner-most 2 dimensions form - `M`-by-`K` matrices that solve the equations - `matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]` in the least - squares sense. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_transpose.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_transpose.md deleted file mode 100644 index 7bfbc549a2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.matrix_transpose.md +++ /dev/null @@ -1,34 +0,0 @@ -### `tf.matrix_transpose(a, name='matrix_transpose')` {#matrix_transpose} - -Transposes last two dimensions of tensor `a`. - -For example: - -```python -# Matrix with no batch dimension. -# 'x' is [[1 2 3] -# [4 5 6]] -tf.matrix_transpose(x) ==> [[1 4] - [2 5] - [3 6]] - -# Matrix with two batch dimensions. -# x.shape is [1, 2, 3, 4] -# tf.matrix_transpose(x) is shape [1, 2, 4, 3] -``` - -##### Args: - - -* `a`: A `Tensor` with `rank >= 2`. -* `name`: A name for the operation (optional). - -##### Returns: - - A transposed batch matrix `Tensor`. - -##### Raises: - - -* `ValueError`: If `a` is determined statically to have `rank < 2`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.atrous_conv2d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.atrous_conv2d.md deleted file mode 100644 index b98661fad5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.atrous_conv2d.md +++ /dev/null @@ -1,115 +0,0 @@ -### `tf.nn.atrous_conv2d(value, filters, rate, padding, name=None)` {#atrous_conv2d} - -Atrous convolution (a.k.a. convolution with holes or dilated convolution). - -Computes a 2-D atrous convolution, also known as convolution with holes or -dilated convolution, given 4-D `value` and `filters` tensors. If the `rate` -parameter is equal to one, it performs regular 2-D convolution. If the `rate` -parameter is greater than one, it performs convolution with holes, sampling -the input values every `rate` pixels in the `height` and `width` dimensions. -This is equivalent to convolving the input with a set of upsampled filters, -produced by inserting `rate - 1` zeros between two consecutive values of the -filters along the `height` and `width` dimensions, hence the name atrous -convolution or convolution with holes (the French word trous means holes in -English). - -More specifically: - - output[b, i, j, k] = sum_{di, dj, q} filters[di, dj, q, k] * - value[b, i + rate * di, j + rate * dj, q] - -Atrous convolution allows us to explicitly control how densely to compute -feature responses in fully convolutional networks. Used in conjunction with -bilinear interpolation, it offers an alternative to `conv2d_transpose` in -dense prediction tasks such as semantic image segmentation, optical flow -computation, or depth estimation. It also allows us to effectively enlarge -the field of view of filters without increasing the number of parameters or -the amount of computation. - -For a description of atrous convolution and how it can be used for dense -feature extraction, please see: [Semantic Image Segmentation with Deep -Convolutional Nets and Fully Connected CRFs](http://arxiv.org/abs/1412.7062). -The same operation is investigated further in [Multi-Scale Context Aggregation -by Dilated Convolutions](http://arxiv.org/abs/1511.07122). Previous works -that effectively use atrous convolution in different ways are, among others, -[OverFeat: Integrated Recognition, Localization and Detection using -Convolutional Networks](http://arxiv.org/abs/1312.6229) and [Fast Image -Scanning with Deep Max-Pooling Convolutional Neural Networks](http://arxiv.org/abs/1302.1700). -Atrous convolution is also closely related to the so-called noble identities -in multi-rate signal processing. - -There are many different ways to implement atrous convolution (see the refs -above). The implementation here reduces - -```python - atrous_conv2d(value, filters, rate, padding=padding) -``` - -to the following three operations: - -```python - paddings = ... - net = space_to_batch(value, paddings, block_size=rate) - net = conv2d(net, filters, strides=[1, 1, 1, 1], padding="VALID") - crops = ... - net = batch_to_space(net, crops, block_size=rate) -``` - -Advanced usage. Note the following optimization: A sequence of `atrous_conv2d` -operations with identical `rate` parameters, 'SAME' `padding`, and filters -with odd heights/ widths: - -```python - net = atrous_conv2d(net, filters1, rate, padding="SAME") - net = atrous_conv2d(net, filters2, rate, padding="SAME") - ... - net = atrous_conv2d(net, filtersK, rate, padding="SAME") -``` - -can be equivalently performed cheaper in terms of computation and memory as: - -```python - pad = ... # padding so that the input dims are multiples of rate - net = space_to_batch(net, paddings=pad, block_size=rate) - net = conv2d(net, filters1, strides=[1, 1, 1, 1], padding="SAME") - net = conv2d(net, filters2, strides=[1, 1, 1, 1], padding="SAME") - ... - net = conv2d(net, filtersK, strides=[1, 1, 1, 1], padding="SAME") - net = batch_to_space(net, crops=pad, block_size=rate) -``` - -because a pair of consecutive `space_to_batch` and `batch_to_space` ops with -the same `block_size` cancel out when their respective `paddings` and `crops` -inputs are identical. - -##### Args: - - -* `value`: A 4-D `Tensor` of type `float`. It needs to be in the default "NHWC" - format. Its shape is `[batch, in_height, in_width, in_channels]`. -* `filters`: A 4-D `Tensor` with the same type as `value` and shape - `[filter_height, filter_width, in_channels, out_channels]`. `filters`' - `in_channels` dimension must match that of `value`. Atrous convolution is - equivalent to standard convolution with upsampled filters with effective - height `filter_height + (filter_height - 1) * (rate - 1)` and effective - width `filter_width + (filter_width - 1) * (rate - 1)`, produced by - inserting `rate - 1` zeros along consecutive elements across the - `filters`' spatial dimensions. -* `rate`: A positive int32. The stride with which we sample input values across - the `height` and `width` dimensions. Equivalently, the rate by which we - upsample the filter values by inserting zeros across the `height` and - `width` dimensions. In the literature, the same parameter is sometimes - called `input stride` or `dilation`. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. -* `name`: Optional name for the returned tensor. - -##### Returns: - - A `Tensor` with the same type as `value`. - -##### Raises: - - -* `ValueError`: If input/output depth does not match `filters`' shape, or if - padding is other than `'VALID'` or `'SAME'`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.avg_pool.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.avg_pool.md deleted file mode 100644 index c6ef397b19..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.avg_pool.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.nn.avg_pool(value, ksize, strides, padding, data_format='NHWC', name=None)` {#avg_pool} - -Performs the average pooling on the input. - -Each entry in `output` is the mean of the corresponding size `ksize` -window in `value`. - -##### Args: - - -* `value`: A 4-D `Tensor` of shape `[batch, height, width, channels]` and type - `float32`, `float64`, `qint8`, `quint8`, or `qint32`. -* `ksize`: A list of ints that has length >= 4. - The size of the window for each dimension of the input tensor. -* `strides`: A list of ints that has length >= 4. - The stride of the sliding window for each dimension of the - input tensor. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. - See the [comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `data_format`: A string. 'NHWC' and 'NCHW' are supported. -* `name`: Optional name for the operation. - -##### Returns: - - A `Tensor` with the same type as `value`. The average pooled output tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.conv3d_transpose.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.conv3d_transpose.md deleted file mode 100644 index 575b52def5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.conv3d_transpose.md +++ /dev/null @@ -1,35 +0,0 @@ -### `tf.nn.conv3d_transpose(value, filter, output_shape, strides, padding='SAME', name=None)` {#conv3d_transpose} - -The transpose of `conv3d`. - -This operation is sometimes called "deconvolution" after [Deconvolutional -Networks](http://www.matthewzeiler.com/pubs/cvpr2010/cvpr2010.pdf), but is -actually the transpose (gradient) of `conv3d` rather than an actual -deconvolution. - -##### Args: - - -* `value`: A 5-D `Tensor` of type `float` and shape - `[batch, depth, height, width, in_channels]`. -* `filter`: A 5-D `Tensor` with the same type as `value` and shape - `[depth, height, width, output_channels, in_channels]`. `filter`'s - `in_channels` dimension must match that of `value`. -* `output_shape`: A 1-D `Tensor` representing the output shape of the - deconvolution op. -* `strides`: A list of ints. The stride of the sliding window for each - dimension of the input tensor. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. - See the [comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `name`: Optional name for the returned tensor. - -##### Returns: - - A `Tensor` with the same type as `value`. - -##### Raises: - - -* `ValueError`: If input/output depth does not match `filter`'s shape, or if - padding is other than `'VALID'` or `'SAME'`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.fixed_unigram_candidate_sampler.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.fixed_unigram_candidate_sampler.md deleted file mode 100644 index ad9b059e42..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.fixed_unigram_candidate_sampler.md +++ /dev/null @@ -1,75 +0,0 @@ -### `tf.nn.fixed_unigram_candidate_sampler(true_classes, num_true, num_sampled, unique, range_max, vocab_file='', distortion=1.0, num_reserved_ids=0, num_shards=1, shard=0, unigrams=(), seed=None, name=None)` {#fixed_unigram_candidate_sampler} - -Samples a set of classes using the provided (fixed) base distribution. - -This operation randomly samples a tensor of sampled classes -(`sampled_candidates`) from the range of integers `[0, range_max)`. - -The elements of `sampled_candidates` are drawn without replacement -(if `unique=True`) or with replacement (if `unique=False`) from -the base distribution. - -The base distribution is read from a file or passed in as an -in-memory array. There is also an option to skew the distribution by -applying a distortion power to the weights. - -In addition, this operation returns tensors `true_expected_count` -and `sampled_expected_count` representing the number of times each -of the target classes (`true_classes`) and the sampled -classes (`sampled_candidates`) is expected to occur in an average -tensor of sampled classes. These values correspond to `Q(y|x)` -defined in [this -document](http://www.tensorflow.org/extras/candidate_sampling.pdf). -If `unique=True`, then these are post-rejection probabilities and we -compute them approximately. - -##### Args: - - -* `true_classes`: A `Tensor` of type `int64` and shape `[batch_size, - num_true]`. The target classes. -* `num_true`: An `int`. The number of target classes per training example. -* `num_sampled`: An `int`. The number of classes to randomly sample per batch. -* `unique`: A `bool`. Determines whether all sampled classes in a batch are - unique. -* `range_max`: An `int`. The number of possible classes. -* `vocab_file`: Each valid line in this file (which should have a CSV-like - format) corresponds to a valid word ID. IDs are in sequential order, - starting from num_reserved_ids. The last entry in each line is expected - to be a value corresponding to the count or relative probability. Exactly - one of `vocab_file` and `unigrams` needs to be passed to this operation. -* `distortion`: The distortion is used to skew the unigram probability - distribution. Each weight is first raised to the distortion's power - before adding to the internal unigram distribution. As a result, - `distortion = 1.0` gives regular unigram sampling (as defined by the vocab - file), and `distortion = 0.0` gives a uniform distribution. -* `num_reserved_ids`: Optionally some reserved IDs can be added in the range - `[0, num_reserved_ids]` by the users. One use case is that a special - unknown word token is used as ID 0. These IDs will have a sampling - probability of 0. -* `num_shards`: A sampler can be used to sample from a subset of the original - range in order to speed up the whole computation through parallelism. This - parameter (together with `shard`) indicates the number of partitions that - are being used in the overall computation. -* `shard`: A sampler can be used to sample from a subset of the original range - in order to speed up the whole computation through parallelism. This - parameter (together with `num_shards`) indicates the particular partition - number of the operation, when partitioning is being used. -* `unigrams`: A list of unigram counts or probabilities, one per ID in - sequential order. Exactly one of `vocab_file` and `unigrams` should be - passed to this operation. -* `seed`: An `int`. An operation-specific seed. Default is 0. -* `name`: A name for the operation (optional). - -##### Returns: - - -* `sampled_candidates`: A tensor of type `int64` and shape `[num_sampled]`. - The sampled classes. -* `true_expected_count`: A tensor of type `float`. Same shape as - `true_classes`. The expected counts under the sampling distribution - of each of `true_classes`. -* `sampled_expected_count`: A tensor of type `float`. Same shape as - `sampled_candidates`. The expected counts under the sampling distribution - of each of `sampled_candidates`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.fractional_avg_pool.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.fractional_avg_pool.md deleted file mode 100644 index 367205ffd6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.fractional_avg_pool.md +++ /dev/null @@ -1,57 +0,0 @@ -### `tf.nn.fractional_avg_pool(value, pooling_ratio, pseudo_random=None, overlapping=None, deterministic=None, seed=None, seed2=None, name=None)` {#fractional_avg_pool} - -Performs fractional average pooling on the input. - -Fractional average pooling is similar to Fractional max pooling in the pooling -region generation step. The only difference is that after pooling regions are -generated, a mean operation is performed instead of a max operation in each -pooling region. - -##### Args: - - -* `value`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`. - 4-D with shape `[batch, height, width, channels]`. -* `pooling_ratio`: A list of `floats` that has length `>= 4`. - Pooling ratio for each dimension of `value`, currently only - supports row and col dimension and should be >= 1.0. For example, a valid - pooling ratio looks like [1.0, 1.44, 1.73, 1.0]. The first and last elements - must be 1.0 because we don't allow pooling on batch and channels - dimensions. 1.44 and 1.73 are pooling ratio on height and width dimensions - respectively. -* `pseudo_random`: An optional `bool`. Defaults to `False`. - When set to True, generates the pooling sequence in a - pseudorandom fashion, otherwise, in a random fashion. Check paper [Benjamin - Graham, Fractional Max-Pooling](http://arxiv.org/abs/1412.6071) for - difference between pseudorandom and random. -* `overlapping`: An optional `bool`. Defaults to `False`. - When set to True, it means when pooling, the values at the boundary - of adjacent pooling cells are used by both cells. For example: - - `index 0 1 2 3 4` - - `value 20 5 16 3 7` - - If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. - The result would be [41/3, 26/3] for fractional avg pooling. - -* `deterministic`: An optional `bool`. Defaults to `False`. - When set to True, a fixed pooling region will be used when - iterating over a FractionalAvgPool node in the computation graph. Mainly used - in unit test to make FractionalAvgPool deterministic. -* `seed`: An optional `int`. Defaults to `0`. - If either seed or seed2 are set to be non-zero, the random number - generator is seeded by the given seed. Otherwise, it is seeded by a - random seed. -* `seed2`: An optional `int`. Defaults to `0`. - An second seed to avoid seed collision. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, row_pooling_sequence, col_pooling_sequence). - -* `output`: A `Tensor`. Has the same type as `value`. output tensor after fractional avg pooling. -* `row_pooling_sequence`: A `Tensor` of type `int64`. row pooling sequence, needed to calculate gradient. -* `col_pooling_sequence`: A `Tensor` of type `int64`. column pooling sequence, needed to calculate gradient. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.in_top_k.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.in_top_k.md deleted file mode 100644 index f46780649d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.in_top_k.md +++ /dev/null @@ -1,33 +0,0 @@ -### `tf.nn.in_top_k(predictions, targets, k, name=None)` {#in_top_k} - -Says whether the targets are in the top `K` predictions. - -This outputs a `batch_size` bool array, an entry `out[i]` is `true` if the -prediction for the target class is among the top `k` predictions among -all predictions for example `i`. Note that the behavior of `InTopK` differs -from the `TopK` op in its handling of ties; if multiple classes have the -same prediction value and straddle the top-`k` boundary, all of those -classes are considered to be in the top `k`. - -More formally, let - - \\(predictions_i\\) be the predictions for all classes for example `i`, - \\(targets_i\\) be the target class for example `i`, - \\(out_i\\) be the output for example `i`, - -$$out_i = predictions_{i, targets_i} \in TopKIncludingTies(predictions_i)$$ - -##### Args: - - -* `predictions`: A `Tensor` of type `float32`. - A `batch_size` x `classes` tensor. -* `targets`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A `batch_size` vector of class ids. -* `k`: An `int`. Number of top elements to look at for computing precision. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. Computed Precision at `k` as a `bool Tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.local_response_normalization.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.local_response_normalization.md deleted file mode 100644 index 81134df29f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.local_response_normalization.md +++ /dev/null @@ -1,34 +0,0 @@ -### `tf.nn.local_response_normalization(input, depth_radius=None, bias=None, alpha=None, beta=None, name=None)` {#local_response_normalization} - -Local Response Normalization. - -The 4-D `input` tensor is treated as a 3-D array of 1-D vectors (along the last -dimension), and each vector is normalized independently. Within a given vector, -each component is divided by the weighted, squared sum of inputs within -`depth_radius`. In detail, - - sqr_sum[a, b, c, d] = - sum(input[a, b, c, d - depth_radius : d + depth_radius + 1] ** 2) - output = input / (bias + alpha * sqr_sum) ** beta - -For details, see [Krizhevsky et al., ImageNet classification with deep -convolutional neural networks (NIPS 2012)](http://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks). - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `half`. - 4-D. -* `depth_radius`: An optional `int`. Defaults to `5`. - 0-D. Half-width of the 1-D normalization window. -* `bias`: An optional `float`. Defaults to `1`. - An offset (usually positive to avoid dividing by 0). -* `alpha`: An optional `float`. Defaults to `1`. - A scale factor, usually positive. -* `beta`: An optional `float`. Defaults to `0.5`. An exponent. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.quantized_avg_pool.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.quantized_avg_pool.md deleted file mode 100644 index 4bc6a1dc6d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.quantized_avg_pool.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.nn.quantized_avg_pool(input, min_input, max_input, ksize, strides, padding, name=None)` {#quantized_avg_pool} - -Produces the average pool of the input tensor for quantized types. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `qint8`, `quint8`, `qint16`, `quint16`, `qint32`. - 4-D with shape `[batch, height, width, channels]`. -* `min_input`: A `Tensor` of type `float32`. - The float value that the lowest quantized input value represents. -* `max_input`: A `Tensor` of type `float32`. - The float value that the highest quantized input value represents. -* `ksize`: A list of `ints`. - The size of the window for each dimension of the input tensor. - The length must be 4 to match the number of dimensions of the input. -* `strides`: A list of `ints`. - The stride of the sliding window for each dimension of the input - tensor. The length must be 4 to match the number of dimensions of the input. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, min_output, max_output). - -* `output`: A `Tensor`. Has the same type as `input`. -* `min_output`: A `Tensor` of type `float32`. The float value that the lowest quantized output value represents. -* `max_output`: A `Tensor` of type `float32`. The float value that the highest quantized output value represents. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.softmax_cross_entropy_with_logits.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.softmax_cross_entropy_with_logits.md deleted file mode 100644 index d7a62e2da7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.softmax_cross_entropy_with_logits.md +++ /dev/null @@ -1,41 +0,0 @@ -### `tf.nn.softmax_cross_entropy_with_logits(_sentinel=None, labels=None, logits=None, dim=-1, name=None)` {#softmax_cross_entropy_with_logits} - -Computes softmax cross entropy between `logits` and `labels`. - -Measures the probability error in discrete classification tasks in which the -classes are mutually exclusive (each entry is in exactly one class). For -example, each CIFAR-10 image is labeled with one and only one label: an image -can be a dog or a truck, but not both. - -**NOTE:** While the classes are mutually exclusive, their probabilities -need not be. All that is required is that each row of `labels` is -a valid probability distribution. If they are not, the computation of the -gradient will be incorrect. - -If using exclusive `labels` (wherein one and only -one class is true at a time), see `sparse_softmax_cross_entropy_with_logits`. - -**WARNING:** This op expects unscaled logits, since it performs a `softmax` -on `logits` internally for efficiency. Do not call this op with the -output of `softmax`, as it will produce incorrect results. - -`logits` and `labels` must have the same shape `[batch_size, num_classes]` -and the same dtype (either `float16`, `float32`, or `float64`). - -**Note that to avoid confusion, it is required to pass only named arguments to -this function.** - -##### Args: - - _sentinel: Used to prevent positional parameters. Internal, do not use. - -* `labels`: Each row `labels[i]` must be a valid probability distribution. -* `logits`: Unscaled log probabilities. -* `dim`: The class dimension. Defaulted to -1 which is the last dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A 1-D `Tensor` of length `batch_size` of the same type as `logits` with the - softmax cross entropy loss. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.weighted_moments.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.weighted_moments.md deleted file mode 100644 index def48d7552..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.nn.weighted_moments.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.nn.weighted_moments(x, axes, frequency_weights, name=None, keep_dims=False)` {#weighted_moments} - -Returns the frequency-weighted mean and variance of `x`. - -##### Args: - - -* `x`: A tensor. -* `axes`: 1-d tensor of int32 values; these are the axes along which - to compute mean and variance. -* `frequency_weights`: A tensor of positive weights which can be - broadcast with x. -* `name`: Name used to scope the operation. -* `keep_dims`: Produce moments with the same dimensionality as the input. - -##### Returns: - - Two tensors: `weighted_mean` and `weighted_variance`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.ones_like.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.ones_like.md deleted file mode 100644 index 5ca57f52a5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.ones_like.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.ones_like(tensor, dtype=None, name=None, optimize=True)` {#ones_like} - -Creates a tensor with all elements set to 1. - -Given a single tensor (`tensor`), this operation returns a tensor of the same -type and shape as `tensor` with all elements set to 1. Optionally, you can -specify a new type (`dtype`) for the returned tensor. - -For example: - -```python -# 'tensor' is [[1, 2, 3], [4, 5, 6]] -tf.ones_like(tensor) ==> [[1, 1, 1], [1, 1, 1]] -``` - -##### Args: - - -* `tensor`: A `Tensor`. -* `dtype`: A type for the returned `Tensor`. Must be `float32`, `float64`, - `int8`, `int16`, `int32`, `int64`, `uint8`, `complex64`, `complex128` or - `bool`. -* `name`: A name for the operation (optional). -* `optimize`: if true, attempt to statically determine the shape of 'tensor' - and encode it as a constant. - -##### Returns: - - A `Tensor` with all elements set to 1. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.polygamma.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.polygamma.md deleted file mode 100644 index c8b5b2578a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.polygamma.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.polygamma(a, x, name=None)` {#polygamma} - -Compute the polygamma function \\(\psi^{(n)}(x)\\). - -The polygamma function is defined as: - -``` -\psi^{(n)}(x) = \frac{d^n}{dx^n} \psi(x) -``` -where \\(\psi(x)\\) is the digamma function. - -##### Args: - - -* `a`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `x`: A `Tensor`. Must have the same type as `a`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `a`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.python_io.TFRecordWriter.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.python_io.TFRecordWriter.md deleted file mode 100644 index 41cbdda85c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.python_io.TFRecordWriter.md +++ /dev/null @@ -1,55 +0,0 @@ -A class to write records to a TFRecords file. - -This class implements `__enter__` and `__exit__`, and can be used -in `with` blocks like a normal file. -- - - - -#### `tf.python_io.TFRecordWriter.__enter__()` {#TFRecordWriter.__enter__} - -Enter a `with` block. - - -- - - - -#### `tf.python_io.TFRecordWriter.__exit__(unused_type, unused_value, unused_traceback)` {#TFRecordWriter.__exit__} - -Exit a `with` block, closing the file. - - -- - - - -#### `tf.python_io.TFRecordWriter.__init__(path, options=None)` {#TFRecordWriter.__init__} - -Opens file `path` and creates a `TFRecordWriter` writing to it. - -##### Args: - - -* `path`: The path to the TFRecords file. -* `options`: (optional) A TFRecordOptions object. - -##### Raises: - - -* `IOError`: If `path` cannot be opened for writing. - - -- - - - -#### `tf.python_io.TFRecordWriter.close()` {#TFRecordWriter.close} - -Close the file. - - -- - - - -#### `tf.python_io.TFRecordWriter.write(record)` {#TFRecordWriter.write} - -Write a string record to the file. - -##### Args: - - -* `record`: str - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.random_normal.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.random_normal.md deleted file mode 100644 index 1344423202..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.random_normal.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.random_normal(shape, mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None)` {#random_normal} - -Outputs random values from a normal distribution. - -##### Args: - - -* `shape`: A 1-D integer Tensor or Python array. The shape of the output tensor. -* `mean`: A 0-D Tensor or Python value of type `dtype`. The mean of the normal - distribution. -* `stddev`: A 0-D Tensor or Python value of type `dtype`. The standard deviation - of the normal distribution. -* `dtype`: The type of the output. -* `seed`: A Python integer. Used to create a random seed for the distribution. - See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: A name for the operation (optional). - -##### Returns: - - A tensor of the specified shape filled with random normal values. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.reduce_max.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.reduce_max.md deleted file mode 100644 index cea9d70718..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.reduce_max.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.reduce_max(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_max} - -Computes the maximum of elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -##### Args: - - -* `input_tensor`: The tensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - -@compatibility(numpy) -Equivalent to np.max -@end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.rint.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.rint.md deleted file mode 100644 index 91fc557ee6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.rint.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.rint(x, name=None)` {#rint} - -Returns element-wise integer closest to x. - -If the result is midway between two representable values, -the even representable is chosen. -For example: - -``` -rint(-1.5) ==> -2.0 -rint(0.5000001) ==> 1.0 -rint([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) ==> [-2., -2., -0., 0., 2., 2., 2.] -``` - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.scatter_nd_update.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.scatter_nd_update.md deleted file mode 100644 index e7e975cbd3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.scatter_nd_update.md +++ /dev/null @@ -1,60 +0,0 @@ -### `tf.scatter_nd_update(ref, indices, updates, use_locking=None, name=None)` {#scatter_nd_update} - -Applies sparse `updates` to individual values or slices within a given - -variable according to `indices`. - -`ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. - -`indices` must be integer tensor, containing indices into `ref`. -It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. - -The innermost dimension of `indices` (with length `K`) corresponds to -indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th -dimension of `ref`. - -`updates` is `Tensor` of rank `Q-1+P-K` with shape: - -``` -[d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]]. -``` - -For example, say we want to update 4 scattered elements to a rank-1 tensor to -8 elements. In Python, that update would look like this: - - ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8]) - indices = tf.constant([[4], [3], [1] ,[7]]) - updates = tf.constant([9, 10, 11, 12]) - update = tf.scatter_nd_update(ref, indices, updates) - with tf.Session() as sess: - print sess.run(update) - -The resulting update to ref would look like this: - - [1, 11, 3, 10, 9, 6, 7, 12] - -See [tf.scatter_nd](#scatter_nd) for more details about how to make updates to -slices. - -##### Args: - - -* `ref`: A mutable `Tensor`. A mutable Tensor. Should be from a Variable node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A Tensor. Must be one of the following types: int32, int64. - A tensor of indices into ref. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A Tensor. Must have the same type as ref. A tensor of updated - values to add to ref. -* `use_locking`: An optional `bool`. Defaults to `True`. - An optional bool. Defaults to True. If True, the assignment will - be protected by a lock; otherwise the behavior is undefined, - but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - A mutable `Tensor`. Has the same type as `ref`. - Same as ref. Returned as a convenience for operations that want to - use the updated values after the update is done. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.scatter_sub.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.scatter_sub.md deleted file mode 100644 index 8f1afc42f6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.scatter_sub.md +++ /dev/null @@ -1,44 +0,0 @@ -### `tf.scatter_sub(ref, indices, updates, use_locking=None, name=None)` {#scatter_sub} - -Subtracts sparse updates to a variable reference. - - # Scalar indices - ref[indices, ...] -= updates[...] - - # Vector indices (for each i) - ref[indices[i], ...] -= updates[i, ...] - - # High rank indices (for each i, ..., j) - ref[indices[i, ..., j], ...] -= updates[i, ..., j, ...] - -This operation outputs `ref` after the update is done. -This makes it easier to chain operations that need to use the reset value. - -Duplicate entries are handled correctly: if multiple `indices` reference -the same location, their (negated) contributions add. - -Requires `updates.shape = indices.shape + ref.shape[1:]`. - -
- -
- -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Should be from a `Variable` node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A tensor of indices into the first dimension of `ref`. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A tensor of updated values to subtract from `ref`. -* `use_locking`: An optional `bool`. Defaults to `False`. - If True, the subtraction will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as `ref`. Returned as a convenience for operations that want - to use the updated values after the update is done. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.segment_prod.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.segment_prod.md deleted file mode 100644 index c1e3e74cf5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.segment_prod.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.segment_prod(data, segment_ids, name=None)` {#segment_prod} - -Computes the product along segments of a tensor. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -Computes a tensor such that -\\(output_i = \prod_j data_j\\) where the product is over `j` such -that `segment_ids[j] == i`. - -
- -
- -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `segment_ids`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor whose rank is equal to the rank of `data`'s - first dimension. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.segment_sum.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.segment_sum.md deleted file mode 100644 index be93c31a2e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.segment_sum.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.segment_sum(data, segment_ids, name=None)` {#segment_sum} - -Computes the sum along segments of a tensor. - -Read [the section on Segmentation](../../api_docs/python/math_ops.md#segmentation) -for an explanation of segments. - -Computes a tensor such that -\\(output_i = \sum_j data_j\\) where sum is over `j` such -that `segment_ids[j] == i`. - -
- -
- -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `segment_ids`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor whose rank is equal to the rank of `data`'s - first dimension. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.sparse_reduce_sum.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.sparse_reduce_sum.md deleted file mode 100644 index 4c1e77ac36..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.sparse_reduce_sum.md +++ /dev/null @@ -1,43 +0,0 @@ -### `tf.sparse_reduce_sum(sp_input, axis=None, keep_dims=False, reduction_axes=None)` {#sparse_reduce_sum} - -Computes the sum of elements across dimensions of a SparseTensor. - -This Op takes a SparseTensor and is the sparse counterpart to -`tf.reduce_sum()`. In particular, this Op also returns a dense `Tensor` -instead of a sparse one. - -Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless -`keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in -`reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained -with length 1. - -If `reduction_axes` has no entries, all dimensions are reduced, and a tensor -with a single element is returned. Additionally, the axes can be negative, -similar to the indexing rules in Python. - -For example: - -```python -# 'x' represents [[1, ?, 1] -# [?, 1, ?]] -# where ? is implicitly-zero. -tf.sparse_reduce_sum(x) ==> 3 -tf.sparse_reduce_sum(x, 0) ==> [1, 1, 1] -tf.sparse_reduce_sum(x, 1) ==> [2, 1] # Can also use -1 as the axis. -tf.sparse_reduce_sum(x, 1, keep_dims=True) ==> [[2], [1]] -tf.sparse_reduce_sum(x, [0, 1]) ==> 3 -``` - -##### Args: - - -* `sp_input`: The SparseTensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce; list or scalar. If `None` (the - default), reduces all dimensions. -* `keep_dims`: If true, retain reduced dimensions with length 1. -* `reduction_axes`: Deprecated name of axis. - -##### Returns: - - The reduced Tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.sparse_tensor_dense_matmul.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.sparse_tensor_dense_matmul.md deleted file mode 100644 index 27de39cda2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.sparse_tensor_dense_matmul.md +++ /dev/null @@ -1,165 +0,0 @@ -### `tf.sparse_tensor_dense_matmul(sp_a, b, adjoint_a=False, adjoint_b=False, name=None)` {#sparse_tensor_dense_matmul} - -Multiply SparseTensor (of rank 2) "A" by dense matrix "B". - -No validity checking is performed on the indices of A. However, the following -input format is recommended for optimal behavior: - -if adjoint_a == false: - A should be sorted in lexicographically increasing order. Use - sparse_reorder if you're not sure. -if adjoint_a == true: - A should be sorted in order of increasing dimension 1 (i.e., "column major" - order instead of "row major" order). - -Deciding when to use sparse_tensor_dense_matmul vs. matmul(sp_a=True): - -There are a number of questions to ask in the decision process, including: - -* Will the SparseTensor A fit in memory if densified? -* Is the column count of the product large (>> 1)? -* Is the density of A larger than approximately 15%? - -If the answer to several of these questions is yes, consider -converting the `SparseTensor` to a dense one and using `tf.matmul` with -`sp_a=True`. - -This operation tends to perform well when A is more sparse, if the column size -of the product is small (e.g. matrix-vector multiplication), if -`sp_a.dense_shape` takes on large values. - -Below is a rough speed comparison between sparse_tensor_dense_matmul, -labelled 'sparse', and matmul(sp_a=True), labelled 'dense'. For purposes of -the comparison, the time spent converting from a SparseTensor to a dense -Tensor is not included, so it is overly conservative with respect to -the time ratio. - -Benchmark system: -CPU: Intel Ivybridge with HyperThreading (6 cores) dL1:32KB dL2:256KB dL3:12MB -GPU: NVidia Tesla k40c - -Compiled with: -`-c opt --config=cuda --copt=-mavx` - -``` -tensorflow/python/sparse_tensor_dense_matmul_op_test --benchmarks -A sparse [m, k] with % nonzero values between 1% and 80% -B dense [k, n] - -% nnz n gpu m k dt(dense) dt(sparse) dt(sparse)/dt(dense) -0.01 1 True 100 100 0.000221166 0.00010154 0.459112 -0.01 1 True 100 1000 0.00033858 0.000109275 0.322745 -0.01 1 True 1000 100 0.000310557 9.85661e-05 0.317385 -0.01 1 True 1000 1000 0.0008721 0.000100875 0.115669 -0.01 1 False 100 100 0.000208085 0.000107603 0.51711 -0.01 1 False 100 1000 0.000327112 9.51118e-05 0.290762 -0.01 1 False 1000 100 0.000308222 0.00010345 0.335635 -0.01 1 False 1000 1000 0.000865721 0.000101397 0.117124 -0.01 10 True 100 100 0.000218522 0.000105537 0.482958 -0.01 10 True 100 1000 0.000340882 0.000111641 0.327506 -0.01 10 True 1000 100 0.000315472 0.000117376 0.372064 -0.01 10 True 1000 1000 0.000905493 0.000123263 0.136128 -0.01 10 False 100 100 0.000221529 9.82571e-05 0.44354 -0.01 10 False 100 1000 0.000330552 0.000112615 0.340687 -0.01 10 False 1000 100 0.000341277 0.000114097 0.334324 -0.01 10 False 1000 1000 0.000819944 0.000120982 0.147549 -0.01 25 True 100 100 0.000207806 0.000105977 0.509981 -0.01 25 True 100 1000 0.000322879 0.00012921 0.400181 -0.01 25 True 1000 100 0.00038262 0.00014158 0.370035 -0.01 25 True 1000 1000 0.000865438 0.000202083 0.233504 -0.01 25 False 100 100 0.000209401 0.000104696 0.499979 -0.01 25 False 100 1000 0.000321161 0.000130737 0.407076 -0.01 25 False 1000 100 0.000377012 0.000136801 0.362856 -0.01 25 False 1000 1000 0.000861125 0.00020272 0.235413 -0.2 1 True 100 100 0.000206952 9.69219e-05 0.46833 -0.2 1 True 100 1000 0.000348674 0.000147475 0.422959 -0.2 1 True 1000 100 0.000336908 0.00010122 0.300439 -0.2 1 True 1000 1000 0.001022 0.000203274 0.198898 -0.2 1 False 100 100 0.000207532 9.5412e-05 0.459746 -0.2 1 False 100 1000 0.000356127 0.000146824 0.41228 -0.2 1 False 1000 100 0.000322664 0.000100918 0.312764 -0.2 1 False 1000 1000 0.000998987 0.000203442 0.203648 -0.2 10 True 100 100 0.000211692 0.000109903 0.519165 -0.2 10 True 100 1000 0.000372819 0.000164321 0.440753 -0.2 10 True 1000 100 0.000338651 0.000144806 0.427596 -0.2 10 True 1000 1000 0.00108312 0.000758876 0.70064 -0.2 10 False 100 100 0.000215727 0.000110502 0.512231 -0.2 10 False 100 1000 0.000375419 0.0001613 0.429653 -0.2 10 False 1000 100 0.000336999 0.000145628 0.432132 -0.2 10 False 1000 1000 0.00110502 0.000762043 0.689618 -0.2 25 True 100 100 0.000218705 0.000129913 0.594009 -0.2 25 True 100 1000 0.000394794 0.00029428 0.745402 -0.2 25 True 1000 100 0.000404483 0.0002693 0.665788 -0.2 25 True 1000 1000 0.0012002 0.00194494 1.62052 -0.2 25 False 100 100 0.000221494 0.0001306 0.589632 -0.2 25 False 100 1000 0.000396436 0.000297204 0.74969 -0.2 25 False 1000 100 0.000409346 0.000270068 0.659754 -0.2 25 False 1000 1000 0.00121051 0.00193737 1.60046 -0.5 1 True 100 100 0.000214981 9.82111e-05 0.456836 -0.5 1 True 100 1000 0.000415328 0.000223073 0.537101 -0.5 1 True 1000 100 0.000358324 0.00011269 0.314492 -0.5 1 True 1000 1000 0.00137612 0.000437401 0.317851 -0.5 1 False 100 100 0.000224196 0.000101423 0.452386 -0.5 1 False 100 1000 0.000400987 0.000223286 0.556841 -0.5 1 False 1000 100 0.000368825 0.00011224 0.304318 -0.5 1 False 1000 1000 0.00136036 0.000429369 0.31563 -0.5 10 True 100 100 0.000222125 0.000112308 0.505608 -0.5 10 True 100 1000 0.000461088 0.00032357 0.701753 -0.5 10 True 1000 100 0.000394624 0.000225497 0.571422 -0.5 10 True 1000 1000 0.00158027 0.00190898 1.20801 -0.5 10 False 100 100 0.000232083 0.000114978 0.495418 -0.5 10 False 100 1000 0.000454574 0.000324632 0.714146 -0.5 10 False 1000 100 0.000379097 0.000227768 0.600817 -0.5 10 False 1000 1000 0.00160292 0.00190168 1.18638 -0.5 25 True 100 100 0.00023429 0.000151703 0.647501 -0.5 25 True 100 1000 0.000497462 0.000598873 1.20386 -0.5 25 True 1000 100 0.000460778 0.000557038 1.20891 -0.5 25 True 1000 1000 0.00170036 0.00467336 2.74845 -0.5 25 False 100 100 0.000228981 0.000155334 0.678371 -0.5 25 False 100 1000 0.000496139 0.000620789 1.25124 -0.5 25 False 1000 100 0.00045473 0.000551528 1.21287 -0.5 25 False 1000 1000 0.00171793 0.00467152 2.71927 -0.8 1 True 100 100 0.000222037 0.000105301 0.47425 -0.8 1 True 100 1000 0.000410804 0.000329327 0.801664 -0.8 1 True 1000 100 0.000349735 0.000131225 0.375212 -0.8 1 True 1000 1000 0.00139219 0.000677065 0.48633 -0.8 1 False 100 100 0.000214079 0.000107486 0.502085 -0.8 1 False 100 1000 0.000413746 0.000323244 0.781261 -0.8 1 False 1000 100 0.000348983 0.000131983 0.378193 -0.8 1 False 1000 1000 0.00136296 0.000685325 0.50282 -0.8 10 True 100 100 0.000229159 0.00011825 0.516017 -0.8 10 True 100 1000 0.000498845 0.000532618 1.0677 -0.8 10 True 1000 100 0.000383126 0.00029935 0.781336 -0.8 10 True 1000 1000 0.00162866 0.00307312 1.88689 -0.8 10 False 100 100 0.000230783 0.000124958 0.541452 -0.8 10 False 100 1000 0.000493393 0.000550654 1.11606 -0.8 10 False 1000 100 0.000377167 0.000298581 0.791642 -0.8 10 False 1000 1000 0.00165795 0.00305103 1.84024 -0.8 25 True 100 100 0.000233496 0.000175241 0.75051 -0.8 25 True 100 1000 0.00055654 0.00102658 1.84458 -0.8 25 True 1000 100 0.000463814 0.000783267 1.68875 -0.8 25 True 1000 1000 0.00186905 0.00755344 4.04132 -0.8 25 False 100 100 0.000240243 0.000175047 0.728625 -0.8 25 False 100 1000 0.000578102 0.00104499 1.80763 -0.8 25 False 1000 100 0.000485113 0.000776849 1.60138 -0.8 25 False 1000 1000 0.00211448 0.00752736 3.55992 -``` - -##### Args: - - -* `sp_a`: SparseTensor A, of rank 2. -* `b`: A dense Matrix with the same dtype as sp_a. -* `adjoint_a`: Use the adjoint of A in the matrix multiply. If A is complex, - this is transpose(conj(A)). Otherwise it's transpose(A). -* `adjoint_b`: Use the adjoint of B in the matrix multiply. If B is complex, - this is transpose(conj(B)). Otherwise it's transpose(B). -* `name`: A name prefix for the returned tensors (optional) - -##### Returns: - - A dense matrix (pseudo-code in dense np.matrix notation): - A = A.H if adjoint_a else A - B = B.H if adjoint_b else B - return A*B - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.square.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.square.md deleted file mode 100644 index 940154968f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.square.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.square(x, name=None)` {#square} - -Computes square of x element-wise. - -I.e., \(y = x * x = x^2\). - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. Must be one of the following types: `half`, - `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.string_to_hash_bucket.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.string_to_hash_bucket.md deleted file mode 100644 index 1b818c2d3b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.string_to_hash_bucket.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.string_to_hash_bucket(string_tensor, num_buckets, name=None)` {#string_to_hash_bucket} - -Converts each string in the input Tensor to its hash mod by a number of buckets. - -The hash function is deterministic on the content of the string within the -process. - -Note that the hash function may change from time to time. -This functionality will be deprecated and it's recommended to use -`tf.string_to_hash_bucket_fast()` or `tf.string_to_hash_bucket_strong()`. - -##### Args: - - -* `string_tensor`: A `Tensor` of type `string`. -* `num_buckets`: An `int` that is `>= 1`. The number of buckets. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `int64`. - A Tensor of the same shape as the input `string_tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.summary.FileWriter.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.summary.FileWriter.md deleted file mode 100644 index 526e408fba..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.summary.FileWriter.md +++ /dev/null @@ -1,209 +0,0 @@ -Writes `Summary` protocol buffers to event files. - -The `FileWriter` class provides a mechanism to create an event file in a -given directory and add summaries and events to it. The class updates the -file contents asynchronously. This allows a training program to call methods -to add data to the file directly from the training loop, without slowing down -training. -- - - - -#### `tf.summary.FileWriter.__init__(logdir, graph=None, max_queue=10, flush_secs=120, graph_def=None)` {#FileWriter.__init__} - -Creates a `FileWriter` and an event file. - -On construction the summary writer creates a new event file in `logdir`. -This event file will contain `Event` protocol buffers constructed when you -call one of the following functions: `add_summary()`, `add_session_log()`, -`add_event()`, or `add_graph()`. - -If you pass a `Graph` to the constructor it is added to -the event file. (This is equivalent to calling `add_graph()` later). - -TensorBoard will pick the graph from the file and display it graphically so -you can interactively explore the graph you built. You will usually pass -the graph from the session in which you launched it: - -```python -...create a graph... -# Launch the graph in a session. -sess = tf.Session() -# Create a summary writer, add the 'graph' to the event file. -writer = tf.summary.FileWriter(, sess.graph) -``` - -The other arguments to the constructor control the asynchronous writes to -the event file: - -* `flush_secs`: How often, in seconds, to flush the added summaries - and events to disk. -* `max_queue`: Maximum number of summaries or events pending to be - written to disk before one of the 'add' calls block. - -##### Args: - - -* `logdir`: A string. Directory where event file will be written. -* `graph`: A `Graph` object, such as `sess.graph`. -* `max_queue`: Integer. Size of the queue for pending events and summaries. -* `flush_secs`: Number. How often, in seconds, to flush the - pending events and summaries to disk. -* `graph_def`: DEPRECATED: Use the `graph` argument instead. - - -- - - - -#### `tf.summary.FileWriter.add_event(event)` {#FileWriter.add_event} - -Adds an event to the event file. - -##### Args: - - -* `event`: An `Event` protocol buffer. - - -- - - - -#### `tf.summary.FileWriter.add_graph(graph, global_step=None, graph_def=None)` {#FileWriter.add_graph} - -Adds a `Graph` to the event file. - -The graph described by the protocol buffer will be displayed by -TensorBoard. Most users pass a graph in the constructor instead. - -##### Args: - - -* `graph`: A `Graph` object, such as `sess.graph`. -* `global_step`: Number. Optional global step counter to record with the - graph. -* `graph_def`: DEPRECATED. Use the `graph` parameter instead. - -##### Raises: - - -* `ValueError`: If both graph and graph_def are passed to the method. - - -- - - - -#### `tf.summary.FileWriter.add_meta_graph(meta_graph_def, global_step=None)` {#FileWriter.add_meta_graph} - -Adds a `MetaGraphDef` to the event file. - -The `MetaGraphDef` allows running the given graph via -`saver.import_meta_graph()`. - -##### Args: - - -* `meta_graph_def`: A `MetaGraphDef` object, often as retured by - `saver.export_meta_graph()`. -* `global_step`: Number. Optional global step counter to record with the - graph. - -##### Raises: - - -* `TypeError`: If both `meta_graph_def` is not an instance of `MetaGraphDef`. - - -- - - - -#### `tf.summary.FileWriter.add_run_metadata(run_metadata, tag, global_step=None)` {#FileWriter.add_run_metadata} - -Adds a metadata information for a single session.run() call. - -##### Args: - - -* `run_metadata`: A `RunMetadata` protobuf object. -* `tag`: The tag name for this metadata. -* `global_step`: Number. Optional global step counter to record with the - StepStats. - -##### Raises: - - -* `ValueError`: If the provided tag was already used for this type of event. - - -- - - - -#### `tf.summary.FileWriter.add_session_log(session_log, global_step=None)` {#FileWriter.add_session_log} - -Adds a `SessionLog` protocol buffer to the event file. - -This method wraps the provided session in an `Event` protocol buffer -and adds it to the event file. - -##### Args: - - -* `session_log`: A `SessionLog` protocol buffer. -* `global_step`: Number. Optional global step value to record with the - summary. - - -- - - - -#### `tf.summary.FileWriter.add_summary(summary, global_step=None)` {#FileWriter.add_summary} - -Adds a `Summary` protocol buffer to the event file. - -This method wraps the provided summary in an `Event` protocol buffer -and adds it to the event file. - -You can pass the result of evaluating any summary op, using -[`Session.run()`](client.md#Session.run) or -[`Tensor.eval()`](framework.md#Tensor.eval), to this -function. Alternatively, you can pass a `tf.Summary` protocol -buffer that you populate with your own data. The latter is -commonly done to report evaluation results in event files. - -##### Args: - - -* `summary`: A `Summary` protocol buffer, optionally serialized as a string. -* `global_step`: Number. Optional global step value to record with the - summary. - - -- - - - -#### `tf.summary.FileWriter.close()` {#FileWriter.close} - -Flushes the event file to disk and close the file. - -Call this method when you do not need the summary writer anymore. - - -- - - - -#### `tf.summary.FileWriter.flush()` {#FileWriter.flush} - -Flushes the event file to disk. - -Call this method to make sure that all pending events have been written to -disk. - - -- - - - -#### `tf.summary.FileWriter.get_logdir()` {#FileWriter.get_logdir} - -Returns the directory where event file will be written. - - -- - - - -#### `tf.summary.FileWriter.reopen()` {#FileWriter.reopen} - -Reopens the EventFileWriter. - -Can be called after `close()` to add more events in the same directory. -The events will go into a new events file. - -Does nothing if the EventFileWriter was not closed. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.summary.FileWriterCache.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.summary.FileWriterCache.md deleted file mode 100644 index 3c6c8773b3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.summary.FileWriterCache.md +++ /dev/null @@ -1,26 +0,0 @@ -Cache for file writers. - -This class caches file writers, one per directory. -- - - - -#### `tf.summary.FileWriterCache.clear()` {#FileWriterCache.clear} - -Clear cached summary writers. Currently only used for unit tests. - - -- - - - -#### `tf.summary.FileWriterCache.get(logdir)` {#FileWriterCache.get} - -Returns the FileWriter for the specified directory. - -##### Args: - - -* `logdir`: str, name of the directory. - -##### Returns: - - A `FileWriter`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.MomentumOptimizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.MomentumOptimizer.md deleted file mode 100644 index 810f802c25..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.MomentumOptimizer.md +++ /dev/null @@ -1,21 +0,0 @@ -Optimizer that implements the Momentum algorithm. - -- - - - -#### `tf.train.MomentumOptimizer.__init__(learning_rate, momentum, use_locking=False, name='Momentum', use_nesterov=False)` {#MomentumOptimizer.__init__} - -Construct a new Momentum optimizer. - -##### Args: - - -* `learning_rate`: A `Tensor` or a floating point value. The learning rate. -* `momentum`: A `Tensor` or a floating point value. The momentum. -* `use_locking`: If `True` use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "Momentum". -* `use_nesterov`: If `True` use Nesterov Momentum. - See [Sutskever et. al., 2013]( -* `http`: //jmlr.org/proceedings/papers/v28/sutskever13.pdf) - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.ProximalGradientDescentOptimizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.ProximalGradientDescentOptimizer.md deleted file mode 100644 index ee14fe89df..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.ProximalGradientDescentOptimizer.md +++ /dev/null @@ -1,24 +0,0 @@ -Optimizer that implements the proximal gradient descent algorithm. - -See this [paper](http://papers.nips.cc/paper/3793-efficient-learning-using-forward-backward-splitting.pdf). - -- - - - -#### `tf.train.ProximalGradientDescentOptimizer.__init__(learning_rate, l1_regularization_strength=0.0, l2_regularization_strength=0.0, use_locking=False, name='ProximalGradientDescent')` {#ProximalGradientDescentOptimizer.__init__} - -Construct a new proximal gradient descent optimizer. - -##### Args: - - -* `learning_rate`: A Tensor or a floating point value. The learning - rate to use. -* `l1_regularization_strength`: A float value, must be greater than or - equal to zero. -* `l2_regularization_strength`: A float value, must be greater than or - equal to zero. -* `use_locking`: If True use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "GradientDescent". - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.SessionRunValues.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.SessionRunValues.md deleted file mode 100644 index 7856c8bf92..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.SessionRunValues.md +++ /dev/null @@ -1,66 +0,0 @@ -Contains the results of `Session.run()`. - -In the future we may use this object to add more information about result of -run without changing the Hook API. - -Args: - results: The return values from `Session.run()` corresponding to the fetches - attribute returned in the RunArgs. Note that this has the same shape as - the RunArgs fetches. For example: - fetches = global_step_tensor - => results = nparray(int) - fetches = [train_op, summary_op, global_step_tensor] - => results = [None, nparray(string), nparray(int)] - fetches = {'step': global_step_tensor, 'summ': summary_op} - => results = {'step': nparray(int), 'summ': nparray(string)} - options: `RunOptions` from the `Session.run()` call. - run_metadata: `RunMetadata` from the `Session.run()` call. -- - - - -#### `tf.train.SessionRunValues.__getnewargs__()` {#SessionRunValues.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.train.SessionRunValues.__getstate__()` {#SessionRunValues.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.train.SessionRunValues.__new__(_cls, results, options, run_metadata)` {#SessionRunValues.__new__} - -Create new instance of SessionRunValues(results, options, run_metadata) - - -- - - - -#### `tf.train.SessionRunValues.__repr__()` {#SessionRunValues.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.train.SessionRunValues.options` {#SessionRunValues.options} - -Alias for field number 1 - - -- - - - -#### `tf.train.SessionRunValues.results` {#SessionRunValues.results} - -Alias for field number 0 - - -- - - - -#### `tf.train.SessionRunValues.run_metadata` {#SessionRunValues.run_metadata} - -Alias for field number 2 - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.export_meta_graph.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.export_meta_graph.md deleted file mode 100644 index dd31819759..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.export_meta_graph.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.train.export_meta_graph(filename=None, meta_info_def=None, graph_def=None, saver_def=None, collection_list=None, as_text=False, graph=None, export_scope=None, clear_devices=False, **kwargs)` {#export_meta_graph} - -Returns `MetaGraphDef` proto. Optionally writes it to filename. - -This function exports the graph, saver, and collection objects into -`MetaGraphDef` protocol buffer with the intention of it being imported -at a later time or location to restart training, run inference, or be -a subgraph. - -##### Args: - - -* `filename`: Optional filename including the path for writing the - generated `MetaGraphDef` protocol buffer. -* `meta_info_def`: `MetaInfoDef` protocol buffer. -* `graph_def`: `GraphDef` protocol buffer. -* `saver_def`: `SaverDef` protocol buffer. -* `collection_list`: List of string keys to collect. -* `as_text`: If `True`, writes the `MetaGraphDef` as an ASCII proto. -* `graph`: The `Graph` to import into. If `None`, use the default graph. -* `export_scope`: Optional `string`. Name scope under which to extract - the subgraph. The scope name will be striped from the node definitions - for easy import later into new name scopes. If `None`, the whole graph - is exported. graph_def and export_scope cannot both be specified. -* `clear_devices`: Whether or not to clear the device field for an `Operation` - or `Tensor` during export. -* `**kwargs`: Optional keyed arguments. - -##### Returns: - - A `MetaGraphDef` proto. - -##### Raises: - - -* `ValueError`: When the `GraphDef` is larger than 2GB. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.get_checkpoint_state.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.get_checkpoint_state.md deleted file mode 100644 index 8963539605..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.get_checkpoint_state.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.train.get_checkpoint_state(checkpoint_dir, latest_filename=None)` {#get_checkpoint_state} - -Returns CheckpointState proto from the "checkpoint" file. - -If the "checkpoint" file contains a valid CheckpointState -proto, returns it. - -##### Args: - - -* `checkpoint_dir`: The directory of checkpoints. -* `latest_filename`: Optional name of the checkpoint file. Default to - 'checkpoint'. - -##### Returns: - - A CheckpointState if the state was available, None - otherwise. - -##### Raises: - - -* `ValueError`: if the checkpoint read doesn't have model_checkpoint_path set. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.get_global_step.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.get_global_step.md deleted file mode 100644 index 7ccb41889f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.get_global_step.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.train.get_global_step(graph=None)` {#get_global_step} - -Get the global step tensor. - -The global step tensor must be an integer variable. We first try to find it -in the collection `GLOBAL_STEP`, or by name `global_step:0`. - -##### Args: - - -* `graph`: The graph to find the global step in. If missing, use default graph. - -##### Returns: - - The global step variable, or `None` if none was found. - -##### Raises: - - -* `TypeError`: If the global step tensor has a non-integer type, or if it is not - a `Variable`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.inverse_time_decay.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.inverse_time_decay.md deleted file mode 100644 index fe85cb1b12..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.train.inverse_time_decay.md +++ /dev/null @@ -1,56 +0,0 @@ -### `tf.train.inverse_time_decay(learning_rate, global_step, decay_steps, decay_rate, staircase=False, name=None)` {#inverse_time_decay} - -Applies inverse time decay to the initial learning rate. - -When training a model, it is often recommended to lower the learning rate as -the training progresses. This function applies an inverse decay function -to a provided initial learning rate. It requires an `global_step` value to -compute the decayed learning rate. You can just pass a TensorFlow variable -that you increment at each training step. - -The function returns the decayed learning rate. It is computed as: - -```python -decayed_learning_rate = learning_rate / (1 + decay_rate * t) -``` - -Example: decay 1/t with a rate of 0.5: - -```python -... -global_step = tf.Variable(0, trainable=False) -learning_rate = 0.1 -k = 0.5 -learning_rate = tf.train.inverse_time_decay(learning_rate, global_step, k) - -# Passing global_step to minimize() will increment it at each step. -learning_step = ( - tf.train.GradientDescentOptimizer(learning_rate) - .minimize(...my loss..., global_step=global_step) -) -``` - -##### Args: - - -* `learning_rate`: A scalar `float32` or `float64` `Tensor` or a - Python number. The initial learning rate. -* `global_step`: A Python number. - Global step to use for the decay computation. Must not be negative. -* `decay_steps`: How often to apply decay. -* `decay_rate`: A Python number. The decay rate. -* `staircase`: Whether to apply decay in a discrete staircase, as opposed to - continuous, fashion. -* `name`: String. Optional name of the operation. Defaults to - 'InverseTimeDecay'. - -##### Returns: - - A scalar `Tensor` of the same type as `learning_rate`. The decayed - learning rate. - -##### Raises: - - -* `ValueError`: if `global_step` is not supplied. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.truediv.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.truediv.md deleted file mode 100644 index 7a0c7a4aac..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.truediv.md +++ /dev/null @@ -1,34 +0,0 @@ -### `tf.truediv(x, y, name=None)` {#truediv} - -Divides x / y elementwise (using Python 3 division operator semantics). - -NOTE: Prefer using the Tensor operator or tf.divide which obey Python -division operator semantics. - -This function forces Python 3 division operator semantics where all integer -arguments are cast to floating types first. This op is generated by normal -`x / y` division in Python 3 and in Python 2.7 with -`from __future__ import division`. If you want integer division that rounds -down, use `x // y` or `tf.floordiv`. - -`x` and `y` must have the same numeric type. If the inputs are floating -point, the output will have the same type. If the inputs are integral, the -inputs are cast to `float32` for `int8` and `int16` and `float64` for `int32` -and `int64` (matching the behavior of Numpy). - -##### Args: - - -* `x`: `Tensor` numerator of numeric type. -* `y`: `Tensor` denominator of numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` evaluated in floating point. - -##### Raises: - - -* `TypeError`: If `x` and `y` have different dtypes. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.unique.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.unique.md deleted file mode 100644 index 5b9bc642c8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.unique.md +++ /dev/null @@ -1,34 +0,0 @@ -### `tf.unique(x, out_idx=None, name=None)` {#unique} - -Finds unique elements in a 1-D tensor. - -This operation returns a tensor `y` containing all of the unique elements of `x` -sorted in the same order that they occur in `x`. This operation also returns a -tensor `idx` the same size as `x` that contains the index of each value of `x` -in the unique output `y`. In other words: - -`y[idx[i]] = x[i] for i in [0, 1,...,rank(x) - 1]` - -For example: - -```prettyprint -# tensor 'x' is [1, 1, 2, 4, 4, 4, 7, 8, 8] -y, idx = unique(x) -y ==> [1, 2, 4, 7, 8] -idx ==> [0, 0, 1, 2, 2, 2, 3, 4, 4] -``` - -##### Args: - - -* `x`: A `Tensor`. 1-D. -* `out_idx`: An optional `tf.DType` from: `tf.int32, tf.int64`. Defaults to `tf.int32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (y, idx). - -* `y`: A `Tensor`. Has the same type as `x`. 1-D. -* `idx`: A `Tensor` of type `out_idx`. 1-D. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.variable_scope.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.variable_scope.md deleted file mode 100644 index 2bf61a0190..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.variable_scope.md +++ /dev/null @@ -1,100 +0,0 @@ -### `tf.variable_scope(name_or_scope, default_name=None, values=None, initializer=None, regularizer=None, caching_device=None, partitioner=None, custom_getter=None, reuse=None, dtype=None, use_resource=None)` {#variable_scope} - -Returns a context manager for defining ops that creates variables (layers). - -This context manager validates that the (optional) `values` are from -the same graph, ensures that graph is the default graph, and pushes a -name scope and a variable scope. - -If `name_or_scope` is not None, it is used as is. If `scope` is None, then -`default_name` is used. In that case, if the same name has been previously -used in the same scope, it will made unique be appending `_N` to it. - -Variable scope allows to create new variables and to share already created -ones while providing checks to not create or share by accident. For details, -see the [Variable Scope How To](../../how_tos/variable_scope/index.md), -here we present only a few basic examples. - -Simple example of how to create a new variable: - -```python -with tf.variable_scope("foo"): - with tf.variable_scope("bar"): - v = tf.get_variable("v", [1]) - assert v.name == "foo/bar/v:0" -``` - -Basic example of sharing a variable: - -```python -with tf.variable_scope("foo"): - v = tf.get_variable("v", [1]) -with tf.variable_scope("foo", reuse=True): - v1 = tf.get_variable("v", [1]) -assert v1 == v -``` - -Sharing a variable by capturing a scope and setting reuse: - -```python -with tf.variable_scope("foo") as scope: - v = tf.get_variable("v", [1]) - scope.reuse_variables() - v1 = tf.get_variable("v", [1]) -assert v1 == v -``` - -To prevent accidental sharing of variables, we raise an exception when -getting an existing variable in a non-reusing scope. - -```python -with tf.variable_scope("foo"): - v = tf.get_variable("v", [1]) - v1 = tf.get_variable("v", [1]) - # Raises ValueError("... v already exists ..."). -``` - -Similarly, we raise an exception when trying to get a variable that -does not exist in reuse mode. - -```python -with tf.variable_scope("foo", reuse=True): - v = tf.get_variable("v", [1]) - # Raises ValueError("... v does not exists ..."). -``` - -Note that the `reuse` flag is inherited: if we open a reusing scope, -then all its sub-scopes become reusing as well. - -##### Args: - - -* `name_or_scope`: `string` or `VariableScope`: the scope to open. -* `default_name`: The default name to use if the `name_or_scope` argument is - `None`, this name will be uniquified. If name_or_scope is provided it - won't be used and therefore it is not required and can be None. -* `values`: The list of `Tensor` arguments that are passed to the op function. -* `initializer`: default initializer for variables within this scope. -* `regularizer`: default regularizer for variables within this scope. -* `caching_device`: default caching device for variables within this scope. -* `partitioner`: default partitioner for variables within this scope. -* `custom_getter`: default custom getter for variables within this scope. -* `reuse`: `True` or `None`; if `True`, we go into reuse mode for this scope as - well as all sub-scopes; if `None`, we just inherit the parent scope reuse. -* `dtype`: type of variables created in this scope (defaults to the type - in the passed scope, or inherited from parent scope). -* `use_resource`: If False, all variables will be regular Variables. If True, - experimental ResourceVariables with well-defined semantics will be used - instead. Defaults to False (will later change to True). - -##### Returns: - - A scope that can be to captured and reused. - -##### Raises: - - -* `ValueError`: when trying to reuse within a create scope, or create within - a reuse scope, or if reuse is not `None` or `True`. -* `TypeError`: when the types of some arguments are not appropriate. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.where.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.where.md deleted file mode 100644 index 8aaf2e1463..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard7/tf.where.md +++ /dev/null @@ -1,47 +0,0 @@ -### `tf.where(condition, x=None, y=None, name=None)` {#where} - -Return the elements, either from `x` or `y`, depending on the `condition`. - -If both `x` and `y` are None, then this operation returns the coordinates of -true elements of `condition`. The coordinates are returned in a 2-D tensor -where the first dimension (rows) represents the number of true elements, and -the second dimension (columns) represents the coordinates of the true -elements. Keep in mind, the shape of the output tensor can vary depending on -how many true values there are in input. Indices are output in row-major -order. - -If both non-None, `x` and `y` must have the same shape. -The `condition` tensor must be a scalar if `x` and `y` are scalar. -If `x` and `y` are vectors or higher rank, then `condition` must be either a -vector with size matching the first dimension of `x`, or must have the same -shape as `x`. - -The `condition` tensor acts as a mask that chooses, based on the value at each -element, whether the corresponding element / row in the output should be taken -from `x` (if true) or `y` (if false). - -If `condition` is a vector and `x` and `y` are higher rank matrices, then it -chooses which row (outer dimension) to copy from `x` and `y`. If `condition` -has the same shape as `x` and `y`, then it chooses which element to copy from -`x` and `y`. - -##### Args: - - -* `condition`: A `Tensor` of type `bool` -* `x`: A Tensor which may have the same shape as `condition`. If `condition` is - rank 1, `x` may have higher rank, but its first dimension must match the - size of `condition`. -* `y`: A `tensor` with the same shape and type as `x`. -* `name`: A name of the operation (optional) - -##### Returns: - - A `Tensor` with the same type and shape as `x`, `y` if they are non-None. - A `Tensor` with shape `(num_true, dim_size(condition))`. - -##### Raises: - - -* `ValueError`: When exactly one of `x` or `y` is non-None. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.FixedLenSequenceFeature.__new__.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.FixedLenSequenceFeature.__new__.md deleted file mode 100644 index 33babc9edd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.FixedLenSequenceFeature.__new__.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.FixedLenSequenceFeature.__new__(_cls, shape, dtype, allow_missing=False)` {#FixedLenSequenceFeature.__new__} - -Create new instance of FixedLenSequenceFeature(shape, dtype, allow_missing) - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.GraphKeys.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.GraphKeys.md deleted file mode 100644 index 74b46140d2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.GraphKeys.md +++ /dev/null @@ -1,44 +0,0 @@ -Standard names to use for graph collections. - -The standard library uses various well-known names to collect and -retrieve values associated with a graph. For example, the -`tf.Optimizer` subclasses default to optimizing the variables -collected under `tf.GraphKeys.TRAINABLE_VARIABLES` if none is -specified, but it is also possible to pass an explicit list of -variables. - -The following standard keys are defined: - -* `GLOBAL_VARIABLES`: the default collection of `Variable` objects, shared - across distributed environment (model variables are subset of these). See - [`tf.global_variables()`](../../api_docs/python/state_ops.md#global_variables) - for more details. - Commonly, all `TRAINABLE_VARIABLES` variables will be in `MODEL_VARIABLES`, - and all `MODEL_VARIABLES` variables will be in `GLOBAL_VARIABLES`. -* `LOCAL_VARIABLES`: the subset of `Variable` objects that are local to each - machine. Usually used for temporarily variables, like counters. - Note: use `tf.contrib.framework.local_variable` to add to this collection. -* `MODEL_VARIABLES`: the subset of `Variable` objects that are used in the - model for inference (feed forward). Note: use - `tf.contrib.framework.model_variable` to add to this collection. -* `TRAINABLE_VARIABLES`: the subset of `Variable` objects that will - be trained by an optimizer. See - [`tf.trainable_variables()`](../../api_docs/python/state_ops.md#trainable_variables) - for more details. -* `SUMMARIES`: the summary `Tensor` objects that have been created in the - graph. See - [`tf.summary.merge_all()`](../../api_docs/python/summary.md#merge_all) - for more details. -* `QUEUE_RUNNERS`: the `QueueRunner` objects that are used to - produce input for a computation. See - [`tf.start_queue_runners()`](../../api_docs/python/train.md#start_queue_runners) - for more details. -* `MOVING_AVERAGE_VARIABLES`: the subset of `Variable` objects that will also - keep moving averages. See - [`tf.moving_average_variables()`](../../api_docs/python/state_ops.md#moving_average_variables) - for more details. -* `REGULARIZATION_LOSSES`: regularization losses collected during graph - construction. -* `WEIGHTS`: weights inside neural network layers -* `BIASES`: biases inside neural network layers -* `ACTIVATIONS`: activations of neural network layers diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.IndexedSlices.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.IndexedSlices.md deleted file mode 100644 index cb674c3ea8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.IndexedSlices.md +++ /dev/null @@ -1,102 +0,0 @@ -A sparse representation of a set of tensor slices at given indices. - -This class is a simple wrapper for a pair of `Tensor` objects: - -* `values`: A `Tensor` of any dtype with shape `[D0, D1, ..., Dn]`. -* `indices`: A 1-D integer `Tensor` with shape `[D0]`. - -An `IndexedSlices` is typically used to represent a subset of a larger -tensor `dense` of shape `[LARGE0, D1, .. , DN]` where `LARGE0 >> D0`. -The values in `indices` are the indices in the first dimension of -the slices that have been extracted from the larger tensor. - -The dense tensor `dense` represented by an `IndexedSlices` `slices` has - -```python -dense[slices.indices[i], :, :, :, ...] = slices.values[i, :, :, :, ...] -``` - -The `IndexedSlices` class is used principally in the definition of -gradients for operations that have sparse gradients -(e.g. [`tf.gather`](../../api_docs/python/array_ops.md#gather)). - -Contrast this representation with -[`SparseTensor`](../../api_docs/python/sparse_ops.md#SparseTensor), -which uses multi-dimensional indices and scalar values. -- - - - -#### `tf.IndexedSlices.__init__(values, indices, dense_shape=None)` {#IndexedSlices.__init__} - -Creates an `IndexedSlices`. - - -- - - - -#### `tf.IndexedSlices.__neg__()` {#IndexedSlices.__neg__} - - - - -- - - - -#### `tf.IndexedSlices.__str__()` {#IndexedSlices.__str__} - - - - -- - - - -#### `tf.IndexedSlices.dense_shape` {#IndexedSlices.dense_shape} - -A 1-D `Tensor` containing the shape of the corresponding dense tensor. - - -- - - - -#### `tf.IndexedSlices.device` {#IndexedSlices.device} - -The name of the device on which `values` will be produced, or `None`. - - -- - - - -#### `tf.IndexedSlices.dtype` {#IndexedSlices.dtype} - -The `DType` of elements in this tensor. - - -- - - - -#### `tf.IndexedSlices.graph` {#IndexedSlices.graph} - -The `Graph` that contains the values, indices, and shape tensors. - - -- - - - -#### `tf.IndexedSlices.indices` {#IndexedSlices.indices} - -A 1-D `Tensor` containing the indices of the slices. - - -- - - - -#### `tf.IndexedSlices.name` {#IndexedSlices.name} - -The name of this `IndexedSlices`. - - -- - - - -#### `tf.IndexedSlices.op` {#IndexedSlices.op} - -The `Operation` that produces `values` as an output. - - -- - - - -#### `tf.IndexedSlices.values` {#IndexedSlices.values} - -A `Tensor` containing the values of the slices. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.RandomShuffleQueue.from_list.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.RandomShuffleQueue.from_list.md deleted file mode 100644 index 546ee36157..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.RandomShuffleQueue.from_list.md +++ /dev/null @@ -1,21 +0,0 @@ -#### `tf.RandomShuffleQueue.from_list(index, queues)` {#RandomShuffleQueue.from_list} - -Create a queue using the queue reference from `queues[index]`. - -##### Args: - - -* `index`: An integer scalar tensor that determines the input that gets - selected. -* `queues`: A list of `QueueBase` objects. - -##### Returns: - - A `QueueBase` object. - -##### Raises: - - -* `TypeError`: When `queues` is not a list of `QueueBase` objects, - or when the data types of `queues` are not all the same. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.Session.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.Session.md deleted file mode 100644 index 92766465b2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.Session.md +++ /dev/null @@ -1,416 +0,0 @@ -A class for running TensorFlow operations. - -A `Session` object encapsulates the environment in which `Operation` -objects are executed, and `Tensor` objects are evaluated. For -example: - -```python -# Build a graph. -a = tf.constant(5.0) -b = tf.constant(6.0) -c = a * b - -# Launch the graph in a session. -sess = tf.Session() - -# Evaluate the tensor `c`. -print(sess.run(c)) -``` - -A session may own resources, such as -[variables](../../api_docs/python/state_ops.md#Variable), [queues](../../api_docs/python/io_ops.md#QueueBase), -and [readers](../../api_docs/python/io_ops.md#ReaderBase). It is important to release -these resources when they are no longer required. To do this, either -invoke the [`close()`](#Session.close) method on the session, or use -the session as a context manager. The following two examples are -equivalent: - -```python -# Using the `close()` method. -sess = tf.Session() -sess.run(...) -sess.close() - -# Using the context manager. -with tf.Session() as sess: - sess.run(...) -``` - -The [`ConfigProto`](https://www.tensorflow.org/code/tensorflow/core/protobuf/config.proto) -protocol buffer exposes various configuration options for a -session. For example, to create a session that uses soft constraints -for device placement, and log the resulting placement decisions, -create a session as follows: - -```python -# Launch the graph in a session that allows soft device placement and -# logs the placement decisions. -sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True, - log_device_placement=True)) -``` -- - - - -#### `tf.Session.__del__()` {#Session.__del__} - - - - -- - - - -#### `tf.Session.__enter__()` {#Session.__enter__} - - - - -- - - - -#### `tf.Session.__exit__(exec_type, exec_value, exec_tb)` {#Session.__exit__} - - - - -- - - - -#### `tf.Session.__init__(target='', graph=None, config=None)` {#Session.__init__} - -Creates a new TensorFlow session. - -If no `graph` argument is specified when constructing the session, -the default graph will be launched in the session. If you are -using more than one graph (created with `tf.Graph()` in the same -process, you will have to use different sessions for each graph, -but each graph can be used in multiple sessions. In this case, it -is often clearer to pass the graph to be launched explicitly to -the session constructor. - -##### Args: - - -* `target`: (Optional.) The execution engine to connect to. - Defaults to using an in-process engine. See - [Distributed Tensorflow](https://www.tensorflow.org/how_tos/distributed/index.html) - for more examples. -* `graph`: (Optional.) The `Graph` to be launched (described above). -* `config`: (Optional.) A [`ConfigProto`](https://www.tensorflow.org/code/tensorflow/core/protobuf/config.proto) - protocol buffer with configuration options for the session. - - -- - - - -#### `tf.Session.as_default()` {#Session.as_default} - -Returns a context manager that makes this object the default session. - -Use with the `with` keyword to specify that calls to -[`Operation.run()`](../../api_docs/python/framework.md#Operation.run) or -[`Tensor.eval()`](../../api_docs/python/framework.md#Tensor.eval) should be -executed in this session. - -```python -c = tf.constant(..) -sess = tf.Session() - -with sess.as_default(): - assert tf.get_default_session() is sess - print(c.eval()) -``` - -To get the current default session, use -[`tf.get_default_session()`](#get_default_session). - - -*N.B.* The `as_default` context manager *does not* close the -session when you exit the context, and you must close the session -explicitly. - -```python -c = tf.constant(...) -sess = tf.Session() -with sess.as_default(): - print(c.eval()) -# ... -with sess.as_default(): - print(c.eval()) - -sess.close() -``` - -Alternatively, you can use `with tf.Session():` to create a -session that is automatically closed on exiting the context, -including when an uncaught exception is raised. - -*N.B.* The default graph is a property of the current thread. If you -create a new thread, and wish to use the default session in that -thread, you must explicitly add a `with sess.as_default():` in that -thread's function. - -##### Returns: - - A context manager using this session as the default session. - - -- - - - -#### `tf.Session.close()` {#Session.close} - -Closes this session. - -Calling this method frees all resources associated with the session. - -##### Raises: - - tf.errors.OpError: Or one of its subclasses if an error occurs while - closing the TensorFlow session. - - -- - - - -#### `tf.Session.graph` {#Session.graph} - -The graph that was launched in this session. - - -- - - - -#### `tf.Session.graph_def` {#Session.graph_def} - -A serializable version of the underlying TensorFlow graph. - -##### Returns: - - A graph_pb2.GraphDef proto containing nodes for all of the Operations in - the underlying TensorFlow graph. - - -- - - - -#### `tf.Session.partial_run(handle, fetches, feed_dict=None)` {#Session.partial_run} - -Continues the execution with more feeds and fetches. - -This is EXPERIMENTAL and subject to change. - -To use partial execution, a user first calls `partial_run_setup()` and -then a sequence of `partial_run()`. `partial_run_setup` specifies the -list of feeds and fetches that will be used in the subsequent -`partial_run` calls. - -The optional `feed_dict` argument allows the caller to override -the value of tensors in the graph. See run() for more information. - -Below is a simple example: - -```python -a = array_ops.placeholder(dtypes.float32, shape=[]) -b = array_ops.placeholder(dtypes.float32, shape=[]) -c = array_ops.placeholder(dtypes.float32, shape=[]) -r1 = math_ops.add(a, b) -r2 = math_ops.multiply(r1, c) - -h = sess.partial_run_setup([r1, r2], [a, b, c]) -res = sess.partial_run(h, r1, feed_dict={a: 1, b: 2}) -res = sess.partial_run(h, r2, feed_dict={c: res}) -``` - -##### Args: - - -* `handle`: A handle for a sequence of partial runs. -* `fetches`: A single graph element, a list of graph elements, - or a dictionary whose values are graph elements or lists of graph - elements (see documentation for `run`). -* `feed_dict`: A dictionary that maps graph elements to values - (described above). - -##### Returns: - - Either a single value if `fetches` is a single graph element, or - a list of values if `fetches` is a list, or a dictionary with the - same keys as `fetches` if that is a dictionary - (see documentation for `run`). - -##### Raises: - - tf.errors.OpError: Or one of its subclasses on error. - - -- - - - -#### `tf.Session.partial_run_setup(fetches, feeds=None)` {#Session.partial_run_setup} - -Sets up a graph with feeds and fetches for partial run. - -This is EXPERIMENTAL and subject to change. - -Note that contrary to `run`, `feeds` only specifies the graph elements. -The tensors will be supplied by the subsequent `partial_run` calls. - -##### Args: - - -* `fetches`: A single graph element, or a list of graph elements. -* `feeds`: A single graph element, or a list of graph elements. - -##### Returns: - - A handle for partial run. - -##### Raises: - - -* `RuntimeError`: If this `Session` is in an invalid state (e.g. has been - closed). -* `TypeError`: If `fetches` or `feed_dict` keys are of an inappropriate type. - tf.errors.OpError: Or one of its subclasses if a TensorFlow error happens. - - -- - - - -#### `tf.Session.reset(target, containers=None, config=None)` {#Session.reset} - -Resets resource containers on `target`, and close all connected sessions. - -A resource container is distributed across all workers in the -same cluster as `target`. When a resource container on `target` -is reset, resources associated with that container will be cleared. -In particular, all Variables in the container will become undefined: -they lose their values and shapes. - -NOTE: -(i) reset() is currently only implemented for distributed sessions. -(ii) Any sessions on the master named by `target` will be closed. - -If no resource containers are provided, all containers are reset. - -##### Args: - - -* `target`: The execution engine to connect to. -* `containers`: A list of resource container name strings, or `None` if all of - all the containers are to be reset. -* `config`: (Optional.) Protocol buffer with configuration options. - -##### Raises: - - tf.errors.OpError: Or one of its subclasses if an error occurs while - resetting containers. - - -- - - - -#### `tf.Session.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#Session.run} - -Runs operations and evaluates tensors in `fetches`. - -This method runs one "step" of TensorFlow computation, by -running the necessary graph fragment to execute every `Operation` -and evaluate every `Tensor` in `fetches`, substituting the values in -`feed_dict` for the corresponding input values. - -The `fetches` argument may be a single graph element, or an arbitrarily -nested list, tuple, namedtuple, dict, or OrderedDict containing graph -elements at its leaves. A graph element can be one of the following types: - -* An [`Operation`](../../api_docs/python/framework.md#Operation). - The corresponding fetched value will be `None`. -* A [`Tensor`](../../api_docs/python/framework.md#Tensor). - The corresponding fetched value will be a numpy ndarray containing the - value of that tensor. -* A [`SparseTensor`](../../api_docs/python/sparse_ops.md#SparseTensor). - The corresponding fetched value will be a - [`SparseTensorValue`](../../api_docs/python/sparse_ops.md#SparseTensorValue) - containing the value of that sparse tensor. -* A `get_tensor_handle` op. The corresponding fetched value will be a - numpy ndarray containing the handle of that tensor. -* A `string` which is the name of a tensor or operation in the graph. - -The value returned by `run()` has the same shape as the `fetches` argument, -where the leaves are replaced by the corresponding values returned by -TensorFlow. - -Example: - -```python - a = tf.constant([10, 20]) - b = tf.constant([1.0, 2.0]) - # 'fetches' can be a singleton - v = session.run(a) - # v is the numpy array [10, 20] - # 'fetches' can be a list. - v = session.run([a, b]) - # v a Python list with 2 numpy arrays: the numpy array [10, 20] and the - # 1-D array [1.0, 2.0] - # 'fetches' can be arbitrary lists, tuples, namedtuple, dicts: - MyData = collections.namedtuple('MyData', ['a', 'b']) - v = session.run({'k1': MyData(a, b), 'k2': [b, a]}) - # v is a dict with - # v['k1'] is a MyData namedtuple with 'a' the numpy array [10, 20] and - # 'b' the numpy array [1.0, 2.0] - # v['k2'] is a list with the numpy array [1.0, 2.0] and the numpy array - # [10, 20]. -``` - -The optional `feed_dict` argument allows the caller to override -the value of tensors in the graph. Each key in `feed_dict` can be -one of the following types: - -* If the key is a [`Tensor`](../../api_docs/python/framework.md#Tensor), the - value may be a Python scalar, string, list, or numpy ndarray - that can be converted to the same `dtype` as that - tensor. Additionally, if the key is a - [placeholder](../../api_docs/python/io_ops.md#placeholder), the shape of - the value will be checked for compatibility with the placeholder. -* If the key is a - [`SparseTensor`](../../api_docs/python/sparse_ops.md#SparseTensor), - the value should be a - [`SparseTensorValue`](../../api_docs/python/sparse_ops.md#SparseTensorValue). -* If the key is a nested tuple of `Tensor`s or `SparseTensor`s, the value - should be a nested tuple with the same structure that maps to their - corresponding values as above. - -Each value in `feed_dict` must be convertible to a numpy array of the dtype -of the corresponding key. - -The optional `options` argument expects a [`RunOptions`] proto. The options -allow controlling the behavior of this particular step (e.g. turning tracing -on). - -The optional `run_metadata` argument expects a [`RunMetadata`] proto. When -appropriate, the non-Tensor output of this step will be collected there. For -example, when users turn on tracing in `options`, the profiled info will be -collected into this argument and passed back. - -##### Args: - - -* `fetches`: A single graph element, a list of graph elements, - or a dictionary whose values are graph elements or lists of graph - elements (described above). -* `feed_dict`: A dictionary that maps graph elements to values - (described above). -* `options`: A [`RunOptions`] protocol buffer -* `run_metadata`: A [`RunMetadata`] protocol buffer - -##### Returns: - - Either a single value if `fetches` is a single graph element, or - a list of values if `fetches` is a list, or a dictionary with the - same keys as `fetches` if that is a dictionary (described above). - -##### Raises: - - -* `RuntimeError`: If this `Session` is in an invalid state (e.g. has been - closed). -* `TypeError`: If `fetches` or `feed_dict` keys are of an inappropriate type. -* `ValueError`: If `fetches` or `feed_dict` keys are invalid or refer to a - `Tensor` that doesn't exist. - - -- - - - -#### `tf.Session.sess_str` {#Session.sess_str} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.VarLenFeature.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.VarLenFeature.md deleted file mode 100644 index 85f2546d3e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.VarLenFeature.md +++ /dev/null @@ -1,39 +0,0 @@ -Configuration for parsing a variable-length input feature. - -Fields: - dtype: Data type of input. -- - - - -#### `tf.VarLenFeature.__getnewargs__()` {#VarLenFeature.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.VarLenFeature.__getstate__()` {#VarLenFeature.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.VarLenFeature.__new__(_cls, dtype)` {#VarLenFeature.__new__} - -Create new instance of VarLenFeature(dtype,) - - -- - - - -#### `tf.VarLenFeature.__repr__()` {#VarLenFeature.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.VarLenFeature.dtype` {#VarLenFeature.dtype} - -Alias for field number 0 - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.Variable.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.Variable.md deleted file mode 100644 index 8c921f7c04..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.Variable.md +++ /dev/null @@ -1,1156 +0,0 @@ -See the [Variables How To](../../how_tos/variables/index.md) for a high -level overview. - -A variable maintains state in the graph across calls to `run()`. You add a -variable to the graph by constructing an instance of the class `Variable`. - -The `Variable()` constructor requires an initial value for the variable, -which can be a `Tensor` of any type and shape. The initial value defines the -type and shape of the variable. After construction, the type and shape of -the variable are fixed. The value can be changed using one of the assign -methods. - -If you want to change the shape of a variable later you have to use an -`assign` Op with `validate_shape=False`. - -Just like any `Tensor`, variables created with `Variable()` can be used as -inputs for other Ops in the graph. Additionally, all the operators -overloaded for the `Tensor` class are carried over to variables, so you can -also add nodes to the graph by just doing arithmetic on variables. - -```python -import tensorflow as tf - -# Create a variable. -w = tf.Variable(, name=) - -# Use the variable in the graph like any Tensor. -y = tf.matmul(w, ...another variable or tensor...) - -# The overloaded operators are available too. -z = tf.sigmoid(w + y) - -# Assign a new value to the variable with `assign()` or a related method. -w.assign(w + 1.0) -w.assign_add(1.0) -``` - -When you launch the graph, variables have to be explicitly initialized before -you can run Ops that use their value. You can initialize a variable by -running its *initializer op*, restoring the variable from a save file, or -simply running an `assign` Op that assigns a value to the variable. In fact, -the variable *initializer op* is just an `assign` Op that assigns the -variable's initial value to the variable itself. - -```python -# Launch the graph in a session. -with tf.Session() as sess: - # Run the variable initializer. - sess.run(w.initializer) - # ...you now can run ops that use the value of 'w'... -``` - -The most common initialization pattern is to use the convenience function -`global_variables_initializer()` to add an Op to the graph that initializes -all the variables. You then run that Op after launching the graph. - -```python -# Add an Op to initialize global variables. -init_op = tf.global_variables_initializer() - -# Launch the graph in a session. -with tf.Session() as sess: - # Run the Op that initializes global variables. - sess.run(init_op) - # ...you can now run any Op that uses variable values... -``` - -If you need to create a variable with an initial value dependent on another -variable, use the other variable's `initialized_value()`. This ensures that -variables are initialized in the right order. - -All variables are automatically collected in the graph where they are -created. By default, the constructor adds the new variable to the graph -collection `GraphKeys.GLOBAL_VARIABLES`. The convenience function -`global_variables()` returns the contents of that collection. - -When building a machine learning model it is often convenient to distinguish -between variables holding the trainable model parameters and other variables -such as a `global step` variable used to count training steps. To make this -easier, the variable constructor supports a `trainable=` parameter. If -`True`, the new variable is also added to the graph collection -`GraphKeys.TRAINABLE_VARIABLES`. The convenience function -`trainable_variables()` returns the contents of this collection. The -various `Optimizer` classes use this collection as the default list of -variables to optimize. - - -Creating a variable. - -- - - - -#### `tf.Variable.__init__(initial_value=None, trainable=True, collections=None, validate_shape=True, caching_device=None, name=None, variable_def=None, dtype=None, expected_shape=None, import_scope=None)` {#Variable.__init__} - -Creates a new variable with value `initial_value`. - -The new variable is added to the graph collections listed in `collections`, -which defaults to `[GraphKeys.GLOBAL_VARIABLES]`. - -If `trainable` is `True` the variable is also added to the graph collection -`GraphKeys.TRAINABLE_VARIABLES`. - -This constructor creates both a `variable` Op and an `assign` Op to set the -variable to its initial value. - -##### Args: - - -* `initial_value`: A `Tensor`, or Python object convertible to a `Tensor`, - which is the initial value for the Variable. The initial value must have - a shape specified unless `validate_shape` is set to False. Can also be a - callable with no argument that returns the initial value when called. In - that case, `dtype` must be specified. (Note that initializer functions - from init_ops.py must first be bound to a shape before being used here.) -* `trainable`: If `True`, the default, also adds the variable to the graph - collection `GraphKeys.TRAINABLE_VARIABLES`. This collection is used as - the default list of variables to use by the `Optimizer` classes. -* `collections`: List of graph collections keys. The new variable is added to - these collections. Defaults to `[GraphKeys.GLOBAL_VARIABLES]`. -* `validate_shape`: If `False`, allows the variable to be initialized with a - value of unknown shape. If `True`, the default, the shape of - `initial_value` must be known. -* `caching_device`: Optional device string describing where the Variable - should be cached for reading. Defaults to the Variable's device. - If not `None`, caches on another device. Typical use is to cache - on the device where the Ops using the Variable reside, to deduplicate - copying through `Switch` and other conditional statements. -* `name`: Optional name for the variable. Defaults to `'Variable'` and gets - uniquified automatically. -* `variable_def`: `VariableDef` protocol buffer. If not `None`, recreates - the Variable object with its contents. `variable_def` and the other - arguments are mutually exclusive. -* `dtype`: If set, initial_value will be converted to the given type. - If `None`, either the datatype will be kept (if `initial_value` is - a Tensor), or `convert_to_tensor` will decide. -* `expected_shape`: A TensorShape. If set, initial_value is expected - to have this shape. -* `import_scope`: Optional `string`. Name scope to add to the - `Variable.` Only used when initializing from protocol buffer. - -##### Raises: - - -* `ValueError`: If both `variable_def` and initial_value are specified. -* `ValueError`: If the initial value is not specified, or does not have a - shape and `validate_shape` is `True`. - - -- - - - -#### `tf.Variable.initialized_value()` {#Variable.initialized_value} - -Returns the value of the initialized variable. - -You should use this instead of the variable itself to initialize another -variable with a value that depends on the value of this variable. - -Beware of using initialized_value except during initialization: -initialized_value causes the Variable's initializer op to be run, so running -this op resets the variable to the initial value. - -```python -# Initialize 'v' with a random tensor. -v = tf.Variable(tf.truncated_normal([10, 40])) -# Use `initialized_value` to guarantee that `v` has been -# initialized before its value is used to initialize `w`. -# The random values are picked only once. -w = tf.Variable(v.initialized_value() * 2.0) -``` - -##### Returns: - - A `Tensor` holding the value of this variable after its initializer - has run. - - - -Changing a variable value. - -- - - - -#### `tf.Variable.assign(value, use_locking=False)` {#Variable.assign} - -Assigns a new value to the variable. - -This is essentially a shortcut for `assign(self, value)`. - -##### Args: - - -* `value`: A `Tensor`. The new value for this variable. -* `use_locking`: If `True`, use locking during the assignment. - -##### Returns: - - A `Tensor` that will hold the new value of this variable after - the assignment has completed. - - -- - - - -#### `tf.Variable.assign_add(delta, use_locking=False)` {#Variable.assign_add} - -Adds a value to this variable. - - This is essentially a shortcut for `assign_add(self, delta)`. - -##### Args: - - -* `delta`: A `Tensor`. The value to add to this variable. -* `use_locking`: If `True`, use locking during the operation. - -##### Returns: - - A `Tensor` that will hold the new value of this variable after - the addition has completed. - - -- - - - -#### `tf.Variable.assign_sub(delta, use_locking=False)` {#Variable.assign_sub} - -Subtracts a value from this variable. - -This is essentially a shortcut for `assign_sub(self, delta)`. - -##### Args: - - -* `delta`: A `Tensor`. The value to subtract from this variable. -* `use_locking`: If `True`, use locking during the operation. - -##### Returns: - - A `Tensor` that will hold the new value of this variable after - the subtraction has completed. - - -- - - - -#### `tf.Variable.scatter_sub(sparse_delta, use_locking=False)` {#Variable.scatter_sub} - -Subtracts `IndexedSlices` from this variable. - -This is essentially a shortcut for `scatter_sub(self, sparse_delta.indices, -sparse_delta.values)`. - -##### Args: - - -* `sparse_delta`: `IndexedSlices` to be subtracted from this variable. -* `use_locking`: If `True`, use locking during the operation. - -##### Returns: - - A `Tensor` that will hold the new value of this variable after - the scattered subtraction has completed. - -##### Raises: - - -* `ValueError`: if `sparse_delta` is not an `IndexedSlices`. - - -- - - - -#### `tf.Variable.count_up_to(limit)` {#Variable.count_up_to} - -Increments this variable until it reaches `limit`. - -When that Op is run it tries to increment the variable by `1`. If -incrementing the variable would bring it above `limit` then the Op raises -the exception `OutOfRangeError`. - -If no error is raised, the Op outputs the value of the variable before -the increment. - -This is essentially a shortcut for `count_up_to(self, limit)`. - -##### Args: - - -* `limit`: value at which incrementing the variable raises an error. - -##### Returns: - - A `Tensor` that will hold the variable value before the increment. If no - other Op modifies this variable, the values produced will all be - distinct. - - - -- - - - -#### `tf.Variable.eval(session=None)` {#Variable.eval} - -In a session, computes and returns the value of this variable. - -This is not a graph construction method, it does not add ops to the graph. - -This convenience method requires a session where the graph containing this -variable has been launched. If no session is passed, the default session is -used. See the [Session class](../../api_docs/python/client.md#Session) for -more information on launching a graph and on sessions. - -```python -v = tf.Variable([1, 2]) -init = tf.global_variables_initializer() - -with tf.Session() as sess: - sess.run(init) - # Usage passing the session explicitly. - print(v.eval(sess)) - # Usage with the default session. The 'with' block - # above makes 'sess' the default session. - print(v.eval()) -``` - -##### Args: - - -* `session`: The session to use to evaluate this variable. If - none, the default session is used. - -##### Returns: - - A numpy `ndarray` with a copy of the value of this variable. - - - -Properties. - -- - - - -#### `tf.Variable.name` {#Variable.name} - -The name of this variable. - - -- - - - -#### `tf.Variable.dtype` {#Variable.dtype} - -The `DType` of this variable. - - -- - - - -#### `tf.Variable.get_shape()` {#Variable.get_shape} - -The `TensorShape` of this variable. - -##### Returns: - - A `TensorShape`. - - -- - - - -#### `tf.Variable.device` {#Variable.device} - -The device of this variable. - - -- - - - -#### `tf.Variable.initializer` {#Variable.initializer} - -The initializer operation for this variable. - - -- - - - -#### `tf.Variable.graph` {#Variable.graph} - -The `Graph` of this variable. - - -- - - - -#### `tf.Variable.op` {#Variable.op} - -The `Operation` of this variable. - - - -#### Other Methods -- - - - -#### `tf.Variable.__abs__(a, *args)` {#Variable.__abs__} - -Computes the absolute value of a tensor. - -Given a tensor of real numbers `x`, this operation returns a tensor -containing the absolute value of each element in `x`. For example, if x is -an input element and y is an output element, this operation computes -\\(y = |x|\\). - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor` of type `float32`, `float64`, `int32`, or - `int64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` the same size and type as `x` with absolute - values. - - -- - - - -#### `tf.Variable.__add__(a, *args)` {#Variable.__add__} - -Returns x + y element-wise. - -*NOTE*: `Add` supports broadcasting. `AddN` does not. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`, `complex64`, `complex128`, `string`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Variable.__and__(a, *args)` {#Variable.__and__} - -Returns the truth value of x AND y element-wise. - -*NOTE*: `LogicalAnd` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__div__(a, *args)` {#Variable.__div__} - -Divide two values using Python 2 semantics. Used for Tensor.__div__. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` returns the quotient of x and y. - - -- - - - -#### `tf.Variable.__floordiv__(a, *args)` {#Variable.__floordiv__} - -Divides `x / y` elementwise, rounding toward the most negative integer. - -The same as `tf.div(x,y)` for integers, but uses `tf.floor(tf.div(x,y))` for -floating point arguments so that the result is always an integer (though -possibly an integer represented as floating point). This op is generated by -`x // y` floor division in Python 3 and in Python 2.7 with -`from __future__ import division`. - -Note that for efficiency, `floordiv` uses C semantics for negative numbers -(unlike Python and Numpy). - -`x` and `y` must have the same type, and the result will have the same type -as well. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` rounded down (except possibly towards zero for negative integers). - -##### Raises: - - -* `TypeError`: If the inputs are complex. - - -- - - - -#### `tf.Variable.__ge__(a, *args)` {#Variable.__ge__} - -Returns the truth value of (x >= y) element-wise. - -*NOTE*: `GreaterEqual` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__getitem__(var, slice_spec)` {#Variable.__getitem__} - -Creates a slice helper object given a variable. - -This allows creating a sub-tensor from part of the current contents -of a variable. -See -[`Tensor.__getitem__`](../../api_docs/python/framework.md#Tensor.__getitem__) -for detailed examples of slicing. - -This function in addition also allows assignment to a sliced range. -This is similar to `__setitem__` functionality in Python. However, -the syntax is different so that the user can capture the assignment -operation for grouping or passing to `sess.run()`. -For example, - -```prettyprint -import tensorflow as tf -A = tf.Variable([[1,2,3], [4,5,6], [7,8,9]], dtype=tf.float32) -with tf.Session() as sess: - sess.run(tf.global_variables_initializer()) - print sess.run(A[:2, :2]) # => [[1,2], [4,5]] - - op = A[:2,:2].assign(22. * tf.ones((2, 2))) - print sess.run(op) # => [[22, 22, 3], [22, 22, 6], [7,8,9]] -``` - -Note that assignments currently do not support NumPy broadcasting -semantics. - -##### Args: - - -* `var`: An `ops.Variable` object. -* `slice_spec`: The arguments to `Tensor.__getitem__`. - -##### Returns: - - The appropriate slice of "tensor", based on "slice_spec". - As an operator. The operator also has a `assign()` method - that can be used to generate an assignment operator. - -##### Raises: - - -* `ValueError`: If a slice range is negative size. -* `TypeError`: If the slice indices aren't int, slice, or Ellipsis. - - -- - - - -#### `tf.Variable.__gt__(a, *args)` {#Variable.__gt__} - -Returns the truth value of (x > y) element-wise. - -*NOTE*: `Greater` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__invert__(a, *args)` {#Variable.__invert__} - -Returns the truth value of NOT x element-wise. - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__iter__()` {#Variable.__iter__} - -Dummy method to prevent iteration. Do not call. - -NOTE(mrry): If we register __getitem__ as an overloaded operator, -Python will valiantly attempt to iterate over the variable's Tensor from 0 -to infinity. Declaring this method prevents this unintended behavior. - -##### Raises: - - -* `TypeError`: when invoked. - - -- - - - -#### `tf.Variable.__le__(a, *args)` {#Variable.__le__} - -Returns the truth value of (x <= y) element-wise. - -*NOTE*: `LessEqual` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__lt__(a, *args)` {#Variable.__lt__} - -Returns the truth value of (x < y) element-wise. - -*NOTE*: `Less` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__mod__(a, *args)` {#Variable.__mod__} - -Returns element-wise remainder of division. When `x < 0` xor `y < 0` is - -true, this follows Python semantics in that the result here is consistent -with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. - -*NOTE*: `FloorMod` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `float32`, `float64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Variable.__mul__(a, *args)` {#Variable.__mul__} - -Dispatches cwise mul for "Dense*Dense" and "Dense*Sparse". - - -- - - - -#### `tf.Variable.__neg__(a, *args)` {#Variable.__neg__} - -Computes numerical negative value element-wise. - -I.e., \\(y = -x\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Variable.__or__(a, *args)` {#Variable.__or__} - -Returns the truth value of x OR y element-wise. - -*NOTE*: `LogicalOr` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__pow__(a, *args)` {#Variable.__pow__} - -Computes the power of one value to another. - -Given a tensor `x` and a tensor `y`, this operation computes \\(x^y\\) for -corresponding elements in `x` and `y`. For example: - -``` -# tensor 'x' is [[2, 2], [3, 3]] -# tensor 'y' is [[8, 16], [2, 3]] -tf.pow(x, y) ==> [[256, 65536], [9, 27]] -``` - -##### Args: - - -* `x`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `y`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. - - -- - - - -#### `tf.Variable.__radd__(a, *args)` {#Variable.__radd__} - -Returns x + y element-wise. - -*NOTE*: `Add` supports broadcasting. `AddN` does not. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`, `complex64`, `complex128`, `string`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Variable.__rand__(a, *args)` {#Variable.__rand__} - -Returns the truth value of x AND y element-wise. - -*NOTE*: `LogicalAnd` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__rdiv__(a, *args)` {#Variable.__rdiv__} - -Divide two values using Python 2 semantics. Used for Tensor.__div__. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` returns the quotient of x and y. - - -- - - - -#### `tf.Variable.__rfloordiv__(a, *args)` {#Variable.__rfloordiv__} - -Divides `x / y` elementwise, rounding toward the most negative integer. - -The same as `tf.div(x,y)` for integers, but uses `tf.floor(tf.div(x,y))` for -floating point arguments so that the result is always an integer (though -possibly an integer represented as floating point). This op is generated by -`x // y` floor division in Python 3 and in Python 2.7 with -`from __future__ import division`. - -Note that for efficiency, `floordiv` uses C semantics for negative numbers -(unlike Python and Numpy). - -`x` and `y` must have the same type, and the result will have the same type -as well. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` rounded down (except possibly towards zero for negative integers). - -##### Raises: - - -* `TypeError`: If the inputs are complex. - - -- - - - -#### `tf.Variable.__rmod__(a, *args)` {#Variable.__rmod__} - -Returns element-wise remainder of division. When `x < 0` xor `y < 0` is - -true, this follows Python semantics in that the result here is consistent -with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. - -*NOTE*: `FloorMod` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `float32`, `float64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Variable.__rmul__(a, *args)` {#Variable.__rmul__} - -Dispatches cwise mul for "Dense*Dense" and "Dense*Sparse". - - -- - - - -#### `tf.Variable.__ror__(a, *args)` {#Variable.__ror__} - -Returns the truth value of x OR y element-wise. - -*NOTE*: `LogicalOr` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__rpow__(a, *args)` {#Variable.__rpow__} - -Computes the power of one value to another. - -Given a tensor `x` and a tensor `y`, this operation computes \\(x^y\\) for -corresponding elements in `x` and `y`. For example: - -``` -# tensor 'x' is [[2, 2], [3, 3]] -# tensor 'y' is [[8, 16], [2, 3]] -tf.pow(x, y) ==> [[256, 65536], [9, 27]] -``` - -##### Args: - - -* `x`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `y`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. - - -- - - - -#### `tf.Variable.__rsub__(a, *args)` {#Variable.__rsub__} - -Returns x - y element-wise. - -*NOTE*: `Sub` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Variable.__rtruediv__(a, *args)` {#Variable.__rtruediv__} - - - - -- - - - -#### `tf.Variable.__rxor__(a, *args)` {#Variable.__rxor__} - -x ^ y = (x | y) & ~(x & y). - - -- - - - -#### `tf.Variable.__str__()` {#Variable.__str__} - - - - -- - - - -#### `tf.Variable.__sub__(a, *args)` {#Variable.__sub__} - -Returns x - y element-wise. - -*NOTE*: `Sub` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Variable.__truediv__(a, *args)` {#Variable.__truediv__} - - - - -- - - - -#### `tf.Variable.__xor__(a, *args)` {#Variable.__xor__} - -x ^ y = (x | y) & ~(x & y). - - -- - - - -#### `tf.Variable.from_proto(variable_def, import_scope=None)` {#Variable.from_proto} - -Returns a `Variable` object created from `variable_def`. - - -- - - - -#### `tf.Variable.initial_value` {#Variable.initial_value} - -Returns the Tensor used as the initial value for the variable. - -Note that this is different from `initialized_value()` which runs -the op that initializes the variable before returning its value. -This method returns the tensor that is used by the op that initializes -the variable. - -##### Returns: - - A `Tensor`. - - -- - - - -#### `tf.Variable.load(value, session=None)` {#Variable.load} - -Load new value into this variable - -Writes new value to variable's memory. Doesn't add ops to the graph. - -This convenience method requires a session where the graph containing this -variable has been launched. If no session is passed, the default session is -used. See the [Session class](../../api_docs/python/client.md#Session) for -more information on launching a graph and on sessions. - -```python -v = tf.Variable([1, 2]) -init = tf.global_variables_initializer() - -with tf.Session() as sess: - sess.run(init) - # Usage passing the session explicitly. - v.load([2, 3], sess) - print(v.eval(sess)) # prints [2 3] - # Usage with the default session. The 'with' block - # above makes 'sess' the default session. - v.load([3, 4], sess) - print(v.eval()) # prints [3 4] -``` - -##### Args: - - -* `value`: New variable value -* `session`: The session to use to evaluate this variable. If - none, the default session is used. - -##### Raises: - - -* `ValueError`: Session is not passed and no default session - - -- - - - -#### `tf.Variable.read_value()` {#Variable.read_value} - -Returns the value of this variable, read in the current context. - -Can be different from value() if it's on another device, with control -dependencies, etc. - -##### Returns: - - A `Tensor` containing the value of the variable. - - -- - - - -#### `tf.Variable.set_shape(shape)` {#Variable.set_shape} - -Overrides the shape for this variable. - -##### Args: - - -* `shape`: the `TensorShape` representing the overridden shape. - - -- - - - -#### `tf.Variable.to_proto(export_scope=None)` {#Variable.to_proto} - -Converts a `Variable` to a `VariableDef` protocol buffer. - -##### Args: - - -* `export_scope`: Optional `string`. Name scope to remove. - -##### Returns: - - A `VariableDef` protocol buffer, or `None` if the `Variable` is not - in the specified name scope. - - -- - - - -#### `tf.Variable.value()` {#Variable.value} - -Returns the last snapshot of this variable. - -You usually do not need to call this method as all ops that need the value -of the variable call it automatically through a `convert_to_tensor()` call. - -Returns a `Tensor` which holds the value of the variable. You can not -assign a new value to this tensor as it is not a reference to the variable. - -To avoid copies, if the consumer of the returned value is on the same device -as the variable, this actually returns the live value of the variable, not -a copy. Updates to the variable are seen by the consumer. If the consumer -is on a different device it will get a copy of the variable. - -##### Returns: - - A `Tensor` containing the value of the variable. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.acos.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.acos.md deleted file mode 100644 index 15ecc97044..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.acos.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.acos(x, name=None)` {#acos} - -Computes acos of x element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.argmax.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.argmax.md deleted file mode 100644 index 44a278e0d4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.argmax.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.argmax(input, axis=None, name=None, dimension=None)` {#argmax} - -Returns the index with the largest value across axes of a tensor. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `axis`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - int32, 0 <= axis < rank(input). Describes which axis - of the input Tensor to reduce across. For vectors, use axis = 0. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `int64`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.assert_negative.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.assert_negative.md deleted file mode 100644 index 6f93226afe..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.assert_negative.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.assert_negative(x, data=None, summarize=None, message=None, name=None)` {#assert_negative} - -Assert the condition `x < 0` holds element-wise. - -Example of adding a dependency to an operation: - -```python -with tf.control_dependencies([tf.assert_negative(x)]): - output = tf.reduce_sum(x) -``` - -Negative means, for every element `x[i]` of `x`, we have `x[i] < 0`. -If `x` is empty this is trivially satisfied. - -##### Args: - - -* `x`: Numeric `Tensor`. -* `data`: The tensors to print out if the condition is False. Defaults to - error message and first few entries of `x`. -* `summarize`: Print this many entries of each tensor. -* `message`: A string to prefix to the default message. -* `name`: A name for this operation (optional). Defaults to "assert_negative". - -##### Returns: - - Op raising `InvalidArgumentError` unless `x` is all negative. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.assert_proper_iterable.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.assert_proper_iterable.md deleted file mode 100644 index ba01073765..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.assert_proper_iterable.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.assert_proper_iterable(values)` {#assert_proper_iterable} - -Static assert that values is a "proper" iterable. - -`Ops` that expect iterables of `Tensor` can call this to validate input. -Useful since `Tensor`, `ndarray`, byte/text type are all iterables themselves. - -##### Args: - - -* `values`: Object to be checked. - -##### Raises: - - -* `TypeError`: If `values` is not iterable or is one of - `Tensor`, `SparseTensor`, `np.array`, `tf.compat.bytes_or_text_types`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.assign_sub.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.assign_sub.md deleted file mode 100644 index 73232dddc1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.assign_sub.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.assign_sub(ref, value, use_locking=None, name=None)` {#assign_sub} - -Update 'ref' by subtracting 'value' from it. - -This operation outputs "ref" after the update is done. -This makes it easier to chain operations that need to use the reset value. - -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: - `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, - `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Should be from a `Variable` node. -* `value`: A `Tensor`. Must have the same type as `ref`. - The value to be subtracted to the variable. -* `use_locking`: An optional `bool`. Defaults to `False`. - If True, the subtraction will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as "ref". Returned as a convenience for operations that want - to use the new value after the variable has been updated. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.atan.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.atan.md deleted file mode 100644 index 63fe76f460..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.atan.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.atan(x, name=None)` {#atan} - -Computes atan of x element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.batch_to_space_nd.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.batch_to_space_nd.md deleted file mode 100644 index 1f84141a13..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.batch_to_space_nd.md +++ /dev/null @@ -1,136 +0,0 @@ -### `tf.batch_to_space_nd(input, block_shape, crops, name=None)` {#batch_to_space_nd} - -BatchToSpace for N-D tensors of type T. - -This operation reshapes the "batch" dimension 0 into `M + 1` dimensions of shape -`block_shape + [batch]`, interleaves these blocks back into the grid defined by -the spatial dimensions `[1, ..., M]`, to obtain a result with the same rank as -the input. The spatial dimensions of this intermediate result are then -optionally cropped according to `crops` to produce the output. This is the -reverse of SpaceToBatch. See below for a precise description. - -##### Args: - - -* `input`: A `Tensor`. - N-D with shape `input_shape = [batch] + spatial_shape + remaining_shape`, - where spatial_shape has M dimensions. -* `block_shape`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 1-D with shape `[M]`, all values must be >= 1. -* `crops`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 2-D with shape `[M, 2]`, all values must be >= 0. - `crops[i] = [crop_start, crop_end]` specifies the amount to crop from input - dimension `i + 1`, which corresponds to spatial dimension `i`. It is - required that - `crop_start[i] + crop_end[i] <= block_shape[i] * input_shape[i + 1]`. - - This operation is equivalent to the following steps: - - 1. Reshape `input` to `reshaped` of shape: - [block_shape[0], ..., block_shape[M-1], - batch / prod(block_shape), - input_shape[1], ..., input_shape[N-1]] - - 2. Permute dimensions of `reshaped` to produce `permuted` of shape - [batch / prod(block_shape), - - input_shape[1], block_shape[0], - ..., - input_shape[M], block_shape[M-1], - - input_shape[M+1], ..., input_shape[N-1]] - - 3. Reshape `permuted` to produce `reshaped_permuted` of shape - [batch / prod(block_shape), - - input_shape[1] * block_shape[0], - ..., - input_shape[M] * block_shape[M-1], - - input_shape[M+1], - ..., - input_shape[N-1]] - - 4. Crop the start and end of dimensions `[1, ..., M]` of - `reshaped_permuted` according to `crops` to produce the output of shape: - [batch / prod(block_shape), - - input_shape[1] * block_shape[0] - crops[0,0] - crops[0,1], - ..., - input_shape[M] * block_shape[M-1] - crops[M-1,0] - crops[M-1,1], - - input_shape[M+1], ..., input_shape[N-1]] - - Some examples: - - (1) For the following input of shape `[4, 1, 1, 1]`, `block_shape = [2, 2]`, and - `crops = [[0, 0], [0, 0]]`: - - ```prettyprint - [[[[1]]], [[[2]]], [[[3]]], [[[4]]]] - ``` - - The output tensor has shape `[1, 2, 2, 1]` and value: - - ```prettyprint - x = [[[[1], [2]], [[3], [4]]]] - ``` - - (2) For the following input of shape `[4, 1, 1, 3]`, `block_shape = [2, 2]`, and - `crops = [[0, 0], [0, 0]]`: - - ```prettyprint - [[[1, 2, 3]], [[4, 5, 6]], [[7, 8, 9]], [[10, 11, 12]]] - ``` - - The output tensor has shape `[1, 2, 2, 3]` and value: - - ```prettyprint - x = [[[[1, 2, 3], [4, 5, 6]], - [[7, 8, 9], [10, 11, 12]]]] - ``` - - (3) For the following input of shape `[4, 2, 2, 1]`, `block_shape = [2, 2]`, and - `crops = [[0, 0], [0, 0]]`: - - ```prettyprint - x = [[[[1], [3]], [[9], [11]]], - [[[2], [4]], [[10], [12]]], - [[[5], [7]], [[13], [15]]], - [[[6], [8]], [[14], [16]]]] - ``` - - The output tensor has shape `[1, 4, 4, 1]` and value: - - ```prettyprint - x = [[[1], [2], [3], [4]], - [[5], [6], [7], [8]], - [[9], [10], [11], [12]], - [[13], [14], [15], [16]]] - ``` - - (4) For the following input of shape `[8, 1, 3, 1]`, `block_shape = [2, 2]`, and - `crops = [[0, 0], [2, 0]]`: - - ```prettyprint - x = [[[[0], [1], [3]]], [[[0], [9], [11]]], - [[[0], [2], [4]]], [[[0], [10], [12]]], - [[[0], [5], [7]]], [[[0], [13], [15]]], - [[[0], [6], [8]]], [[[0], [14], [16]]]] - ``` - - The output tensor has shape `[2, 2, 4, 1]` and value: - - ```prettyprint - x = [[[[1], [2], [3], [4]], - [[5], [6], [7], [8]]], - [[[9], [10], [11], [12]], - [[13], [14], [15], [16]]]] - ``` - -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.bayesflow.stochastic_tensor.MeanValue.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.bayesflow.stochastic_tensor.MeanValue.md deleted file mode 100644 index 032b60f98b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.bayesflow.stochastic_tensor.MeanValue.md +++ /dev/null @@ -1,36 +0,0 @@ - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.MeanValue.__init__(stop_gradient=False)` {#MeanValue.__init__} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.MeanValue.declare_inputs(unused_stochastic_tensor, unused_inputs_dict)` {#MeanValue.declare_inputs} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.MeanValue.popped_above(unused_value_type)` {#MeanValue.popped_above} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.MeanValue.pushed_above(unused_value_type)` {#MeanValue.pushed_above} - - - - -- - - - -#### `tf.contrib.bayesflow.stochastic_tensor.MeanValue.stop_gradient` {#MeanValue.stop_gradient} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.bayesflow.variational_inference.elbo_with_log_joint.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.bayesflow.variational_inference.elbo_with_log_joint.md deleted file mode 100644 index 592be500f2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.bayesflow.variational_inference.elbo_with_log_joint.md +++ /dev/null @@ -1,35 +0,0 @@ -### `tf.contrib.bayesflow.variational_inference.elbo_with_log_joint(log_joint, variational=None, keep_batch_dim=True, form=None, name='ELBO')` {#elbo_with_log_joint} - -Evidence Lower BOund. `log p(x) >= ELBO`. - -This method is for models that have computed `p(x,Z)` instead of `p(x|Z)`. -See `elbo` for further details. - -Because only the joint is specified, analytic KL is not available. - -##### Args: - - -* `log_joint`: `Tensor` log p(x, Z). -* `variational`: list of `StochasticTensor` q(Z). If `None`, defaults to all - `StochasticTensor` objects upstream of `log_joint`. -* `keep_batch_dim`: bool. Whether to keep the batch dimension when summing - entropy term. When the sample is per data point, this should be True; - otherwise (e.g. in a Bayesian NN), this should be False. -* `form`: ELBOForms constant. Controls how the ELBO is computed. Defaults to - ELBOForms.default. -* `name`: name to prefix ops with. - -##### Returns: - - `Tensor` ELBO of the same type and shape as `log_joint`. - -##### Raises: - - -* `TypeError`: if variationals in `variational` are not `StochasticTensor`s. -* `TypeError`: if form is not a valid ELBOForms constant. -* `ValueError`: if `variational` is None and there are no `StochasticTensor`s - upstream of `log_joint`. -* `ValueError`: if form is ELBOForms.analytic_kl. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.Mixture.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.Mixture.md deleted file mode 100644 index 9799e8b23e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.Mixture.md +++ /dev/null @@ -1,659 +0,0 @@ -Mixture distribution. - -The `Mixture` object implements batched mixture distributions. -The mixture model is defined by a `Categorical` distribution (the mixture) -and a python list of `Distribution` objects. - -Methods supported include `log_prob`, `prob`, `mean`, `sample`, and -`entropy_lower_bound`. -- - - - -#### `tf.contrib.distributions.Mixture.__init__(cat, components, validate_args=False, allow_nan_stats=True, name='Mixture')` {#Mixture.__init__} - -Initialize a Mixture distribution. - -A `Mixture` is defined by a `Categorical` (`cat`, representing the -mixture probabilities) and a list of `Distribution` objects -all having matching dtype, batch shape, event shape, and continuity -properties (the components). - -The `num_classes` of `cat` must be possible to infer at graph construction -time and match `len(components)`. - -##### Args: - - -* `cat`: A `Categorical` distribution instance, representing the probabilities - of `distributions`. -* `components`: A list or tuple of `Distribution` instances. - Each instance must have the same type, be defined on the same domain, - and have matching `event_shape` and `batch_shape`. -* `validate_args`: Python `bool`, default `False`. If `True`, raise a runtime - error if batch or event ranks are inconsistent between cat and any of - the distributions. This is only checked if the ranks cannot be - determined statically at graph construction time. -* `allow_nan_stats`: Boolean, default `True`. If `False`, raise an - exception if a statistic (e.g. mean/mode/etc...) is undefined for any - batch member. If `True`, batch members with valid parameters leading to - undefined statistics will return NaN for this statistic. -* `name`: A name for this distribution (optional). - -##### Raises: - - -* `TypeError`: If cat is not a `Categorical`, or `components` is not - a list or tuple, or the elements of `components` are not - instances of `Distribution`, or do not have matching `dtype`. -* `ValueError`: If `components` is an empty list or tuple, or its - elements do not have a statically known event rank. - If `cat.num_classes` cannot be inferred at graph creation time, - or the constant value of `cat.num_classes` is not equal to - `len(components)`, or all `components` and `cat` do not have - matching static batch shapes, or all components do not - have matching static event shapes. - - -- - - - -#### `tf.contrib.distributions.Mixture.allow_nan_stats` {#Mixture.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Mixture.batch_shape` {#Mixture.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Mixture.batch_shape_tensor(name='batch_shape_tensor')` {#Mixture.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Mixture.cat` {#Mixture.cat} - - - - -- - - - -#### `tf.contrib.distributions.Mixture.cdf(value, name='cdf')` {#Mixture.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Mixture.components` {#Mixture.components} - - - - -- - - - -#### `tf.contrib.distributions.Mixture.copy(**override_parameters_kwargs)` {#Mixture.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Mixture.covariance(name='covariance')` {#Mixture.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Mixture.dtype` {#Mixture.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Mixture.entropy(name='entropy')` {#Mixture.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Mixture.entropy_lower_bound(name='entropy_lower_bound')` {#Mixture.entropy_lower_bound} - -A lower bound on the entropy of this mixture model. - -The bound below is not always very tight, and its usefulness depends -on the mixture probabilities and the components in use. - -A lower bound is useful for ELBO when the `Mixture` is the variational -distribution: - -\\( -\log p(x) >= ELBO = \int q(z) \log p(x, z) dz + H[q] -\\) - -where \\( p \\) is the prior distribution, \\( q \\) is the variational, -and \\( H[q] \\) is the entropy of \\( q \\). If there is a lower bound -\\( G[q] \\) such that \\( H[q] \geq G[q] \\) then it can be used in -place of \\( H[q] \\). - -For a mixture of distributions \\( q(Z) = \sum_i c_i q_i(Z) \\) with -\\( \sum_i c_i = 1 \\), by the concavity of \\( f(x) = -x \log x \\), a -simple lower bound is: - -\\( -\begin{align} -H[q] & = - \int q(z) \log q(z) dz \\\ - & = - \int (\sum_i c_i q_i(z)) \log(\sum_i c_i q_i(z)) dz \\\ - & \geq - \sum_i c_i \int q_i(z) \log q_i(z) dz \\\ - & = \sum_i c_i H[q_i] -\end{align} -\\) - -This is the term we calculate below for \\( G[q] \\). - -##### Args: - - -* `name`: A name for this operation (optional). - -##### Returns: - - A lower bound on the Mixture's entropy. - - -- - - - -#### `tf.contrib.distributions.Mixture.event_shape` {#Mixture.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Mixture.event_shape_tensor(name='event_shape_tensor')` {#Mixture.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Mixture.is_continuous` {#Mixture.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Mixture.is_scalar_batch(name='is_scalar_batch')` {#Mixture.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Mixture.is_scalar_event(name='is_scalar_event')` {#Mixture.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Mixture.log_cdf(value, name='log_cdf')` {#Mixture.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Mixture.log_prob(value, name='log_prob')` {#Mixture.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Mixture.log_survival_function(value, name='log_survival_function')` {#Mixture.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Mixture.mean(name='mean')` {#Mixture.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Mixture.mode(name='mode')` {#Mixture.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.Mixture.name` {#Mixture.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Mixture.num_components` {#Mixture.num_components} - - - - -- - - - -#### `tf.contrib.distributions.Mixture.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Mixture.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Mixture.param_static_shapes(cls, sample_shape)` {#Mixture.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Mixture.parameters` {#Mixture.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Mixture.prob(value, name='prob')` {#Mixture.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Mixture.reparameterization_type` {#Mixture.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Mixture.sample(sample_shape=(), seed=None, name='sample')` {#Mixture.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Mixture.stddev(name='stddev')` {#Mixture.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Mixture.survival_function(value, name='survival_function')` {#Mixture.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Mixture.validate_args` {#Mixture.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Mixture.variance(name='variance')` {#Mixture.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.bijector.SoftmaxCentered.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.bijector.SoftmaxCentered.md deleted file mode 100644 index 1e47513e6b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.bijector.SoftmaxCentered.md +++ /dev/null @@ -1,298 +0,0 @@ -Bijector which computes `Y = g(X) = exp([X 0]) / sum(exp([X 0]))`. - -To implement [softmax](https://en.wikipedia.org/wiki/Softmax_function) as a -bijection, the forward transformation appends a value to the input and the -inverse removes this coordinate. The appended coordinate represents a pivot, -e.g., `softmax(x) = exp(x-c) / sum(exp(x-c))` where `c` is the implicit last -coordinate. - -Because we append a coordinate, this bijector only supports `event_ndim in [0, -1]`, i.e., scalars and vectors. - -Example Use: - -```python -bijector.SoftmaxCentered(event_ndims=1).forward(tf.log([2, 3, 4])) -# Result: [0.2, 0.3, 0.4, 0.1] -# Extra result: 0.1 - -bijector.SoftmaxCentered(event_ndims=1).inverse([0.2, 0.3, 0.4, 0.1]) -# Result: tf.log([2, 3, 4]) -# Extra coordinate removed. -``` - -At first blush it may seem like the [Invariance of domain]( -https://en.wikipedia.org/wiki/Invariance_of_domain) theorem implies this -implementation is not a bijection. However, the appended dimension -makes the (forward) image non-open and the theorem does not directly apply. -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.__init__(event_ndims=0, validate_args=False, name='softmax_centered')` {#SoftmaxCentered.__init__} - - - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.dtype` {#SoftmaxCentered.dtype} - -dtype of `Tensor`s transformable by this distribution. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.event_ndims` {#SoftmaxCentered.event_ndims} - -Returns then number of event dimensions this bijector operates on. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.forward(x, name='forward')` {#SoftmaxCentered.forward} - -Returns the forward `Bijector` evaluation, i.e., X = g(Y). - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `x.dtype` is not - `self.dtype`. -* `NotImplementedError`: if `_forward` is not implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.forward_event_shape(input_shape)` {#SoftmaxCentered.forward_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `forward_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `input_shape`: `TensorShape` indicating event-portion shape passed into - `forward` function. - -##### Returns: - - -* `forward_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `forward`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.forward_event_shape_tensor(input_shape, name='forward_event_shape_tensor')` {#SoftmaxCentered.forward_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `input_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `forward` function. -* `name`: name to give to the op - -##### Returns: - - -* `forward_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `forward`. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.forward_log_det_jacobian(x, name='forward_log_det_jacobian')` {#SoftmaxCentered.forward_log_det_jacobian} - -Returns both the forward_log_det_jacobian. - -##### Args: - - -* `x`: `Tensor`. The input to the "forward" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_forward_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.graph_parents` {#SoftmaxCentered.graph_parents} - -Returns this `Bijector`'s graph_parents as a Python list. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.inverse(y, name='inverse')` {#SoftmaxCentered.inverse} - -Returns the inverse `Bijector` evaluation, i.e., X = g^{-1}(Y). - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.inverse_and_inverse_log_det_jacobian(y, name='inverse_and_inverse_log_det_jacobian')` {#SoftmaxCentered.inverse_and_inverse_log_det_jacobian} - -Returns both the inverse evaluation and inverse_log_det_jacobian. - -Enables possibly more efficient calculation when both inverse and -corresponding Jacobian are needed. - -See `inverse()`, `inverse_log_det_jacobian()` for more details. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_and_inverse_log_det_jacobian` - nor {`_inverse`, `_inverse_log_det_jacobian`} are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.inverse_event_shape(output_shape)` {#SoftmaxCentered.inverse_event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -Same meaning as `inverse_event_shape_tensor`. May be only partially defined. - -##### Args: - - -* `output_shape`: `TensorShape` indicating event-portion shape passed into - `inverse` function. - -##### Returns: - - -* `inverse_event_shape_tensor`: `TensorShape` indicating event-portion shape - after applying `inverse`. Possibly unknown. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.inverse_event_shape_tensor(output_shape, name='inverse_event_shape_tensor')` {#SoftmaxCentered.inverse_event_shape_tensor} - -Shape of a single sample from a single batch as an `int32` 1D `Tensor`. - -##### Args: - - -* `output_shape`: `Tensor`, `int32` vector indicating event-portion shape - passed into `inverse` function. -* `name`: name to give to the op - -##### Returns: - - -* `inverse_event_shape_tensor`: `Tensor`, `int32` vector indicating - event-portion shape after applying `inverse`. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.inverse_log_det_jacobian(y, name='inverse_log_det_jacobian')` {#SoftmaxCentered.inverse_log_det_jacobian} - -Returns the (log o det o Jacobian o inverse)(y). - -Mathematically, returns: `log(det(dX/dY))(Y)`. (Recall that: `X=g^{-1}(Y)`.) - -Note that `forward_log_det_jacobian` is the negative of this function. - -##### Args: - - -* `y`: `Tensor`. The input to the "inverse" Jacobian evaluation. -* `name`: The name to give this op. - -##### Returns: - - `Tensor`. - -##### Raises: - - -* `TypeError`: if `self.dtype` is specified and `y.dtype` is not - `self.dtype`. -* `NotImplementedError`: if neither `_inverse_log_det_jacobian` nor - `_inverse_and_inverse_log_det_jacobian` are implemented. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.is_constant_jacobian` {#SoftmaxCentered.is_constant_jacobian} - -Returns true iff the Jacobian is not a function of x. - -Note: Jacobian is either constant for both forward and inverse or neither. - -##### Returns: - - -* `is_constant_jacobian`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.name` {#SoftmaxCentered.name} - -Returns the string name of this `Bijector`. - - -- - - - -#### `tf.contrib.distributions.bijector.SoftmaxCentered.validate_args` {#SoftmaxCentered.validate_args} - -Returns True if Tensor arguments will be validated. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.matrix_diag_transform.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.matrix_diag_transform.md deleted file mode 100644 index 1f39a487ba..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.matrix_diag_transform.md +++ /dev/null @@ -1,53 +0,0 @@ -### `tf.contrib.distributions.matrix_diag_transform(matrix, transform=None, name=None)` {#matrix_diag_transform} - -Transform diagonal of [batch-]matrix, leave rest of matrix unchanged. - -Create a trainable covariance defined by a Cholesky factor: - -```python -# Transform network layer into 2 x 2 array. -matrix_values = tf.contrib.layers.fully_connected(activations, 4) -matrix = tf.reshape(matrix_values, (batch_size, 2, 2)) - -# Make the diagonal positive. If the upper triangle was zero, this would be a -# valid Cholesky factor. -chol = matrix_diag_transform(matrix, transform=tf.nn.softplus) - -# OperatorPDCholesky ignores the upper triangle. -operator = OperatorPDCholesky(chol) -``` - -Example of heteroskedastic 2-D linear regression. - -```python -# Get a trainable Cholesky factor. -matrix_values = tf.contrib.layers.fully_connected(activations, 4) -matrix = tf.reshape(matrix_values, (batch_size, 2, 2)) -chol = matrix_diag_transform(matrix, transform=tf.nn.softplus) - -# Get a trainable mean. -mu = tf.contrib.layers.fully_connected(activations, 2) - -# This is a fully trainable multivariate normal! -dist = tf.contrib.distributions.MVNCholesky(mu, chol) - -# Standard log loss. Minimizing this will "train" mu and chol, and then dist -# will be a distribution predicting labels as multivariate Gaussians. -loss = -1 * tf.reduce_mean(dist.log_prob(labels)) -``` - -##### Args: - - -* `matrix`: Rank `R` `Tensor`, `R >= 2`, where the last two dimensions are - equal. -* `transform`: Element-wise function mapping `Tensors` to `Tensors`. To - be applied to the diagonal of `matrix`. If `None`, `matrix` is returned - unchanged. Defaults to `None`. -* `name`: A name to give created ops. - Defaults to "matrix_diag_transform". - -##### Returns: - - A `Tensor` with same shape and `dtype` as `matrix`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.normal_conjugates_known_scale_posterior.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.normal_conjugates_known_scale_posterior.md deleted file mode 100644 index 554d553e77..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.distributions.normal_conjugates_known_scale_posterior.md +++ /dev/null @@ -1,48 +0,0 @@ -### `tf.contrib.distributions.normal_conjugates_known_scale_posterior(prior, scale, s, n)` {#normal_conjugates_known_scale_posterior} - -Posterior Normal distribution with conjugate prior on the mean. - -This model assumes that `n` observations (with sum `s`) come from a -Normal with unknown mean `loc` (described by the Normal `prior`) -and known variance `scale**2`. The "known scale posterior" is -the distribution of the unknown `loc`. - -Accepts a prior Normal distribution object, having parameters -`loc0` and `scale0`, as well as known `scale` values of the predictive -distribution(s) (also assumed Normal), -and statistical estimates `s` (the sum(s) of the observations) and -`n` (the number(s) of observations). - -Returns a posterior (also Normal) distribution object, with parameters -`(loc', scale'**2)`, where: - -``` -mu ~ N(mu', sigma'**2) -sigma'**2 = 1/(1/sigma0**2 + n/sigma**2), -mu' = (mu0/sigma0**2 + s/sigma**2) * sigma'**2. -``` - -Distribution parameters from `prior`, as well as `scale`, `s`, and `n`. -will broadcast in the case of multidimensional sets of parameters. - -##### Args: - - -* `prior`: `Normal` object of type `dtype`: - the prior distribution having parameters `(loc0, scale0)`. -* `scale`: tensor of type `dtype`, taking values `scale > 0`. - The known stddev parameter(s). -* `s`: Tensor of type `dtype`. The sum(s) of observations. -* `n`: Tensor of type `int`. The number(s) of observations. - -##### Returns: - - A new Normal posterior distribution object for the unknown observation - mean `loc`. - -##### Raises: - - -* `TypeError`: if dtype of `s` does not match `dtype`, or `prior` is not a - Normal object. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.framework.assert_same_float_dtype.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.framework.assert_same_float_dtype.md deleted file mode 100644 index e5ecdd0898..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.framework.assert_same_float_dtype.md +++ /dev/null @@ -1,27 +0,0 @@ -### `tf.contrib.framework.assert_same_float_dtype(tensors=None, dtype=None)` {#assert_same_float_dtype} - -Validate and return float type based on `tensors` and `dtype`. - -For ops such as matrix multiplication, inputs and weights must be of the -same float type. This function validates that all `tensors` are the same type, -validates that type is `dtype` (if supplied), and returns the type. Type must -be `dtypes.float32` or `dtypes.float64`. If neither `tensors` nor -`dtype` is supplied, default to `dtypes.float32`. - -##### Args: - - -* `tensors`: Tensors of input values. Can include `None` elements, which will be - ignored. -* `dtype`: Expected type. - -##### Returns: - - Validated type. - -##### Raises: - - -* `ValueError`: if neither `tensors` nor `dtype` is supplied, or result is not - float. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.framework.get_variable_full_name.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.framework.get_variable_full_name.md deleted file mode 100644 index 24aa87a829..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.framework.get_variable_full_name.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.contrib.framework.get_variable_full_name(var)` {#get_variable_full_name} - -Returns the full name of a variable. - -For normal Variables, this is the same as the var.op.name. For -sliced or PartitionedVariables, this name is the same for all the -slices/partitions. In both cases, this is normally the name used in -a checkpoint file. - -##### Args: - - -* `var`: A `Variable` object. - -##### Returns: - - A string that is the full name. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.framework.zero_initializer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.framework.zero_initializer.md deleted file mode 100644 index 7f78c18e45..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.framework.zero_initializer.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.contrib.framework.zero_initializer(ref, use_locking=True, name='zero_initializer')` {#zero_initializer} - -Initialize 'ref' with all zeros, ref tensor should be uninitialized. -If already initialized, you will get ValueError. This op is intended to -save memory during initialization. - -##### Args: - - -* `ref`: ref of the tensor need to be zero initialized. -* `name`: optional name for this operation. - -##### Returns: - - ref that initialized. - -##### Raises: - - -* `ValueError`: If ref tensor is initialized. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.ControlOutputs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.ControlOutputs.md deleted file mode 100644 index 30b5d435d1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.ControlOutputs.md +++ /dev/null @@ -1,52 +0,0 @@ -The control outputs topology. -- - - - -#### `tf.contrib.graph_editor.ControlOutputs.__init__(graph)` {#ControlOutputs.__init__} - -Create a dictionary of control-output dependencies. - -##### Args: - - -* `graph`: a `tf.Graph`. - -##### Returns: - - A dictionary where a key is a `tf.Operation` instance and the - corresponding value is a list of all the ops which have the key - as one of their control-input dependencies. - -##### Raises: - - -* `TypeError`: graph is not a `tf.Graph`. - - -- - - - -#### `tf.contrib.graph_editor.ControlOutputs.get(op)` {#ControlOutputs.get} - -return the control outputs of op. - - -- - - - -#### `tf.contrib.graph_editor.ControlOutputs.get_all()` {#ControlOutputs.get_all} - - - - -- - - - -#### `tf.contrib.graph_editor.ControlOutputs.graph` {#ControlOutputs.graph} - - - - -- - - - -#### `tf.contrib.graph_editor.ControlOutputs.update()` {#ControlOutputs.update} - -Update the control outputs if the graph has changed. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.Transformer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.Transformer.md deleted file mode 100644 index 2b8f433b54..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.Transformer.md +++ /dev/null @@ -1,64 +0,0 @@ -Transform a subgraph into another one. - -By default, the constructor create a transform which copy a subgraph and -replaces inputs with placeholders. This behavior can be modified by changing -the handlers. -- - - - -#### `tf.contrib.graph_editor.Transformer.__call__(sgv, dst_graph, dst_scope, src_scope='', reuse_dst_scope=False)` {#Transformer.__call__} - -Execute the transformation. - -##### Args: - - -* `sgv`: the source subgraph-view. -* `dst_graph`: the destination graph. -* `dst_scope`: the destination scope. -* `src_scope`: the source scope, which specify the path from which the - relative path of the transformed nodes are computed. For instance, if - src_scope is a/ and dst_scoped is b/, then the node a/x/y will have a - relative path of x/y and will be transformed into b/x/y. -* `reuse_dst_scope`: if True the dst_scope is re-used if it already exists. - Otherwise, the scope is given a unique name based on the one given - by appending an underscore followed by a digit (default). - -##### Returns: - - A tuple `(sgv, info)` where: - `sgv` is the transformed subgraph view; - `info` is an instance of TransformerInfo containing - information about the transform, including mapping between - original and transformed tensors and operations. - -##### Raises: - - -* `ValueError`: if the arguments are invalid. - - -- - - - -#### `tf.contrib.graph_editor.Transformer.__init__()` {#Transformer.__init__} - -Transformer constructor. - -The following members can be modified: -transform_op_handler: handle the transformation of a `tf.Operation`. - This handler defaults to a simple copy. -assign_collections_handler: handle the assignment of collections. - This handler defaults to assigning new collections created under the - given name-scope. -transform_external_input_handler: handle the transform of the inputs to - the given subgraph. This handler defaults to creating placeholders - instead of the ops just before the input tensors of the subgraph. -transform_external_hidden_input_handler: handle the transform of the - hidden inputs of the subgraph, that is, the inputs which are not listed - in sgv.inputs. This handler defaults to a transform which keep the same - input if the source and destination graphs are the same, otherwise - use placeholders. -transform_original_op_handler: handle the transform of original_op. This - handler defaults to transforming original_op only if they are in the - subgraph, otherwise they are ignored. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.check_cios.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.check_cios.md deleted file mode 100644 index 6943d50376..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.check_cios.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.contrib.graph_editor.check_cios(control_inputs=False, control_outputs=None, control_ios=None)` {#check_cios} - -Do various check on control_inputs and control_outputs. - -##### Args: - - -* `control_inputs`: A boolean indicating whether control inputs are enabled. -* `control_outputs`: An instance of util.ControlOutputs or None. If not None, - control outputs are enabled. -* `control_ios`: An instance of util.ControlOutputs or None. If not None, both - control inputs and control outputs are enabled. This is equivalent to set - control_inputs to True and control_outputs to the util.ControlOutputs - instance. - -##### Returns: - - A tuple `(control_inputs, control_outputs)` where: - `control_inputs` is a boolean indicating whether to use control inputs. - `control_outputs` is an instance of util.ControlOutputs or None - -##### Raises: - - -* `ValueError`: if control_inputs is an instance of util.ControlOutputs but - control_outputs is not None -* `TypeError`: if control_outputs is not None and is not a util.ControlOutputs. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.copy_with_input_replacements.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.copy_with_input_replacements.md deleted file mode 100644 index 47a30fe1be..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.copy_with_input_replacements.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.contrib.graph_editor.copy_with_input_replacements(sgv, replacement_ts, dst_graph=None, dst_scope='', src_scope='', reuse_dst_scope=False)` {#copy_with_input_replacements} - -Copy a subgraph, replacing some of its inputs. - -Note a replacement only happens if the tensor to be replaced -is an input of the given subgraph. The inputs of a subgraph can -be queried using sgv.inputs. - -##### Args: - - -* `sgv`: the source subgraph-view. This argument is converted to a subgraph - using the same rules as the function subgraph.make_view. -* `replacement_ts`: dictionary mapping from original tensors to the - replaced one. -* `dst_graph`: the destination graph. -* `dst_scope`: the destination scope. -* `src_scope`: the source scope. -* `reuse_dst_scope`: if True the dst_scope is re-used if it already exists. - Otherwise, the scope is given a unique name based on the one given - by appending an underscore followed by a digit (default). - -##### Returns: - - A tuple `(sgv, info)` where: - `sgv` is the transformed subgraph view; - `info` is an instance of TransformerInfo containing - information about the transform, including mapping between - original and transformed tensors and operations. - -##### Raises: - - -* `TypeError`: if dst_graph is not a tf.Graph. -* `StandardError`: if sgv cannot be converted to a SubGraphView using - the same rules as the function subgraph.make_view. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.detach.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.detach.md deleted file mode 100644 index 8230e9b3cd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.detach.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.contrib.graph_editor.detach(sgv, control_inputs=False, control_outputs=None, control_ios=None)` {#detach} - -Detach both the inputs and the outputs of a subgraph view. - -##### Args: - - -* `sgv`: the subgraph view to be detached. This argument is converted to a - subgraph using the same rules as the function subgraph.make_view. - Note that sgv is modified in place. -* `control_inputs`: A boolean indicating whether control inputs are enabled. -* `control_outputs`: An instance of util.ControlOutputs or None. If not None, - control outputs are enabled. -* `control_ios`: An instance of util.ControlOutputs or None. If not None, both - control inputs and control outputs are enabled. This is equivalent to set - control_inputs to True and control_outputs to the util.ControlOutputs - instance. - -##### Returns: - - A tuple `(sgv, detached_inputs, detached_outputs)` where: - `sgv` is a new subgraph view of the detached subgraph; - `detach_inputs` is a list of the created input placeholders; - `detach_outputs` is a list of the created output placeholders. - -##### Raises: - - -* `StandardError`: if sgv cannot be converted to a SubGraphView using - the same rules than the function subgraph.make_view. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.get_backward_walk_ops.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.get_backward_walk_ops.md deleted file mode 100644 index f22dc2ed1c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.get_backward_walk_ops.md +++ /dev/null @@ -1,27 +0,0 @@ -### `tf.contrib.graph_editor.get_backward_walk_ops(seed_ops, inclusive=True, within_ops=None, stop_at_ts=(), control_inputs=False)` {#get_backward_walk_ops} - -Do a backward graph walk and return all the visited ops. - -##### Args: - - -* `seed_ops`: an iterable of operations from which the backward graph - walk starts. If a list of tensors is given instead, the seed_ops are set - to be the generators of those tensors. -* `inclusive`: if True the given seed_ops are also part of the resulting set. -* `within_ops`: an iterable of `tf.Operation` within which the search is - restricted. If `within_ops` is `None`, the search is performed within - the whole graph. -* `stop_at_ts`: an iterable of tensors at which the graph walk stops. -* `control_inputs`: if True, control inputs will be used while moving backward. - -##### Returns: - - A Python set of all the `tf.Operation` behind `seed_ops`. - -##### Raises: - - -* `TypeError`: if `seed_ops` or `within_ops` cannot be converted to a list of - `tf.Operation`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.get_ops_ios.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.get_ops_ios.md deleted file mode 100644 index 30491b740c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.graph_editor.get_ops_ios.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.contrib.graph_editor.get_ops_ios(ops, control_inputs=False, control_outputs=None, control_ios=None)` {#get_ops_ios} - -Return all the `tf.Operation` which are connected to an op in ops. - -##### Args: - - -* `ops`: an object convertible to a list of `tf.Operation`. -* `control_inputs`: A boolean indicating whether control inputs are enabled. -* `control_outputs`: An instance of `util.ControlOutputs` or `None`. If not - `None`, control outputs are enabled. -* `control_ios`: An instance of `util.ControlOutputs` or `None`. If not `None`, - both control inputs and control outputs are enabled. This is equivalent to - set `control_inputs` to `True` and `control_outputs` to the - `util.ControlOutputs` instance. - -##### Returns: - - All the `tf.Operation` surrounding the given ops. - -##### Raises: - - -* `TypeError`: if `ops` cannot be converted to a list of `tf.Operation`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.apply_regularization.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.apply_regularization.md deleted file mode 100644 index ec6beee0af..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.apply_regularization.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.contrib.layers.apply_regularization(regularizer, weights_list=None)` {#apply_regularization} - -Returns the summed penalty by applying `regularizer` to the `weights_list`. - -Adding a regularization penalty over the layer weights and embedding weights -can help prevent overfitting the training data. Regularization over layer -biases is less common/useful, but assuming proper data preprocessing/mean -subtraction, it usually shouldn't hurt much either. - -##### Args: - - -* `regularizer`: A function that takes a single `Tensor` argument and returns - a scalar `Tensor` output. -* `weights_list`: List of weights `Tensors` or `Variables` to apply - `regularizer` over. Defaults to the `GraphKeys.WEIGHTS` collection if - `None`. - -##### Returns: - - A scalar representing the overall regularization penalty. - -##### Raises: - - -* `ValueError`: If `regularizer` does not return a scalar output, or if we find - no weights. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.conv2d_in_plane.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.conv2d_in_plane.md deleted file mode 100644 index 83319a6d6b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.conv2d_in_plane.md +++ /dev/null @@ -1,49 +0,0 @@ -### `tf.contrib.layers.conv2d_in_plane(*args, **kwargs)` {#conv2d_in_plane} - -Performs the same in-plane convolution to each channel independently. - -This is useful for performing various simple channel-independent convolution -operations such as image gradients: - - image = tf.constant(..., shape=(16, 240, 320, 3)) - vert_gradients = layers.conv2d_in_plane(image, - kernel=[1, -1], - kernel_size=[2, 1]) - horz_gradients = layers.conv2d_in_plane(image, - kernel=[1, -1], - kernel_size=[1, 2]) - -##### Args: - - -* `inputs`: A 4-D tensor with dimensions [batch_size, height, width, channels]. -* `kernel_size`: A list of length 2 holding the [kernel_height, kernel_width] of - of the pooling. Can be an int if both values are the same. -* `stride`: A list of length 2 `[stride_height, stride_width]`. - Can be an int if both strides are the same. Note that presently - both strides must have the same value. -* `padding`: The padding type to use, either 'SAME' or 'VALID'. -* `activation_fn`: Activation function. The default value is a ReLU function. - Explicitly set it to None to skip it and maintain a linear activation. -* `normalizer_fn`: Normalization function to use instead of `biases`. If - `normalizer_fn` is provided then `biases_initializer` and - `biases_regularizer` are ignored and `biases` are not created nor added. - default set to None for no normalizer function -* `normalizer_params`: Normalization function parameters. -* `weights_initializer`: An initializer for the weights. -* `weights_regularizer`: Optional regularizer for the weights. -* `biases_initializer`: An initializer for the biases. If None skip biases. -* `biases_regularizer`: Optional regularizer for the biases. -* `reuse`: Whether or not the layer and its variables should be reused. To be - able to reuse the layer scope must be given. -* `variables_collections`: Optional list of collections for all the variables or - a dictionary containing a different list of collection per variable. -* `outputs_collections`: Collection to add the outputs. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for `variable_scope`. - -##### Returns: - - A `Tensor` representing the output of the operation. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.max_pool2d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.max_pool2d.md deleted file mode 100644 index 823ec0f734..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.max_pool2d.md +++ /dev/null @@ -1,33 +0,0 @@ -### `tf.contrib.layers.max_pool2d(*args, **kwargs)` {#max_pool2d} - -Adds a 2D Max Pooling op. - -It is assumed that the pooling is done per image but not in batch or channels. - -##### Args: - - -* `inputs`: A 4-D tensor of shape `[batch_size, height, width, channels]` if - `data_format` is `NHWC`, and `[batch_size, channels, height, width]` if - `data_format` is `NCHW`. -* `kernel_size`: A list of length 2: [kernel_height, kernel_width] of the - pooling kernel over which the op is computed. Can be an int if both - values are the same. -* `stride`: A list of length 2: [stride_height, stride_width]. - Can be an int if both strides are the same. Note that presently - both strides must have the same value. -* `padding`: The padding method, either 'VALID' or 'SAME'. -* `data_format`: A string. `NHWC` (default) and `NCHW` are supported. -* `outputs_collections`: The collections to which the outputs are added. -* `scope`: Optional scope for name_scope. - -##### Returns: - - A `Tensor` representing the results of the pooling operation. - -##### Raises: - - -* `ValueError`: If `data_format` is neither `NHWC` nor `NCHW`. -* `ValueError`: If 'kernel_size' is not a 2-D list - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.parse_feature_columns_from_examples.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.parse_feature_columns_from_examples.md deleted file mode 100644 index 8d2e3543f5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.parse_feature_columns_from_examples.md +++ /dev/null @@ -1,52 +0,0 @@ -### `tf.contrib.layers.parse_feature_columns_from_examples(serialized, feature_columns, name=None, example_names=None)` {#parse_feature_columns_from_examples} - -Parses tf.Examples to extract tensors for given feature_columns. - -This is a wrapper of 'tf.parse_example'. - -Example: - -```python -columns_to_tensor = parse_feature_columns_from_examples( - serialized=my_data, - feature_columns=my_features) - -# Where my_features are: -# Define features and transformations -sparse_feature_a = sparse_column_with_keys( - column_name="sparse_feature_a", keys=["AB", "CD", ...]) - -embedding_feature_a = embedding_column( - sparse_id_column=sparse_feature_a, dimension=3, combiner="sum") - -sparse_feature_b = sparse_column_with_hash_bucket( - column_name="sparse_feature_b", hash_bucket_size=1000) - -embedding_feature_b = embedding_column( - sparse_id_column=sparse_feature_b, dimension=16, combiner="sum") - -crossed_feature_a_x_b = crossed_column( - columns=[sparse_feature_a, sparse_feature_b], hash_bucket_size=10000) - -real_feature = real_valued_column("real_feature") -real_feature_buckets = bucketized_column( - source_column=real_feature, boundaries=[...]) - -my_features = [embedding_feature_b, real_feature_buckets, embedding_feature_a] -``` - -##### Args: - - -* `serialized`: A vector (1-D Tensor) of strings, a batch of binary - serialized `Example` protos. -* `feature_columns`: An iterable containing all the feature columns. All items - should be instances of classes derived from _FeatureColumn. -* `name`: A name for this operation (optional). -* `example_names`: A vector (1-D Tensor) of strings (optional), the names of - the serialized protos in the batch. - -##### Returns: - - A `dict` mapping FeatureColumn to `Tensor` and `SparseTensor` values. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.parse_feature_columns_from_sequence_examples.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.parse_feature_columns_from_sequence_examples.md deleted file mode 100644 index 99d37f4f77..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.parse_feature_columns_from_sequence_examples.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.contrib.layers.parse_feature_columns_from_sequence_examples(serialized, context_feature_columns, sequence_feature_columns, name=None, example_name=None)` {#parse_feature_columns_from_sequence_examples} - -Parses tf.SequenceExamples to extract tensors for given `FeatureColumn`s. - -##### Args: - - -* `serialized`: A scalar (0-D Tensor) of type string, a single serialized - `SequenceExample` proto. -* `context_feature_columns`: An iterable containing the feature columns for - context features. All items should be instances of classes derived from - `_FeatureColumn`. Can be `None`. -* `sequence_feature_columns`: An iterable containing the feature columns for - sequence features. All items should be instances of classes derived from - `_FeatureColumn`. Can be `None`. -* `name`: A name for this operation (optional). -* `example_name`: A scalar (0-D Tensor) of type string (optional), the names of - the serialized proto. - -##### Returns: - - A tuple consisting of: - -* `context_features`: a dict mapping `FeatureColumns` from - `context_feature_columns` to their parsed `Tensors`/`SparseTensor`s. -* `sequence_features`: a dict mapping `FeatureColumns` from - `sequence_feature_columns` to their parsed `Tensors`/`SparseTensor`s. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.summarize_tensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.summarize_tensor.md deleted file mode 100644 index 872ba5c9d4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.summarize_tensor.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.contrib.layers.summarize_tensor(tensor, tag=None)` {#summarize_tensor} - -Summarize a tensor using a suitable summary type. - -This function adds a summary op for `tensor`. The type of summary depends on -the shape of `tensor`. For scalars, a `scalar_summary` is created, for all -other tensors, `histogram_summary` is used. - -##### Args: - - -* `tensor`: The tensor to summarize -* `tag`: The tag to use, if None then use tensor's op's name. - -##### Returns: - - The summary op created or None for string tensors. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.xavier_initializer_conv2d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.xavier_initializer_conv2d.md deleted file mode 100644 index 9deeb48b5b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.layers.xavier_initializer_conv2d.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.contrib.layers.xavier_initializer_conv2d(uniform=True, seed=None, dtype=tf.float32)` {#xavier_initializer_conv2d} - -Returns an initializer performing "Xavier" initialization for weights. - -This function implements the weight initialization from: - -Xavier Glorot and Yoshua Bengio (2010): - Understanding the difficulty of training deep feedforward neural - networks. International conference on artificial intelligence and - statistics. - -This initializer is designed to keep the scale of the gradients roughly the -same in all layers. In uniform distribution this ends up being the range: -`x = sqrt(6. / (in + out)); [-x, x]` and for normal distribution a standard -deviation of `sqrt(3. / (in + out))` is used. - -##### Args: - - -* `uniform`: Whether to use uniform or normal distributed random initialization. -* `seed`: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `dtype`: The data type. Only floating point types are supported. - -##### Returns: - - An initializer for a weight matrix. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.Experiment.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.Experiment.md deleted file mode 100644 index 6e891922f4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.Experiment.md +++ /dev/null @@ -1,229 +0,0 @@ -Experiment is a class containing all information needed to train a model. - -After an experiment is created (by passing an Estimator and inputs for -training and evaluation), an Experiment instance knows how to invoke training -and eval loops in a sensible fashion for distributed training. -- - - - -#### `tf.contrib.learn.Experiment.__init__(*args, **kwargs)` {#Experiment.__init__} - -Constructor for `Experiment`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-10-23. -Instructions for updating: -local_eval_frequency is deprecated as local_run will be renamed to train_and_evaluate. Use min_eval_frequency and call train_and_evaluate instead. Note, however, that the default for min_eval_frequency is 1, meaning models will be evaluated every time a new checkpoint is available. In contrast, the default for local_eval_frequency is None, resulting in evaluation occurring only after training has completed. min_eval_frequency is ignored when calling the deprecated local_run. - -Creates an Experiment instance. None of the functions passed to this -constructor are executed at construction time. They are stored and used -when a method is executed which requires it. - -##### Args: - - -* `estimator`: Object implementing `Trainable` and `Evaluable`. -* `train_input_fn`: function, returns features and labels for training. -* `eval_input_fn`: function, returns features and labels for evaluation. If - `eval_steps` is `None`, this should be configured only to produce for a - finite number of batches (generally, 1 epoch over the evaluation data). -* `eval_metrics`: `dict` of string, metric function. If `None`, default set - is used. -* `train_steps`: Perform this many steps of training. `None`, the default, - means train forever. -* `eval_steps`: `evaluate` runs until input is exhausted (or another exception - is raised), or for `eval_steps` steps, if specified. -* `train_monitors`: A list of monitors to pass to the `Estimator`'s `fit` - function. -* `eval_hooks`: A list of `SessionRunHook` hooks to pass to the - `Estimator`'s `evaluate` function. -* `local_eval_frequency`: Frequency of running eval in steps, - when running locally. If `None`, runs evaluation only at the end of - training. -* `eval_delay_secs`: Start evaluating after waiting for this many seconds. -* `continuous_eval_throttle_secs`: Do not re-evaluate unless the last - evaluation was started at least this many seconds ago for - continuous_eval(). -* `min_eval_frequency`: (applies only to train_and_evaluate). the minimum - number of steps between evaluations. Of course, evaluation does not - occur if no new snapshot is available, hence, this is the minimum. -* `delay_workers_by_global_step`: if `True` delays training workers - based on global step instead of time. -* `export_strategies`: A list of `ExportStrategy`s, or a single one, or None. - -##### Raises: - - -* `ValueError`: if `estimator` does not implement `Evaluable` and `Trainable`, - or if export_strategies has the wrong type. - - -- - - - -#### `tf.contrib.learn.Experiment.continuous_eval(delay_secs=None, throttle_delay_secs=None, evaluate_checkpoint_only_once=True, continuous_eval_predicate_fn=None)` {#Experiment.continuous_eval} - - - - -- - - - -#### `tf.contrib.learn.Experiment.continuous_eval_on_train_data(delay_secs=None, throttle_delay_secs=None, continuous_eval_predicate_fn=None)` {#Experiment.continuous_eval_on_train_data} - - - - -- - - - -#### `tf.contrib.learn.Experiment.estimator` {#Experiment.estimator} - - - - -- - - - -#### `tf.contrib.learn.Experiment.eval_metrics` {#Experiment.eval_metrics} - - - - -- - - - -#### `tf.contrib.learn.Experiment.eval_steps` {#Experiment.eval_steps} - - - - -- - - - -#### `tf.contrib.learn.Experiment.evaluate(delay_secs=None)` {#Experiment.evaluate} - -Evaluate on the evaluation data. - -Runs evaluation on the evaluation data and returns the result. Runs for -`self._eval_steps` steps, or if it's `None`, then run until input is -exhausted or another exception is raised. Start the evaluation after -`delay_secs` seconds, or if it's `None`, defaults to using -`self._eval_delay_secs` seconds. - -##### Args: - - -* `delay_secs`: Start evaluating after this many seconds. If `None`, defaults - to using `self._eval_delays_secs`. - -##### Returns: - - The result of the `evaluate` call to the `Estimator`. - - -- - - - -#### `tf.contrib.learn.Experiment.extend_train_hooks(additional_hooks)` {#Experiment.extend_train_hooks} - -Extends the hooks for training. - - -- - - - -#### `tf.contrib.learn.Experiment.local_run(*args, **kwargs)` {#Experiment.local_run} - -DEPRECATED FUNCTION - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-10-23. -Instructions for updating: -local_run will be renamed to train_and_evaluate and the new default behavior will be to run evaluation every time there is a new checkpoint. - - -- - - - -#### `tf.contrib.learn.Experiment.reset_export_strategies(new_export_strategies=None)` {#Experiment.reset_export_strategies} - -Resets the export strategies with the `new_export_strategies`. - -##### Args: - - -* `new_export_strategies`: A new list of `ExportStrategy`s, or a single one, - or None. - -##### Returns: - - The old export strategies. - - -- - - - -#### `tf.contrib.learn.Experiment.run_std_server()` {#Experiment.run_std_server} - -Starts a TensorFlow server and joins the serving thread. - -Typically used for parameter servers. - -##### Raises: - - -* `ValueError`: if not enough information is available in the estimator's - config to create a server. - - -- - - - -#### `tf.contrib.learn.Experiment.test()` {#Experiment.test} - -Tests training and evaluating the estimator both for a single step. - -##### Returns: - - The result of the `evaluate` call to the `Estimator`. - - -- - - - -#### `tf.contrib.learn.Experiment.train(delay_secs=None)` {#Experiment.train} - -Fit the estimator using the training data. - -Train the estimator for `self._train_steps` steps, after waiting for -`delay_secs` seconds. If `self._train_steps` is `None`, train forever. - -##### Args: - - -* `delay_secs`: Start training after this many seconds. - -##### Returns: - - The trained estimator. - - -- - - - -#### `tf.contrib.learn.Experiment.train_and_evaluate()` {#Experiment.train_and_evaluate} - -Interleaves training and evaluation. - -The frequency of evaluation is controlled by the contructor arg -`min_eval_frequency`. When this parameter is None or 0, evaluation happens -only after training has completed. Note that evaluation cannot happen -more frequently than checkpoints are taken. If no new snapshots are -available when evaluation is supposed to occur, then evaluation doesn't -happen for another `min_eval_frequency` steps (assuming a checkpoint is -available at that point). Thus, settings `min_eval_frequency` to 1 means -that the model will be evaluated everytime there is a new checkpoint. - -This is particular useful for a "Master" task in the cloud, whose -responsibility it is to take checkpoints, evaluate those checkpoints, -and write out summaries. Participating in training as the supervisor -allows such a task to accomplish the first and last items, while -performing evaluation allows for the second. - -##### Returns: - - The result of the `evaluate` call to the `Estimator`. - - -- - - - -#### `tf.contrib.learn.Experiment.train_steps` {#Experiment.train_steps} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.KMeansClustering.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.KMeansClustering.md deleted file mode 100644 index 712b3d1140..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.KMeansClustering.md +++ /dev/null @@ -1,413 +0,0 @@ -An Estimator for K-Means clustering. -- - - - -#### `tf.contrib.learn.KMeansClustering.__init__(num_clusters, model_dir=None, initial_clusters='random', distance_metric='squared_euclidean', random_seed=0, use_mini_batch=True, mini_batch_steps_per_iteration=1, kmeans_plus_plus_num_retries=2, relative_tolerance=None, config=None)` {#KMeansClustering.__init__} - -Creates a model for running KMeans training and inference. - -##### Args: - - -* `num_clusters`: number of clusters to train. -* `model_dir`: the directory to save the model results and log files. -* `initial_clusters`: specifies how to initialize the clusters for training. - See clustering_ops.kmeans for the possible values. -* `distance_metric`: the distance metric used for clustering. - See clustering_ops.kmeans for the possible values. -* `random_seed`: Python integer. Seed for PRNG used to initialize centers. -* `use_mini_batch`: If true, use the mini-batch k-means algorithm. Else assume - full batch. -* `mini_batch_steps_per_iteration`: number of steps after which the updated - cluster centers are synced back to a master copy. See clustering_ops.py - for more details. -* `kmeans_plus_plus_num_retries`: For each point that is sampled during - kmeans++ initialization, this parameter specifies the number of - additional points to draw from the current distribution before selecting - the best. If a negative value is specified, a heuristic is used to - sample O(log(num_to_sample)) additional points. -* `relative_tolerance`: A relative tolerance of change in the loss between - iterations. Stops learning if the loss changes less than this amount. - Note that this may not work correctly if use_mini_batch=True. -* `config`: See Estimator - - -- - - - -#### `tf.contrib.learn.KMeansClustering.__repr__()` {#KMeansClustering.__repr__} - - - - -- - - - -#### `tf.contrib.learn.KMeansClustering.clusters()` {#KMeansClustering.clusters} - -Returns cluster centers. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.config` {#KMeansClustering.config} - - - - -- - - - -#### `tf.contrib.learn.KMeansClustering.evaluate(*args, **kwargs)` {#KMeansClustering.evaluate} - -See `Evaluable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If at least one of `x` or `y` is provided, and at least one of - `input_fn` or `feed_fn` is provided. - Or if `metrics` is not `None` or `dict`. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.export(*args, **kwargs)` {#KMeansClustering.export} - -Exports inference graph into given dir. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-23. -Instructions for updating: -The signature of the input_fn accepted by export is changing to be consistent with what's used by tf.Learn Estimator's train/evaluate. input_fn (and in most cases, input_feature_key) will become required args, and use_deprecated_input_fn will default to False and be removed altogether. - -##### Args: - - -* `export_dir`: A string containing a directory to write the exported graph - and checkpoints. -* `input_fn`: If `use_deprecated_input_fn` is true, then a function that given - `Tensor` of `Example` strings, parses it into features that are then - passed to the model. Otherwise, a function that takes no argument and - returns a tuple of (features, labels), where features is a dict of - string key to `Tensor` and labels is a `Tensor` that's currently not - used (and so can be `None`). -* `input_feature_key`: Only used if `use_deprecated_input_fn` is false. String - key into the features dict returned by `input_fn` that corresponds to a - the raw `Example` strings `Tensor` that the exported model will take as - input. Can only be `None` if you're using a custom `signature_fn` that - does not use the first arg (examples). -* `use_deprecated_input_fn`: Determines the signature format of `input_fn`. -* `signature_fn`: Function that returns a default signature and a named - signature map, given `Tensor` of `Example` strings, `dict` of `Tensor`s - for features and `Tensor` or `dict` of `Tensor`s for predictions. -* `prediction_key`: The key for a tensor in the `predictions` dict (output - from the `model_fn`) to use as the `predictions` input to the - `signature_fn`. Optional. If `None`, predictions will pass to - `signature_fn` without filtering. -* `default_batch_size`: Default batch size of the `Example` placeholder. -* `exports_to_keep`: Number of exports to keep. -* `checkpoint_path`: the checkpoint path of the model to be exported. If it is - `None` (which is default), will use the latest checkpoint in - export_dir. - -##### Returns: - - The string path to the exported directory. NB: this functionality was - added ca. 2016/09/25; clients that depend on the return value may need - to handle the case where this function returns None because subclasses - are not returning a value. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#KMeansClustering.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.fit(*args, **kwargs)` {#KMeansClustering.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.get_params(deep=True)` {#KMeansClustering.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.get_variable_names()` {#KMeansClustering.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.get_variable_value(name)` {#KMeansClustering.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.model_dir` {#KMeansClustering.model_dir} - - - - -- - - - -#### `tf.contrib.learn.KMeansClustering.partial_fit(*args, **kwargs)` {#KMeansClustering.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.predict(*args, **kwargs)` {#KMeansClustering.predict} - -Returns predictions for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x` and 'batch_size' must be `None`. -* `batch_size`: Override default batch size. If set, 'input_fn' must be - 'None'. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns all. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - A numpy array of predicted classes or regression values if the - constructor's `model_fn` returns a `Tensor` for `predictions` or a `dict` - of numpy arrays if `model_fn` returns a `dict`. Returns an iterable of - predictions if as_iterable is True. - -##### Raises: - - -* `ValueError`: If x and input_fn are both provided or both `None`. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.predict_cluster_idx(input_fn=None)` {#KMeansClustering.predict_cluster_idx} - -Yields predicted cluster indices. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.score(input_fn=None, steps=None)` {#KMeansClustering.score} - -Predict total sum of distances to nearest clusters. - -Note that this function is different from the corresponding one in sklearn -which returns the negative of the sum of distances. - -##### Args: - - -* `input_fn`: see predict. -* `steps`: see predict. - -##### Returns: - - Total sum of distances to nearest clusters. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.set_params(**params)` {#KMeansClustering.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - -- - - - -#### `tf.contrib.learn.KMeansClustering.transform(input_fn=None, as_iterable=False)` {#KMeansClustering.transform} - -Transforms each element to distances to cluster centers. - -Note that this function is different from the corresponding one in sklearn. -For SQUARED_EUCLIDEAN distance metric, sklearn transform returns the -EUCLIDEAN distance, while this function returns the SQUARED_EUCLIDEAN -distance. - -##### Args: - - -* `input_fn`: see predict. -* `as_iterable`: see predict - -##### Returns: - - Array with same number of rows as x, and num_clusters columns, containing - distances to the cluster centers. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.TaskType.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.TaskType.md deleted file mode 100644 index 8b13789179..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.TaskType.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.extract_pandas_labels.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.extract_pandas_labels.md deleted file mode 100644 index 2cbb8e0652..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.learn.extract_pandas_labels.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.contrib.learn.extract_pandas_labels(labels)` {#extract_pandas_labels} - -Extract data from pandas.DataFrame for labels. - -##### Args: - - -* `labels`: `pandas.DataFrame` or `pandas.Series` containing one column of - labels to be extracted. - -##### Returns: - - A numpy `ndarray` of labels from the DataFrame. - -##### Raises: - - -* `ValueError`: if more than one column is found or type is not int, float or - bool. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.linalg.LinearOperatorTriL.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.linalg.LinearOperatorTriL.md deleted file mode 100644 index 403e5dac69..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.linalg.LinearOperatorTriL.md +++ /dev/null @@ -1,521 +0,0 @@ -`LinearOperator` acting like a [batch] square lower triangular matrix. - -This operator acts like a [batch] lower triangular matrix `A` with shape -`[B1,...,Bb, N, N]` for some `b >= 0`. The first `b` indices index a -batch member. For every batch index `(i1,...,ib)`, `A[i1,...,ib, : :]` is -an `N x N` matrix. - -`LinearOperatorTriL` is initialized with a `Tensor` having dimensions -`[B1,...,Bb, N, N]`. The upper triangle of the last two dimensions is ignored. - -```python -# Create a 2 x 2 lower-triangular linear operator. -tril = [[1., 2.], [3., 4.]] -operator = LinearOperatorTriL(tril) - -# The upper triangle is ignored. -operator.to_dense() -==> [[1., 0.] - [3., 4.]] - -operator.shape -==> [2, 2] - -operator.log_determinant() -==> scalar Tensor - -x = ... Shape [2, 4] Tensor -operator.apply(x) -==> Shape [2, 4] Tensor - -# Create a [2, 3] batch of 4 x 4 linear operators. -tril = tf.random_normal(shape=[2, 3, 4, 4]) -operator = LinearOperatorTriL(tril) -``` - -#### Shape compatibility - -This operator acts on [batch] matrix with compatible shape. -`x` is a batch matrix with compatible shape for `apply` and `solve` if - -``` -operator.shape = [B1,...,Bb] + [N, N], with b >= 0 -x.shape = [B1,...,Bb] + [N, R], with R >= 0. -``` - -#### Performance - -Suppose `operator` is a `LinearOperatorTriL` of shape `[N, N]`, -and `x.shape = [N, R]`. Then - -* `operator.apply(x)` involves `N^2 * R` multiplications. -* `operator.solve(x)` involves `N * R` size `N` back-substitutions. -* `operator.determinant()` involves a size `N` `reduce_prod`. - -If instead `operator` and `x` have shape `[B1,...,Bb, N, N]` and -`[B1,...,Bb, N, R]`, every operation increases in complexity by `B1*...*Bb`. - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite`. -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.__init__(tril, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, name='LinearOperatorTriL')` {#LinearOperatorTriL.__init__} - -Initialize a `LinearOperatorTriL`. - -##### Args: - - -* `tril`: Shape `[B1,...,Bb, N, N]` with `b >= 0`, `N >= 0`. - The lower triangular part of `tril` defines this operator. The strictly - upper triangle is ignored. Allowed dtypes: `float32`, `float64`. -* `is_non_singular`: Expect that this operator is non-singular. - This operator is non-singular if and only if its diagonal elements are - all non-zero. -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. This operator is self-adjoint only if it is diagonal with - real-valued diagonal entries. In this case it is advised to use - `LinearOperatorDiag`. -* `is_positive_definite`: Expect that this operator is positive definite, - meaning the real part of all eigenvalues is positive. We do not require - the operator to be self-adjoint to be positive-definite. See: -* `https`: //en.wikipedia.org/wiki/Positive-definite_matrix - #Extension_for_non_symmetric_matrices -* `name`: A name for this `LinearOperator`. - -##### Raises: - - -* `TypeError`: If `diag.dtype` is not an allowed type. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.add_to_tensor(x, name='add_to_tensor')` {#LinearOperatorTriL.add_to_tensor} - -Add matrix represented by this operator to `x`. Equivalent to `A + x`. - -##### Args: - - -* `x`: `Tensor` with same `dtype` and shape broadcastable to `self.shape`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.apply(x, adjoint=False, name='apply')` {#LinearOperatorTriL.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.assert_non_singular(name='assert_non_singular')` {#LinearOperatorTriL.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.assert_positive_definite(name='assert_positive_definite')` {#LinearOperatorTriL.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperatorTriL.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.batch_shape` {#LinearOperatorTriL.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperatorTriL.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.determinant(name='det')` {#LinearOperatorTriL.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.diag_part(name='diag_part')` {#LinearOperatorTriL.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.domain_dimension` {#LinearOperatorTriL.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperatorTriL.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.dtype` {#LinearOperatorTriL.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.graph_parents` {#LinearOperatorTriL.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.is_non_singular` {#LinearOperatorTriL.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.is_positive_definite` {#LinearOperatorTriL.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.is_self_adjoint` {#LinearOperatorTriL.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.is_square` {#LinearOperatorTriL.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.log_abs_determinant(name='log_abs_det')` {#LinearOperatorTriL.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.name` {#LinearOperatorTriL.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.range_dimension` {#LinearOperatorTriL.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperatorTriL.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.shape` {#LinearOperatorTriL.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.shape_tensor(name='shape_tensor')` {#LinearOperatorTriL.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.solve(rhs, adjoint=False, name='solve')` {#LinearOperatorTriL.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.tensor_rank` {#LinearOperatorTriL.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperatorTriL.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperatorTriL.to_dense(name='to_dense')` {#LinearOperatorTriL.to_dense} - -Return a dense (batch) matrix representing this operator. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.losses.sparse_softmax_cross_entropy.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.losses.sparse_softmax_cross_entropy.md deleted file mode 100644 index 4e774b2741..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.losses.sparse_softmax_cross_entropy.md +++ /dev/null @@ -1,33 +0,0 @@ -### `tf.contrib.losses.sparse_softmax_cross_entropy(*args, **kwargs)` {#sparse_softmax_cross_entropy} - -Cross-entropy loss using `tf.nn.sparse_softmax_cross_entropy_with_logits`. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.sparse_softmax_cross_entropy instead. Note that the order of the logits and labels arguments has been changed. - -`weights` acts as a coefficient for the loss. If a scalar is provided, -then the loss is simply scaled by the given value. If `weights` is a -tensor of size [`batch_size`], then the loss weights apply to each -corresponding sample. - -##### Args: - - -* `logits`: [batch_size, num_classes] logits outputs of the network . -* `labels`: [batch_size, 1] or [batch_size] labels of dtype `int32` or `int64` - in the range `[0, num_classes)`. -* `weights`: Coefficients for the loss. The tensor must be a scalar or a tensor - of shape [batch_size] or [batch_size, 1]. -* `scope`: the scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the mean loss value. - -##### Raises: - - -* `ValueError`: If the shapes of `logits`, `labels`, and `weights` are - incompatible, or if `weights` is None. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.confusion_matrix.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.confusion_matrix.md deleted file mode 100644 index 831de8ac6b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.confusion_matrix.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.metrics.confusion_matrix(labels, predictions, num_classes=None, dtype=tf.int32, name=None, weights=None)` {#confusion_matrix} - -Deprecated. Use tf.confusion_matrix instead. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_accuracy.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_accuracy.md deleted file mode 100644 index 3a930314a3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_accuracy.md +++ /dev/null @@ -1,50 +0,0 @@ -### `tf.contrib.metrics.streaming_accuracy(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_accuracy} - -Calculates how often `predictions` matches `labels`. - -The `streaming_accuracy` function creates two local variables, `total` and -`count` that are used to compute the frequency with which `predictions` -matches `labels`. This frequency is ultimately returned as `accuracy`: an -idempotent operation that simply divides `total` by `count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the `accuracy`. -Internally, an `is_correct` operation computes a `Tensor` with elements 1.0 -where the corresponding elements of `predictions` and `labels` match and 0.0 -otherwise. Then `update_op` increments `total` with the reduced sum of the -product of `weights` and `is_correct`, and it increments `count` with the -reduced sum of `weights`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: The predicted values, a `Tensor` of any shape. -* `labels`: The ground truth values, a `Tensor` whose shape matches - `predictions`. -* `weights`: `Tensor` whose rank is either 0, or the same rank as `labels`, and - must be broadcastable to `labels` (i.e., all dimensions must be either - `1`, or the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that `accuracy` should - be added to. -* `updates_collections`: An optional list of collections that `update_op` should - be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `accuracy`: A `Tensor` representing the accuracy, the value of `total` divided - by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately and whose value matches `accuracy`. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_mean_cosine_distance.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_mean_cosine_distance.md deleted file mode 100644 index 442187dfa4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_mean_cosine_distance.md +++ /dev/null @@ -1,46 +0,0 @@ -### `tf.contrib.metrics.streaming_mean_cosine_distance(predictions, labels, dim, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_mean_cosine_distance} - -Computes the cosine distance between the labels and predictions. - -The `streaming_mean_cosine_distance` function creates two local variables, -`total` and `count` that are used to compute the average cosine distance -between `predictions` and `labels`. This average is weighted by `weights`, -and it is ultimately returned as `mean_distance`, which is an idempotent -operation that simply divides `total` by `count`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`mean_distance`. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: A `Tensor` of the same shape as `labels`. -* `labels`: A `Tensor` of arbitrary shape. -* `dim`: The dimension along which the cosine distance is computed. -* `weights`: An optional `Tensor` whose shape is broadcastable to `predictions`, - and whose dimension `dim` is 1. -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `mean_distance`: A `Tensor` representing the current mean, the value of - `total` divided by `count`. -* `update_op`: An operation that increments the `total` and `count` variables - appropriately. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_pearson_correlation.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_pearson_correlation.md deleted file mode 100644 index c2bc594874..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_pearson_correlation.md +++ /dev/null @@ -1,52 +0,0 @@ -### `tf.contrib.metrics.streaming_pearson_correlation(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_pearson_correlation} - -Computes Pearson correlation coefficient between `predictions`, `labels`. - -The `streaming_pearson_correlation` function delegates to -`streaming_covariance` the tracking of three [co]variances: - -- `streaming_covariance(predictions, labels)`, i.e. covariance -- `streaming_covariance(predictions, predictions)`, i.e. variance -- `streaming_covariance(labels, labels)`, i.e. variance - -The product-moment correlation ultimately returned is an idempotent operation -`cov(predictions, labels) / sqrt(var(predictions) * var(labels))`. To -facilitate correlation computation across multiple batches, the function -groups the `update_op`s of the underlying streaming_covariance and returns an -`update_op`. - -If `weights` is not None, then it is used to compute a weighted correlation. -NOTE: these weights are treated as "frequency weights", as opposed to -"reliability weights". See discussion of the difference on -https://wikipedia.org/wiki/Weighted_arithmetic_mean#Weighted_sample_variance - -##### Args: - - -* `predictions`: A `Tensor` of arbitrary size. -* `labels`: A `Tensor` of the same size as predictions. -* `weights`: Optional `Tensor` indicating the frequency with which an example is - sampled. Rank must be 0, or the same rank as `labels`, and must be - broadcastable to `labels` (i.e., all dimensions must be either `1`, or - the same as the corresponding `labels` dimension). -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `pearson_r`: A `Tensor` representing the current Pearson product-moment - correlation coefficient, the value of - `cov(predictions, labels) / sqrt(var(predictions) * var(labels))`. -* `update_op`: An operation that updates the underlying variables appropriately. - -##### Raises: - - -* `ValueError`: If `labels` and `predictions` are of different sizes, or if - `weights` is the wrong size, or if either `metrics_collections` or - `updates_collections` are not a `list` or `tuple`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_sparse_average_precision_at_k.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_sparse_average_precision_at_k.md deleted file mode 100644 index f6cbb8c90a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_sparse_average_precision_at_k.md +++ /dev/null @@ -1,57 +0,0 @@ -### `tf.contrib.metrics.streaming_sparse_average_precision_at_k(predictions, labels, k, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_sparse_average_precision_at_k} - -Computes average precision@k of predictions with respect to sparse labels. - -See `sparse_average_precision_at_k` for details on formula. `weights` are -applied to the result of `sparse_average_precision_at_k` - -`streaming_sparse_average_precision_at_k` creates two local variables, -`average_precision_at_/total` and `average_precision_at_/max`, that -are used to compute the frequency. This frequency is ultimately returned as -`average_precision_at_`: an idempotent operation that simply divides -`average_precision_at_/total` by `average_precision_at_/max`. - -For estimation of the metric over a stream of data, the function creates an -`update_op` operation that updates these variables and returns the -`precision_at_`. Internally, a `top_k` operation computes a `Tensor` -indicating the top `k` `predictions`. Set operations applied to `top_k` and -`labels` calculate the true positives and false positives weighted by -`weights`. Then `update_op` increments `true_positive_at_` and -`false_positive_at_` using these values. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: Float `Tensor` with shape [D1, ... DN, num_classes] where - N >= 1. Commonly, N=1 and `predictions` has shape - [batch size, num_classes]. The final dimension contains the logit values - for each class. [D1, ... DN] must match `labels`. -* `labels`: `int64` `Tensor` or `SparseTensor` with shape - [D1, ... DN, num_labels], where N >= 1 and num_labels is the number of - target classes for the associated prediction. Commonly, N=1 and `labels` - has shape [batch_size, num_labels]. [D1, ... DN] must match - `predictions_`. Values should be in range [0, num_classes), where - num_classes is the last dimension of `predictions`. Values outside this - range are ignored. -* `k`: Integer, k for @k metric. This will calculate an average precision for - range `[1,k]`, as documented above. -* `weights`: `Tensor` whose rank is either 0, or n-1, where n is the rank of - `labels`. If the latter, it must be broadcastable to `labels` (i.e., all - dimensions must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that values should - be added to. -* `updates_collections`: An optional list of collections that updates should - be added to. -* `name`: Name of new update operation, and namespace for other dependent ops. - -##### Returns: - - -* `mean_average_precision`: Scalar `float64` `Tensor` with the mean average - precision values. -* `update`: `Operation` that increments variables appropriately, and whose - value matches `metric`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_true_negatives.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_true_negatives.md deleted file mode 100644 index 5b9dfd33f4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.metrics.streaming_true_negatives.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.contrib.metrics.streaming_true_negatives(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_true_negatives} - -Sum the weights of true_negatives. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: The predicted values, a `Tensor` of arbitrary dimensions. Will - be cast to `bool`. -* `labels`: The ground truth values, a `Tensor` whose dimensions must match - `predictions`. Will be cast to `bool`. -* `weights`: Optional `Tensor` whose rank is either 0, or the same rank as - `labels`, and must be broadcastable to `labels` (i.e., all dimensions - must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `value_tensor`: A `Tensor` representing the current value of the metric. -* `update_op`: An operation that accumulates the error from a batch of data. - -##### Raises: - - -* `ValueError`: If `predictions` and `labels` have mismatched shapes, or if - `weights` is not `None` and its shape doesn't match `predictions`, or if - either `metrics_collections` or `updates_collections` are not a list or - tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.opt.MovingAverageOptimizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.opt.MovingAverageOptimizer.md deleted file mode 100644 index 582deec24d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.opt.MovingAverageOptimizer.md +++ /dev/null @@ -1,217 +0,0 @@ -Optimizer that computes a moving average of the variables. - -Empirically it has been found that using the moving average of the trained -parameters of a deep network is better than using its trained parameters -directly. This optimizer allows you to compute this moving average and swap -the variables at save time so that any code outside of the training loop will -use by default the averaged values instead of the original ones. - -Example of usage: - -```python - -// Encapsulate your favorite optimizer (here the momentum one) -// inside the MovingAverageOptimizer. -opt = tf.train.MomentumOptimizer(learning_rate, FLAGS.momentum) -opt = tf.contrib.opt.MovingAverageOptimizer(opt) -// Then create your model and all its variables. -model = build_model() -// Add the training op that optimizes using opt. -// This needs to be called before swapping_saver(). -opt.minimize(cost, var_list) -// Then create your saver like this: -saver = opt.swapping_saver() -// Pass it to your training loop. - slim.learning.train( - model, - ... - saver=saver) -``` - -Note that for evaluation, the normal saver should be used instead of -swapping_saver(). -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.__init__(opt, average_decay=0.9999, num_updates=None, sequential_update=True)` {#MovingAverageOptimizer.__init__} - -Construct a new MovingAverageOptimizer. - -##### Args: - - -* `opt`: A tf.Optimizer that will be used to compute and apply gradients. -* `average_decay`: Float. Decay to use to maintain the moving averages - of trained variables. - See tf.train.ExponentialMovingAverage for details. -* `num_updates`: Optional count of number of updates applied to variables. - See tf.train.ExponentialMovingAverage for details. -* `sequential_update`: Bool. If False, will compute the moving average at the - same time as the model is updated, potentially doing - benign data races. - If True, will update the moving average after gradient - updates. - - -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#MovingAverageOptimizer.apply_gradients} - - - - -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.compute_gradients(loss, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, grad_loss=None)` {#MovingAverageOptimizer.compute_gradients} - -Compute gradients of `loss` for the variables in `var_list`. - -This is the first part of `minimize()`. It returns a list -of (gradient, variable) pairs where "gradient" is the gradient -for "variable". Note that "gradient" can be a `Tensor`, an -`IndexedSlices`, or `None` if there is no gradient for the -given variable. - -##### Args: - - -* `loss`: A Tensor containing the value to minimize. -* `var_list`: Optional list of `tf.Variable` to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKey.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - A list of (gradient, variable) pairs. Variable is always present, but - gradient can be `None`. - -##### Raises: - - -* `TypeError`: If `var_list` contains anything else than `Variable` objects. -* `ValueError`: If some arguments are invalid. - - -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.get_name()` {#MovingAverageOptimizer.get_name} - - - - -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.get_slot(var, name)` {#MovingAverageOptimizer.get_slot} - -Return a slot named `name` created for `var` by the Optimizer. - -Some `Optimizer` subclasses use additional variables. For example -`Momentum` and `Adagrad` use variables to accumulate updates. This method -gives access to these `Variable` objects if for some reason you need them. - -Use `get_slot_names()` to get the list of slot names created by the -`Optimizer`. - -##### Args: - - -* `var`: A variable passed to `minimize()` or `apply_gradients()`. -* `name`: A string. - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.get_slot_names()` {#MovingAverageOptimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -See `get_slot()`. - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.minimize(loss, global_step=None, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, name=None, grad_loss=None)` {#MovingAverageOptimizer.minimize} - -Add operations to minimize `loss` by updating `var_list`. - -This method simply combines calls `compute_gradients()` and -`apply_gradients()`. If you want to process the gradient before applying -them call `compute_gradients()` and `apply_gradients()` explicitly instead -of using this function. - -##### Args: - - -* `loss`: A `Tensor` containing the value to minimize. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `name`: Optional name for the returned operation. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - An Operation that updates the variables in `var_list`. If `global_step` - was not `None`, that operation also increments `global_step`. - -##### Raises: - - -* `ValueError`: If some of the variables are not `Variable` objects. - - -- - - - -#### `tf.contrib.opt.MovingAverageOptimizer.swapping_saver(var_list=None, name='swapping_saver', **kwargs)` {#MovingAverageOptimizer.swapping_saver} - -Create a saver swapping moving averages and variables. - -You should use this saver during training. It will save the moving averages -of the trained parameters under the original parameter names. For -evaluations or inference you should use a regular saver and it will -automatically use the moving averages for the trained variable. - -You must call this function after all variables have been created and after -you have called Optimizer.minimize(). - -##### Args: - - -* `var_list`: List of variables to save, as per `Saver()`. - If set to None, will save all the variables that have been - created before this call. -* `name`: The name of the saver. -* `**kwargs`: Keyword arguments of `Saver()`. - -##### Returns: - - A `tf.Saver` object. - -##### Raises: - - -* `RuntimeError`: If apply_gradients or minimize has not been called before. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.rnn.FusedRNNCell.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.rnn.FusedRNNCell.md deleted file mode 100644 index d862d9ea9d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.rnn.FusedRNNCell.md +++ /dev/null @@ -1,47 +0,0 @@ -Abstract object representing a fused RNN cell. - -A fused RNN cell represents the entire RNN expanded over the time -dimension. In effect, this represents an entire recurrent network. - -Unlike RNN cells which are subclasses of `rnn_cell.RNNCell`, a `FusedRNNCell` -operates on the entire time sequence at once, by putting the loop over time -inside the cell. This usually leads to much more efficient, but more complex -and less flexible implementations. - -Every `FusedRNNCell` must implement `__call__` with the following signature. -- - - - -#### `tf.contrib.rnn.FusedRNNCell.__call__(inputs, initial_state=None, dtype=None, sequence_length=None, scope=None)` {#FusedRNNCell.__call__} - -Run this fused RNN on inputs, starting from the given state. - -##### Args: - - -* `inputs`: `3-D` tensor with shape `[time_len x batch_size x input_size]` - or a list of `time_len` tensors of shape `[batch_size x input_size]`. -* `initial_state`: either a tensor with shape `[batch_size x state_size]` - or a tuple with shapes `[batch_size x s] for s in state_size`, if the - cell takes tuples. If this is not provided, the cell is expected to - create a zero initial state of type `dtype`. -* `dtype`: The data type for the initial state and expected output. Required - if `initial_state` is not provided or RNN state has a heterogeneous - dtype. -* `sequence_length`: Specifies the length of each sequence in inputs. An - `int32` or `int64` vector (tensor) size `[batch_size]`, values in `[0, - time_len)`. - Defaults to `time_len` for each element. -* `scope`: `VariableScope` or `string` for the created subgraph; defaults to - class name. - -##### Returns: - - A pair containing: - - - Output: A `3-D` tensor of shape `[time_len x batch_size x output_size]` - or a list of `time_len` tensors of shape `[batch_size x output_size]`, - to match the type of the `inputs`. - - Final state: Either a single `2-D` tensor, or a tuple of tensors - matching the arity and shapes of `initial_state`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.rnn.LSTMStateTuple.__new__.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.rnn.LSTMStateTuple.__new__.md deleted file mode 100644 index fec450ce78..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.rnn.LSTMStateTuple.__new__.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.contrib.rnn.LSTMStateTuple.__new__(_cls, c, h)` {#LSTMStateTuple.__new__} - -Create new instance of LSTMStateTuple(c, h) - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.rnn.static_rnn.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.rnn.static_rnn.md deleted file mode 100644 index fb32ce3d2e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.rnn.static_rnn.md +++ /dev/null @@ -1,65 +0,0 @@ -### `tf.contrib.rnn.static_rnn(cell, inputs, initial_state=None, dtype=None, sequence_length=None, scope=None)` {#static_rnn} - -Creates a recurrent neural network specified by RNNCell `cell`. - -The simplest form of RNN network generated is: - -```python - state = cell.zero_state(...) - outputs = [] - for input_ in inputs: - output, state = cell(input_, state) - outputs.append(output) - return (outputs, state) -``` -However, a few other options are available: - -An initial state can be provided. -If the sequence_length vector is provided, dynamic calculation is performed. -This method of calculation does not compute the RNN steps past the maximum -sequence length of the minibatch (thus saving computational time), -and properly propagates the state at an example's sequence length -to the final state output. - -The dynamic calculation performed is, at time `t` for batch row `b`, - -```python - (output, state)(b, t) = - (t >= sequence_length(b)) - ? (zeros(cell.output_size), states(b, sequence_length(b) - 1)) - : cell(input(b, t), state(b, t - 1)) -``` - -##### Args: - - -* `cell`: An instance of RNNCell. -* `inputs`: A length T list of inputs, each a `Tensor` of shape - `[batch_size, input_size]`, or a nested tuple of such elements. -* `initial_state`: (optional) An initial state for the RNN. - If `cell.state_size` is an integer, this must be - a `Tensor` of appropriate type and shape `[batch_size, cell.state_size]`. - If `cell.state_size` is a tuple, this should be a tuple of - tensors having shapes `[batch_size, s] for s in cell.state_size`. -* `dtype`: (optional) The data type for the initial state and expected output. - Required if initial_state is not provided or RNN state has a heterogeneous - dtype. -* `sequence_length`: Specifies the length of each sequence in inputs. - An int32 or int64 vector (tensor) size `[batch_size]`, values in `[0, T)`. -* `scope`: VariableScope for the created subgraph; defaults to "rnn". - -##### Returns: - - A pair (outputs, state) where: - - - outputs is a length T list of outputs (one for each input), or a nested - tuple of such elements. - - state is the final state - -##### Raises: - - -* `TypeError`: If `cell` is not an instance of RNNCell. -* `ValueError`: If `inputs` is `None` or an empty list, or if the input depth - (column size) cannot be inferred from inputs via shape inference. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.training.bucket_by_sequence_length.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.training.bucket_by_sequence_length.md deleted file mode 100644 index f2e69fbb88..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.contrib.training.bucket_by_sequence_length.md +++ /dev/null @@ -1,55 +0,0 @@ -### `tf.contrib.training.bucket_by_sequence_length(input_length, tensors, batch_size, bucket_boundaries, num_threads=1, capacity=32, shapes=None, dynamic_pad=False, allow_smaller_final_batch=False, keep_input=True, shared_name=None, name=None)` {#bucket_by_sequence_length} - -Lazy bucketing of inputs according to their length. - -This method calls `tf.contrib.training.bucket` under the hood, after first -subdividing the bucket boundaries into separate buckets and identifying which -bucket the given `input_length` belongs to. See the documentation for -`which_bucket` for details of the other arguments. - -##### Args: - - -* `input_length`: `int32` scalar `Tensor`, the sequence length of tensors. -* `tensors`: The list or dictionary of tensors, representing a single element, - to bucket. Nested lists are not supported. -* `batch_size`: The new batch size pulled from the queue (all queues will have - the same size). If a list is passed in then each bucket will have a - different batch_size. - (python int, int32 scalar or iterable of integers of length num_buckets). -* `bucket_boundaries`: int list, increasing non-negative numbers. - The edges of the buckets to use when bucketing tensors. Two extra buckets - are created, one for `input_length < bucket_boundaries[0]` and - one for `input_length >= bucket_boundaries[-1]`. -* `num_threads`: An integer. The number of threads enqueuing `tensors`. -* `capacity`: An integer. The maximum number of minibatches in the top queue, - and also the maximum number of elements within each bucket. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensors`. -* `dynamic_pad`: Boolean. Allow variable dimensions in input shapes. - The given dimensions are padded upon dequeue so that tensors within a - batch have the same shapes. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batches to be smaller if there are insufficient items left in the queues. -* `keep_input`: A `bool` scalar Tensor. If provided, this tensor controls - whether the input is added to the queue or not. If it evaluates `True`, - then `tensors` are added to the bucket; otherwise they are dropped. This - tensor essentially acts as a filtering mechanism. -* `shared_name`: (Optional). If set, the queues will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A tuple `(sequence_length, outputs)` where `sequence_length` is - a 1-D `Tensor` of size `batch_size` and `outputs` is a list or dictionary - of batched, bucketed, outputs corresponding to elements of `tensors`. - -##### Raises: - - -* `TypeError`: if `bucket_boundaries` is not a list of python integers. -* `ValueError`: if `bucket_boundaries` is empty or contains non-increasing - values or if batch_size is a list and it's length doesn't equal the number - of buckets. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.cross.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.cross.md deleted file mode 100644 index eecf2e869b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.cross.md +++ /dev/null @@ -1,22 +0,0 @@ -### `tf.cross(a, b, name=None)` {#cross} - -Compute the pairwise cross product. - -`a` and `b` must be the same shape; they can either be simple 3-element vectors, -or any shape where the innermost dimension is 3. In the latter case, each pair -of corresponding 3-element vectors is cross-multiplied independently. - -##### Args: - - -* `a`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. - A tensor containing 3-element vectors. -* `b`: A `Tensor`. Must have the same type as `a`. - Another tensor, of same type and shape as `a`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `a`. - Pairwise cross product of the vectors in `a` and `b`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.equal.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.equal.md deleted file mode 100644 index 332a12f725..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.equal.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.equal(x, y, name=None)` {#equal} - -Returns the truth value of (x == y) element-wise. - -*NOTE*: `Equal` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`, `complex64`, `quint8`, `qint8`, `qint32`, `string`, `bool`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.hessians.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.hessians.md deleted file mode 100644 index 0aea7659ce..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.hessians.md +++ /dev/null @@ -1,36 +0,0 @@ -### `tf.hessians(ys, xs, name='hessians', colocate_gradients_with_ops=False, gate_gradients=False, aggregation_method=None)` {#hessians} - -Constructs the Hessian of sum of `ys` with respect to `x` in `xs`. - -`hessians()` adds ops to the graph to output the Hessian matrix of `ys` -with respect to `xs`. It returns a list of `Tensor` of length `len(xs)` -where each tensor is the Hessian of `sum(ys)`. This function currently -only supports evaluating the Hessian with respect to (a list of) one- -dimensional tensors. - -The Hessian is a matrix of second-order partial derivatives of a scalar -tensor (see https://en.wikipedia.org/wiki/Hessian_matrix for more details). - -##### Args: - - -* `ys`: A `Tensor` or list of tensors to be differentiated. -* `xs`: A `Tensor` or list of tensors to be used for differentiation. -* `name`: Optional name to use for grouping all the gradient ops together. - defaults to 'hessians'. -* `colocate_gradients_with_ops`: See `gradients()` documentation for details. -* `gate_gradients`: See `gradients()` documentation for details. -* `aggregation_method`: See `gradients()` documentation for details. - -##### Returns: - - A list of Hessian matrices of `sum(y)` for each `x` in `xs`. - -##### Raises: - - -* `LookupError`: if one of the operations between `xs` and `ys` does not - have a registered gradient function. -* `ValueError`: if the arguments are invalid or not supported. Currently, - this function only supports one-dimensional `x` in `xs`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.crop_to_bounding_box.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.crop_to_bounding_box.md deleted file mode 100644 index 1ca4247a9b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.crop_to_bounding_box.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.image.crop_to_bounding_box(image, offset_height, offset_width, target_height, target_width)` {#crop_to_bounding_box} - -Crops an image to a specified bounding box. - -This op cuts a rectangular part out of `image`. The top-left corner of the -returned image is at `offset_height, offset_width` in `image`, and its -lower-right corner is at -`offset_height + target_height, offset_width + target_width`. - -##### Args: - - -* `image`: 3-D tensor with shape `[height, width, channels]` -* `offset_height`: Vertical coordinate of the top-left corner of the result in - the input. -* `offset_width`: Horizontal coordinate of the top-left corner of the result in - the input. -* `target_height`: Height of the result. -* `target_width`: Width of the result. - -##### Returns: - - 3-D tensor of image with shape `[target_height, target_width, channels]` - -##### Raises: - - -* `ValueError`: If the shape of `image` is incompatible with the `offset_*` or - `target_*` arguments, or either `offset_height` or `offset_width` is - negative, or either `target_height` or `target_width` is not positive. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.draw_bounding_boxes.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.draw_bounding_boxes.md deleted file mode 100644 index fff67cd42f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.draw_bounding_boxes.md +++ /dev/null @@ -1,32 +0,0 @@ -### `tf.image.draw_bounding_boxes(images, boxes, name=None)` {#draw_bounding_boxes} - -Draw bounding boxes on a batch of images. - -Outputs a copy of `images` but draws on top of the pixels zero or more bounding -boxes specified by the locations in `boxes`. The coordinates of the each -bounding box in `boxes` are encoded as `[y_min, x_min, y_max, x_max]`. The -bounding box coordinates are floats in `[0.0, 1.0]` relative to the width and -height of the underlying image. - -For example, if an image is 100 x 200 pixels and the bounding box is -`[0.1, 0.2, 0.5, 0.9]`, the bottom-left and upper-right coordinates of the -bounding box will be `(10, 40)` to `(50, 180)`. - -Parts of the bounding box may fall outside the image. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `float32`, `half`. - 4-D with shape `[batch, height, width, depth]`. A batch of images. -* `boxes`: A `Tensor` of type `float32`. - 3-D with shape `[batch, num_bounding_boxes, 4]` containing bounding - boxes. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `images`. - 4-D with the same shape as `images`. The batch of input images with - bounding boxes drawn on the images. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.per_image_standardization.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.per_image_standardization.md deleted file mode 100644 index 8b7b848443..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.per_image_standardization.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.image.per_image_standardization(image)` {#per_image_standardization} - -Linearly scales `image` to have zero mean and unit norm. - -This op computes `(x - mean) / adjusted_stddev`, where `mean` is the average -of all values in image, and -`adjusted_stddev = max(stddev, 1.0/sqrt(image.NumElements()))`. - -`stddev` is the standard deviation of all values in `image`. It is capped -away from zero to protect against division by 0 when handling uniform images. - -##### Args: - - -* `image`: 3-D tensor of shape `[height, width, channels]`. - -##### Returns: - - The standardized image with same shape as `image`. - -##### Raises: - - -* `ValueError`: if the shape of 'image' is incompatible with this function. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.resize_bilinear.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.resize_bilinear.md deleted file mode 100644 index a9580ca199..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.resize_bilinear.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.image.resize_bilinear(images, size, align_corners=None, name=None)` {#resize_bilinear} - -Resize `images` to `size` using bilinear interpolation. - -Input images can be of different types but output images are always float. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int16`, `int32`, `int64`, `half`, `float32`, `float64`. - 4-D with shape `[batch, height, width, channels]`. -* `size`: A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The - new size for the images. -* `align_corners`: An optional `bool`. Defaults to `False`. - If true, rescale input by (new_height - 1) / (height - 1), which - exactly aligns the 4 corners of images and resized images. If false, rescale - by new_height / height. Treat similarly the width dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. 4-D with shape - `[batch, new_height, new_width, channels]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.resize_images.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.resize_images.md deleted file mode 100644 index a4b7e8f57a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.resize_images.md +++ /dev/null @@ -1,41 +0,0 @@ -### `tf.image.resize_images(images, size, method=0, align_corners=False)` {#resize_images} - -Resize `images` to `size` using the specified `method`. - -Resized images will be distorted if their original aspect ratio is not -the same as `size`. To avoid distortions see -[`resize_image_with_crop_or_pad`](#resize_image_with_crop_or_pad). - -`method` can be one of: - -* `ResizeMethod.BILINEAR`: [Bilinear interpolation.](https://en.wikipedia.org/wiki/Bilinear_interpolation) -* `ResizeMethod.NEAREST_NEIGHBOR`: [Nearest neighbor interpolation.](https://en.wikipedia.org/wiki/Nearest-neighbor_interpolation) -* `ResizeMethod.BICUBIC`: [Bicubic interpolation.](https://en.wikipedia.org/wiki/Bicubic_interpolation) -* `ResizeMethod.AREA`: Area interpolation. - -##### Args: - - -* `images`: 4-D Tensor of shape `[batch, height, width, channels]` or - 3-D Tensor of shape `[height, width, channels]`. -* `size`: A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The - new size for the images. -* `method`: ResizeMethod. Defaults to `ResizeMethod.BILINEAR`. -* `align_corners`: bool. If true, exactly align all 4 corners of the input and - output. Defaults to `false`. - -##### Raises: - - -* `ValueError`: if the shape of `images` is incompatible with the - shape arguments to this function -* `ValueError`: if `size` has invalid shape or type. -* `ValueError`: if an unsupported resize method is specified. - -##### Returns: - - If `images` was 4-D, a 4-D float Tensor of shape - `[batch, new_height, new_width, channels]`. - If `images` was 3-D, a 3-D float Tensor of shape - `[new_height, new_width, channels]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.transpose_image.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.transpose_image.md deleted file mode 100644 index 1cc527d345..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.image.transpose_image.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.image.transpose_image(image)` {#transpose_image} - -Transpose an image by swapping the first and second dimension. - -See also `transpose()`. - -##### Args: - - -* `image`: 3-D tensor of shape `[height, width, channels]` - -##### Returns: - - A 3-D tensor of shape `[width, height, channels]` - -##### Raises: - - -* `ValueError`: if the shape of `image` not supported. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.is_inf.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.is_inf.md deleted file mode 100644 index 56663d6417..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.is_inf.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.is_inf(x, name=None)` {#is_inf} - -Returns which elements of x are Inf. - -@compatibility(numpy) -Equivalent to np.isinf -@end_compatibility - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.lbeta.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.lbeta.md deleted file mode 100644 index e3ee18dfb3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.lbeta.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.lbeta(x, name='lbeta')` {#lbeta} - -Computes `ln(|Beta(x)|)`, reducing along the last dimension. - -Given one-dimensional `z = [z_0,...,z_{K-1}]`, we define - -```Beta(z) = \prod_j Gamma(z_j) / Gamma(\sum_j z_j)``` - -And for `n + 1` dimensional `x` with shape `[N1, ..., Nn, K]`, we define -`lbeta(x)[i1, ..., in] = Log(|Beta(x[i1, ..., in, :])|)`. In other words, -the last dimension is treated as the `z` vector. - -Note that if `z = [u, v]`, then -`Beta(z) = int_0^1 t^{u-1} (1 - t)^{v-1} dt`, which defines the traditional -bivariate beta function. - -##### Args: - - -* `x`: A rank `n + 1` `Tensor` with type `float`, or `double`. -* `name`: A name for the operation (optional). - -##### Returns: - - The logarithm of `|Beta(x)|` reducing along the last dimension. - -##### Raises: - - -* `ValueError`: If `x` is empty with rank one or less. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.less_equal.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.less_equal.md deleted file mode 100644 index c8ce84b669..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.less_equal.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.less_equal(x, y, name=None)` {#less_equal} - -Returns the truth value of (x <= y) element-wise. - -*NOTE*: `LessEqual` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.matrix_inverse.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.matrix_inverse.md deleted file mode 100644 index ff49493f0c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.matrix_inverse.md +++ /dev/null @@ -1,32 +0,0 @@ -### `tf.matrix_inverse(input, adjoint=None, name=None)` {#matrix_inverse} - -Computes the inverse of one or more square invertible matrices or their - -adjoints (conjugate transposes). - -The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions -form square matrices. The output is a tensor of the same shape as the input -containing the inverse for all input submatrices `[..., :, :]`. - -The op uses LU decomposition with partial pivoting to compute the inverses. - -If a matrix is not invertible there is no guarantee what the op does. It -may detect the condition and raise an exception or it may simply return a -garbage result. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float64`, `float32`. - Shape is `[..., M, M]`. -* `adjoint`: An optional `bool`. Defaults to `False`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. Shape is `[..., M, M]`. - - @compatibility(numpy) - Equivalent to np.linalg.inv - @end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.matrix_set_diag.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.matrix_set_diag.md deleted file mode 100644 index a8f9bf6be8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.matrix_set_diag.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.matrix_set_diag(input, diagonal, name=None)` {#matrix_set_diag} - -Returns a batched matrix tensor with new batched diagonal values. - -Given `input` and `diagonal`, this operation returns a tensor with the -same shape and values as `input`, except for the main diagonal of the -innermost matrices. These will be overwritten by the values in `diagonal`. - -The output is computed as follows: - -Assume `input` has `k+1` dimensions `[I, J, K, ..., M, N]` and `diagonal` has -`k` dimensions `[I, J, K, ..., min(M, N)]`. Then the output is a -tensor of rank `k+1` with dimensions `[I, J, K, ..., M, N]` where: - - * `output[i, j, k, ..., m, n] = diagonal[i, j, k, ..., n]` for `m == n`. - * `output[i, j, k, ..., m, n] = input[i, j, k, ..., m, n]` for `m != n`. - -##### Args: - - -* `input`: A `Tensor`. Rank `k+1`, where `k >= 1`. -* `diagonal`: A `Tensor`. Must have the same type as `input`. - Rank `k`, where `k >= 1`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - Rank `k+1`, with `output.shape = input.shape`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.batch_normalization.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.batch_normalization.md deleted file mode 100644 index 4ef94aeda2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.batch_normalization.md +++ /dev/null @@ -1,47 +0,0 @@ -### `tf.nn.batch_normalization(x, mean, variance, offset, scale, variance_epsilon, name=None)` {#batch_normalization} - -Batch normalization. - -As described in http://arxiv.org/abs/1502.03167. -Normalizes a tensor by `mean` and `variance`, and applies (optionally) a -`scale` \\(\gamma\\) to it, as well as an `offset` \\(\beta\\): - -\\(\frac{\gamma(x-\mu)}{\sigma}+\beta\\) - -`mean`, `variance`, `offset` and `scale` are all expected to be of one of two -shapes: - - * In all generality, they can have the same number of dimensions as the - input `x`, with identical sizes as `x` for the dimensions that are not - normalized over (the 'depth' dimension(s)), and dimension 1 for the - others which are being normalized over. - `mean` and `variance` in this case would typically be the outputs of - `tf.nn.moments(..., keep_dims=True)` during training, or running averages - thereof during inference. - * In the common case where the 'depth' dimension is the last dimension in - the input tensor `x`, they may be one dimensional tensors of the same - size as the 'depth' dimension. - This is the case for example for the common `[batch, depth]` layout of - fully-connected layers, and `[batch, height, width, depth]` for - convolutions. - `mean` and `variance` in this case would typically be the outputs of - `tf.nn.moments(..., keep_dims=False)` during training, or running averages - thereof during inference. - -##### Args: - - -* `x`: Input `Tensor` of arbitrary dimensionality. -* `mean`: A mean `Tensor`. -* `variance`: A variance `Tensor`. -* `offset`: An offset `Tensor`, often denoted \\(\beta\\) in equations, or - None. If present, will be added to the normalized tensor. -* `scale`: A scale `Tensor`, often denoted \\(\gamma\\) in equations, or - `None`. If present, the scale is applied to the normalized tensor. -* `variance_epsilon`: A small float number to avoid dividing by 0. -* `name`: A name for this operation (optional). - -##### Returns: - - the normalized, scaled, offset tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.bidirectional_dynamic_rnn.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.bidirectional_dynamic_rnn.md deleted file mode 100644 index e57bbb03d0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.bidirectional_dynamic_rnn.md +++ /dev/null @@ -1,84 +0,0 @@ -### `tf.nn.bidirectional_dynamic_rnn(cell_fw, cell_bw, inputs, sequence_length=None, initial_state_fw=None, initial_state_bw=None, dtype=None, parallel_iterations=None, swap_memory=False, time_major=False, scope=None)` {#bidirectional_dynamic_rnn} - -Creates a dynamic version of bidirectional recurrent neural network. - -Similar to the unidirectional case above (rnn) but takes input and builds -independent forward and backward RNNs. The input_size of forward and -backward cell must match. The initial state for both directions is zero by -default (but can be set optionally) and no intermediate states are ever -returned -- the network is fully unrolled for the given (passed in) -length(s) of the sequence(s) or completely unrolled if length(s) is not -given. - -##### Args: - - -* `cell_fw`: An instance of RNNCell, to be used for forward direction. -* `cell_bw`: An instance of RNNCell, to be used for backward direction. -* `inputs`: The RNN inputs. - If time_major == False (default), this must be a tensor of shape: - `[batch_size, max_time, input_size]`. - If time_major == True, this must be a tensor of shape: - `[max_time, batch_size, input_size]`. - [batch_size, input_size]. -* `sequence_length`: An int32/int64 vector, size `[batch_size]`, - containing the actual lengths for each of the sequences. -* `initial_state_fw`: (optional) An initial state for the forward RNN. - This must be a tensor of appropriate type and shape - `[batch_size, cell_fw.state_size]`. - If `cell_fw.state_size` is a tuple, this should be a tuple of - tensors having shapes `[batch_size, s] for s in cell_fw.state_size`. -* `initial_state_bw`: (optional) Same as for `initial_state_fw`, but using - the corresponding properties of `cell_bw`. -* `dtype`: (optional) The data type for the initial states and expected output. - Required if initial_states are not provided or RNN states have a - heterogeneous dtype. -* `parallel_iterations`: (Default: 32). The number of iterations to run in - parallel. Those operations which do not have any temporal dependency - and can be run in parallel, will be. This parameter trades off - time for space. Values >> 1 use more memory but take less time, - while smaller values use less memory but computations take longer. -* `swap_memory`: Transparently swap the tensors produced in forward inference - but needed for back prop from GPU to CPU. This allows training RNNs - which would typically not fit on a single GPU, with very minimal (or no) - performance penalty. -* `time_major`: The shape format of the `inputs` and `outputs` Tensors. - If true, these `Tensors` must be shaped `[max_time, batch_size, depth]`. - If false, these `Tensors` must be shaped `[batch_size, max_time, depth]`. - Using `time_major = True` is a bit more efficient because it avoids - transposes at the beginning and end of the RNN calculation. However, - most TensorFlow data is batch-major, so by default this function - accepts input and emits output in batch-major form. -* `dtype`: (optional) The data type for the initial state. Required if - either of the initial states are not provided. -* `scope`: VariableScope for the created subgraph; defaults to - "bidirectional_rnn" - -##### Returns: - - A tuple (outputs, output_states) where: - -* `outputs`: A tuple (output_fw, output_bw) containing the forward and - the backward rnn output `Tensor`. - If time_major == False (default), - output_fw will be a `Tensor` shaped: - `[batch_size, max_time, cell_fw.output_size]` - and output_bw will be a `Tensor` shaped: - `[batch_size, max_time, cell_bw.output_size]`. - If time_major == True, - output_fw will be a `Tensor` shaped: - `[max_time, batch_size, cell_fw.output_size]` - and output_bw will be a `Tensor` shaped: - `[max_time, batch_size, cell_bw.output_size]`. - It returns a tuple instead of a single concatenated `Tensor`, unlike - in the `bidirectional_rnn`. If the concatenated one is preferred, - the forward and backward outputs can be concatenated as - `tf.concat(outputs, 2)`. -* `output_states`: A tuple (output_state_fw, output_state_bw) containing - the forward and the backward final states of bidirectional rnn. - -##### Raises: - - -* `TypeError`: If `cell_fw` or `cell_bw` is not an instance of `RNNCell`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.conv2d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.conv2d.md deleted file mode 100644 index d40ed35657..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.conv2d.md +++ /dev/null @@ -1,49 +0,0 @@ -### `tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, data_format=None, name=None)` {#conv2d} - -Computes a 2-D convolution given 4-D `input` and `filter` tensors. - -Given an input tensor of shape `[batch, in_height, in_width, in_channels]` -and a filter / kernel tensor of shape -`[filter_height, filter_width, in_channels, out_channels]`, this op -performs the following: - -1. Flattens the filter to a 2-D matrix with shape - `[filter_height * filter_width * in_channels, output_channels]`. -2. Extracts image patches from the input tensor to form a *virtual* - tensor of shape `[batch, out_height, out_width, - filter_height * filter_width * in_channels]`. -3. For each patch, right-multiplies the filter matrix and the image patch - vector. - -In detail, with the default NHWC format, - - output[b, i, j, k] = - sum_{di, dj, q} input[b, strides[1] * i + di, strides[2] * j + dj, q] * - filter[di, dj, q, k] - -Must have `strides[0] = strides[3] = 1`. For the most common case of the same -horizontal and vertices strides, `strides = [1, stride, stride, 1]`. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `filter`: A `Tensor`. Must have the same type as `input`. -* `strides`: A list of `ints`. - 1-D of length 4. The stride of the sliding window for each dimension - of `input`. Must be in the same order as the dimension specified with format. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `use_cudnn_on_gpu`: An optional `bool`. Defaults to `True`. -* `data_format`: An optional `string` from: `"NHWC", "NCHW"`. Defaults to `"NHWC"`. - Specify the data format of the input and output data. With the - default format "NHWC", the data is stored in the order of: - [batch, in_height, in_width, in_channels]. - Alternatively, the format could be "NCHW", the data storage order of: - [batch, in_channels, in_height, in_width]. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.convolution.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.convolution.md deleted file mode 100644 index f1ed0e2f53..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.convolution.md +++ /dev/null @@ -1,116 +0,0 @@ -### `tf.nn.convolution(input, filter, padding, strides=None, dilation_rate=None, name=None, data_format=None)` {#convolution} - -Computes sums of N-D convolutions (actually cross-correlation). - -This also supports either output striding via the optional `strides` parameter -or atrous convolution (also known as convolution with holes or dilated -convolution, based on the French word "trous" meaning holes in English) via -the optional `dilation_rate` parameter. Currently, however, output striding -is not supported for atrous convolutions. - -Specifically, in the case that `data_format` does not start with "NC", given -a rank (N+2) `input` Tensor of shape - - [num_batches, - input_spatial_shape[0], - ..., - input_spatial_shape[N-1], - num_input_channels], - -a rank (N+2) `filter` Tensor of shape - - [spatial_filter_shape[0], - ..., - spatial_filter_shape[N-1], - num_input_channels, - num_output_channels], - -an optional `dilation_rate` tensor of shape [N] (defaulting to [1]*N) -specifying the filter upsampling/input downsampling rate, and an optional list -of N `strides` (defaulting [1]*N), this computes for each N-D spatial output -position (x[0], ..., x[N-1]): - - output[b, x[0], ..., x[N-1], k] = - - sum_{z[0], ..., z[N-1], q} - - filter[z[0], ..., z[N-1], q, k] * - padded_input[b, - x[0]*strides[0] + dilation_rate[0]*z[0], - ..., - x[N-1]*strides[N-1] + dilation_rate[N-1]*z[N-1], - q] - -where `padded_input` is obtained by zero padding the input using an effective -spatial filter shape of `(spatial_filter_shape-1) * dilation_rate + 1` and -output striding `strides` as described in the -[comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution). - -In the case that `data_format` does start with `"NC"`, the `input` and output -(but not the `filter`) are simply transposed as follows: - - convolution(input, data_format, **kwargs) = - tf.transpose(convolution(tf.transpose(input, [0] + range(2,N+2) + [1]), - **kwargs), - [0, N+1] + range(1, N+1)) - -It is required that 1 <= N <= 3. - -##### Args: - - -* `input`: An N-D `Tensor` of type `T`, of shape - `[batch_size] + input_spatial_shape + [in_channels]` if data_format does - not start with "NC" (default), or - `[batch_size, in_channels] + input_spatial_shape` if data_format starts - with "NC". -* `filter`: An N-D `Tensor` with the same type as `input` and shape - `spatial_filter_shape + [in_channels, out_channels]`. -* `padding`: A string, either `"VALID"` or `"SAME"`. The padding algorithm. -* `strides`: Optional. Sequence of N ints >= 1. Specifies the output stride. - Defaults to [1]*N. If any value of strides is > 1, then all values of - dilation_rate must be 1. -* `dilation_rate`: Optional. Sequence of N ints >= 1. Specifies the filter - upsampling/input downsampling rate. In the literature, the same parameter - is sometimes called `input stride` or `dilation`. The effective filter - size used for the convolution will be `spatial_filter_shape + - (spatial_filter_shape - 1) * (rate - 1)`, obtained by inserting - (dilation_rate[i]-1) zeros between consecutive elements of the original - filter in each spatial dimension i. If any value of dilation_rate is > 1, - then all values of strides must be 1. -* `name`: Optional name for the returned tensor. -* `data_format`: A string or None. Specifies whether the channel dimension of - the `input` and output is the last dimension (default, or if `data_format` - does not start with "NC"), or the second dimension (if `data_format` - starts with "NC"). For N=1, the valid values are "NWC" (default) and - "NCW". For N=2, the valid values are "NHWC" (default) and "NCHW". For - N=3, the valid value is "NDHWC". - -##### Returns: - - A `Tensor` with the same type as `input` of shape - - `[batch_size] + output_spatial_shape + [out_channels]` - - if data_format is None or does not start with "NC", or - - `[batch_size, out_channels] + output_spatial_shape` - - if data_format starts with "NC", - where `output_spatial_shape` depends on the value of `padding`. - - If padding == "SAME": - output_spatial_shape[i] = ceil(input_spatial_shape[i] / strides[i]) - - If padding == "VALID": - output_spatial_shape[i] = - ceil((input_spatial_shape[i] - - (spatial_filter_shape[i]-1) * dilation_rate[i]) - / strides[i]). - -##### Raises: - - -* `ValueError`: If input/output depth does not match `filter` shape, if padding - is other than `"VALID"` or `"SAME"`, or if data_format is invalid. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.dynamic_rnn.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.dynamic_rnn.md deleted file mode 100644 index f2ae7527e7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.dynamic_rnn.md +++ /dev/null @@ -1,102 +0,0 @@ -### `tf.nn.dynamic_rnn(cell, inputs, sequence_length=None, initial_state=None, dtype=None, parallel_iterations=None, swap_memory=False, time_major=False, scope=None)` {#dynamic_rnn} - -Creates a recurrent neural network specified by RNNCell `cell`. - -This function is functionally identical to the function `rnn` above, but -performs fully dynamic unrolling of `inputs`. - -Unlike `rnn`, the input `inputs` is not a Python list of `Tensors`, one for -each frame. Instead, `inputs` may be a single `Tensor` where -the maximum time is either the first or second dimension (see the parameter -`time_major`). Alternatively, it may be a (possibly nested) tuple of -Tensors, each of them having matching batch and time dimensions. -The corresponding output is either a single `Tensor` having the same number -of time steps and batch size, or a (possibly nested) tuple of such tensors, -matching the nested structure of `cell.output_size`. - -The parameter `sequence_length` is optional and is used to copy-through state -and zero-out outputs when past a batch element's sequence length. So it's more -for correctness than performance, unlike in rnn(). - -##### Args: - - -* `cell`: An instance of RNNCell. -* `inputs`: The RNN inputs. - - If `time_major == False` (default), this must be a `Tensor` of shape: - `[batch_size, max_time, ...]`, or a nested tuple of such - elements. - - If `time_major == True`, this must be a `Tensor` of shape: - `[max_time, batch_size, ...]`, or a nested tuple of such - elements. - - This may also be a (possibly nested) tuple of Tensors satisfying - this property. The first two dimensions must match across all the inputs, - but otherwise the ranks and other shape components may differ. - In this case, input to `cell` at each time-step will replicate the - structure of these tuples, except for the time dimension (from which the - time is taken). - - The input to `cell` at each time step will be a `Tensor` or (possibly - nested) tuple of Tensors each with dimensions `[batch_size, ...]`. - -* `sequence_length`: (optional) An int32/int64 vector sized `[batch_size]`. -* `initial_state`: (optional) An initial state for the RNN. - If `cell.state_size` is an integer, this must be - a `Tensor` of appropriate type and shape `[batch_size, cell.state_size]`. - If `cell.state_size` is a tuple, this should be a tuple of - tensors having shapes `[batch_size, s] for s in cell.state_size`. -* `dtype`: (optional) The data type for the initial state and expected output. - Required if initial_state is not provided or RNN state has a heterogeneous - dtype. -* `parallel_iterations`: (Default: 32). The number of iterations to run in - parallel. Those operations which do not have any temporal dependency - and can be run in parallel, will be. This parameter trades off - time for space. Values >> 1 use more memory but take less time, - while smaller values use less memory but computations take longer. -* `swap_memory`: Transparently swap the tensors produced in forward inference - but needed for back prop from GPU to CPU. This allows training RNNs - which would typically not fit on a single GPU, with very minimal (or no) - performance penalty. -* `time_major`: The shape format of the `inputs` and `outputs` Tensors. - If true, these `Tensors` must be shaped `[max_time, batch_size, depth]`. - If false, these `Tensors` must be shaped `[batch_size, max_time, depth]`. - Using `time_major = True` is a bit more efficient because it avoids - transposes at the beginning and end of the RNN calculation. However, - most TensorFlow data is batch-major, so by default this function - accepts input and emits output in batch-major form. -* `scope`: VariableScope for the created subgraph; defaults to "rnn". - -##### Returns: - - A pair (outputs, state) where: - - -* `outputs`: The RNN output `Tensor`. - - If time_major == False (default), this will be a `Tensor` shaped: - `[batch_size, max_time, cell.output_size]`. - - If time_major == True, this will be a `Tensor` shaped: - `[max_time, batch_size, cell.output_size]`. - - Note, if `cell.output_size` is a (possibly nested) tuple of integers - or `TensorShape` objects, then `outputs` will be a tuple having the - same structure as `cell.output_size`, containing Tensors having shapes - corresponding to the shape data in `cell.output_size`. - - -* `state`: The final state. If `cell.state_size` is an int, this - will be shaped `[batch_size, cell.state_size]`. If it is a - `TensorShape`, this will be shaped `[batch_size] + cell.state_size`. - If it is a (possibly nested) tuple of ints or `TensorShape`, this will - be a tuple having the corresponding shapes. - -##### Raises: - - -* `TypeError`: If `cell` is not an instance of RNNCell. -* `ValueError`: If inputs is None or an empty list. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.learned_unigram_candidate_sampler.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.learned_unigram_candidate_sampler.md deleted file mode 100644 index 4f69938e59..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.learned_unigram_candidate_sampler.md +++ /dev/null @@ -1,53 +0,0 @@ -### `tf.nn.learned_unigram_candidate_sampler(true_classes, num_true, num_sampled, unique, range_max, seed=None, name=None)` {#learned_unigram_candidate_sampler} - -Samples a set of classes from a distribution learned during training. - -This operation randomly samples a tensor of sampled classes -(`sampled_candidates`) from the range of integers `[0, range_max)`. - -The elements of `sampled_candidates` are drawn without replacement -(if `unique=True`) or with replacement (if `unique=False`) from -the base distribution. - -The base distribution for this operation is constructed on the fly -during training. It is a unigram distribution over the target -classes seen so far during training. Every integer in `[0, range_max)` -begins with a weight of 1, and is incremented by 1 each time it is -seen as a target class. The base distribution is not saved to checkpoints, -so it is reset when the model is reloaded. - -In addition, this operation returns tensors `true_expected_count` -and `sampled_expected_count` representing the number of times each -of the target classes (`true_classes`) and the sampled -classes (`sampled_candidates`) is expected to occur in an average -tensor of sampled classes. These values correspond to `Q(y|x)` -defined in [this -document](http://www.tensorflow.org/extras/candidate_sampling.pdf). -If `unique=True`, then these are post-rejection probabilities and we -compute them approximately. - -##### Args: - - -* `true_classes`: A `Tensor` of type `int64` and shape `[batch_size, - num_true]`. The target classes. -* `num_true`: An `int`. The number of target classes per training example. -* `num_sampled`: An `int`. The number of classes to randomly sample per batch. -* `unique`: A `bool`. Determines whether all sampled classes in a batch are - unique. -* `range_max`: An `int`. The number of possible classes. -* `seed`: An `int`. An operation-specific seed. Default is 0. -* `name`: A name for the operation (optional). - -##### Returns: - - -* `sampled_candidates`: A tensor of type `int64` and shape `[num_sampled]`. - The sampled classes. -* `true_expected_count`: A tensor of type `float`. Same shape as - `true_classes`. The expected counts under the sampling distribution - of each of `true_classes`. -* `sampled_expected_count`: A tensor of type `float`. Same shape as - `sampled_candidates`. The expected counts under the sampling distribution - of each of `sampled_candidates`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.pool.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.pool.md deleted file mode 100644 index 98a70fde53..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.pool.md +++ /dev/null @@ -1,80 +0,0 @@ -### `tf.nn.pool(input, window_shape, pooling_type, padding, dilation_rate=None, strides=None, name=None, data_format=None)` {#pool} - -Performs an N-D pooling operation. - -In the case that `data_format` does not start with "NC", computes for - 0 <= b < batch_size, - 0 <= x[i] < output_spatial_shape[i], - 0 <= c < num_channels: - - output[b, x[0], ..., x[N-1], c] = - REDUCE_{z[0], ..., z[N-1]} - input[b, - x[0] * strides[0] - pad_before[0] + dilation_rate[0]*z[0], - ... - x[N-1]*strides[N-1] - pad_before[N-1] + dilation_rate[N-1]*z[N-1], - c], - -where the reduction function REDUCE depends on the value of `pooling_type`, -and pad_before is defined based on the value of `padding` as described in the -[comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution). -The reduction never includes out-of-bounds positions. - -In the case that `data_format` starts with `"NC"`, the `input` and output are -simply transposed as follows: - - pool(input, data_format, **kwargs) = - tf.transpose(pool(tf.transpose(input, [0] + range(2,N+2) + [1]), - **kwargs), - [0, N+1] + range(1, N+1)) - -##### Args: - - -* `input`: Tensor of rank N+2, of shape - `[batch_size] + input_spatial_shape + [num_channels]` if data_format does - not start with "NC" (default), or - `[batch_size, num_channels] + input_spatial_shape` if data_format starts - with "NC". Pooling happens over the spatial dimensions only. -* `window_shape`: Sequence of N ints >= 1. -* `pooling_type`: Specifies pooling operation, must be "AVG" or "MAX". -* `padding`: The padding algorithm, must be "SAME" or "VALID". - See the [comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `dilation_rate`: Optional. Dilation rate. List of N ints >= 1. - Defaults to [1]*N. If any value of dilation_rate is > 1, then all values - of strides must be 1. -* `strides`: Optional. Sequence of N ints >= 1. Defaults to [1]*N. - If any value of strides is > 1, then all values of dilation_rate must be - 1. -* `name`: Optional. Name of the op. -* `data_format`: A string or None. Specifies whether the channel dimension of - the `input` and output is the last dimension (default, or if `data_format` - does not start with "NC"), or the second dimension (if `data_format` - starts with "NC"). For N=1, the valid values are "NWC" (default) and - "NCW". For N=2, the valid values are "NHWC" (default) and "NCHW". For - N=3, the valid value is "NDHWC". - -##### Returns: - - Tensor of rank N+2, of shape - [batch_size] + output_spatial_shape + [num_channels] - - if data_format is None or does not start with "NC", or - - [batch_size, num_channels] + output_spatial_shape - - if data_format starts with "NC", - where `output_spatial_shape` depends on the value of padding: - - If padding = "SAME": - output_spatial_shape[i] = ceil(input_spatial_shape[i] / strides[i]) - If padding = "VALID": - output_spatial_shape[i] = - ceil((input_spatial_shape[i] - (window_shape[i] - 1) * dilation_rate[i]) - / strides[i]). - -##### Raises: - - -* `ValueError`: if arguments are invalid. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.quantized_conv2d.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.quantized_conv2d.md deleted file mode 100644 index 0c9fd8f1db..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.quantized_conv2d.md +++ /dev/null @@ -1,39 +0,0 @@ -### `tf.nn.quantized_conv2d(input, filter, min_input, max_input, min_filter, max_filter, strides, padding, out_type=None, name=None)` {#quantized_conv2d} - -Computes a 2D convolution given quantized 4D input and filter tensors. - -The inputs are quantized tensors where the lowest value represents the real -number of the associated minimum, and the highest represents the maximum. -This means that you can only interpret the quantized output in the same way, by -taking the returned minimum and maximum values into account. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `qint8`, `quint8`, `qint16`, `quint16`, `qint32`. -* `filter`: A `Tensor`. Must be one of the following types: `qint8`, `quint8`, `qint16`, `quint16`, `qint32`. - filter's input_depth dimension must match input's depth dimensions. -* `min_input`: A `Tensor` of type `float32`. - The float value that the lowest quantized input value represents. -* `max_input`: A `Tensor` of type `float32`. - The float value that the highest quantized input value represents. -* `min_filter`: A `Tensor` of type `float32`. - The float value that the lowest quantized filter value represents. -* `max_filter`: A `Tensor` of type `float32`. - The float value that the highest quantized filter value represents. -* `strides`: A list of `ints`. - The stride of the sliding window for each dimension of the input - tensor. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `out_type`: An optional `tf.DType` from: `tf.qint8, tf.quint8, tf.qint16, tf.quint16, tf.qint32`. Defaults to `tf.qint32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, min_output, max_output). - -* `output`: A `Tensor` of type `out_type`. -* `min_output`: A `Tensor` of type `float32`. The float value that the lowest quantized output value represents. -* `max_output`: A `Tensor` of type `float32`. The float value that the highest quantized output value represents. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.relu6.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.relu6.md deleted file mode 100644 index 9695e557eb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.relu6.md +++ /dev/null @@ -1,15 +0,0 @@ -### `tf.nn.relu6(features, name=None)` {#relu6} - -Computes Rectified Linear 6: `min(max(features, 0), 6)`. - -##### Args: - - -* `features`: A `Tensor` with type `float`, `double`, `int32`, `int64`, `uint8`, - `int16`, or `int8`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` with the same type as `features`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.sufficient_statistics.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.sufficient_statistics.md deleted file mode 100644 index 84aa616331..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.sufficient_statistics.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.nn.sufficient_statistics(x, axes, shift=None, keep_dims=False, name=None)` {#sufficient_statistics} - -Calculate the sufficient statistics for the mean and variance of `x`. - -These sufficient statistics are computed using the one pass algorithm on -an input that's optionally shifted. See: -https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Computing_shifted_data - -##### Args: - - -* `x`: A `Tensor`. -* `axes`: Array of ints. Axes along which to compute mean and variance. -* `shift`: A `Tensor` containing the value by which to shift the data for - numerical stability, or `None` if no shift is to be performed. A shift - close to the true mean provides the most numerically stable results. -* `keep_dims`: produce statistics with the same dimensionality as the input. -* `name`: Name used to scope the operations that compute the sufficient stats. - -##### Returns: - - Four `Tensor` objects of the same type as `x`: - - * the count (number of elements to average over). - * the (possibly shifted) sum of the elements in the array. - * the (possibly shifted) sum of squares of the elements in the array. - * the shift by which the mean must be corrected or None if `shift` is None. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.weighted_cross_entropy_with_logits.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.weighted_cross_entropy_with_logits.md deleted file mode 100644 index 12593f8412..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.nn.weighted_cross_entropy_with_logits.md +++ /dev/null @@ -1,52 +0,0 @@ -### `tf.nn.weighted_cross_entropy_with_logits(targets, logits, pos_weight, name=None)` {#weighted_cross_entropy_with_logits} - -Computes a weighted cross entropy. - -This is like `sigmoid_cross_entropy_with_logits()` except that `pos_weight`, -allows one to trade off recall and precision by up- or down-weighting the -cost of a positive error relative to a negative error. - -The usual cross-entropy cost is defined as: - - targets * -log(sigmoid(logits)) + (1 - targets) * -log(1 - sigmoid(logits)) - -The argument `pos_weight` is used as a multiplier for the positive targets: - - targets * -log(sigmoid(logits)) * pos_weight + - (1 - targets) * -log(1 - sigmoid(logits)) - -For brevity, let `x = logits`, `z = targets`, `q = pos_weight`. -The loss is: - - qz * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) - = qz * -log(1 / (1 + exp(-x))) + (1 - z) * -log(exp(-x) / (1 + exp(-x))) - = qz * log(1 + exp(-x)) + (1 - z) * (-log(exp(-x)) + log(1 + exp(-x))) - = qz * log(1 + exp(-x)) + (1 - z) * (x + log(1 + exp(-x)) - = (1 - z) * x + (qz + 1 - z) * log(1 + exp(-x)) - = (1 - z) * x + (1 + (q - 1) * z) * log(1 + exp(-x)) - -Setting `l = (1 + (q - 1) * z)`, to ensure stability and avoid overflow, -the implementation uses - - (1 - z) * x + l * (log(1 + exp(-abs(x))) + max(-x, 0)) - -`logits` and `targets` must have the same type and shape. - -##### Args: - - -* `targets`: A `Tensor` of the same type and shape as `logits`. -* `logits`: A `Tensor` of type `float32` or `float64`. -* `pos_weight`: A coefficient to use on the positive examples. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of the same shape as `logits` with the componentwise - weighted logistic losses. - -##### Raises: - - -* `ValueError`: If `logits` and `targets` do not have the same shape. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.no_regularizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.no_regularizer.md deleted file mode 100644 index cb55675641..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.no_regularizer.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.no_regularizer(_)` {#no_regularizer} - -Use this function to prevent regularization of variables. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.ones_initializer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.ones_initializer.md deleted file mode 100644 index 871e73ba25..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.ones_initializer.md +++ /dev/null @@ -1,15 +0,0 @@ -Initializer that generates tensors initialized to 1. -- - - - -#### `tf.ones_initializer.__call__(shape, dtype=None, partition_info=None)` {#ones_initializer.__call__} - - - - -- - - - -#### `tf.ones_initializer.__init__(dtype=tf.float32)` {#ones_initializer.__init__} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.python_io.TFRecordOptions.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.python_io.TFRecordOptions.md deleted file mode 100644 index 3c05efe834..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.python_io.TFRecordOptions.md +++ /dev/null @@ -1,15 +0,0 @@ -Options used for manipulating TFRecord files. -- - - - -#### `tf.python_io.TFRecordOptions.__init__(compression_type)` {#TFRecordOptions.__init__} - - - - -- - - - -#### `tf.python_io.TFRecordOptions.get_compression_type_string(cls, options)` {#TFRecordOptions.get_compression_type_string} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.quantized_concat.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.quantized_concat.md deleted file mode 100644 index 0bb94d727d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.quantized_concat.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.quantized_concat(concat_dim, values, input_mins, input_maxes, name=None)` {#quantized_concat} - -Concatenates quantized tensors along one dimension. - -##### Args: - - -* `concat_dim`: A `Tensor` of type `int32`. - 0-D. The dimension along which to concatenate. Must be in the - range [0, rank(values)). -* `values`: A list of at least 2 `Tensor` objects of the same type. - The `N` Tensors to concatenate. Their ranks and types must match, - and their sizes must match in all dimensions except `concat_dim`. -* `input_mins`: A list with the same number of `Tensor` objects as `values` of `Tensor` objects of type `float32`. - The minimum scalar values for each of the input tensors. -* `input_maxes`: A list with the same number of `Tensor` objects as `values` of `Tensor` objects of type `float32`. - The maximum scalar values for each of the input tensors. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, output_min, output_max). - -* `output`: A `Tensor`. Has the same type as `values`. A `Tensor` with the concatenation of values stacked along the - `concat_dim` dimension. This tensor's shape matches that of `values` except - in `concat_dim` where it has the sum of the sizes. -* `output_min`: A `Tensor` of type `float32`. The float value that the minimum quantized output value represents. -* `output_max`: A `Tensor` of type `float32`. The float value that the maximum quantized output value represents. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.reduce_prod.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.reduce_prod.md deleted file mode 100644 index 89810f8459..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.reduce_prod.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.reduce_prod(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_prod} - -Computes the product of elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -##### Args: - - -* `input_tensor`: The tensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - -@compatibility(numpy) -Equivalent to np.prod -@end_compatibility - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.reset_default_graph.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.reset_default_graph.md deleted file mode 100644 index ae5a906a0d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.reset_default_graph.md +++ /dev/null @@ -1,10 +0,0 @@ -### `tf.reset_default_graph()` {#reset_default_graph} - -Clears the default graph stack and resets the global default graph. - -NOTE: The default graph is a property of the current thread. This -function applies only to the current thread. Calling this function while -a `tf.Session` or `tf.InteractiveSession` is active will result in undefined -behavior. Using any previously created `tf.Operation` or `tf.Tensor` objects -after calling this function will result in undefined behavior. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.reverse.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.reverse.md deleted file mode 100644 index d040ecf92a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.reverse.md +++ /dev/null @@ -1,64 +0,0 @@ -### `tf.reverse(tensor, axis, name=None)` {#reverse} - -Reverses specific dimensions of a tensor. - -NOTE `tf.reverse` has now changed behavior in preparation for 1.0. -`tf.reverse_v2` is currently an alias that will be deprecated before TF 1.0. - -Given a `tensor`, and a `int32` tensor `axis` representing the set of -dimensions of `tensor` to reverse. This operation reverses each dimension -`i` for which there exists `j` s.t. `axis[j] == i`. - -`tensor` can have up to 8 dimensions. The number of dimensions specified -in `axis` may be 0 or more entries. If an index is specified more than -once, a InvalidArgument error is raised. - -For example: - -```prettyprint -# tensor 't' is [[[[ 0, 1, 2, 3], -# [ 4, 5, 6, 7], -# [ 8, 9, 10, 11]], -# [[12, 13, 14, 15], -# [16, 17, 18, 19], -# [20, 21, 22, 23]]]] -# tensor 't' shape is [1, 2, 3, 4] - -# 'dims' is [3] or 'dims' is -1 -reverse(t, dims) ==> [[[[ 3, 2, 1, 0], - [ 7, 6, 5, 4], - [ 11, 10, 9, 8]], - [[15, 14, 13, 12], - [19, 18, 17, 16], - [23, 22, 21, 20]]]] - -# 'dims' is '[1]' (or 'dims' is '[-3]') -reverse(t, dims) ==> [[[[12, 13, 14, 15], - [16, 17, 18, 19], - [20, 21, 22, 23] - [[ 0, 1, 2, 3], - [ 4, 5, 6, 7], - [ 8, 9, 10, 11]]]] - -# 'dims' is '[2]' (or 'dims' is '[-2]') -reverse(t, dims) ==> [[[[8, 9, 10, 11], - [4, 5, 6, 7], - [0, 1, 2, 3]] - [[20, 21, 22, 23], - [16, 17, 18, 19], - [12, 13, 14, 15]]]] -``` - -##### Args: - - -* `tensor`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int32`, `int64`, `bool`, `half`, `float32`, `float64`, `complex64`, `complex128`. - Up to 8-D. -* `axis`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 1-D. The indices of the dimensions to reverse. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `tensor`. The same shape as `tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.round.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.round.md deleted file mode 100644 index 1693dbe61f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.round.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.round(x, name=None)` {#round} - -Rounds the values of a tensor to the nearest integer, element-wise. - -Rounds half to even. Also known as bankers rounding. If you want to round -according to the current system rounding mode use tf::cint. -For example: - -```python -# 'a' is [0.9, 2.5, 2.3, 1.5, -4.5] -tf.round(a) ==> [ 1.0, 2.0, 2.0, 2.0, -4.0 ] -``` - -##### Args: - - -* `x`: A `Tensor` of type `float32` or `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of same shape and type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.rsqrt.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.rsqrt.md deleted file mode 100644 index 5f76fcd593..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.rsqrt.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.rsqrt(x, name=None)` {#rsqrt} - -Computes reciprocal of square root of x element-wise. - -I.e., \\(y = 1 / \sqrt{x}\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.scatter_add.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.scatter_add.md deleted file mode 100644 index a8f8b7a9b0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.scatter_add.md +++ /dev/null @@ -1,46 +0,0 @@ -### `tf.scatter_add(ref, indices, updates, use_locking=None, name=None)` {#scatter_add} - -Adds sparse updates to a variable reference. - -This operation computes - - # Scalar indices - ref[indices, ...] += updates[...] - - # Vector indices (for each i) - ref[indices[i], ...] += updates[i, ...] - - # High rank indices (for each i, ..., j) - ref[indices[i, ..., j], ...] += updates[i, ..., j, ...] - -This operation outputs `ref` after the update is done. -This makes it easier to chain operations that need to use the reset value. - -Duplicate entries are handled correctly: if multiple `indices` reference -the same location, their contributions add. - -Requires `updates.shape = indices.shape + ref.shape[1:]`. - -
- -
- -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Should be from a `Variable` node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A tensor of indices into the first dimension of `ref`. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A tensor of updated values to add to `ref`. -* `use_locking`: An optional `bool`. Defaults to `False`. - If True, the addition will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as `ref`. Returned as a convenience for operations that want - to use the updated values after the update is done. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.scatter_div.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.scatter_div.md deleted file mode 100644 index ecd8e8b890..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.scatter_div.md +++ /dev/null @@ -1,42 +0,0 @@ -### `tf.scatter_div(ref, indices, updates, use_locking=None, name=None)` {#scatter_div} - -Divides a variable reference by sparse updates. - -This operation computes - - # Scalar indices - ref[indices, ...] /= updates[...] - - # Vector indices (for each i) - ref[indices[i], ...] /= updates[i, ...] - - # High rank indices (for each i, ..., j) - ref[indices[i, ..., j], ...] /= updates[i, ..., j, ...] - -This operation outputs `ref` after the update is done. -This makes it easier to chain operations that need to use the reset value. - -Duplicate entries are handled correctly: if multiple `indices` reference -the same location, their contributions divide. - -Requires `updates.shape = indices.shape + ref.shape[1:]`. - -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Should be from a `Variable` node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A tensor of indices into the first dimension of `ref`. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A tensor of values that `ref` is divided by. -* `use_locking`: An optional `bool`. Defaults to `False`. - If True, the operation will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as `ref`. Returned as a convenience for operations that want - to use the updated values after the update is done. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sequence_mask.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sequence_mask.md deleted file mode 100644 index 7c0144f2f4..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sequence_mask.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.sequence_mask(lengths, maxlen=None, dtype=tf.bool, name=None)` {#sequence_mask} - -Return a mask tensor representing the first N positions of each row. - -Example: - -```python -tf.sequence_mask([1, 3, 2], 5) = - [[True, False, False, False, False], - [True, True, True, False, False], - [True, True, False, False, False]] -``` - -##### Args: - - -* `lengths`: 1D integer tensor, all its values < maxlen. -* `maxlen`: scalar integer tensor, maximum length of each row. Default: use - maximum over lengths. -* `dtype`: output type of the resulting tensor. -* `name`: name of the op. - -##### Returns: - - A 2D mask tensor, as shown in the example above, cast to specified dtype. - -##### Raises: - - -* `ValueError`: if the arguments have invalid rank. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.set_random_seed.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.set_random_seed.md deleted file mode 100644 index d8d3abc5eb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.set_random_seed.md +++ /dev/null @@ -1,98 +0,0 @@ -### `tf.set_random_seed(seed)` {#set_random_seed} - -Sets the graph-level random seed. - -Operations that rely on a random seed actually derive it from two seeds: -the graph-level and operation-level seeds. This sets the graph-level seed. - -Its interactions with operation-level seeds is as follows: - - 1. If neither the graph-level nor the operation seed is set: - A random seed is used for this op. - 2. If the graph-level seed is set, but the operation seed is not: - The system deterministically picks an operation seed in conjunction - with the graph-level seed so that it gets a unique random sequence. - 3. If the graph-level seed is not set, but the operation seed is set: - A default graph-level seed and the specified operation seed are used to - determine the random sequence. - 4. If both the graph-level and the operation seed are set: - Both seeds are used in conjunction to determine the random sequence. - -To illustrate the user-visible effects, consider these examples: - -To generate different sequences across sessions, set neither -graph-level nor op-level seeds: - -```python -a = tf.random_uniform([1]) -b = tf.random_normal([1]) - -print("Session 1") -with tf.Session() as sess1: - print(sess1.run(a)) # generates 'A1' - print(sess1.run(a)) # generates 'A2' - print(sess1.run(b)) # generates 'B1' - print(sess1.run(b)) # generates 'B2' - -print("Session 2") -with tf.Session() as sess2: - print(sess2.run(a)) # generates 'A3' - print(sess2.run(a)) # generates 'A4' - print(sess2.run(b)) # generates 'B3' - print(sess2.run(b)) # generates 'B4' -``` - -To generate the same repeatable sequence for an op across sessions, set the -seed for the op: - -```python -a = tf.random_uniform([1], seed=1) -b = tf.random_normal([1]) - -# Repeatedly running this block with the same graph will generate the same -# sequence of values for 'a', but different sequences of values for 'b'. -print("Session 1") -with tf.Session() as sess1: - print(sess1.run(a)) # generates 'A1' - print(sess1.run(a)) # generates 'A2' - print(sess1.run(b)) # generates 'B1' - print(sess1.run(b)) # generates 'B2' - -print("Session 2") -with tf.Session() as sess2: - print(sess2.run(a)) # generates 'A1' - print(sess2.run(a)) # generates 'A2' - print(sess2.run(b)) # generates 'B3' - print(sess2.run(b)) # generates 'B4' -``` - -To make the random sequences generated by all ops be repeatable across -sessions, set a graph-level seed: - -```python -tf.set_random_seed(1234) -a = tf.random_uniform([1]) -b = tf.random_normal([1]) - -# Repeatedly running this block with the same graph will generate the same -# sequences of 'a' and 'b'. -print("Session 1") -with tf.Session() as sess1: - print(sess1.run(a)) # generates 'A1' - print(sess1.run(a)) # generates 'A2' - print(sess1.run(b)) # generates 'B1' - print(sess1.run(b)) # generates 'B2' - -print("Session 2") -with tf.Session() as sess2: - print(sess2.run(a)) # generates 'A1' - print(sess2.run(a)) # generates 'A2' - print(sess2.run(b)) # generates 'B1' - print(sess2.run(b)) # generates 'B2' -``` - -##### Args: - - -* `seed`: integer. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_fill_empty_rows.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_fill_empty_rows.md deleted file mode 100644 index 3ea1697f3d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_fill_empty_rows.md +++ /dev/null @@ -1,54 +0,0 @@ -### `tf.sparse_fill_empty_rows(sp_input, default_value, name=None)` {#sparse_fill_empty_rows} - -Fills empty rows in the input 2-D `SparseTensor` with a default value. - -This op adds entries with the specified `default_value` at index -`[row, 0]` for any row in the input that does not already have a value. - -For example, suppose `sp_input` has shape `[5, 6]` and non-empty values: - - [0, 1]: a - [0, 3]: b - [2, 0]: c - [3, 1]: d - -Rows 1 and 4 are empty, so the output will be of shape `[5, 6]` with values: - - [0, 1]: a - [0, 3]: b - [1, 0]: default_value - [2, 0]: c - [3, 1]: d - [4, 0]: default_value - -Note that the input may have empty columns at the end, with no effect on -this op. - -The output `SparseTensor` will be in row-major order and will have the -same shape as the input. - -This op also returns an indicator vector such that - - empty_row_indicator[i] = True iff row i was an empty row. - -##### Args: - - -* `sp_input`: A `SparseTensor` with shape `[N, M]`. -* `default_value`: The value to fill for empty rows, with the same type as - `sp_input.` -* `name`: A name prefix for the returned tensors (optional) - -##### Returns: - - -* `sp_ordered_output`: A `SparseTensor` with shape `[N, M]`, and with all empty - rows filled in with `default_value`. -* `empty_row_indicator`: A bool vector of length `N` indicating whether each - input row was empty. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_reorder.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_reorder.md deleted file mode 100644 index 1e7b8fd857..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_reorder.md +++ /dev/null @@ -1,41 +0,0 @@ -### `tf.sparse_reorder(sp_input, name=None)` {#sparse_reorder} - -Reorders a `SparseTensor` into the canonical, row-major ordering. - -Note that by convention, all sparse ops preserve the canonical ordering -along increasing dimension number. The only time ordering can be violated -is during manual manipulation of the indices and values to add entries. - -Reordering does not affect the shape of the `SparseTensor`. - -For example, if `sp_input` has shape `[4, 5]` and `indices` / `values`: - - [0, 3]: b - [0, 1]: a - [3, 1]: d - [2, 0]: c - -then the output will be a `SparseTensor` of shape `[4, 5]` and -`indices` / `values`: - - [0, 1]: a - [0, 3]: b - [2, 0]: c - [3, 1]: d - -##### Args: - - -* `sp_input`: The input `SparseTensor`. -* `name`: A name prefix for the returned tensors (optional) - -##### Returns: - - A `SparseTensor` with the same shape and non-empty values, but in - canonical ordering. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_retain.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_retain.md deleted file mode 100644 index dcaa303627..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_retain.md +++ /dev/null @@ -1,33 +0,0 @@ -### `tf.sparse_retain(sp_input, to_retain)` {#sparse_retain} - -Retains specified non-empty values within a `SparseTensor`. - -For example, if `sp_input` has shape `[4, 5]` and 4 non-empty string values: - - [0, 1]: a - [0, 3]: b - [2, 0]: c - [3, 1]: d - -and `to_retain = [True, False, False, True]`, then the output will -be a `SparseTensor` of shape `[4, 5]` with 2 non-empty values: - - [0, 1]: a - [3, 1]: d - -##### Args: - - -* `sp_input`: The input `SparseTensor` with `N` non-empty elements. -* `to_retain`: A bool vector of length `N` with `M` true values. - -##### Returns: - - A `SparseTensor` with the same shape as the input and `M` non-empty - elements corresponding to the true positions in `to_retain`. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_segment_sqrt_n.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_segment_sqrt_n.md deleted file mode 100644 index 83ae3d67ec..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_segment_sqrt_n.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.sparse_segment_sqrt_n(data, indices, segment_ids, name=None)` {#sparse_segment_sqrt_n} - -Computes the sum along sparse segments of a tensor divided by the sqrt of N. - -N is the size of the segment being reduced. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor. Has same rank as `segment_ids`. -* `segment_ids`: A `Tensor` of type `int32`. - A 1-D tensor. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_to_dense.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_to_dense.md deleted file mode 100644 index d4df5a9183..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.sparse_to_dense.md +++ /dev/null @@ -1,45 +0,0 @@ -### `tf.sparse_to_dense(sparse_indices, output_shape, sparse_values, default_value=0, validate_indices=True, name=None)` {#sparse_to_dense} - -Converts a sparse representation into a dense tensor. - -Builds an array `dense` with shape `output_shape` such that - -```python -# If sparse_indices is scalar -dense[i] = (i == sparse_indices ? sparse_values : default_value) - -# If sparse_indices is a vector, then for each i -dense[sparse_indices[i]] = sparse_values[i] - -# If sparse_indices is an n by d matrix, then for each i in [0, n) -dense[sparse_indices[i][0], ..., sparse_indices[i][d-1]] = sparse_values[i] -``` - -All other values in `dense` are set to `default_value`. If `sparse_values` -is a scalar, all sparse indices are set to this single value. - -Indices should be sorted in lexicographic order, and indices must not -contain any repeats. If `validate_indices` is True, these properties -are checked during execution. - -##### Args: - - -* `sparse_indices`: A 0-D, 1-D, or 2-D `Tensor` of type `int32` or `int64`. - `sparse_indices[i]` contains the complete index where `sparse_values[i]` - will be placed. -* `output_shape`: A 1-D `Tensor` of the same type as `sparse_indices`. Shape - of the dense output tensor. -* `sparse_values`: A 0-D or 1-D `Tensor`. Values corresponding to each row of - `sparse_indices`, or a scalar value to be used for all sparse indices. -* `default_value`: A 0-D `Tensor` of the same type as `sparse_values`. Value - to set for indices not specified in `sparse_indices`. Defaults to zero. -* `validate_indices`: A boolean value. If True, indices are checked to make - sure they are sorted in lexicographic order and that there are no repeats. -* `name`: A name for the operation (optional). - -##### Returns: - - Dense `Tensor` of shape `output_shape`. Has the same type as - `sparse_values`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.strided_slice.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.strided_slice.md deleted file mode 100644 index 25abd415c3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.strided_slice.md +++ /dev/null @@ -1,86 +0,0 @@ -### `tf.strided_slice(input_, begin, end, strides=None, begin_mask=0, end_mask=0, ellipsis_mask=0, new_axis_mask=0, shrink_axis_mask=0, var=None, name=None)` {#strided_slice} - -Extracts a strided slice from a tensor. - -To a first order, this operation extracts a slice of size `end - begin` -from a tensor `input` -starting at the location specified by `begin`. The slice continues by adding -`stride` to the `begin` index until all dimensions are not less than `end`. -Note that components of stride can be negative, which causes a reverse -slice. - -This operation can be thought of an encoding of a numpy style sliced -range. Given a python slice input[, , ..., ] -this function will be called as follows. - -`begin`, `end`, and `strides` will be all length n. n is in general -not the same dimensionality as `input`. - -For the ith spec, -`begin_mask`, `end_mask`, `ellipsis_mask`, `new_axis_mask`, -and `shrink_axis_mask` will have the ith bit corresponding to -the ith spec. - -If the ith bit of `begin_mask` is non-zero, `begin[i]` is ignored and -the fullest possible range in that dimension is used instead. -`end_mask` works analogously, except with the end range. - -`foo[5:,:,:3]` on a 7x8x9 tensor is equivalent to `foo[5:7,0:8,0:3]`. -`foo[::-1]` reverses a tensor with shape 8. - - -If the ith bit of `ellipsis_mask`, as many unspecified dimensions -as needed will be inserted between other dimensions. Only one -non-zero bit is allowed in `ellipsis_mask`. - -For example `foo[3:5,...,4:5]` on a shape 10x3x3x10 tensor is -equivalent to `foo[3:5,:,:,4:5]` and -`foo[3:5,...]` is equivalent to `foo[3:5,:,:,:]`. - -If the ith bit of `new_axis_mask` is one, then a `begin`, -`end`, and `stride` are ignored and a new length 1 dimension is -added at this point in the output tensor. - -For example `foo[3:5,4]` on a 10x8 tensor produces a shape 2 tensor -whereas `foo[3:5,4:5]` produces a shape 2x1 tensor with shrink_mask -being 1<<1 == 2. - -If the ith bit of `shrink_axis_mask` is one, then `begin`, -`end[i]`, and `stride[i]` are used to do a slice in the appropriate -dimension, but the output tensor will be reduced in dimensionality -by one. This is only valid if the ith entry of slice[i]==1. - -NOTE: `begin` and `end` are zero-indexed`. -`strides` entries must be non-zero. - - -```python -# 'input' is [[[1, 1, 1], [2, 2, 2]], -# [[3, 3, 3], [4, 4, 4]], -# [[5, 5, 5], [6, 6, 6]]] -tf.strided_slice(input, [1, 0, 0], [2, 1, 3], [1, 1, 1]) ==> [[[3, 3, 3]]] -tf.strided_slice(input, [1, 0, 0], [2, 2, 3], [1, 1, 1]) ==> [[[3, 3, 3], - [4, 4, 4]]] -tf.strided_slice(input, [1, 1, 0], [2, -1, 3], [1, -1, 1]) ==>[[[4, 4, 4], - [3, 3, 3]]] -``` - -##### Args: - - -* `input_`: A `Tensor`. -* `begin`: An `int32` or `int64` `Tensor`. -* `end`: An `int32` or `int64` `Tensor`. -* `strides`: An `int32` or `int64` `Tensor`. -* `begin_mask`: An `int32` mask. -* `end_mask`: An `int32` mask. -* `ellipsis_mask`: An `int32` mask. -* `new_axis_mask`: An `int32` mask. -* `shrink_axis_mask`: An `int32` mask. -* `var`: The variable corresponding to `input_` or None -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` the same type as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.subtract.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.subtract.md deleted file mode 100644 index 93a00899c9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.subtract.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.subtract(x, y, name=None)` {#subtract} - -Returns x - y element-wise. - -*NOTE*: `tf.subtract` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.summary.histogram.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.summary.histogram.md deleted file mode 100644 index 19df48fd3f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.summary.histogram.md +++ /dev/null @@ -1,25 +0,0 @@ -### `tf.summary.histogram(name, values, collections=None)` {#histogram} - -Outputs a `Summary` protocol buffer with a histogram. - -The generated -[`Summary`](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto) -has one summary value containing a histogram for `values`. - -This op reports an `InvalidArgument` error if any value is not finite. - -##### Args: - - -* `name`: A name for the generated node. Will also serve as a series name in - TensorBoard. -* `values`: A real numeric `Tensor`. Any shape. Values to use to - build the histogram. -* `collections`: Optional list of graph collections keys. The new summary op is - added to these collections. Defaults to `[GraphKeys.SUMMARIES]`. - -##### Returns: - - A scalar `Tensor` of type `string`. The serialized `Summary` protocol - buffer. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.summary.merge.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.summary.merge.md deleted file mode 100644 index 5a7bd8a0f5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.summary.merge.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.summary.merge(inputs, collections=None, name=None)` {#merge} - -Merges summaries. - -This op creates a -[`Summary`](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto) -protocol buffer that contains the union of all the values in the input -summaries. - -When the Op is run, it reports an `InvalidArgument` error if multiple values -in the summaries to merge use the same tag. - -##### Args: - - -* `inputs`: A list of `string` `Tensor` objects containing serialized `Summary` - protocol buffers. -* `collections`: Optional list of graph collections keys. The new summary op is - added to these collections. Defaults to `[]`. -* `name`: A name for the operation (optional). - -##### Returns: - - A scalar `Tensor` of type `string`. The serialized `Summary` protocol - buffer resulting from the merging. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.tensordot.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.tensordot.md deleted file mode 100644 index 76c811e213..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.tensordot.md +++ /dev/null @@ -1,54 +0,0 @@ -### `tf.tensordot(a, b, axes, name=None)` {#tensordot} - -Tensor contraction of a and b along specified axes. - -Tensordot (also known as tensor contraction) sums the product of elements -from `a` and `b` over the indices specified by `a_axes` and `b_axes`. -The lists `a_axes` and `b_axes` specify those pairs of axes along which to -contract the tensors. The axis `a_axes[i]` of `a` must have the same dimension -as axis `b_axes[i]` of `b` for all `i` in `range(0, len(a_axes))`. The lists -`a_axes` and `b_axes` must have identical length and consist of unique -integers that specify valid axes for each of the tensors. - -This operation corresponds to `numpy.tensordot(a, b, axes)`. - -Example 1: When `a` and `b` are matrices (order 2), the case `axes = 1` -is equivalent to matrix multiplication. - -Example 2: When `a` and `b` are matrices (order 2), the case -`axes = [[1], [0]]` is equivalent to matrix multiplication. - -Example 3: Suppose that \\(a_ijk\\) and \\(b_lmn\\) represent two -tensors of order 3. Then, `contract(a, b, [0], [2])` is the order 4 tensor -\\(c_{jklm}\\) whose entry -corresponding to the indices \\((j,k,l,m)\\) is given by: - -\\( c_{jklm} = \sum_i a_{ijk} b_{lmi} \\). - -In general, `order(c) = order(a) + order(b) - 2*len(axes[0])`. - -##### Args: - - -* `a`: `Tensor` of type `float32` or `float64`. -* `b`: `Tensor` with the same type as `a`. -* `axes`: Either a scalar `N`, or a list or an `int32` `Tensor` of shape [2, k]. - If axes is a scalar, sum over the last N axes of a and the first N axes - of b in order. - If axes is a list or `Tensor` the first and second row contain the set of - unique integers specifying axes along which the contraction is computed, - for `a` and `b`, respectively. The number of axes for `a` and `b` must - be equal. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` with the same type as `a`. - -##### Raises: - - -* `ValueError`: If the shapes of `a`, `b`, and `axes` are incompatible. -* `IndexError`: If the values in axes exceed the rank of the corresponding - tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.AdagradDAOptimizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.AdagradDAOptimizer.md deleted file mode 100644 index f25ccc018a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.AdagradDAOptimizer.md +++ /dev/null @@ -1,194 +0,0 @@ -Adagrad Dual Averaging algorithm for sparse linear models. - -See this [paper](http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf). - -This optimizer takes care of regularization of unseen features in a mini batch -by updating them when they are seen with a closed form update rule that is -equivalent to having updated them on every mini-batch. - -AdagradDA is typically used when there is a need for large sparsity in the -trained model. This optimizer only guarantees sparsity for linear models. Be -careful when using AdagradDA for deep networks as it will require careful -initialization of the gradient accumulators for it to train. -- - - - -#### `tf.train.AdagradDAOptimizer.__init__(learning_rate, global_step, initial_gradient_squared_accumulator_value=0.1, l1_regularization_strength=0.0, l2_regularization_strength=0.0, use_locking=False, name='AdagradDA')` {#AdagradDAOptimizer.__init__} - -Construct a new AdagradDA optimizer. - -##### Args: - - -* `learning_rate`: A `Tensor` or a floating point value. The learning rate. -* `global_step`: A `Tensor` containing the current training step number. -* `initial_gradient_squared_accumulator_value`: A floating point value. - Starting value for the accumulators, must be positive. -* `l1_regularization_strength`: A float value, must be greater than or - equal to zero. -* `l2_regularization_strength`: A float value, must be greater than or - equal to zero. -* `use_locking`: If `True` use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "AdagradDA". - -##### Raises: - - -* `ValueError`: If the `initial_gradient_squared_accumulator_value` is - invalid. - - -- - - - -#### `tf.train.AdagradDAOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#AdagradDAOptimizer.apply_gradients} - -Apply gradients to variables. - -This is the second part of `minimize()`. It returns an `Operation` that -applies gradients. - -##### Args: - - -* `grads_and_vars`: List of (gradient, variable) pairs as returned by - `compute_gradients()`. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `name`: Optional name for the returned operation. Default to the - name passed to the `Optimizer` constructor. - -##### Returns: - - An `Operation` that applies the specified gradients. If `global_step` - was not None, that operation also increments `global_step`. - -##### Raises: - - -* `TypeError`: If `grads_and_vars` is malformed. -* `ValueError`: If none of the variables have gradients. - - -- - - - -#### `tf.train.AdagradDAOptimizer.compute_gradients(loss, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, grad_loss=None)` {#AdagradDAOptimizer.compute_gradients} - -Compute gradients of `loss` for the variables in `var_list`. - -This is the first part of `minimize()`. It returns a list -of (gradient, variable) pairs where "gradient" is the gradient -for "variable". Note that "gradient" can be a `Tensor`, an -`IndexedSlices`, or `None` if there is no gradient for the -given variable. - -##### Args: - - -* `loss`: A Tensor containing the value to minimize. -* `var_list`: Optional list of `tf.Variable` to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKey.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - A list of (gradient, variable) pairs. Variable is always present, but - gradient can be `None`. - -##### Raises: - - -* `TypeError`: If `var_list` contains anything else than `Variable` objects. -* `ValueError`: If some arguments are invalid. - - -- - - - -#### `tf.train.AdagradDAOptimizer.get_name()` {#AdagradDAOptimizer.get_name} - - - - -- - - - -#### `tf.train.AdagradDAOptimizer.get_slot(var, name)` {#AdagradDAOptimizer.get_slot} - -Return a slot named `name` created for `var` by the Optimizer. - -Some `Optimizer` subclasses use additional variables. For example -`Momentum` and `Adagrad` use variables to accumulate updates. This method -gives access to these `Variable` objects if for some reason you need them. - -Use `get_slot_names()` to get the list of slot names created by the -`Optimizer`. - -##### Args: - - -* `var`: A variable passed to `minimize()` or `apply_gradients()`. -* `name`: A string. - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - -- - - - -#### `tf.train.AdagradDAOptimizer.get_slot_names()` {#AdagradDAOptimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -See `get_slot()`. - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.train.AdagradDAOptimizer.minimize(loss, global_step=None, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, name=None, grad_loss=None)` {#AdagradDAOptimizer.minimize} - -Add operations to minimize `loss` by updating `var_list`. - -This method simply combines calls `compute_gradients()` and -`apply_gradients()`. If you want to process the gradient before applying -them call `compute_gradients()` and `apply_gradients()` explicitly instead -of using this function. - -##### Args: - - -* `loss`: A `Tensor` containing the value to minimize. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `name`: Optional name for the returned operation. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - An Operation that updates the variables in `var_list`. If `global_step` - was not `None`, that operation also increments `global_step`. - -##### Raises: - - -* `ValueError`: If some of the variables are not `Variable` objects. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.Scaffold.get_or_default.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.Scaffold.get_or_default.md deleted file mode 100644 index ecb8dc31eb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.Scaffold.get_or_default.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.train.Scaffold.get_or_default(arg_name, collection_key, default_constructor)` {#Scaffold.get_or_default} - -Get from cache or create a default operation. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.SessionRunArgs.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.SessionRunArgs.md deleted file mode 100644 index 85695d22be..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.SessionRunArgs.md +++ /dev/null @@ -1,64 +0,0 @@ -Represents arguments to be added to a `Session.run()` call. - -Args: - fetches: Exactly like the 'fetches' argument to Session.Run(). - Can be a single tensor or op, a list of 'fetches' or a dictionary - of fetches. For example: - fetches = global_step_tensor - fetches = [train_op, summary_op, global_step_tensor] - fetches = {'step': global_step_tensor, 'summ': summary_op} - Note that this can recurse as expected: - fetches = {'step': global_step_tensor, - 'ops': [train_op, check_nan_op]} - feed_dict: Exactly like the `feed_dict` argument to `Session.Run()` - options: Exactly like the `options` argument to `Session.run()`, i.e., a - config_pb2.RunOptions proto. -- - - - -#### `tf.train.SessionRunArgs.__getnewargs__()` {#SessionRunArgs.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.train.SessionRunArgs.__getstate__()` {#SessionRunArgs.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.train.SessionRunArgs.__new__(cls, fetches, feed_dict=None, options=None)` {#SessionRunArgs.__new__} - - - - -- - - - -#### `tf.train.SessionRunArgs.__repr__()` {#SessionRunArgs.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.train.SessionRunArgs.feed_dict` {#SessionRunArgs.feed_dict} - -Alias for field number 1 - - -- - - - -#### `tf.train.SessionRunArgs.fetches` {#SessionRunArgs.fetches} - -Alias for field number 0 - - -- - - - -#### `tf.train.SessionRunArgs.options` {#SessionRunArgs.options} - -Alias for field number 2 - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.SummarySaverHook.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.SummarySaverHook.md deleted file mode 100644 index 2d09da7b0c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.SummarySaverHook.md +++ /dev/null @@ -1,79 +0,0 @@ -Saves summaries every N steps. -- - - - -#### `tf.train.SummarySaverHook.__init__(save_steps=None, save_secs=None, output_dir=None, summary_writer=None, scaffold=None, summary_op=None)` {#SummarySaverHook.__init__} - -Initializes a `SummarySaver` monitor. - -##### Args: - - -* `save_steps`: `int`, save summaries every N steps. Exactly one of - `save_secs` and `save_steps` should be set. -* `save_secs`: `int`, save summaries every N seconds. -* `output_dir`: `string`, the directory to save the summaries to. Only used - if no `summary_writer` is supplied. -* `summary_writer`: `SummaryWriter`. If `None` and an `output_dir` was passed, - one will be created accordingly. -* `scaffold`: `Scaffold` to get summary_op if it's not provided. -* `summary_op`: `Tensor` of type `string` containing the serialized `Summary` - protocol buffer or a list of `Tensor`. They are most likely an output - by TF summary methods like `tf.summary.scalar` or - `tf.summary.merge_all`. It can be passed in as one tensor; if more - than one, they must be passed in as a list. - -##### Raises: - - -* `ValueError`: Exactly one of scaffold or summary_op should be set. - - -- - - - -#### `tf.train.SummarySaverHook.after_create_session(session, coord)` {#SummarySaverHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.SummarySaverHook.after_run(run_context, run_values)` {#SummarySaverHook.after_run} - - - - -- - - - -#### `tf.train.SummarySaverHook.before_run(run_context)` {#SummarySaverHook.before_run} - - - - -- - - - -#### `tf.train.SummarySaverHook.begin()` {#SummarySaverHook.begin} - - - - -- - - - -#### `tf.train.SummarySaverHook.end(session=None)` {#SummarySaverHook.end} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.batch.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.batch.md deleted file mode 100644 index 965f4f2eef..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.batch.md +++ /dev/null @@ -1,81 +0,0 @@ -### `tf.train.batch(tensors, batch_size, num_threads=1, capacity=32, enqueue_many=False, shapes=None, dynamic_pad=False, allow_smaller_final_batch=False, shared_name=None, name=None)` {#batch} - -Creates batches of tensors in `tensors`. - -The argument `tensors` can be a list or a dictionary of tensors. -The value returned by the function will be of the same type -as `tensors`. - -This function is implemented using a queue. A `QueueRunner` for the -queue is added to the current `Graph`'s `QUEUE_RUNNER` collection. - -If `enqueue_many` is `False`, `tensors` is assumed to represent a single -example. An input tensor with shape `[x, y, z]` will be output as a tensor -with shape `[batch_size, x, y, z]`. - -If `enqueue_many` is `True`, `tensors` is assumed to represent a batch of -examples, where the first dimension is indexed by example, and all members of -`tensors` should have the same size in the first dimension. If an input -tensor has shape `[*, x, y, z]`, the output will have shape `[batch_size, x, -y, z]`. The `capacity` argument controls the how long the prefetching is -allowed to grow the queues. - -The returned operation is a dequeue operation and will throw -`tf.errors.OutOfRangeError` if the input queue is exhausted. If this -operation is feeding another input queue, its queue runner will catch -this exception, however, if this operation is used in your main thread -you are responsible for catching this yourself. - -*N.B.:* If `dynamic_pad` is `False`, you must ensure that either -(i) the `shapes` argument is passed, or (ii) all of the tensors in -`tensors` must have fully-defined shapes. `ValueError` will be -raised if neither of these conditions holds. - -If `dynamic_pad` is `True`, it is sufficient that the *rank* of the -tensors is known, but individual dimensions may have shape `None`. -In this case, for each enqueue the dimensions with value `None` -may have a variable length; upon dequeue, the output tensors will be padded -on the right to the maximum shape of the tensors in the current minibatch. -For numbers, this padding takes value 0. For strings, this padding is -the empty string. See `PaddingFIFOQueue` for more info. - -If `allow_smaller_final_batch` is `True`, a smaller batch value than -`batch_size` is returned when the queue is closed and there are not enough -elements to fill the batch, otherwise the pending elements are discarded. -In addition, all output tensors' static shapes, as accessed via the -`get_shape` method will have a first `Dimension` value of `None`, and -operations that depend on fixed batch_size would fail. - -Note: if `num_epochs` is not `None`, this function creates local counter -`epochs`. Use `local_variables_initializer()` to initialize local variables. - -##### Args: - - -* `tensors`: The list or dictionary of tensors to enqueue. -* `batch_size`: The new batch size pulled from the queue. -* `num_threads`: The number of threads enqueuing `tensors`. -* `capacity`: An integer. The maximum number of elements in the queue. -* `enqueue_many`: Whether each tensor in `tensors` is a single example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensors`. -* `dynamic_pad`: Boolean. Allow variable dimensions in input shapes. - The given dimensions are padded upon dequeue so that tensors within a - batch have the same shapes. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (Optional). If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the same types as `tensors` (except if - the input is a list of one element, then it returns a tensor, not a list). - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensors`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.do_quantize_training_on_graphdef.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.do_quantize_training_on_graphdef.md deleted file mode 100644 index 6fbb908133..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.do_quantize_training_on_graphdef.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.train.do_quantize_training_on_graphdef(input_graph, num_bits)` {#do_quantize_training_on_graphdef} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.import_meta_graph.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.import_meta_graph.md deleted file mode 100644 index d0fa7f551e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.train.import_meta_graph.md +++ /dev/null @@ -1,70 +0,0 @@ -### `tf.train.import_meta_graph(meta_graph_or_file, clear_devices=False, import_scope=None, **kwargs)` {#import_meta_graph} - -Recreates a Graph saved in a `MetaGraphDef` proto. - -This function takes a `MetaGraphDef` protocol buffer as input. If -the argument is a file containing a `MetaGraphDef` protocol buffer , -it constructs a protocol buffer from the file content. The function -then adds all the nodes from the `graph_def` field to the -current graph, recreates all the collections, and returns a saver -constructed from the `saver_def` field. - -In combination with `export_meta_graph()`, this function can be used to - -* Serialize a graph along with other Python objects such as `QueueRunner`, - `Variable` into a `MetaGraphDef`. - -* Restart training from a saved graph and checkpoints. - -* Run inference from a saved graph and checkpoints. - -```Python -... -# Create a saver. -saver = tf.train.Saver(...variables...) -# Remember the training_op we want to run by adding it to a collection. -tf.add_to_collection('train_op', train_op) -sess = tf.Session() -for step in xrange(1000000): - sess.run(train_op) - if step % 1000 == 0: - # Saves checkpoint, which by default also exports a meta_graph - # named 'my-model-global_step.meta'. - saver.save(sess, 'my-model', global_step=step) -``` - -Later we can continue training from this saved `meta_graph` without building -the model from scratch. - -```Python -with tf.Session() as sess: - new_saver = tf.train.import_meta_graph('my-save-dir/my-model-10000.meta') - new_saver.restore(sess, 'my-save-dir/my-model-10000') - # tf.get_collection() returns a list. In this example we only want the - # first one. - train_op = tf.get_collection('train_op')[0] - for step in xrange(1000000): - sess.run(train_op) -``` - -NOTE: Restarting training from saved `meta_graph` only works if the -device assignments have not changed. - -##### Args: - - -* `meta_graph_or_file`: `MetaGraphDef` protocol buffer or filename (including - the path) containing a `MetaGraphDef`. -* `clear_devices`: Whether or not to clear the device field for an `Operation` - or `Tensor` during import. -* `import_scope`: Optional `string`. Name scope to add. Only used when - initializing from protocol buffer. -* `**kwargs`: Optional keyed arguments. - -##### Returns: - - A saver constructed from `saver_def` in `MetaGraphDef` or None. - - A None value is returned if no variables exist in the `MetaGraphDef` - (i.e., there are no variables to restore). - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.truncatemod.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.truncatemod.md deleted file mode 100644 index c75108fc55..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.truncatemod.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.truncatemod(x, y, name=None)` {#truncatemod} - -Returns element-wise remainder of division. This emulates C semantics where - -true, this follows C semantics in that the result here is consistent -with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. - -*NOTE*: `Mod` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `float32`, `float64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.variable_axis_size_partitioner.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.variable_axis_size_partitioner.md deleted file mode 100644 index 5d8822e83c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.variable_axis_size_partitioner.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.variable_axis_size_partitioner(max_shard_bytes, axis=0, bytes_per_string_element=16, max_shards=None)` {#variable_axis_size_partitioner} - -Get a partitioner for VariableScope to keep shards below `max_shard_bytes`. - -This partitioner will shard a Variable along one axis, attempting to keep -the maximum shard size below `max_shard_bytes`. In practice, this is not -always possible when sharding along only one axis. When this happens, -this axis is sharded as much as possible (i.e., every dimension becomes -a separate shard). - -If the partitioner hits the `max_shards` limit, then each shard may end up -larger than `max_shard_bytes`. By default `max_shards` equals `None` and no -limit on the number of shards is enforced. - -One reasonable value for `max_shard_bytes` is `(64 << 20) - 1`, or almost -`64MB`, to keep below the protobuf byte limit. - -##### Args: - - -* `max_shard_bytes`: The maximum size any given shard is allowed to be. -* `axis`: The axis to partition along. Default: outermost axis. -* `bytes_per_string_element`: If the `Variable` is of type string, this provides - an estimate of how large each scalar in the `Variable` is. -* `max_shards`: The maximum number of shards in int created taking precedence - over `max_shard_bytes`. - -##### Returns: - - A partition function usable as the `partitioner` argument to - `variable_scope`, `get_variable`, and `get_partitioned_variable_list`. - -##### Raises: - - -* `ValueError`: If any of the byte counts are non-positive. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.zeta.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.zeta.md deleted file mode 100644 index ed66237d38..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard8/tf.zeta.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.zeta(x, q, name=None)` {#zeta} - -Compute the Hurwitz zeta function \\(\zeta(x, q)\\). - -The Hurwitz zeta function is defined as: - -``` -\zeta(x, q) = \sum_{n=0}^{\infty} (q + n)^{-x} -``` - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `q`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.DeviceSpec.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.DeviceSpec.md deleted file mode 100644 index 2355a91e54..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.DeviceSpec.md +++ /dev/null @@ -1,147 +0,0 @@ -Represents a (possibly partial) specification for a TensorFlow device. - -`DeviceSpec`s are used throughout TensorFlow to describe where state is stored -and computations occur. Using `DeviceSpec` allows you to parse device spec -strings to verify their validity, merge them or compose them programmatically. - -Example: - -```python -# Place the operations on device "GPU:0" in the "ps" job. -device_spec = DeviceSpec(job="ps", device_type="GPU", device_index=0) -with tf.device(device_spec): - # Both my_var and squared_var will be placed on /job:ps/device:GPU:0. - my_var = tf.Variable(..., name="my_variable") - squared_var = tf.square(my_var) -``` - -If a `DeviceSpec` is partially specified, it will be merged with other -`DeviceSpec`s according to the scope in which it is defined. `DeviceSpec` -components defined in inner scopes take precedence over those defined in -outer scopes. - -```python -with tf.device(DeviceSpec(job="train", )): - with tf.device(DeviceSpec(job="ps", device_type="GPU", device_index=0): - # Nodes created here will be assigned to /job:ps/device:GPU:0. - with tf.device(DeviceSpec(device_type="GPU", device_index=1): - # Nodes created here will be assigned to /job:train/device:GPU:1. -``` - -A `DeviceSpec` consists of 5 components -- each of -which is optionally specified: - -* Job: The job name. -* Replica: The replica index. -* Task: The task index. -* Device type: The device type string (e.g. "CPU" or "GPU"). -* Device index: The device index. -- - - - -#### `tf.DeviceSpec.__init__(job=None, replica=None, task=None, device_type=None, device_index=None)` {#DeviceSpec.__init__} - -Create a new `DeviceSpec` object. - -##### Args: - - -* `job`: string. Optional job name. -* `replica`: int. Optional replica index. -* `task`: int. Optional task index. -* `device_type`: Optional device type string (e.g. "CPU" or "GPU") -* `device_index`: int. Optional device index. If left - unspecified, device represents 'any' device_index. - - -- - - - -#### `tf.DeviceSpec.from_string(spec)` {#DeviceSpec.from_string} - -Construct a `DeviceSpec` from a string. - -##### Args: - - -* `spec`: a string of the form - /job:/replica:/task:/device:CPU: - or - /job:/replica:/task:/device:GPU: - as cpu and gpu are mutually exclusive. - All entries are optional. - -##### Returns: - - A DeviceSpec. - - -- - - - -#### `tf.DeviceSpec.job` {#DeviceSpec.job} - - - - -- - - - -#### `tf.DeviceSpec.merge_from(dev)` {#DeviceSpec.merge_from} - -Merge the properties of "dev" into this `DeviceSpec`. - -##### Args: - - -* `dev`: a `DeviceSpec`. - - -- - - - -#### `tf.DeviceSpec.parse_from_string(spec)` {#DeviceSpec.parse_from_string} - -Parse a `DeviceSpec` name into its components. - -##### Args: - - -* `spec`: a string of the form - /job:/replica:/task:/device:CPU: - or - /job:/replica:/task:/device:GPU: - as cpu and gpu are mutually exclusive. - All entries are optional. - -##### Returns: - - The `DeviceSpec`. - -##### Raises: - - -* `ValueError`: if the spec was not valid. - - -- - - - -#### `tf.DeviceSpec.replica` {#DeviceSpec.replica} - - - - -- - - - -#### `tf.DeviceSpec.task` {#DeviceSpec.task} - - - - -- - - - -#### `tf.DeviceSpec.to_string()` {#DeviceSpec.to_string} - -Return a string representation of this `DeviceSpec`. - -##### Returns: - - a string of the form - /job:/replica:/task:/device::. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.FixedLenFeature.__new__.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.FixedLenFeature.__new__.md deleted file mode 100644 index f7838d1884..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.FixedLenFeature.__new__.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.FixedLenFeature.__new__(_cls, shape, dtype, default_value=None)` {#FixedLenFeature.__new__} - -Create new instance of FixedLenFeature(shape, dtype, default_value) - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.NotDifferentiable.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.NotDifferentiable.md deleted file mode 100644 index c77655a1d3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.NotDifferentiable.md +++ /dev/null @@ -1,32 +0,0 @@ -### `tf.NotDifferentiable(op_type)` {#NotDifferentiable} - -Specifies that ops of type `op_type` is not differentiable. - -This function should *not* be used for operations that have a -well-defined gradient that is not yet implemented. - -This function is only used when defining a new op type. It may be -used for ops such as `tf.size()` that are not differentiable. For -example: - -```python -tf.NotDifferentiable("Size") -``` - -The gradient computed for 'op_type' will then propagate zeros. - -For ops that have a well-defined gradient but are not yet implemented, -no declaration should be made, and an error *must* be thrown if -an attempt to request its gradient is made. - -##### Args: - - -* `op_type`: The string type of an operation. This corresponds to the - `OpDef.name` field for the proto that defines the operation. - -##### Raises: - - -* `TypeError`: If `op_type` is not a string. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.Session.reset.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.Session.reset.md deleted file mode 100644 index 4c47c02264..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.Session.reset.md +++ /dev/null @@ -1,29 +0,0 @@ -#### `tf.Session.reset(target, containers=None, config=None)` {#Session.reset} - -Resets resource containers on `target`, and close all connected sessions. - -A resource container is distributed across all workers in the -same cluster as `target`. When a resource container on `target` -is reset, resources associated with that container will be cleared. -In particular, all Variables in the container will become undefined: -they lose their values and shapes. - -NOTE: -(i) reset() is currently only implemented for distributed sessions. -(ii) Any sessions on the master named by `target` will be closed. - -If no resource containers are provided, all containers are reset. - -##### Args: - - -* `target`: The execution engine to connect to. -* `containers`: A list of resource container name strings, or `None` if all of - all the containers are to be reset. -* `config`: (Optional.) Protocol buffer with configuration options. - -##### Raises: - - tf.errors.OpError: Or one of its subclasses if an error occurs while - resetting containers. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.assign_add.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.assign_add.md deleted file mode 100644 index 60e2875407..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.assign_add.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.assign_add(ref, value, use_locking=None, name=None)` {#assign_add} - -Update 'ref' by adding 'value' to it. - -This operation outputs "ref" after the update is done. -This makes it easier to chain operations that need to use the reset value. - -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: - `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, - `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Should be from a `Variable` node. -* `value`: A `Tensor`. Must have the same type as `ref`. - The value to be added to the variable. -* `use_locking`: An optional `bool`. Defaults to `False`. - If True, the addition will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as "ref". Returned as a convenience for operations that want - to use the new value after the variable has been updated. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.clip_by_average_norm.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.clip_by_average_norm.md deleted file mode 100644 index 4598e183d8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.clip_by_average_norm.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.clip_by_average_norm(t, clip_norm, name=None)` {#clip_by_average_norm} - -Clips tensor values to a maximum average L2-norm. - -Given a tensor `t`, and a maximum clip value `clip_norm`, this operation -normalizes `t` so that its average L2-norm is less than or equal to -`clip_norm`. Specifically, if the average L2-norm is already less than or -equal to `clip_norm`, then `t` is not modified. If the average L2-norm is -greater than `clip_norm`, then this operation returns a tensor of the same -type and shape as `t` with its values set to: - -`t * clip_norm / l2norm_avg(t)` - -In this case, the average L2-norm of the output tensor is `clip_norm`. - -This operation is typically used to clip gradients before applying them with -an optimizer. - -##### Args: - - -* `t`: A `Tensor`. -* `clip_norm`: A 0-D (scalar) `Tensor` > 0. A maximum clipping value. -* `name`: A name for the operation (optional). - -##### Returns: - - A clipped `Tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.entropy.entropy_shannon.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.entropy.entropy_shannon.md deleted file mode 100644 index 489d94783d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.entropy.entropy_shannon.md +++ /dev/null @@ -1,38 +0,0 @@ -### `tf.contrib.bayesflow.entropy.entropy_shannon(p, z=None, n=None, seed=None, form=None, name='entropy_shannon')` {#entropy_shannon} - -Monte Carlo or deterministic computation of Shannon's entropy. - -Depending on the kwarg `form`, this `Op` returns either the analytic entropy -of the distribution `p`, or the sampled entropy: - -``` --n^{-1} sum_{i=1}^n p.log_prob(z_i), where z_i ~ p, - \approx - E_p[ Log[p(Z)] ] - = Entropy[p] -``` - -User supplies either `Tensor` of samples `z`, or number of samples to draw `n` - -##### Args: - - -* `p`: `tf.contrib.distributions.Distribution` -* `z`: `Tensor` of samples from `p`, produced by `p.sample(n)` for some `n`. -* `n`: Integer `Tensor`. Number of samples to generate if `z` is not provided. -* `seed`: Python integer to seed the random number generator. -* `form`: Either `ELBOForms.analytic_entropy` (use formula for entropy of `q`) - or `ELBOForms.sample` (sample estimate of entropy), or `ELBOForms.default` - (attempt analytic entropy, fallback on sample). - Default value is `ELBOForms.default`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with same `dtype` as `p`, and shape equal to `p.batch_shape`. - -##### Raises: - - -* `ValueError`: If `form` not handled by this function. -* `ValueError`: If `form` is `ELBOForms.analytic_entropy` and `n` was provided. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.monte_carlo.expectation_importance_sampler_logspace.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.monte_carlo.expectation_importance_sampler_logspace.md deleted file mode 100644 index 10f7a67c63..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.monte_carlo.expectation_importance_sampler_logspace.md +++ /dev/null @@ -1,45 +0,0 @@ -### `tf.contrib.bayesflow.monte_carlo.expectation_importance_sampler_logspace(log_f, log_p, sampling_dist_q, z=None, n=None, seed=None, name='expectation_importance_sampler_logspace')` {#expectation_importance_sampler_logspace} - -Importance sampling with a positive function, in log-space. - -With `p(z) := exp{log_p(z)}`, and `f(z) = exp{log_f(z)}`, this `Op` -returns - -``` -Log[ n^{-1} sum_{i=1}^n [ f(z_i) p(z_i) / q(z_i) ] ], z_i ~ q, -\approx Log[ E_q[ f(Z) p(Z) / q(Z) ] ] -= Log[E_p[f(Z)]] -``` - -This integral is done in log-space with max-subtraction to better handle the -often extreme values that `f(z) p(z) / q(z)` can take on. - -In contrast to `expectation_importance_sampler`, this `Op` returns values in -log-space. - - -User supplies either `Tensor` of samples `z`, or number of samples to draw `n` - -##### Args: - - -* `log_f`: Callable mapping samples from `sampling_dist_q` to `Tensors` with - shape broadcastable to `q.batch_shape`. - For example, `log_f` works "just like" `sampling_dist_q.log_prob`. -* `log_p`: Callable mapping samples from `sampling_dist_q` to `Tensors` with - shape broadcastable to `q.batch_shape`. - For example, `log_p` works "just like" `q.log_prob`. -* `sampling_dist_q`: The sampling distribution. - `tf.contrib.distributions.Distribution`. - `float64` `dtype` recommended. - `log_p` and `q` should be supported on the same set. -* `z`: `Tensor` of samples from `q`, produced by `q.sample` for some `n`. -* `n`: Integer `Tensor`. Number of samples to generate if `z` is not provided. -* `seed`: Python integer to seed the random number generator. -* `name`: A name to give this `Op`. - -##### Returns: - - Logarithm of the importance sampling estimate. `Tensor` with `shape` equal - to batch shape of `q`, and `dtype` = `q.dtype`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.stochastic_tensor.get_current_value_type.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.stochastic_tensor.get_current_value_type.md deleted file mode 100644 index 98bd7241bb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.stochastic_tensor.get_current_value_type.md +++ /dev/null @@ -1,4 +0,0 @@ -### `tf.contrib.bayesflow.stochastic_tensor.get_current_value_type()` {#get_current_value_type} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.variational_inference.register_prior.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.variational_inference.register_prior.md deleted file mode 100644 index 45059c3199..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.bayesflow.variational_inference.register_prior.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.contrib.bayesflow.variational_inference.register_prior(variational, prior)` {#register_prior} - -Associate a variational `StochasticTensor` with a `Distribution` prior. - -This is a helper function used in conjunction with `elbo` that allows users -to specify the mapping between variational distributions and their priors -without having to pass in `variational_with_prior` explicitly. - -##### Args: - - -* `variational`: `StochasticTensor` q(Z). Approximating distribution. -* `prior`: `Distribution` p(Z). Prior distribution. - -##### Returns: - - None - -##### Raises: - - -* `ValueError`: if variational is not a `StochasticTensor` or `prior` is not - a `Distribution`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.BetaWithSoftplusConcentration.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.BetaWithSoftplusConcentration.md deleted file mode 100644 index e01f84653b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.BetaWithSoftplusConcentration.md +++ /dev/null @@ -1,597 +0,0 @@ -Beta with softplus transform of `concentration1` and `concentration0`. -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.__init__(concentration1, concentration0, validate_args=False, allow_nan_stats=True, name='BetaWithSoftplusConcentration')` {#BetaWithSoftplusConcentration.__init__} - - - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.allow_nan_stats` {#BetaWithSoftplusConcentration.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.batch_shape` {#BetaWithSoftplusConcentration.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.batch_shape_tensor(name='batch_shape_tensor')` {#BetaWithSoftplusConcentration.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.cdf(value, name='cdf')` {#BetaWithSoftplusConcentration.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.concentration0` {#BetaWithSoftplusConcentration.concentration0} - -Concentration parameter associated with a `0` outcome. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.concentration1` {#BetaWithSoftplusConcentration.concentration1} - -Concentration parameter associated with a `1` outcome. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.copy(**override_parameters_kwargs)` {#BetaWithSoftplusConcentration.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.covariance(name='covariance')` {#BetaWithSoftplusConcentration.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.dtype` {#BetaWithSoftplusConcentration.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.entropy(name='entropy')` {#BetaWithSoftplusConcentration.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.event_shape` {#BetaWithSoftplusConcentration.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.event_shape_tensor(name='event_shape_tensor')` {#BetaWithSoftplusConcentration.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.is_continuous` {#BetaWithSoftplusConcentration.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.is_scalar_batch(name='is_scalar_batch')` {#BetaWithSoftplusConcentration.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.is_scalar_event(name='is_scalar_event')` {#BetaWithSoftplusConcentration.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.log_cdf(value, name='log_cdf')` {#BetaWithSoftplusConcentration.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.log_prob(value, name='log_prob')` {#BetaWithSoftplusConcentration.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.log_survival_function(value, name='log_survival_function')` {#BetaWithSoftplusConcentration.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.mean(name='mean')` {#BetaWithSoftplusConcentration.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.mode(name='mode')` {#BetaWithSoftplusConcentration.mode} - -Mode. - -Additional documentation from `Beta`: - -Note: The mode is undefined when `concentration1 <= 1` or -`concentration0 <= 1`. If `self.allow_nan_stats` is `True`, `NaN` -is used for undefined modes. If `self.allow_nan_stats` is `False` an -exception is raised when one or more modes are undefined. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.name` {#BetaWithSoftplusConcentration.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#BetaWithSoftplusConcentration.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.param_static_shapes(cls, sample_shape)` {#BetaWithSoftplusConcentration.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.parameters` {#BetaWithSoftplusConcentration.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.prob(value, name='prob')` {#BetaWithSoftplusConcentration.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Beta`: - -Note: `x` must have dtype `self.dtype` and be in -`[0, 1].` It must have a shape compatible with `self.batch_shape()`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.reparameterization_type` {#BetaWithSoftplusConcentration.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.sample(sample_shape=(), seed=None, name='sample')` {#BetaWithSoftplusConcentration.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.stddev(name='stddev')` {#BetaWithSoftplusConcentration.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.survival_function(value, name='survival_function')` {#BetaWithSoftplusConcentration.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.total_concentration` {#BetaWithSoftplusConcentration.total_concentration} - -Sum of concentration parameters. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.validate_args` {#BetaWithSoftplusConcentration.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.BetaWithSoftplusConcentration.variance(name='variance')` {#BetaWithSoftplusConcentration.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.MultivariateNormalTriL.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.MultivariateNormalTriL.md deleted file mode 100644 index 4bd0c96189..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.MultivariateNormalTriL.md +++ /dev/null @@ -1,750 +0,0 @@ -The multivariate normal distribution on `R^k`. - -The Multivariate Normal distribution is defined over `R^k` and parameterized -by a (batch of) length-`k` `loc` vector (aka "mu") and a (batch of) `k x k` -`scale` matrix; `covariance = scale @ scale.T` where `@` denotes -matrix-multiplication. - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(x; loc, scale) = exp(-0.5 ||y||**2) / Z, -y = inv(scale) @ (x - loc), -Z = (2 pi)**(0.5 k) |det(scale)|, -``` - -where: - -* `loc` is a vector in `R^k`, -* `scale` is a linear operator in `R^{k x k}`, `cov = scale @ scale.T`, -* `Z` denotes the normalization constant, and, -* `||y||**2` denotes the squared Euclidean norm of `y`. - -A (non-batch) `scale` matrix is: - -```none -scale = scale_tril -``` - -where `scale_tril` is lower-triangular `k x k` matrix with non-zero diagonal, -i.e., `tf.diag_part(scale_tril) != 0`. - -Additional leading dimensions (if any) will index batches. - -The MultivariateNormal distribution is a member of the [location-scale -family](https://en.wikipedia.org/wiki/Location-scale_family), i.e., it can be -constructed as, - -```none -X ~ MultivariateNormal(loc=0, scale=1) # Identity scale, zero shift. -Y = scale @ X + loc -``` - -Trainable (batch) lower-triangular matrices can be created with -`ds.matrix_diag_transform()` and/or `ds.fill_lower_triangular()` - -#### Examples - -```python -ds = tf.contrib.distributions - -# Initialize a single 3-variate Gaussian. -mu = [1., 2, 3] -cov = [[ 0.36, 0.12, 0.06], - [ 0.12, 0.29, -0.13], - [ 0.06, -0.13, 0.26]] -scale = tf.cholesky(cov) -# ==> [[ 0.6, 0. , 0. ], -# [ 0.2, 0.5, 0. ], -# [ 0.1, -0.3, 0.4]]) -mvn = ds.MultivariateNormalTriL( - loc=mu, - scale_tril=scale) - -mvn.mean().eval() -# ==> [1., 2, 3] - -# Covariance agrees with cholesky(cov) parameterization. -mvn.covariance().eval() -# ==> [[ 0.36, 0.12, 0.06], -# [ 0.12, 0.29, -0.13], -# [ 0.06, -0.13, 0.26]] - -# Compute the pdf of an observation in `R^3` ; return a scalar. -mvn.prob([-1., 0, 1]).eval() # shape: [] - -# Initialize a 2-batch of 3-variate Gaussians. -mu = [[1., 2, 3], - [11, 22, 33]] # shape: [2, 3] -tril = ... # shape: [2, 3, 3], lower triangular, non-zero diagonal. -mvn = ds.MultivariateNormalTriL( - loc=mu, - scale_tril=tril) - -# Compute the pdf of two `R^3` observations; return a length-2 vector. -x = [[-0.9, 0, 0.1], - [-10, 0, 9]] # shape: [2, 3] -mvn.prob(x).eval() # shape: [2] - -``` -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.__init__(loc=None, scale_tril=None, validate_args=False, allow_nan_stats=True, name='MultivariateNormalTriL')` {#MultivariateNormalTriL.__init__} - -Construct Multivariate Normal distribution on `R^k`. - -The `batch_shape` is the broadcast shape between `loc` and `scale` -arguments. - -The `event_shape` is given by the last dimension of `loc` or the last -dimension of the matrix implied by `scale`. - -Recall that `covariance = scale @ scale.T`. A (non-batch) `scale` matrix is: - -```none -scale = scale_tril -``` - -where `scale_tril` is lower-triangular `k x k` matrix with non-zero -diagonal, i.e., `tf.diag_part(scale_tril) != 0`. - -Additional leading dimensions (if any) will index batches. - -##### Args: - - -* `loc`: Floating-point `Tensor`. If this is set to `None`, `loc` is - implicitly `0`. When specified, may have shape `[B1, ..., Bb, k]` where - `b >= 0` and `k` is the event size. -* `scale_tril`: Floating-point, lower-triangular `Tensor` with non-zero - diagonal elements. `scale_tril` has shape `[B1, ..., Bb, k, k]` where - `b >= 0` and `k` is the event size. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, - statistics (e.g., mean, mode, variance) use the value "`NaN`" to - indicate the result is undefined. When `False`, an exception is raised - if one or more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - -##### Raises: - - -* `ValueError`: if neither `loc` nor `scale_tril` are specified. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.allow_nan_stats` {#MultivariateNormalTriL.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.batch_shape` {#MultivariateNormalTriL.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.batch_shape_tensor(name='batch_shape_tensor')` {#MultivariateNormalTriL.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.bijector` {#MultivariateNormalTriL.bijector} - -Function transforming x => y. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.cdf(value, name='cdf')` {#MultivariateNormalTriL.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.copy(**override_parameters_kwargs)` {#MultivariateNormalTriL.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.covariance(name='covariance')` {#MultivariateNormalTriL.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.det_covariance(name='det_covariance')` {#MultivariateNormalTriL.det_covariance} - -Determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.distribution` {#MultivariateNormalTriL.distribution} - -Base distribution, p(x). - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.dtype` {#MultivariateNormalTriL.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.entropy(name='entropy')` {#MultivariateNormalTriL.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.event_shape` {#MultivariateNormalTriL.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.event_shape_tensor(name='event_shape_tensor')` {#MultivariateNormalTriL.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.is_continuous` {#MultivariateNormalTriL.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.is_scalar_batch(name='is_scalar_batch')` {#MultivariateNormalTriL.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.is_scalar_event(name='is_scalar_event')` {#MultivariateNormalTriL.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.loc` {#MultivariateNormalTriL.loc} - -The `loc` `Tensor` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.log_cdf(value, name='log_cdf')` {#MultivariateNormalTriL.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.log_det_covariance(name='log_det_covariance')` {#MultivariateNormalTriL.log_det_covariance} - -Log of determinant of covariance matrix. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.log_prob(value, name='log_prob')` {#MultivariateNormalTriL.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.log_survival_function(value, name='log_survival_function')` {#MultivariateNormalTriL.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.mean(name='mean')` {#MultivariateNormalTriL.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.mode(name='mode')` {#MultivariateNormalTriL.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.name` {#MultivariateNormalTriL.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#MultivariateNormalTriL.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.param_static_shapes(cls, sample_shape)` {#MultivariateNormalTriL.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.parameters` {#MultivariateNormalTriL.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.prob(value, name='prob')` {#MultivariateNormalTriL.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `MultivariateNormalLinearOperator`: - -`value` is a batch vector with compatible shape if `value` is a `Tensor` whose -shape can be broadcast up to either: - -```python -self.batch_shape + self.event_shape -``` - -or - -```python -[M1, ..., Mm] + self.batch_shape + self.event_shape -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.reparameterization_type` {#MultivariateNormalTriL.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.sample(sample_shape=(), seed=None, name='sample')` {#MultivariateNormalTriL.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.scale` {#MultivariateNormalTriL.scale} - -The `scale` `LinearOperator` in `Y = scale @ X + loc`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.stddev(name='stddev')` {#MultivariateNormalTriL.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.survival_function(value, name='survival_function')` {#MultivariateNormalTriL.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.validate_args` {#MultivariateNormalTriL.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.MultivariateNormalTriL.variance(name='variance')` {#MultivariateNormalTriL.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.Poisson.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.Poisson.md deleted file mode 100644 index 1a52643a32..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.Poisson.md +++ /dev/null @@ -1,613 +0,0 @@ -Poisson distribution. - -The Poisson distribution is parameterized by an event `rate` parameter. - -#### Mathematical Details - -The probability mass function (pmf) is, - -```none -pmf(k; lambda, k >= 0) = (lambda^k / k!) / Z -Z = exp(lambda). -``` - -where `rate = lambda` and `Z` is the normalizing constant. -- - - - -#### `tf.contrib.distributions.Poisson.__init__(rate, validate_args=False, allow_nan_stats=True, name='Poisson')` {#Poisson.__init__} - -Initialize a batch of Poisson distributions. - -##### Args: - - -* `rate`: Floating point tensor, the rate parameter of the - distribution(s). `rate` must be positive. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.Poisson.allow_nan_stats` {#Poisson.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.Poisson.batch_shape` {#Poisson.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Poisson.batch_shape_tensor(name='batch_shape_tensor')` {#Poisson.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Poisson.cdf(value, name='cdf')` {#Poisson.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - - -Additional documentation from `Poisson`: - -Note that the input value must be a non-negative floating point tensor with -dtype `dtype` and whose shape can be broadcast with `self.rate`. `x` is only -legal if it is non-negative and its components are equal to integer values. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Poisson.copy(**override_parameters_kwargs)` {#Poisson.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.Poisson.covariance(name='covariance')` {#Poisson.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.Poisson.dtype` {#Poisson.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Poisson.entropy(name='entropy')` {#Poisson.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.Poisson.event_shape` {#Poisson.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.Poisson.event_shape_tensor(name='event_shape_tensor')` {#Poisson.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Poisson.is_continuous` {#Poisson.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.Poisson.is_scalar_batch(name='is_scalar_batch')` {#Poisson.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Poisson.is_scalar_event(name='is_scalar_event')` {#Poisson.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.Poisson.log_cdf(value, name='log_cdf')` {#Poisson.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - - -Additional documentation from `Poisson`: - -Note that the input value must be a non-negative floating point tensor with -dtype `dtype` and whose shape can be broadcast with `self.rate`. `x` is only -legal if it is non-negative and its components are equal to integer values. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Poisson.log_prob(value, name='log_prob')` {#Poisson.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Poisson`: - -Note that the input value must be a non-negative floating point tensor with -dtype `dtype` and whose shape can be broadcast with `self.rate`. `x` is only -legal if it is non-negative and its components are equal to integer values. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Poisson.log_survival_function(value, name='log_survival_function')` {#Poisson.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Poisson.mean(name='mean')` {#Poisson.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.Poisson.mode(name='mode')` {#Poisson.mode} - -Mode. - -Additional documentation from `Poisson`: - -Note: when `rate` is an integer, there are actually two modes: `rate` -and `rate - 1`. In this case we return the larger, i.e., `rate`. - - -- - - - -#### `tf.contrib.distributions.Poisson.name` {#Poisson.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Poisson.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#Poisson.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.Poisson.param_static_shapes(cls, sample_shape)` {#Poisson.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.Poisson.parameters` {#Poisson.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.Poisson.prob(value, name='prob')` {#Poisson.prob} - -Probability density/mass function (depending on `is_continuous`). - - -Additional documentation from `Poisson`: - -Note that the input value must be a non-negative floating point tensor with -dtype `dtype` and whose shape can be broadcast with `self.rate`. `x` is only -legal if it is non-negative and its components are equal to integer values. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Poisson.rate` {#Poisson.rate} - -Rate parameter. - - -- - - - -#### `tf.contrib.distributions.Poisson.reparameterization_type` {#Poisson.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.Poisson.sample(sample_shape=(), seed=None, name='sample')` {#Poisson.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.Poisson.stddev(name='stddev')` {#Poisson.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.Poisson.survival_function(value, name='survival_function')` {#Poisson.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.Poisson.validate_args` {#Poisson.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.Poisson.variance(name='variance')` {#Poisson.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.WishartFull.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.WishartFull.md deleted file mode 100644 index eefa558fca..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.WishartFull.md +++ /dev/null @@ -1,669 +0,0 @@ -The matrix Wishart distribution on positive definite matrices. - -This distribution is defined by a scalar degrees of freedom `df` and a -symmetric, positive definite scale matrix. - -Evaluation of the pdf, determinant, and sampling are all `O(k^3)` operations -where `(k, k)` is the event space shape. - -#### Mathematical Details - -The probability density function (pdf) is, - -```none -pdf(X; df, scale) = det(X)**(0.5 (df-k-1)) exp(-0.5 tr[inv(scale) X]) / Z -Z = 2**(0.5 df k) |det(scale)|**(0.5 df) Gamma_k(0.5 df) -``` - -where: -* `df >= k` denotes the degrees of freedom, -* `scale` is a symmetric, positive definite, `k x k` matrix, -* `Z` is the normalizing constant, and, -* `Gamma_k` is the [multivariate Gamma function]( - https://en.wikipedia.org/wiki/Multivariate_gamma_function). - -#### Examples - -```python -# Initialize a single 3x3 Wishart with Full factored scale matrix and 5 -# degrees-of-freedom.(*) -df = 5 -scale = ... # Shape is [3, 3]; positive definite. -dist = tf.contrib.distributions.WishartFull(df=df, scale=scale) - -# Evaluate this on an observation in R^3, returning a scalar. -x = ... # A 3x3 positive definite matrix. -dist.prob(x) # Shape is [], a scalar. - -# Evaluate this on a two observations, each in R^{3x3}, returning a length two -# Tensor. -x = [x0, x1] # Shape is [2, 3, 3]. -dist.prob(x) # Shape is [2]. - -# Initialize two 3x3 Wisharts with Full factored scale matrices. -df = [5, 4] -scale = ... # Shape is [2, 3, 3]. -dist = tf.contrib.distributions.WishartFull(df=df, scale=scale) - -# Evaluate this on four observations. -x = [[x0, x1], [x2, x3]] # Shape is [2, 2, 3, 3]; xi is positive definite. -dist.prob(x) # Shape is [2, 2]. - -# (*) - To efficiently create a trainable covariance matrix, see the example -# in tf.contrib.distributions.matrix_diag_transform. -``` -- - - - -#### `tf.contrib.distributions.WishartFull.__init__(df, scale, cholesky_input_output_matrices=False, validate_args=False, allow_nan_stats=True, name='WishartFull')` {#WishartFull.__init__} - -Construct Wishart distributions. - -##### Args: - - -* `df`: `float` or `double` `Tensor`. Degrees of freedom, must be greater than - or equal to dimension of the scale matrix. -* `scale`: `float` or `double` `Tensor`. The symmetric positive definite - scale matrix of the distribution. -* `cholesky_input_output_matrices`: Python `bool`. Any function which whose - input or output is a matrix assumes the input is Cholesky and returns a - Cholesky factored matrix. Example `log_prob` input takes a Cholesky and - `sample_n` returns a Cholesky when - `cholesky_input_output_matrices=True`. -* `validate_args`: Python `bool`, default `False`. When `True` distribution - parameters are checked for validity despite possibly degrading runtime - performance. When `False` invalid inputs may silently render incorrect - outputs. -* `allow_nan_stats`: Python `bool`, default `True`. When `True`, statistics - (e.g., mean, mode, variance) use the value "`NaN`" to indicate the - result is undefined. When `False`, an exception is raised if one or - more of the statistic's batch members are undefined. -* `name`: Python `str` name prefixed to Ops created by this class. - - -- - - - -#### `tf.contrib.distributions.WishartFull.allow_nan_stats` {#WishartFull.allow_nan_stats} - -Python `bool` describing behavior when a stat is undefined. - -Stats return +/- infinity when it makes sense. E.g., the variance of a -Cauchy distribution is infinity. However, sometimes the statistic is -undefined, e.g., if a distribution's pdf does not achieve a maximum within -the support of the distribution, the mode is undefined. If the mean is -undefined, then by definition the variance is undefined. E.g. the mean for -Student's T for df = 1 is undefined (no clear way to say it is either + or - -infinity), so the variance = E[(X - mean)**2] is also undefined. - -##### Returns: - - -* `allow_nan_stats`: Python `bool`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.batch_shape` {#WishartFull.batch_shape} - -Shape of a single sample from a single event index as a `TensorShape`. - -May be partially defined or unknown. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Returns: - - -* `batch_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.WishartFull.batch_shape_tensor(name='batch_shape_tensor')` {#WishartFull.batch_shape_tensor} - -Shape of a single sample from a single event index as a 1-D `Tensor`. - -The batch dimensions are indexes into independent, non-identical -parameterizations of this distribution. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `batch_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.cdf(value, name='cdf')` {#WishartFull.cdf} - -Cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -cdf(x) := P[X <= x] -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `cdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.cholesky_input_output_matrices` {#WishartFull.cholesky_input_output_matrices} - -Boolean indicating if `Tensor` input/outputs are Cholesky factorized. - - -- - - - -#### `tf.contrib.distributions.WishartFull.copy(**override_parameters_kwargs)` {#WishartFull.copy} - -Creates a deep copy of the distribution. - -Note: the copy distribution may continue to depend on the original -intialization arguments. - -##### Args: - - -* `**override_parameters_kwargs`: String/value dictionary of initialization - arguments to override with new values. - -##### Returns: - - -* `distribution`: A new instance of `type(self)` intitialized from the union - of self.parameters and override_parameters_kwargs, i.e., - `dict(self.parameters, **override_parameters_kwargs)`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.covariance(name='covariance')` {#WishartFull.covariance} - -Covariance. - -Covariance is (possibly) defined only for non-scalar-event distributions. - -For example, for a length-`k`, vector-valued distribution, it is calculated -as, - -```none -Cov[i, j] = Covariance(X_i, X_j) = E[(X_i - E[X_i]) (X_j - E[X_j])] -``` - -where `Cov` is a (batch of) `k x k` matrix, `0 <= (i, j) < k`, and `E` -denotes expectation. - -Alternatively, for non-vector, multivariate distributions (e.g., -matrix-valued, Wishart), `Covariance` shall return a (batch of) matrices -under some vectorization of the events, i.e., - -```none -Cov[i, j] = Covariance(Vec(X)_i, Vec(X)_j) = [as above] -```` - -where `Cov` is a (batch of) `k' x k'` matrices, -`0 <= (i, j) < k' = reduce_prod(event_shape)`, and `Vec` is some function -mapping indices of this distribution's event dimensions to indices of a -length-`k'` vector. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `covariance`: Floating-point `Tensor` with shape `[B1, ..., Bn, k', k']` - where the first `n` dimensions are batch coordinates and - `k' = reduce_prod(self.event_shape)`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.df` {#WishartFull.df} - -Wishart distribution degree(s) of freedom. - - -- - - - -#### `tf.contrib.distributions.WishartFull.dimension` {#WishartFull.dimension} - -Dimension of underlying vector space. The `p` in `R^(p*p)`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.dtype` {#WishartFull.dtype} - -The `DType` of `Tensor`s handled by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.entropy(name='entropy')` {#WishartFull.entropy} - -Shannon entropy in nats. - - -- - - - -#### `tf.contrib.distributions.WishartFull.event_shape` {#WishartFull.event_shape} - -Shape of a single sample from a single batch as a `TensorShape`. - -May be partially defined or unknown. - -##### Returns: - - -* `event_shape`: `TensorShape`, possibly unknown. - - -- - - - -#### `tf.contrib.distributions.WishartFull.event_shape_tensor(name='event_shape_tensor')` {#WishartFull.event_shape_tensor} - -Shape of a single sample from a single batch as a 1-D int32 `Tensor`. - -##### Args: - - -* `name`: name to give to the op - -##### Returns: - - -* `event_shape`: `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.is_continuous` {#WishartFull.is_continuous} - - - - -- - - - -#### `tf.contrib.distributions.WishartFull.is_scalar_batch(name='is_scalar_batch')` {#WishartFull.is_scalar_batch} - -Indicates that `batch_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_batch`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.is_scalar_event(name='is_scalar_event')` {#WishartFull.is_scalar_event} - -Indicates that `event_shape == []`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `is_scalar_event`: `bool` scalar `Tensor`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.log_cdf(value, name='log_cdf')` {#WishartFull.log_cdf} - -Log cumulative distribution function. - -Given random variable `X`, the cumulative distribution function `cdf` is: - -``` -log_cdf(x) := Log[ P[X <= x] ] -``` - -Often, a numerical approximation can be used for `log_cdf(x)` that yields -a more accurate answer than simply taking the logarithm of the `cdf` when -`x << -1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `logcdf`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.log_normalization(name='log_normalization')` {#WishartFull.log_normalization} - -Computes the log normalizing constant, log(Z). - - -- - - - -#### `tf.contrib.distributions.WishartFull.log_prob(value, name='log_prob')` {#WishartFull.log_prob} - -Log probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `log_prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.log_survival_function(value, name='log_survival_function')` {#WishartFull.log_survival_function} - -Log survival function. - -Given random variable `X`, the survival function is defined: - -``` -log_survival_function(x) = Log[ P[X > x] ] - = Log[ 1 - P[X <= x] ] - = Log[ 1 - cdf(x) ] -``` - -Typically, different numerical approximations can be used for the log -survival function, which are more accurate than `1 - cdf(x)` when `x >> 1`. - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.mean(name='mean')` {#WishartFull.mean} - -Mean. - - -- - - - -#### `tf.contrib.distributions.WishartFull.mean_log_det(name='mean_log_det')` {#WishartFull.mean_log_det} - -Computes E[log(det(X))] under this Wishart distribution. - - -- - - - -#### `tf.contrib.distributions.WishartFull.mode(name='mode')` {#WishartFull.mode} - -Mode. - - -- - - - -#### `tf.contrib.distributions.WishartFull.name` {#WishartFull.name} - -Name prepended to all ops created by this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.param_shapes(cls, sample_shape, name='DistributionParamShapes')` {#WishartFull.param_shapes} - -Shapes of parameters given the desired shape of a call to `sample()`. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. - -Subclasses should override class method `_param_shapes`. - -##### Args: - - -* `sample_shape`: `Tensor` or python list/tuple. Desired shape of a call to - `sample()`. -* `name`: name to prepend ops with. - -##### Returns: - - `dict` of parameter name to `Tensor` shapes. - - -- - - - -#### `tf.contrib.distributions.WishartFull.param_static_shapes(cls, sample_shape)` {#WishartFull.param_static_shapes} - -param_shapes with static (i.e. `TensorShape`) shapes. - -This is a class method that describes what key/value arguments are required -to instantiate the given `Distribution` so that a particular shape is -returned for that instance's call to `sample()`. Assumes that the sample's -shape is known statically. - -Subclasses should override class method `_param_shapes` to return -constant-valued tensors when constant values are fed. - -##### Args: - - -* `sample_shape`: `TensorShape` or python list/tuple. Desired shape of a call - to `sample()`. - -##### Returns: - - `dict` of parameter name to `TensorShape`. - -##### Raises: - - -* `ValueError`: if `sample_shape` is a `TensorShape` and is not fully defined. - - -- - - - -#### `tf.contrib.distributions.WishartFull.parameters` {#WishartFull.parameters} - -Dictionary of parameters used to instantiate this `Distribution`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.prob(value, name='prob')` {#WishartFull.prob} - -Probability density/mass function (depending on `is_continuous`). - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - -* `prob`: a `Tensor` of shape `sample_shape(x) + self.batch_shape` with - values of type `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.reparameterization_type` {#WishartFull.reparameterization_type} - -Describes how samples from the distribution are reparameterized. - -Currently this is one of the static instances -`distributions.FULLY_REPARAMETERIZED` -or `distributions.NOT_REPARAMETERIZED`. - -##### Returns: - - An instance of `ReparameterizationType`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.sample(sample_shape=(), seed=None, name='sample')` {#WishartFull.sample} - -Generate samples of the specified shape. - -Note that a call to `sample()` without arguments will generate a single -sample. - -##### Args: - - -* `sample_shape`: 0D or 1D `int32` `Tensor`. Shape of the generated samples. -* `seed`: Python integer seed for RNG -* `name`: name to give to the op. - -##### Returns: - - -* `samples`: a `Tensor` with prepended dimensions `sample_shape`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.scale()` {#WishartFull.scale} - -Wishart distribution scale matrix. - - -- - - - -#### `tf.contrib.distributions.WishartFull.scale_operator_pd` {#WishartFull.scale_operator_pd} - -Wishart distribution scale matrix as an OperatorPD. - - -- - - - -#### `tf.contrib.distributions.WishartFull.stddev(name='stddev')` {#WishartFull.stddev} - -Standard deviation. - -Standard deviation is defined as, - -```none -stddev = E[(X - E[X])**2]**0.5 -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `stddev.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `stddev`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.survival_function(value, name='survival_function')` {#WishartFull.survival_function} - -Survival function. - -Given random variable `X`, the survival function is defined: - -``` -survival_function(x) = P[X > x] - = 1 - P[X <= x] - = 1 - cdf(x). -``` - -##### Args: - - -* `value`: `float` or `double` `Tensor`. -* `name`: The name to give this op. - -##### Returns: - - `Tensor` of shape `sample_shape(x) + self.batch_shape` with values of type - `self.dtype`. - - -- - - - -#### `tf.contrib.distributions.WishartFull.validate_args` {#WishartFull.validate_args} - -Python `bool` indicating possibly expensive checks are enabled. - - -- - - - -#### `tf.contrib.distributions.WishartFull.variance(name='variance')` {#WishartFull.variance} - -Variance. - -Variance is defined as, - -```none -Var = E[(X - E[X])**2] -``` - -where `X` is the random variable associated with this distribution, `E` -denotes expectation, and `Var.shape = batch_shape + event_shape`. - -##### Args: - - -* `name`: The name to give this op. - -##### Returns: - - -* `variance`: Floating-point `Tensor` with shape identical to - `batch_shape + event_shape`, i.e., the same shape as `self.mean()`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.softplus_inverse.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.softplus_inverse.md deleted file mode 100644 index 6f97b1f959..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.distributions.softplus_inverse.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.contrib.distributions.softplus_inverse(x, name=None)` {#softplus_inverse} - -Computes the inverse softplus, i.e., x = softplus_inverse(softplus(x)). - -Mathematically this op is equivalent to: - -```none -softplus_inverse = log(exp(x) - 1.) -``` - -##### Args: - - -* `x`: `Tensor`. Non-negative (not enforced), floating-point. -* `name`: A name for the operation (optional). - -##### Returns: - - `Tensor`. Has the same type/shape as input `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.ffmpeg.decode_audio.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.ffmpeg.decode_audio.md deleted file mode 100644 index 64aab3cffb..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.ffmpeg.decode_audio.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.contrib.ffmpeg.decode_audio(contents, file_format=None, samples_per_second=None, channel_count=None)` {#decode_audio} - -Create an op that decodes the contents of an audio file. - -Note that ffmpeg is free to select the "best" audio track from an mp4. -https://trac.ffmpeg.org/wiki/Map - -##### Args: - - -* `contents`: The binary contents of the audio file to decode. This is a - scalar. -* `file_format`: A string specifying which format the contents will conform - to. This can be mp3, mp4, ogg, or wav. -* `samples_per_second`: The number of samples per second that is assumed. - In some cases, resampling will occur to generate the correct sample - rate. -* `channel_count`: The number of channels that should be created from the - audio contents. If the contents have more than this number, then - some channels will be merged or dropped. If contents has fewer than - this, then additional channels will be created from the existing ones. - -##### Returns: - - A rank 2 tensor that has time along dimension 0 and channels along - dimension 1. Dimension 0 will be `samples_per_second * length` wide, and - dimension 1 will be `channel_count` wide. If ffmpeg fails to decode the - audio then an empty tensor will be returned. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.assign_from_checkpoint_fn.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.assign_from_checkpoint_fn.md deleted file mode 100644 index e4d183b990..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.assign_from_checkpoint_fn.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.contrib.framework.assign_from_checkpoint_fn(model_path, var_list, ignore_missing_vars=False, reshape_variables=False)` {#assign_from_checkpoint_fn} - -Returns a function that assigns specific variables from a checkpoint. - -##### Args: - - -* `model_path`: The full path to the model checkpoint. To get latest checkpoint - use `model_path = tf.train.latest_checkpoint(checkpoint_dir)` -* `var_list`: A list of `Variable` objects or a dictionary mapping names in the - checkpoint to the correspoing variables to initialize. If empty or None, - it would return no_op(), None. -* `ignore_missing_vars`: Boolean, if True it would ignore variables missing in - the checkpoint with a warning instead of failing. -* `reshape_variables`: Boolean, if True it would automatically reshape variables - which are of different shape then the ones stored in the checkpoint but - which have the same number of elements. - -##### Returns: - - A function that takes a single argument, a `tf.Session`, that applies the - assignment operation. - -##### Raises: - - -* `ValueError`: If the checkpoint specified at `model_path` is missing one of - the variables in `var_list`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.get_or_create_global_step.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.get_or_create_global_step.md deleted file mode 100644 index bd9e41ee62..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.get_or_create_global_step.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.contrib.framework.get_or_create_global_step(graph=None)` {#get_or_create_global_step} - -Returns and create (if necessary) the global step variable. - -##### Args: - - -* `graph`: The graph in which to create the global step. If missing, use default - graph. - -##### Returns: - - the tensor representing the global step variable. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.is_tensor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.is_tensor.md deleted file mode 100644 index 9db3544e7e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.is_tensor.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.contrib.framework.is_tensor(x)` {#is_tensor} - -Check for tensor types. - -Check whether an object is a tensor. Equivalent to -`isinstance(x, [tf.Tensor, tf.SparseTensor, tf.Variable])`. - -##### Args: - - -* `x`: An python object to check. - -##### Returns: - - `True` if `x` is a tensor, `False` if not. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.model_variable.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.model_variable.md deleted file mode 100644 index daa96911d9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.model_variable.md +++ /dev/null @@ -1,34 +0,0 @@ -### `tf.contrib.framework.model_variable(*args, **kwargs)` {#model_variable} - -Gets an existing model variable with these parameters or creates a new one. - -##### Args: - - -* `name`: the name of the new or existing variable. -* `shape`: shape of the new or existing variable. -* `dtype`: type of the new or existing variable (defaults to `DT_FLOAT`). -* `initializer`: initializer for the variable if one is created. -* `regularizer`: a (Tensor -> Tensor or None) function; the result of - applying it on a newly created variable will be added to the collection - GraphKeys.REGULARIZATION_LOSSES and can be used for regularization. -* `trainable`: If `True` also add the variable to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see `tf.Variable`). -* `collections`: A list of collection names to which the Variable will be added. - Note that the variable is always also added to the - `GraphKeys.GLOBAL_VARIABLES` and `GraphKeys.MODEL_VARIABLES` collections. -* `caching_device`: Optional device string or function describing where the - Variable should be cached for reading. Defaults to the Variable's - device. -* `device`: Optional device to place the variable. It can be an string or a - function that is called to get the device for the variable. -* `partitioner`: Optional callable that accepts a fully defined `TensorShape` - and dtype of the `Variable` to be created, and returns a list of - partitions for each axis (currently only one axis can be partitioned). -* `custom_getter`: Callable that allows overwriting the internal - get_variable method and has to have the same signature. - -##### Returns: - - The created or existing variable. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.remove_squeezable_dimensions.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.remove_squeezable_dimensions.md deleted file mode 100644 index b444be2e1c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.framework.remove_squeezable_dimensions.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.contrib.framework.remove_squeezable_dimensions(predictions, labels, name=None)` {#remove_squeezable_dimensions} - -Squeeze last dim if ranks of `predictions` and `labels` differ by 1. - -This will use static shape if available. Otherwise, it will add graph -operations, which could result in a performance hit. - -##### Args: - - -* `predictions`: Predicted values, a `Tensor` of arbitrary dimensions. -* `labels`: Label values, a `Tensor` whose dimensions match `predictions`. -* `name`: Name of the op. - -##### Returns: - - Tuple of `predictions` and `labels`, possibly with last dim squeezed. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.connect.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.connect.md deleted file mode 100644 index 29d5633ef1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.connect.md +++ /dev/null @@ -1,27 +0,0 @@ -### `tf.contrib.graph_editor.connect(sgv0, sgv1, disconnect_first=False)` {#connect} - -Connect the outputs of sgv0 to the inputs of sgv1. - -##### Args: - - -* `sgv0`: the first subgraph to have its outputs swapped. This argument is - converted to a subgraph using the same rules as the function - subgraph.make_view. - Note that sgv0 is modified in place. -* `sgv1`: the second subgraph to have its outputs swapped. This argument is - converted to a subgraph using the same rules as the function - subgraph.make_view. - Note that sgv1 is modified in place. -* `disconnect_first`: if True the current outputs of sgv0 are disconnected. - -##### Returns: - - A tuple `(sgv0, sgv1)` of the now connected subgraphs. - -##### Raises: - - -* `StandardError`: if sgv0 or sgv1 cannot be converted to a SubGraphView using - the same rules than the function subgraph.make_view. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.get_generating_ops.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.get_generating_ops.md deleted file mode 100644 index ac42fc9272..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.get_generating_ops.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.contrib.graph_editor.get_generating_ops(ts)` {#get_generating_ops} - -Return all the generating ops of the tensors in `ts`. - -##### Args: - - -* `ts`: a list of `tf.Tensor` - -##### Returns: - - A list of all the generating `tf.Operation` of the tensors in `ts`. - -##### Raises: - - -* `TypeError`: if `ts` cannot be converted to a list of `tf.Tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.get_walks_union_ops.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.get_walks_union_ops.md deleted file mode 100644 index af6fa7c093..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.get_walks_union_ops.md +++ /dev/null @@ -1,38 +0,0 @@ -### `tf.contrib.graph_editor.get_walks_union_ops(forward_seed_ops, backward_seed_ops, forward_inclusive=True, backward_inclusive=True, within_ops=None, control_inputs=False, control_outputs=None, control_ios=None)` {#get_walks_union_ops} - -Return the union of a forward and a backward walk. - -##### Args: - - -* `forward_seed_ops`: an iterable of operations from which the forward graph - walk starts. If a list of tensors is given instead, the seed_ops are set - to be the consumers of those tensors. -* `backward_seed_ops`: an iterable of operations from which the backward graph - walk starts. If a list of tensors is given instead, the seed_ops are set - to be the generators of those tensors. -* `forward_inclusive`: if True the given forward_seed_ops are also part of the - resulting set. -* `backward_inclusive`: if True the given backward_seed_ops are also part of the - resulting set. -* `within_ops`: restrict the search within those operations. If within_ops is - None, the search is done within the whole graph. -* `control_inputs`: A boolean indicating whether control inputs are enabled. -* `control_outputs`: An instance of util.ControlOutputs or None. If not None, - control outputs are enabled. -* `control_ios`: An instance of util.ControlOutputs or None. If not None, both - control inputs and control outputs are enabled. This is equivalent to set - control_inputs to True and control_outputs to the util.ControlOutputs - instance. - -##### Returns: - - A Python set of all the tf.Operation in the union of a forward and a - backward walk. - -##### Raises: - - -* `TypeError`: if forward_seed_ops or backward_seed_ops or within_ops cannot be - converted to a list of tf.Operation. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.get_within_boundary_ops.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.get_within_boundary_ops.md deleted file mode 100644 index d49459205b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.get_within_boundary_ops.md +++ /dev/null @@ -1,32 +0,0 @@ -### `tf.contrib.graph_editor.get_within_boundary_ops(ops, seed_ops, boundary_ops=(), inclusive=True, control_inputs=False, control_outputs=None, control_ios=None)` {#get_within_boundary_ops} - -Return all the `tf.Operation` within the given boundary. - -##### Args: - - -* `ops`: an object convertible to a list of `tf.Operation`. those ops define the - set in which to perform the operation (if a `tf.Graph` is given, it - will be converted to the list of all its operations). -* `seed_ops`: the operations from which to start expanding. -* `boundary_ops`: the ops forming the boundary. -* `inclusive`: if `True`, the result will also include the boundary ops. -* `control_inputs`: A boolean indicating whether control inputs are enabled. -* `control_outputs`: An instance of `util.ControlOutputs` or `None`. If not - `None`, control outputs are enabled. -* `control_ios`: An instance of `util.ControlOutputs` or `None`. If not - `None`, both control inputs and control outputs are enabled. This is - equivalent to set control_inputs to True and control_outputs to - the `util.ControlOutputs` instance. - -##### Returns: - - All the `tf.Operation` surrounding the given ops. - -##### Raises: - - -* `TypeError`: if `ops` or `seed_ops` cannot be converted to a list of - `tf.Operation`. -* `ValueError`: if the boundary is intersecting with the seeds. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.make_view_from_scope.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.make_view_from_scope.md deleted file mode 100644 index 5d1fde9416..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.make_view_from_scope.md +++ /dev/null @@ -1,14 +0,0 @@ -### `tf.contrib.graph_editor.make_view_from_scope(scope, graph)` {#make_view_from_scope} - -Make a subgraph from a name scope. - -##### Args: - - -* `scope`: the name of the scope. -* `graph`: the `tf.Graph`. - -##### Returns: - - A subgraph view representing the given scope. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.reroute_ts.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.reroute_ts.md deleted file mode 100644 index c3a5132331..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.graph_editor.reroute_ts.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.contrib.graph_editor.reroute_ts(ts0, ts1, can_modify=None, cannot_modify=None)` {#reroute_ts} - -For each tensor's pair, replace the end of t1 by the end of t0. - -B0 B1 B0 B1 -| | => |/ -A0 A1 A0 A1 - -The end of the tensors in ts1 are left dangling. - -##### Args: - - -* `ts0`: an object convertible to a list of `tf.Tensor`. -* `ts1`: an object convertible to a list of `tf.Tensor`. -* `can_modify`: iterable of operations which can be modified. Any operation - outside within_ops will be left untouched by this function. -* `cannot_modify`: iterable of operations which cannot be modified. Any - operation within cannot_modify will be left untouched by this function. - -##### Returns: - - The number of individual modifications made by the function. - -##### Raises: - - -* `TypeError`: if ts0 or ts1 cannot be converted to a list of tf.Tensor. -* `TypeError`: if can_modify or cannot_modify is not None and cannot be - converted to a list of tf.Operation. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.create_feature_spec_for_parsing.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.create_feature_spec_for_parsing.md deleted file mode 100644 index 898cecc117..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.create_feature_spec_for_parsing.md +++ /dev/null @@ -1,42 +0,0 @@ -### `tf.contrib.layers.create_feature_spec_for_parsing(feature_columns)` {#create_feature_spec_for_parsing} - -Helper that prepares features config from input feature_columns. - -The returned feature config can be used as arg 'features' in tf.parse_example. - -Typical usage example: - -```python -# Define features and transformations -feature_a = sparse_column_with_vocabulary_file(...) -feature_b = real_valued_column(...) -feature_c_bucketized = bucketized_column(real_valued_column("feature_c"), ...) -feature_a_x_feature_c = crossed_column( - columns=[feature_a, feature_c_bucketized], ...) - -feature_columns = set( - [feature_b, feature_c_bucketized, feature_a_x_feature_c]) -batch_examples = tf.parse_example( - serialized=serialized_examples, - features=create_feature_spec_for_parsing(feature_columns)) -``` - -For the above example, create_feature_spec_for_parsing would return the dict: -{ - "feature_a": parsing_ops.VarLenFeature(tf.string), - "feature_b": parsing_ops.FixedLenFeature([1], dtype=tf.float32), - "feature_c": parsing_ops.FixedLenFeature([1], dtype=tf.float32) -} - -##### Args: - - -* `feature_columns`: An iterable containing all the feature columns. All items - should be instances of classes derived from _FeatureColumn, unless - feature_columns is a dict -- in which case, this should be true of all - values in the dict. - -##### Returns: - - A dict mapping feature keys to FixedLenFeature or VarLenFeature values. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.joint_weighted_sum_from_feature_columns.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.joint_weighted_sum_from_feature_columns.md deleted file mode 100644 index ccb2e6a606..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.joint_weighted_sum_from_feature_columns.md +++ /dev/null @@ -1,35 +0,0 @@ -### `tf.contrib.layers.joint_weighted_sum_from_feature_columns(columns_to_tensors, feature_columns, num_outputs, weight_collections=None, trainable=True, scope=None)` {#joint_weighted_sum_from_feature_columns} - -A restricted linear prediction builder based on FeatureColumns. - -As long as all feature columns are unweighted sparse columns this computes the -prediction of a linear model which stores all weights in a single variable. - -##### Args: - - -* `columns_to_tensors`: A mapping from feature column to tensors. 'string' key - means a base feature (not-transformed). It can have FeatureColumn as a - key too. That means that FeatureColumn is already transformed by input - pipeline. For example, `inflow` may have handled transformations. -* `feature_columns`: A set containing all the feature columns. All items in the - set should be instances of classes derived from FeatureColumn. -* `num_outputs`: An integer specifying number of outputs. Default value is 1. -* `weight_collections`: List of graph collections to which weights are added. -* `trainable`: If `True` also add variables to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see tf.Variable). -* `scope`: Optional scope for variable_scope. - -##### Returns: - - A tuple containing: - - * A Tensor which represents predictions of a linear model. - * A list of Variables storing the weights. - * A Variable which is used for bias. - -##### Raises: - - -* `ValueError`: if FeatureColumn cannot be used for linear predictions. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.l1_regularizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.l1_regularizer.md deleted file mode 100644 index edf410d1da..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.l1_regularizer.md +++ /dev/null @@ -1,21 +0,0 @@ -### `tf.contrib.layers.l1_regularizer(scale, scope=None)` {#l1_regularizer} - -Returns a function that can be used to apply L1 regularization to weights. - -L1 regularization encourages sparsity. - -##### Args: - - -* `scale`: A scalar multiplier `Tensor`. 0.0 disables the regularizer. -* `scope`: An optional scope name. - -##### Returns: - - A function with signature `l1(weights)` that apply L1 regularization. - -##### Raises: - - -* `ValueError`: If scale is negative or if scale is not a float. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.xavier_initializer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.xavier_initializer.md deleted file mode 100644 index 55631e4b05..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.layers.xavier_initializer.md +++ /dev/null @@ -1,29 +0,0 @@ -### `tf.contrib.layers.xavier_initializer(uniform=True, seed=None, dtype=tf.float32)` {#xavier_initializer} - -Returns an initializer performing "Xavier" initialization for weights. - -This function implements the weight initialization from: - -Xavier Glorot and Yoshua Bengio (2010): - Understanding the difficulty of training deep feedforward neural - networks. International conference on artificial intelligence and - statistics. - -This initializer is designed to keep the scale of the gradients roughly the -same in all layers. In uniform distribution this ends up being the range: -`x = sqrt(6. / (in + out)); [-x, x]` and for normal distribution a standard -deviation of `sqrt(3. / (in + out))` is used. - -##### Args: - - -* `uniform`: Whether to use uniform or normal distributed random initialization. -* `seed`: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `dtype`: The data type. Only floating point types are supported. - -##### Returns: - - An initializer for a weight matrix. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.DNNLinearCombinedRegressor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.DNNLinearCombinedRegressor.md deleted file mode 100644 index dea9500a81..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.DNNLinearCombinedRegressor.md +++ /dev/null @@ -1,408 +0,0 @@ -A regressor for TensorFlow Linear and DNN joined training models. - -Example: - -```python -sparse_feature_a = sparse_column_with_hash_bucket(...) -sparse_feature_b = sparse_column_with_hash_bucket(...) - -sparse_feature_a_x_sparse_feature_b = crossed_column(...) - -sparse_feature_a_emb = embedding_column(sparse_id_column=sparse_feature_a, - ...) -sparse_feature_b_emb = embedding_column(sparse_id_column=sparse_feature_b, - ...) - -estimator = DNNLinearCombinedRegressor( - # common settings - weight_column_name=weight_column_name, - # wide settings - linear_feature_columns=[sparse_feature_a_x_sparse_feature_b], - linear_optimizer=tf.train.FtrlOptimizer(...), - # deep settings - dnn_feature_columns=[sparse_feature_a_emb, sparse_feature_b_emb], - dnn_hidden_units=[1000, 500, 100], - dnn_optimizer=tf.train.ProximalAdagradOptimizer(...)) - -# To apply L1 and L2 regularization, you can set optimizers as follows: -tf.train.ProximalAdagradOptimizer( - learning_rate=0.1, - l1_regularization_strength=0.001, - l2_regularization_strength=0.001) -# It is same for FtrlOptimizer. - -# Input builders -def input_fn_train: # returns x, y - ... -def input_fn_eval: # returns x, y - ... -estimator.train(input_fn_train) -estimator.evaluate(input_fn_eval) -estimator.predict(x) -``` - -Input of `fit`, `train`, and `evaluate` should have following features, - otherwise there will be a `KeyError`: - if `weight_column_name` is not `None`, a feature with - `key=weight_column_name` whose value is a `Tensor`. - for each `column` in `dnn_feature_columns` + `linear_feature_columns`: - - if `column` is a `SparseColumn`, a feature with `key=column.name` - whose `value` is a `SparseTensor`. - - if `column` is a `WeightedSparseColumn`, two features: the first with - `key` the id column name, the second with `key` the weight column name. - Both features' `value` must be a `SparseTensor`. - - if `column` is a `RealValuedColumn, a feature with `key=column.name` - whose `value` is a `Tensor`. -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.__init__(model_dir=None, weight_column_name=None, linear_feature_columns=None, linear_optimizer=None, _joint_linear_weights=False, dnn_feature_columns=None, dnn_optimizer=None, dnn_hidden_units=None, dnn_activation_fn=relu, dnn_dropout=None, gradient_clip_norm=None, enable_centered_bias=False, label_dimension=1, config=None, feature_engineering_fn=None, embedding_lr_multipliers=None, input_layer_min_slice_size=None)` {#DNNLinearCombinedRegressor.__init__} - -Initializes a DNNLinearCombinedRegressor instance. - -##### Args: - - -* `model_dir`: Directory to save model parameters, graph and etc. This can - also be used to load checkpoints from the directory into a estimator - to continue training a previously saved model. -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. It - will be multiplied by the loss of the example. -* `linear_feature_columns`: An iterable containing all the feature columns - used by linear part of the model. All items in the set must be - instances of classes derived from `FeatureColumn`. -* `linear_optimizer`: An instance of `tf.Optimizer` used to apply gradients to - the linear part of the model. If `None`, will use a FTRL optimizer. - _joint_linear_weights: If True a single (possibly partitioned) variable - will be used to store the linear model weights. It's faster, but - requires that all columns are sparse and have the 'sum' combiner. - -* `dnn_feature_columns`: An iterable containing all the feature columns used - by deep part of the model. All items in the set must be instances of - classes derived from `FeatureColumn`. -* `dnn_optimizer`: An instance of `tf.Optimizer` used to apply gradients to - the deep part of the model. If `None`, will use an Adagrad optimizer. -* `dnn_hidden_units`: List of hidden units per layer. All layers are fully - connected. -* `dnn_activation_fn`: Activation function applied to each layer. If None, - will use `tf.nn.relu`. -* `dnn_dropout`: When not None, the probability we will drop out - a given coordinate. -* `gradient_clip_norm`: A float > 0. If provided, gradients are clipped - to their global norm with this clipping ratio. See - tf.clip_by_global_norm for more details. -* `enable_centered_bias`: A bool. If True, estimator will learn a centered - bias variable for each class. Rest of the model structure learns the - residual after centered bias. -* `label_dimension`: Number of regression targets per example. This is the - size of the last dimension of the labels and logits `Tensor` objects - (typically, these have shape `[batch_size, label_dimension]`). -* `config`: RunConfig object to configure the runtime settings. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into the model. -* `embedding_lr_multipliers`: Optional. A dictionary from `EmbeddingColumn` to - a `float` multiplier. Multiplier will be used to multiply with - learning rate for the embedding variables. -* `input_layer_min_slice_size`: Optional. The min slice size of input layer - partitions. If not provided, will use the default of 64M. - - -##### Raises: - - -* `ValueError`: If both linear_feature_columns and dnn_features_columns are - empty at the same time. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.__repr__()` {#DNNLinearCombinedRegressor.__repr__} - - - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.config` {#DNNLinearCombinedRegressor.config} - - - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.evaluate(x=None, y=None, input_fn=None, feed_fn=None, batch_size=None, steps=None, metrics=None, name=None, checkpoint_path=None, hooks=None)` {#DNNLinearCombinedRegressor.evaluate} - -See evaluable.Evaluable. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.export(export_dir, input_fn=None, input_feature_key=None, use_deprecated_input_fn=True, signature_fn=None, default_batch_size=1, exports_to_keep=None)` {#DNNLinearCombinedRegressor.export} - -See BaseEstimator.export. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#DNNLinearCombinedRegressor.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.fit(*args, **kwargs)` {#DNNLinearCombinedRegressor.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.get_params(deep=True)` {#DNNLinearCombinedRegressor.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.get_variable_names()` {#DNNLinearCombinedRegressor.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.get_variable_value(name)` {#DNNLinearCombinedRegressor.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.model_dir` {#DNNLinearCombinedRegressor.model_dir} - - - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.partial_fit(*args, **kwargs)` {#DNNLinearCombinedRegressor.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.predict(*args, **kwargs)` {#DNNLinearCombinedRegressor.predict} - -Returns predictions for given features. (deprecated arguments) (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2017-03-01. -Instructions for updating: -Please switch to predict_scores, or set `outputs` argument. - -By default, returns predicted scores. But this default will be dropped -soon. Users should either pass `outputs`, or call `predict_scores` method. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns scores. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted scores (or an iterable of predicted scores if - as_iterable is True). If `label_dimension == 1`, the shape of the output - is `[batch_size]`, otherwise the shape is `[batch_size, label_dimension]`. - If `outputs` is set, returns a dict of predictions. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.predict_scores(*args, **kwargs)` {#DNNLinearCombinedRegressor.predict_scores} - -Returns predicted scores for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted scores (or an iterable of predicted scores if - as_iterable is True). If `label_dimension == 1`, the shape of the output - is `[batch_size]`, otherwise the shape is `[batch_size, label_dimension]`. - - -- - - - -#### `tf.contrib.learn.DNNLinearCombinedRegressor.set_params(**params)` {#DNNLinearCombinedRegressor.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.DNNRegressor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.DNNRegressor.md deleted file mode 100644 index 017234aa0c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.DNNRegressor.md +++ /dev/null @@ -1,393 +0,0 @@ -A regressor for TensorFlow DNN models. - -Example: - -```python -sparse_feature_a = sparse_column_with_hash_bucket(...) -sparse_feature_b = sparse_column_with_hash_bucket(...) - -sparse_feature_a_emb = embedding_column(sparse_id_column=sparse_feature_a, - ...) -sparse_feature_b_emb = embedding_column(sparse_id_column=sparse_feature_b, - ...) - -estimator = DNNRegressor( - feature_columns=[sparse_feature_a, sparse_feature_b], - hidden_units=[1024, 512, 256]) - -# Or estimator using the ProximalAdagradOptimizer optimizer with -# regularization. -estimator = DNNRegressor( - feature_columns=[sparse_feature_a, sparse_feature_b], - hidden_units=[1024, 512, 256], - optimizer=tf.train.ProximalAdagradOptimizer( - learning_rate=0.1, - l1_regularization_strength=0.001 - )) - -# Input builders -def input_fn_train: # returns x, y - pass -estimator.fit(input_fn=input_fn_train) - -def input_fn_eval: # returns x, y - pass -estimator.evaluate(input_fn=input_fn_eval) -estimator.predict(x=x) -``` - -Input of `fit` and `evaluate` should have following features, - otherwise there will be a `KeyError`: - -* if `weight_column_name` is not `None`, a feature with - `key=weight_column_name` whose value is a `Tensor`. -* for each `column` in `feature_columns`: - - if `column` is a `SparseColumn`, a feature with `key=column.name` - whose `value` is a `SparseTensor`. - - if `column` is a `WeightedSparseColumn`, two features: the first with - `key` the id column name, the second with `key` the weight column name. - Both features' `value` must be a `SparseTensor`. - - if `column` is a `RealValuedColumn`, a feature with `key=column.name` - whose `value` is a `Tensor`. -- - - - -#### `tf.contrib.learn.DNNRegressor.__init__(hidden_units, feature_columns, model_dir=None, weight_column_name=None, optimizer=None, activation_fn=relu, dropout=None, gradient_clip_norm=None, enable_centered_bias=False, config=None, feature_engineering_fn=None, label_dimension=1, embedding_lr_multipliers=None, input_layer_min_slice_size=None)` {#DNNRegressor.__init__} - -Initializes a `DNNRegressor` instance. - -##### Args: - - -* `hidden_units`: List of hidden units per layer. All layers are fully - connected. Ex. `[64, 32]` means first layer has 64 nodes and second one - has 32. -* `feature_columns`: An iterable containing all the feature columns used by - the model. All items in the set should be instances of classes derived - from `FeatureColumn`. -* `model_dir`: Directory to save model parameters, graph and etc. This can - also be used to load checkpoints from the directory into a estimator to - continue training a previously saved model. -* `weight_column_name`: A string defining feature column name representing - weights. It is used to down weight or boost examples during training. It - will be multiplied by the loss of the example. -* `optimizer`: An instance of `tf.Optimizer` used to train the model. If - `None`, will use an Adagrad optimizer. -* `activation_fn`: Activation function applied to each layer. If `None`, will - use `tf.nn.relu`. -* `dropout`: When not `None`, the probability we will drop out a given - coordinate. -* `gradient_clip_norm`: A `float` > 0. If provided, gradients are clipped - to their global norm with this clipping ratio. See - `tf.clip_by_global_norm` for more details. -* `enable_centered_bias`: A bool. If True, estimator will learn a centered - bias variable for each class. Rest of the model structure learns the - residual after centered bias. -* `config`: `RunConfig` object to configure the runtime settings. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into the model. -* `label_dimension`: Number of regression targets per example. This is the - size of the last dimension of the labels and logits `Tensor` objects - (typically, these have shape `[batch_size, label_dimension]`). -* `embedding_lr_multipliers`: Optional. A dictionary from `EbeddingColumn` to - a `float` multiplier. Multiplier will be used to multiply with - learning rate for the embedding variables. -* `input_layer_min_slice_size`: Optional. The min slice size of input layer - partitions. If not provided, will use the default of 64M. - -##### Returns: - - A `DNNRegressor` estimator. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.__repr__()` {#DNNRegressor.__repr__} - - - - -- - - - -#### `tf.contrib.learn.DNNRegressor.config` {#DNNRegressor.config} - - - - -- - - - -#### `tf.contrib.learn.DNNRegressor.evaluate(x=None, y=None, input_fn=None, feed_fn=None, batch_size=None, steps=None, metrics=None, name=None, checkpoint_path=None, hooks=None)` {#DNNRegressor.evaluate} - -See evaluable.Evaluable. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.export(export_dir, input_fn=None, input_feature_key=None, use_deprecated_input_fn=True, signature_fn=None, default_batch_size=1, exports_to_keep=None)` {#DNNRegressor.export} - -See BaseEstimator.export. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.export_savedmodel(export_dir_base, serving_input_fn, default_output_alternative_key=None, assets_extra=None, as_text=False, checkpoint_path=None)` {#DNNRegressor.export_savedmodel} - -Exports inference graph as a SavedModel into given dir. - -##### Args: - - -* `export_dir_base`: A string containing a directory to write the exported - graph and checkpoints. -* `serving_input_fn`: A function that takes no argument and - returns an `InputFnOps`. -* `default_output_alternative_key`: the name of the head to serve when none is - specified. Not needed for single-headed models. -* `assets_extra`: A dict specifying how to populate the assets.extra directory - within the exported SavedModel. Each key should give the destination - path (including the filename) relative to the assets.extra directory. - The corresponding value gives the full path of the source file to be - copied. For example, the simple case of copying a single file without - renaming it is specified as - `{'my_asset_file.txt': '/path/to/my_asset_file.txt'}`. -* `as_text`: whether to write the SavedModel proto in text format. -* `checkpoint_path`: The checkpoint path to export. If None (the default), - the most recent checkpoint found within the model directory is chosen. - -##### Returns: - - The string path to the exported directory. - -##### Raises: - - -* `ValueError`: if an unrecognized export_type is requested. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.fit(*args, **kwargs)` {#DNNRegressor.fit} - -See `Trainable`. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -##### Raises: - - -* `ValueError`: If `x` or `y` are not `None` while `input_fn` is not `None`. -* `ValueError`: If both `steps` and `max_steps` are not `None`. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.get_params(deep=True)` {#DNNRegressor.get_params} - -Get parameters for this estimator. - -##### Args: - - -* `deep`: boolean, optional - - If `True`, will return the parameters for this estimator and - contained subobjects that are estimators. - -##### Returns: - - params : mapping of string to any - Parameter names mapped to their values. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.get_variable_names()` {#DNNRegressor.get_variable_names} - -Returns list of all variable names in this model. - -##### Returns: - - List of names. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.get_variable_value(name)` {#DNNRegressor.get_variable_value} - -Returns value of the variable given by name. - -##### Args: - - -* `name`: string, name of the tensor. - -##### Returns: - - Numpy array - value of the tensor. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.model_dir` {#DNNRegressor.model_dir} - - - - -- - - - -#### `tf.contrib.learn.DNNRegressor.partial_fit(*args, **kwargs)` {#DNNRegressor.partial_fit} - -Incremental fit on a batch of samples. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-12-01. -Instructions for updating: -Estimator is decoupled from Scikit Learn interface by moving into -separate class SKCompat. Arguments x, y and batch_size are only -available in the SKCompat class, Estimator will only accept input_fn. - -##### Example conversion: - - est = Estimator(...) -> est = SKCompat(Estimator(...)) - -This method is expected to be called several times consecutively -on different or the same chunks of the dataset. This either can -implement iterative training or out-of-core/online training. - -This is especially useful when the whole dataset is too big to -fit in memory at the same time. Or when model is taking long time -to converge, and you want to split up training into subparts. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...]. Can be iterator that - returns arrays of features. The training input samples for fitting the - model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs]. Can be - iterator that returns array of labels. The training label values - (class labels in classification, real numbers in regression). If set, - `input_fn` must be `None`. -* `input_fn`: Input function. If set, `x`, `y`, and `batch_size` must be - `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. - -##### Returns: - - `self`, for chaining. - -##### Raises: - - -* `ValueError`: If at least one of `x` and `y` is provided, and `input_fn` is - provided. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.predict(*args, **kwargs)` {#DNNRegressor.predict} - -Returns predictions for given features. (deprecated arguments) (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2017-03-01. -Instructions for updating: -Please switch to predict_scores, or set `outputs` argument. - -By default, returns predicted scores. But this default will be dropped -soon. Users should either pass `outputs`, or call `predict_scores` method. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `outputs`: list of `str`, name of the output to predict. - If `None`, returns scores. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted scores (or an iterable of predicted scores if - as_iterable is True). If `label_dimension == 1`, the shape of the output - is `[batch_size]`, otherwise the shape is `[batch_size, label_dimension]`. - If `outputs` is set, returns a dict of predictions. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.predict_scores(*args, **kwargs)` {#DNNRegressor.predict_scores} - -Returns predicted scores for given features. (deprecated arguments) - -SOME ARGUMENTS ARE DEPRECATED. They will be removed after 2016-09-15. -Instructions for updating: -The default behavior of predict() is changing. The default value for -as_iterable will change to True, and then the flag will be removed -altogether. The behavior of this flag is described below. - -##### Args: - - -* `x`: features. -* `input_fn`: Input function. If set, x must be None. -* `batch_size`: Override default batch size. -* `as_iterable`: If True, return an iterable which keeps yielding predictions - for each example until inputs are exhausted. Note: The inputs must - terminate if you want the iterable to terminate (e.g. be sure to pass - num_epochs=1 if you are using something like read_batch_features). - -##### Returns: - - Numpy array of predicted scores (or an iterable of predicted scores if - as_iterable is True). If `label_dimension == 1`, the shape of the output - is `[batch_size]`, otherwise the shape is `[batch_size, label_dimension]`. - - -- - - - -#### `tf.contrib.learn.DNNRegressor.set_params(**params)` {#DNNRegressor.set_params} - -Set the parameters of this estimator. - -The method works on simple estimators as well as on nested objects -(such as pipelines). The former have parameters of the form -``__`` so that it's possible to update each -component of a nested object. - -##### Args: - - -* `**params`: Parameters. - -##### Returns: - - self - -##### Raises: - - -* `ValueError`: If params contain invalid names. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.InputFnOps.__new__.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.InputFnOps.__new__.md deleted file mode 100644 index 147c6e6ed8..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.InputFnOps.__new__.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.contrib.learn.InputFnOps.__new__(_cls, features, labels, default_inputs)` {#InputFnOps.__new__} - -Create new instance of InputFnOps(features, labels, default_inputs) - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.LogisticRegressor.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.LogisticRegressor.md deleted file mode 100644 index 3b420913ed..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.LogisticRegressor.md +++ /dev/null @@ -1,45 +0,0 @@ -### `tf.contrib.learn.LogisticRegressor(model_fn, thresholds=None, model_dir=None, config=None, feature_engineering_fn=None)` {#LogisticRegressor} - -Builds a logistic regression Estimator for binary classification. - -This method provides a basic Estimator with some additional metrics for custom -binary classification models, including AUC, precision/recall and accuracy. - -Example: - -```python - # See tf.contrib.learn.Estimator(...) for details on model_fn structure - def my_model_fn(...): - pass - - estimator = LogisticRegressor(model_fn=my_model_fn) - - # Input builders - def input_fn_train: - pass - - estimator.fit(input_fn=input_fn_train) - estimator.predict(x=x) -``` - -##### Args: - - -* `model_fn`: Model function with the signature: - `(features, labels, mode) -> (predictions, loss, train_op)`. - Expects the returned predictions to be probabilities in [0.0, 1.0]. -* `thresholds`: List of floating point thresholds to use for accuracy, - precision, and recall metrics. If `None`, defaults to `[0.5]`. -* `model_dir`: Directory to save model parameters, graphs, etc. This can also - be used to load checkpoints from the directory into a estimator to - continue training a previously saved model. -* `config`: A RunConfig configuration object. -* `feature_engineering_fn`: Feature engineering function. Takes features and - labels which are the output of `input_fn` and - returns features and labels which will be fed - into the model. - -##### Returns: - - A `tf.contrib.learn.Estimator` instance. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.Trainable.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.Trainable.md deleted file mode 100644 index 944903d1f0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.Trainable.md +++ /dev/null @@ -1,45 +0,0 @@ -Interface for objects that are trainable by, e.g., `Experiment`. -- - - - -#### `tf.contrib.learn.Trainable.fit(x=None, y=None, input_fn=None, steps=None, batch_size=None, monitors=None, max_steps=None)` {#Trainable.fit} - -Trains a model given training data `x` predictions and `y` labels. - -##### Args: - - -* `x`: Matrix of shape [n_samples, n_features...] or the dictionary of Matrices. - Can be iterator that returns arrays of features or dictionary of arrays of features. - The training input samples for fitting the model. If set, `input_fn` must be `None`. -* `y`: Vector or matrix [n_samples] or [n_samples, n_outputs] or the dictionary of same. - Can be iterator that returns array of labels or dictionary of array of labels. - The training label values (class labels in classification, real numbers in regression). - If set, `input_fn` must be `None`. Note: For classification, label values must - be integers representing the class index (i.e. values from 0 to - n_classes-1). -* `input_fn`: Input function returning a tuple of: - features - `Tensor` or dictionary of string feature name to `Tensor`. - labels - `Tensor` or dictionary of `Tensor` with labels. - If input_fn is set, `x`, `y`, and `batch_size` must be `None`. -* `steps`: Number of steps for which to train model. If `None`, train forever. - 'steps' works incrementally. If you call two times fit(steps=10) then - training occurs in total 20 steps. If you don't want to have incremental - behaviour please set `max_steps` instead. If set, `max_steps` must be - `None`. -* `batch_size`: minibatch size to use on the input, defaults to first - dimension of `x`. Must be `None` if `input_fn` is provided. -* `monitors`: List of `BaseMonitor` subclass instances. Used for callbacks - inside the training loop. -* `max_steps`: Number of total steps for which to train model. If `None`, - train forever. If set, `steps` must be `None`. - - Two calls to `fit(steps=100)` means 200 training - iterations. On the other hand, two calls to `fit(max_steps=100)` means - that the second call will not do any iteration since first call did - all 100 steps. - -##### Returns: - - `self`, for chaining. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.infer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.infer.md deleted file mode 100644 index 32268ffd16..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.infer.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.contrib.learn.infer(*args, **kwargs)` {#infer} - -Restore graph from `restore_checkpoint_path` and run `output_dict` tensors. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-02-15. -Instructions for updating: -graph_actions.py will be deleted. Use tf.train.* utilities instead. You can use learn/estimators/estimator.py as an example. - -If `restore_checkpoint_path` is supplied, restore from checkpoint. Otherwise, -init all variables. - -##### Args: - - -* `restore_checkpoint_path`: A string containing the path to a checkpoint to - restore. -* `output_dict`: A `dict` mapping string names to `Tensor` objects to run. - Tensors must all be from the same graph. -* `feed_dict`: `dict` object mapping `Tensor` objects to input values to feed. - -##### Returns: - - Dict of values read from `output_dict` tensors. Keys are the same as - `output_dict`, values are the results read from the corresponding `Tensor` - in `output_dict`. - -##### Raises: - - -* `ValueError`: if `output_dict` or `feed_dicts` is None or empty. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.monitors.LoggingTrainable.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.monitors.LoggingTrainable.md deleted file mode 100644 index 1d94d6e1f3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.learn.monitors.LoggingTrainable.md +++ /dev/null @@ -1,184 +0,0 @@ -Writes trainable variable values into log every N steps. - -Write the tensors in trainable variables `every_n` steps, -starting with the `first_n`th step. -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.__init__(scope=None, every_n=100, first_n=1)` {#LoggingTrainable.__init__} - -Initializes LoggingTrainable monitor. - -##### Args: - - -* `scope`: An optional string to match variable names using re.match. -* `every_n`: Print every N steps. -* `first_n`: Print first N steps. - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.begin(max_steps=None)` {#LoggingTrainable.begin} - -Called at the beginning of training. - -When called, the default graph is the one we are executing. - -##### Args: - - -* `max_steps`: `int`, the maximum global step this training will run until. - -##### Raises: - - -* `ValueError`: if we've already begun a run. - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.end(session=None)` {#LoggingTrainable.end} - - - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.epoch_begin(epoch)` {#LoggingTrainable.epoch_begin} - -Begin epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've already begun an epoch, or `epoch` < 0. - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.epoch_end(epoch)` {#LoggingTrainable.epoch_end} - -End epoch. - -##### Args: - - -* `epoch`: `int`, the epoch number. - -##### Raises: - - -* `ValueError`: if we've not begun an epoch, or `epoch` number does not match. - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.every_n_post_step(step, session)` {#LoggingTrainable.every_n_post_step} - -Callback after a step is finished or `end()` is called. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `session`: `Session` object. - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.every_n_step_begin(step)` {#LoggingTrainable.every_n_step_begin} - - - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.every_n_step_end(step, outputs)` {#LoggingTrainable.every_n_step_end} - - - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.post_step(step, session)` {#LoggingTrainable.post_step} - - - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.run_on_all_workers` {#LoggingTrainable.run_on_all_workers} - - - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.set_estimator(estimator)` {#LoggingTrainable.set_estimator} - -A setter called automatically by the target estimator. - -If the estimator is locked, this method does nothing. - -##### Args: - - -* `estimator`: the estimator that this monitor monitors. - -##### Raises: - - -* `ValueError`: if the estimator is None. - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.step_begin(step)` {#LoggingTrainable.step_begin} - -Overrides `BaseMonitor.step_begin`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. - -##### Returns: - - A `list`, the result of every_n_step_begin, if that was called this step, - or an empty list otherwise. - -##### Raises: - - -* `ValueError`: if called more than once during a step. - - -- - - - -#### `tf.contrib.learn.monitors.LoggingTrainable.step_end(step, output)` {#LoggingTrainable.step_end} - -Overrides `BaseMonitor.step_end`. - -When overriding this method, you must call the super implementation. - -##### Args: - - -* `step`: `int`, the current value of the global step. -* `output`: `dict` mapping `string` values representing tensor names to - the value resulted from running these tensors. Values may be either - scalars, for scalar tensors, or Numpy `array`, for non-scalar tensors. - -##### Returns: - - `bool`, the result of every_n_step_end, if that was called this step, - or `False` otherwise. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.legacy_seq2seq.embedding_tied_rnn_seq2seq.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.legacy_seq2seq.embedding_tied_rnn_seq2seq.md deleted file mode 100644 index 2d628aa16a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.legacy_seq2seq.embedding_tied_rnn_seq2seq.md +++ /dev/null @@ -1,53 +0,0 @@ -### `tf.contrib.legacy_seq2seq.embedding_tied_rnn_seq2seq(encoder_inputs, decoder_inputs, cell, num_symbols, embedding_size, num_decoder_symbols=None, output_projection=None, feed_previous=False, dtype=None, scope=None)` {#embedding_tied_rnn_seq2seq} - -Embedding RNN sequence-to-sequence model with tied (shared) parameters. - -This model first embeds encoder_inputs by a newly created embedding (of shape -[num_symbols x input_size]). Then it runs an RNN to encode embedded -encoder_inputs into a state vector. Next, it embeds decoder_inputs using -the same embedding. Then it runs RNN decoder, initialized with the last -encoder state, on embedded decoder_inputs. The decoder output is over symbols -from 0 to num_decoder_symbols - 1 if num_decoder_symbols is none; otherwise it -is over 0 to num_symbols - 1. - -##### Args: - - -* `encoder_inputs`: A list of 1D int32 Tensors of shape [batch_size]. -* `decoder_inputs`: A list of 1D int32 Tensors of shape [batch_size]. -* `cell`: core_rnn_cell.RNNCell defining the cell function and size. -* `num_symbols`: Integer; number of symbols for both encoder and decoder. -* `embedding_size`: Integer, the length of the embedding vector for each symbol. -* `num_decoder_symbols`: Integer; number of output symbols for decoder. If - provided, the decoder output is over symbols 0 to num_decoder_symbols - 1. - Otherwise, decoder output is over symbols 0 to num_symbols - 1. Note that - this assumes that the vocabulary is set up such that the first - num_decoder_symbols of num_symbols are part of decoding. -* `output_projection`: None or a pair (W, B) of output projection weights and - biases; W has shape [output_size x num_symbols] and B has - shape [num_symbols]; if provided and feed_previous=True, each - fed previous output will first be multiplied by W and added B. -* `feed_previous`: Boolean or scalar Boolean Tensor; if True, only the first - of decoder_inputs will be used (the "GO" symbol), and all other decoder - inputs will be taken from previous outputs (as in embedding_rnn_decoder). - If False, decoder_inputs are used as given (the standard decoder case). -* `dtype`: The dtype to use for the initial RNN states (default: tf.float32). -* `scope`: VariableScope for the created subgraph; defaults to - "embedding_tied_rnn_seq2seq". - -##### Returns: - - A tuple of the form (outputs, state), where: - -* `outputs`: A list of the same length as decoder_inputs of 2D Tensors with - shape [batch_size x output_symbols] containing the generated - outputs where output_symbols = num_decoder_symbols if - num_decoder_symbols is not None otherwise output_symbols = num_symbols. -* `state`: The state of each decoder cell at the final time-step. - It is a 2D Tensor of shape [batch_size x cell.state_size]. - -##### Raises: - - -* `ValueError`: When output_projection has the wrong shape. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.linalg.LinearOperator.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.linalg.LinearOperator.md deleted file mode 100644 index 1d9ba477a7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.linalg.LinearOperator.md +++ /dev/null @@ -1,553 +0,0 @@ -Base class defining a [batch of] linear operator[s]. - -Subclasses of `LinearOperator` provide a access to common methods on a -(batch) matrix, without the need to materialize the matrix. This allows: - -* Matrix free computations -* Operators that take advantage of special structure, while providing a - consistent API to users. - -#### Subclassing - -To enable a public method, subclasses should implement the leading-underscore -version of the method. The argument signature should be identical except for -the omission of `name="..."`. For example, to enable -`apply(x, adjoint=False, name="apply")` a subclass should implement -`_apply(x, adjoint=False)`. - -#### Performance contract - -Subclasses should implement a method only if it can be done with a reasonable -performance increase over generic dense operations, either in time, parallel -scalability, or memory usage. For example, if the determinant can only be -computed using `tf.matrix_determinant(self.to_dense())`, then determinants -should not be implemented. - -Class docstrings should contain an explanation of computational complexity. -Since this is a high-performance library, attention should be paid to detail, -and explanations can include constants as well as Big-O notation. - -#### Shape compatibility - -`LinearOperator` sub classes should operate on a [batch] matrix with -compatible shape. Class docstrings should define what is meant by compatible -shape. Some sub-classes may not support batching. - -An example is: - -`x` is a batch matrix with compatible shape for `apply` if - -``` -operator.shape = [B1,...,Bb] + [M, N], b >= 0, -x.shape = [B1,...,Bb] + [N, R] -``` - -`rhs` is a batch matrix with compatible shape for `solve` if - -``` -operator.shape = [B1,...,Bb] + [M, N], b >= 0, -rhs.shape = [B1,...,Bb] + [M, R] -``` - -#### Example docstring for subclasses. - -This operator acts like a (batch) matrix `A` with shape -`[B1,...,Bb, M, N]` for some `b >= 0`. The first `b` indices index a -batch member. For every batch index `(i1,...,ib)`, `A[i1,...,ib, : :]` is -an `m x n` matrix. Again, this matrix `A` may not be materialized, but for -purposes of identifying and working with compatible arguments the shape is -relevant. - -Examples: - -```python -some_tensor = ... shape = ???? -operator = MyLinOp(some_tensor) - -operator.shape() -==> [2, 4, 4] - -operator.log_determinant() -==> Shape [2] Tensor - -x = ... Shape [2, 4, 5] Tensor - -operator.apply(x) -==> Shape [2, 4, 5] Tensor -``` - -#### Shape compatibility - -This operator acts on batch matrices with compatible shape. -FILL IN WHAT IS MEANT BY COMPATIBLE SHAPE - -#### Performance - -FILL THIS IN - -#### Matrix property hints - -This `LinearOperator` is initialized with boolean flags of the form `is_X`, -for `X = non_singular, self_adjoint, positive_definite, square`. -These have the following meaning -* If `is_X == True`, callers should expect the operator to have the - property `X`. This is a promise that should be fulfilled, but is *not* a - runtime assert. For example, finite floating point precision may result - in these promises being violated. -* If `is_X == False`, callers should expect the operator to not have `X`. -* If `is_X == None` (the default), callers should have no expectation either - way. -- - - - -#### `tf.contrib.linalg.LinearOperator.__init__(dtype, graph_parents=None, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, is_square=None, name=None)` {#LinearOperator.__init__} - -Initialize the `LinearOperator`. - -**This is a private method for subclass use.** -**Subclasses should copy-paste this `__init__` documentation.** - -##### Args: - - -* `dtype`: The type of the this `LinearOperator`. Arguments to `apply` and - `solve` will have to be this type. -* `graph_parents`: Python list of graph prerequisites of this `LinearOperator` - Typically tensors that are passed during initialization. -* `is_non_singular`: Expect that this operator is non-singular. -* `is_self_adjoint`: Expect that this operator is equal to its hermitian - transpose. If `dtype` is real, this is equivalent to being symmetric. -* `is_positive_definite`: Expect that this operator is positive definite, - meaning the real part of all eigenvalues is positive. We do not require - the operator to be self-adjoint to be positive-definite. See: -* `https`: //en.wikipedia.org/wiki/Positive-definite_matrix\ - #Extension_for_non_symmetric_matrices -* `is_square`: Expect that this operator acts like square [batch] matrices. -* `name`: A name for this `LinearOperator`. - -##### Raises: - - -* `ValueError`: If any member of graph_parents is `None` or not a `Tensor`. -* `ValueError`: If hints are set incorrectly. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.add_to_tensor(x, name='add_to_tensor')` {#LinearOperator.add_to_tensor} - -Add matrix represented by this operator to `x`. Equivalent to `A + x`. - -##### Args: - - -* `x`: `Tensor` with same `dtype` and shape broadcastable to `self.shape`. -* `name`: A name to give this `Op`. - -##### Returns: - - A `Tensor` with broadcast shape and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.apply(x, adjoint=False, name='apply')` {#LinearOperator.apply} - -Transform `x` with left multiplication: `x --> Ax`. - -##### Args: - - -* `x`: `Tensor` with compatible shape and same `dtype` as `self`. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, left multiply by the adjoint. -* `name`: A name for this `Op. - -##### Returns: - - A `Tensor` with shape `[..., M, R]` and same `dtype` as `self`. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.assert_non_singular(name='assert_non_singular')` {#LinearOperator.assert_non_singular} - -Returns an `Op` that asserts this operator is non singular. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.assert_positive_definite(name='assert_positive_definite')` {#LinearOperator.assert_positive_definite} - -Returns an `Op` that asserts this operator is positive definite. - -Here, positive definite means the real part of all eigenvalues is positive. -We do not require the operator to be self-adjoint. - -##### Args: - - -* `name`: A name to give this `Op`. - -##### Returns: - - An `Op` that asserts this operator is positive definite. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.assert_self_adjoint(name='assert_self_adjoint')` {#LinearOperator.assert_self_adjoint} - -Returns an `Op` that asserts this operator is self-adjoint. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.batch_shape` {#LinearOperator.batch_shape} - -`TensorShape` of batch dimensions of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb])`, equivalent to `A.get_shape()[:-2]` - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.batch_shape_tensor(name='batch_shape_tensor')` {#LinearOperator.batch_shape_tensor} - -Shape of batch dimensions of this operator, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb]`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperator.determinant(name='det')` {#LinearOperator.determinant} - -Determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.diag_part(name='diag_part')` {#LinearOperator.diag_part} - -Efficiently get the [batch] diagonal part of this operator. - -If this operator has shape `[B1,...,Bb, M, N]`, this returns a -`Tensor` `diagonal`, of shape `[B1,...,Bb, min(M, N)]`, where -`diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]`. - -``` -my_operator = LinearOperatorDiag([1., 2.]) - -# Efficiently get the diagonal -my_operator.diag_part() -==> [1., 2.] - -# Equivalent, but inefficient method -tf.matrix_diag_part(my_operator.to_dense()) -==> [1., 2.] -``` - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - -* `diag_part`: A `Tensor` of same `dtype` as self. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.domain_dimension` {#LinearOperator.domain_dimension} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.domain_dimension_tensor(name='domain_dimension_tensor')` {#LinearOperator.domain_dimension_tensor} - -Dimension (in the sense of vector spaces) of the domain of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `N`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperator.dtype` {#LinearOperator.dtype} - -The `DType` of `Tensor`s handled by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.graph_parents` {#LinearOperator.graph_parents} - -List of graph dependencies of this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.is_non_singular` {#LinearOperator.is_non_singular} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperator.is_positive_definite` {#LinearOperator.is_positive_definite} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperator.is_self_adjoint` {#LinearOperator.is_self_adjoint} - - - - -- - - - -#### `tf.contrib.linalg.LinearOperator.is_square` {#LinearOperator.is_square} - -Return `True/False` depending on if this operator is square. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.log_abs_determinant(name='log_abs_det')` {#LinearOperator.log_abs_determinant} - -Log absolute value of determinant for every batch member. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `Tensor` with shape `self.batch_shape` and same `dtype` as `self`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_square` is `False`. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.name` {#LinearOperator.name} - -Name prepended to all ops created by this `LinearOperator`. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.range_dimension` {#LinearOperator.range_dimension} - -Dimension (in the sense of vector spaces) of the range of this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Returns: - - `Dimension` object. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.range_dimension_tensor(name='range_dimension_tensor')` {#LinearOperator.range_dimension_tensor} - -Dimension (in the sense of vector spaces) of the range of this operator. - -Determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `M`. - -##### Args: - - -* `name`: A name for this `Op`. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperator.shape` {#LinearOperator.shape} - -`TensorShape` of this `LinearOperator`. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns -`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.get_shape()`. - -##### Returns: - - `TensorShape`, statically determined, may be undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.shape_tensor(name='shape_tensor')` {#LinearOperator.shape_tensor} - -Shape of this `LinearOperator`, determined at runtime. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns a `Tensor` holding -`[B1,...,Bb, M, N]`, equivalent to `tf.shape(A)`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor` - - -- - - - -#### `tf.contrib.linalg.LinearOperator.solve(rhs, adjoint=False, name='solve')` {#LinearOperator.solve} - -Solve `R` (batch) systems of equations exactly: `A X = rhs`. - -Examples: - -```python -# Create an operator acting like a 10 x 2 x 2 matrix. -operator = LinearOperator(...) -operator.shape # = 10 x 2 x 2 - -# Solve one linear system (R = 1) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 1 -X = operator.solve(RHS) # shape 10 x 2 x 1 - -# Solve five linear systems (R = 5) for every member of the length 10 batch. -RHS = ... # shape 10 x 2 x 5 -X = operator.solve(RHS) -X[3, :, 2] # Solution to the linear system A[3, :, :] X = RHS[3, :, 2] -``` - -##### Args: - - -* `rhs`: `Tensor` with same `dtype` as this operator and compatible shape. - See class docstring for definition of compatibility. -* `adjoint`: Python `bool`. If `True`, solve the system involving the adjoint - of this `LinearOperator`. -* `name`: A name scope to use for ops added by this method. - -##### Returns: - - `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`. - -##### Raises: - - -* `NotImplementedError`: If `self.is_non_singular` or `is_square` is False. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.tensor_rank` {#LinearOperator.tensor_rank} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - Python integer, or None if the tensor rank is undefined. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.tensor_rank_tensor(name='tensor_rank_tensor')` {#LinearOperator.tensor_rank_tensor} - -Rank (in the sense of tensors) of matrix corresponding to this operator. - -If this operator acts like the batch matrix `A` with -`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`. - -##### Args: - - -* `name`: A name for this `Op. - -##### Returns: - - `int32` `Tensor`, determined at runtime. - - -- - - - -#### `tf.contrib.linalg.LinearOperator.to_dense(name='to_dense')` {#LinearOperator.to_dense} - -Return a dense (batch) matrix representing this operator. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.losses.get_total_loss.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.losses.get_total_loss.md deleted file mode 100644 index 533121794f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.losses.get_total_loss.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.contrib.losses.get_total_loss(*args, **kwargs)` {#get_total_loss} - -Returns a tensor whose value represents the total loss. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.get_total_loss instead. - -Notice that the function adds the given losses to the regularization losses. - -##### Args: - - -* `add_regularization_losses`: A boolean indicating whether or not to use the - regularization losses in the sum. -* `name`: The name of the returned tensor. - -##### Returns: - - A `Tensor` whose value represents the total loss. - -##### Raises: - - -* `ValueError`: if `losses` is not iterable. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.losses.mean_pairwise_squared_error.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.losses.mean_pairwise_squared_error.md deleted file mode 100644 index 6d42afbbca..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.losses.mean_pairwise_squared_error.md +++ /dev/null @@ -1,49 +0,0 @@ -### `tf.contrib.losses.mean_pairwise_squared_error(*args, **kwargs)` {#mean_pairwise_squared_error} - -Adds a pairwise-errors-squared loss to the training procedure. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2016-12-30. -Instructions for updating: -Use tf.losses.mean_pairwise_squared_error instead. Note that the order of the predictions and labels arguments was changed. - -Unlike `mean_squared_error`, which is a measure of the differences between -corresponding elements of `predictions` and `labels`, -`mean_pairwise_squared_error` is a measure of the differences between pairs of -corresponding elements of `predictions` and `labels`. - -For example, if `labels`=[a, b, c] and `predictions`=[x, y, z], there are -three pairs of differences are summed to compute the loss: - loss = [ ((a-b) - (x-y)).^2 + ((a-c) - (x-z)).^2 + ((b-c) - (y-z)).^2 ] / 3 - -Note that since the inputs are of size [batch_size, d0, ... dN], the -corresponding pairs are computed within each batch sample but not across -samples within a batch. For example, if `predictions` represents a batch of -16 grayscale images of dimension [batch_size, 100, 200], then the set of pairs -is drawn from each image, but not across images. - -`weights` acts as a coefficient for the loss. If a scalar is provided, then -the loss is simply scaled by the given value. If `weights` is a tensor of size -[batch_size], then the total loss for each sample of the batch is rescaled -by the corresponding element in the `weights` vector. - -##### Args: - - -* `predictions`: The predicted outputs, a tensor of size [batch_size, d0, .. dN] - where N+1 is the total number of dimensions in `predictions`. -* `labels`: The ground truth output tensor, whose shape must match the shape of - the `predictions` tensor. -* `weights`: Coefficients for the loss a scalar, a tensor of shape [batch_size] - or a tensor whose shape matches `predictions`. -* `scope`: The scope for the operations performed in computing the loss. - -##### Returns: - - A scalar `Tensor` representing the loss value. - -##### Raises: - - -* `ValueError`: If the shape of `predictions` doesn't match that of `labels` or - if the shape of `weights` is invalid. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.metrics.aggregate_metric_map.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.metrics.aggregate_metric_map.md deleted file mode 100644 index fd4d3733c6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.metrics.aggregate_metric_map.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.contrib.metrics.aggregate_metric_map(names_to_tuples)` {#aggregate_metric_map} - -Aggregates the metric names to tuple dictionary. - -This function is useful for pairing metric names with their associated value -and update ops when the list of metrics is long. For example: - -```python - metrics_to_values, metrics_to_updates = slim.metrics.aggregate_metric_map({ - 'Mean Absolute Error': new_slim.metrics.streaming_mean_absolute_error( - predictions, labels, weights), - 'Mean Relative Error': new_slim.metrics.streaming_mean_relative_error( - predictions, labels, labels, weights), - 'RMSE Linear': new_slim.metrics.streaming_root_mean_squared_error( - predictions, labels, weights), - 'RMSE Log': new_slim.metrics.streaming_root_mean_squared_error( - predictions, labels, weights), - }) -``` - -##### Args: - - -* `names_to_tuples`: a map of metric names to tuples, each of which contain the - pair of (value_tensor, update_op) from a streaming metric. - -##### Returns: - - A dictionary from metric names to value ops and a dictionary from metric - names to update ops. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.metrics.aggregate_metrics.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.metrics.aggregate_metrics.md deleted file mode 100644 index fc3844131c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.metrics.aggregate_metrics.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.contrib.metrics.aggregate_metrics(*value_update_tuples)` {#aggregate_metrics} - -Aggregates the metric value tensors and update ops into two lists. - -##### Args: - - -* `*value_update_tuples`: a variable number of tuples, each of which contain the - pair of (value_tensor, update_op) from a streaming metric. - -##### Returns: - - A list of value `Tensor` objects and a list of update ops. - -##### Raises: - - -* `ValueError`: if `value_update_tuples` is empty. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.metrics.streaming_false_negatives.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.metrics.streaming_false_negatives.md deleted file mode 100644 index 1464305257..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.metrics.streaming_false_negatives.md +++ /dev/null @@ -1,36 +0,0 @@ -### `tf.contrib.metrics.streaming_false_negatives(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)` {#streaming_false_negatives} - -Computes the total number of false positives. - -If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. - -##### Args: - - -* `predictions`: The predicted values, a `Tensor` of arbitrary dimensions. Will - be cast to `bool`. -* `labels`: The ground truth values, a `Tensor` whose dimensions must match - `predictions`. Will be cast to `bool`. -* `weights`: Optional `Tensor` whose rank is either 0, or the same rank as - `labels`, and must be broadcastable to `labels` (i.e., all dimensions - must be either `1`, or the same as the corresponding `labels` - dimension). -* `metrics_collections`: An optional list of collections that the metric - value variable should be added to. -* `updates_collections`: An optional list of collections that the metric update - ops should be added to. -* `name`: An optional variable_scope name. - -##### Returns: - - -* `value_tensor`: A `Tensor` representing the current value of the metric. -* `update_op`: An operation that accumulates the error from a batch of data. - -##### Raises: - - -* `ValueError`: If `weights` is not `None` and its shape doesn't match `values`, - or if either `metrics_collections` or `updates_collections` are not a list - or tuple. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.rnn.CompiledWrapper.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.rnn.CompiledWrapper.md deleted file mode 100644 index dd655070ca..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.rnn.CompiledWrapper.md +++ /dev/null @@ -1,58 +0,0 @@ -Wraps step execution in an XLA JIT scope. -- - - - -#### `tf.contrib.rnn.CompiledWrapper.__call__(inputs, state, scope=None)` {#CompiledWrapper.__call__} - - - - -- - - - -#### `tf.contrib.rnn.CompiledWrapper.__init__(cell, compile_stateful=False)` {#CompiledWrapper.__init__} - -Create CompiledWrapper cell. - -##### Args: - - -* `cell`: Instance of `RNNCell`. -* `compile_stateful`: Whether to compile stateful ops like initializers - and random number generators (default: False). - - -- - - - -#### `tf.contrib.rnn.CompiledWrapper.output_size` {#CompiledWrapper.output_size} - - - - -- - - - -#### `tf.contrib.rnn.CompiledWrapper.state_size` {#CompiledWrapper.state_size} - - - - -- - - - -#### `tf.contrib.rnn.CompiledWrapper.zero_state(batch_size, dtype)` {#CompiledWrapper.zero_state} - -Return zero-filled state tensor(s). - -##### Args: - - -* `batch_size`: int, float, or unit Tensor representing the batch size. -* `dtype`: the data type to use for the state. - -##### Returns: - - If `state_size` is an int or TensorShape, then the return value is a - `N-D` tensor of shape `[batch_size x state_size]` filled with zeros. - - If `state_size` is a nested list or tuple, then the return value is - a nested list or tuple (of the same structure) of `2-D` tensors with -the shapes `[batch_size x s]` for each s in `state_size`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.training.SequenceQueueingStateSaver.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.training.SequenceQueueingStateSaver.md deleted file mode 100644 index a805e936a3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.contrib.training.SequenceQueueingStateSaver.md +++ /dev/null @@ -1,270 +0,0 @@ -SequenceQueueingStateSaver provides access to stateful values from input. - -This class is meant to be used instead of, e.g., a `Queue`, for splitting -variable-length sequence inputs into segments of sequences with fixed length -and batching them into mini-batches. It maintains contexts and state for a -sequence across the segments. It can be used in conjunction with a -`QueueRunner` (see the example below). - -The `SequenceQueueingStateSaver` (SQSS) accepts one example at a time via the -inputs `input_length`, `input_key`, `input_sequences` (a dict), -`input_context` (a dict), and `initial_states` (a dict). -The sequences, values in `input_sequences`, may have variable first dimension -(the `padded_length`), though this dimension must always be a multiple of -`num_unroll`. All other dimensions must be fixed and accessible via -`get_shape` calls. The length prior to padding can be recorded in -`input_length`. The context values in `input_context` must all have fixed and -well defined dimensions. The initial state values must all have fixed and -well defined dimensions. - -The SQSS splits the sequences of an input example into segments of length -`num_unroll`. Across examples minibatches of size `batch_size` are formed. -These minibatches contain a segment of the sequences, copy the context values, -and maintain state, length, and key information of the original input -examples. In the first segment of an example the state is still the initial -state. It can then be updated; and updated state values are accessible in -subsequent segments of the same example. After each segment -`batch.save_state()` must be called which is done by the state_saving_rnn. -Without this call, the dequeue op associated with the SQSS will not run. -Internally, SQSS has a queue for the input examples. Its `capacity` is -configurable. If set smaller than `batch_size` then the dequeue op will block -indefinitely. A small multiple of `batch_size` is a good rule of thumb to -prevent that queue from becoming a bottleneck and slowing down training. -If set too large (and note that it defaults to unbounded) memory consumption -goes up. Moreover, when iterating over the same input examples multiple times -reusing the same `key` the `capacity` must be smaller than the number of -examples. - -The prefetcher, which reads one unrolled, variable-length input sequence at -a time, is accessible via `prefetch_op`. The underlying `Barrier` object -is accessible via `barrier`. Processed minibatches, as well as -state read and write capabilities are accessible via `next_batch`. -Specifically, `next_batch` provides access to all of the minibatched -data, including the following, see `NextQueuedSequenceBatch` for details: - -* `total_length`, `length`, `insertion_index`, `key`, `next_key`, -* `sequence` (the index each minibatch entry's time segment index), -* `sequence_count` (the total time segment count for each minibatch entry), -* `context` (a dict of the copied minibatched context values), -* `sequences` (a dict of the split minibatched variable-length sequences), -* `state` (to access the states of the current segments of these entries) -* `save_state` (to save the states for the next segments of these entries) - -Example usage: - -```python -batch_size = 32 -num_unroll = 20 -lstm_size = 8 -cell = tf.contrib.rnn.BasicLSTMCell(num_units=lstm_size) -initial_state_values = tf.zeros(cell.state_size, dtype=tf.float32) - -raw_data = get_single_input_from_input_reader() -length, key, sequences, context = my_parser(raw_data) -assert "input" in sequences.keys() -assert "label" in context.keys() -initial_states = {"lstm_state": initial_state_value} - -stateful_reader = tf.SequenceQueueingStateSaver( - batch_size, num_unroll, - length=length, input_key=key, input_sequences=sequences, - input_context=context, initial_states=initial_states, - capacity=batch_size*100) - -batch = stateful_reader.next_batch -inputs = batch.sequences["input"] -context_label = batch.context["label"] - -inputs_by_time = tf.split(value=inputs, num_or_size_splits=num_unroll, axis=1) -assert len(inputs_by_time) == num_unroll - -lstm_output, _ = tf.contrib.rnn.static_state_saving_rnn( - cell, - inputs_by_time, - state_saver=batch, - state_name="lstm_state") - -# Start a prefetcher in the background -sess = tf.Session() -num_threads = 3 -queue_runner = tf.train.QueueRunner( - stateful_reader, [stateful_reader.prefetch_op] * num_threads) -tf.train.add_queue_runner(queue_runner) -tf.train.start_queue_runners(sess=session) - -while True: - # Step through batches, perform training or inference... - session.run([lstm_output]) -``` - -**Note**: Usually the barrier is given to a QueueRunner as in the - examples above. The QueueRunner will close the barrier if the prefetch_op - receives an OutOfRange Error from upstream input queues (i.e., reaches - the end of the input). If the barrier is closed no further new examples - are added to the SQSS. The underlying barrier might, however, still - contain further unroll-steps of examples that have not undergone all - iterations. To gracefully finish all examples, the flag - `allow_small_batch` must be set to true, which causes the SQSS to issue - progressively smaller mini-batches with the remaining examples. -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.__init__(batch_size, num_unroll, input_length, input_key, input_sequences, input_context, initial_states, capacity=None, allow_small_batch=False, name=None)` {#SequenceQueueingStateSaver.__init__} - -Creates the SequenceQueueingStateSaver. - -##### Args: - - -* `batch_size`: int or int32 scalar `Tensor`, how large minibatches should - be when accessing the `state()` method and `context`, `sequences`, etc, - properties. -* `num_unroll`: Python integer, how many time steps to unroll at a time. - The input sequences of length `k` are then split into `k / num_unroll` - many segments. -* `input_length`: An int32 scalar `Tensor`, the length of the sequence prior - to padding. This value may be at most `padded_length` for any given - input (see below for the definition of `padded_length`). - Batched and total lengths of the current iteration are made accessible - via the `length` and `total_length` properties. The shape of - input_length (scalar) must be fully specified. -* `input_key`: A string scalar `Tensor`, the **unique** key for the given - input. This is used to keep track of the split minibatch elements - of this input. Batched keys of the current iteration are made - accessible via the `key` property. The shape of `input_key` (scalar) - must be fully specified. -* `input_sequences`: A dict mapping string names to `Tensor` values. The - values must all have matching first dimension, called `padded_length`. - The `SequenceQueueingStateSaver` will split these tensors along - this first dimension into minibatch elements of dimension - `num_unroll`. Batched and segmented sequences of the current iteration - are made accessible via the `sequences` property. - - **Note**: `padded_length` may be dynamic, and may vary from input - to input, but must always be a multiple of `num_unroll`. The remainder - of the shape (other than the first dimension) must be fully specified. - -* `input_context`: A dict mapping string names to `Tensor` values. The values - are treated as "global" across all time splits of the given input, - and will be copied across for all minibatch elements accordingly. - Batched and copied context of the current iteration are made - accessible via the `context` property. - - **Note**: All input_context values must have fully defined shapes. - -* `initial_states`: A dict mapping string state names to multi-dimensional - values (e.g. constants or tensors). This input defines the set of - states that will be kept track of during computing iterations, and - which can be accessed via the `state` and `save_state` methods. - - **Note**: All initial_state values must have fully defined shapes. - -* `capacity`: The max capacity of the SQSS in number of examples. Needs to be - at least `batch_size`. Defaults to unbounded. -* `allow_small_batch`: If true, the SQSS will return smaller batches when - there aren't enough input examples to fill a whole batch and the end of - the input has been reached (i.e., the underlying barrier has been - closed). -* `name`: An op name string (optional). - -##### Raises: - - -* `TypeError`: if any of the inputs is not an expected type. -* `ValueError`: if any of the input values is inconsistent, e.g. if - not enough shape information is available from inputs to build - the state saver. - - -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.barrier` {#SequenceQueueingStateSaver.barrier} - - - - -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.batch_size` {#SequenceQueueingStateSaver.batch_size} - - - - -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.close(cancel_pending_enqueues=False, name=None)` {#SequenceQueueingStateSaver.close} - -Closes the barrier and the FIFOQueue. - -This operation signals that no more segments of new sequences will be -enqueued. New segments of already inserted sequences may still be enqueued -and dequeued if there is a sufficient number filling a batch or -allow_small_batch is true. Otherwise dequeue operations will fail -immediately. - -##### Args: - - -* `cancel_pending_enqueues`: (Optional.) A boolean, defaulting to - `False`. If `True`, all pending enqueues to the underlying queues will - be cancelled, and completing already started sequences is not possible. -* `name`: Optional name for the op. - -##### Returns: - - The operation that closes the barrier and the FIFOQueue. - - -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.name` {#SequenceQueueingStateSaver.name} - - - - -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.next_batch` {#SequenceQueueingStateSaver.next_batch} - -The `NextQueuedSequenceBatch` providing access to batched output data. - -Also provides access to the `state` and `save_state` methods. -The first time this gets called, it additionally prepares barrier reads -and creates `NextQueuedSequenceBatch` / next_batch objects. Subsequent -calls simply return the previously created `next_batch`. - -In order to access data in `next_batch` without blocking, the `prefetch_op` -must have been run at least `batch_size` times (ideally in a separate -thread, or launched via a `QueueRunner`). After processing a segment in -`next_batch()`, `batch.save_state()` must be called which is done by the -state_saving_rnn. Without this call, the dequeue op associated with the SQSS -will not run. - -##### Returns: - - A cached `NextQueuedSequenceBatch` instance. - - -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.num_unroll` {#SequenceQueueingStateSaver.num_unroll} - - - - -- - - - -#### `tf.contrib.training.SequenceQueueingStateSaver.prefetch_op` {#SequenceQueueingStateSaver.prefetch_op} - -The op used to prefetch new data into the state saver. - -Running it once enqueues one new input example into the state saver. -The first time this gets called, it additionally creates the prefetch_op. -Subsequent calls simply return the previously created `prefetch_op`. - -It should be run in a separate thread via e.g. a `QueueRunner`. - -##### Returns: - - An `Operation` that performs prefetching. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.errors.InvalidArgumentError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.errors.InvalidArgumentError.md deleted file mode 100644 index 877325fe0b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.errors.InvalidArgumentError.md +++ /dev/null @@ -1,17 +0,0 @@ -Raised when an operation receives an invalid argument. - -This may occur, for example, if an operation is receives an input -tensor that has an invalid value or shape. For example, the -[`tf.matmul()`](../../api_docs/python/math_ops.md#matmul) op will raise this -error if it receives an input that is not a matrix, and the -[`tf.reshape()`](../../api_docs/python/array_ops.md#reshape) op will raise -this error if the new shape does not match the number of elements in the input -tensor. - -- - - - -#### `tf.errors.InvalidArgumentError.__init__(node_def, op, message)` {#InvalidArgumentError.__init__} - -Creates an `InvalidArgumentError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.errors.UnknownError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.errors.UnknownError.md deleted file mode 100644 index 3e18ec866b..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.errors.UnknownError.md +++ /dev/null @@ -1,15 +0,0 @@ -Unknown error. - -An example of where this error may be returned is if a Status value -received from another address space belongs to an error-space that -is not known to this address space. Also errors raised by APIs that -do not return enough error information may be converted to this -error. - -- - - - -#### `tf.errors.UnknownError.__init__(node_def, op, message, error_code=2)` {#UnknownError.__init__} - -Creates an `UnknownError`. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.expm1.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.expm1.md deleted file mode 100644 index a1867f0a30..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.expm1.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.expm1(x, name=None)` {#expm1} - -Computes exponential of x - 1 element-wise. - -I.e., \\(y = (\exp x) - 1\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.eye.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.eye.md deleted file mode 100644 index b71edf9b96..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.eye.md +++ /dev/null @@ -1,36 +0,0 @@ -### `tf.eye(num_rows, num_columns=None, batch_shape=None, dtype=tf.float32, name=None)` {#eye} - -Construct an identity matrix, or a batch of matrices. - -```python -# Construct one identity matrix. -tf.eye(2) -==> [[1., 0.], - [0., 1.]] - -# Construct a batch of 3 identity matricies, each 2 x 2. -# batch_identity[i, :, :] is a 2 x 2 identity matrix, i = 0, 1, 2. -batch_identity = tf.eye(2, batch_shape=[3]) - -# Construct one 2 x 3 "identity" matrix -tf.eye(2, num_columns=3) -==> [[ 1., 0., 0.], - [ 0., 1., 0.]] -``` - -##### Args: - - -* `num_rows`: Non-negative `int32` scalar `Tensor` giving the number of rows - in each batch matrix. -* `num_columns`: Optional non-negative `int32` scalar `Tensor` giving the number - of columns in each batch matrix. Defaults to `num_rows`. -* `batch_shape`: `int32` `Tensor`. If provided, returned `Tensor` will have - leading batch dimensions of this shape. -* `dtype`: The type of an element in the resulting `Tensor` -* `name`: A name for this `Op`. Defaults to "eye". - -##### Returns: - - A `Tensor` of shape `batch_shape + [num_rows, num_columns]` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.fill.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.fill.md deleted file mode 100644 index 76de3e2d4d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.fill.md +++ /dev/null @@ -1,31 +0,0 @@ -### `tf.fill(dims, value, name=None)` {#fill} - -Creates a tensor filled with a scalar value. - -This operation creates a tensor of shape `dims` and fills it with `value`. - -For example: - -```prettyprint -# Output tensor has shape [2, 3]. -fill([2, 3], 9) ==> [[9, 9, 9] - [9, 9, 9]] -``` - -##### Args: - - -* `dims`: A `Tensor` of type `int32`. - 1-D. Represents the shape of the output tensor. -* `value`: A `Tensor`. 0-D (scalar). Value to fill the returned tensor. - - @compatibility(numpy) - Equivalent to np.full - @end_compatibility - -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `value`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.foldr.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.foldr.md deleted file mode 100644 index ae3471659f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.foldr.md +++ /dev/null @@ -1,44 +0,0 @@ -### `tf.foldr(fn, elems, initializer=None, parallel_iterations=10, back_prop=True, swap_memory=False, name=None)` {#foldr} - -foldr on the list of tensors unpacked from `elems` on dimension 0. - -This foldr operator repeatedly applies the callable `fn` to a sequence -of elements from last to first. The elements are made of the tensors -unpacked from `elems`. The callable fn takes two tensors as arguments. -The first argument is the accumulated value computed from the preceding -invocation of fn. If `initializer` is None, `elems` must contain at least -one element, and its first element is used as the initializer. - -Suppose that `elems` is unpacked into `values`, a list of tensors. The shape -of the result tensor is `fn(initializer, values[0]).shape`. - -##### Args: - - -* `fn`: The callable to be performed. -* `elems`: A tensor that is unpacked into a sequence of tensors to apply `fn`. -* `initializer`: (optional) The initial value for the accumulator. -* `parallel_iterations`: (optional) The number of iterations allowed to run - in parallel. -* `back_prop`: (optional) True enables support for back propagation. -* `swap_memory`: (optional) True enables GPU-CPU memory swapping. -* `name`: (optional) Name prefix for the returned tensors. - -##### Returns: - - A tensor resulting from applying `fn` consecutively to the list of tensors - unpacked from `elems`, from last to first. - -##### Raises: - - -* `TypeError`: if `fn` is not callable. - -##### Example: - - ```python - elems = [1, 2, 3, 4, 5, 6] - sum = foldr(lambda a, x: a + x, elems) - # sum == 21 - ``` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.gather.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.gather.md deleted file mode 100644 index 3c6be5988c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.gather.md +++ /dev/null @@ -1,37 +0,0 @@ -### `tf.gather(params, indices, validate_indices=None, name=None)` {#gather} - -Gather slices from `params` according to `indices`. - -`indices` must be an integer tensor of any dimension (usually 0-D or 1-D). -Produces an output tensor with shape `indices.shape + params.shape[1:]` where: - -```python - # Scalar indices - output[:, ..., :] = params[indices, :, ... :] - - # Vector indices - output[i, :, ..., :] = params[indices[i], :, ... :] - - # Higher rank indices - output[i, ..., j, :, ... :] = params[indices[i, ..., j], :, ..., :] -``` - -If `indices` is a permutation and `len(indices) == params.shape[0]` then -this operation will permute `params` accordingly. - -
- -
- -##### Args: - - -* `params`: A `Tensor`. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. -* `validate_indices`: An optional `bool`. Defaults to `True`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `params`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.get_default_graph.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.get_default_graph.md deleted file mode 100644 index bd734d1b98..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.get_default_graph.md +++ /dev/null @@ -1,17 +0,0 @@ -### `tf.get_default_graph()` {#get_default_graph} - -Returns the default graph for the current thread. - -The returned graph will be the innermost graph on which a -`Graph.as_default()` context has been entered, or a global default -graph if none has been explicitly created. - -NOTE: The default graph is a property of the current thread. If you -create a new thread, and wish to use the default graph in that -thread, you must explicitly add a `with g.as_default():` in that -thread's function. - -##### Returns: - - The default `Graph` being used in the current thread. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.get_local_variable.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.get_local_variable.md deleted file mode 100644 index ffd465b3c3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.get_local_variable.md +++ /dev/null @@ -1,87 +0,0 @@ -### `tf.get_local_variable(*args, **kwargs)` {#get_local_variable} - -Gets an existing *local* variable or creates a new one. - -Behavior is the same as in `get_variable`, except that variables are -added to the `LOCAL_VARIABLES` collection and `trainable` is set to -`False`. -This function prefixes the name with the current variable scope -and performs reuse checks. See the -[Variable Scope How To](../../how_tos/variable_scope/index.md) -for an extensive description of how reusing works. Here is a basic example: - -```python -with tf.variable_scope("foo"): - v = tf.get_variable("v", [1]) # v.name == "foo/v:0" - w = tf.get_variable("w", [1]) # w.name == "foo/w:0" -with tf.variable_scope("foo", reuse=True): - v1 = tf.get_variable("v") # The same as v above. -``` - -If initializer is `None` (the default), the default initializer passed in -the variable scope will be used. If that one is `None` too, a -`glorot_uniform_initializer` will be used. The initializer can also be -a Tensor, in which case the variable is initialized to this value and shape. - -Similarly, if the regularizer is `None` (the default), the default regularizer -passed in the variable scope will be used (if that is `None` too, -then by default no regularization is performed). - -If a partitioner is provided, a `PartitionedVariable` is returned. -Accessing this object as a `Tensor` returns the shards concatenated along -the partition axis. - -Some useful partitioners are available. See, e.g., -`variable_axis_size_partitioner` and `min_max_variable_partitioner`. - -##### Args: - - -* `name`: The name of the new or existing variable. -* `shape`: Shape of the new or existing variable. -* `dtype`: Type of the new or existing variable (defaults to `DT_FLOAT`). -* `initializer`: Initializer for the variable if one is created. -* `regularizer`: A (Tensor -> Tensor or None) function; the result of - applying it on a newly created variable will be added to the collection - @{tf.GraphKeys.REGULARIZATION_LOSSES} and can be used for regularization. -* `collections`: List of graph collections keys to add the Variable to. - Defaults to `[GraphKeys.LOCAL_VARIABLES]` (see `tf.Variable`). -* `caching_device`: Optional device string or function describing where the - Variable should be cached for reading. Defaults to the Variable's - device. If not `None`, caches on another device. Typical use is to - cache on the device where the Ops using the Variable reside, to - deduplicate copying through `Switch` and other conditional statements. -* `partitioner`: Optional callable that accepts a fully defined `TensorShape` - and `dtype` of the Variable to be created, and returns a list of - partitions for each axis (currently only one axis can be partitioned). -* `validate_shape`: If False, allows the variable to be initialized with a - value of unknown shape. If True, the default, the shape of initial_value - must be known. -* `use_resource`: If False, creates a regular Variable. If true, creates an - experimental ResourceVariable instead with well-defined semantics. - Defaults to False (will later change to True). -* `custom_getter`: Callable that takes as a first argument the true getter, and - allows overwriting the internal get_variable method. - The signature of `custom_getter` should match that of this method, - but the most future-proof version will allow for changes: - `def custom_getter(getter, *args, **kwargs)`. Direct access to - all `get_variable` parameters is also allowed: - `def custom_getter(getter, name, *args, **kwargs)`. A simple identity - custom getter that simply creates variables with modified names is: - ```python - def custom_getter(getter, name, *args, **kwargs): - return getter(name + '_suffix', *args, **kwargs) - ``` - -##### Returns: - - The created or existing `Variable` (or `PartitionedVariable`, if a - partitioner was used). - -##### Raises: - - -* `ValueError`: when creating a new variable and shape is not declared, - when violating reuse during variable creation, or when `initializer` dtype - and `dtype` don't match. Reuse is set inside `variable_scope`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.get_variable.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.get_variable.md deleted file mode 100644 index 9ec5405d6e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.get_variable.md +++ /dev/null @@ -1,86 +0,0 @@ -### `tf.get_variable(name, shape=None, dtype=None, initializer=None, regularizer=None, trainable=True, collections=None, caching_device=None, partitioner=None, validate_shape=True, use_resource=None, custom_getter=None)` {#get_variable} - -Gets an existing variable with these parameters or create a new one. - -This function prefixes the name with the current variable scope -and performs reuse checks. See the -[Variable Scope How To](../../how_tos/variable_scope/index.md) -for an extensive description of how reusing works. Here is a basic example: - -```python -with tf.variable_scope("foo"): - v = tf.get_variable("v", [1]) # v.name == "foo/v:0" - w = tf.get_variable("w", [1]) # w.name == "foo/w:0" -with tf.variable_scope("foo", reuse=True): - v1 = tf.get_variable("v") # The same as v above. -``` - -If initializer is `None` (the default), the default initializer passed in -the variable scope will be used. If that one is `None` too, a -`glorot_uniform_initializer` will be used. The initializer can also be -a Tensor, in which case the variable is initialized to this value and shape. - -Similarly, if the regularizer is `None` (the default), the default regularizer -passed in the variable scope will be used (if that is `None` too, -then by default no regularization is performed). - -If a partitioner is provided, a `PartitionedVariable` is returned. -Accessing this object as a `Tensor` returns the shards concatenated along -the partition axis. - -Some useful partitioners are available. See, e.g., -`variable_axis_size_partitioner` and `min_max_variable_partitioner`. - -##### Args: - - -* `name`: The name of the new or existing variable. -* `shape`: Shape of the new or existing variable. -* `dtype`: Type of the new or existing variable (defaults to `DT_FLOAT`). -* `initializer`: Initializer for the variable if one is created. -* `regularizer`: A (Tensor -> Tensor or None) function; the result of - applying it on a newly created variable will be added to the collection - @{tf.GraphKeys.REGULARIZATION_LOSSES} and can be used for regularization. -* `trainable`: If `True` also add the variable to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see `tf.Variable`). -* `collections`: List of graph collections keys to add the Variable to. - Defaults to `[GraphKeys.GLOBAL_VARIABLES]` (see `tf.Variable`). -* `caching_device`: Optional device string or function describing where the - Variable should be cached for reading. Defaults to the Variable's - device. If not `None`, caches on another device. Typical use is to - cache on the device where the Ops using the Variable reside, to - deduplicate copying through `Switch` and other conditional statements. -* `partitioner`: Optional callable that accepts a fully defined `TensorShape` - and `dtype` of the Variable to be created, and returns a list of - partitions for each axis (currently only one axis can be partitioned). -* `validate_shape`: If False, allows the variable to be initialized with a - value of unknown shape. If True, the default, the shape of initial_value - must be known. -* `use_resource`: If False, creates a regular Variable. If true, creates an - experimental ResourceVariable instead with well-defined semantics. - Defaults to False (will later change to True). -* `custom_getter`: Callable that takes as a first argument the true getter, and - allows overwriting the internal get_variable method. - The signature of `custom_getter` should match that of this method, - but the most future-proof version will allow for changes: - `def custom_getter(getter, *args, **kwargs)`. Direct access to - all `get_variable` parameters is also allowed: - `def custom_getter(getter, name, *args, **kwargs)`. A simple identity - custom getter that simply creates variables with modified names is: - ```python - def custom_getter(getter, name, *args, **kwargs): - return getter(name + '_suffix', *args, **kwargs) - ``` - -##### Returns: - - The created or existing `Variable` (or `PartitionedVariable`, if a - partitioner was used). - -##### Raises: - - -* `ValueError`: when creating a new variable and shape is not declared, - when violating reuse during variable creation, or when `initializer` dtype - and `dtype` don't match. Reuse is set inside `variable_scope`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.image.encode_png.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.image.encode_png.md deleted file mode 100644 index fa073a771f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.image.encode_png.md +++ /dev/null @@ -1,28 +0,0 @@ -### `tf.image.encode_png(image, compression=None, name=None)` {#encode_png} - -PNG-encode an image. - -`image` is a 3-D uint8 or uint16 Tensor of shape `[height, width, channels]` -where `channels` is: - -* 1: for grayscale. -* 2: for grayscale + alpha. -* 3: for RGB. -* 4: for RGBA. - -The ZLIB compression level, `compression`, can be -1 for the PNG-encoder -default or a value from 0 to 9. 9 is the highest compression level, generating -the smallest output, but is slower. - -##### Args: - - -* `image`: A `Tensor`. Must be one of the following types: `uint8`, `uint16`. - 3-D with shape `[height, width, channels]`. -* `compression`: An optional `int`. Defaults to `-1`. Compression level. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. 0-D. PNG-encoded image. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.image.random_flip_up_down.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.image.random_flip_up_down.md deleted file mode 100644 index 7ed36f5df2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.image.random_flip_up_down.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.image.random_flip_up_down(image, seed=None)` {#random_flip_up_down} - -Randomly flips an image vertically (upside down). - -With a 1 in 2 chance, outputs the contents of `image` flipped along the first -dimension, which is `height`. Otherwise output the image as-is. - -##### Args: - - -* `image`: A 3-D tensor of shape `[height, width, channels].` -* `seed`: A Python integer. Used to create a random seed. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - -##### Returns: - - A 3-D tensor of the same type and shape as `image`. - -##### Raises: - - -* `ValueError`: if the shape of `image` not supported. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.matrix_determinant.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.matrix_determinant.md deleted file mode 100644 index bcd0859e47..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.matrix_determinant.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.matrix_determinant(input, name=None)` {#matrix_determinant} - -Computes the determinant of one ore more square matrices. - -The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions -form square matrices. The output is a tensor containing the determinants -for all input submatrices `[..., :, :]`. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`. - Shape is `[..., M, M]`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. Shape is `[...]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.matrix_triangular_solve.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.matrix_triangular_solve.md deleted file mode 100644 index 66403eccfe..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.matrix_triangular_solve.md +++ /dev/null @@ -1,44 +0,0 @@ -### `tf.matrix_triangular_solve(matrix, rhs, lower=None, adjoint=None, name=None)` {#matrix_triangular_solve} - -Solves systems of linear equations with upper or lower triangular matrices by - -backsubstitution. - -`matrix` is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions form -square matrices. If `lower` is `True` then the strictly upper triangular part -of each inner-most matrix is assumed to be zero and not accessed. -If `lower` is False then the strictly lower triangular part of each inner-most -matrix is assumed to be zero and not accessed. -`rhs` is a tensor of shape `[..., M, K]`. - -The output is a tensor of shape `[..., M, K]`. If `adjoint` is -`True` then the innermost matrices in output` satisfy matrix equations -`matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]`. -If `adjoint` is `False` then the strictly then the innermost matrices in -`output` satisfy matrix equations -`adjoint(matrix[..., i, k]) * output[..., k, j] = rhs[..., i, j]`. - -##### Args: - - -* `matrix`: A `Tensor`. Must be one of the following types: `float64`, `float32`. - Shape is `[..., M, M]`. -* `rhs`: A `Tensor`. Must have the same type as `matrix`. - Shape is `[..., M, K]`. -* `lower`: An optional `bool`. Defaults to `True`. - Boolean indicating whether the innermost matrices in `matrix` are - lower or upper triangular. -* `adjoint`: An optional `bool`. Defaults to `False`. - Boolean indicating whether to solve with `matrix` or its (block-wise) - adjoint. - - @compatibility(numpy) - Equivalent to np.linalg.triangular_solve - @end_compatibility - -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `matrix`. Shape is `[..., M, K]`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.meshgrid.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.meshgrid.md deleted file mode 100644 index 673a5c0717..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.meshgrid.md +++ /dev/null @@ -1,45 +0,0 @@ -### `tf.meshgrid(*args, **kwargs)` {#meshgrid} - -Broadcasts parameters for evaluation on an N-D grid. - -Given N one-dimensional coordinate arrays `*args`, returns a list `outputs` -of N-D coordinate arrays for evaluating expressions on an N-D grid. - -Notes: - -`meshgrid` supports cartesian ('xy') and matrix ('ij') indexing conventions. -When the `indexing` argument is set to 'xy' (the default), the broadcasting -instructions for the first two dimensions are swapped. - -Examples: - -Calling `X, Y = meshgrid(x, y)` with the tensors - -```prettyprint - x = [1, 2, 3] - y = [4, 5, 6] -``` - -results in - -```prettyprint - X = [[1, 1, 1], - [2, 2, 2], - [3, 3, 3]] - Y = [[4, 5, 6], - [4, 5, 6], - [4, 5, 6]] -``` - -##### Args: - - -* `*args`: `Tensor`s with rank 1 -* `indexing`: Either 'xy' or 'ij' (optional, default: 'xy') -* `name`: A name for the operation (optional). - -##### Returns: - - -* `outputs`: A list of N `Tensor`s with rank N - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.bias_add.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.bias_add.md deleted file mode 100644 index eee3edf9c3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.bias_add.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.nn.bias_add(value, bias, data_format=None, name=None)` {#bias_add} - -Adds `bias` to `value`. - -This is (mostly) a special case of `tf.add` where `bias` is restricted to 1-D. -Broadcasting is supported, so `value` may have any number of dimensions. -Unlike `tf.add`, the type of `bias` is allowed to differ from `value` in the -case where both types are quantized. - -##### Args: - - -* `value`: A `Tensor` with type `float`, `double`, `int64`, `int32`, `uint8`, - `int16`, `int8`, `complex64`, or `complex128`. -* `bias`: A 1-D `Tensor` with size matching the last dimension of `value`. - Must be the same type as `value` unless `value` is a quantized type, - in which case a different quantized type may be used. -* `data_format`: A string. 'NHWC' and 'NCHW' are supported. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` with the same type as `value`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.crelu.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.crelu.md deleted file mode 100644 index 8f6d282c10..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.crelu.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.nn.crelu(features, name=None)` {#crelu} - -Computes Concatenated ReLU. - -Concatenates a ReLU which selects only the positive part of the activation -with a ReLU which selects only the *negative* part of the activation. -Note that as a result this non-linearity doubles the depth of the activations. -Source: https://arxiv.org/abs/1603.05201 - -##### Args: - - -* `features`: A `Tensor` with type `float`, `double`, `int32`, `int64`, `uint8`, - `int16`, or `int8`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` with the same type as `features`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.fused_batch_norm.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.fused_batch_norm.md deleted file mode 100644 index 154f5692f3..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.fused_batch_norm.md +++ /dev/null @@ -1,33 +0,0 @@ -### `tf.nn.fused_batch_norm(x, scale, offset, mean=None, variance=None, epsilon=0.001, data_format='NHWC', is_training=True, name=None)` {#fused_batch_norm} - -Batch normalization. - -As described in http://arxiv.org/abs/1502.03167. - -##### Args: - - -* `x`: Input `Tensor` of 4 dimensions. -* `scale`: A `Tensor` of 1 dimension for scaling. -* `offset`: A `Tensor` of 1 dimension for bias. -* `mean`: A `Tensor` of 1 dimension for population mean used for inference. -* `variance`: A `Tensor` of 1 dimension for population variance - used for inference. -* `epsilon`: A small float number added to the variance of x. -* `data_format`: The data format for x. Either "NHWC" (default) or "NCHW". -* `is_training`: A bool value to specify if the operation is used for - training or inference. -* `name`: A name for this operation (optional). - -##### Returns: - - -* `y`: A 4D Tensor for the normalized, scaled, offsetted x. -* `batch_mean`: A 1D Tensor for the mean of x. -* `batch_var`: A 1D Tensor for the variance of x. - -##### Raises: - - -* `ValueError`: If mean or variance is not None when is_training is True. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.max_pool_with_argmax.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.max_pool_with_argmax.md deleted file mode 100644 index 5424efd7a7..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.max_pool_with_argmax.md +++ /dev/null @@ -1,30 +0,0 @@ -### `tf.nn.max_pool_with_argmax(input, ksize, strides, padding, Targmax=None, name=None)` {#max_pool_with_argmax} - -Performs max pooling on the input and outputs both max values and indices. - -The indices in `argmax` are flattened, so that a maximum value at position -`[b, y, x, c]` becomes flattened index -`((b * height + y) * width + x) * channels + c`. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `half`. - 4-D with shape `[batch, height, width, channels]`. Input to pool over. -* `ksize`: A list of `ints` that has length `>= 4`. - The size of the window for each dimension of the input tensor. -* `strides`: A list of `ints` that has length `>= 4`. - The stride of the sliding window for each dimension of the - input tensor. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `Targmax`: An optional `tf.DType` from: `tf.int32, tf.int64`. Defaults to `tf.int64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, argmax). - -* `output`: A `Tensor`. Has the same type as `input`. The max pooled output tensor. -* `argmax`: A `Tensor` of type `Targmax`. 4-D. The flattened indices of the max values chosen for each output. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.raw_rnn.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.raw_rnn.md deleted file mode 100644 index 370ad0a5d2..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.raw_rnn.md +++ /dev/null @@ -1,170 +0,0 @@ -### `tf.nn.raw_rnn(cell, loop_fn, parallel_iterations=None, swap_memory=False, scope=None)` {#raw_rnn} - -Creates an `RNN` specified by RNNCell `cell` and loop function `loop_fn`. - -**NOTE: This method is still in testing, and the API may change.** - -This function is a more primitive version of `dynamic_rnn` that provides -more direct access to the inputs each iteration. It also provides more -control over when to start and finish reading the sequence, and -what to emit for the output. - -For example, it can be used to implement the dynamic decoder of a seq2seq -model. - -Instead of working with `Tensor` objects, most operations work with -`TensorArray` objects directly. - -The operation of `raw_rnn`, in pseudo-code, is basically the following: - -```python -time = tf.constant(0, dtype=tf.int32) -(finished, next_input, initial_state, _, loop_state) = loop_fn( - time=time, cell_output=None, cell_state=None, loop_state=None) -emit_ta = TensorArray(dynamic_size=True, dtype=initial_state.dtype) -state = initial_state -while not all(finished): - (output, cell_state) = cell(next_input, state) - (next_finished, next_input, next_state, emit, loop_state) = loop_fn( - time=time + 1, cell_output=output, cell_state=cell_state, - loop_state=loop_state) - # Emit zeros and copy forward state for minibatch entries that are finished. - state = tf.where(finished, state, next_state) - emit = tf.where(finished, tf.zeros_like(emit), emit) - emit_ta = emit_ta.write(time, emit) - # If any new minibatch entries are marked as finished, mark these. - finished = tf.logical_or(finished, next_finished) - time += 1 -return (emit_ta, state, loop_state) -``` - -with the additional properties that output and state may be (possibly nested) -tuples, as determined by `cell.output_size` and `cell.state_size`, and -as a result the final `state` and `emit_ta` may themselves be tuples. - -A simple implementation of `dynamic_rnn` via `raw_rnn` looks like this: - -```python -inputs = tf.placeholder(shape=(max_time, batch_size, input_depth), - dtype=tf.float32) -sequence_length = tf.placeholder(shape=(batch_size,), dtype=tf.int32) -inputs_ta = tf.TensorArray(dtype=tf.float32, size=max_time) -inputs_ta = inputs_ta.unstack(inputs) - -cell = tf.contrib.rnn.LSTMCell(num_units) - -def loop_fn(time, cell_output, cell_state, loop_state): - emit_output = cell_output # == None for time == 0 - if cell_output is None: # time == 0 - next_cell_state = cell.zero_state(batch_size, tf.float32) - else: - next_cell_state = cell_state - elements_finished = (time >= sequence_length) - finished = tf.reduce_all(elements_finished) - next_input = tf.cond( - finished, - lambda: tf.zeros([batch_size, input_depth], dtype=tf.float32), - lambda: inputs_ta.read(time)) - next_loop_state = None - return (elements_finished, next_input, next_cell_state, - emit_output, next_loop_state) - -outputs_ta, final_state, _ = raw_rnn(cell, loop_fn) -outputs = outputs_ta.stack() -``` - -##### Args: - - -* `cell`: An instance of RNNCell. -* `loop_fn`: A callable that takes inputs - `(time, cell_output, cell_state, loop_state)` - and returns the tuple - `(finished, next_input, next_cell_state, emit_output, next_loop_state)`. - Here `time` is an int32 scalar `Tensor`, `cell_output` is a - `Tensor` or (possibly nested) tuple of tensors as determined by - `cell.output_size`, and `cell_state` is a `Tensor` - or (possibly nested) tuple of tensors, as determined by the `loop_fn` - on its first call (and should match `cell.state_size`). - The outputs are: `finished`, a boolean `Tensor` of - shape `[batch_size]`, `next_input`: the next input to feed to `cell`, - `next_cell_state`: the next state to feed to `cell`, - and `emit_output`: the output to store for this iteration. - - Note that `emit_output` should be a `Tensor` or (possibly nested) - tuple of tensors with shapes and structure matching `cell.output_size` - and `cell_output` above. The parameter `cell_state` and output - `next_cell_state` may be either a single or (possibly nested) tuple - of tensors. The parameter `loop_state` and - output `next_loop_state` may be either a single or (possibly nested) tuple - of `Tensor` and `TensorArray` objects. This last parameter - may be ignored by `loop_fn` and the return value may be `None`. If it - is not `None`, then the `loop_state` will be propagated through the RNN - loop, for use purely by `loop_fn` to keep track of its own state. - The `next_loop_state` parameter returned may be `None`. - - The first call to `loop_fn` will be `time = 0`, `cell_output = None`, - `cell_state = None`, and `loop_state = None`. For this call: - The `next_cell_state` value should be the value with which to initialize - the cell's state. It may be a final state from a previous RNN or it - may be the output of `cell.zero_state()`. It should be a - (possibly nested) tuple structure of tensors. - If `cell.state_size` is an integer, this must be - a `Tensor` of appropriate type and shape `[batch_size, cell.state_size]`. - If `cell.state_size` is a `TensorShape`, this must be a `Tensor` of - appropriate type and shape `[batch_size] + cell.state_size`. - If `cell.state_size` is a (possibly nested) tuple of ints or - `TensorShape`, this will be a tuple having the corresponding shapes. - The `emit_output` value may be either `None` or a (possibly nested) - tuple structure of tensors, e.g., - `(tf.zeros(shape_0, dtype=dtype_0), tf.zeros(shape_1, dtype=dtype_1))`. - If this first `emit_output` return value is `None`, - then the `emit_ta` result of `raw_rnn` will have the same structure and - dtypes as `cell.output_size`. Otherwise `emit_ta` will have the same - structure, shapes (prepended with a `batch_size` dimension), and dtypes - as `emit_output`. The actual values returned for `emit_output` at this - initializing call are ignored. Note, this emit structure must be - consistent across all time steps. - - -* `parallel_iterations`: (Default: 32). The number of iterations to run in - parallel. Those operations which do not have any temporal dependency - and can be run in parallel, will be. This parameter trades off - time for space. Values >> 1 use more memory but take less time, - while smaller values use less memory but computations take longer. -* `swap_memory`: Transparently swap the tensors produced in forward inference - but needed for back prop from GPU to CPU. This allows training RNNs - which would typically not fit on a single GPU, with very minimal (or no) - performance penalty. -* `scope`: VariableScope for the created subgraph; defaults to "rnn". - -##### Returns: - - A tuple `(emit_ta, final_state, final_loop_state)` where: - - `emit_ta`: The RNN output `TensorArray`. - If `loop_fn` returns a (possibly nested) set of Tensors for - `emit_output` during initialization, (inputs `time = 0`, - `cell_output = None`, and `loop_state = None`), then `emit_ta` will - have the same structure, dtypes, and shapes as `emit_output` instead. - If `loop_fn` returns `emit_output = None` during this call, - the structure of `cell.output_size` is used: - If `cell.output_size` is a (possibly nested) tuple of integers - or `TensorShape` objects, then `emit_ta` will be a tuple having the - same structure as `cell.output_size`, containing TensorArrays whose - elements' shapes correspond to the shape data in `cell.output_size`. - - `final_state`: The final cell state. If `cell.state_size` is an int, this - will be shaped `[batch_size, cell.state_size]`. If it is a - `TensorShape`, this will be shaped `[batch_size] + cell.state_size`. - If it is a (possibly nested) tuple of ints or `TensorShape`, this will - be a tuple having the corresponding shapes. - - `final_loop_state`: The final loop state as returned by `loop_fn`. - -##### Raises: - - -* `TypeError`: If `cell` is not an instance of RNNCell, or `loop_fn` is not - a `callable`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.uniform_candidate_sampler.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.uniform_candidate_sampler.md deleted file mode 100644 index c34056dc84..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.uniform_candidate_sampler.md +++ /dev/null @@ -1,49 +0,0 @@ -### `tf.nn.uniform_candidate_sampler(true_classes, num_true, num_sampled, unique, range_max, seed=None, name=None)` {#uniform_candidate_sampler} - -Samples a set of classes using a uniform base distribution. - -This operation randomly samples a tensor of sampled classes -(`sampled_candidates`) from the range of integers `[0, range_max)`. - -The elements of `sampled_candidates` are drawn without replacement -(if `unique=True`) or with replacement (if `unique=False`) from -the base distribution. - -The base distribution for this operation is the uniform distribution -over the range of integers `[0, range_max)`. - -In addition, this operation returns tensors `true_expected_count` -and `sampled_expected_count` representing the number of times each -of the target classes (`true_classes`) and the sampled -classes (`sampled_candidates`) is expected to occur in an average -tensor of sampled classes. These values correspond to `Q(y|x)` -defined in [this -document](http://www.tensorflow.org/extras/candidate_sampling.pdf). -If `unique=True`, then these are post-rejection probabilities and we -compute them approximately. - -##### Args: - - -* `true_classes`: A `Tensor` of type `int64` and shape `[batch_size, - num_true]`. The target classes. -* `num_true`: An `int`. The number of target classes per training example. -* `num_sampled`: An `int`. The number of classes to randomly sample per batch. -* `unique`: A `bool`. Determines whether all sampled classes in a batch are - unique. -* `range_max`: An `int`. The number of possible classes. -* `seed`: An `int`. An operation-specific seed. Default is 0. -* `name`: A name for the operation (optional). - -##### Returns: - - -* `sampled_candidates`: A tensor of type `int64` and shape `[num_sampled]`. - The sampled classes. -* `true_expected_count`: A tensor of type `float`. Same shape as - `true_classes`. The expected counts under the sampling distribution - of each of `true_classes`. -* `sampled_expected_count`: A tensor of type `float`. Same shape as - `sampled_candidates`. The expected counts under the sampling distribution - of each of `sampled_candidates`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.zero_fraction.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.zero_fraction.md deleted file mode 100644 index dc519bbf76..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.nn.zero_fraction.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.nn.zero_fraction(value, name=None)` {#zero_fraction} - -Returns the fraction of zeros in `value`. - -If `value` is empty, the result is `nan`. - -This is useful in summaries to measure and report sparsity. For example, - -```python - z = tf.Relu(...) - summ = tf.contrib.deprecated.scalar_summary('sparsity', - tf.nn.zero_fraction(z)) -``` - -##### Args: - - -* `value`: A tensor of numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - The fraction of zeros in `value`, with type `float32`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.ones.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.ones.md deleted file mode 100644 index c218aa6c97..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.ones.md +++ /dev/null @@ -1,24 +0,0 @@ -### `tf.ones(shape, dtype=tf.float32, name=None)` {#ones} - -Creates a tensor with all elements set to 1. - -This operation returns a tensor of type `dtype` with shape `shape` and all -elements set to 1. - -For example: - -```python -tf.ones([2, 3], tf.int32) ==> [[1, 1, 1], [1, 1, 1]] -``` - -##### Args: - - -* `shape`: Either a list of integers, or a 1-D `Tensor` of type `int32`. -* `dtype`: The type of an element in the resulting `Tensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` with all elements set to 1. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.pad.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.pad.md deleted file mode 100644 index 55a35db9b1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.pad.md +++ /dev/null @@ -1,57 +0,0 @@ -### `tf.pad(tensor, paddings, mode='CONSTANT', name=None)` {#pad} - -Pads a tensor. - -This operation pads a `tensor` according to the `paddings` you specify. -`paddings` is an integer tensor with shape `[n, 2]`, where n is the rank of -`tensor`. For each dimension D of `input`, `paddings[D, 0]` indicates how -many values to add before the contents of `tensor` in that dimension, and -`paddings[D, 1]` indicates how many values to add after the contents of -`tensor` in that dimension. If `mode` is "REFLECT" then both `paddings[D, 0]` -and `paddings[D, 1]` must be no greater than `tensor.dim_size(D) - 1`. If -`mode` is "SYMMETRIC" then both `paddings[D, 0]` and `paddings[D, 1]` must be -no greater than `tensor.dim_size(D)`. - -The padded size of each dimension D of the output is: - -`paddings[D, 0] + tensor.dim_size(D) + paddings[D, 1]` - -For example: - -```python -# 't' is [[1, 2, 3], [4, 5, 6]]. -# 'paddings' is [[1, 1,], [2, 2]]. -# rank of 't' is 2. -pad(t, paddings, "CONSTANT") ==> [[0, 0, 0, 0, 0, 0, 0], - [0, 0, 1, 2, 3, 0, 0], - [0, 0, 4, 5, 6, 0, 0], - [0, 0, 0, 0, 0, 0, 0]] - -pad(t, paddings, "REFLECT") ==> [[6, 5, 4, 5, 6, 5, 4], - [3, 2, 1, 2, 3, 2, 1], - [6, 5, 4, 5, 6, 5, 4], - [3, 2, 1, 2, 3, 2, 1]] - -pad(t, paddings, "SYMMETRIC") ==> [[2, 1, 1, 2, 3, 3, 2], - [2, 1, 1, 2, 3, 3, 2], - [5, 4, 4, 5, 6, 6, 5], - [5, 4, 4, 5, 6, 6, 5]] -``` - -##### Args: - - -* `tensor`: A `Tensor`. -* `paddings`: A `Tensor` of type `int32`. -* `mode`: One of "CONSTANT", "REFLECT", or "SYMMETRIC" (case-insensitive) -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `tensor`. - -##### Raises: - - -* `ValueError`: When mode is not one of "CONSTANT", "REFLECT", or "SYMMETRIC". - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.random_poisson.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.random_poisson.md deleted file mode 100644 index d56c967168..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.random_poisson.md +++ /dev/null @@ -1,38 +0,0 @@ -### `tf.random_poisson(lam, shape, dtype=tf.float32, seed=None, name=None)` {#random_poisson} - -Draws `shape` samples from each of the given Poisson distribution(s). - -`lam` is the rate parameter describing the distribution(s). - -Example: - - samples = tf.random_poisson([0.5, 1.5], [10]) - # samples has shape [10, 2], where each slice [:, 0] and [:, 1] represents - # the samples drawn from each distribution - - samples = tf.random_poisson([12.2, 3.3], [7, 5]) - # samples has shape [7, 5, 2], where each slice [:, :, 0] and [:, :, 1] - # represents the 7x5 samples drawn from each of the two distributions - -##### Args: - - -* `lam`: A Tensor or Python value or N-D array of type `dtype`. - `lam` provides the rate parameter(s) describing the poisson - distribution(s) to sample. -* `shape`: A 1-D integer Tensor or Python array. The shape of the output samples - to be drawn per "rate"-parameterized distribution. -* `dtype`: The type of `lam` and the output: `float16`, `float32`, or - `float64`. -* `seed`: A Python integer. Used to create a random seed for the distributions. - See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: Optional name for the operation. - -##### Returns: - - -* `samples`: a `Tensor` of shape `tf.concat(shape, tf.shape(lam))` with - values of type `dtype`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.realdiv.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.realdiv.md deleted file mode 100644 index facd6630dd..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.realdiv.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.realdiv(x, y, name=None)` {#realdiv} - -Returns x / y element-wise for real types. - -If `x` and `y` are reals, this will return the floating-point division. - -*NOTE*: `Div` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `uint16`, `int16`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.saturate_cast.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.saturate_cast.md deleted file mode 100644 index 6a77c2791e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.saturate_cast.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.saturate_cast(value, dtype, name=None)` {#saturate_cast} - -Performs a safe saturating cast of `value` to `dtype`. - -This function casts the input to `dtype` without applying any scaling. If -there is a danger that values would over or underflow in the cast, this op -applies the appropriate clamping before the cast. - -##### Args: - - -* `value`: A `Tensor`. -* `dtype`: The desired output `DType`. -* `name`: A name for the operation (optional). - -##### Returns: - - `value` safely cast to `dtype`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.scalar_mul.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.scalar_mul.md deleted file mode 100644 index 5af291597d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.scalar_mul.md +++ /dev/null @@ -1,23 +0,0 @@ -### `tf.scalar_mul(scalar, x)` {#scalar_mul} - -Multiplies a scalar times a `Tensor` or `IndexedSlices` object. - -Intended for use in gradient code which might deal with `IndexedSlices` -objects, which are easy to multiply by a scalar but more expensive to -multiply with arbitrary tensors. - -##### Args: - - -* `scalar`: A 0-D scalar `Tensor`. Must have known shape. -* `x`: A `Tensor` or `IndexedSlices` to be scaled. - -##### Returns: - - `scalar * x` of the same type (`Tensor` or `IndexedSlices`) as `x`. - -##### Raises: - - -* `ValueError`: if scalar is not a 0-D `scalar`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.scan.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.scan.md deleted file mode 100644 index 047971e260..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.scan.md +++ /dev/null @@ -1,92 +0,0 @@ -### `tf.scan(fn, elems, initializer=None, parallel_iterations=10, back_prop=True, swap_memory=False, infer_shape=True, name=None)` {#scan} - -scan on the list of tensors unpacked from `elems` on dimension 0. - -The simplest version of `scan` repeatedly applies the callable `fn` to a -sequence of elements from first to last. The elements are made of the tensors -unpacked from `elems` on dimension 0. The callable fn takes two tensors as -arguments. The first argument is the accumulated value computed from the -preceding invocation of fn. If `initializer` is None, `elems` must contain -at least one element, and its first element is used as the initializer. - -Suppose that `elems` is unpacked into `values`, a list of tensors. The shape -of the result tensor is `[len(values)] + fn(initializer, values[0]).shape`. - -This method also allows multi-arity `elems` and accumulator. If `elems` -is a (possibly nested) list or tuple of tensors, then each of these tensors -must have a matching first (unpack) dimension. The second argument of -`fn` must match the structure of `elems`. - -If no `initializer` is provided, the output structure and dtypes of `fn` -are assumed to be the same as its input; and in this case, the first -argument of `fn` must match the structure of `elems`. - -If an `initializer` is provided, then the output of `fn` must have the same -structure as `initializer`; and the first argument of `fn` must match -this structure. - -For example, if `elems` is `(t1, [t2, t3])` and `initializer` is -`[i1, i2]` then an appropriate signature for `fn` in `python2` is: -`fn = lambda (acc_p1, acc_p2), (t1 [t2, t3]):` and `fn` must return a list, -`[acc_n1, acc_n2]`. An alternative correct signature for `fn`, and the - one that works in `python3`, is: -`fn = lambda a, t:`, where `a` and `t` correspond to the input tuples. - -##### Args: - - -* `fn`: The callable to be performed. It accepts two arguments. The first - will have the same structure as `initializer` if one is provided, - otherwise it will have the same structure as `elems`. The second - will have the same (possibly nested) structure as `elems`. Its output - must have the same structure as `initializer` if one is provided, - otherwise it must have the same structure as `elems`. -* `elems`: A tensor or (possibly nested) sequence of tensors, each of which - will be unpacked along their first dimension. The nested sequence - of the resulting slices will be the first argument to `fn`. -* `initializer`: (optional) A tensor or (possibly nested) sequence of tensors, - initial value for the accumulator, and the expected output type of `fn`. -* `parallel_iterations`: (optional) The number of iterations allowed to run - in parallel. -* `back_prop`: (optional) True enables support for back propagation. -* `swap_memory`: (optional) True enables GPU-CPU memory swapping. -* `infer_shape`: (optional) False disables tests for consistent output shapes. -* `name`: (optional) Name prefix for the returned tensors. - -##### Returns: - - A tensor or (possibly nested) sequence of tensors. Each tensor packs the - results of applying `fn` to tensors unpacked from `elems` along the first - dimension, and the previous accumulator value(s), from first to last. - -##### Raises: - - -* `TypeError`: if `fn` is not callable or the structure of the output of - `fn` and `initializer` do not match. -* `ValueError`: if the lengths of the output of `fn` and `initializer` - do not match. - -##### Examples: - - ```python - elems = np.array([1, 2, 3, 4, 5, 6]) - sum = scan(lambda a, x: a + x, elems) - # sum == [1, 3, 6, 10, 15, 21] - ``` - - ```python - elems = np.array([1, 2, 3, 4, 5, 6]) - initializer = np.array(0) - sum_one = scan( - lambda a, x: x[0] - x[1] + a, (elems + 1, elems), initializer) - # sum_one == [1, 2, 3, 4, 5, 6] - ``` - - ```python - elems = np.array([1, 0, 0, 0, 0, 0]) - initializer = (np.array(0), np.array(1)) - fibonaccis = scan(lambda a, _: (a[1], a[0] + a[1]), elems, initializer) - # fibonaccis == ([1, 1, 2, 3, 5, 8], [1, 2, 3, 5, 8, 13]) - ``` - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.size.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.size.md deleted file mode 100644 index 3df6d4cb2f..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.size.md +++ /dev/null @@ -1,26 +0,0 @@ -### `tf.size(input, name=None, out_type=tf.int32)` {#size} - -Returns the size of a tensor. - -This operation returns an integer representing the number of elements in -`input`. - -For example: - -```python -# 't' is [[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]] -size(t) ==> 12 -``` - -##### Args: - - -* `input`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). -* `out_type`: (Optional) The specified output type of the operation - (`int32` or `int64`). Defaults to tf.int32. - -##### Returns: - - A `Tensor` of type `out_type`. Defaults to tf.int32. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.space_to_batch.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.space_to_batch.md deleted file mode 100644 index f61b0dfe08..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.space_to_batch.md +++ /dev/null @@ -1,110 +0,0 @@ -### `tf.space_to_batch(input, paddings, block_size, name=None)` {#space_to_batch} - -SpaceToBatch for 4-D tensors of type T. - -This is a legacy version of the more general SpaceToBatchND. - -Zero-pads and then rearranges (permutes) blocks of spatial data into batch. -More specifically, this op outputs a copy of the input tensor where values from -the `height` and `width` dimensions are moved to the `batch` dimension. After -the zero-padding, both `height` and `width` of the input must be divisible by the -block size. - -##### Args: - - -* `input`: A `Tensor`. 4-D with shape `[batch, height, width, depth]`. -* `paddings`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - 2-D tensor of non-negative integers with shape `[2, 2]`. It specifies - the padding of the input with zeros across the spatial dimensions as follows: - - paddings = [[pad_top, pad_bottom], [pad_left, pad_right]] - - The effective spatial dimensions of the zero-padded input tensor will be: - - height_pad = pad_top + height + pad_bottom - width_pad = pad_left + width + pad_right - - The attr `block_size` must be greater than one. It indicates the block size. - - * Non-overlapping blocks of size `block_size x block size` in the height and - width dimensions are rearranged into the batch dimension at each location. - * The batch of the output tensor is `batch * block_size * block_size`. - * Both height_pad and width_pad must be divisible by block_size. - - The shape of the output will be: - - [batch*block_size*block_size, height_pad/block_size, width_pad/block_size, - depth] - - Some examples: - - (1) For the following input of shape `[1, 2, 2, 1]` and block_size of 2: - - ```prettyprint - x = [[[[1], [2]], [[3], [4]]]] - ``` - - The output tensor has shape `[4, 1, 1, 1]` and value: - - ```prettyprint - [[[[1]]], [[[2]]], [[[3]]], [[[4]]]] - ``` - - (2) For the following input of shape `[1, 2, 2, 3]` and block_size of 2: - - ```prettyprint - x = [[[[1, 2, 3], [4, 5, 6]], - [[7, 8, 9], [10, 11, 12]]]] - ``` - - The output tensor has shape `[4, 1, 1, 3]` and value: - - ```prettyprint - [[[1, 2, 3]], [[4, 5, 6]], [[7, 8, 9]], [[10, 11, 12]]] - ``` - - (3) For the following input of shape `[1, 4, 4, 1]` and block_size of 2: - - ```prettyprint - x = [[[[1], [2], [3], [4]], - [[5], [6], [7], [8]], - [[9], [10], [11], [12]], - [[13], [14], [15], [16]]]] - ``` - - The output tensor has shape `[4, 2, 2, 1]` and value: - - ```prettyprint - x = [[[[1], [3]], [[9], [11]]], - [[[2], [4]], [[10], [12]]], - [[[5], [7]], [[13], [15]]], - [[[6], [8]], [[14], [16]]]] - ``` - - (4) For the following input of shape `[2, 2, 4, 1]` and block_size of 2: - - ```prettyprint - x = [[[[1], [2], [3], [4]], - [[5], [6], [7], [8]]], - [[[9], [10], [11], [12]], - [[13], [14], [15], [16]]]] - ``` - - The output tensor has shape `[8, 1, 2, 1]` and value: - - ```prettyprint - x = [[[[1], [3]]], [[[9], [11]]], [[[2], [4]]], [[[10], [12]]], - [[[5], [7]]], [[[13], [15]]], [[[6], [8]]], [[[14], [16]]]] - ``` - - Among others, this operation is useful for reducing atrous convolution into - regular convolution. - -* `block_size`: An `int` that is `>= 2`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.sparse_mask.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.sparse_mask.md deleted file mode 100644 index 84f65ec55c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.sparse_mask.md +++ /dev/null @@ -1,40 +0,0 @@ -### `tf.sparse_mask(a, mask_indices, name=None)` {#sparse_mask} - -Masks elements of `IndexedSlices`. - -Given an `IndexedSlices` instance `a`, returns another `IndexedSlices` that -contains a subset of the slices of `a`. Only the slices at indices not -specified in `mask_indices` are returned. - -This is useful when you need to extract a subset of slices in an -`IndexedSlices` object. - -For example: - -```python -# `a` contains slices at indices [12, 26, 37, 45] from a large tensor -# with shape [1000, 10] -a.indices => [12, 26, 37, 45] -tf.shape(a.values) => [4, 10] - -# `b` will be the subset of `a` slices at its second and third indices, so -# we want to mask its first and last indices (which are at absolute -# indices 12, 45) -b = tf.sparse_mask(a, [12, 45]) - -b.indices => [26, 37] -tf.shape(b.values) => [2, 10] - -``` - -##### Args: - - -* `a`: An `IndexedSlices` instance. -* `mask_indices`: Indices of elements to mask. -* `name`: A name for the operation (optional). - -##### Returns: - - The masked `IndexedSlices` instance. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.sparse_merge.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.sparse_merge.md deleted file mode 100644 index 99b87e7455..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.sparse_merge.md +++ /dev/null @@ -1,98 +0,0 @@ -### `tf.sparse_merge(sp_ids, sp_values, vocab_size, name=None, already_sorted=False)` {#sparse_merge} - -Combines a batch of feature ids and values into a single `SparseTensor`. - -The most common use case for this function occurs when feature ids and -their corresponding values are stored in `Example` protos on disk. -`parse_example` will return a batch of ids and a batch of values, and this -function joins them into a single logical `SparseTensor` for use in -functions such as `sparse_tensor_dense_matmul`, `sparse_to_dense`, etc. - -The `SparseTensor` returned by this function has the following properties: - - - `indices` is equivalent to `sp_ids.indices` with the last - dimension discarded and replaced with `sp_ids.values`. - - `values` is simply `sp_values.values`. - - If `sp_ids.dense_shape = [D0, D1, ..., Dn, K]`, then - `output.shape = [D0, D1, ..., Dn, vocab_size]`. - -For example, consider the following feature vectors: - -```python - vector1 = [-3, 0, 0, 0, 0, 0] - vector2 = [ 0, 1, 0, 4, 1, 0] - vector3 = [ 5, 0, 0, 9, 0, 0] -``` - -These might be stored sparsely in the following Example protos by storing -only the feature ids (column number if the vectors are treated as a matrix) -of the non-zero elements and the corresponding values: - -```python - examples = [Example(features={ - "ids": Feature(int64_list=Int64List(value=[0])), - "values": Feature(float_list=FloatList(value=[-3]))}), - Example(features={ - "ids": Feature(int64_list=Int64List(value=[1, 4, 3])), - "values": Feature(float_list=FloatList(value=[1, 1, 4]))}), - Example(features={ - "ids": Feature(int64_list=Int64List(value=[0, 3])), - "values": Feature(float_list=FloatList(value=[5, 9]))})] -``` - -The result of calling parse_example on these examples will produce a -dictionary with entries for "ids" and "values". Passing those two objects -to this function along with vocab_size=6, will produce a `SparseTensor` that -sparsely represents all three instances. Namely, the `indices` property will -contain the coordinates of the non-zero entries in the feature matrix (the -first dimension is the row number in the matrix, i.e., the index within the -batch, and the second dimension is the column number, i.e., the feature id); -`values` will contain the actual values. `shape` will be the shape of the -original matrix, i.e., (3, 6). For our example above, the output will be -equal to: - -```python - SparseTensor(indices=[[0, 0], [1, 1], [1, 3], [1, 4], [2, 0], [2, 3]], - values=[-3, 1, 4, 1, 5, 9], - dense_shape=[3, 6]) -``` - -This method generalizes to higher-dimensions by simply providing a list for -both the sp_ids as well as the vocab_size. -In this case the resulting `SparseTensor` has the following properties: - - `indices` is equivalent to `sp_ids[0].indices` with the last - dimension discarded and concatenated with - `sp_ids[0].values, sp_ids[1].values, ...`. - - `values` is simply `sp_values.values`. - - If `sp_ids.dense_shape = [D0, D1, ..., Dn, K]`, then - `output.shape = [D0, D1, ..., Dn] + vocab_size`. - -##### Args: - - -* `sp_ids`: A single `SparseTensor` with `values` property of type `int32` - or `int64` or a Python list of such `SparseTensor`s or a list thereof. -* `sp_values`: A`SparseTensor` of any type. -* `vocab_size`: A scalar `int64` Tensor (or Python int) containing the new size - of the last dimension, `all(0 <= sp_ids.values < vocab_size)`. - Or a list thereof with `all(0 <= sp_ids[i].values < vocab_size[i])` for - all `i`. -* `name`: A name prefix for the returned tensors (optional) -* `already_sorted`: A boolean to specify whether the per-batch values in - `sp_values` are already sorted. If so skip sorting, False by default - (optional). - -##### Returns: - - A `SparseTensor` compactly representing a batch of feature ids and values, - useful for passing to functions that expect such a `SparseTensor`. - -##### Raises: - - -* `TypeError`: If `sp_values` is not a `SparseTensor`. Or if `sp_ids` is neither - a `SparseTensor` nor a list thereof. Or if `vocab_size` is not a - `Tensor` or a Python int and `sp_ids` is a `SparseTensor`. Or if - `vocab_size` is not a or list thereof and `sp_ids` is a list. -* `ValueError`: If `sp_ids` and `vocab_size` are lists of different lengths. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.sparse_reshape.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.sparse_reshape.md deleted file mode 100644 index 263f676fc1..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.sparse_reshape.md +++ /dev/null @@ -1,51 +0,0 @@ -### `tf.sparse_reshape(sp_input, shape, name=None)` {#sparse_reshape} - -Reshapes a `SparseTensor` to represent values in a new dense shape. - -This operation has the same semantics as `reshape` on the represented dense -tensor. The indices of non-empty values in `sp_input` are recomputed based -on the new dense shape, and a new `SparseTensor` is returned containing the -new indices and new shape. The order of non-empty values in `sp_input` is -unchanged. - -If one component of `shape` is the special value -1, the size of that -dimension is computed so that the total dense size remains constant. At -most one component of `shape` can be -1. The number of dense elements -implied by `shape` must be the same as the number of dense elements -originally represented by `sp_input`. - -For example, if `sp_input` has shape `[2, 3, 6]` and `indices` / `values`: - - [0, 0, 0]: a - [0, 0, 1]: b - [0, 1, 0]: c - [1, 0, 0]: d - [1, 2, 3]: e - -and `shape` is `[9, -1]`, then the output will be a `SparseTensor` of -shape `[9, 4]` and `indices` / `values`: - - [0, 0]: a - [0, 1]: b - [1, 2]: c - [4, 2]: d - [8, 1]: e - -##### Args: - - -* `sp_input`: The input `SparseTensor`. -* `shape`: A 1-D (vector) int64 `Tensor` specifying the new dense shape of the - represented `SparseTensor`. -* `name`: A name prefix for the returned tensors (optional) - -##### Returns: - - A `SparseTensor` with the same non-empty values but with indices calculated - by the new dense shape. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.squared_difference.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.squared_difference.md deleted file mode 100644 index 19f25f473d..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.squared_difference.md +++ /dev/null @@ -1,18 +0,0 @@ -### `tf.squared_difference(x, y, name=None)` {#squared_difference} - -Returns (x - y)(x - y) element-wise. - -*NOTE*: `SquaredDifference` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.string_to_number.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.string_to_number.md deleted file mode 100644 index c6837bfa4a..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.string_to_number.md +++ /dev/null @@ -1,20 +0,0 @@ -### `tf.string_to_number(string_tensor, out_type=None, name=None)` {#string_to_number} - -Converts each string in the input Tensor to the specified numeric type. - -(Note that int32 overflow results in an error while float overflow -results in a rounded value.) - -##### Args: - - -* `string_tensor`: A `Tensor` of type `string`. -* `out_type`: An optional `tf.DType` from: `tf.float32, tf.int32`. Defaults to `tf.float32`. - The numeric type to interpret each string in `string_tensor` as. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `out_type`. - A Tensor of the same shape as the input `string_tensor`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.summary.TaggedRunMetadata.FromString.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.summary.TaggedRunMetadata.FromString.md deleted file mode 100644 index 613f4ebd73..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.summary.TaggedRunMetadata.FromString.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.summary.TaggedRunMetadata.FromString(s)` {#TaggedRunMetadata.FromString} - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.tanh.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.tanh.md deleted file mode 100644 index 154a13059c..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.tanh.md +++ /dev/null @@ -1,16 +0,0 @@ -### `tf.tanh(x, name=None)` {#tanh} - -Computes hyperbolic tangent of `x` element-wise. - -##### Args: - - -* `x`: A Tensor or SparseTensor with type `float`, `double`, `int32`, - `complex64`, `int64`, or `qint32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A Tensor or SparseTensor respectively with the same type as `x` if - `x.dtype != qint32` otherwise the return type is `quint8`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.test.is_gpu_available.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.test.is_gpu_available.md deleted file mode 100644 index db6132b259..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.test.is_gpu_available.md +++ /dev/null @@ -1,13 +0,0 @@ -### `tf.test.is_gpu_available(cuda_only=False)` {#is_gpu_available} - -Returns whether TensorFlow can access a GPU. - -##### Args: - - -* `cuda_only`: limit the search to CUDA gpus. - -##### Returns: - - True iff a gpu device of the requested kind is available. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.to_bfloat16.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.to_bfloat16.md deleted file mode 100644 index 3d55da1110..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.to_bfloat16.md +++ /dev/null @@ -1,19 +0,0 @@ -### `tf.to_bfloat16(x, name='ToBFloat16')` {#to_bfloat16} - -Casts a tensor to type `bfloat16`. - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` with same shape as `x` with type `bfloat16`. - -##### Raises: - - -* `TypeError`: If `x` cannot be cast to the `bfloat16`. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.FeedFnHook.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.FeedFnHook.md deleted file mode 100644 index 1797a0d3b5..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.FeedFnHook.md +++ /dev/null @@ -1,88 +0,0 @@ -Runs `feed_fn` and sets the `feed_dict` accordingly. -- - - - -#### `tf.train.FeedFnHook.__init__(feed_fn)` {#FeedFnHook.__init__} - -Constructs the FeedFnHook with given `feed_fn`. - -##### Args: - - -* `feed_fn`: function, no arguments and returns `dict` to feed. - - -- - - - -#### `tf.train.FeedFnHook.after_create_session(session, coord)` {#FeedFnHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.FeedFnHook.after_run(run_context, run_values)` {#FeedFnHook.after_run} - -Called after each call to run(). - -The `run_values` argument contains results of requested ops/tensors by -`before_run()`. - -The `run_context` argument is the same one send to `before_run` call. -`run_context.request_stop()` can be called to stop the iteration. - -##### Args: - - -* `run_context`: A `SessionRunContext` object. -* `run_values`: A SessionRunValues object. - - -- - - - -#### `tf.train.FeedFnHook.before_run(run_context)` {#FeedFnHook.before_run} - - - - -- - - - -#### `tf.train.FeedFnHook.begin()` {#FeedFnHook.begin} - -Called once before using the session. - -When called, the default graph is the one that will be launched in the -session. The hook can modify the graph by adding new operations to it. -After the `begin()` call the graph will be finalized and the other callbacks -can not modify the graph anymore. Second call of `begin()` on the same -graph, should not change the graph. - - -- - - - -#### `tf.train.FeedFnHook.end(session)` {#FeedFnHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.FinalOpsHook.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.FinalOpsHook.md deleted file mode 100644 index bf8e7184b6..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.FinalOpsHook.md +++ /dev/null @@ -1,111 +0,0 @@ -A run hook which evaluates `Tensors` at the end of a session. -- - - - -#### `tf.train.FinalOpsHook.__init__(final_ops, final_ops_feed_dict=None)` {#FinalOpsHook.__init__} - -Constructs the FinalOpHook with ops to run at the end of the session. - -##### Args: - - -* `final_ops`: A single `Tensor`, a list of `Tensors` or a dictionary of - names to `Tensors`. -* `final_ops_feed_dict`: A feed dictionary to use when running - `final_ops_dict`. - - -- - - - -#### `tf.train.FinalOpsHook.after_create_session(session, coord)` {#FinalOpsHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.FinalOpsHook.after_run(run_context, run_values)` {#FinalOpsHook.after_run} - -Called after each call to run(). - -The `run_values` argument contains results of requested ops/tensors by -`before_run()`. - -The `run_context` argument is the same one send to `before_run` call. -`run_context.request_stop()` can be called to stop the iteration. - -##### Args: - - -* `run_context`: A `SessionRunContext` object. -* `run_values`: A SessionRunValues object. - - -- - - - -#### `tf.train.FinalOpsHook.before_run(run_context)` {#FinalOpsHook.before_run} - -Called before each call to run(). - -You can return from this call a `SessionRunArgs` object indicating ops or -tensors to add to the upcoming `run()` call. These ops/tensors will be run -together with the ops/tensors originally passed to the original run() call. -The run args you return can also contain feeds to be added to the run() -call. - -The `run_context` argument is a `SessionRunContext` that provides -information about the upcoming `run()` call: the originally requested -op/tensors, the TensorFlow Session. - -At this point graph is finalized and you can not add ops. - -##### Args: - - -* `run_context`: A `SessionRunContext` object. - -##### Returns: - - None or a `SessionRunArgs` object. - - -- - - - -#### `tf.train.FinalOpsHook.begin()` {#FinalOpsHook.begin} - -Called once before using the session. - -When called, the default graph is the one that will be launched in the -session. The hook can modify the graph by adding new operations to it. -After the `begin()` call the graph will be finalized and the other callbacks -can not modify the graph anymore. Second call of `begin()` on the same -graph, should not change the graph. - - -- - - - -#### `tf.train.FinalOpsHook.end(session)` {#FinalOpsHook.end} - - - - -- - - - -#### `tf.train.FinalOpsHook.final_ops_values` {#FinalOpsHook.final_ops_values} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.NanLossDuringTrainingError.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.NanLossDuringTrainingError.md deleted file mode 100644 index d568c56114..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.NanLossDuringTrainingError.md +++ /dev/null @@ -1,8 +0,0 @@ - -- - - - -#### `tf.train.NanLossDuringTrainingError.__str__()` {#NanLossDuringTrainingError.__str__} - - - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.ProximalAdagradOptimizer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.ProximalAdagradOptimizer.md deleted file mode 100644 index 002dabfbf9..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.ProximalAdagradOptimizer.md +++ /dev/null @@ -1,30 +0,0 @@ -Optimizer that implements the Proximal Adagrad algorithm. - -See this [paper](http://papers.nips.cc/paper/3793-efficient-learning-using-forward-backward-splitting.pdf). - -- - - - -#### `tf.train.ProximalAdagradOptimizer.__init__(learning_rate, initial_accumulator_value=0.1, l1_regularization_strength=0.0, l2_regularization_strength=0.0, use_locking=False, name='ProximalAdagrad')` {#ProximalAdagradOptimizer.__init__} - -Construct a new ProximalAdagrad optimizer. - -##### Args: - - -* `learning_rate`: A `Tensor` or a floating point value. The learning rate. -* `initial_accumulator_value`: A floating point value. - Starting value for the accumulators, must be positive. -* `l1_regularization_strength`: A float value, must be greater than or - equal to zero. -* `l2_regularization_strength`: A float value, must be greater than or - equal to zero. -* `use_locking`: If `True` use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "Adagrad". - -##### Raises: - - -* `ValueError`: If the `initial_accumulator_value` is invalid. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.SessionRunValues.__new__.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.SessionRunValues.__new__.md deleted file mode 100644 index 3540616254..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.SessionRunValues.__new__.md +++ /dev/null @@ -1,4 +0,0 @@ -#### `tf.train.SessionRunValues.__new__(_cls, results, options, run_metadata)` {#SessionRunValues.__new__} - -Create new instance of SessionRunValues(results, options, run_metadata) - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.StepCounterHook.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.StepCounterHook.md deleted file mode 100644 index 50ebc652ab..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.StepCounterHook.md +++ /dev/null @@ -1,65 +0,0 @@ -Steps per second monitor. -- - - - -#### `tf.train.StepCounterHook.__init__(every_n_steps=100, every_n_secs=None, output_dir=None, summary_writer=None)` {#StepCounterHook.__init__} - - - - -- - - - -#### `tf.train.StepCounterHook.after_create_session(session, coord)` {#StepCounterHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.StepCounterHook.after_run(run_context, run_values)` {#StepCounterHook.after_run} - - - - -- - - - -#### `tf.train.StepCounterHook.before_run(run_context)` {#StepCounterHook.before_run} - - - - -- - - - -#### `tf.train.StepCounterHook.begin()` {#StepCounterHook.begin} - - - - -- - - - -#### `tf.train.StepCounterHook.end(session)` {#StepCounterHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.input_producer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.input_producer.md deleted file mode 100644 index c98eed194e..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.input_producer.md +++ /dev/null @@ -1,42 +0,0 @@ -### `tf.train.input_producer(input_tensor, element_shape=None, num_epochs=None, shuffle=True, seed=None, capacity=32, shared_name=None, summary_name=None, name=None, cancel_op=None)` {#input_producer} - -Output the rows of `input_tensor` to a queue for an input pipeline. - -Note: if `num_epochs` is not `None`, this function creates local counter -`epochs`. Use `local_variables_initializer()` to initialize local variables. - -##### Args: - - -* `input_tensor`: A tensor with the rows to produce. Must be at least - one-dimensional. Must either have a fully-defined shape, or - `element_shape` must be defined. -* `element_shape`: (Optional.) A `TensorShape` representing the shape of a - row of `input_tensor`, if it cannot be inferred. -* `num_epochs`: (Optional.) An integer. If specified `input_producer` produces - each row of `input_tensor` `num_epochs` times before generating an - `OutOfRange` error. If not specified, `input_producer` can cycle through - the rows of `input_tensor` an unlimited number of times. -* `shuffle`: (Optional.) A boolean. If true, the rows are randomly shuffled - within each epoch. -* `seed`: (Optional.) An integer. The seed to use if `shuffle` is true. -* `capacity`: (Optional.) The capacity of the queue to be used for buffering - the input. -* `shared_name`: (Optional.) If set, this queue will be shared under the given - name across multiple sessions. -* `summary_name`: (Optional.) If set, a scalar summary for the current queue - size will be generated, using this name as part of the tag. -* `name`: (Optional.) A name for queue. -* `cancel_op`: (Optional.) Cancel op for the queue - -##### Returns: - - A queue with the output rows. A `QueueRunner` for the queue is - added to the current `QUEUE_RUNNER` collection of the current - graph. - -##### Raises: - - -* `ValueError`: If the shape of the input cannot be inferred from the arguments. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.string_input_producer.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.string_input_producer.md deleted file mode 100644 index 1aba482ef0..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.string_input_producer.md +++ /dev/null @@ -1,36 +0,0 @@ -### `tf.train.string_input_producer(string_tensor, num_epochs=None, shuffle=True, seed=None, capacity=32, shared_name=None, name=None, cancel_op=None)` {#string_input_producer} - -Output strings (e.g. filenames) to a queue for an input pipeline. - -Note: if `num_epochs` is not `None`, this function creates local counter -`epochs`. Use `local_variables_initializer()` to initialize local variables. - -##### Args: - - -* `string_tensor`: A 1-D string tensor with the strings to produce. -* `num_epochs`: An integer (optional). If specified, `string_input_producer` - produces each string from `string_tensor` `num_epochs` times before - generating an `OutOfRange` error. If not specified, - `string_input_producer` can cycle through the strings in `string_tensor` - an unlimited number of times. -* `shuffle`: Boolean. If true, the strings are randomly shuffled within each - epoch. -* `seed`: An integer (optional). Seed used if shuffle == True. -* `capacity`: An integer. Sets the queue capacity. -* `shared_name`: (optional). If set, this queue will be shared under the given - name across multiple sessions. -* `name`: A name for the operations (optional). -* `cancel_op`: Cancel op for the queue (optional). - -##### Returns: - - A queue with the output strings. A `QueueRunner` for the Queue - is added to the current `Graph`'s `QUEUE_RUNNER` collection. - -##### Raises: - - -* `ValueError`: If the string_tensor is a null Python list. At runtime, - will fail with an assertion if string_tensor becomes a null tensor. - diff --git a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.summary_iterator.md b/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.summary_iterator.md deleted file mode 100644 index f998e62046..0000000000 --- a/tensorflow/g3doc/api_docs/python/functions_and_classes/shard9/tf.train.summary_iterator.md +++ /dev/null @@ -1,42 +0,0 @@ -### `tf.train.summary_iterator(path)` {#summary_iterator} - -An iterator for reading `Event` protocol buffers from an event file. - -You can use this function to read events written to an event file. It returns -a Python iterator that yields `Event` protocol buffers. - -Example: Print the contents of an events file. - -```python -for e in tf.train.summary_iterator(path to events file): - print(e) -``` - -Example: Print selected summary values. - -```python -# This example supposes that the events file contains summaries with a -# summary value tag 'loss'. These could have been added by calling -# `add_summary()`, passing the output of a scalar summary op created with -# with: `tf.summary.scalar('loss', loss_tensor)`. -for e in tf.train.summary_iterator(path to events file): - for v in e.summary.value: - if v.tag == 'loss': - print(v.simple_value) -``` - -See the protocol buffer definitions of -[Event](https://www.tensorflow.org/code/tensorflow/core/util/event.proto) -and -[Summary](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto) -for more information about their attributes. - -##### Args: - - -* `path`: The path to an event file created by a `SummaryWriter`. - -##### Yields: - - `Event` protocol buffers. - diff --git a/tensorflow/g3doc/api_docs/python/histogram_ops.md b/tensorflow/g3doc/api_docs/python/histogram_ops.md deleted file mode 100644 index e9fa732e60..0000000000 --- a/tensorflow/g3doc/api_docs/python/histogram_ops.md +++ /dev/null @@ -1,48 +0,0 @@ - - -# Histograms -[TOC] - -Histograms. Please see @{$python/histogram_ops} guide. - -- - - - -### `tf.histogram_fixed_width(values, value_range, nbins=100, dtype=tf.int32, name=None)` {#histogram_fixed_width} - -Return histogram of values. - -Given the tensor `values`, this operation returns a rank 1 histogram counting -the number of entries in `values` that fell into every bin. The bins are -equal width and determined by the arguments `value_range` and `nbins`. - -##### Args: - - -* `values`: Numeric `Tensor`. -* `value_range`: Shape [2] `Tensor`. new_values <= value_range[0] will be - mapped to hist[0], values >= value_range[1] will be mapped to hist[-1]. - Must be same dtype as new_values. -* `nbins`: Scalar `int32 Tensor`. Number of histogram bins. -* `dtype`: dtype for returned histogram. -* `name`: A name for this operation (defaults to 'histogram_fixed_width'). - -##### Returns: - - A 1-D `Tensor` holding histogram of values. - - -* `Examples`: - -```python -# Bins will be: (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf) -nbins = 5 -value_range = [0.0, 5.0] -new_values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15] - -with tf.default_session() as sess: - hist = tf.histogram_fixed_width(new_values, value_range, nbins=5) - variables.global_variables_initializer().run() - sess.run(hist) => [2, 1, 1, 0, 2] -``` - - diff --git a/tensorflow/g3doc/api_docs/python/image.md b/tensorflow/g3doc/api_docs/python/image.md deleted file mode 100644 index 8d233dcadb..0000000000 --- a/tensorflow/g3doc/api_docs/python/image.md +++ /dev/null @@ -1,1415 +0,0 @@ - - -# Images - -Note: Functions taking `Tensor` arguments can also take anything accepted by -[`tf.convert_to_tensor`](framework.md#convert_to_tensor). - -[TOC] - -Image processing and decoding ops. See the @{$python/image} guide. - -- - - - -### `tf.image.decode_gif(contents, name=None)` {#decode_gif} - -Decode the first frame of a GIF-encoded image to a uint8 tensor. - -GIF with frame or transparency compression are not supported -convert animated GIF from compressed to uncompressed by: - -convert $src.gif -coalesce $dst.gif - -##### Args: - - -* `contents`: A `Tensor` of type `string`. 0-D. The GIF-encoded image. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `uint8`. - 4-D with shape `[num_frames, height, width, 3]`. RGB order - - -- - - - -### `tf.image.decode_jpeg(contents, channels=None, ratio=None, fancy_upscaling=None, try_recover_truncated=None, acceptable_fraction=None, dct_method=None, name=None)` {#decode_jpeg} - -Decode a JPEG-encoded image to a uint8 tensor. - -The attr `channels` indicates the desired number of color channels for the -decoded image. - -Accepted values are: - -* 0: Use the number of channels in the JPEG-encoded image. -* 1: output a grayscale image. -* 3: output an RGB image. - -If needed, the JPEG-encoded image is transformed to match the requested number -of color channels. - -The attr `ratio` allows downscaling the image by an integer factor during -decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than -downscaling the image later. - -##### Args: - - -* `contents`: A `Tensor` of type `string`. 0-D. The JPEG-encoded image. -* `channels`: An optional `int`. Defaults to `0`. - Number of color channels for the decoded image. -* `ratio`: An optional `int`. Defaults to `1`. Downscaling ratio. -* `fancy_upscaling`: An optional `bool`. Defaults to `True`. - If true use a slower but nicer upscaling of the - chroma planes (yuv420/422 only). -* `try_recover_truncated`: An optional `bool`. Defaults to `False`. - If true try to recover an image from truncated input. -* `acceptable_fraction`: An optional `float`. Defaults to `1`. - The minimum required fraction of lines before a truncated - input is accepted. -* `dct_method`: An optional `string`. Defaults to `""`. - string specifying a hint about the algorithm used for - decompression. Defaults to "" which maps to a system-specific - default. Currently valid values are ["INTEGER_FAST", - "INTEGER_ACCURATE"]. The hint may be ignored (e.g., the internal - jpeg library changes to a version that does not have that specific - option.) -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `uint8`. 3-D with shape `[height, width, channels]`.. - - -- - - - -### `tf.image.encode_jpeg(image, format=None, quality=None, progressive=None, optimize_size=None, chroma_downsampling=None, density_unit=None, x_density=None, y_density=None, xmp_metadata=None, name=None)` {#encode_jpeg} - -JPEG-encode an image. - -`image` is a 3-D uint8 Tensor of shape `[height, width, channels]`. - -The attr `format` can be used to override the color format of the encoded -output. Values can be: - -* `''`: Use a default format based on the number of channels in the image. -* `grayscale`: Output a grayscale JPEG image. The `channels` dimension - of `image` must be 1. -* `rgb`: Output an RGB JPEG image. The `channels` dimension - of `image` must be 3. - -If `format` is not specified or is the empty string, a default format is picked -in function of the number of channels in `image`: - -* 1: Output a grayscale image. -* 3: Output an RGB image. - -##### Args: - - -* `image`: A `Tensor` of type `uint8`. - 3-D with shape `[height, width, channels]`. -* `format`: An optional `string` from: `"", "grayscale", "rgb"`. Defaults to `""`. - Per pixel image format. -* `quality`: An optional `int`. Defaults to `95`. - Quality of the compression from 0 to 100 (higher is better and slower). -* `progressive`: An optional `bool`. Defaults to `False`. - If True, create a JPEG that loads progressively (coarse to fine). -* `optimize_size`: An optional `bool`. Defaults to `False`. - If True, spend CPU/RAM to reduce size with no quality change. -* `chroma_downsampling`: An optional `bool`. Defaults to `True`. - See http://en.wikipedia.org/wiki/Chroma_subsampling. -* `density_unit`: An optional `string` from: `"in", "cm"`. Defaults to `"in"`. - Unit used to specify `x_density` and `y_density`: - pixels per inch (`'in'`) or centimeter (`'cm'`). -* `x_density`: An optional `int`. Defaults to `300`. - Horizontal pixels per density unit. -* `y_density`: An optional `int`. Defaults to `300`. - Vertical pixels per density unit. -* `xmp_metadata`: An optional `string`. Defaults to `""`. - If not empty, embed this XMP metadata in the image header. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. 0-D. JPEG-encoded image. - - -- - - - -### `tf.image.decode_png(contents, channels=None, dtype=None, name=None)` {#decode_png} - -Decode a PNG-encoded image to a uint8 or uint16 tensor. - -The attr `channels` indicates the desired number of color channels for the -decoded image. - -Accepted values are: - -* 0: Use the number of channels in the PNG-encoded image. -* 1: output a grayscale image. -* 3: output an RGB image. -* 4: output an RGBA image. - -If needed, the PNG-encoded image is transformed to match the requested number -of color channels. - -##### Args: - - -* `contents`: A `Tensor` of type `string`. 0-D. The PNG-encoded image. -* `channels`: An optional `int`. Defaults to `0`. - Number of color channels for the decoded image. -* `dtype`: An optional `tf.DType` from: `tf.uint8, tf.uint16`. Defaults to `tf.uint8`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `dtype`. 3-D with shape `[height, width, channels]`. - - -- - - - -### `tf.image.encode_png(image, compression=None, name=None)` {#encode_png} - -PNG-encode an image. - -`image` is a 3-D uint8 or uint16 Tensor of shape `[height, width, channels]` -where `channels` is: - -* 1: for grayscale. -* 2: for grayscale + alpha. -* 3: for RGB. -* 4: for RGBA. - -The ZLIB compression level, `compression`, can be -1 for the PNG-encoder -default or a value from 0 to 9. 9 is the highest compression level, generating -the smallest output, but is slower. - -##### Args: - - -* `image`: A `Tensor`. Must be one of the following types: `uint8`, `uint16`. - 3-D with shape `[height, width, channels]`. -* `compression`: An optional `int`. Defaults to `-1`. Compression level. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. 0-D. PNG-encoded image. - - -- - - - -### `tf.image.decode_image(contents, channels=None, name=None)` {#decode_image} - -Convenience function for `decode_gif`, `decode_jpeg`, and `decode_png`. -Detects whether an image is a GIF, JPEG, or PNG, and performs the appropriate -operation to convert the input bytes `string` into a `Tensor` of type `uint8`. - -Note: `decode_gif` returns a 4-D array `[num_frames, height, width, 3]`, as -opposed to `decode_jpeg` and `decode_png`, which return 3-D arrays -`[height, width, num_channels]`. Make sure to take this into account when -constructing your graph if you are intermixing GIF files with JPEG and/or PNG -files. - -##### Args: - - -* `contents`: 0-D `string`. The encoded image bytes. -* `channels`: An optional `int`. Defaults to `0`. Number of color channels for - the decoded image. -* `name`: A name for the operation (optional) - -##### Returns: - - `Tensor` with type `uint8` with shape `[height, width, num_channels]` for - JPEG and PNG images and shape `[num_frames, height, width, 3]` for GIF - images. - - -- - - - -### `tf.image.resize_images(images, size, method=0, align_corners=False)` {#resize_images} - -Resize `images` to `size` using the specified `method`. - -Resized images will be distorted if their original aspect ratio is not -the same as `size`. To avoid distortions see -[`resize_image_with_crop_or_pad`](#resize_image_with_crop_or_pad). - -`method` can be one of: - -* `ResizeMethod.BILINEAR`: [Bilinear interpolation.](https://en.wikipedia.org/wiki/Bilinear_interpolation) -* `ResizeMethod.NEAREST_NEIGHBOR`: [Nearest neighbor interpolation.](https://en.wikipedia.org/wiki/Nearest-neighbor_interpolation) -* `ResizeMethod.BICUBIC`: [Bicubic interpolation.](https://en.wikipedia.org/wiki/Bicubic_interpolation) -* `ResizeMethod.AREA`: Area interpolation. - -##### Args: - - -* `images`: 4-D Tensor of shape `[batch, height, width, channels]` or - 3-D Tensor of shape `[height, width, channels]`. -* `size`: A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The - new size for the images. -* `method`: ResizeMethod. Defaults to `ResizeMethod.BILINEAR`. -* `align_corners`: bool. If true, exactly align all 4 corners of the input and - output. Defaults to `false`. - -##### Raises: - - -* `ValueError`: if the shape of `images` is incompatible with the - shape arguments to this function -* `ValueError`: if `size` has invalid shape or type. -* `ValueError`: if an unsupported resize method is specified. - -##### Returns: - - If `images` was 4-D, a 4-D float Tensor of shape - `[batch, new_height, new_width, channels]`. - If `images` was 3-D, a 3-D float Tensor of shape - `[new_height, new_width, channels]`. - - -- - - - -### `tf.image.resize_area(images, size, align_corners=None, name=None)` {#resize_area} - -Resize `images` to `size` using area interpolation. - -Input images can be of different types but output images are always float. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int16`, `int32`, `int64`, `half`, `float32`, `float64`. - 4-D with shape `[batch, height, width, channels]`. -* `size`: A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The - new size for the images. -* `align_corners`: An optional `bool`. Defaults to `False`. - If true, rescale input by (new_height - 1) / (height - 1), which - exactly aligns the 4 corners of images and resized images. If false, rescale - by new_height / height. Treat similarly the width dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. 4-D with shape - `[batch, new_height, new_width, channels]`. - - -- - - - -### `tf.image.resize_bicubic(images, size, align_corners=None, name=None)` {#resize_bicubic} - -Resize `images` to `size` using bicubic interpolation. - -Input images can be of different types but output images are always float. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int16`, `int32`, `int64`, `half`, `float32`, `float64`. - 4-D with shape `[batch, height, width, channels]`. -* `size`: A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The - new size for the images. -* `align_corners`: An optional `bool`. Defaults to `False`. - If true, rescale input by (new_height - 1) / (height - 1), which - exactly aligns the 4 corners of images and resized images. If false, rescale - by new_height / height. Treat similarly the width dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. 4-D with shape - `[batch, new_height, new_width, channels]`. - - -- - - - -### `tf.image.resize_bilinear(images, size, align_corners=None, name=None)` {#resize_bilinear} - -Resize `images` to `size` using bilinear interpolation. - -Input images can be of different types but output images are always float. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int16`, `int32`, `int64`, `half`, `float32`, `float64`. - 4-D with shape `[batch, height, width, channels]`. -* `size`: A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The - new size for the images. -* `align_corners`: An optional `bool`. Defaults to `False`. - If true, rescale input by (new_height - 1) / (height - 1), which - exactly aligns the 4 corners of images and resized images. If false, rescale - by new_height / height. Treat similarly the width dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. 4-D with shape - `[batch, new_height, new_width, channels]`. - - -- - - - -### `tf.image.resize_nearest_neighbor(images, size, align_corners=None, name=None)` {#resize_nearest_neighbor} - -Resize `images` to `size` using nearest neighbor interpolation. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int16`, `int32`, `int64`, `half`, `float32`, `float64`. - 4-D with shape `[batch, height, width, channels]`. -* `size`: A 1-D int32 Tensor of 2 elements: `new_height, new_width`. The - new size for the images. -* `align_corners`: An optional `bool`. Defaults to `False`. - If true, rescale input by (new_height - 1) / (height - 1), which - exactly aligns the 4 corners of images and resized images. If false, rescale - by new_height / height. Treat similarly the width dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `images`. 4-D with shape - `[batch, new_height, new_width, channels]`. - - -- - - - -### `tf.image.resize_image_with_crop_or_pad(image, target_height, target_width)` {#resize_image_with_crop_or_pad} - -Crops and/or pads an image to a target width and height. - -Resizes an image to a target width and height by either centrally -cropping the image or padding it evenly with zeros. - -If `width` or `height` is greater than the specified `target_width` or -`target_height` respectively, this op centrally crops along that dimension. -If `width` or `height` is smaller than the specified `target_width` or -`target_height` respectively, this op centrally pads with 0 along that -dimension. - -##### Args: - - -* `image`: 3-D tensor of shape `[height, width, channels]` -* `target_height`: Target height. -* `target_width`: Target width. - -##### Raises: - - -* `ValueError`: if `target_height` or `target_width` are zero or negative. - -##### Returns: - - Cropped and/or padded image of shape - `[target_height, target_width, channels]` - - -- - - - -### `tf.image.central_crop(image, central_fraction)` {#central_crop} - -Crop the central region of the image. - -Remove the outer parts of an image but retain the central region of the image -along each dimension. If we specify central_fraction = 0.5, this function -returns the region marked with "X" in the below diagram. - - -------- - | | - | XXXX | - | XXXX | - | | where "X" is the central 50% of the image. - -------- - -##### Args: - - -* `image`: 3-D float Tensor of shape [height, width, depth] -* `central_fraction`: float (0, 1], fraction of size to crop - -##### Raises: - - -* `ValueError`: if central_crop_fraction is not within (0, 1]. - -##### Returns: - - 3-D float Tensor - - -- - - - -### `tf.image.pad_to_bounding_box(image, offset_height, offset_width, target_height, target_width)` {#pad_to_bounding_box} - -Pad `image` with zeros to the specified `height` and `width`. - -Adds `offset_height` rows of zeros on top, `offset_width` columns of -zeros on the left, and then pads the image on the bottom and right -with zeros until it has dimensions `target_height`, `target_width`. - -This op does nothing if `offset_*` is zero and the image already has size -`target_height` by `target_width`. - -##### Args: - - -* `image`: 3-D tensor with shape `[height, width, channels]` -* `offset_height`: Number of rows of zeros to add on top. -* `offset_width`: Number of columns of zeros to add on the left. -* `target_height`: Height of output image. -* `target_width`: Width of output image. - -##### Returns: - - 3-D tensor of shape `[target_height, target_width, channels]` - -##### Raises: - - -* `ValueError`: If the shape of `image` is incompatible with the `offset_*` or - `target_*` arguments, or either `offset_height` or `offset_width` is - negative. - - -- - - - -### `tf.image.crop_to_bounding_box(image, offset_height, offset_width, target_height, target_width)` {#crop_to_bounding_box} - -Crops an image to a specified bounding box. - -This op cuts a rectangular part out of `image`. The top-left corner of the -returned image is at `offset_height, offset_width` in `image`, and its -lower-right corner is at -`offset_height + target_height, offset_width + target_width`. - -##### Args: - - -* `image`: 3-D tensor with shape `[height, width, channels]` -* `offset_height`: Vertical coordinate of the top-left corner of the result in - the input. -* `offset_width`: Horizontal coordinate of the top-left corner of the result in - the input. -* `target_height`: Height of the result. -* `target_width`: Width of the result. - -##### Returns: - - 3-D tensor of image with shape `[target_height, target_width, channels]` - -##### Raises: - - -* `ValueError`: If the shape of `image` is incompatible with the `offset_*` or - `target_*` arguments, or either `offset_height` or `offset_width` is - negative, or either `target_height` or `target_width` is not positive. - - -- - - - -### `tf.image.extract_glimpse(input, size, offsets, centered=None, normalized=None, uniform_noise=None, name=None)` {#extract_glimpse} - -Extracts a glimpse from the input tensor. - -Returns a set of windows called glimpses extracted at location -`offsets` from the input tensor. If the windows only partially -overlaps the inputs, the non overlapping areas will be filled with -random noise. - -The result is a 4-D tensor of shape `[batch_size, glimpse_height, -glimpse_width, channels]`. The channels and batch dimensions are the -same as that of the input tensor. The height and width of the output -windows are specified in the `size` parameter. - -The argument `normalized` and `centered` controls how the windows are built: - -* If the coordinates are normalized but not centered, 0.0 and 1.0 - correspond to the minimum and maximum of each height and width - dimension. -* If the coordinates are both normalized and centered, they range from - -1.0 to 1.0. The coordinates (-1.0, -1.0) correspond to the upper - left corner, the lower right corner is located at (1.0, 1.0) and the - center is at (0, 0). -* If the coordinates are not normalized they are interpreted as - numbers of pixels. - -##### Args: - - -* `input`: A `Tensor` of type `float32`. - A 4-D float tensor of shape `[batch_size, height, width, channels]`. -* `size`: A `Tensor` of type `int32`. - A 1-D tensor of 2 elements containing the size of the glimpses - to extract. The glimpse height must be specified first, following - by the glimpse width. -* `offsets`: A `Tensor` of type `float32`. - A 2-D integer tensor of shape `[batch_size, 2]` containing - the x, y locations of the center of each window. -* `centered`: An optional `bool`. Defaults to `True`. - indicates if the offset coordinates are centered relative to - the image, in which case the (0, 0) offset is relative to the center - of the input images. If false, the (0,0) offset corresponds to the - upper left corner of the input images. -* `normalized`: An optional `bool`. Defaults to `True`. - indicates if the offset coordinates are normalized. -* `uniform_noise`: An optional `bool`. Defaults to `True`. - indicates if the noise should be generated using a - uniform distribution or a Gaussian distribution. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. - A tensor representing the glimpses `[batch_size, - glimpse_height, glimpse_width, channels]`. - - -- - - - -### `tf.image.crop_and_resize(image, boxes, box_ind, crop_size, method=None, extrapolation_value=None, name=None)` {#crop_and_resize} - -Extracts crops from the input image tensor and bilinearly resizes them (possibly - -with aspect ratio change) to a common output size specified by `crop_size`. This -is more general than the `crop_to_bounding_box` op which extracts a fixed size -slice from the input image and does not allow resizing or aspect ratio change. - -Returns a tensor with `crops` from the input `image` at positions defined at the -bounding box locations in `boxes`. The cropped boxes are all resized (with -bilinear interpolation) to a fixed `size = [crop_height, crop_width]`. The -result is a 4-D tensor `[num_boxes, crop_height, crop_width, depth]`. - -##### Args: - - -* `image`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int16`, `int32`, `int64`, `half`, `float32`, `float64`. - A 4-D tensor of shape `[batch, image_height, image_width, depth]`. - Both `image_height` and `image_width` need to be positive. -* `boxes`: A `Tensor` of type `float32`. - A 2-D tensor of shape `[num_boxes, 4]`. The `i`-th row of the tensor - specifies the coordinates of a box in the `box_ind[i]` image and is specified - in normalized coordinates `[y1, x1, y2, x2]`. A normalized coordinate value of - `y` is mapped to the image coordinate at `y * (image_height - 1)`, so as the - `[0, 1]` interval of normalized image height is mapped to - `[0, image_height - 1] in image height coordinates. We do allow y1 > y2, in - which case the sampled crop is an up-down flipped version of the original - image. The width dimension is treated similarly. Normalized coordinates - outside the `[0, 1]` range are allowed, in which case we use - `extrapolation_value` to extrapolate the input image values. -* `box_ind`: A `Tensor` of type `int32`. - A 1-D tensor of shape `[num_boxes]` with int32 values in `[0, batch)`. - The value of `box_ind[i]` specifies the image that the `i`-th box refers to. -* `crop_size`: A `Tensor` of type `int32`. - A 1-D tensor of 2 elements, `size = [crop_height, crop_width]`. All - cropped image patches are resized to this size. The aspect ratio of the image - content is not preserved. Both `crop_height` and `crop_width` need to be - positive. -* `method`: An optional `string` from: `"bilinear"`. Defaults to `"bilinear"`. - A string specifying the interpolation method. Only 'bilinear' is - supported for now. -* `extrapolation_value`: An optional `float`. Defaults to `0`. - Value used for extrapolation, when applicable. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32`. - A 4-D tensor of shape `[num_boxes, crop_height, crop_width, depth]`. - - -- - - - -### `tf.image.flip_up_down(image)` {#flip_up_down} - -Flip an image horizontally (upside down). - -Outputs the contents of `image` flipped along the first dimension, which is -`height`. - -See also `reverse()`. - -##### Args: - - -* `image`: A 3-D tensor of shape `[height, width, channels].` - -##### Returns: - - A 3-D tensor of the same type and shape as `image`. - -##### Raises: - - -* `ValueError`: if the shape of `image` not supported. - - -- - - - -### `tf.image.random_flip_up_down(image, seed=None)` {#random_flip_up_down} - -Randomly flips an image vertically (upside down). - -With a 1 in 2 chance, outputs the contents of `image` flipped along the first -dimension, which is `height`. Otherwise output the image as-is. - -##### Args: - - -* `image`: A 3-D tensor of shape `[height, width, channels].` -* `seed`: A Python integer. Used to create a random seed. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - -##### Returns: - - A 3-D tensor of the same type and shape as `image`. - -##### Raises: - - -* `ValueError`: if the shape of `image` not supported. - - -- - - - -### `tf.image.flip_left_right(image)` {#flip_left_right} - -Flip an image horizontally (left to right). - -Outputs the contents of `image` flipped along the second dimension, which is -`width`. - -See also `reverse()`. - -##### Args: - - -* `image`: A 3-D tensor of shape `[height, width, channels].` - -##### Returns: - - A 3-D tensor of the same type and shape as `image`. - -##### Raises: - - -* `ValueError`: if the shape of `image` not supported. - - -- - - - -### `tf.image.random_flip_left_right(image, seed=None)` {#random_flip_left_right} - -Randomly flip an image horizontally (left to right). - -With a 1 in 2 chance, outputs the contents of `image` flipped along the -second dimension, which is `width`. Otherwise output the image as-is. - -##### Args: - - -* `image`: A 3-D tensor of shape `[height, width, channels].` -* `seed`: A Python integer. Used to create a random seed. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - -##### Returns: - - A 3-D tensor of the same type and shape as `image`. - -##### Raises: - - -* `ValueError`: if the shape of `image` not supported. - - -- - - - -### `tf.image.transpose_image(image)` {#transpose_image} - -Transpose an image by swapping the first and second dimension. - -See also `transpose()`. - -##### Args: - - -* `image`: 3-D tensor of shape `[height, width, channels]` - -##### Returns: - - A 3-D tensor of shape `[width, height, channels]` - -##### Raises: - - -* `ValueError`: if the shape of `image` not supported. - - -- - - - -### `tf.image.rot90(image, k=1, name=None)` {#rot90} - -Rotate an image counter-clockwise by 90 degrees. - -##### Args: - - -* `image`: A 3-D tensor of shape `[height, width, channels]`. -* `k`: A scalar integer. The number of times the image is rotated by 90 degrees. -* `name`: A name for this operation (optional). - -##### Returns: - - A rotated 3-D tensor of the same type and shape as `image`. - - - -- - - - -### `tf.image.rgb_to_grayscale(images, name=None)` {#rgb_to_grayscale} - -Converts one or more images from RGB to Grayscale. - -Outputs a tensor of the same `DType` and rank as `images`. The size of the -last dimension of the output is 1, containing the Grayscale value of the -pixels. - -##### Args: - - -* `images`: The RGB tensor to convert. Last dimension must have size 3 and - should contain RGB values. -* `name`: A name for the operation (optional). - -##### Returns: - - The converted grayscale image(s). - - -- - - - -### `tf.image.grayscale_to_rgb(images, name=None)` {#grayscale_to_rgb} - -Converts one or more images from Grayscale to RGB. - -Outputs a tensor of the same `DType` and rank as `images`. The size of the -last dimension of the output is 3, containing the RGB value of the pixels. - -##### Args: - - -* `images`: The Grayscale tensor to convert. Last dimension must be size 1. -* `name`: A name for the operation (optional). - -##### Returns: - - The converted grayscale image(s). - - -- - - - -### `tf.image.hsv_to_rgb(images, name=None)` {#hsv_to_rgb} - -Convert one or more images from HSV to RGB. - -Outputs a tensor of the same shape as the `images` tensor, containing the RGB -value of the pixels. The output is only well defined if the value in `images` -are in `[0,1]`. - -See `rgb_to_hsv` for a description of the HSV encoding. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `float32`, `float64`. - 1-D or higher rank. HSV data to convert. Last dimension must be size 3. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `images`. `images` converted to RGB. - - -- - - - -### `tf.image.rgb_to_hsv(images, name=None)` {#rgb_to_hsv} - -Converts one or more images from RGB to HSV. - -Outputs a tensor of the same shape as the `images` tensor, containing the HSV -value of the pixels. The output is only well defined if the value in `images` -are in `[0,1]`. - -`output[..., 0]` contains hue, `output[..., 1]` contains saturation, and -`output[..., 2]` contains value. All HSV values are in `[0,1]`. A hue of 0 -corresponds to pure red, hue 1/3 is pure green, and 2/3 is pure blue. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `float32`, `float64`. - 1-D or higher rank. RGB data to convert. Last dimension must be size 3. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `images`. `images` converted to HSV. - - -- - - - -### `tf.image.convert_image_dtype(image, dtype, saturate=False, name=None)` {#convert_image_dtype} - -Convert `image` to `dtype`, scaling its values if needed. - -Images that are represented using floating point values are expected to have -values in the range [0,1). Image data stored in integer data types are -expected to have values in the range `[0,MAX]`, where `MAX` is the largest -positive representable number for the data type. - -This op converts between data types, scaling the values appropriately before -casting. - -Note that converting from floating point inputs to integer types may lead to -over/underflow problems. Set saturate to `True` to avoid such problem in -problematic conversions. If enabled, saturation will clip the output into the -allowed range before performing a potentially dangerous cast (and only before -performing such a cast, i.e., when casting from a floating point to an integer -type, and when casting from a signed to an unsigned type; `saturate` has no -effect on casts between floats, or on casts that increase the type's range). - -##### Args: - - -* `image`: An image. -* `dtype`: A `DType` to convert `image` to. -* `saturate`: If `True`, clip the input before casting (if necessary). -* `name`: A name for this operation (optional). - -##### Returns: - - `image`, converted to `dtype`. - - -- - - - -### `tf.image.adjust_brightness(image, delta)` {#adjust_brightness} - -Adjust the brightness of RGB or Grayscale images. - -This is a convenience method that converts an RGB image to float -representation, adjusts its brightness, and then converts it back to the -original data type. If several adjustments are chained it is advisable to -minimize the number of redundant conversions. - -The value `delta` is added to all components of the tensor `image`. Both -`image` and `delta` are converted to `float` before adding (and `image` is -scaled appropriately if it is in fixed-point representation). For regular -images, `delta` should be in the range `[0,1)`, as it is added to the image in -floating point representation, where pixel values are in the `[0,1)` range. - -##### Args: - - -* `image`: A tensor. -* `delta`: A scalar. Amount to add to the pixel values. - -##### Returns: - - A brightness-adjusted tensor of the same shape and type as `image`. - - -- - - - -### `tf.image.random_brightness(image, max_delta, seed=None)` {#random_brightness} - -Adjust the brightness of images by a random factor. - -Equivalent to `adjust_brightness()` using a `delta` randomly picked in the -interval `[-max_delta, max_delta)`. - -##### Args: - - -* `image`: An image. -* `max_delta`: float, must be non-negative. -* `seed`: A Python integer. Used to create a random seed. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - -##### Returns: - - The brightness-adjusted image. - -##### Raises: - - -* `ValueError`: if `max_delta` is negative. - - -- - - - -### `tf.image.adjust_contrast(images, contrast_factor)` {#adjust_contrast} - -Adjust contrast of RGB or grayscale images. - -This is a convenience method that converts an RGB image to float -representation, adjusts its contrast, and then converts it back to the -original data type. If several adjustments are chained it is advisable to -minimize the number of redundant conversions. - -`images` is a tensor of at least 3 dimensions. The last 3 dimensions are -interpreted as `[height, width, channels]`. The other dimensions only -represent a collection of images, such as `[batch, height, width, channels].` - -Contrast is adjusted independently for each channel of each image. - -For each channel, this Op computes the mean of the image pixels in the -channel and then adjusts each component `x` of each pixel to -`(x - mean) * contrast_factor + mean`. - -##### Args: - - -* `images`: Images to adjust. At least 3-D. -* `contrast_factor`: A float multiplier for adjusting contrast. - -##### Returns: - - The contrast-adjusted image or images. - - -- - - - -### `tf.image.random_contrast(image, lower, upper, seed=None)` {#random_contrast} - -Adjust the contrast of an image by a random factor. - -Equivalent to `adjust_contrast()` but uses a `contrast_factor` randomly -picked in the interval `[lower, upper]`. - -##### Args: - - -* `image`: An image tensor with 3 or more dimensions. -* `lower`: float. Lower bound for the random contrast factor. -* `upper`: float. Upper bound for the random contrast factor. -* `seed`: A Python integer. Used to create a random seed. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - -##### Returns: - - The contrast-adjusted tensor. - -##### Raises: - - -* `ValueError`: if `upper <= lower` or if `lower < 0`. - - -- - - - -### `tf.image.adjust_hue(image, delta, name=None)` {#adjust_hue} - -Adjust hue of an RGB image. - -This is a convenience method that converts an RGB image to float -representation, converts it to HSV, add an offset to the hue channel, converts -back to RGB and then back to the original data type. If several adjustments -are chained it is advisable to minimize the number of redundant conversions. - -`image` is an RGB image. The image hue is adjusted by converting the -image to HSV and rotating the hue channel (H) by -`delta`. The image is then converted back to RGB. - -`delta` must be in the interval `[-1, 1]`. - -##### Args: - - -* `image`: RGB image or images. Size of the last dimension must be 3. -* `delta`: float. How much to add to the hue channel. -* `name`: A name for this operation (optional). - -##### Returns: - - Adjusted image(s), same shape and DType as `image`. - - -- - - - -### `tf.image.random_hue(image, max_delta, seed=None)` {#random_hue} - -Adjust the hue of an RGB image by a random factor. - -Equivalent to `adjust_hue()` but uses a `delta` randomly -picked in the interval `[-max_delta, max_delta]`. - -`max_delta` must be in the interval `[0, 0.5]`. - -##### Args: - - -* `image`: RGB image or images. Size of the last dimension must be 3. -* `max_delta`: float. Maximum value for the random delta. -* `seed`: An operation-specific seed. It will be used in conjunction - with the graph-level seed to determine the real seeds that will be - used in this operation. Please see the documentation of - set_random_seed for its interaction with the graph-level random seed. - -##### Returns: - - 3-D float tensor of shape `[height, width, channels]`. - -##### Raises: - - -* `ValueError`: if `max_delta` is invalid. - - -- - - - -### `tf.image.adjust_gamma(image, gamma=1, gain=1)` {#adjust_gamma} - -Performs Gamma Correction on the input image. - Also known as Power Law Transform. This function transforms the - input image pixelwise according to the equation Out = In**gamma - after scaling each pixel to the range 0 to 1. - -##### Args: - - image : A Tensor. - gamma : A scalar. Non negative real number. - gain : A scalar. The constant multiplier. - -##### Returns: - - A Tensor. Gamma corrected output image. - -##### Notes: - - For gamma greater than 1, the histogram will shift towards left and - the output image will be darker than the input image. - For gamma less than 1, the histogram will shift towards right and - the output image will be brighter than the input image. - -##### References: - - [1] http://en.wikipedia.org/wiki/Gamma_correction - - -- - - - -### `tf.image.adjust_saturation(image, saturation_factor, name=None)` {#adjust_saturation} - -Adjust saturation of an RGB image. - -This is a convenience method that converts an RGB image to float -representation, converts it to HSV, add an offset to the saturation channel, -converts back to RGB and then back to the original data type. If several -adjustments are chained it is advisable to minimize the number of redundant -conversions. - -`image` is an RGB image. The image saturation is adjusted by converting the -image to HSV and multiplying the saturation (S) channel by -`saturation_factor` and clipping. The image is then converted back to RGB. - -##### Args: - - -* `image`: RGB image or images. Size of the last dimension must be 3. -* `saturation_factor`: float. Factor to multiply the saturation by. -* `name`: A name for this operation (optional). - -##### Returns: - - Adjusted image(s), same shape and DType as `image`. - - -- - - - -### `tf.image.random_saturation(image, lower, upper, seed=None)` {#random_saturation} - -Adjust the saturation of an RGB image by a random factor. - -Equivalent to `adjust_saturation()` but uses a `saturation_factor` randomly -picked in the interval `[lower, upper]`. - -##### Args: - - -* `image`: RGB image or images. Size of the last dimension must be 3. -* `lower`: float. Lower bound for the random saturation factor. -* `upper`: float. Upper bound for the random saturation factor. -* `seed`: An operation-specific seed. It will be used in conjunction - with the graph-level seed to determine the real seeds that will be - used in this operation. Please see the documentation of - set_random_seed for its interaction with the graph-level random seed. - -##### Returns: - - Adjusted image(s), same shape and DType as `image`. - -##### Raises: - - -* `ValueError`: if `upper <= lower` or if `lower < 0`. - - -- - - - -### `tf.image.per_image_standardization(image)` {#per_image_standardization} - -Linearly scales `image` to have zero mean and unit norm. - -This op computes `(x - mean) / adjusted_stddev`, where `mean` is the average -of all values in image, and -`adjusted_stddev = max(stddev, 1.0/sqrt(image.NumElements()))`. - -`stddev` is the standard deviation of all values in `image`. It is capped -away from zero to protect against division by 0 when handling uniform images. - -##### Args: - - -* `image`: 3-D tensor of shape `[height, width, channels]`. - -##### Returns: - - The standardized image with same shape as `image`. - -##### Raises: - - -* `ValueError`: if the shape of 'image' is incompatible with this function. - - -- - - - -### `tf.image.draw_bounding_boxes(images, boxes, name=None)` {#draw_bounding_boxes} - -Draw bounding boxes on a batch of images. - -Outputs a copy of `images` but draws on top of the pixels zero or more bounding -boxes specified by the locations in `boxes`. The coordinates of the each -bounding box in `boxes` are encoded as `[y_min, x_min, y_max, x_max]`. The -bounding box coordinates are floats in `[0.0, 1.0]` relative to the width and -height of the underlying image. - -For example, if an image is 100 x 200 pixels and the bounding box is -`[0.1, 0.2, 0.5, 0.9]`, the bottom-left and upper-right coordinates of the -bounding box will be `(10, 40)` to `(50, 180)`. - -Parts of the bounding box may fall outside the image. - -##### Args: - - -* `images`: A `Tensor`. Must be one of the following types: `float32`, `half`. - 4-D with shape `[batch, height, width, depth]`. A batch of images. -* `boxes`: A `Tensor` of type `float32`. - 3-D with shape `[batch, num_bounding_boxes, 4]` containing bounding - boxes. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `images`. - 4-D with the same shape as `images`. The batch of input images with - bounding boxes drawn on the images. - - -- - - - -### `tf.image.non_max_suppression(boxes, scores, max_output_size, iou_threshold=None, name=None)` {#non_max_suppression} - -Greedily selects a subset of bounding boxes in descending order of score, - -pruning away boxes that have high intersection-over-union (IOU) overlap -with previously selected boxes. Bounding boxes are supplied as -[y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any -diagonal pair of box corners and the coordinates can be provided as normalized -(i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm -is agnostic to where the origin is in the coordinate system. Note that this -algorithm is invariant to orthogonal transformations and translations -of the coordinate system; thus translating or reflections of the coordinate -system result in the same boxes being selected by the algorithm. - -The output of this operation is a set of integers indexing into the input -collection of bounding boxes representing the selected boxes. The bounding -box coordinates corresponding to the selected indices can then be obtained -using the `tf.gather operation`. For example: - - selected_indices = tf.image.non_max_suppression( - boxes, scores, max_output_size, iou_threshold) - selected_boxes = tf.gather(boxes, selected_indices) - -##### Args: - - -* `boxes`: A `Tensor` of type `float32`. - A 2-D float tensor of shape `[num_boxes, 4]`. -* `scores`: A `Tensor` of type `float32`. - A 1-D float tensor of shape `[num_boxes]` representing a single - score corresponding to each box (each row of boxes). -* `max_output_size`: A `Tensor` of type `int32`. - A scalar integer tensor representing the maximum number of - boxes to be selected by non max suppression. -* `iou_threshold`: An optional `float`. Defaults to `0.5`. - A float representing the threshold for deciding whether boxes - overlap too much with respect to IOU. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `int32`. - A 1-D integer tensor of shape `[M]` representing the selected - indices from the boxes tensor, where `M <= max_output_size`. - - -- - - - -### `tf.image.sample_distorted_bounding_box(image_size, bounding_boxes, seed=None, seed2=None, min_object_covered=None, aspect_ratio_range=None, area_range=None, max_attempts=None, use_image_if_no_bounding_boxes=None, name=None)` {#sample_distorted_bounding_box} - -Generate a single randomly distorted bounding box for an image. - -Bounding box annotations are often supplied in addition to ground-truth labels -in image recognition or object localization tasks. A common technique for -training such a system is to randomly distort an image while preserving -its content, i.e. *data augmentation*. This Op outputs a randomly distorted -localization of an object, i.e. bounding box, given an `image_size`, -`bounding_boxes` and a series of constraints. - -The output of this Op is a single bounding box that may be used to crop the -original image. The output is returned as 3 tensors: `begin`, `size` and -`bboxes`. The first 2 tensors can be fed directly into `tf.slice` to crop the -image. The latter may be supplied to `tf.image.draw_bounding_boxes` to visualize -what the bounding box looks like. - -Bounding boxes are supplied and returned as `[y_min, x_min, y_max, x_max]`. The -bounding box coordinates are floats in `[0.0, 1.0]` relative to the width and -height of the underlying image. - -For example, - -```python - # Generate a single distorted bounding box. - begin, size, bbox_for_draw = tf.image.sample_distorted_bounding_box( - tf.shape(image), - bounding_boxes=bounding_boxes) - - # Draw the bounding box in an image summary. - image_with_box = tf.image.draw_bounding_boxes(tf.expand_dims(image, 0), - bbox_for_draw) - tf.image_summary('images_with_box', image_with_box) - - # Employ the bounding box to distort the image. - distorted_image = tf.slice(image, begin, size) -``` - -Note that if no bounding box information is available, setting -`use_image_if_no_bounding_boxes = true` will assume there is a single implicit -bounding box covering the whole image. If `use_image_if_no_bounding_boxes` is -false and no bounding boxes are supplied, an error is raised. - -##### Args: - - -* `image_size`: A `Tensor`. Must be one of the following types: `uint8`, `int8`, `int16`, `int32`, `int64`. - 1-D, containing `[height, width, channels]`. -* `bounding_boxes`: A `Tensor` of type `float32`. - 3-D with shape `[batch, N, 4]` describing the N bounding boxes - associated with the image. -* `seed`: An optional `int`. Defaults to `0`. - If either `seed` or `seed2` are set to non-zero, the random number - generator is seeded by the given `seed`. Otherwise, it is seeded by a random - seed. -* `seed2`: An optional `int`. Defaults to `0`. - A second seed to avoid seed collision. -* `min_object_covered`: An optional `float`. Defaults to `0.1`. - The cropped area of the image must contain at least this - fraction of any bounding box supplied. The value of this parameter should be - non-negative. In the case of 0, the cropped area does not need to overlap - any of the bounding boxes supplied. -* `aspect_ratio_range`: An optional list of `floats`. Defaults to `[0.75, 1.33]`. - The cropped area of the image must have an aspect ratio = - width / height within this range. -* `area_range`: An optional list of `floats`. Defaults to `[0.05, 1]`. - The cropped area of the image must contain a fraction of the - supplied image within in this range. -* `max_attempts`: An optional `int`. Defaults to `100`. - Number of attempts at generating a cropped region of the image - of the specified constraints. After `max_attempts` failures, return the entire - image. -* `use_image_if_no_bounding_boxes`: An optional `bool`. Defaults to `False`. - Controls behavior if no bounding boxes supplied. - If true, assume an implicit bounding box covering the whole input. If false, - raise an error. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (begin, size, bboxes). - -* `begin`: A `Tensor`. Has the same type as `image_size`. 1-D, containing `[offset_height, offset_width, 0]`. Provide as input to - `tf.slice`. -* `size`: A `Tensor`. Has the same type as `image_size`. 1-D, containing `[target_height, target_width, -1]`. Provide as input to - `tf.slice`. -* `bboxes`: A `Tensor` of type `float32`. 3-D with shape `[1, 1, 4]` containing the distorted bounding box. - Provide as input to `tf.image.draw_bounding_boxes`. - - -- - - - -### `tf.image.total_variation(images, name=None)` {#total_variation} - -Calculate and return the total variation for one or more images. - -The total variation is the sum of the absolute differences for neighboring -pixel-values in the input images. This measures how much noise is in the -images. - -This can be used as a loss-function during optimization so as to suppress -noise in images. If you have a batch of images, then you should calculate -the scalar loss-value as the sum: -`loss = tf.reduce_sum(tf.image.total_variation(images))` - -This implements the anisotropic 2-D version of the formula described here: - -https://en.wikipedia.org/wiki/Total_variation_denoising - -##### Args: - - -* `images`: 4-D Tensor of shape `[batch, height, width, channels]` or - 3-D Tensor of shape `[height, width, channels]`. - - -* `name`: A name for the operation (optional). - -##### Raises: - - -* `ValueError`: if images.shape is not a 3-D or 4-D vector. - -##### Returns: - - The total variation of `images`. - - If `images` was 4-D, return a 1-D float Tensor of shape `[batch]` with the - total variation for each image in the batch. - If `images` was 3-D, return a scalar float with the total variation for - that image. - - diff --git a/tensorflow/g3doc/api_docs/python/index.md b/tensorflow/g3doc/api_docs/python/index.md deleted file mode 100644 index 0de79c8474..0000000000 --- a/tensorflow/g3doc/api_docs/python/index.md +++ /dev/null @@ -1,1204 +0,0 @@ - - -# TensorFlow Python reference documentation - -* **[Building Graphs](../../api_docs/python/framework.md)**: - * [`add_to_collection`](../../api_docs/python/framework.md#add_to_collection) - * [`as_dtype`](../../api_docs/python/framework.md#as_dtype) - * [`container`](../../api_docs/python/framework.md#container) - * [`control_dependencies`](../../api_docs/python/framework.md#control_dependencies) - * [`convert_to_tensor`](../../api_docs/python/framework.md#convert_to_tensor) - * [`convert_to_tensor_or_indexed_slices`](../../api_docs/python/framework.md#convert_to_tensor_or_indexed_slices) - * [`convert_to_tensor_or_sparse_tensor`](../../api_docs/python/framework.md#convert_to_tensor_or_sparse_tensor) - * [`device`](../../api_docs/python/framework.md#device) - * [`DeviceSpec`](../../api_docs/python/framework.md#DeviceSpec) - * [`Dimension`](../../api_docs/python/framework.md#Dimension) - * [`DType`](../../api_docs/python/framework.md#DType) - * [`get_collection`](../../api_docs/python/framework.md#get_collection) - * [`get_collection_ref`](../../api_docs/python/framework.md#get_collection_ref) - * [`get_default_graph`](../../api_docs/python/framework.md#get_default_graph) - * [`get_seed`](../../api_docs/python/framework.md#get_seed) - * [`Graph`](../../api_docs/python/framework.md#Graph) - * [`GraphKeys`](../../api_docs/python/framework.md#GraphKeys) - * [`import_graph_def`](../../api_docs/python/framework.md#import_graph_def) - * [`load_file_system_library`](../../api_docs/python/framework.md#load_file_system_library) - * [`load_op_library`](../../api_docs/python/framework.md#load_op_library) - * [`name_scope`](../../api_docs/python/framework.md#name_scope) - * [`NoGradient`](../../api_docs/python/framework.md#NoGradient) - * [`NotDifferentiable`](../../api_docs/python/framework.md#NotDifferentiable) - * [`op_scope`](../../api_docs/python/framework.md#op_scope) - * [`Operation`](../../api_docs/python/framework.md#Operation) - * [`register_tensor_conversion_function`](../../api_docs/python/framework.md#register_tensor_conversion_function) - * [`RegisterGradient`](../../api_docs/python/framework.md#RegisterGradient) - * [`reset_default_graph`](../../api_docs/python/framework.md#reset_default_graph) - * [`Tensor`](../../api_docs/python/framework.md#Tensor) - * [`TensorShape`](../../api_docs/python/framework.md#TensorShape) - -* **[Asserts and boolean checks.](../../api_docs/python/check_ops.md)**: - * [`assert_equal`](../../api_docs/python/check_ops.md#assert_equal) - * [`assert_greater`](../../api_docs/python/check_ops.md#assert_greater) - * [`assert_greater_equal`](../../api_docs/python/check_ops.md#assert_greater_equal) - * [`assert_integer`](../../api_docs/python/check_ops.md#assert_integer) - * [`assert_less`](../../api_docs/python/check_ops.md#assert_less) - * [`assert_less_equal`](../../api_docs/python/check_ops.md#assert_less_equal) - * [`assert_negative`](../../api_docs/python/check_ops.md#assert_negative) - * [`assert_non_negative`](../../api_docs/python/check_ops.md#assert_non_negative) - * [`assert_non_positive`](../../api_docs/python/check_ops.md#assert_non_positive) - * [`assert_positive`](../../api_docs/python/check_ops.md#assert_positive) - * [`assert_proper_iterable`](../../api_docs/python/check_ops.md#assert_proper_iterable) - * [`assert_rank`](../../api_docs/python/check_ops.md#assert_rank) - * [`assert_rank_at_least`](../../api_docs/python/check_ops.md#assert_rank_at_least) - * [`assert_type`](../../api_docs/python/check_ops.md#assert_type) - * [`is_non_decreasing`](../../api_docs/python/check_ops.md#is_non_decreasing) - * [`is_numeric_tensor`](../../api_docs/python/check_ops.md#is_numeric_tensor) - * [`is_strictly_increasing`](../../api_docs/python/check_ops.md#is_strictly_increasing) - -* **[Constants, Sequences, and Random Values](../../api_docs/python/constant_op.md)**: - * [`constant`](../../api_docs/python/constant_op.md#constant) - * [`fill`](../../api_docs/python/constant_op.md#fill) - * [`linspace`](../../api_docs/python/constant_op.md#linspace) - * [`multinomial`](../../api_docs/python/constant_op.md#multinomial) - * [`ones`](../../api_docs/python/constant_op.md#ones) - * [`ones_like`](../../api_docs/python/constant_op.md#ones_like) - * [`random_crop`](../../api_docs/python/constant_op.md#random_crop) - * [`random_gamma`](../../api_docs/python/constant_op.md#random_gamma) - * [`random_normal`](../../api_docs/python/constant_op.md#random_normal) - * [`random_poisson`](../../api_docs/python/constant_op.md#random_poisson) - * [`random_shuffle`](../../api_docs/python/constant_op.md#random_shuffle) - * [`random_uniform`](../../api_docs/python/constant_op.md#random_uniform) - * [`range`](../../api_docs/python/constant_op.md#range) - * [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - * [`truncated_normal`](../../api_docs/python/constant_op.md#truncated_normal) - * [`zeros`](../../api_docs/python/constant_op.md#zeros) - * [`zeros_like`](../../api_docs/python/constant_op.md#zeros_like) - -* **[Variables](../../api_docs/python/state_ops.md)**: - * [`all_variables`](../../api_docs/python/state_ops.md#all_variables) - * [`assert_variables_initialized`](../../api_docs/python/state_ops.md#assert_variables_initialized) - * [`assign`](../../api_docs/python/state_ops.md#assign) - * [`assign_add`](../../api_docs/python/state_ops.md#assign_add) - * [`assign_sub`](../../api_docs/python/state_ops.md#assign_sub) - * [`constant_initializer`](../../api_docs/python/state_ops.md#constant_initializer) - * [`count_up_to`](../../api_docs/python/state_ops.md#count_up_to) - * [`device`](../../api_docs/python/state_ops.md#device) - * [`export_meta_graph`](../../api_docs/python/state_ops.md#export_meta_graph) - * [`fixed_size_partitioner`](../../api_docs/python/state_ops.md#fixed_size_partitioner) - * [`get_checkpoint_state`](../../api_docs/python/state_ops.md#get_checkpoint_state) - * [`get_local_variable`](../../api_docs/python/state_ops.md#get_local_variable) - * [`get_variable`](../../api_docs/python/state_ops.md#get_variable) - * [`get_variable_scope`](../../api_docs/python/state_ops.md#get_variable_scope) - * [`global_variables`](../../api_docs/python/state_ops.md#global_variables) - * [`global_variables_initializer`](../../api_docs/python/state_ops.md#global_variables_initializer) - * [`import_meta_graph`](../../api_docs/python/state_ops.md#import_meta_graph) - * [`IndexedSlices`](../../api_docs/python/state_ops.md#IndexedSlices) - * [`initialize_all_tables`](../../api_docs/python/state_ops.md#initialize_all_tables) - * [`initialize_all_variables`](../../api_docs/python/state_ops.md#initialize_all_variables) - * [`initialize_local_variables`](../../api_docs/python/state_ops.md#initialize_local_variables) - * [`initialize_variables`](../../api_docs/python/state_ops.md#initialize_variables) - * [`is_variable_initialized`](../../api_docs/python/state_ops.md#is_variable_initialized) - * [`latest_checkpoint`](../../api_docs/python/state_ops.md#latest_checkpoint) - * [`local_variables`](../../api_docs/python/state_ops.md#local_variables) - * [`local_variables_initializer`](../../api_docs/python/state_ops.md#local_variables_initializer) - * [`make_template`](../../api_docs/python/state_ops.md#make_template) - * [`min_max_variable_partitioner`](../../api_docs/python/state_ops.md#min_max_variable_partitioner) - * [`model_variables`](../../api_docs/python/state_ops.md#model_variables) - * [`moving_average_variables`](../../api_docs/python/state_ops.md#moving_average_variables) - * [`no_regularizer`](../../api_docs/python/state_ops.md#no_regularizer) - * [`ones_initializer`](../../api_docs/python/state_ops.md#ones_initializer) - * [`orthogonal_initializer`](../../api_docs/python/state_ops.md#orthogonal_initializer) - * [`random_normal_initializer`](../../api_docs/python/state_ops.md#random_normal_initializer) - * [`random_uniform_initializer`](../../api_docs/python/state_ops.md#random_uniform_initializer) - * [`report_uninitialized_variables`](../../api_docs/python/state_ops.md#report_uninitialized_variables) - * [`Saver`](../../api_docs/python/state_ops.md#Saver) - * [`scatter_add`](../../api_docs/python/state_ops.md#scatter_add) - * [`scatter_div`](../../api_docs/python/state_ops.md#scatter_div) - * [`scatter_mul`](../../api_docs/python/state_ops.md#scatter_mul) - * [`scatter_nd_add`](../../api_docs/python/state_ops.md#scatter_nd_add) - * [`scatter_nd_sub`](../../api_docs/python/state_ops.md#scatter_nd_sub) - * [`scatter_nd_update`](../../api_docs/python/state_ops.md#scatter_nd_update) - * [`scatter_sub`](../../api_docs/python/state_ops.md#scatter_sub) - * [`scatter_update`](../../api_docs/python/state_ops.md#scatter_update) - * [`sparse_mask`](../../api_docs/python/state_ops.md#sparse_mask) - * [`tables_initializer`](../../api_docs/python/state_ops.md#tables_initializer) - * [`trainable_variables`](../../api_docs/python/state_ops.md#trainable_variables) - * [`truncated_normal_initializer`](../../api_docs/python/state_ops.md#truncated_normal_initializer) - * [`uniform_unit_scaling_initializer`](../../api_docs/python/state_ops.md#uniform_unit_scaling_initializer) - * [`update_checkpoint_state`](../../api_docs/python/state_ops.md#update_checkpoint_state) - * [`Variable`](../../api_docs/python/state_ops.md#Variable) - * [`variable_axis_size_partitioner`](../../api_docs/python/state_ops.md#variable_axis_size_partitioner) - * [`variable_op_scope`](../../api_docs/python/state_ops.md#variable_op_scope) - * [`variable_scope`](../../api_docs/python/state_ops.md#variable_scope) - * [`variables_initializer`](../../api_docs/python/state_ops.md#variables_initializer) - * [`VariableScope`](../../api_docs/python/state_ops.md#VariableScope) - * [`zeros_initializer`](../../api_docs/python/state_ops.md#zeros_initializer) - -* **[Tensor Transformations](../../api_docs/python/array_ops.md)**: - * [`batch_to_space`](../../api_docs/python/array_ops.md#batch_to_space) - * [`batch_to_space_nd`](../../api_docs/python/array_ops.md#batch_to_space_nd) - * [`bitcast`](../../api_docs/python/array_ops.md#bitcast) - * [`boolean_mask`](../../api_docs/python/array_ops.md#boolean_mask) - * [`broadcast_dynamic_shape`](../../api_docs/python/array_ops.md#broadcast_dynamic_shape) - * [`broadcast_static_shape`](../../api_docs/python/array_ops.md#broadcast_static_shape) - * [`cast`](../../api_docs/python/array_ops.md#cast) - * [`concat`](../../api_docs/python/array_ops.md#concat) - * [`copy`](../../api_docs/python/array_ops.md#copy) - * [`depth_to_space`](../../api_docs/python/array_ops.md#depth_to_space) - * [`dequantize`](../../api_docs/python/array_ops.md#dequantize) - * [`dynamic_partition`](../../api_docs/python/array_ops.md#dynamic_partition) - * [`dynamic_stitch`](../../api_docs/python/array_ops.md#dynamic_stitch) - * [`expand_dims`](../../api_docs/python/array_ops.md#expand_dims) - * [`extract_image_patches`](../../api_docs/python/array_ops.md#extract_image_patches) - * [`fake_quant_with_min_max_args`](../../api_docs/python/array_ops.md#fake_quant_with_min_max_args) - * [`fake_quant_with_min_max_args_gradient`](../../api_docs/python/array_ops.md#fake_quant_with_min_max_args_gradient) - * [`fake_quant_with_min_max_vars`](../../api_docs/python/array_ops.md#fake_quant_with_min_max_vars) - * [`fake_quant_with_min_max_vars_gradient`](../../api_docs/python/array_ops.md#fake_quant_with_min_max_vars_gradient) - * [`fake_quant_with_min_max_vars_per_channel`](../../api_docs/python/array_ops.md#fake_quant_with_min_max_vars_per_channel) - * [`fake_quant_with_min_max_vars_per_channel_gradient`](../../api_docs/python/array_ops.md#fake_quant_with_min_max_vars_per_channel_gradient) - * [`gather`](../../api_docs/python/array_ops.md#gather) - * [`gather_nd`](../../api_docs/python/array_ops.md#gather_nd) - * [`meshgrid`](../../api_docs/python/array_ops.md#meshgrid) - * [`one_hot`](../../api_docs/python/array_ops.md#one_hot) - * [`pad`](../../api_docs/python/array_ops.md#pad) - * [`parallel_stack`](../../api_docs/python/array_ops.md#parallel_stack) - * [`quantize_v2`](../../api_docs/python/array_ops.md#quantize_v2) - * [`quantized_concat`](../../api_docs/python/array_ops.md#quantized_concat) - * [`rank`](../../api_docs/python/array_ops.md#rank) - * [`required_space_to_batch_paddings`](../../api_docs/python/array_ops.md#required_space_to_batch_paddings) - * [`reshape`](../../api_docs/python/array_ops.md#reshape) - * [`reverse`](../../api_docs/python/array_ops.md#reverse) - * [`reverse_sequence`](../../api_docs/python/array_ops.md#reverse_sequence) - * [`reverse_v2`](../../api_docs/python/array_ops.md#reverse_v2) - * [`saturate_cast`](../../api_docs/python/array_ops.md#saturate_cast) - * [`scatter_nd`](../../api_docs/python/array_ops.md#scatter_nd) - * [`sequence_mask`](../../api_docs/python/array_ops.md#sequence_mask) - * [`setdiff1d`](../../api_docs/python/array_ops.md#setdiff1d) - * [`shape`](../../api_docs/python/array_ops.md#shape) - * [`shape_n`](../../api_docs/python/array_ops.md#shape_n) - * [`size`](../../api_docs/python/array_ops.md#size) - * [`slice`](../../api_docs/python/array_ops.md#slice) - * [`space_to_batch`](../../api_docs/python/array_ops.md#space_to_batch) - * [`space_to_batch_nd`](../../api_docs/python/array_ops.md#space_to_batch_nd) - * [`space_to_depth`](../../api_docs/python/array_ops.md#space_to_depth) - * [`split`](../../api_docs/python/array_ops.md#split) - * [`squeeze`](../../api_docs/python/array_ops.md#squeeze) - * [`stack`](../../api_docs/python/array_ops.md#stack) - * [`strided_slice`](../../api_docs/python/array_ops.md#strided_slice) - * [`string_to_number`](../../api_docs/python/array_ops.md#string_to_number) - * [`tile`](../../api_docs/python/array_ops.md#tile) - * [`to_bfloat16`](../../api_docs/python/array_ops.md#to_bfloat16) - * [`to_double`](../../api_docs/python/array_ops.md#to_double) - * [`to_float`](../../api_docs/python/array_ops.md#to_float) - * [`to_int32`](../../api_docs/python/array_ops.md#to_int32) - * [`to_int64`](../../api_docs/python/array_ops.md#to_int64) - * [`transpose`](../../api_docs/python/array_ops.md#transpose) - * [`unique_with_counts`](../../api_docs/python/array_ops.md#unique_with_counts) - * [`unstack`](../../api_docs/python/array_ops.md#unstack) - -* **[Math](../../api_docs/python/math_ops.md)**: - * [`abs`](../../api_docs/python/math_ops.md#abs) - * [`accumulate_n`](../../api_docs/python/math_ops.md#accumulate_n) - * [`acos`](../../api_docs/python/math_ops.md#acos) - * [`add`](../../api_docs/python/math_ops.md#add) - * [`add_n`](../../api_docs/python/math_ops.md#add_n) - * [`argmax`](../../api_docs/python/math_ops.md#argmax) - * [`argmin`](../../api_docs/python/math_ops.md#argmin) - * [`asin`](../../api_docs/python/math_ops.md#asin) - * [`atan`](../../api_docs/python/math_ops.md#atan) - * [`betainc`](../../api_docs/python/math_ops.md#betainc) - * [`ceil`](../../api_docs/python/math_ops.md#ceil) - * [`cholesky`](../../api_docs/python/math_ops.md#cholesky) - * [`cholesky_solve`](../../api_docs/python/math_ops.md#cholesky_solve) - * [`complex`](../../api_docs/python/math_ops.md#complex) - * [`conj`](../../api_docs/python/math_ops.md#conj) - * [`cos`](../../api_docs/python/math_ops.md#cos) - * [`count_nonzero`](../../api_docs/python/math_ops.md#count_nonzero) - * [`cross`](../../api_docs/python/math_ops.md#cross) - * [`cumprod`](../../api_docs/python/math_ops.md#cumprod) - * [`cumsum`](../../api_docs/python/math_ops.md#cumsum) - * [`diag`](../../api_docs/python/math_ops.md#diag) - * [`diag_part`](../../api_docs/python/math_ops.md#diag_part) - * [`digamma`](../../api_docs/python/math_ops.md#digamma) - * [`div`](../../api_docs/python/math_ops.md#div) - * [`divide`](../../api_docs/python/math_ops.md#divide) - * [`edit_distance`](../../api_docs/python/math_ops.md#edit_distance) - * [`einsum`](../../api_docs/python/math_ops.md#einsum) - * [`erf`](../../api_docs/python/math_ops.md#erf) - * [`erfc`](../../api_docs/python/math_ops.md#erfc) - * [`exp`](../../api_docs/python/math_ops.md#exp) - * [`expm1`](../../api_docs/python/math_ops.md#expm1) - * [`eye`](../../api_docs/python/math_ops.md#eye) - * [`fft`](../../api_docs/python/math_ops.md#fft) - * [`fft2d`](../../api_docs/python/math_ops.md#fft2d) - * [`fft3d`](../../api_docs/python/math_ops.md#fft3d) - * [`floor`](../../api_docs/python/math_ops.md#floor) - * [`floor_div`](../../api_docs/python/math_ops.md#floor_div) - * [`floordiv`](../../api_docs/python/math_ops.md#floordiv) - * [`floormod`](../../api_docs/python/math_ops.md#floormod) - * [`ifft`](../../api_docs/python/math_ops.md#ifft) - * [`ifft2d`](../../api_docs/python/math_ops.md#ifft2d) - * [`ifft3d`](../../api_docs/python/math_ops.md#ifft3d) - * [`igamma`](../../api_docs/python/math_ops.md#igamma) - * [`igammac`](../../api_docs/python/math_ops.md#igammac) - * [`imag`](../../api_docs/python/math_ops.md#imag) - * [`invert_permutation`](../../api_docs/python/math_ops.md#invert_permutation) - * [`lbeta`](../../api_docs/python/math_ops.md#lbeta) - * [`lgamma`](../../api_docs/python/math_ops.md#lgamma) - * [`log`](../../api_docs/python/math_ops.md#log) - * [`log1p`](../../api_docs/python/math_ops.md#log1p) - * [`matmul`](../../api_docs/python/math_ops.md#matmul) - * [`matrix_band_part`](../../api_docs/python/math_ops.md#matrix_band_part) - * [`matrix_determinant`](../../api_docs/python/math_ops.md#matrix_determinant) - * [`matrix_diag`](../../api_docs/python/math_ops.md#matrix_diag) - * [`matrix_diag_part`](../../api_docs/python/math_ops.md#matrix_diag_part) - * [`matrix_inverse`](../../api_docs/python/math_ops.md#matrix_inverse) - * [`matrix_set_diag`](../../api_docs/python/math_ops.md#matrix_set_diag) - * [`matrix_solve`](../../api_docs/python/math_ops.md#matrix_solve) - * [`matrix_solve_ls`](../../api_docs/python/math_ops.md#matrix_solve_ls) - * [`matrix_transpose`](../../api_docs/python/math_ops.md#matrix_transpose) - * [`matrix_triangular_solve`](../../api_docs/python/math_ops.md#matrix_triangular_solve) - * [`maximum`](../../api_docs/python/math_ops.md#maximum) - * [`minimum`](../../api_docs/python/math_ops.md#minimum) - * [`mod`](../../api_docs/python/math_ops.md#mod) - * [`multiply`](../../api_docs/python/math_ops.md#multiply) - * [`negative`](../../api_docs/python/math_ops.md#negative) - * [`norm`](../../api_docs/python/math_ops.md#norm) - * [`polygamma`](../../api_docs/python/math_ops.md#polygamma) - * [`pow`](../../api_docs/python/math_ops.md#pow) - * [`qr`](../../api_docs/python/math_ops.md#qr) - * [`real`](../../api_docs/python/math_ops.md#real) - * [`realdiv`](../../api_docs/python/math_ops.md#realdiv) - * [`reciprocal`](../../api_docs/python/math_ops.md#reciprocal) - * [`reduce_all`](../../api_docs/python/math_ops.md#reduce_all) - * [`reduce_any`](../../api_docs/python/math_ops.md#reduce_any) - * [`reduce_logsumexp`](../../api_docs/python/math_ops.md#reduce_logsumexp) - * [`reduce_max`](../../api_docs/python/math_ops.md#reduce_max) - * [`reduce_mean`](../../api_docs/python/math_ops.md#reduce_mean) - * [`reduce_min`](../../api_docs/python/math_ops.md#reduce_min) - * [`reduce_prod`](../../api_docs/python/math_ops.md#reduce_prod) - * [`reduce_sum`](../../api_docs/python/math_ops.md#reduce_sum) - * [`rint`](../../api_docs/python/math_ops.md#rint) - * [`round`](../../api_docs/python/math_ops.md#round) - * [`rsqrt`](../../api_docs/python/math_ops.md#rsqrt) - * [`scalar_mul`](../../api_docs/python/math_ops.md#scalar_mul) - * [`segment_max`](../../api_docs/python/math_ops.md#segment_max) - * [`segment_mean`](../../api_docs/python/math_ops.md#segment_mean) - * [`segment_min`](../../api_docs/python/math_ops.md#segment_min) - * [`segment_prod`](../../api_docs/python/math_ops.md#segment_prod) - * [`segment_sum`](../../api_docs/python/math_ops.md#segment_sum) - * [`self_adjoint_eig`](../../api_docs/python/math_ops.md#self_adjoint_eig) - * [`self_adjoint_eigvals`](../../api_docs/python/math_ops.md#self_adjoint_eigvals) - * [`setdiff1d`](../../api_docs/python/math_ops.md#setdiff1d) - * [`sign`](../../api_docs/python/math_ops.md#sign) - * [`sin`](../../api_docs/python/math_ops.md#sin) - * [`sparse_segment_mean`](../../api_docs/python/math_ops.md#sparse_segment_mean) - * [`sparse_segment_sqrt_n`](../../api_docs/python/math_ops.md#sparse_segment_sqrt_n) - * [`sparse_segment_sum`](../../api_docs/python/math_ops.md#sparse_segment_sum) - * [`sqrt`](../../api_docs/python/math_ops.md#sqrt) - * [`square`](../../api_docs/python/math_ops.md#square) - * [`squared_difference`](../../api_docs/python/math_ops.md#squared_difference) - * [`subtract`](../../api_docs/python/math_ops.md#subtract) - * [`svd`](../../api_docs/python/math_ops.md#svd) - * [`tan`](../../api_docs/python/math_ops.md#tan) - * [`tensordot`](../../api_docs/python/math_ops.md#tensordot) - * [`trace`](../../api_docs/python/math_ops.md#trace) - * [`transpose`](../../api_docs/python/math_ops.md#transpose) - * [`truediv`](../../api_docs/python/math_ops.md#truediv) - * [`truncatediv`](../../api_docs/python/math_ops.md#truncatediv) - * [`truncatemod`](../../api_docs/python/math_ops.md#truncatemod) - * [`unique`](../../api_docs/python/math_ops.md#unique) - * [`unsorted_segment_max`](../../api_docs/python/math_ops.md#unsorted_segment_max) - * [`unsorted_segment_sum`](../../api_docs/python/math_ops.md#unsorted_segment_sum) - * [`where`](../../api_docs/python/math_ops.md#where) - * [`zeta`](../../api_docs/python/math_ops.md#zeta) - -* **[Strings](../../api_docs/python/string_ops.md)**: - * [`as_string`](../../api_docs/python/string_ops.md#as_string) - * [`decode_base64`](../../api_docs/python/string_ops.md#decode_base64) - * [`encode_base64`](../../api_docs/python/string_ops.md#encode_base64) - * [`reduce_join`](../../api_docs/python/string_ops.md#reduce_join) - * [`string_join`](../../api_docs/python/string_ops.md#string_join) - * [`string_split`](../../api_docs/python/string_ops.md#string_split) - * [`string_to_hash_bucket`](../../api_docs/python/string_ops.md#string_to_hash_bucket) - * [`string_to_hash_bucket_fast`](../../api_docs/python/string_ops.md#string_to_hash_bucket_fast) - * [`string_to_hash_bucket_strong`](../../api_docs/python/string_ops.md#string_to_hash_bucket_strong) - * [`substr`](../../api_docs/python/string_ops.md#substr) - -* **[Histograms](../../api_docs/python/histogram_ops.md)**: - * [`histogram_fixed_width`](../../api_docs/python/histogram_ops.md#histogram_fixed_width) - -* **[Control Flow](../../api_docs/python/control_flow_ops.md)**: - * [`add_check_numerics_ops`](../../api_docs/python/control_flow_ops.md#add_check_numerics_ops) - * [`Assert`](../../api_docs/python/control_flow_ops.md#Assert) - * [`case`](../../api_docs/python/control_flow_ops.md#case) - * [`check_numerics`](../../api_docs/python/control_flow_ops.md#check_numerics) - * [`cond`](../../api_docs/python/control_flow_ops.md#cond) - * [`count_up_to`](../../api_docs/python/control_flow_ops.md#count_up_to) - * [`equal`](../../api_docs/python/control_flow_ops.md#equal) - * [`greater`](../../api_docs/python/control_flow_ops.md#greater) - * [`greater_equal`](../../api_docs/python/control_flow_ops.md#greater_equal) - * [`group`](../../api_docs/python/control_flow_ops.md#group) - * [`identity`](../../api_docs/python/control_flow_ops.md#identity) - * [`is_finite`](../../api_docs/python/control_flow_ops.md#is_finite) - * [`is_inf`](../../api_docs/python/control_flow_ops.md#is_inf) - * [`is_nan`](../../api_docs/python/control_flow_ops.md#is_nan) - * [`less`](../../api_docs/python/control_flow_ops.md#less) - * [`less_equal`](../../api_docs/python/control_flow_ops.md#less_equal) - * [`logical_and`](../../api_docs/python/control_flow_ops.md#logical_and) - * [`logical_not`](../../api_docs/python/control_flow_ops.md#logical_not) - * [`logical_or`](../../api_docs/python/control_flow_ops.md#logical_or) - * [`logical_xor`](../../api_docs/python/control_flow_ops.md#logical_xor) - * [`no_op`](../../api_docs/python/control_flow_ops.md#no_op) - * [`not_equal`](../../api_docs/python/control_flow_ops.md#not_equal) - * [`Print`](../../api_docs/python/control_flow_ops.md#Print) - * [`tuple`](../../api_docs/python/control_flow_ops.md#tuple) - * [`verify_tensor_all_finite`](../../api_docs/python/control_flow_ops.md#verify_tensor_all_finite) - * [`where`](../../api_docs/python/control_flow_ops.md#where) - * [`while_loop`](../../api_docs/python/control_flow_ops.md#while_loop) - -* **[Higher Order Functions](../../api_docs/python/functional_ops.md)**: - * [`foldl`](../../api_docs/python/functional_ops.md#foldl) - * [`foldr`](../../api_docs/python/functional_ops.md#foldr) - * [`map_fn`](../../api_docs/python/functional_ops.md#map_fn) - * [`scan`](../../api_docs/python/functional_ops.md#scan) - -* **[TensorArray Operations](../../api_docs/python/tensor_array_ops.md)**: - * [`TensorArray`](../../api_docs/python/tensor_array_ops.md#TensorArray) - -* **[Tensor Handle Operations](../../api_docs/python/session_ops.md)**: - * [`delete_session_tensor`](../../api_docs/python/session_ops.md#delete_session_tensor) - * [`get_session_handle`](../../api_docs/python/session_ops.md#get_session_handle) - * [`get_session_tensor`](../../api_docs/python/session_ops.md#get_session_tensor) - -* **[Images](../../api_docs/python/image.md)**: - * [`adjust_brightness`](../../api_docs/python/image.md#adjust_brightness) - * [`adjust_contrast`](../../api_docs/python/image.md#adjust_contrast) - * [`adjust_gamma`](../../api_docs/python/image.md#adjust_gamma) - * [`adjust_hue`](../../api_docs/python/image.md#adjust_hue) - * [`adjust_saturation`](../../api_docs/python/image.md#adjust_saturation) - * [`central_crop`](../../api_docs/python/image.md#central_crop) - * [`convert_image_dtype`](../../api_docs/python/image.md#convert_image_dtype) - * [`crop_and_resize`](../../api_docs/python/image.md#crop_and_resize) - * [`crop_to_bounding_box`](../../api_docs/python/image.md#crop_to_bounding_box) - * [`decode_gif`](../../api_docs/python/image.md#decode_gif) - * [`decode_image`](../../api_docs/python/image.md#decode_image) - * [`decode_jpeg`](../../api_docs/python/image.md#decode_jpeg) - * [`decode_png`](../../api_docs/python/image.md#decode_png) - * [`draw_bounding_boxes`](../../api_docs/python/image.md#draw_bounding_boxes) - * [`encode_jpeg`](../../api_docs/python/image.md#encode_jpeg) - * [`encode_png`](../../api_docs/python/image.md#encode_png) - * [`extract_glimpse`](../../api_docs/python/image.md#extract_glimpse) - * [`flip_left_right`](../../api_docs/python/image.md#flip_left_right) - * [`flip_up_down`](../../api_docs/python/image.md#flip_up_down) - * [`grayscale_to_rgb`](../../api_docs/python/image.md#grayscale_to_rgb) - * [`hsv_to_rgb`](../../api_docs/python/image.md#hsv_to_rgb) - * [`non_max_suppression`](../../api_docs/python/image.md#non_max_suppression) - * [`pad_to_bounding_box`](../../api_docs/python/image.md#pad_to_bounding_box) - * [`per_image_standardization`](../../api_docs/python/image.md#per_image_standardization) - * [`random_brightness`](../../api_docs/python/image.md#random_brightness) - * [`random_contrast`](../../api_docs/python/image.md#random_contrast) - * [`random_flip_left_right`](../../api_docs/python/image.md#random_flip_left_right) - * [`random_flip_up_down`](../../api_docs/python/image.md#random_flip_up_down) - * [`random_hue`](../../api_docs/python/image.md#random_hue) - * [`random_saturation`](../../api_docs/python/image.md#random_saturation) - * [`resize_area`](../../api_docs/python/image.md#resize_area) - * [`resize_bicubic`](../../api_docs/python/image.md#resize_bicubic) - * [`resize_bilinear`](../../api_docs/python/image.md#resize_bilinear) - * [`resize_image_with_crop_or_pad`](../../api_docs/python/image.md#resize_image_with_crop_or_pad) - * [`resize_images`](../../api_docs/python/image.md#resize_images) - * [`resize_nearest_neighbor`](../../api_docs/python/image.md#resize_nearest_neighbor) - * [`rgb_to_grayscale`](../../api_docs/python/image.md#rgb_to_grayscale) - * [`rgb_to_hsv`](../../api_docs/python/image.md#rgb_to_hsv) - * [`rot90`](../../api_docs/python/image.md#rot90) - * [`sample_distorted_bounding_box`](../../api_docs/python/image.md#sample_distorted_bounding_box) - * [`total_variation`](../../api_docs/python/image.md#total_variation) - * [`transpose_image`](../../api_docs/python/image.md#transpose_image) - -* **[Sparse Tensors](../../api_docs/python/sparse_ops.md)**: - * [`sparse_add`](../../api_docs/python/sparse_ops.md#sparse_add) - * [`sparse_concat`](../../api_docs/python/sparse_ops.md#sparse_concat) - * [`sparse_fill_empty_rows`](../../api_docs/python/sparse_ops.md#sparse_fill_empty_rows) - * [`sparse_maximum`](../../api_docs/python/sparse_ops.md#sparse_maximum) - * [`sparse_merge`](../../api_docs/python/sparse_ops.md#sparse_merge) - * [`sparse_minimum`](../../api_docs/python/sparse_ops.md#sparse_minimum) - * [`sparse_reduce_sum`](../../api_docs/python/sparse_ops.md#sparse_reduce_sum) - * [`sparse_reduce_sum_sparse`](../../api_docs/python/sparse_ops.md#sparse_reduce_sum_sparse) - * [`sparse_reorder`](../../api_docs/python/sparse_ops.md#sparse_reorder) - * [`sparse_reset_shape`](../../api_docs/python/sparse_ops.md#sparse_reset_shape) - * [`sparse_reshape`](../../api_docs/python/sparse_ops.md#sparse_reshape) - * [`sparse_retain`](../../api_docs/python/sparse_ops.md#sparse_retain) - * [`sparse_softmax`](../../api_docs/python/sparse_ops.md#sparse_softmax) - * [`sparse_split`](../../api_docs/python/sparse_ops.md#sparse_split) - * [`sparse_tensor_dense_matmul`](../../api_docs/python/sparse_ops.md#sparse_tensor_dense_matmul) - * [`sparse_tensor_to_dense`](../../api_docs/python/sparse_ops.md#sparse_tensor_to_dense) - * [`sparse_to_dense`](../../api_docs/python/sparse_ops.md#sparse_to_dense) - * [`sparse_to_indicator`](../../api_docs/python/sparse_ops.md#sparse_to_indicator) - * [`sparse_transpose`](../../api_docs/python/sparse_ops.md#sparse_transpose) - * [`SparseTensor`](../../api_docs/python/sparse_ops.md#SparseTensor) - * [`SparseTensorValue`](../../api_docs/python/sparse_ops.md#SparseTensorValue) - -* **[Inputs and Readers](../../api_docs/python/io_ops.md)**: - * [`batch`](../../api_docs/python/io_ops.md#batch) - * [`batch_join`](../../api_docs/python/io_ops.md#batch_join) - * [`ConditionalAccumulator`](../../api_docs/python/io_ops.md#ConditionalAccumulator) - * [`ConditionalAccumulatorBase`](../../api_docs/python/io_ops.md#ConditionalAccumulatorBase) - * [`decode_csv`](../../api_docs/python/io_ops.md#decode_csv) - * [`decode_json_example`](../../api_docs/python/io_ops.md#decode_json_example) - * [`decode_raw`](../../api_docs/python/io_ops.md#decode_raw) - * [`FIFOQueue`](../../api_docs/python/io_ops.md#FIFOQueue) - * [`FixedLenFeature`](../../api_docs/python/io_ops.md#FixedLenFeature) - * [`FixedLengthRecordReader`](../../api_docs/python/io_ops.md#FixedLengthRecordReader) - * [`FixedLenSequenceFeature`](../../api_docs/python/io_ops.md#FixedLenSequenceFeature) - * [`IdentityReader`](../../api_docs/python/io_ops.md#IdentityReader) - * [`input_producer`](../../api_docs/python/io_ops.md#input_producer) - * [`limit_epochs`](../../api_docs/python/io_ops.md#limit_epochs) - * [`match_filenames_once`](../../api_docs/python/io_ops.md#match_filenames_once) - * [`matching_files`](../../api_docs/python/io_ops.md#matching_files) - * [`maybe_batch`](../../api_docs/python/io_ops.md#maybe_batch) - * [`maybe_batch_join`](../../api_docs/python/io_ops.md#maybe_batch_join) - * [`maybe_shuffle_batch`](../../api_docs/python/io_ops.md#maybe_shuffle_batch) - * [`maybe_shuffle_batch_join`](../../api_docs/python/io_ops.md#maybe_shuffle_batch_join) - * [`PaddingFIFOQueue`](../../api_docs/python/io_ops.md#PaddingFIFOQueue) - * [`parse_example`](../../api_docs/python/io_ops.md#parse_example) - * [`parse_single_example`](../../api_docs/python/io_ops.md#parse_single_example) - * [`parse_tensor`](../../api_docs/python/io_ops.md#parse_tensor) - * [`placeholder`](../../api_docs/python/io_ops.md#placeholder) - * [`placeholder_with_default`](../../api_docs/python/io_ops.md#placeholder_with_default) - * [`PriorityQueue`](../../api_docs/python/io_ops.md#PriorityQueue) - * [`QueueBase`](../../api_docs/python/io_ops.md#QueueBase) - * [`RandomShuffleQueue`](../../api_docs/python/io_ops.md#RandomShuffleQueue) - * [`range_input_producer`](../../api_docs/python/io_ops.md#range_input_producer) - * [`read_file`](../../api_docs/python/io_ops.md#read_file) - * [`ReaderBase`](../../api_docs/python/io_ops.md#ReaderBase) - * [`shuffle_batch`](../../api_docs/python/io_ops.md#shuffle_batch) - * [`shuffle_batch_join`](../../api_docs/python/io_ops.md#shuffle_batch_join) - * [`slice_input_producer`](../../api_docs/python/io_ops.md#slice_input_producer) - * [`sparse_placeholder`](../../api_docs/python/io_ops.md#sparse_placeholder) - * [`SparseConditionalAccumulator`](../../api_docs/python/io_ops.md#SparseConditionalAccumulator) - * [`SparseFeature`](../../api_docs/python/io_ops.md#SparseFeature) - * [`string_input_producer`](../../api_docs/python/io_ops.md#string_input_producer) - * [`TextLineReader`](../../api_docs/python/io_ops.md#TextLineReader) - * [`TFRecordReader`](../../api_docs/python/io_ops.md#TFRecordReader) - * [`VarLenFeature`](../../api_docs/python/io_ops.md#VarLenFeature) - * [`WholeFileReader`](../../api_docs/python/io_ops.md#WholeFileReader) - * [`write_file`](../../api_docs/python/io_ops.md#write_file) - -* **[Data IO (Python functions)](../../api_docs/python/python_io.md)**: - * [`tf_record_iterator`](../../api_docs/python/python_io.md#tf_record_iterator) - * [`TFRecordCompressionType`](../../api_docs/python/python_io.md#TFRecordCompressionType) - * [`TFRecordOptions`](../../api_docs/python/python_io.md#TFRecordOptions) - * [`TFRecordWriter`](../../api_docs/python/python_io.md#TFRecordWriter) - -* **[Neural Network](../../api_docs/python/nn.md)**: - * [`atrous_conv2d`](../../api_docs/python/nn.md#atrous_conv2d) - * [`atrous_conv2d_transpose`](../../api_docs/python/nn.md#atrous_conv2d_transpose) - * [`avg_pool`](../../api_docs/python/nn.md#avg_pool) - * [`avg_pool3d`](../../api_docs/python/nn.md#avg_pool3d) - * [`batch_norm_with_global_normalization`](../../api_docs/python/nn.md#batch_norm_with_global_normalization) - * [`batch_normalization`](../../api_docs/python/nn.md#batch_normalization) - * [`bias_add`](../../api_docs/python/nn.md#bias_add) - * [`bidirectional_dynamic_rnn`](../../api_docs/python/nn.md#bidirectional_dynamic_rnn) - * [`compute_accidental_hits`](../../api_docs/python/nn.md#compute_accidental_hits) - * [`conv1d`](../../api_docs/python/nn.md#conv1d) - * [`conv2d`](../../api_docs/python/nn.md#conv2d) - * [`conv2d_backprop_filter`](../../api_docs/python/nn.md#conv2d_backprop_filter) - * [`conv2d_backprop_input`](../../api_docs/python/nn.md#conv2d_backprop_input) - * [`conv2d_transpose`](../../api_docs/python/nn.md#conv2d_transpose) - * [`conv3d`](../../api_docs/python/nn.md#conv3d) - * [`conv3d_backprop_filter_v2`](../../api_docs/python/nn.md#conv3d_backprop_filter_v2) - * [`conv3d_transpose`](../../api_docs/python/nn.md#conv3d_transpose) - * [`convolution`](../../api_docs/python/nn.md#convolution) - * [`crelu`](../../api_docs/python/nn.md#crelu) - * [`ctc_beam_search_decoder`](../../api_docs/python/nn.md#ctc_beam_search_decoder) - * [`ctc_greedy_decoder`](../../api_docs/python/nn.md#ctc_greedy_decoder) - * [`ctc_loss`](../../api_docs/python/nn.md#ctc_loss) - * [`depthwise_conv2d`](../../api_docs/python/nn.md#depthwise_conv2d) - * [`depthwise_conv2d_native`](../../api_docs/python/nn.md#depthwise_conv2d_native) - * [`depthwise_conv2d_native_backprop_filter`](../../api_docs/python/nn.md#depthwise_conv2d_native_backprop_filter) - * [`depthwise_conv2d_native_backprop_input`](../../api_docs/python/nn.md#depthwise_conv2d_native_backprop_input) - * [`dilation2d`](../../api_docs/python/nn.md#dilation2d) - * [`dropout`](../../api_docs/python/nn.md#dropout) - * [`dynamic_rnn`](../../api_docs/python/nn.md#dynamic_rnn) - * [`elu`](../../api_docs/python/nn.md#elu) - * [`embedding_lookup`](../../api_docs/python/nn.md#embedding_lookup) - * [`embedding_lookup_sparse`](../../api_docs/python/nn.md#embedding_lookup_sparse) - * [`erosion2d`](../../api_docs/python/nn.md#erosion2d) - * [`fixed_unigram_candidate_sampler`](../../api_docs/python/nn.md#fixed_unigram_candidate_sampler) - * [`fractional_avg_pool`](../../api_docs/python/nn.md#fractional_avg_pool) - * [`fractional_max_pool`](../../api_docs/python/nn.md#fractional_max_pool) - * [`fused_batch_norm`](../../api_docs/python/nn.md#fused_batch_norm) - * [`in_top_k`](../../api_docs/python/nn.md#in_top_k) - * [`l2_loss`](../../api_docs/python/nn.md#l2_loss) - * [`l2_normalize`](../../api_docs/python/nn.md#l2_normalize) - * [`learned_unigram_candidate_sampler`](../../api_docs/python/nn.md#learned_unigram_candidate_sampler) - * [`local_response_normalization`](../../api_docs/python/nn.md#local_response_normalization) - * [`log_poisson_loss`](../../api_docs/python/nn.md#log_poisson_loss) - * [`log_softmax`](../../api_docs/python/nn.md#log_softmax) - * [`log_uniform_candidate_sampler`](../../api_docs/python/nn.md#log_uniform_candidate_sampler) - * [`max_pool`](../../api_docs/python/nn.md#max_pool) - * [`max_pool3d`](../../api_docs/python/nn.md#max_pool3d) - * [`max_pool_with_argmax`](../../api_docs/python/nn.md#max_pool_with_argmax) - * [`moments`](../../api_docs/python/nn.md#moments) - * [`nce_loss`](../../api_docs/python/nn.md#nce_loss) - * [`normalize_moments`](../../api_docs/python/nn.md#normalize_moments) - * [`pool`](../../api_docs/python/nn.md#pool) - * [`quantized_avg_pool`](../../api_docs/python/nn.md#quantized_avg_pool) - * [`quantized_conv2d`](../../api_docs/python/nn.md#quantized_conv2d) - * [`quantized_max_pool`](../../api_docs/python/nn.md#quantized_max_pool) - * [`quantized_relu_x`](../../api_docs/python/nn.md#quantized_relu_x) - * [`raw_rnn`](../../api_docs/python/nn.md#raw_rnn) - * [`relu`](../../api_docs/python/nn.md#relu) - * [`relu6`](../../api_docs/python/nn.md#relu6) - * [`sampled_softmax_loss`](../../api_docs/python/nn.md#sampled_softmax_loss) - * [`separable_conv2d`](../../api_docs/python/nn.md#separable_conv2d) - * [`sigmoid`](../../api_docs/python/nn.md#sigmoid) - * [`sigmoid_cross_entropy_with_logits`](../../api_docs/python/nn.md#sigmoid_cross_entropy_with_logits) - * [`softmax`](../../api_docs/python/nn.md#softmax) - * [`softmax_cross_entropy_with_logits`](../../api_docs/python/nn.md#softmax_cross_entropy_with_logits) - * [`softplus`](../../api_docs/python/nn.md#softplus) - * [`softsign`](../../api_docs/python/nn.md#softsign) - * [`sparse_softmax_cross_entropy_with_logits`](../../api_docs/python/nn.md#sparse_softmax_cross_entropy_with_logits) - * [`sufficient_statistics`](../../api_docs/python/nn.md#sufficient_statistics) - * [`tanh`](../../api_docs/python/nn.md#tanh) - * [`top_k`](../../api_docs/python/nn.md#top_k) - * [`uniform_candidate_sampler`](../../api_docs/python/nn.md#uniform_candidate_sampler) - * [`weighted_cross_entropy_with_logits`](../../api_docs/python/nn.md#weighted_cross_entropy_with_logits) - * [`weighted_moments`](../../api_docs/python/nn.md#weighted_moments) - * [`with_space_to_batch`](../../api_docs/python/nn.md#with_space_to_batch) - * [`zero_fraction`](../../api_docs/python/nn.md#zero_fraction) - -* **[Running Graphs](../../api_docs/python/client.md)**: - * [`AbortedError`](../../api_docs/python/client.md#AbortedError) - * [`AlreadyExistsError`](../../api_docs/python/client.md#AlreadyExistsError) - * [`CancelledError`](../../api_docs/python/client.md#CancelledError) - * [`DataLossError`](../../api_docs/python/client.md#DataLossError) - * [`DeadlineExceededError`](../../api_docs/python/client.md#DeadlineExceededError) - * [`error_code_from_exception_type`](../../api_docs/python/client.md#error_code_from_exception_type) - * [`exception_type_from_error_code`](../../api_docs/python/client.md#exception_type_from_error_code) - * [`FailedPreconditionError`](../../api_docs/python/client.md#FailedPreconditionError) - * [`get_default_session`](../../api_docs/python/client.md#get_default_session) - * [`InteractiveSession`](../../api_docs/python/client.md#InteractiveSession) - * [`InternalError`](../../api_docs/python/client.md#InternalError) - * [`InvalidArgumentError`](../../api_docs/python/client.md#InvalidArgumentError) - * [`NotFoundError`](../../api_docs/python/client.md#NotFoundError) - * [`OpError`](../../api_docs/python/client.md#OpError) - * [`OutOfRangeError`](../../api_docs/python/client.md#OutOfRangeError) - * [`PermissionDeniedError`](../../api_docs/python/client.md#PermissionDeniedError) - * [`raise_exception_on_not_ok_status`](../../api_docs/python/client.md#raise_exception_on_not_ok_status) - * [`ResourceExhaustedError`](../../api_docs/python/client.md#ResourceExhaustedError) - * [`Session`](../../api_docs/python/client.md#Session) - * [`UnauthenticatedError`](../../api_docs/python/client.md#UnauthenticatedError) - * [`UnavailableError`](../../api_docs/python/client.md#UnavailableError) - * [`UnimplementedError`](../../api_docs/python/client.md#UnimplementedError) - * [`UnknownError`](../../api_docs/python/client.md#UnknownError) - -* **[Training](../../api_docs/python/train.md)**: - * [`AdadeltaOptimizer`](../../api_docs/python/train.md#AdadeltaOptimizer) - * [`AdagradDAOptimizer`](../../api_docs/python/train.md#AdagradDAOptimizer) - * [`AdagradOptimizer`](../../api_docs/python/train.md#AdagradOptimizer) - * [`AdamOptimizer`](../../api_docs/python/train.md#AdamOptimizer) - * [`add_queue_runner`](../../api_docs/python/train.md#add_queue_runner) - * [`AggregationMethod`](../../api_docs/python/train.md#AggregationMethod) - * [`assert_global_step`](../../api_docs/python/train.md#assert_global_step) - * [`basic_train_loop`](../../api_docs/python/train.md#basic_train_loop) - * [`checkpoint_exists`](../../api_docs/python/train.md#checkpoint_exists) - * [`CheckpointSaverHook`](../../api_docs/python/train.md#CheckpointSaverHook) - * [`ChiefSessionCreator`](../../api_docs/python/train.md#ChiefSessionCreator) - * [`clip_by_average_norm`](../../api_docs/python/train.md#clip_by_average_norm) - * [`clip_by_global_norm`](../../api_docs/python/train.md#clip_by_global_norm) - * [`clip_by_norm`](../../api_docs/python/train.md#clip_by_norm) - * [`clip_by_value`](../../api_docs/python/train.md#clip_by_value) - * [`ClusterSpec`](../../api_docs/python/train.md#ClusterSpec) - * [`Coordinator`](../../api_docs/python/train.md#Coordinator) - * [`do_quantize_training_on_graphdef`](../../api_docs/python/train.md#do_quantize_training_on_graphdef) - * [`exponential_decay`](../../api_docs/python/train.md#exponential_decay) - * [`ExponentialMovingAverage`](../../api_docs/python/train.md#ExponentialMovingAverage) - * [`FeedFnHook`](../../api_docs/python/train.md#FeedFnHook) - * [`FinalOpsHook`](../../api_docs/python/train.md#FinalOpsHook) - * [`FtrlOptimizer`](../../api_docs/python/train.md#FtrlOptimizer) - * [`generate_checkpoint_state_proto`](../../api_docs/python/train.md#generate_checkpoint_state_proto) - * [`get_checkpoint_mtimes`](../../api_docs/python/train.md#get_checkpoint_mtimes) - * [`get_global_step`](../../api_docs/python/train.md#get_global_step) - * [`global_norm`](../../api_docs/python/train.md#global_norm) - * [`global_step`](../../api_docs/python/train.md#global_step) - * [`GlobalStepWaiterHook`](../../api_docs/python/train.md#GlobalStepWaiterHook) - * [`GradientDescentOptimizer`](../../api_docs/python/train.md#GradientDescentOptimizer) - * [`gradients`](../../api_docs/python/train.md#gradients) - * [`hessians`](../../api_docs/python/train.md#hessians) - * [`inverse_time_decay`](../../api_docs/python/train.md#inverse_time_decay) - * [`LoggingTensorHook`](../../api_docs/python/train.md#LoggingTensorHook) - * [`LooperThread`](../../api_docs/python/train.md#LooperThread) - * [`MomentumOptimizer`](../../api_docs/python/train.md#MomentumOptimizer) - * [`MonitoredSession`](../../api_docs/python/train.md#MonitoredSession) - * [`MonitoredTrainingSession`](../../api_docs/python/train.md#MonitoredTrainingSession) - * [`NanLossDuringTrainingError`](../../api_docs/python/train.md#NanLossDuringTrainingError) - * [`NanTensorHook`](../../api_docs/python/train.md#NanTensorHook) - * [`natural_exp_decay`](../../api_docs/python/train.md#natural_exp_decay) - * [`NewCheckpointReader`](../../api_docs/python/train.md#NewCheckpointReader) - * [`Optimizer`](../../api_docs/python/train.md#Optimizer) - * [`piecewise_constant`](../../api_docs/python/train.md#piecewise_constant) - * [`polynomial_decay`](../../api_docs/python/train.md#polynomial_decay) - * [`ProximalAdagradOptimizer`](../../api_docs/python/train.md#ProximalAdagradOptimizer) - * [`ProximalGradientDescentOptimizer`](../../api_docs/python/train.md#ProximalGradientDescentOptimizer) - * [`QueueRunner`](../../api_docs/python/train.md#QueueRunner) - * [`replica_device_setter`](../../api_docs/python/train.md#replica_device_setter) - * [`RMSPropOptimizer`](../../api_docs/python/train.md#RMSPropOptimizer) - * [`Scaffold`](../../api_docs/python/train.md#Scaffold) - * [`Server`](../../api_docs/python/train.md#Server) - * [`SessionCreator`](../../api_docs/python/train.md#SessionCreator) - * [`SessionManager`](../../api_docs/python/train.md#SessionManager) - * [`SessionRunArgs`](../../api_docs/python/train.md#SessionRunArgs) - * [`SessionRunContext`](../../api_docs/python/train.md#SessionRunContext) - * [`SessionRunHook`](../../api_docs/python/train.md#SessionRunHook) - * [`SessionRunValues`](../../api_docs/python/train.md#SessionRunValues) - * [`SingularMonitoredSession`](../../api_docs/python/train.md#SingularMonitoredSession) - * [`start_queue_runners`](../../api_docs/python/train.md#start_queue_runners) - * [`StepCounterHook`](../../api_docs/python/train.md#StepCounterHook) - * [`stop_gradient`](../../api_docs/python/train.md#stop_gradient) - * [`StopAtStepHook`](../../api_docs/python/train.md#StopAtStepHook) - * [`summary_iterator`](../../api_docs/python/train.md#summary_iterator) - * [`SummarySaverHook`](../../api_docs/python/train.md#SummarySaverHook) - * [`Supervisor`](../../api_docs/python/train.md#Supervisor) - * [`SyncReplicasOptimizer`](../../api_docs/python/train.md#SyncReplicasOptimizer) - * [`WorkerSessionCreator`](../../api_docs/python/train.md#WorkerSessionCreator) - * [`write_graph`](../../api_docs/python/train.md#write_graph) - -* **[Wraps python functions](../../api_docs/python/script_ops.md)**: - * [`py_func`](../../api_docs/python/script_ops.md#py_func) - -* **[Summary Operations](../../api_docs/python/summary.md)**: - * [`audio`](../../api_docs/python/summary.md#audio) - * [`FileWriter`](../../api_docs/python/summary.md#FileWriter) - * [`FileWriterCache`](../../api_docs/python/summary.md#FileWriterCache) - * [`get_summary_description`](../../api_docs/python/summary.md#get_summary_description) - * [`histogram`](../../api_docs/python/summary.md#histogram) - * [`image`](../../api_docs/python/summary.md#image) - * [`merge`](../../api_docs/python/summary.md#merge) - * [`merge_all`](../../api_docs/python/summary.md#merge_all) - * [`scalar`](../../api_docs/python/summary.md#scalar) - * [`SummaryDescription`](../../api_docs/python/summary.md#SummaryDescription) - * [`TaggedRunMetadata`](../../api_docs/python/summary.md#TaggedRunMetadata) - * [`tensor_summary`](../../api_docs/python/summary.md#tensor_summary) - -* **[Testing](../../api_docs/python/test.md)**: - * [`assert_equal_graph_def`](../../api_docs/python/test.md#assert_equal_graph_def) - * [`Benchmark`](../../api_docs/python/test.md#Benchmark) - * [`compute_gradient`](../../api_docs/python/test.md#compute_gradient) - * [`compute_gradient_error`](../../api_docs/python/test.md#compute_gradient_error) - * [`get_temp_dir`](../../api_docs/python/test.md#get_temp_dir) - * [`gpu_device_name`](../../api_docs/python/test.md#gpu_device_name) - * [`is_built_with_cuda`](../../api_docs/python/test.md#is_built_with_cuda) - * [`is_gpu_available`](../../api_docs/python/test.md#is_gpu_available) - * [`main`](../../api_docs/python/test.md#main) - * [`test_src_dir_path`](../../api_docs/python/test.md#test_src_dir_path) - * [`TestCase`](../../api_docs/python/test.md#TestCase) - -* **[BayesFlow Entropy (contrib)](../../api_docs/python/contrib.bayesflow.entropy.md)**: - * [`elbo_ratio`](../../api_docs/python/contrib.bayesflow.entropy.md#elbo_ratio) - * [`entropy_shannon`](../../api_docs/python/contrib.bayesflow.entropy.md#entropy_shannon) - * [`renyi_alpha`](../../api_docs/python/contrib.bayesflow.entropy.md#renyi_alpha) - * [`renyi_ratio`](../../api_docs/python/contrib.bayesflow.entropy.md#renyi_ratio) - -* **[BayesFlow Monte Carlo (contrib)](../../api_docs/python/contrib.bayesflow.monte_carlo.md)**: - * [`expectation`](../../api_docs/python/contrib.bayesflow.monte_carlo.md#expectation) - * [`expectation_importance_sampler`](../../api_docs/python/contrib.bayesflow.monte_carlo.md#expectation_importance_sampler) - * [`expectation_importance_sampler_logspace`](../../api_docs/python/contrib.bayesflow.monte_carlo.md#expectation_importance_sampler_logspace) - -* **[BayesFlow Stochastic Graph (contrib)](../../api_docs/python/contrib.bayesflow.stochastic_graph.md)**: - * [`surrogate_loss`](../../api_docs/python/contrib.bayesflow.stochastic_graph.md#surrogate_loss) - -* **[BayesFlow Stochastic Tensors (contrib)](../../api_docs/python/contrib.bayesflow.stochastic_tensor.md)**: - * [`BaseStochasticTensor`](../../api_docs/python/contrib.bayesflow.stochastic_tensor.md#BaseStochasticTensor) - * [`get_current_value_type`](../../api_docs/python/contrib.bayesflow.stochastic_tensor.md#get_current_value_type) - * [`MeanValue`](../../api_docs/python/contrib.bayesflow.stochastic_tensor.md#MeanValue) - * [`ObservedStochasticTensor`](../../api_docs/python/contrib.bayesflow.stochastic_tensor.md#ObservedStochasticTensor) - * [`SampleValue`](../../api_docs/python/contrib.bayesflow.stochastic_tensor.md#SampleValue) - * [`StochasticTensor`](../../api_docs/python/contrib.bayesflow.stochastic_tensor.md#StochasticTensor) - * [`value_type`](../../api_docs/python/contrib.bayesflow.stochastic_tensor.md#value_type) - -* **[BayesFlow Variational Inference (contrib)](../../api_docs/python/contrib.bayesflow.variational_inference.md)**: - * [`elbo`](../../api_docs/python/contrib.bayesflow.variational_inference.md#elbo) - * [`elbo_with_log_joint`](../../api_docs/python/contrib.bayesflow.variational_inference.md#elbo_with_log_joint) - * [`ELBOForms`](../../api_docs/python/contrib.bayesflow.variational_inference.md#ELBOForms) - * [`register_prior`](../../api_docs/python/contrib.bayesflow.variational_inference.md#register_prior) - -* **[CRF (contrib)](../../api_docs/python/contrib.crf.md)**: - * [`crf_binary_score`](../../api_docs/python/contrib.crf.md#crf_binary_score) - * [`crf_log_likelihood`](../../api_docs/python/contrib.crf.md#crf_log_likelihood) - * [`crf_log_norm`](../../api_docs/python/contrib.crf.md#crf_log_norm) - * [`crf_sequence_score`](../../api_docs/python/contrib.crf.md#crf_sequence_score) - * [`crf_unary_score`](../../api_docs/python/contrib.crf.md#crf_unary_score) - * [`CrfForwardRnnCell`](../../api_docs/python/contrib.crf.md#CrfForwardRnnCell) - * [`viterbi_decode`](../../api_docs/python/contrib.crf.md#viterbi_decode) - -* **[Statistical Distributions (contrib)](../../api_docs/python/contrib.distributions.md)**: - * [`Bernoulli`](../../api_docs/python/contrib.distributions.md#Bernoulli) - * [`BernoulliWithSigmoidProbs`](../../api_docs/python/contrib.distributions.md#BernoulliWithSigmoidProbs) - * [`Beta`](../../api_docs/python/contrib.distributions.md#Beta) - * [`BetaWithSoftplusConcentration`](../../api_docs/python/contrib.distributions.md#BetaWithSoftplusConcentration) - * [`Binomial`](../../api_docs/python/contrib.distributions.md#Binomial) - * [`Categorical`](../../api_docs/python/contrib.distributions.md#Categorical) - * [`Chi2`](../../api_docs/python/contrib.distributions.md#Chi2) - * [`Chi2WithAbsDf`](../../api_docs/python/contrib.distributions.md#Chi2WithAbsDf) - * [`ConditionalDistribution`](../../api_docs/python/contrib.distributions.md#ConditionalDistribution) - * [`ConditionalTransformedDistribution`](../../api_docs/python/contrib.distributions.md#ConditionalTransformedDistribution) - * [`Dirichlet`](../../api_docs/python/contrib.distributions.md#Dirichlet) - * [`DirichletMultinomial`](../../api_docs/python/contrib.distributions.md#DirichletMultinomial) - * [`Distribution`](../../api_docs/python/contrib.distributions.md#Distribution) - * [`Exponential`](../../api_docs/python/contrib.distributions.md#Exponential) - * [`ExponentialWithSoftplusRate`](../../api_docs/python/contrib.distributions.md#ExponentialWithSoftplusRate) - * [`ExpRelaxedOneHotCategorical`](../../api_docs/python/contrib.distributions.md#ExpRelaxedOneHotCategorical) - * [`Gamma`](../../api_docs/python/contrib.distributions.md#Gamma) - * [`GammaWithSoftplusConcentrationRate`](../../api_docs/python/contrib.distributions.md#GammaWithSoftplusConcentrationRate) - * [`InverseGamma`](../../api_docs/python/contrib.distributions.md#InverseGamma) - * [`InverseGammaWithSoftplusConcentrationRate`](../../api_docs/python/contrib.distributions.md#InverseGammaWithSoftplusConcentrationRate) - * [`kl`](../../api_docs/python/contrib.distributions.md#kl) - * [`Laplace`](../../api_docs/python/contrib.distributions.md#Laplace) - * [`LaplaceWithSoftplusScale`](../../api_docs/python/contrib.distributions.md#LaplaceWithSoftplusScale) - * [`Logistic`](../../api_docs/python/contrib.distributions.md#Logistic) - * [`matrix_diag_transform`](../../api_docs/python/contrib.distributions.md#matrix_diag_transform) - * [`Mixture`](../../api_docs/python/contrib.distributions.md#Mixture) - * [`Multinomial`](../../api_docs/python/contrib.distributions.md#Multinomial) - * [`MultivariateNormalDiag`](../../api_docs/python/contrib.distributions.md#MultivariateNormalDiag) - * [`MultivariateNormalDiagPlusLowRank`](../../api_docs/python/contrib.distributions.md#MultivariateNormalDiagPlusLowRank) - * [`MultivariateNormalDiagWithSoftplusScale`](../../api_docs/python/contrib.distributions.md#MultivariateNormalDiagWithSoftplusScale) - * [`MultivariateNormalTriL`](../../api_docs/python/contrib.distributions.md#MultivariateNormalTriL) - * [`Normal`](../../api_docs/python/contrib.distributions.md#Normal) - * [`normal_conjugates_known_scale_posterior`](../../api_docs/python/contrib.distributions.md#normal_conjugates_known_scale_posterior) - * [`normal_conjugates_known_scale_predictive`](../../api_docs/python/contrib.distributions.md#normal_conjugates_known_scale_predictive) - * [`NormalWithSoftplusScale`](../../api_docs/python/contrib.distributions.md#NormalWithSoftplusScale) - * [`OneHotCategorical`](../../api_docs/python/contrib.distributions.md#OneHotCategorical) - * [`Poisson`](../../api_docs/python/contrib.distributions.md#Poisson) - * [`QuantizedDistribution`](../../api_docs/python/contrib.distributions.md#QuantizedDistribution) - * [`RegisterKL`](../../api_docs/python/contrib.distributions.md#RegisterKL) - * [`RelaxedBernoulli`](../../api_docs/python/contrib.distributions.md#RelaxedBernoulli) - * [`RelaxedOneHotCategorical`](../../api_docs/python/contrib.distributions.md#RelaxedOneHotCategorical) - * [`ReparameterizationType`](../../api_docs/python/contrib.distributions.md#ReparameterizationType) - * [`softplus_inverse`](../../api_docs/python/contrib.distributions.md#softplus_inverse) - * [`StudentT`](../../api_docs/python/contrib.distributions.md#StudentT) - * [`StudentTWithAbsDfSoftplusScale`](../../api_docs/python/contrib.distributions.md#StudentTWithAbsDfSoftplusScale) - * [`TransformedDistribution`](../../api_docs/python/contrib.distributions.md#TransformedDistribution) - * [`Uniform`](../../api_docs/python/contrib.distributions.md#Uniform) - * [`WishartCholesky`](../../api_docs/python/contrib.distributions.md#WishartCholesky) - * [`WishartFull`](../../api_docs/python/contrib.distributions.md#WishartFull) - -* **[Random variable transformations (contrib)](../../api_docs/python/contrib.distributions.bijector.md)**: - * [`Affine`](../../api_docs/python/contrib.distributions.bijector.md#Affine) - * [`AffineLinearOperator`](../../api_docs/python/contrib.distributions.bijector.md#AffineLinearOperator) - * [`Bijector`](../../api_docs/python/contrib.distributions.bijector.md#Bijector) - * [`Chain`](../../api_docs/python/contrib.distributions.bijector.md#Chain) - * [`CholeskyOuterProduct`](../../api_docs/python/contrib.distributions.bijector.md#CholeskyOuterProduct) - * [`Exp`](../../api_docs/python/contrib.distributions.bijector.md#Exp) - * [`Identity`](../../api_docs/python/contrib.distributions.bijector.md#Identity) - * [`Inline`](../../api_docs/python/contrib.distributions.bijector.md#Inline) - * [`Invert`](../../api_docs/python/contrib.distributions.bijector.md#Invert) - * [`PowerTransform`](../../api_docs/python/contrib.distributions.bijector.md#PowerTransform) - * [`SigmoidCentered`](../../api_docs/python/contrib.distributions.bijector.md#SigmoidCentered) - * [`SoftmaxCentered`](../../api_docs/python/contrib.distributions.bijector.md#SoftmaxCentered) - * [`Softplus`](../../api_docs/python/contrib.distributions.bijector.md#Softplus) - -* **[FFmpeg (contrib)](../../api_docs/python/contrib.ffmpeg.md)**: - * [`decode_audio`](../../api_docs/python/contrib.ffmpeg.md#decode_audio) - * [`encode_audio`](../../api_docs/python/contrib.ffmpeg.md#encode_audio) - -* **[Framework (contrib)](../../api_docs/python/contrib.framework.md)**: - * [`add_arg_scope`](../../api_docs/python/contrib.framework.md#add_arg_scope) - * [`add_model_variable`](../../api_docs/python/contrib.framework.md#add_model_variable) - * [`arg_scope`](../../api_docs/python/contrib.framework.md#arg_scope) - * [`arg_scoped_arguments`](../../api_docs/python/contrib.framework.md#arg_scoped_arguments) - * [`assert_global_step`](../../api_docs/python/contrib.framework.md#assert_global_step) - * [`assert_or_get_global_step`](../../api_docs/python/contrib.framework.md#assert_or_get_global_step) - * [`assert_same_float_dtype`](../../api_docs/python/contrib.framework.md#assert_same_float_dtype) - * [`assert_scalar`](../../api_docs/python/contrib.framework.md#assert_scalar) - * [`assert_scalar_int`](../../api_docs/python/contrib.framework.md#assert_scalar_int) - * [`assign_from_checkpoint`](../../api_docs/python/contrib.framework.md#assign_from_checkpoint) - * [`assign_from_checkpoint_fn`](../../api_docs/python/contrib.framework.md#assign_from_checkpoint_fn) - * [`assign_from_values`](../../api_docs/python/contrib.framework.md#assign_from_values) - * [`assign_from_values_fn`](../../api_docs/python/contrib.framework.md#assign_from_values_fn) - * [`convert_to_tensor_or_sparse_tensor`](../../api_docs/python/contrib.framework.md#convert_to_tensor_or_sparse_tensor) - * [`create_global_step`](../../api_docs/python/contrib.framework.md#create_global_step) - * [`deprecated`](../../api_docs/python/contrib.framework.md#deprecated) - * [`deprecated_arg_values`](../../api_docs/python/contrib.framework.md#deprecated_arg_values) - * [`deprecated_args`](../../api_docs/python/contrib.framework.md#deprecated_args) - * [`filter_variables`](../../api_docs/python/contrib.framework.md#filter_variables) - * [`get_global_step`](../../api_docs/python/contrib.framework.md#get_global_step) - * [`get_graph_from_inputs`](../../api_docs/python/contrib.framework.md#get_graph_from_inputs) - * [`get_local_variables`](../../api_docs/python/contrib.framework.md#get_local_variables) - * [`get_model_variables`](../../api_docs/python/contrib.framework.md#get_model_variables) - * [`get_or_create_global_step`](../../api_docs/python/contrib.framework.md#get_or_create_global_step) - * [`get_unique_variable`](../../api_docs/python/contrib.framework.md#get_unique_variable) - * [`get_variable_full_name`](../../api_docs/python/contrib.framework.md#get_variable_full_name) - * [`get_variables`](../../api_docs/python/contrib.framework.md#get_variables) - * [`get_variables_by_name`](../../api_docs/python/contrib.framework.md#get_variables_by_name) - * [`get_variables_by_suffix`](../../api_docs/python/contrib.framework.md#get_variables_by_suffix) - * [`get_variables_to_restore`](../../api_docs/python/contrib.framework.md#get_variables_to_restore) - * [`has_arg_scope`](../../api_docs/python/contrib.framework.md#has_arg_scope) - * [`init_from_checkpoint`](../../api_docs/python/contrib.framework.md#init_from_checkpoint) - * [`is_non_decreasing`](../../api_docs/python/contrib.framework.md#is_non_decreasing) - * [`is_numeric_tensor`](../../api_docs/python/contrib.framework.md#is_numeric_tensor) - * [`is_strictly_increasing`](../../api_docs/python/contrib.framework.md#is_strictly_increasing) - * [`is_tensor`](../../api_docs/python/contrib.framework.md#is_tensor) - * [`list_variables`](../../api_docs/python/contrib.framework.md#list_variables) - * [`load_checkpoint`](../../api_docs/python/contrib.framework.md#load_checkpoint) - * [`load_variable`](../../api_docs/python/contrib.framework.md#load_variable) - * [`local_variable`](../../api_docs/python/contrib.framework.md#local_variable) - * [`model_variable`](../../api_docs/python/contrib.framework.md#model_variable) - * [`reduce_sum_n`](../../api_docs/python/contrib.framework.md#reduce_sum_n) - * [`remove_squeezable_dimensions`](../../api_docs/python/contrib.framework.md#remove_squeezable_dimensions) - * [`variable`](../../api_docs/python/contrib.framework.md#variable) - * [`VariableDeviceChooser`](../../api_docs/python/contrib.framework.md#VariableDeviceChooser) - * [`with_same_shape`](../../api_docs/python/contrib.framework.md#with_same_shape) - * [`with_shape`](../../api_docs/python/contrib.framework.md#with_shape) - * [`zero_initializer`](../../api_docs/python/contrib.framework.md#zero_initializer) - -* **[Graph Editor (contrib)](../../api_docs/python/contrib.graph_editor.md)**: - * [`add_control_inputs`](../../api_docs/python/contrib.graph_editor.md#add_control_inputs) - * [`assign_renamed_collections_handler`](../../api_docs/python/contrib.graph_editor.md#assign_renamed_collections_handler) - * [`bypass`](../../api_docs/python/contrib.graph_editor.md#bypass) - * [`can_be_regex`](../../api_docs/python/contrib.graph_editor.md#can_be_regex) - * [`check_cios`](../../api_docs/python/contrib.graph_editor.md#check_cios) - * [`compute_boundary_ts`](../../api_docs/python/contrib.graph_editor.md#compute_boundary_ts) - * [`connect`](../../api_docs/python/contrib.graph_editor.md#connect) - * [`ControlOutputs`](../../api_docs/python/contrib.graph_editor.md#ControlOutputs) - * [`copy_op_handler`](../../api_docs/python/contrib.graph_editor.md#copy_op_handler) - * [`copy_with_input_replacements`](../../api_docs/python/contrib.graph_editor.md#copy_with_input_replacements) - * [`detach`](../../api_docs/python/contrib.graph_editor.md#detach) - * [`detach_control_inputs`](../../api_docs/python/contrib.graph_editor.md#detach_control_inputs) - * [`detach_control_outputs`](../../api_docs/python/contrib.graph_editor.md#detach_control_outputs) - * [`detach_inputs`](../../api_docs/python/contrib.graph_editor.md#detach_inputs) - * [`detach_outputs`](../../api_docs/python/contrib.graph_editor.md#detach_outputs) - * [`filter_ops`](../../api_docs/python/contrib.graph_editor.md#filter_ops) - * [`filter_ops_from_regex`](../../api_docs/python/contrib.graph_editor.md#filter_ops_from_regex) - * [`filter_ts`](../../api_docs/python/contrib.graph_editor.md#filter_ts) - * [`filter_ts_from_regex`](../../api_docs/python/contrib.graph_editor.md#filter_ts_from_regex) - * [`get_backward_walk_ops`](../../api_docs/python/contrib.graph_editor.md#get_backward_walk_ops) - * [`get_consuming_ops`](../../api_docs/python/contrib.graph_editor.md#get_consuming_ops) - * [`get_forward_walk_ops`](../../api_docs/python/contrib.graph_editor.md#get_forward_walk_ops) - * [`get_generating_ops`](../../api_docs/python/contrib.graph_editor.md#get_generating_ops) - * [`get_name_scope_ops`](../../api_docs/python/contrib.graph_editor.md#get_name_scope_ops) - * [`get_ops_ios`](../../api_docs/python/contrib.graph_editor.md#get_ops_ios) - * [`get_tensors`](../../api_docs/python/contrib.graph_editor.md#get_tensors) - * [`get_walks_intersection_ops`](../../api_docs/python/contrib.graph_editor.md#get_walks_intersection_ops) - * [`get_walks_union_ops`](../../api_docs/python/contrib.graph_editor.md#get_walks_union_ops) - * [`get_within_boundary_ops`](../../api_docs/python/contrib.graph_editor.md#get_within_boundary_ops) - * [`graph_replace`](../../api_docs/python/contrib.graph_editor.md#graph_replace) - * [`keep_t_if_possible_handler`](../../api_docs/python/contrib.graph_editor.md#keep_t_if_possible_handler) - * [`make_list_of_op`](../../api_docs/python/contrib.graph_editor.md#make_list_of_op) - * [`make_list_of_t`](../../api_docs/python/contrib.graph_editor.md#make_list_of_t) - * [`make_placeholder_from_dtype_and_shape`](../../api_docs/python/contrib.graph_editor.md#make_placeholder_from_dtype_and_shape) - * [`make_placeholder_from_tensor`](../../api_docs/python/contrib.graph_editor.md#make_placeholder_from_tensor) - * [`make_regex`](../../api_docs/python/contrib.graph_editor.md#make_regex) - * [`make_view`](../../api_docs/python/contrib.graph_editor.md#make_view) - * [`make_view_from_scope`](../../api_docs/python/contrib.graph_editor.md#make_view_from_scope) - * [`op_type`](../../api_docs/python/contrib.graph_editor.md#op_type) - * [`OpMatcher`](../../api_docs/python/contrib.graph_editor.md#OpMatcher) - * [`ph`](../../api_docs/python/contrib.graph_editor.md#ph) - * [`placeholder_name`](../../api_docs/python/contrib.graph_editor.md#placeholder_name) - * [`remove_control_inputs`](../../api_docs/python/contrib.graph_editor.md#remove_control_inputs) - * [`replace_t_with_placeholder_handler`](../../api_docs/python/contrib.graph_editor.md#replace_t_with_placeholder_handler) - * [`reroute_inputs`](../../api_docs/python/contrib.graph_editor.md#reroute_inputs) - * [`reroute_ios`](../../api_docs/python/contrib.graph_editor.md#reroute_ios) - * [`reroute_outputs`](../../api_docs/python/contrib.graph_editor.md#reroute_outputs) - * [`reroute_ts`](../../api_docs/python/contrib.graph_editor.md#reroute_ts) - * [`select_ops`](../../api_docs/python/contrib.graph_editor.md#select_ops) - * [`select_ops_and_ts`](../../api_docs/python/contrib.graph_editor.md#select_ops_and_ts) - * [`select_ts`](../../api_docs/python/contrib.graph_editor.md#select_ts) - * [`sgv`](../../api_docs/python/contrib.graph_editor.md#sgv) - * [`sgv_scope`](../../api_docs/python/contrib.graph_editor.md#sgv_scope) - * [`SubGraphView`](../../api_docs/python/contrib.graph_editor.md#SubGraphView) - * [`swap_inputs`](../../api_docs/python/contrib.graph_editor.md#swap_inputs) - * [`swap_ios`](../../api_docs/python/contrib.graph_editor.md#swap_ios) - * [`swap_outputs`](../../api_docs/python/contrib.graph_editor.md#swap_outputs) - * [`swap_ts`](../../api_docs/python/contrib.graph_editor.md#swap_ts) - * [`transform_op_if_inside_handler`](../../api_docs/python/contrib.graph_editor.md#transform_op_if_inside_handler) - * [`Transformer`](../../api_docs/python/contrib.graph_editor.md#Transformer) - * [`TransformerInfo`](../../api_docs/python/contrib.graph_editor.md#TransformerInfo) - -* **[Integrate (contrib)](../../api_docs/python/contrib.integrate.md)**: - * [`odeint`](../../api_docs/python/contrib.integrate.md#odeint) - -* **[Layers (contrib)](../../api_docs/python/contrib.layers.md)**: - * [`apply_regularization`](../../api_docs/python/contrib.layers.md#apply_regularization) - * [`avg_pool2d`](../../api_docs/python/contrib.layers.md#avg_pool2d) - * [`batch_norm`](../../api_docs/python/contrib.layers.md#batch_norm) - * [`bucketized_column`](../../api_docs/python/contrib.layers.md#bucketized_column) - * [`check_feature_columns`](../../api_docs/python/contrib.layers.md#check_feature_columns) - * [`conv2d_in_plane`](../../api_docs/python/contrib.layers.md#conv2d_in_plane) - * [`conv2d_transpose`](../../api_docs/python/contrib.layers.md#conv2d_transpose) - * [`convolution2d`](../../api_docs/python/contrib.layers.md#convolution2d) - * [`convolution2d_in_plane`](../../api_docs/python/contrib.layers.md#convolution2d_in_plane) - * [`convolution2d_transpose`](../../api_docs/python/contrib.layers.md#convolution2d_transpose) - * [`create_feature_spec_for_parsing`](../../api_docs/python/contrib.layers.md#create_feature_spec_for_parsing) - * [`crossed_column`](../../api_docs/python/contrib.layers.md#crossed_column) - * [`dropout`](../../api_docs/python/contrib.layers.md#dropout) - * [`embed_sequence`](../../api_docs/python/contrib.layers.md#embed_sequence) - * [`embedding_column`](../../api_docs/python/contrib.layers.md#embedding_column) - * [`flatten`](../../api_docs/python/contrib.layers.md#flatten) - * [`fully_connected`](../../api_docs/python/contrib.layers.md#fully_connected) - * [`infer_real_valued_columns`](../../api_docs/python/contrib.layers.md#infer_real_valued_columns) - * [`input_from_feature_columns`](../../api_docs/python/contrib.layers.md#input_from_feature_columns) - * [`joint_weighted_sum_from_feature_columns`](../../api_docs/python/contrib.layers.md#joint_weighted_sum_from_feature_columns) - * [`l1_regularizer`](../../api_docs/python/contrib.layers.md#l1_regularizer) - * [`l2_regularizer`](../../api_docs/python/contrib.layers.md#l2_regularizer) - * [`layer_norm`](../../api_docs/python/contrib.layers.md#layer_norm) - * [`legacy_fully_connected`](../../api_docs/python/contrib.layers.md#legacy_fully_connected) - * [`legacy_linear`](../../api_docs/python/contrib.layers.md#legacy_linear) - * [`legacy_relu`](../../api_docs/python/contrib.layers.md#legacy_relu) - * [`linear`](../../api_docs/python/contrib.layers.md#linear) - * [`make_place_holder_tensors_for_base_features`](../../api_docs/python/contrib.layers.md#make_place_holder_tensors_for_base_features) - * [`max_pool2d`](../../api_docs/python/contrib.layers.md#max_pool2d) - * [`multi_class_target`](../../api_docs/python/contrib.layers.md#multi_class_target) - * [`one_hot_column`](../../api_docs/python/contrib.layers.md#one_hot_column) - * [`one_hot_encoding`](../../api_docs/python/contrib.layers.md#one_hot_encoding) - * [`optimize_loss`](../../api_docs/python/contrib.layers.md#optimize_loss) - * [`parse_feature_columns_from_examples`](../../api_docs/python/contrib.layers.md#parse_feature_columns_from_examples) - * [`parse_feature_columns_from_sequence_examples`](../../api_docs/python/contrib.layers.md#parse_feature_columns_from_sequence_examples) - * [`real_valued_column`](../../api_docs/python/contrib.layers.md#real_valued_column) - * [`regression_target`](../../api_docs/python/contrib.layers.md#regression_target) - * [`relu`](../../api_docs/python/contrib.layers.md#relu) - * [`relu6`](../../api_docs/python/contrib.layers.md#relu6) - * [`repeat`](../../api_docs/python/contrib.layers.md#repeat) - * [`safe_embedding_lookup_sparse`](../../api_docs/python/contrib.layers.md#safe_embedding_lookup_sparse) - * [`scattered_embedding_column`](../../api_docs/python/contrib.layers.md#scattered_embedding_column) - * [`separable_conv2d`](../../api_docs/python/contrib.layers.md#separable_conv2d) - * [`separable_convolution2d`](../../api_docs/python/contrib.layers.md#separable_convolution2d) - * [`sequence_input_from_feature_columns`](../../api_docs/python/contrib.layers.md#sequence_input_from_feature_columns) - * [`shared_embedding_columns`](../../api_docs/python/contrib.layers.md#shared_embedding_columns) - * [`softmax`](../../api_docs/python/contrib.layers.md#softmax) - * [`sparse_column_with_hash_bucket`](../../api_docs/python/contrib.layers.md#sparse_column_with_hash_bucket) - * [`sparse_column_with_integerized_feature`](../../api_docs/python/contrib.layers.md#sparse_column_with_integerized_feature) - * [`sparse_column_with_keys`](../../api_docs/python/contrib.layers.md#sparse_column_with_keys) - * [`stack`](../../api_docs/python/contrib.layers.md#stack) - * [`sum_regularizer`](../../api_docs/python/contrib.layers.md#sum_regularizer) - * [`summarize_activation`](../../api_docs/python/contrib.layers.md#summarize_activation) - * [`summarize_activations`](../../api_docs/python/contrib.layers.md#summarize_activations) - * [`summarize_collection`](../../api_docs/python/contrib.layers.md#summarize_collection) - * [`summarize_tensor`](../../api_docs/python/contrib.layers.md#summarize_tensor) - * [`summarize_tensors`](../../api_docs/python/contrib.layers.md#summarize_tensors) - * [`unit_norm`](../../api_docs/python/contrib.layers.md#unit_norm) - * [`variance_scaling_initializer`](../../api_docs/python/contrib.layers.md#variance_scaling_initializer) - * [`weighted_sparse_column`](../../api_docs/python/contrib.layers.md#weighted_sparse_column) - * [`weighted_sum_from_feature_columns`](../../api_docs/python/contrib.layers.md#weighted_sum_from_feature_columns) - * [`xavier_initializer`](../../api_docs/python/contrib.layers.md#xavier_initializer) - * [`xavier_initializer_conv2d`](../../api_docs/python/contrib.layers.md#xavier_initializer_conv2d) - -* **[Learn (contrib)](../../api_docs/python/contrib.learn.md)**: - * [`BaseEstimator`](../../api_docs/python/contrib.learn.md#BaseEstimator) - * [`build_parsing_serving_input_fn`](../../api_docs/python/contrib.learn.md#build_parsing_serving_input_fn) - * [`DNNClassifier`](../../api_docs/python/contrib.learn.md#DNNClassifier) - * [`DNNLinearCombinedClassifier`](../../api_docs/python/contrib.learn.md#DNNLinearCombinedClassifier) - * [`DNNLinearCombinedRegressor`](../../api_docs/python/contrib.learn.md#DNNLinearCombinedRegressor) - * [`DNNRegressor`](../../api_docs/python/contrib.learn.md#DNNRegressor) - * [`Estimator`](../../api_docs/python/contrib.learn.md#Estimator) - * [`Evaluable`](../../api_docs/python/contrib.learn.md#Evaluable) - * [`evaluate`](../../api_docs/python/contrib.learn.md#evaluate) - * [`Experiment`](../../api_docs/python/contrib.learn.md#Experiment) - * [`ExportStrategy`](../../api_docs/python/contrib.learn.md#ExportStrategy) - * [`extract_dask_data`](../../api_docs/python/contrib.learn.md#extract_dask_data) - * [`extract_dask_labels`](../../api_docs/python/contrib.learn.md#extract_dask_labels) - * [`extract_pandas_data`](../../api_docs/python/contrib.learn.md#extract_pandas_data) - * [`extract_pandas_labels`](../../api_docs/python/contrib.learn.md#extract_pandas_labels) - * [`extract_pandas_matrix`](../../api_docs/python/contrib.learn.md#extract_pandas_matrix) - * [`infer`](../../api_docs/python/contrib.learn.md#infer) - * [`infer_real_valued_columns_from_input`](../../api_docs/python/contrib.learn.md#infer_real_valued_columns_from_input) - * [`infer_real_valued_columns_from_input_fn`](../../api_docs/python/contrib.learn.md#infer_real_valued_columns_from_input_fn) - * [`InputFnOps`](../../api_docs/python/contrib.learn.md#InputFnOps) - * [`KMeansClustering`](../../api_docs/python/contrib.learn.md#KMeansClustering) - * [`LinearClassifier`](../../api_docs/python/contrib.learn.md#LinearClassifier) - * [`LinearRegressor`](../../api_docs/python/contrib.learn.md#LinearRegressor) - * [`LogisticRegressor`](../../api_docs/python/contrib.learn.md#LogisticRegressor) - * [`make_export_strategy`](../../api_docs/python/contrib.learn.md#make_export_strategy) - * [`MetricSpec`](../../api_docs/python/contrib.learn.md#MetricSpec) - * [`ModeKeys`](../../api_docs/python/contrib.learn.md#ModeKeys) - * [`ModelFnOps`](../../api_docs/python/contrib.learn.md#ModelFnOps) - * [`NanLossDuringTrainingError`](../../api_docs/python/contrib.learn.md#NanLossDuringTrainingError) - * [`NotFittedError`](../../api_docs/python/contrib.learn.md#NotFittedError) - * [`PredictionKey`](../../api_docs/python/contrib.learn.md#PredictionKey) - * [`ProblemType`](../../api_docs/python/contrib.learn.md#ProblemType) - * [`read_batch_examples`](../../api_docs/python/contrib.learn.md#read_batch_examples) - * [`read_batch_features`](../../api_docs/python/contrib.learn.md#read_batch_features) - * [`read_batch_record_features`](../../api_docs/python/contrib.learn.md#read_batch_record_features) - * [`run_feeds`](../../api_docs/python/contrib.learn.md#run_feeds) - * [`run_n`](../../api_docs/python/contrib.learn.md#run_n) - * [`RunConfig`](../../api_docs/python/contrib.learn.md#RunConfig) - * [`TaskType`](../../api_docs/python/contrib.learn.md#TaskType) - * [`train`](../../api_docs/python/contrib.learn.md#train) - * [`Trainable`](../../api_docs/python/contrib.learn.md#Trainable) - -* **[Monitors (contrib)](../../api_docs/python/contrib.learn.monitors.md)**: - * [`BaseMonitor`](../../api_docs/python/contrib.learn.monitors.md#BaseMonitor) - * [`CaptureVariable`](../../api_docs/python/contrib.learn.monitors.md#CaptureVariable) - * [`CheckpointSaver`](../../api_docs/python/contrib.learn.monitors.md#CheckpointSaver) - * [`EveryN`](../../api_docs/python/contrib.learn.monitors.md#EveryN) - * [`ExportMonitor`](../../api_docs/python/contrib.learn.monitors.md#ExportMonitor) - * [`get_default_monitors`](../../api_docs/python/contrib.learn.monitors.md#get_default_monitors) - * [`GraphDump`](../../api_docs/python/contrib.learn.monitors.md#GraphDump) - * [`LoggingTrainable`](../../api_docs/python/contrib.learn.monitors.md#LoggingTrainable) - * [`NanLoss`](../../api_docs/python/contrib.learn.monitors.md#NanLoss) - * [`PrintTensor`](../../api_docs/python/contrib.learn.monitors.md#PrintTensor) - * [`replace_monitors_with_hooks`](../../api_docs/python/contrib.learn.monitors.md#replace_monitors_with_hooks) - * [`RunHookAdapterForMonitors`](../../api_docs/python/contrib.learn.monitors.md#RunHookAdapterForMonitors) - * [`StepCounter`](../../api_docs/python/contrib.learn.monitors.md#StepCounter) - * [`StopAtStep`](../../api_docs/python/contrib.learn.monitors.md#StopAtStep) - * [`SummarySaver`](../../api_docs/python/contrib.learn.monitors.md#SummarySaver) - * [`SummaryWriterCache`](../../api_docs/python/contrib.learn.monitors.md#SummaryWriterCache) - * [`ValidationMonitor`](../../api_docs/python/contrib.learn.monitors.md#ValidationMonitor) - -* **[Sequence to Sequence (contrib)](../../api_docs/python/contrib.legacy_seq2seq.md)**: - * [`attention_decoder`](../../api_docs/python/contrib.legacy_seq2seq.md#attention_decoder) - * [`basic_rnn_seq2seq`](../../api_docs/python/contrib.legacy_seq2seq.md#basic_rnn_seq2seq) - * [`embedding_attention_decoder`](../../api_docs/python/contrib.legacy_seq2seq.md#embedding_attention_decoder) - * [`embedding_attention_seq2seq`](../../api_docs/python/contrib.legacy_seq2seq.md#embedding_attention_seq2seq) - * [`embedding_rnn_decoder`](../../api_docs/python/contrib.legacy_seq2seq.md#embedding_rnn_decoder) - * [`embedding_rnn_seq2seq`](../../api_docs/python/contrib.legacy_seq2seq.md#embedding_rnn_seq2seq) - * [`embedding_tied_rnn_seq2seq`](../../api_docs/python/contrib.legacy_seq2seq.md#embedding_tied_rnn_seq2seq) - * [`model_with_buckets`](../../api_docs/python/contrib.legacy_seq2seq.md#model_with_buckets) - * [`one2many_rnn_seq2seq`](../../api_docs/python/contrib.legacy_seq2seq.md#one2many_rnn_seq2seq) - * [`rnn_decoder`](../../api_docs/python/contrib.legacy_seq2seq.md#rnn_decoder) - * [`sequence_loss`](../../api_docs/python/contrib.legacy_seq2seq.md#sequence_loss) - * [`sequence_loss_by_example`](../../api_docs/python/contrib.legacy_seq2seq.md#sequence_loss_by_example) - * [`tied_rnn_seq2seq`](../../api_docs/python/contrib.legacy_seq2seq.md#tied_rnn_seq2seq) - -* **[Linear Algebra (contrib)](../../api_docs/python/contrib.linalg.md)**: - * [`LinearOperator`](../../api_docs/python/contrib.linalg.md#LinearOperator) - * [`LinearOperatorComposition`](../../api_docs/python/contrib.linalg.md#LinearOperatorComposition) - * [`LinearOperatorDiag`](../../api_docs/python/contrib.linalg.md#LinearOperatorDiag) - * [`LinearOperatorIdentity`](../../api_docs/python/contrib.linalg.md#LinearOperatorIdentity) - * [`LinearOperatorMatrix`](../../api_docs/python/contrib.linalg.md#LinearOperatorMatrix) - * [`LinearOperatorScaledIdentity`](../../api_docs/python/contrib.linalg.md#LinearOperatorScaledIdentity) - * [`LinearOperatorTriL`](../../api_docs/python/contrib.linalg.md#LinearOperatorTriL) - * [`LinearOperatorUDVHUpdate`](../../api_docs/python/contrib.linalg.md#LinearOperatorUDVHUpdate) - -* **[Losses (contrib)](../../api_docs/python/contrib.losses.md)**: - * [`absolute_difference`](../../api_docs/python/contrib.losses.md#absolute_difference) - * [`add_loss`](../../api_docs/python/contrib.losses.md#add_loss) - * [`compute_weighted_loss`](../../api_docs/python/contrib.losses.md#compute_weighted_loss) - * [`cosine_distance`](../../api_docs/python/contrib.losses.md#cosine_distance) - * [`get_losses`](../../api_docs/python/contrib.losses.md#get_losses) - * [`get_regularization_losses`](../../api_docs/python/contrib.losses.md#get_regularization_losses) - * [`get_total_loss`](../../api_docs/python/contrib.losses.md#get_total_loss) - * [`hinge_loss`](../../api_docs/python/contrib.losses.md#hinge_loss) - * [`log_loss`](../../api_docs/python/contrib.losses.md#log_loss) - * [`mean_pairwise_squared_error`](../../api_docs/python/contrib.losses.md#mean_pairwise_squared_error) - * [`mean_squared_error`](../../api_docs/python/contrib.losses.md#mean_squared_error) - * [`sigmoid_cross_entropy`](../../api_docs/python/contrib.losses.md#sigmoid_cross_entropy) - * [`softmax_cross_entropy`](../../api_docs/python/contrib.losses.md#softmax_cross_entropy) - * [`sparse_softmax_cross_entropy`](../../api_docs/python/contrib.losses.md#sparse_softmax_cross_entropy) - -* **[Optimization (contrib)](../../api_docs/python/contrib.opt.md)**: - * [`ExternalOptimizerInterface`](../../api_docs/python/contrib.opt.md#ExternalOptimizerInterface) - * [`MovingAverageOptimizer`](../../api_docs/python/contrib.opt.md#MovingAverageOptimizer) - * [`ScipyOptimizerInterface`](../../api_docs/python/contrib.opt.md#ScipyOptimizerInterface) - * [`VariableClippingOptimizer`](../../api_docs/python/contrib.opt.md#VariableClippingOptimizer) - -* **[RNN and Cells (contrib)](../../api_docs/python/contrib.rnn.md)**: - * [`AttentionCellWrapper`](../../api_docs/python/contrib.rnn.md#AttentionCellWrapper) - * [`BasicLSTMCell`](../../api_docs/python/contrib.rnn.md#BasicLSTMCell) - * [`BasicRNNCell`](../../api_docs/python/contrib.rnn.md#BasicRNNCell) - * [`CompiledWrapper`](../../api_docs/python/contrib.rnn.md#CompiledWrapper) - * [`CoupledInputForgetGateLSTMCell`](../../api_docs/python/contrib.rnn.md#CoupledInputForgetGateLSTMCell) - * [`DeviceWrapper`](../../api_docs/python/contrib.rnn.md#DeviceWrapper) - * [`DropoutWrapper`](../../api_docs/python/contrib.rnn.md#DropoutWrapper) - * [`EmbeddingWrapper`](../../api_docs/python/contrib.rnn.md#EmbeddingWrapper) - * [`FusedRNNCell`](../../api_docs/python/contrib.rnn.md#FusedRNNCell) - * [`FusedRNNCellAdaptor`](../../api_docs/python/contrib.rnn.md#FusedRNNCellAdaptor) - * [`GridLSTMCell`](../../api_docs/python/contrib.rnn.md#GridLSTMCell) - * [`GRUBlockCell`](../../api_docs/python/contrib.rnn.md#GRUBlockCell) - * [`GRUCell`](../../api_docs/python/contrib.rnn.md#GRUCell) - * [`InputProjectionWrapper`](../../api_docs/python/contrib.rnn.md#InputProjectionWrapper) - * [`LayerNormBasicLSTMCell`](../../api_docs/python/contrib.rnn.md#LayerNormBasicLSTMCell) - * [`LSTMBlockCell`](../../api_docs/python/contrib.rnn.md#LSTMBlockCell) - * [`LSTMBlockFusedCell`](../../api_docs/python/contrib.rnn.md#LSTMBlockFusedCell) - * [`LSTMBlockWrapper`](../../api_docs/python/contrib.rnn.md#LSTMBlockWrapper) - * [`LSTMCell`](../../api_docs/python/contrib.rnn.md#LSTMCell) - * [`LSTMStateTuple`](../../api_docs/python/contrib.rnn.md#LSTMStateTuple) - * [`MultiRNNCell`](../../api_docs/python/contrib.rnn.md#MultiRNNCell) - * [`OutputProjectionWrapper`](../../api_docs/python/contrib.rnn.md#OutputProjectionWrapper) - * [`ResidualWrapper`](../../api_docs/python/contrib.rnn.md#ResidualWrapper) - * [`RNNCell`](../../api_docs/python/contrib.rnn.md#RNNCell) - * [`stack_bidirectional_dynamic_rnn`](../../api_docs/python/contrib.rnn.md#stack_bidirectional_dynamic_rnn) - * [`static_bidirectional_rnn`](../../api_docs/python/contrib.rnn.md#static_bidirectional_rnn) - * [`static_rnn`](../../api_docs/python/contrib.rnn.md#static_rnn) - * [`static_state_saving_rnn`](../../api_docs/python/contrib.rnn.md#static_state_saving_rnn) - * [`TimeFreqLSTMCell`](../../api_docs/python/contrib.rnn.md#TimeFreqLSTMCell) - * [`TimeReversedFusedRNN`](../../api_docs/python/contrib.rnn.md#TimeReversedFusedRNN) - -* **[Metrics (contrib)](../../api_docs/python/contrib.metrics.md)**: - * [`accuracy`](../../api_docs/python/contrib.metrics.md#accuracy) - * [`aggregate_metric_map`](../../api_docs/python/contrib.metrics.md#aggregate_metric_map) - * [`aggregate_metrics`](../../api_docs/python/contrib.metrics.md#aggregate_metrics) - * [`auc_using_histogram`](../../api_docs/python/contrib.metrics.md#auc_using_histogram) - * [`confusion_matrix`](../../api_docs/python/contrib.metrics.md#confusion_matrix) - * [`set_difference`](../../api_docs/python/contrib.metrics.md#set_difference) - * [`set_intersection`](../../api_docs/python/contrib.metrics.md#set_intersection) - * [`set_size`](../../api_docs/python/contrib.metrics.md#set_size) - * [`set_union`](../../api_docs/python/contrib.metrics.md#set_union) - * [`streaming_accuracy`](../../api_docs/python/contrib.metrics.md#streaming_accuracy) - * [`streaming_auc`](../../api_docs/python/contrib.metrics.md#streaming_auc) - * [`streaming_concat`](../../api_docs/python/contrib.metrics.md#streaming_concat) - * [`streaming_covariance`](../../api_docs/python/contrib.metrics.md#streaming_covariance) - * [`streaming_false_negatives`](../../api_docs/python/contrib.metrics.md#streaming_false_negatives) - * [`streaming_false_negatives_at_thresholds`](../../api_docs/python/contrib.metrics.md#streaming_false_negatives_at_thresholds) - * [`streaming_false_positives`](../../api_docs/python/contrib.metrics.md#streaming_false_positives) - * [`streaming_false_positives_at_thresholds`](../../api_docs/python/contrib.metrics.md#streaming_false_positives_at_thresholds) - * [`streaming_mean`](../../api_docs/python/contrib.metrics.md#streaming_mean) - * [`streaming_mean_absolute_error`](../../api_docs/python/contrib.metrics.md#streaming_mean_absolute_error) - * [`streaming_mean_cosine_distance`](../../api_docs/python/contrib.metrics.md#streaming_mean_cosine_distance) - * [`streaming_mean_iou`](../../api_docs/python/contrib.metrics.md#streaming_mean_iou) - * [`streaming_mean_relative_error`](../../api_docs/python/contrib.metrics.md#streaming_mean_relative_error) - * [`streaming_mean_squared_error`](../../api_docs/python/contrib.metrics.md#streaming_mean_squared_error) - * [`streaming_mean_tensor`](../../api_docs/python/contrib.metrics.md#streaming_mean_tensor) - * [`streaming_pearson_correlation`](../../api_docs/python/contrib.metrics.md#streaming_pearson_correlation) - * [`streaming_percentage_less`](../../api_docs/python/contrib.metrics.md#streaming_percentage_less) - * [`streaming_precision`](../../api_docs/python/contrib.metrics.md#streaming_precision) - * [`streaming_precision_at_thresholds`](../../api_docs/python/contrib.metrics.md#streaming_precision_at_thresholds) - * [`streaming_recall`](../../api_docs/python/contrib.metrics.md#streaming_recall) - * [`streaming_recall_at_k`](../../api_docs/python/contrib.metrics.md#streaming_recall_at_k) - * [`streaming_recall_at_thresholds`](../../api_docs/python/contrib.metrics.md#streaming_recall_at_thresholds) - * [`streaming_root_mean_squared_error`](../../api_docs/python/contrib.metrics.md#streaming_root_mean_squared_error) - * [`streaming_sensitivity_at_specificity`](../../api_docs/python/contrib.metrics.md#streaming_sensitivity_at_specificity) - * [`streaming_sparse_average_precision_at_k`](../../api_docs/python/contrib.metrics.md#streaming_sparse_average_precision_at_k) - * [`streaming_sparse_precision_at_k`](../../api_docs/python/contrib.metrics.md#streaming_sparse_precision_at_k) - * [`streaming_sparse_precision_at_top_k`](../../api_docs/python/contrib.metrics.md#streaming_sparse_precision_at_top_k) - * [`streaming_sparse_recall_at_k`](../../api_docs/python/contrib.metrics.md#streaming_sparse_recall_at_k) - * [`streaming_specificity_at_sensitivity`](../../api_docs/python/contrib.metrics.md#streaming_specificity_at_sensitivity) - * [`streaming_true_negatives`](../../api_docs/python/contrib.metrics.md#streaming_true_negatives) - * [`streaming_true_negatives_at_thresholds`](../../api_docs/python/contrib.metrics.md#streaming_true_negatives_at_thresholds) - * [`streaming_true_positives`](../../api_docs/python/contrib.metrics.md#streaming_true_positives) - * [`streaming_true_positives_at_thresholds`](../../api_docs/python/contrib.metrics.md#streaming_true_positives_at_thresholds) - -* **[Training (contrib)](../../api_docs/python/contrib.training.md)**: - * [`batch_sequences_with_states`](../../api_docs/python/contrib.training.md#batch_sequences_with_states) - * [`bucket`](../../api_docs/python/contrib.training.md#bucket) - * [`bucket_by_sequence_length`](../../api_docs/python/contrib.training.md#bucket_by_sequence_length) - * [`NextQueuedSequenceBatch`](../../api_docs/python/contrib.training.md#NextQueuedSequenceBatch) - * [`rejection_sample`](../../api_docs/python/contrib.training.md#rejection_sample) - * [`resample_at_rate`](../../api_docs/python/contrib.training.md#resample_at_rate) - * [`SequenceQueueingStateSaver`](../../api_docs/python/contrib.training.md#SequenceQueueingStateSaver) - * [`stratified_sample`](../../api_docs/python/contrib.training.md#stratified_sample) - * [`weighted_resample`](../../api_docs/python/contrib.training.md#weighted_resample) - -* **[Utilities (contrib)](../../api_docs/python/contrib.util.md)**: - * [`constant_value`](../../api_docs/python/contrib.util.md#constant_value) - * [`make_ndarray`](../../api_docs/python/contrib.util.md#make_ndarray) - * [`make_tensor_proto`](../../api_docs/python/contrib.util.md#make_tensor_proto) - * [`ops_used_by_graph_def`](../../api_docs/python/contrib.util.md#ops_used_by_graph_def) - * [`stripped_op_list_for_graph`](../../api_docs/python/contrib.util.md#stripped_op_list_for_graph) - -* **[Copying Graph Elements (contrib)](../../api_docs/python/contrib.copy_graph.md)**: - * [`copy_op_to_graph`](../../api_docs/python/contrib.copy_graph.md#copy_op_to_graph) - * [`copy_variable_to_graph`](../../api_docs/python/contrib.copy_graph.md#copy_variable_to_graph) - * [`get_copied_op`](../../api_docs/python/contrib.copy_graph.md#get_copied_op) - -* **[TensorFlow Debugger](../../api_docs/python/tf_debug.md)**: - * [`add_debug_tensor_watch`](../../api_docs/python/tf_debug.md#add_debug_tensor_watch) - * [`DebugDumpDir`](../../api_docs/python/tf_debug.md#DebugDumpDir) - * [`DebugTensorDatum`](../../api_docs/python/tf_debug.md#DebugTensorDatum) - * [`DumpingDebugHook`](../../api_docs/python/tf_debug.md#DumpingDebugHook) - * [`DumpingDebugWrapperSession`](../../api_docs/python/tf_debug.md#DumpingDebugWrapperSession) - * [`has_inf_or_nan`](../../api_docs/python/tf_debug.md#has_inf_or_nan) - * [`load_tensor_from_event_file`](../../api_docs/python/tf_debug.md#load_tensor_from_event_file) - * [`LocalCLIDebugHook`](../../api_docs/python/tf_debug.md#LocalCLIDebugHook) - * [`LocalCLIDebugWrapperSession`](../../api_docs/python/tf_debug.md#LocalCLIDebugWrapperSession) - * [`watch_graph`](../../api_docs/python/tf_debug.md#watch_graph) - * [`watch_graph_with_blacklists`](../../api_docs/python/tf_debug.md#watch_graph_with_blacklists) - diff --git a/tensorflow/g3doc/api_docs/python/io_ops.md b/tensorflow/g3doc/api_docs/python/io_ops.md deleted file mode 100644 index db2abc44b3..0000000000 --- a/tensorflow/g3doc/api_docs/python/io_ops.md +++ /dev/null @@ -1,4575 +0,0 @@ - - -# Inputs and Readers - -Note: Functions taking `Tensor` arguments can also take anything accepted by -[`tf.convert_to_tensor`](framework.md#convert_to_tensor). - -[TOC] - -Inputs and Readers. See the @{$python/io_ops} guide. - -- - - - -### `tf.placeholder(dtype, shape=None, name=None)` {#placeholder} - -Inserts a placeholder for a tensor that will be always fed. - -**Important**: This tensor will produce an error if evaluated. Its value must -be fed using the `feed_dict` optional argument to `Session.run()`, -`Tensor.eval()`, or `Operation.run()`. - -For example: - -```python -x = tf.placeholder(tf.float32, shape=(1024, 1024)) -y = tf.matmul(x, x) - -with tf.Session() as sess: - print(sess.run(y)) # ERROR: will fail because x was not fed. - - rand_array = np.random.rand(1024, 1024) - print(sess.run(y, feed_dict={x: rand_array})) # Will succeed. -``` - -##### Args: - - -* `dtype`: The type of elements in the tensor to be fed. -* `shape`: The shape of the tensor to be fed (optional). If the shape is not - specified, you can feed a tensor of any shape. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` that may be used as a handle for feeding a value, but not - evaluated directly. - - -- - - - -### `tf.placeholder_with_default(input, shape, name=None)` {#placeholder_with_default} - -A placeholder op that passes through `input` when its output is not fed. - -##### Args: - - -* `input`: A `Tensor`. The default value to produce when `output` is not fed. -* `shape`: A `tf.TensorShape` or list of `ints`. - The (possibly partial) shape of the tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - A placeholder tensor that defaults to `input` if it is not fed. - - -- - - - -### `tf.sparse_placeholder(dtype, shape=None, name=None)` {#sparse_placeholder} - -Inserts a placeholder for a sparse tensor that will be always fed. - -**Important**: This sparse tensor will produce an error if evaluated. -Its value must be fed using the `feed_dict` optional argument to -`Session.run()`, `Tensor.eval()`, or `Operation.run()`. - -For example: - -```python -x = tf.sparse_placeholder(tf.float32) -y = tf.sparse_reduce_sum(x) - -with tf.Session() as sess: - print(sess.run(y)) # ERROR: will fail because x was not fed. - - indices = np.array([[3, 2, 0], [4, 5, 1]], dtype=np.int64) - values = np.array([1.0, 2.0], dtype=np.float32) - shape = np.array([7, 9, 2], dtype=np.int64) - print(sess.run(y, feed_dict={ - x: tf.SparseTensorValue(indices, values, shape)})) # Will succeed. - print(sess.run(y, feed_dict={ - x: (indices, values, shape)})) # Will succeed. - - sp = tf.SparseTensor(indices=indices, values=values, dense_shape=shape) - sp_value = sp.eval(session) - print(sess.run(y, feed_dict={x: sp_value})) # Will succeed. -``` - -##### Args: - - -* `dtype`: The type of `values` elements in the tensor to be fed. -* `shape`: The shape of the tensor to be fed (optional). If the shape is not - specified, you can feed a sparse tensor of any shape. -* `name`: A name for prefixing the operations (optional). - -##### Returns: - - A `SparseTensor` that may be used as a handle for feeding a value, but not - evaluated directly. - - -- - - - -### `class tf.ReaderBase` {#ReaderBase} - -Base class for different Reader types, that produce a record every step. - -Conceptually, Readers convert string 'work units' into records (key, -value pairs). Typically the 'work units' are filenames and the -records are extracted from the contents of those files. We want a -single record produced per step, but a work unit can correspond to -many records. - -Therefore we introduce some decoupling using a queue. The queue -contains the work units and the Reader dequeues from the queue when -it is asked to produce a record (via Read()) but it has finished the -last work unit. -- - - - -#### `tf.ReaderBase.__init__(reader_ref, supports_serialize=False)` {#ReaderBase.__init__} - -Creates a new ReaderBase. - -##### Args: - - -* `reader_ref`: The operation that implements the reader. -* `supports_serialize`: True if the reader implementation can - serialize its state. - - -- - - - -#### `tf.ReaderBase.num_records_produced(name=None)` {#ReaderBase.num_records_produced} - -Returns the number of records this reader has produced. - -This is the same as the number of Read executions that have -succeeded. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.ReaderBase.num_work_units_completed(name=None)` {#ReaderBase.num_work_units_completed} - -Returns the number of work units this reader has finished processing. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.ReaderBase.read(queue, name=None)` {#ReaderBase.read} - -Returns the next record (key, value pair) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g. when the -Reader needs to start reading from a new file since it has -finished with the previous file). - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (key, value). - -* `key`: A string scalar Tensor. -* `value`: A string scalar Tensor. - - -- - - - -#### `tf.ReaderBase.read_up_to(queue, num_records, name=None)` {#ReaderBase.read_up_to} - -Returns up to num_records (key, value pairs) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g., when the -Reader needs to start reading from a new file since it has -finished with the previous file). -It may return less than num_records even before the last batch. - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `num_records`: Number of records to read. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (keys, values). - -* `keys`: A 1-D string Tensor. -* `values`: A 1-D string Tensor. - - -- - - - -#### `tf.ReaderBase.reader_ref` {#ReaderBase.reader_ref} - -Op that implements the reader. - - -- - - - -#### `tf.ReaderBase.reset(name=None)` {#ReaderBase.reset} - -Restore a reader to its initial clean state. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.ReaderBase.restore_state(state, name=None)` {#ReaderBase.restore_state} - -Restore a reader to a previously saved state. - -Not all Readers support being restored, so this can produce an -Unimplemented error. - -##### Args: - - -* `state`: A string Tensor. - Result of a SerializeState of a Reader with matching type. -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.ReaderBase.serialize_state(name=None)` {#ReaderBase.serialize_state} - -Produce a string tensor that encodes the state of a reader. - -Not all Readers support being serialized, so this can produce an -Unimplemented error. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A string Tensor. - - -- - - - -#### `tf.ReaderBase.supports_serialize` {#ReaderBase.supports_serialize} - -Whether the Reader implementation can serialize its state. - - - -- - - - -### `class tf.TextLineReader` {#TextLineReader} - -A Reader that outputs the lines of a file delimited by newlines. - -Newlines are stripped from the output. -See ReaderBase for supported methods. -- - - - -#### `tf.TextLineReader.__init__(skip_header_lines=None, name=None)` {#TextLineReader.__init__} - -Create a TextLineReader. - -##### Args: - - -* `skip_header_lines`: An optional int. Defaults to 0. Number of lines - to skip from the beginning of every file. -* `name`: A name for the operation (optional). - - -- - - - -#### `tf.TextLineReader.num_records_produced(name=None)` {#TextLineReader.num_records_produced} - -Returns the number of records this reader has produced. - -This is the same as the number of Read executions that have -succeeded. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.TextLineReader.num_work_units_completed(name=None)` {#TextLineReader.num_work_units_completed} - -Returns the number of work units this reader has finished processing. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.TextLineReader.read(queue, name=None)` {#TextLineReader.read} - -Returns the next record (key, value pair) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g. when the -Reader needs to start reading from a new file since it has -finished with the previous file). - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (key, value). - -* `key`: A string scalar Tensor. -* `value`: A string scalar Tensor. - - -- - - - -#### `tf.TextLineReader.read_up_to(queue, num_records, name=None)` {#TextLineReader.read_up_to} - -Returns up to num_records (key, value pairs) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g., when the -Reader needs to start reading from a new file since it has -finished with the previous file). -It may return less than num_records even before the last batch. - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `num_records`: Number of records to read. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (keys, values). - -* `keys`: A 1-D string Tensor. -* `values`: A 1-D string Tensor. - - -- - - - -#### `tf.TextLineReader.reader_ref` {#TextLineReader.reader_ref} - -Op that implements the reader. - - -- - - - -#### `tf.TextLineReader.reset(name=None)` {#TextLineReader.reset} - -Restore a reader to its initial clean state. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.TextLineReader.restore_state(state, name=None)` {#TextLineReader.restore_state} - -Restore a reader to a previously saved state. - -Not all Readers support being restored, so this can produce an -Unimplemented error. - -##### Args: - - -* `state`: A string Tensor. - Result of a SerializeState of a Reader with matching type. -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.TextLineReader.serialize_state(name=None)` {#TextLineReader.serialize_state} - -Produce a string tensor that encodes the state of a reader. - -Not all Readers support being serialized, so this can produce an -Unimplemented error. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A string Tensor. - - -- - - - -#### `tf.TextLineReader.supports_serialize` {#TextLineReader.supports_serialize} - -Whether the Reader implementation can serialize its state. - - - -- - - - -### `class tf.WholeFileReader` {#WholeFileReader} - -A Reader that outputs the entire contents of a file as a value. - -To use, enqueue filenames in a Queue. The output of Read will -be a filename (key) and the contents of that file (value). - -See ReaderBase for supported methods. -- - - - -#### `tf.WholeFileReader.__init__(name=None)` {#WholeFileReader.__init__} - -Create a WholeFileReader. - -##### Args: - - -* `name`: A name for the operation (optional). - - -- - - - -#### `tf.WholeFileReader.num_records_produced(name=None)` {#WholeFileReader.num_records_produced} - -Returns the number of records this reader has produced. - -This is the same as the number of Read executions that have -succeeded. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.WholeFileReader.num_work_units_completed(name=None)` {#WholeFileReader.num_work_units_completed} - -Returns the number of work units this reader has finished processing. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.WholeFileReader.read(queue, name=None)` {#WholeFileReader.read} - -Returns the next record (key, value pair) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g. when the -Reader needs to start reading from a new file since it has -finished with the previous file). - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (key, value). - -* `key`: A string scalar Tensor. -* `value`: A string scalar Tensor. - - -- - - - -#### `tf.WholeFileReader.read_up_to(queue, num_records, name=None)` {#WholeFileReader.read_up_to} - -Returns up to num_records (key, value pairs) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g., when the -Reader needs to start reading from a new file since it has -finished with the previous file). -It may return less than num_records even before the last batch. - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `num_records`: Number of records to read. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (keys, values). - -* `keys`: A 1-D string Tensor. -* `values`: A 1-D string Tensor. - - -- - - - -#### `tf.WholeFileReader.reader_ref` {#WholeFileReader.reader_ref} - -Op that implements the reader. - - -- - - - -#### `tf.WholeFileReader.reset(name=None)` {#WholeFileReader.reset} - -Restore a reader to its initial clean state. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.WholeFileReader.restore_state(state, name=None)` {#WholeFileReader.restore_state} - -Restore a reader to a previously saved state. - -Not all Readers support being restored, so this can produce an -Unimplemented error. - -##### Args: - - -* `state`: A string Tensor. - Result of a SerializeState of a Reader with matching type. -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.WholeFileReader.serialize_state(name=None)` {#WholeFileReader.serialize_state} - -Produce a string tensor that encodes the state of a reader. - -Not all Readers support being serialized, so this can produce an -Unimplemented error. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A string Tensor. - - -- - - - -#### `tf.WholeFileReader.supports_serialize` {#WholeFileReader.supports_serialize} - -Whether the Reader implementation can serialize its state. - - - -- - - - -### `class tf.IdentityReader` {#IdentityReader} - -A Reader that outputs the queued work as both the key and value. - -To use, enqueue strings in a Queue. Read will take the front -work string and output (work, work). - -See ReaderBase for supported methods. -- - - - -#### `tf.IdentityReader.__init__(name=None)` {#IdentityReader.__init__} - -Create a IdentityReader. - -##### Args: - - -* `name`: A name for the operation (optional). - - -- - - - -#### `tf.IdentityReader.num_records_produced(name=None)` {#IdentityReader.num_records_produced} - -Returns the number of records this reader has produced. - -This is the same as the number of Read executions that have -succeeded. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.IdentityReader.num_work_units_completed(name=None)` {#IdentityReader.num_work_units_completed} - -Returns the number of work units this reader has finished processing. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.IdentityReader.read(queue, name=None)` {#IdentityReader.read} - -Returns the next record (key, value pair) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g. when the -Reader needs to start reading from a new file since it has -finished with the previous file). - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (key, value). - -* `key`: A string scalar Tensor. -* `value`: A string scalar Tensor. - - -- - - - -#### `tf.IdentityReader.read_up_to(queue, num_records, name=None)` {#IdentityReader.read_up_to} - -Returns up to num_records (key, value pairs) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g., when the -Reader needs to start reading from a new file since it has -finished with the previous file). -It may return less than num_records even before the last batch. - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `num_records`: Number of records to read. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (keys, values). - -* `keys`: A 1-D string Tensor. -* `values`: A 1-D string Tensor. - - -- - - - -#### `tf.IdentityReader.reader_ref` {#IdentityReader.reader_ref} - -Op that implements the reader. - - -- - - - -#### `tf.IdentityReader.reset(name=None)` {#IdentityReader.reset} - -Restore a reader to its initial clean state. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.IdentityReader.restore_state(state, name=None)` {#IdentityReader.restore_state} - -Restore a reader to a previously saved state. - -Not all Readers support being restored, so this can produce an -Unimplemented error. - -##### Args: - - -* `state`: A string Tensor. - Result of a SerializeState of a Reader with matching type. -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.IdentityReader.serialize_state(name=None)` {#IdentityReader.serialize_state} - -Produce a string tensor that encodes the state of a reader. - -Not all Readers support being serialized, so this can produce an -Unimplemented error. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A string Tensor. - - -- - - - -#### `tf.IdentityReader.supports_serialize` {#IdentityReader.supports_serialize} - -Whether the Reader implementation can serialize its state. - - - -- - - - -### `class tf.TFRecordReader` {#TFRecordReader} - -A Reader that outputs the records from a TFRecords file. - -See ReaderBase for supported methods. -- - - - -#### `tf.TFRecordReader.__init__(name=None, options=None)` {#TFRecordReader.__init__} - -Create a TFRecordReader. - -##### Args: - - -* `name`: A name for the operation (optional). -* `options`: A TFRecordOptions object (optional). - - -- - - - -#### `tf.TFRecordReader.num_records_produced(name=None)` {#TFRecordReader.num_records_produced} - -Returns the number of records this reader has produced. - -This is the same as the number of Read executions that have -succeeded. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.TFRecordReader.num_work_units_completed(name=None)` {#TFRecordReader.num_work_units_completed} - -Returns the number of work units this reader has finished processing. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.TFRecordReader.read(queue, name=None)` {#TFRecordReader.read} - -Returns the next record (key, value pair) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g. when the -Reader needs to start reading from a new file since it has -finished with the previous file). - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (key, value). - -* `key`: A string scalar Tensor. -* `value`: A string scalar Tensor. - - -- - - - -#### `tf.TFRecordReader.read_up_to(queue, num_records, name=None)` {#TFRecordReader.read_up_to} - -Returns up to num_records (key, value pairs) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g., when the -Reader needs to start reading from a new file since it has -finished with the previous file). -It may return less than num_records even before the last batch. - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `num_records`: Number of records to read. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (keys, values). - -* `keys`: A 1-D string Tensor. -* `values`: A 1-D string Tensor. - - -- - - - -#### `tf.TFRecordReader.reader_ref` {#TFRecordReader.reader_ref} - -Op that implements the reader. - - -- - - - -#### `tf.TFRecordReader.reset(name=None)` {#TFRecordReader.reset} - -Restore a reader to its initial clean state. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.TFRecordReader.restore_state(state, name=None)` {#TFRecordReader.restore_state} - -Restore a reader to a previously saved state. - -Not all Readers support being restored, so this can produce an -Unimplemented error. - -##### Args: - - -* `state`: A string Tensor. - Result of a SerializeState of a Reader with matching type. -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.TFRecordReader.serialize_state(name=None)` {#TFRecordReader.serialize_state} - -Produce a string tensor that encodes the state of a reader. - -Not all Readers support being serialized, so this can produce an -Unimplemented error. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A string Tensor. - - -- - - - -#### `tf.TFRecordReader.supports_serialize` {#TFRecordReader.supports_serialize} - -Whether the Reader implementation can serialize its state. - - - -- - - - -### `class tf.FixedLengthRecordReader` {#FixedLengthRecordReader} - -A Reader that outputs fixed-length records from a file. - -See ReaderBase for supported methods. -- - - - -#### `tf.FixedLengthRecordReader.__init__(record_bytes, header_bytes=None, footer_bytes=None, name=None)` {#FixedLengthRecordReader.__init__} - -Create a FixedLengthRecordReader. - -##### Args: - - -* `record_bytes`: An int. -* `header_bytes`: An optional int. Defaults to 0. -* `footer_bytes`: An optional int. Defaults to 0. -* `name`: A name for the operation (optional). - - -- - - - -#### `tf.FixedLengthRecordReader.num_records_produced(name=None)` {#FixedLengthRecordReader.num_records_produced} - -Returns the number of records this reader has produced. - -This is the same as the number of Read executions that have -succeeded. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.FixedLengthRecordReader.num_work_units_completed(name=None)` {#FixedLengthRecordReader.num_work_units_completed} - -Returns the number of work units this reader has finished processing. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - An int64 Tensor. - - -- - - - -#### `tf.FixedLengthRecordReader.read(queue, name=None)` {#FixedLengthRecordReader.read} - -Returns the next record (key, value pair) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g. when the -Reader needs to start reading from a new file since it has -finished with the previous file). - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (key, value). - -* `key`: A string scalar Tensor. -* `value`: A string scalar Tensor. - - -- - - - -#### `tf.FixedLengthRecordReader.read_up_to(queue, num_records, name=None)` {#FixedLengthRecordReader.read_up_to} - -Returns up to num_records (key, value pairs) produced by a reader. - -Will dequeue a work unit from queue if necessary (e.g., when the -Reader needs to start reading from a new file since it has -finished with the previous file). -It may return less than num_records even before the last batch. - -##### Args: - - -* `queue`: A Queue or a mutable string Tensor representing a handle - to a Queue, with string work items. -* `num_records`: Number of records to read. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of Tensors (keys, values). - -* `keys`: A 1-D string Tensor. -* `values`: A 1-D string Tensor. - - -- - - - -#### `tf.FixedLengthRecordReader.reader_ref` {#FixedLengthRecordReader.reader_ref} - -Op that implements the reader. - - -- - - - -#### `tf.FixedLengthRecordReader.reset(name=None)` {#FixedLengthRecordReader.reset} - -Restore a reader to its initial clean state. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.FixedLengthRecordReader.restore_state(state, name=None)` {#FixedLengthRecordReader.restore_state} - -Restore a reader to a previously saved state. - -Not all Readers support being restored, so this can produce an -Unimplemented error. - -##### Args: - - -* `state`: A string Tensor. - Result of a SerializeState of a Reader with matching type. -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -#### `tf.FixedLengthRecordReader.serialize_state(name=None)` {#FixedLengthRecordReader.serialize_state} - -Produce a string tensor that encodes the state of a reader. - -Not all Readers support being serialized, so this can produce an -Unimplemented error. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A string Tensor. - - -- - - - -#### `tf.FixedLengthRecordReader.supports_serialize` {#FixedLengthRecordReader.supports_serialize} - -Whether the Reader implementation can serialize its state. - - - -- - - - -### `tf.decode_csv(records, record_defaults, field_delim=None, name=None)` {#decode_csv} - -Convert CSV records to tensors. Each column maps to one tensor. - -RFC 4180 format is expected for the CSV records. -(https://tools.ietf.org/html/rfc4180) -Note that we allow leading and trailing spaces with int or float field. - -##### Args: - - -* `records`: A `Tensor` of type `string`. - Each string is a record/row in the csv and all records should have - the same format. -* `record_defaults`: A list of `Tensor` objects with types from: `float32`, `int32`, `int64`, `string`. - One tensor per column of the input record, with either a - scalar default value for that column or empty if the column is required. -* `field_delim`: An optional `string`. Defaults to `","`. - delimiter to separate fields in a record. -* `name`: A name for the operation (optional). - -##### Returns: - - A list of `Tensor` objects. Has the same type as `record_defaults`. - Each tensor will have the same shape as records. - - -- - - - -### `tf.decode_raw(bytes, out_type, little_endian=None, name=None)` {#decode_raw} - -Reinterpret the bytes of a string as a vector of numbers. - -##### Args: - - -* `bytes`: A `Tensor` of type `string`. - All the elements must have the same length. -* `out_type`: A `tf.DType` from: `tf.half, tf.float32, tf.float64, tf.int32, tf.uint8, tf.int16, tf.int8, tf.int64`. -* `little_endian`: An optional `bool`. Defaults to `True`. - Whether the input `bytes` are in little-endian order. - Ignored for `out_type` values that are stored in a single byte like - `uint8`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `out_type`. - A Tensor with one more dimension than the input `bytes`. The - added dimension will have size equal to the length of the elements - of `bytes` divided by the number of bytes to represent `out_type`. - - -- - - - -### `class tf.VarLenFeature` {#VarLenFeature} - -Configuration for parsing a variable-length input feature. - -Fields: - dtype: Data type of input. -- - - - -#### `tf.VarLenFeature.__getnewargs__()` {#VarLenFeature.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.VarLenFeature.__getstate__()` {#VarLenFeature.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.VarLenFeature.__new__(_cls, dtype)` {#VarLenFeature.__new__} - -Create new instance of VarLenFeature(dtype,) - - -- - - - -#### `tf.VarLenFeature.__repr__()` {#VarLenFeature.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.VarLenFeature.dtype` {#VarLenFeature.dtype} - -Alias for field number 0 - - - -- - - - -### `class tf.FixedLenFeature` {#FixedLenFeature} - -Configuration for parsing a fixed-length input feature. - -To treat sparse input as dense, provide a `default_value`; otherwise, -the parse functions will fail on any examples missing this feature. - -Fields: - shape: Shape of input data. - dtype: Data type of input. - default_value: Value to be used if an example is missing this feature. It - must be compatible with `dtype`. -- - - - -#### `tf.FixedLenFeature.__getnewargs__()` {#FixedLenFeature.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.FixedLenFeature.__getstate__()` {#FixedLenFeature.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.FixedLenFeature.__new__(_cls, shape, dtype, default_value=None)` {#FixedLenFeature.__new__} - -Create new instance of FixedLenFeature(shape, dtype, default_value) - - -- - - - -#### `tf.FixedLenFeature.__repr__()` {#FixedLenFeature.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.FixedLenFeature.default_value` {#FixedLenFeature.default_value} - -Alias for field number 2 - - -- - - - -#### `tf.FixedLenFeature.dtype` {#FixedLenFeature.dtype} - -Alias for field number 1 - - -- - - - -#### `tf.FixedLenFeature.shape` {#FixedLenFeature.shape} - -Alias for field number 0 - - - -- - - - -### `class tf.FixedLenSequenceFeature` {#FixedLenSequenceFeature} - -Configuration for a dense input feature in a sequence item. - -To treat a sparse input as dense, provide `allow_missing=True`; otherwise, -the parse functions will fail on any examples missing this feature. - -Fields: - shape: Shape of input data. - dtype: Data type of input. - allow_missing: Whether to allow this feature to be missing from a feature - list item. -- - - - -#### `tf.FixedLenSequenceFeature.__getnewargs__()` {#FixedLenSequenceFeature.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.FixedLenSequenceFeature.__getstate__()` {#FixedLenSequenceFeature.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.FixedLenSequenceFeature.__new__(_cls, shape, dtype, allow_missing=False)` {#FixedLenSequenceFeature.__new__} - -Create new instance of FixedLenSequenceFeature(shape, dtype, allow_missing) - - -- - - - -#### `tf.FixedLenSequenceFeature.__repr__()` {#FixedLenSequenceFeature.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.FixedLenSequenceFeature.allow_missing` {#FixedLenSequenceFeature.allow_missing} - -Alias for field number 2 - - -- - - - -#### `tf.FixedLenSequenceFeature.dtype` {#FixedLenSequenceFeature.dtype} - -Alias for field number 1 - - -- - - - -#### `tf.FixedLenSequenceFeature.shape` {#FixedLenSequenceFeature.shape} - -Alias for field number 0 - - - -- - - - -### `class tf.SparseFeature` {#SparseFeature} - -Configuration for parsing a sparse input feature. - -Fields: - index_key: Name of index feature. The underlying feature's type must - be `int64` and its length must always match that of the `value_key` - feature. - value_key: Name of value feature. The underlying feature's type must - be `dtype` and its length must always match that of the `index_key` - feature. - dtype: Data type of the `value_key` feature. - size: A Python int to specify a dimension of the dense shape. Each value in - the `index_key` feature must be in `[0, size)`. - already_sorted: A Python boolean to specify whether the values in - `index_key` are already sorted. If so skip sorting. - False by default (optional). -- - - - -#### `tf.SparseFeature.__getnewargs__()` {#SparseFeature.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.SparseFeature.__getstate__()` {#SparseFeature.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.SparseFeature.__new__(_cls, index_key, value_key, dtype, size, already_sorted=False)` {#SparseFeature.__new__} - -Create new instance of SparseFeature(index_key, value_key, dtype, size, already_sorted) - - -- - - - -#### `tf.SparseFeature.__repr__()` {#SparseFeature.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.SparseFeature.already_sorted` {#SparseFeature.already_sorted} - -Alias for field number 4 - - -- - - - -#### `tf.SparseFeature.dtype` {#SparseFeature.dtype} - -Alias for field number 2 - - -- - - - -#### `tf.SparseFeature.index_key` {#SparseFeature.index_key} - -Alias for field number 0 - - -- - - - -#### `tf.SparseFeature.size` {#SparseFeature.size} - -Alias for field number 3 - - -- - - - -#### `tf.SparseFeature.value_key` {#SparseFeature.value_key} - -Alias for field number 1 - - - -- - - - -### `tf.parse_example(serialized, features, name=None, example_names=None)` {#parse_example} - -Parses `Example` protos into a `dict` of tensors. - -Parses a number of serialized [`Example`](https://www.tensorflow.org/code/tensorflow/core/example/example.proto) -protos given in `serialized`. - -`example_names` may contain descriptive names for the corresponding serialized -protos. These may be useful for debugging purposes, but they have no effect on -the output. If not `None`, `example_names` must be the same length as -`serialized`. - -This op parses serialized examples into a dictionary mapping keys to `Tensor` -and `SparseTensor` objects. `features` is a dict from keys to `VarLenFeature`, -`SparseFeature`, and `FixedLenFeature` objects. Each `VarLenFeature` -and `SparseFeature` is mapped to a `SparseTensor`, and each -`FixedLenFeature` is mapped to a `Tensor`. - -Each `VarLenFeature` maps to a `SparseTensor` of the specified type -representing a ragged matrix. Its indices are `[batch, index]` where `batch` -is the batch entry the value is from in `serialized`, and `index` is the -value's index in the list of values associated with that feature and example. - -Each `SparseFeature` maps to a `SparseTensor` of the specified type -representing a sparse matrix of shape -`(serialized.size(), SparseFeature.size)`. Its indices are `[batch, index]` -where `batch` is the batch entry the value is from in `serialized`, and -`index` is the value's index is given by the values in the -`SparseFeature.index_key` feature column. - -Each `FixedLenFeature` `df` maps to a `Tensor` of the specified type (or -`tf.float32` if not specified) and shape `(serialized.size(),) + df.shape`. - -`FixedLenFeature` entries with a `default_value` are optional. With no default -value, we will fail if that `Feature` is missing from any example in -`serialized`. - -Examples: - -For example, if one expects a `tf.float32` sparse feature `ft` and three -serialized `Example`s are provided: - -``` -serialized = [ - features - { feature { key: "ft" value { float_list { value: [1.0, 2.0] } } } }, - features - { feature []}, - features - { feature { key: "ft" value { float_list { value: [3.0] } } } -] -``` - -then the output will look like: - -``` -{"ft": SparseTensor(indices=[[0, 0], [0, 1], [2, 0]], - values=[1.0, 2.0, 3.0], - dense_shape=(3, 2)) } -``` - -Given two `Example` input protos in `serialized`: - -``` -[ - features { - feature { key: "kw" value { bytes_list { value: [ "knit", "big" ] } } } - feature { key: "gps" value { float_list { value: [] } } } - }, - features { - feature { key: "kw" value { bytes_list { value: [ "emmy" ] } } } - feature { key: "dank" value { int64_list { value: [ 42 ] } } } - feature { key: "gps" value { } } - } -] -``` - -And arguments - -``` -example_names: ["input0", "input1"], -features: { - "kw": VarLenFeature(tf.string), - "dank": VarLenFeature(tf.int64), - "gps": VarLenFeature(tf.float32), -} -``` - -Then the output is a dictionary: - -```python -{ - "kw": SparseTensor( - indices=[[0, 0], [0, 1], [1, 0]], - values=["knit", "big", "emmy"] - dense_shape=[2, 2]), - "dank": SparseTensor( - indices=[[1, 0]], - values=[42], - dense_shape=[2, 1]), - "gps": SparseTensor( - indices=[], - values=[], - dense_shape=[2, 0]), -} -``` - -For dense results in two serialized `Example`s: - -``` -[ - features { - feature { key: "age" value { int64_list { value: [ 0 ] } } } - feature { key: "gender" value { bytes_list { value: [ "f" ] } } } - }, - features { - feature { key: "age" value { int64_list { value: [] } } } - feature { key: "gender" value { bytes_list { value: [ "f" ] } } } - } -] -``` - -We can use arguments: - -``` -example_names: ["input0", "input1"], -features: { - "age": FixedLenFeature([], dtype=tf.int64, default_value=-1), - "gender": FixedLenFeature([], dtype=tf.string), -} -``` - -And the expected output is: - -```python -{ - "age": [[0], [-1]], - "gender": [["f"], ["f"]], -} -``` - -Given two `Example` input protos in `serialized`: - -``` -[ - features { - feature { key: "val" value { float_list { value: [ 0.5, -1.0 ] } } } - feature { key: "ix" value { int64_list { value: [ 3, 20 ] } } } - }, - features { - feature { key: "val" value { float_list { value: [ 0.0 ] } } } - feature { key: "ix" value { int64_list { value: [ 42 ] } } } - } -] -``` - -And arguments - -``` -example_names: ["input0", "input1"], -features: { - "sparse": SparseFeature( - index_key="ix", value_key="val", dtype=tf.float32, size=100), -} -``` - -Then the output is a dictionary: - -```python -{ - "sparse": SparseTensor( - indices=[[0, 3], [0, 20], [1, 42]], - values=[0.5, -1.0, 0.0] - dense_shape=[2, 100]), -} -``` - -##### Args: - - -* `serialized`: A vector (1-D Tensor) of strings, a batch of binary - serialized `Example` protos. -* `features`: A `dict` mapping feature keys to `FixedLenFeature`, - `VarLenFeature`, and `SparseFeature` values. -* `name`: A name for this operation (optional). -* `example_names`: A vector (1-D Tensor) of strings (optional), the names of - the serialized protos in the batch. - -##### Returns: - - A `dict` mapping feature keys to `Tensor` and `SparseTensor` values. - -##### Raises: - - -* `ValueError`: if any feature is invalid. - - -- - - - -### `tf.parse_single_example(serialized, features, name=None, example_names=None)` {#parse_single_example} - -Parses a single `Example` proto. - -Similar to `parse_example`, except: - -For dense tensors, the returned `Tensor` is identical to the output of -`parse_example`, except there is no batch dimension, the output shape is the -same as the shape given in `dense_shape`. - -For `SparseTensor`s, the first (batch) column of the indices matrix is removed -(the indices matrix is a column vector), the values vector is unchanged, and -the first (`batch_size`) entry of the shape vector is removed (it is now a -single element vector). - -One might see performance advantages by batching `Example` protos with -`parse_example` instead of using this function directly. - -##### Args: - - -* `serialized`: A scalar string Tensor, a single serialized Example. - See `_parse_single_example_raw` documentation for more details. -* `features`: A `dict` mapping feature keys to `FixedLenFeature` or - `VarLenFeature` values. -* `name`: A name for this operation (optional). -* `example_names`: (Optional) A scalar string Tensor, the associated name. - See `_parse_single_example_raw` documentation for more details. - -##### Returns: - - A `dict` mapping feature keys to `Tensor` and `SparseTensor` values. - -##### Raises: - - -* `ValueError`: if any feature is invalid. - - -- - - - -### `tf.parse_tensor(serialized, out_type, name=None)` {#parse_tensor} - -Transforms a serialized tensorflow.TensorProto proto into a Tensor. - -##### Args: - - -* `serialized`: A `Tensor` of type `string`. - A scalar string containing a serialized TensorProto proto. -* `out_type`: A `tf.DType`. - The type of the serialized tensor. The provided type must match the - type of the serialized tensor and no implicit conversion will take place. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `out_type`. A Tensor of type `out_type`. - - -- - - - -### `tf.decode_json_example(json_examples, name=None)` {#decode_json_example} - -Convert JSON-encoded Example records to binary protocol buffer strings. - -This op translates a tensor containing Example records, encoded using -the [standard JSON -mapping](https://developers.google.com/protocol-buffers/docs/proto3#json), -into a tensor containing the same records encoded as binary protocol -buffers. The resulting tensor can then be fed to any of the other -Example-parsing ops. - -##### Args: - - -* `json_examples`: A `Tensor` of type `string`. - Each string is a JSON object serialized according to the JSON - mapping of the Example proto. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. - Each string is a binary Example protocol buffer corresponding - to the respective element of `json_examples`. - - -- - - - -### `class tf.QueueBase` {#QueueBase} - -Base class for queue implementations. - -A queue is a TensorFlow data structure that stores tensors across -multiple steps, and exposes operations that enqueue and dequeue -tensors. - -Each queue element is a tuple of one or more tensors, where each -tuple component has a static dtype, and may have a static shape. The -queue implementations support versions of enqueue and dequeue that -handle single elements, versions that support enqueuing and -dequeuing a batch of elements at once. - -See [`tf.FIFOQueue`](#FIFOQueue) and -[`tf.RandomShuffleQueue`](#RandomShuffleQueue) for concrete -implementations of this class, and instructions on how to create -them. -- - - - -#### `tf.QueueBase.__init__(dtypes, shapes, names, queue_ref)` {#QueueBase.__init__} - -Constructs a queue object from a queue reference. - -The two optional lists, `shapes` and `names`, must be of the same length -as `dtypes` if provided. The values at a given index `i` indicate the -shape and name to use for the corresponding queue component in `dtypes`. - -##### Args: - - -* `dtypes`: A list of types. The length of dtypes must equal the number - of tensors in each element. -* `shapes`: Constraints on the shapes of tensors in an element: - A list of shape tuples or None. This list is the same length - as dtypes. If the shape of any tensors in the element are constrained, - all must be; shapes can be None if the shapes should not be constrained. -* `names`: Optional list of names. If provided, the `enqueue()` and - `dequeue()` methods will use dictionaries with these names as keys. - Must be None or a list or tuple of the same length as `dtypes`. -* `queue_ref`: The queue reference, i.e. the output of the queue op. - -##### Raises: - - -* `ValueError`: If one of the arguments is invalid. - - -- - - - -#### `tf.QueueBase.close(cancel_pending_enqueues=False, name=None)` {#QueueBase.close} - -Closes this queue. - -This operation signals that no more elements will be enqueued in -the given queue. Subsequent `enqueue` and `enqueue_many` -operations will fail. Subsequent `dequeue` and `dequeue_many` -operations will continue to succeed if sufficient elements remain -in the queue. Subsequent `dequeue` and `dequeue_many` operations -that would block will fail immediately. - -If `cancel_pending_enqueues` is `True`, all pending requests will also -be cancelled. - -##### Args: - - -* `cancel_pending_enqueues`: (Optional.) A boolean, defaulting to - `False` (described above). -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that closes the queue. - - -- - - - -#### `tf.QueueBase.dequeue(name=None)` {#QueueBase.dequeue} - -Dequeues one element from this queue. - -If the queue is empty when this operation executes, it will block -until there is an element to dequeue. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue is empty, and there are no pending -enqueue operations that can fulfill this request, -`tf.errors.OutOfRangeError` will be raised. If the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of tensors that was dequeued. - - -- - - - -#### `tf.QueueBase.dequeue_many(n, name=None)` {#QueueBase.dequeue_many} - -Dequeues and concatenates `n` elements from this queue. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. All of the -components in the dequeued tuple will have size `n` in the 0th dimension. - -If the queue is closed and there are less than `n` elements left, then an -`OutOfRange` exception is raised. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue contains fewer than `n` elements, and -there are no pending enqueue operations that can fulfill this -request, `tf.errors.OutOfRangeError` will be raised. If the -session is [closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.QueueBase.dequeue_up_to(n, name=None)` {#QueueBase.dequeue_up_to} - -Dequeues and concatenates `n` elements from this queue. - -**Note** This operation is not supported by all queues. If a queue does not -support DequeueUpTo, then a `tf.errors.UnimplementedError` is raised. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. If the queue -has not been closed, all of the components in the dequeued tuple -will have size `n` in the 0th dimension. - -If the queue is closed and there are more than `0` but fewer than -`n` elements remaining, then instead of raising a -`tf.errors.OutOfRangeError` like [`dequeue_many`](#QueueBase.dequeue_many), -less than `n` elements are returned immediately. If the queue is -closed and there are `0` elements left in the queue, then a -`tf.errors.OutOfRangeError` is raised just like in `dequeue_many`. -Otherwise the behavior is identical to `dequeue_many`. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.QueueBase.dtypes` {#QueueBase.dtypes} - -The list of dtypes for each component of a queue element. - - -- - - - -#### `tf.QueueBase.enqueue(vals, name=None)` {#QueueBase.enqueue} - -Enqueues one element to this queue. - -If the queue is full when this operation executes, it will block -until the element has been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary containing - the values to enqueue. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a new tuple of tensors to the queue. - - -- - - - -#### `tf.QueueBase.enqueue_many(vals, name=None)` {#QueueBase.enqueue_many} - -Enqueues zero or more elements to this queue. - -This operation slices each component tensor along the 0th dimension to -make multiple queue elements. All of the tensors in `vals` must have the -same size in the 0th dimension. - -If the queue is full when this operation executes, it will block -until all of the elements have been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary - from which the queue elements are taken. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a batch of tuples of tensors to the queue. - - -- - - - -#### `tf.QueueBase.from_list(index, queues)` {#QueueBase.from_list} - -Create a queue using the queue reference from `queues[index]`. - -##### Args: - - -* `index`: An integer scalar tensor that determines the input that gets - selected. -* `queues`: A list of `QueueBase` objects. - -##### Returns: - - A `QueueBase` object. - -##### Raises: - - -* `TypeError`: When `queues` is not a list of `QueueBase` objects, - or when the data types of `queues` are not all the same. - - -- - - - -#### `tf.QueueBase.name` {#QueueBase.name} - -The name of the underlying queue. - - -- - - - -#### `tf.QueueBase.names` {#QueueBase.names} - -The list of names for each component of a queue element. - - -- - - - -#### `tf.QueueBase.queue_ref` {#QueueBase.queue_ref} - -The underlying queue reference. - - -- - - - -#### `tf.QueueBase.shapes` {#QueueBase.shapes} - -The list of shapes for each component of a queue element. - - -- - - - -#### `tf.QueueBase.size(name=None)` {#QueueBase.size} - -Compute the number of elements in this queue. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A scalar tensor containing the number of elements in this queue. - - - -- - - - -### `class tf.FIFOQueue` {#FIFOQueue} - -A queue implementation that dequeues elements in first-in first-out order. - -See [`tf.QueueBase`](#QueueBase) for a description of the methods on -this class. -- - - - -#### `tf.FIFOQueue.__init__(capacity, dtypes, shapes=None, names=None, shared_name=None, name='fifo_queue')` {#FIFOQueue.__init__} - -Creates a queue that dequeues elements in a first-in first-out order. - -A `FIFOQueue` has bounded capacity; supports multiple concurrent -producers and consumers; and provides exactly-once delivery. - -A `FIFOQueue` holds a list of up to `capacity` elements. Each -element is a fixed-length tuple of tensors whose dtypes are -described by `dtypes`, and whose shapes are optionally described -by the `shapes` argument. - -If the `shapes` argument is specified, each component of a queue -element must have the respective fixed shape. If it is -unspecified, different queue elements may have different shapes, -but the use of `dequeue_many` is disallowed. - -##### Args: - - -* `capacity`: An integer. The upper bound on the number of elements - that may be stored in this queue. -* `dtypes`: A list of `DType` objects. The length of `dtypes` must equal - the number of tensors in each queue element. -* `shapes`: (Optional.) A list of fully-defined `TensorShape` objects - with the same length as `dtypes`, or `None`. -* `names`: (Optional.) A list of string naming the components in the queue - with the same length as `dtypes`, or `None`. If specified the dequeue - methods return a dictionary with the names as keys. -* `shared_name`: (Optional.) If non-empty, this queue will be shared under - the given name across multiple sessions. -* `name`: Optional name for the queue operation. - - -- - - - -#### `tf.FIFOQueue.close(cancel_pending_enqueues=False, name=None)` {#FIFOQueue.close} - -Closes this queue. - -This operation signals that no more elements will be enqueued in -the given queue. Subsequent `enqueue` and `enqueue_many` -operations will fail. Subsequent `dequeue` and `dequeue_many` -operations will continue to succeed if sufficient elements remain -in the queue. Subsequent `dequeue` and `dequeue_many` operations -that would block will fail immediately. - -If `cancel_pending_enqueues` is `True`, all pending requests will also -be cancelled. - -##### Args: - - -* `cancel_pending_enqueues`: (Optional.) A boolean, defaulting to - `False` (described above). -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that closes the queue. - - -- - - - -#### `tf.FIFOQueue.dequeue(name=None)` {#FIFOQueue.dequeue} - -Dequeues one element from this queue. - -If the queue is empty when this operation executes, it will block -until there is an element to dequeue. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue is empty, and there are no pending -enqueue operations that can fulfill this request, -`tf.errors.OutOfRangeError` will be raised. If the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of tensors that was dequeued. - - -- - - - -#### `tf.FIFOQueue.dequeue_many(n, name=None)` {#FIFOQueue.dequeue_many} - -Dequeues and concatenates `n` elements from this queue. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. All of the -components in the dequeued tuple will have size `n` in the 0th dimension. - -If the queue is closed and there are less than `n` elements left, then an -`OutOfRange` exception is raised. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue contains fewer than `n` elements, and -there are no pending enqueue operations that can fulfill this -request, `tf.errors.OutOfRangeError` will be raised. If the -session is [closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.FIFOQueue.dequeue_up_to(n, name=None)` {#FIFOQueue.dequeue_up_to} - -Dequeues and concatenates `n` elements from this queue. - -**Note** This operation is not supported by all queues. If a queue does not -support DequeueUpTo, then a `tf.errors.UnimplementedError` is raised. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. If the queue -has not been closed, all of the components in the dequeued tuple -will have size `n` in the 0th dimension. - -If the queue is closed and there are more than `0` but fewer than -`n` elements remaining, then instead of raising a -`tf.errors.OutOfRangeError` like [`dequeue_many`](#QueueBase.dequeue_many), -less than `n` elements are returned immediately. If the queue is -closed and there are `0` elements left in the queue, then a -`tf.errors.OutOfRangeError` is raised just like in `dequeue_many`. -Otherwise the behavior is identical to `dequeue_many`. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.FIFOQueue.dtypes` {#FIFOQueue.dtypes} - -The list of dtypes for each component of a queue element. - - -- - - - -#### `tf.FIFOQueue.enqueue(vals, name=None)` {#FIFOQueue.enqueue} - -Enqueues one element to this queue. - -If the queue is full when this operation executes, it will block -until the element has been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary containing - the values to enqueue. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a new tuple of tensors to the queue. - - -- - - - -#### `tf.FIFOQueue.enqueue_many(vals, name=None)` {#FIFOQueue.enqueue_many} - -Enqueues zero or more elements to this queue. - -This operation slices each component tensor along the 0th dimension to -make multiple queue elements. All of the tensors in `vals` must have the -same size in the 0th dimension. - -If the queue is full when this operation executes, it will block -until all of the elements have been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary - from which the queue elements are taken. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a batch of tuples of tensors to the queue. - - -- - - - -#### `tf.FIFOQueue.from_list(index, queues)` {#FIFOQueue.from_list} - -Create a queue using the queue reference from `queues[index]`. - -##### Args: - - -* `index`: An integer scalar tensor that determines the input that gets - selected. -* `queues`: A list of `QueueBase` objects. - -##### Returns: - - A `QueueBase` object. - -##### Raises: - - -* `TypeError`: When `queues` is not a list of `QueueBase` objects, - or when the data types of `queues` are not all the same. - - -- - - - -#### `tf.FIFOQueue.name` {#FIFOQueue.name} - -The name of the underlying queue. - - -- - - - -#### `tf.FIFOQueue.names` {#FIFOQueue.names} - -The list of names for each component of a queue element. - - -- - - - -#### `tf.FIFOQueue.queue_ref` {#FIFOQueue.queue_ref} - -The underlying queue reference. - - -- - - - -#### `tf.FIFOQueue.shapes` {#FIFOQueue.shapes} - -The list of shapes for each component of a queue element. - - -- - - - -#### `tf.FIFOQueue.size(name=None)` {#FIFOQueue.size} - -Compute the number of elements in this queue. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A scalar tensor containing the number of elements in this queue. - - - -- - - - -### `class tf.PaddingFIFOQueue` {#PaddingFIFOQueue} - -A FIFOQueue that supports batching variable-sized tensors by padding. - -A `PaddingFIFOQueue` may contain components with dynamic shape, while also -supporting `dequeue_many`. See the constructor for more details. - -See [`tf.QueueBase`](#QueueBase) for a description of the methods on -this class. -- - - - -#### `tf.PaddingFIFOQueue.__init__(capacity, dtypes, shapes, names=None, shared_name=None, name='padding_fifo_queue')` {#PaddingFIFOQueue.__init__} - -Creates a queue that dequeues elements in a first-in first-out order. - -A `PaddingFIFOQueue` has bounded capacity; supports multiple concurrent -producers and consumers; and provides exactly-once delivery. - -A `PaddingFIFOQueue` holds a list of up to `capacity` elements. Each -element is a fixed-length tuple of tensors whose dtypes are -described by `dtypes`, and whose shapes are described by the `shapes` -argument. - -The `shapes` argument must be specified; each component of a queue -element must have the respective shape. Shapes of fixed -rank but variable size are allowed by setting any shape dimension to None. -In this case, the inputs' shape may vary along the given dimension, and -`dequeue_many` will pad the given dimension with zeros up to the maximum -shape of all elements in the given batch. - -##### Args: - - -* `capacity`: An integer. The upper bound on the number of elements - that may be stored in this queue. -* `dtypes`: A list of `DType` objects. The length of `dtypes` must equal - the number of tensors in each queue element. -* `shapes`: A list of `TensorShape` objects, with the same length as - `dtypes`. Any dimension in the `TensorShape` containing value - `None` is dynamic and allows values to be enqueued with - variable size in that dimension. -* `names`: (Optional.) A list of string naming the components in the queue - with the same length as `dtypes`, or `None`. If specified the dequeue - methods return a dictionary with the names as keys. -* `shared_name`: (Optional.) If non-empty, this queue will be shared under - the given name across multiple sessions. -* `name`: Optional name for the queue operation. - -##### Raises: - - -* `ValueError`: If shapes is not a list of shapes, or the lengths of dtypes - and shapes do not match, or if names is specified and the lengths of - dtypes and names do not match. - - -- - - - -#### `tf.PaddingFIFOQueue.close(cancel_pending_enqueues=False, name=None)` {#PaddingFIFOQueue.close} - -Closes this queue. - -This operation signals that no more elements will be enqueued in -the given queue. Subsequent `enqueue` and `enqueue_many` -operations will fail. Subsequent `dequeue` and `dequeue_many` -operations will continue to succeed if sufficient elements remain -in the queue. Subsequent `dequeue` and `dequeue_many` operations -that would block will fail immediately. - -If `cancel_pending_enqueues` is `True`, all pending requests will also -be cancelled. - -##### Args: - - -* `cancel_pending_enqueues`: (Optional.) A boolean, defaulting to - `False` (described above). -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that closes the queue. - - -- - - - -#### `tf.PaddingFIFOQueue.dequeue(name=None)` {#PaddingFIFOQueue.dequeue} - -Dequeues one element from this queue. - -If the queue is empty when this operation executes, it will block -until there is an element to dequeue. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue is empty, and there are no pending -enqueue operations that can fulfill this request, -`tf.errors.OutOfRangeError` will be raised. If the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of tensors that was dequeued. - - -- - - - -#### `tf.PaddingFIFOQueue.dequeue_many(n, name=None)` {#PaddingFIFOQueue.dequeue_many} - -Dequeues and concatenates `n` elements from this queue. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. All of the -components in the dequeued tuple will have size `n` in the 0th dimension. - -If the queue is closed and there are less than `n` elements left, then an -`OutOfRange` exception is raised. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue contains fewer than `n` elements, and -there are no pending enqueue operations that can fulfill this -request, `tf.errors.OutOfRangeError` will be raised. If the -session is [closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.PaddingFIFOQueue.dequeue_up_to(n, name=None)` {#PaddingFIFOQueue.dequeue_up_to} - -Dequeues and concatenates `n` elements from this queue. - -**Note** This operation is not supported by all queues. If a queue does not -support DequeueUpTo, then a `tf.errors.UnimplementedError` is raised. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. If the queue -has not been closed, all of the components in the dequeued tuple -will have size `n` in the 0th dimension. - -If the queue is closed and there are more than `0` but fewer than -`n` elements remaining, then instead of raising a -`tf.errors.OutOfRangeError` like [`dequeue_many`](#QueueBase.dequeue_many), -less than `n` elements are returned immediately. If the queue is -closed and there are `0` elements left in the queue, then a -`tf.errors.OutOfRangeError` is raised just like in `dequeue_many`. -Otherwise the behavior is identical to `dequeue_many`. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.PaddingFIFOQueue.dtypes` {#PaddingFIFOQueue.dtypes} - -The list of dtypes for each component of a queue element. - - -- - - - -#### `tf.PaddingFIFOQueue.enqueue(vals, name=None)` {#PaddingFIFOQueue.enqueue} - -Enqueues one element to this queue. - -If the queue is full when this operation executes, it will block -until the element has been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary containing - the values to enqueue. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a new tuple of tensors to the queue. - - -- - - - -#### `tf.PaddingFIFOQueue.enqueue_many(vals, name=None)` {#PaddingFIFOQueue.enqueue_many} - -Enqueues zero or more elements to this queue. - -This operation slices each component tensor along the 0th dimension to -make multiple queue elements. All of the tensors in `vals` must have the -same size in the 0th dimension. - -If the queue is full when this operation executes, it will block -until all of the elements have been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary - from which the queue elements are taken. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a batch of tuples of tensors to the queue. - - -- - - - -#### `tf.PaddingFIFOQueue.from_list(index, queues)` {#PaddingFIFOQueue.from_list} - -Create a queue using the queue reference from `queues[index]`. - -##### Args: - - -* `index`: An integer scalar tensor that determines the input that gets - selected. -* `queues`: A list of `QueueBase` objects. - -##### Returns: - - A `QueueBase` object. - -##### Raises: - - -* `TypeError`: When `queues` is not a list of `QueueBase` objects, - or when the data types of `queues` are not all the same. - - -- - - - -#### `tf.PaddingFIFOQueue.name` {#PaddingFIFOQueue.name} - -The name of the underlying queue. - - -- - - - -#### `tf.PaddingFIFOQueue.names` {#PaddingFIFOQueue.names} - -The list of names for each component of a queue element. - - -- - - - -#### `tf.PaddingFIFOQueue.queue_ref` {#PaddingFIFOQueue.queue_ref} - -The underlying queue reference. - - -- - - - -#### `tf.PaddingFIFOQueue.shapes` {#PaddingFIFOQueue.shapes} - -The list of shapes for each component of a queue element. - - -- - - - -#### `tf.PaddingFIFOQueue.size(name=None)` {#PaddingFIFOQueue.size} - -Compute the number of elements in this queue. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A scalar tensor containing the number of elements in this queue. - - - -- - - - -### `class tf.RandomShuffleQueue` {#RandomShuffleQueue} - -A queue implementation that dequeues elements in a random order. - -See [`tf.QueueBase`](#QueueBase) for a description of the methods on -this class. -- - - - -#### `tf.RandomShuffleQueue.__init__(capacity, min_after_dequeue, dtypes, shapes=None, names=None, seed=None, shared_name=None, name='random_shuffle_queue')` {#RandomShuffleQueue.__init__} - -Create a queue that dequeues elements in a random order. - -A `RandomShuffleQueue` has bounded capacity; supports multiple -concurrent producers and consumers; and provides exactly-once -delivery. - -A `RandomShuffleQueue` holds a list of up to `capacity` -elements. Each element is a fixed-length tuple of tensors whose -dtypes are described by `dtypes`, and whose shapes are optionally -described by the `shapes` argument. - -If the `shapes` argument is specified, each component of a queue -element must have the respective fixed shape. If it is -unspecified, different queue elements may have different shapes, -but the use of `dequeue_many` is disallowed. - -The `min_after_dequeue` argument allows the caller to specify a -minimum number of elements that will remain in the queue after a -`dequeue` or `dequeue_many` operation completes, to ensure a -minimum level of mixing of elements. This invariant is maintained -by blocking those operations until sufficient elements have been -enqueued. The `min_after_dequeue` argument is ignored after the -queue has been closed. - -##### Args: - - -* `capacity`: An integer. The upper bound on the number of elements - that may be stored in this queue. -* `min_after_dequeue`: An integer (described above). -* `dtypes`: A list of `DType` objects. The length of `dtypes` must equal - the number of tensors in each queue element. -* `shapes`: (Optional.) A list of fully-defined `TensorShape` objects - with the same length as `dtypes`, or `None`. -* `names`: (Optional.) A list of string naming the components in the queue - with the same length as `dtypes`, or `None`. If specified the dequeue - methods return a dictionary with the names as keys. -* `seed`: A Python integer. Used to create a random seed. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `shared_name`: (Optional.) If non-empty, this queue will be shared under - the given name across multiple sessions. -* `name`: Optional name for the queue operation. - - -- - - - -#### `tf.RandomShuffleQueue.close(cancel_pending_enqueues=False, name=None)` {#RandomShuffleQueue.close} - -Closes this queue. - -This operation signals that no more elements will be enqueued in -the given queue. Subsequent `enqueue` and `enqueue_many` -operations will fail. Subsequent `dequeue` and `dequeue_many` -operations will continue to succeed if sufficient elements remain -in the queue. Subsequent `dequeue` and `dequeue_many` operations -that would block will fail immediately. - -If `cancel_pending_enqueues` is `True`, all pending requests will also -be cancelled. - -##### Args: - - -* `cancel_pending_enqueues`: (Optional.) A boolean, defaulting to - `False` (described above). -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that closes the queue. - - -- - - - -#### `tf.RandomShuffleQueue.dequeue(name=None)` {#RandomShuffleQueue.dequeue} - -Dequeues one element from this queue. - -If the queue is empty when this operation executes, it will block -until there is an element to dequeue. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue is empty, and there are no pending -enqueue operations that can fulfill this request, -`tf.errors.OutOfRangeError` will be raised. If the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of tensors that was dequeued. - - -- - - - -#### `tf.RandomShuffleQueue.dequeue_many(n, name=None)` {#RandomShuffleQueue.dequeue_many} - -Dequeues and concatenates `n` elements from this queue. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. All of the -components in the dequeued tuple will have size `n` in the 0th dimension. - -If the queue is closed and there are less than `n` elements left, then an -`OutOfRange` exception is raised. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue contains fewer than `n` elements, and -there are no pending enqueue operations that can fulfill this -request, `tf.errors.OutOfRangeError` will be raised. If the -session is [closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.RandomShuffleQueue.dequeue_up_to(n, name=None)` {#RandomShuffleQueue.dequeue_up_to} - -Dequeues and concatenates `n` elements from this queue. - -**Note** This operation is not supported by all queues. If a queue does not -support DequeueUpTo, then a `tf.errors.UnimplementedError` is raised. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. If the queue -has not been closed, all of the components in the dequeued tuple -will have size `n` in the 0th dimension. - -If the queue is closed and there are more than `0` but fewer than -`n` elements remaining, then instead of raising a -`tf.errors.OutOfRangeError` like [`dequeue_many`](#QueueBase.dequeue_many), -less than `n` elements are returned immediately. If the queue is -closed and there are `0` elements left in the queue, then a -`tf.errors.OutOfRangeError` is raised just like in `dequeue_many`. -Otherwise the behavior is identical to `dequeue_many`. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.RandomShuffleQueue.dtypes` {#RandomShuffleQueue.dtypes} - -The list of dtypes for each component of a queue element. - - -- - - - -#### `tf.RandomShuffleQueue.enqueue(vals, name=None)` {#RandomShuffleQueue.enqueue} - -Enqueues one element to this queue. - -If the queue is full when this operation executes, it will block -until the element has been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary containing - the values to enqueue. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a new tuple of tensors to the queue. - - -- - - - -#### `tf.RandomShuffleQueue.enqueue_many(vals, name=None)` {#RandomShuffleQueue.enqueue_many} - -Enqueues zero or more elements to this queue. - -This operation slices each component tensor along the 0th dimension to -make multiple queue elements. All of the tensors in `vals` must have the -same size in the 0th dimension. - -If the queue is full when this operation executes, it will block -until all of the elements have been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary - from which the queue elements are taken. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a batch of tuples of tensors to the queue. - - -- - - - -#### `tf.RandomShuffleQueue.from_list(index, queues)` {#RandomShuffleQueue.from_list} - -Create a queue using the queue reference from `queues[index]`. - -##### Args: - - -* `index`: An integer scalar tensor that determines the input that gets - selected. -* `queues`: A list of `QueueBase` objects. - -##### Returns: - - A `QueueBase` object. - -##### Raises: - - -* `TypeError`: When `queues` is not a list of `QueueBase` objects, - or when the data types of `queues` are not all the same. - - -- - - - -#### `tf.RandomShuffleQueue.name` {#RandomShuffleQueue.name} - -The name of the underlying queue. - - -- - - - -#### `tf.RandomShuffleQueue.names` {#RandomShuffleQueue.names} - -The list of names for each component of a queue element. - - -- - - - -#### `tf.RandomShuffleQueue.queue_ref` {#RandomShuffleQueue.queue_ref} - -The underlying queue reference. - - -- - - - -#### `tf.RandomShuffleQueue.shapes` {#RandomShuffleQueue.shapes} - -The list of shapes for each component of a queue element. - - -- - - - -#### `tf.RandomShuffleQueue.size(name=None)` {#RandomShuffleQueue.size} - -Compute the number of elements in this queue. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A scalar tensor containing the number of elements in this queue. - - - -- - - - -### `class tf.PriorityQueue` {#PriorityQueue} - -A queue implementation that dequeues elements in prioritized order. - -See [`tf.QueueBase`](#QueueBase) for a description of the methods on -this class. -- - - - -#### `tf.PriorityQueue.__init__(capacity, types, shapes=None, names=None, shared_name=None, name='priority_queue')` {#PriorityQueue.__init__} - -Creates a queue that dequeues elements in a first-in first-out order. - -A `PriorityQueue` has bounded capacity; supports multiple concurrent -producers and consumers; and provides exactly-once delivery. - -A `PriorityQueue` holds a list of up to `capacity` elements. Each -element is a fixed-length tuple of tensors whose dtypes are -described by `types`, and whose shapes are optionally described -by the `shapes` argument. - -If the `shapes` argument is specified, each component of a queue -element must have the respective fixed shape. If it is -unspecified, different queue elements may have different shapes, -but the use of `dequeue_many` is disallowed. - -Enqueues and Dequeues to the `PriorityQueue` must include an additional -tuple entry at the beginning: the `priority`. The priority must be -an int64 scalar (for `enqueue`) or an int64 vector (for `enqueue_many`). - -##### Args: - - -* `capacity`: An integer. The upper bound on the number of elements - that may be stored in this queue. -* `types`: A list of `DType` objects. The length of `types` must equal - the number of tensors in each queue element, except the first priority - element. The first tensor in each element is the priority, - which must be type int64. -* `shapes`: (Optional.) A list of fully-defined `TensorShape` objects, - with the same length as `types`, or `None`. -* `names`: (Optional.) A list of strings naming the components in the queue - with the same length as `dtypes`, or `None`. If specified, the dequeue - methods return a dictionary with the names as keys. -* `shared_name`: (Optional.) If non-empty, this queue will be shared under - the given name across multiple sessions. -* `name`: Optional name for the queue operation. - - -- - - - -#### `tf.PriorityQueue.close(cancel_pending_enqueues=False, name=None)` {#PriorityQueue.close} - -Closes this queue. - -This operation signals that no more elements will be enqueued in -the given queue. Subsequent `enqueue` and `enqueue_many` -operations will fail. Subsequent `dequeue` and `dequeue_many` -operations will continue to succeed if sufficient elements remain -in the queue. Subsequent `dequeue` and `dequeue_many` operations -that would block will fail immediately. - -If `cancel_pending_enqueues` is `True`, all pending requests will also -be cancelled. - -##### Args: - - -* `cancel_pending_enqueues`: (Optional.) A boolean, defaulting to - `False` (described above). -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that closes the queue. - - -- - - - -#### `tf.PriorityQueue.dequeue(name=None)` {#PriorityQueue.dequeue} - -Dequeues one element from this queue. - -If the queue is empty when this operation executes, it will block -until there is an element to dequeue. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue is empty, and there are no pending -enqueue operations that can fulfill this request, -`tf.errors.OutOfRangeError` will be raised. If the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of tensors that was dequeued. - - -- - - - -#### `tf.PriorityQueue.dequeue_many(n, name=None)` {#PriorityQueue.dequeue_many} - -Dequeues and concatenates `n` elements from this queue. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. All of the -components in the dequeued tuple will have size `n` in the 0th dimension. - -If the queue is closed and there are less than `n` elements left, then an -`OutOfRange` exception is raised. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed, the queue contains fewer than `n` elements, and -there are no pending enqueue operations that can fulfill this -request, `tf.errors.OutOfRangeError` will be raised. If the -session is [closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.PriorityQueue.dequeue_up_to(n, name=None)` {#PriorityQueue.dequeue_up_to} - -Dequeues and concatenates `n` elements from this queue. - -**Note** This operation is not supported by all queues. If a queue does not -support DequeueUpTo, then a `tf.errors.UnimplementedError` is raised. - -This operation concatenates queue-element component tensors along -the 0th dimension to make a single component tensor. If the queue -has not been closed, all of the components in the dequeued tuple -will have size `n` in the 0th dimension. - -If the queue is closed and there are more than `0` but fewer than -`n` elements remaining, then instead of raising a -`tf.errors.OutOfRangeError` like [`dequeue_many`](#QueueBase.dequeue_many), -less than `n` elements are returned immediately. If the queue is -closed and there are `0` elements left in the queue, then a -`tf.errors.OutOfRangeError` is raised just like in `dequeue_many`. -Otherwise the behavior is identical to `dequeue_many`. - -##### Args: - - -* `n`: A scalar `Tensor` containing the number of elements to dequeue. -* `name`: A name for the operation (optional). - -##### Returns: - - The tuple of concatenated tensors that was dequeued. - - -- - - - -#### `tf.PriorityQueue.dtypes` {#PriorityQueue.dtypes} - -The list of dtypes for each component of a queue element. - - -- - - - -#### `tf.PriorityQueue.enqueue(vals, name=None)` {#PriorityQueue.enqueue} - -Enqueues one element to this queue. - -If the queue is full when this operation executes, it will block -until the element has been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary containing - the values to enqueue. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a new tuple of tensors to the queue. - - -- - - - -#### `tf.PriorityQueue.enqueue_many(vals, name=None)` {#PriorityQueue.enqueue_many} - -Enqueues zero or more elements to this queue. - -This operation slices each component tensor along the 0th dimension to -make multiple queue elements. All of the tensors in `vals` must have the -same size in the 0th dimension. - -If the queue is full when this operation executes, it will block -until all of the elements have been enqueued. - -At runtime, this operation may raise an error if the queue is -[closed](#QueueBase.close) before or during its execution. If the -queue is closed before this operation runs, -`tf.errors.CancelledError` will be raised. If this operation is -blocked, and either (i) the queue is closed by a close operation -with `cancel_pending_enqueues=True`, or (ii) the session is -[closed](../../api_docs/python/client.md#Session.close), -`tf.errors.CancelledError` will be raised. - -##### Args: - - -* `vals`: A tensor, a list or tuple of tensors, or a dictionary - from which the queue elements are taken. -* `name`: A name for the operation (optional). - -##### Returns: - - The operation that enqueues a batch of tuples of tensors to the queue. - - -- - - - -#### `tf.PriorityQueue.from_list(index, queues)` {#PriorityQueue.from_list} - -Create a queue using the queue reference from `queues[index]`. - -##### Args: - - -* `index`: An integer scalar tensor that determines the input that gets - selected. -* `queues`: A list of `QueueBase` objects. - -##### Returns: - - A `QueueBase` object. - -##### Raises: - - -* `TypeError`: When `queues` is not a list of `QueueBase` objects, - or when the data types of `queues` are not all the same. - - -- - - - -#### `tf.PriorityQueue.name` {#PriorityQueue.name} - -The name of the underlying queue. - - -- - - - -#### `tf.PriorityQueue.names` {#PriorityQueue.names} - -The list of names for each component of a queue element. - - -- - - - -#### `tf.PriorityQueue.queue_ref` {#PriorityQueue.queue_ref} - -The underlying queue reference. - - -- - - - -#### `tf.PriorityQueue.shapes` {#PriorityQueue.shapes} - -The list of shapes for each component of a queue element. - - -- - - - -#### `tf.PriorityQueue.size(name=None)` {#PriorityQueue.size} - -Compute the number of elements in this queue. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - A scalar tensor containing the number of elements in this queue. - - - -- - - - -### `class tf.ConditionalAccumulatorBase` {#ConditionalAccumulatorBase} - -A conditional accumulator for aggregating gradients. - -Up-to-date gradients (i.e., time step at which gradient was computed is -equal to the accumulator's time step) are added to the accumulator. - -Extraction of the average gradient is blocked until the required number of -gradients has been accumulated. -- - - - -#### `tf.ConditionalAccumulatorBase.__init__(dtype, shape, accumulator_ref)` {#ConditionalAccumulatorBase.__init__} - -Creates a new ConditionalAccumulator. - -##### Args: - - -* `dtype`: Datatype of the accumulated gradients. -* `shape`: Shape of the accumulated gradients. -* `accumulator_ref`: A handle to the conditional accumulator, created by sub- - classes - - -- - - - -#### `tf.ConditionalAccumulatorBase.accumulator_ref` {#ConditionalAccumulatorBase.accumulator_ref} - -The underlying accumulator reference. - - -- - - - -#### `tf.ConditionalAccumulatorBase.dtype` {#ConditionalAccumulatorBase.dtype} - -The datatype of the gradients accumulated by this accumulator. - - -- - - - -#### `tf.ConditionalAccumulatorBase.name` {#ConditionalAccumulatorBase.name} - -The name of the underlying accumulator. - - -- - - - -#### `tf.ConditionalAccumulatorBase.num_accumulated(name=None)` {#ConditionalAccumulatorBase.num_accumulated} - -Number of gradients that have currently been aggregated in accumulator. - -##### Args: - - -* `name`: Optional name for the operation. - -##### Returns: - - Number of accumulated gradients currently in accumulator. - - -- - - - -#### `tf.ConditionalAccumulatorBase.set_global_step(new_global_step, name=None)` {#ConditionalAccumulatorBase.set_global_step} - -Sets the global time step of the accumulator. - -The operation logs a warning if we attempt to set to a time step that is -lower than the accumulator's own time step. - -##### Args: - - -* `new_global_step`: Value of new time step. Can be a variable or a constant -* `name`: Optional name for the operation. - -##### Returns: - - Operation that sets the accumulator's time step. - - - -- - - - -### `class tf.ConditionalAccumulator` {#ConditionalAccumulator} - -A conditional accumulator for aggregating gradients. - -Up-to-date gradients (i.e., time step at which gradient was computed is -equal to the accumulator's time step) are added to the accumulator. - -Extraction of the average gradient is blocked until the required number of -gradients has been accumulated. -- - - - -#### `tf.ConditionalAccumulator.__init__(dtype, shape=None, shared_name=None, name='conditional_accumulator')` {#ConditionalAccumulator.__init__} - -Creates a new ConditionalAccumulator. - -##### Args: - - -* `dtype`: Datatype of the accumulated gradients. -* `shape`: Shape of the accumulated gradients. -* `shared_name`: Optional. If non-empty, this accumulator will be shared under - the given name across multiple sessions. -* `name`: Optional name for the accumulator. - - -- - - - -#### `tf.ConditionalAccumulator.accumulator_ref` {#ConditionalAccumulator.accumulator_ref} - -The underlying accumulator reference. - - -- - - - -#### `tf.ConditionalAccumulator.apply_grad(grad, local_step=0, name=None)` {#ConditionalAccumulator.apply_grad} - -Attempts to apply a gradient to the accumulator. - -The attempt is silently dropped if the gradient is stale, i.e., local_step -is less than the accumulator's global time step. - -##### Args: - - -* `grad`: The gradient tensor to be applied. -* `local_step`: Time step at which the gradient was computed. -* `name`: Optional name for the operation. - -##### Returns: - - The operation that (conditionally) applies a gradient to the accumulator. - -##### Raises: - - -* `ValueError`: If grad is of the wrong shape - - -- - - - -#### `tf.ConditionalAccumulator.dtype` {#ConditionalAccumulator.dtype} - -The datatype of the gradients accumulated by this accumulator. - - -- - - - -#### `tf.ConditionalAccumulator.name` {#ConditionalAccumulator.name} - -The name of the underlying accumulator. - - -- - - - -#### `tf.ConditionalAccumulator.num_accumulated(name=None)` {#ConditionalAccumulator.num_accumulated} - -Number of gradients that have currently been aggregated in accumulator. - -##### Args: - - -* `name`: Optional name for the operation. - -##### Returns: - - Number of accumulated gradients currently in accumulator. - - -- - - - -#### `tf.ConditionalAccumulator.set_global_step(new_global_step, name=None)` {#ConditionalAccumulator.set_global_step} - -Sets the global time step of the accumulator. - -The operation logs a warning if we attempt to set to a time step that is -lower than the accumulator's own time step. - -##### Args: - - -* `new_global_step`: Value of new time step. Can be a variable or a constant -* `name`: Optional name for the operation. - -##### Returns: - - Operation that sets the accumulator's time step. - - -- - - - -#### `tf.ConditionalAccumulator.take_grad(num_required, name=None)` {#ConditionalAccumulator.take_grad} - -Attempts to extract the average gradient from the accumulator. - -The operation blocks until sufficient number of gradients have been -successfully applied to the accumulator. - -Once successful, the following actions are also triggered: -- Counter of accumulated gradients is reset to 0. -- Aggregated gradient is reset to 0 tensor. -- Accumulator's internal time step is incremented by 1. - -##### Args: - - -* `num_required`: Number of gradients that needs to have been aggregated -* `name`: Optional name for the operation - -##### Returns: - - A tensor holding the value of the average gradient. - -##### Raises: - - -* `InvalidArgumentError`: If num_required < 1 - - - -- - - - -### `class tf.SparseConditionalAccumulator` {#SparseConditionalAccumulator} - -A conditional accumulator for aggregating sparse gradients. - -Sparse gradients are represented by IndexedSlices. - -Up-to-date gradients (i.e., time step at which gradient was computed is -equal to the accumulator's time step) are added to the accumulator. - -Extraction of the average gradient is blocked until the required number of -gradients has been accumulated. - -Args: - dtype: Datatype of the accumulated gradients. - shape: Shape of the accumulated gradients. - shared_name: Optional. If non-empty, this accumulator will be shared under - the given name across multiple sessions. - name: Optional name for the accumulator. -- - - - -#### `tf.SparseConditionalAccumulator.__init__(dtype, shape=None, shared_name=None, name='sparse_conditional_accumulator')` {#SparseConditionalAccumulator.__init__} - - - - -- - - - -#### `tf.SparseConditionalAccumulator.accumulator_ref` {#SparseConditionalAccumulator.accumulator_ref} - -The underlying accumulator reference. - - -- - - - -#### `tf.SparseConditionalAccumulator.apply_grad(grad_indices, grad_values, grad_shape=None, local_step=0, name=None)` {#SparseConditionalAccumulator.apply_grad} - -Attempts to apply a sparse gradient to the accumulator. - -The attempt is silently dropped if the gradient is stale, i.e., local_step -is less than the accumulator's global time step. - -A sparse gradient is represented by its indices, values and possibly empty -or None shape. Indices must be a vector representing the locations of -non-zero entries in the tensor. Values are the non-zero slices of the -gradient, and must have the same first dimension as indices, i.e., the nnz -represented by indices and values must be consistent. Shape, if not empty or -None, must be consistent with the accumulator's shape (if also provided). - -##### Example: - - A tensor [[0, 0], [0. 1], [2, 3]] can be represented - -* `indices`: [1,2] -* `values`: [[0,1],[2,3]] -* `shape`: [3, 2] - -##### Args: - - -* `grad_indices`: Indices of the sparse gradient to be applied. -* `grad_values`: Values of the sparse gradient to be applied. -* `grad_shape`: Shape of the sparse gradient to be applied. -* `local_step`: Time step at which the gradient was computed. -* `name`: Optional name for the operation. - -##### Returns: - - The operation that (conditionally) applies a gradient to the accumulator. - -##### Raises: - - -* `InvalidArgumentError`: If grad is of the wrong shape - - -- - - - -#### `tf.SparseConditionalAccumulator.apply_indexed_slices_grad(grad, local_step=0, name=None)` {#SparseConditionalAccumulator.apply_indexed_slices_grad} - -Attempts to apply a gradient to the accumulator. - -The attempt is silently dropped if the gradient is stale, i.e., local_step -is less than the accumulator's global time step. - -##### Args: - - -* `grad`: The gradient IndexedSlices to be applied. -* `local_step`: Time step at which the gradient was computed. -* `name`: Optional name for the operation. - -##### Returns: - - The operation that (conditionally) applies a gradient to the accumulator. - -##### Raises: - - -* `InvalidArgumentError`: If grad is of the wrong shape - - -- - - - -#### `tf.SparseConditionalAccumulator.dtype` {#SparseConditionalAccumulator.dtype} - -The datatype of the gradients accumulated by this accumulator. - - -- - - - -#### `tf.SparseConditionalAccumulator.name` {#SparseConditionalAccumulator.name} - -The name of the underlying accumulator. - - -- - - - -#### `tf.SparseConditionalAccumulator.num_accumulated(name=None)` {#SparseConditionalAccumulator.num_accumulated} - -Number of gradients that have currently been aggregated in accumulator. - -##### Args: - - -* `name`: Optional name for the operation. - -##### Returns: - - Number of accumulated gradients currently in accumulator. - - -- - - - -#### `tf.SparseConditionalAccumulator.set_global_step(new_global_step, name=None)` {#SparseConditionalAccumulator.set_global_step} - -Sets the global time step of the accumulator. - -The operation logs a warning if we attempt to set to a time step that is -lower than the accumulator's own time step. - -##### Args: - - -* `new_global_step`: Value of new time step. Can be a variable or a constant -* `name`: Optional name for the operation. - -##### Returns: - - Operation that sets the accumulator's time step. - - -- - - - -#### `tf.SparseConditionalAccumulator.take_grad(num_required, name=None)` {#SparseConditionalAccumulator.take_grad} - -Attempts to extract the average gradient from the accumulator. - -The operation blocks until sufficient number of gradients have been -successfully applied to the accumulator. - -Once successful, the following actions are also triggered: -- Counter of accumulated gradients is reset to 0. -- Aggregated gradient is reset to 0 tensor. -- Accumulator's internal time step is incremented by 1. - -##### Args: - - -* `num_required`: Number of gradients that needs to have been aggregated -* `name`: Optional name for the operation - -##### Returns: - - A tuple of indices, values, and shape representing the average gradient. - -##### Raises: - - -* `InvalidArgumentError`: If num_required < 1 - - -- - - - -#### `tf.SparseConditionalAccumulator.take_indexed_slices_grad(num_required, name=None)` {#SparseConditionalAccumulator.take_indexed_slices_grad} - -Attempts to extract the average gradient from the accumulator. - -The operation blocks until sufficient number of gradients have been -successfully applied to the accumulator. - -Once successful, the following actions are also triggered: -- Counter of accumulated gradients is reset to 0. -- Aggregated gradient is reset to 0 tensor. -- Accumulator's internal time step is incremented by 1. - -##### Args: - - -* `num_required`: Number of gradients that needs to have been aggregated -* `name`: Optional name for the operation - -##### Returns: - - An IndexedSlices holding the value of the average gradient. - -##### Raises: - - -* `InvalidArgumentError`: If num_required < 1 - - - -- - - - -### `tf.matching_files(pattern, name=None)` {#matching_files} - -Returns the set of files matching one or more glob patterns. - -Note that this routine only supports wildcard characters in the -basename portion of the pattern, not in the directory portion. - -##### Args: - - -* `pattern`: A `Tensor` of type `string`. - Shell wildcard pattern(s). Scalar or vector of type string. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. A vector of matching filenames. - - -- - - - -### `tf.read_file(filename, name=None)` {#read_file} - -Reads and outputs the entire contents of the input filename. - -##### Args: - - -* `filename`: A `Tensor` of type `string`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. - - -- - - - -### `tf.write_file(filename, contents, name=None)` {#write_file} - -Writes contents to the file at input filename. Creates file if not existing. - -##### Args: - - -* `filename`: A `Tensor` of type `string`. - scalar. The name of the file to which we write the contents. -* `contents`: A `Tensor` of type `string`. - scalar. The content to be written to the output file. -* `name`: A name for the operation (optional). - -##### Returns: - - The created Operation. - - -- - - - -### `tf.train.match_filenames_once(pattern, name=None)` {#match_filenames_once} - -Save the list of files matching pattern, so it is only computed once. - -##### Args: - - -* `pattern`: A file pattern (glob), or 1D tensor of file patterns. -* `name`: A name for the operations (optional). - -##### Returns: - - A variable that is initialized to the list of files matching the pattern(s). - - -- - - - -### `tf.train.limit_epochs(tensor, num_epochs=None, name=None)` {#limit_epochs} - -Returns tensor `num_epochs` times and then raises an `OutOfRange` error. - -Note: creates local counter `epochs`. Use `local_variables_initializer()` to -initialize local variables. - -##### Args: - - -* `tensor`: Any `Tensor`. -* `num_epochs`: A positive integer (optional). If specified, limits the number - of steps the output tensor may be evaluated. -* `name`: A name for the operations (optional). - -##### Returns: - - tensor or `OutOfRange`. - -##### Raises: - - -* `ValueError`: if `num_epochs` is invalid. - - -- - - - -### `tf.train.input_producer(input_tensor, element_shape=None, num_epochs=None, shuffle=True, seed=None, capacity=32, shared_name=None, summary_name=None, name=None, cancel_op=None)` {#input_producer} - -Output the rows of `input_tensor` to a queue for an input pipeline. - -Note: if `num_epochs` is not `None`, this function creates local counter -`epochs`. Use `local_variables_initializer()` to initialize local variables. - -##### Args: - - -* `input_tensor`: A tensor with the rows to produce. Must be at least - one-dimensional. Must either have a fully-defined shape, or - `element_shape` must be defined. -* `element_shape`: (Optional.) A `TensorShape` representing the shape of a - row of `input_tensor`, if it cannot be inferred. -* `num_epochs`: (Optional.) An integer. If specified `input_producer` produces - each row of `input_tensor` `num_epochs` times before generating an - `OutOfRange` error. If not specified, `input_producer` can cycle through - the rows of `input_tensor` an unlimited number of times. -* `shuffle`: (Optional.) A boolean. If true, the rows are randomly shuffled - within each epoch. -* `seed`: (Optional.) An integer. The seed to use if `shuffle` is true. -* `capacity`: (Optional.) The capacity of the queue to be used for buffering - the input. -* `shared_name`: (Optional.) If set, this queue will be shared under the given - name across multiple sessions. -* `summary_name`: (Optional.) If set, a scalar summary for the current queue - size will be generated, using this name as part of the tag. -* `name`: (Optional.) A name for queue. -* `cancel_op`: (Optional.) Cancel op for the queue - -##### Returns: - - A queue with the output rows. A `QueueRunner` for the queue is - added to the current `QUEUE_RUNNER` collection of the current - graph. - -##### Raises: - - -* `ValueError`: If the shape of the input cannot be inferred from the arguments. - - -- - - - -### `tf.train.range_input_producer(limit, num_epochs=None, shuffle=True, seed=None, capacity=32, shared_name=None, name=None)` {#range_input_producer} - -Produces the integers from 0 to limit-1 in a queue. - -Note: if `num_epochs` is not `None`, this function creates local counter -`epochs`. Use `local_variables_initializer()` to initialize local variables. - -##### Args: - - -* `limit`: An int32 scalar tensor. -* `num_epochs`: An integer (optional). If specified, `range_input_producer` - produces each integer `num_epochs` times before generating an - OutOfRange error. If not specified, `range_input_producer` can cycle - through the integers an unlimited number of times. -* `shuffle`: Boolean. If true, the integers are randomly shuffled within each - epoch. -* `seed`: An integer (optional). Seed used if shuffle == True. -* `capacity`: An integer. Sets the queue capacity. -* `shared_name`: (optional). If set, this queue will be shared under the given - name across multiple sessions. -* `name`: A name for the operations (optional). - -##### Returns: - - A Queue with the output integers. A `QueueRunner` for the Queue - is added to the current `Graph`'s `QUEUE_RUNNER` collection. - - -- - - - -### `tf.train.slice_input_producer(tensor_list, num_epochs=None, shuffle=True, seed=None, capacity=32, shared_name=None, name=None)` {#slice_input_producer} - -Produces a slice of each `Tensor` in `tensor_list`. - -Implemented using a Queue -- a `QueueRunner` for the Queue -is added to the current `Graph`'s `QUEUE_RUNNER` collection. - -##### Args: - - -* `tensor_list`: A list of `Tensor` objects. Every `Tensor` in - `tensor_list` must have the same size in the first dimension. -* `num_epochs`: An integer (optional). If specified, `slice_input_producer` - produces each slice `num_epochs` times before generating - an `OutOfRange` error. If not specified, `slice_input_producer` can cycle - through the slices an unlimited number of times. -* `shuffle`: Boolean. If true, the integers are randomly shuffled within each - epoch. -* `seed`: An integer (optional). Seed used if shuffle == True. -* `capacity`: An integer. Sets the queue capacity. -* `shared_name`: (optional). If set, this queue will be shared under the given - name across multiple sessions. -* `name`: A name for the operations (optional). - -##### Returns: - - A list of tensors, one for each element of `tensor_list`. If the tensor - in `tensor_list` has shape `[N, a, b, .., z]`, then the corresponding output - tensor will have shape `[a, b, ..., z]`. - -##### Raises: - - -* `ValueError`: if `slice_input_producer` produces nothing from `tensor_list`. - - -- - - - -### `tf.train.string_input_producer(string_tensor, num_epochs=None, shuffle=True, seed=None, capacity=32, shared_name=None, name=None, cancel_op=None)` {#string_input_producer} - -Output strings (e.g. filenames) to a queue for an input pipeline. - -Note: if `num_epochs` is not `None`, this function creates local counter -`epochs`. Use `local_variables_initializer()` to initialize local variables. - -##### Args: - - -* `string_tensor`: A 1-D string tensor with the strings to produce. -* `num_epochs`: An integer (optional). If specified, `string_input_producer` - produces each string from `string_tensor` `num_epochs` times before - generating an `OutOfRange` error. If not specified, - `string_input_producer` can cycle through the strings in `string_tensor` - an unlimited number of times. -* `shuffle`: Boolean. If true, the strings are randomly shuffled within each - epoch. -* `seed`: An integer (optional). Seed used if shuffle == True. -* `capacity`: An integer. Sets the queue capacity. -* `shared_name`: (optional). If set, this queue will be shared under the given - name across multiple sessions. -* `name`: A name for the operations (optional). -* `cancel_op`: Cancel op for the queue (optional). - -##### Returns: - - A queue with the output strings. A `QueueRunner` for the Queue - is added to the current `Graph`'s `QUEUE_RUNNER` collection. - -##### Raises: - - -* `ValueError`: If the string_tensor is a null Python list. At runtime, - will fail with an assertion if string_tensor becomes a null tensor. - - -- - - - -### `tf.train.batch(tensors, batch_size, num_threads=1, capacity=32, enqueue_many=False, shapes=None, dynamic_pad=False, allow_smaller_final_batch=False, shared_name=None, name=None)` {#batch} - -Creates batches of tensors in `tensors`. - -The argument `tensors` can be a list or a dictionary of tensors. -The value returned by the function will be of the same type -as `tensors`. - -This function is implemented using a queue. A `QueueRunner` for the -queue is added to the current `Graph`'s `QUEUE_RUNNER` collection. - -If `enqueue_many` is `False`, `tensors` is assumed to represent a single -example. An input tensor with shape `[x, y, z]` will be output as a tensor -with shape `[batch_size, x, y, z]`. - -If `enqueue_many` is `True`, `tensors` is assumed to represent a batch of -examples, where the first dimension is indexed by example, and all members of -`tensors` should have the same size in the first dimension. If an input -tensor has shape `[*, x, y, z]`, the output will have shape `[batch_size, x, -y, z]`. The `capacity` argument controls the how long the prefetching is -allowed to grow the queues. - -The returned operation is a dequeue operation and will throw -`tf.errors.OutOfRangeError` if the input queue is exhausted. If this -operation is feeding another input queue, its queue runner will catch -this exception, however, if this operation is used in your main thread -you are responsible for catching this yourself. - -*N.B.:* If `dynamic_pad` is `False`, you must ensure that either -(i) the `shapes` argument is passed, or (ii) all of the tensors in -`tensors` must have fully-defined shapes. `ValueError` will be -raised if neither of these conditions holds. - -If `dynamic_pad` is `True`, it is sufficient that the *rank* of the -tensors is known, but individual dimensions may have shape `None`. -In this case, for each enqueue the dimensions with value `None` -may have a variable length; upon dequeue, the output tensors will be padded -on the right to the maximum shape of the tensors in the current minibatch. -For numbers, this padding takes value 0. For strings, this padding is -the empty string. See `PaddingFIFOQueue` for more info. - -If `allow_smaller_final_batch` is `True`, a smaller batch value than -`batch_size` is returned when the queue is closed and there are not enough -elements to fill the batch, otherwise the pending elements are discarded. -In addition, all output tensors' static shapes, as accessed via the -`get_shape` method will have a first `Dimension` value of `None`, and -operations that depend on fixed batch_size would fail. - -Note: if `num_epochs` is not `None`, this function creates local counter -`epochs`. Use `local_variables_initializer()` to initialize local variables. - -##### Args: - - -* `tensors`: The list or dictionary of tensors to enqueue. -* `batch_size`: The new batch size pulled from the queue. -* `num_threads`: The number of threads enqueuing `tensors`. -* `capacity`: An integer. The maximum number of elements in the queue. -* `enqueue_many`: Whether each tensor in `tensors` is a single example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensors`. -* `dynamic_pad`: Boolean. Allow variable dimensions in input shapes. - The given dimensions are padded upon dequeue so that tensors within a - batch have the same shapes. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (Optional). If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the same types as `tensors` (except if - the input is a list of one element, then it returns a tensor, not a list). - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensors`. - - -- - - - -### `tf.train.maybe_batch(tensors, keep_input, batch_size, num_threads=1, capacity=32, enqueue_many=False, shapes=None, dynamic_pad=False, allow_smaller_final_batch=False, shared_name=None, name=None)` {#maybe_batch} - -Conditionally creates batches of tensors based on `keep_input`. - -See docstring in `batch` for more details. - -##### Args: - - -* `tensors`: The list or dictionary of tensors to enqueue. -* `keep_input`: A `bool` Tensor. This tensor controls whether the input is - added to the queue or not. If it is a scalar and evaluates `True`, then - `tensors` are all added to the queue. If it is a vector and `enqueue_many` - is `True`, then each example is added to the queue only if the - corresonding value in `keep_input` is `True`. This tensor essentially acts - as a filtering mechanism. -* `batch_size`: The new batch size pulled from the queue. -* `num_threads`: The number of threads enqueuing `tensors`. -* `capacity`: An integer. The maximum number of elements in the queue. -* `enqueue_many`: Whether each tensor in `tensors` is a single example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensors`. -* `dynamic_pad`: Boolean. Allow variable dimensions in input shapes. - The given dimensions are padded upon dequeue so that tensors within a - batch have the same shapes. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (Optional). If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the same types as `tensors`. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensors`. - - -- - - - -### `tf.train.batch_join(tensors_list, batch_size, capacity=32, enqueue_many=False, shapes=None, dynamic_pad=False, allow_smaller_final_batch=False, shared_name=None, name=None)` {#batch_join} - -Runs a list of tensors to fill a queue to create batches of examples. - -The `tensors_list` argument is a list of tuples of tensors, or a list of -dictionaries of tensors. Each element in the list is treated similarly -to the `tensors` argument of `tf.train.batch()`. - -Enqueues a different list of tensors in different threads. -Implemented using a queue -- a `QueueRunner` for the queue -is added to the current `Graph`'s `QUEUE_RUNNER` collection. - -`len(tensors_list)` threads will be started, -with thread `i` enqueuing the tensors from -`tensors_list[i]`. `tensors_list[i1][j]` must match -`tensors_list[i2][j]` in type and shape, except in the first -dimension if `enqueue_many` is true. - -If `enqueue_many` is `False`, each `tensors_list[i]` is assumed -to represent a single example. An input tensor `x` will be output as a -tensor with shape `[batch_size] + x.shape`. - -If `enqueue_many` is `True`, `tensors_list[i]` is assumed to -represent a batch of examples, where the first dimension is indexed -by example, and all members of `tensors_list[i]` should have the -same size in the first dimension. The slices of any input tensor -`x` are treated as examples, and the output tensors will have shape -`[batch_size] + x.shape[1:]`. - -The `capacity` argument controls the how long the prefetching is allowed to -grow the queues. - -The returned operation is a dequeue operation and will throw -`tf.errors.OutOfRangeError` if the input queue is exhausted. If this -operation is feeding another input queue, its queue runner will catch -this exception, however, if this operation is used in your main thread -you are responsible for catching this yourself. - -*N.B.:* If `dynamic_pad` is `False`, you must ensure that either -(i) the `shapes` argument is passed, or (ii) all of the tensors in -`tensors_list` must have fully-defined shapes. `ValueError` will be -raised if neither of these conditions holds. - -If `dynamic_pad` is `True`, it is sufficient that the *rank* of the -tensors is known, but individual dimensions may have value `None`. -In this case, for each enqueue the dimensions with value `None` -may have a variable length; upon dequeue, the output tensors will be padded -on the right to the maximum shape of the tensors in the current minibatch. -For numbers, this padding takes value 0. For strings, this padding is -the empty string. See `PaddingFIFOQueue` for more info. - -If `allow_smaller_final_batch` is `True`, a smaller batch value than -`batch_size` is returned when the queue is closed and there are not enough -elements to fill the batch, otherwise the pending elements are discarded. -In addition, all output tensors' static shapes, as accessed via the -`get_shape` method will have a first `Dimension` value of `None`, and -operations that depend on fixed batch_size would fail. - -##### Args: - - -* `tensors_list`: A list of tuples or dictionaries of tensors to enqueue. -* `batch_size`: An integer. The new batch size pulled from the queue. -* `capacity`: An integer. The maximum number of elements in the queue. -* `enqueue_many`: Whether each tensor in `tensor_list_list` is a single - example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensor_list_list[i]`. -* `dynamic_pad`: Boolean. Allow variable dimensions in input shapes. - The given dimensions are padded upon dequeue so that tensors within a - batch have the same shapes. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (Optional) If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the same number and types as - `tensors_list[i]`. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensor_list_list`. - - -- - - - -### `tf.train.maybe_batch_join(tensors_list, keep_input, batch_size, capacity=32, enqueue_many=False, shapes=None, dynamic_pad=False, allow_smaller_final_batch=False, shared_name=None, name=None)` {#maybe_batch_join} - -Runs a list of tensors to conditionally fill a queue to create batches. - -See docstring in `batch_join` for more details. - -##### Args: - - -* `tensors_list`: A list of tuples or dictionaries of tensors to enqueue. -* `keep_input`: A `bool` Tensor. This tensor controls whether the input is - added to the queue or not. If it is a scalar and evaluates `True`, then - `tensors` are all added to the queue. If it is a vector and `enqueue_many` - is `True`, then each example is added to the queue only if the - corresonding value in `keep_input` is `True`. This tensor essentially acts - as a filtering mechanism. -* `batch_size`: An integer. The new batch size pulled from the queue. -* `capacity`: An integer. The maximum number of elements in the queue. -* `enqueue_many`: Whether each tensor in `tensor_list_list` is a single - example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensor_list_list[i]`. -* `dynamic_pad`: Boolean. Allow variable dimensions in input shapes. - The given dimensions are padded upon dequeue so that tensors within a - batch have the same shapes. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (Optional) If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the same number and types as - `tensors_list[i]`. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensor_list_list`. - - -- - - - -### `tf.train.shuffle_batch(tensors, batch_size, capacity, min_after_dequeue, num_threads=1, seed=None, enqueue_many=False, shapes=None, allow_smaller_final_batch=False, shared_name=None, name=None)` {#shuffle_batch} - -Creates batches by randomly shuffling tensors. - -This function adds the following to the current `Graph`: - -* A shuffling queue into which tensors from `tensors` are enqueued. -* A `dequeue_many` operation to create batches from the queue. -* A `QueueRunner` to `QUEUE_RUNNER` collection, to enqueue the tensors - from `tensors`. - -If `enqueue_many` is `False`, `tensors` is assumed to represent a -single example. An input tensor with shape `[x, y, z]` will be output -as a tensor with shape `[batch_size, x, y, z]`. - -If `enqueue_many` is `True`, `tensors` is assumed to represent a -batch of examples, where the first dimension is indexed by example, -and all members of `tensors` should have the same size in the -first dimension. If an input tensor has shape `[*, x, y, z]`, the -output will have shape `[batch_size, x, y, z]`. - -The `capacity` argument controls the how long the prefetching is allowed to -grow the queues. - -The returned operation is a dequeue operation and will throw -`tf.errors.OutOfRangeError` if the input queue is exhausted. If this -operation is feeding another input queue, its queue runner will catch -this exception, however, if this operation is used in your main thread -you are responsible for catching this yourself. - -For example: - -```python -# Creates batches of 32 images and 32 labels. -image_batch, label_batch = tf.train.shuffle_batch( - [single_image, single_label], - batch_size=32, - num_threads=4, - capacity=50000, - min_after_dequeue=10000) -``` - -*N.B.:* You must ensure that either (i) the `shapes` argument is -passed, or (ii) all of the tensors in `tensors` must have -fully-defined shapes. `ValueError` will be raised if neither of -these conditions holds. - -If `allow_smaller_final_batch` is `True`, a smaller batch value than -`batch_size` is returned when the queue is closed and there are not enough -elements to fill the batch, otherwise the pending elements are discarded. -In addition, all output tensors' static shapes, as accessed via the -`get_shape` method will have a first `Dimension` value of `None`, and -operations that depend on fixed batch_size would fail. - -Note: if `num_epochs` is not `None`, this function creates local counter -`epochs`. Use `local_variables_initializer()` to initialize local variables. - -##### Args: - - -* `tensors`: The list or dictionary of tensors to enqueue. -* `batch_size`: The new batch size pulled from the queue. -* `capacity`: An integer. The maximum number of elements in the queue. -* `min_after_dequeue`: Minimum number elements in the queue after a - dequeue, used to ensure a level of mixing of elements. -* `num_threads`: The number of threads enqueuing `tensor_list`. -* `seed`: Seed for the random shuffling within the queue. -* `enqueue_many`: Whether each tensor in `tensor_list` is a single example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensor_list`. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (Optional) If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the types as `tensors`. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensors`. - - -- - - - -### `tf.train.maybe_shuffle_batch(tensors, batch_size, capacity, min_after_dequeue, keep_input, num_threads=1, seed=None, enqueue_many=False, shapes=None, allow_smaller_final_batch=False, shared_name=None, name=None)` {#maybe_shuffle_batch} - -Creates batches by randomly shuffling conditionally-enqueued tensors. - -See docstring in `shuffle_batch` for more details. - -##### Args: - - -* `tensors`: The list or dictionary of tensors to enqueue. -* `batch_size`: The new batch size pulled from the queue. -* `capacity`: An integer. The maximum number of elements in the queue. -* `min_after_dequeue`: Minimum number elements in the queue after a - dequeue, used to ensure a level of mixing of elements. -* `keep_input`: A `bool` Tensor. This tensor controls whether the input is - added to the queue or not. If it is a scalar and evaluates `True`, then - `tensors` are all added to the queue. If it is a vector and `enqueue_many` - is `True`, then each example is added to the queue only if the - corresonding value in `keep_input` is `True`. This tensor essentially acts - as a filtering mechanism. -* `num_threads`: The number of threads enqueuing `tensor_list`. -* `seed`: Seed for the random shuffling within the queue. -* `enqueue_many`: Whether each tensor in `tensor_list` is a single example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensor_list`. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (Optional) If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the types as `tensors`. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensors`. - - -- - - - -### `tf.train.shuffle_batch_join(tensors_list, batch_size, capacity, min_after_dequeue, seed=None, enqueue_many=False, shapes=None, allow_smaller_final_batch=False, shared_name=None, name=None)` {#shuffle_batch_join} - -Create batches by randomly shuffling tensors. - -The `tensors_list` argument is a list of tuples of tensors, or a list of -dictionaries of tensors. Each element in the list is treated similarly -to the `tensors` argument of `tf.train.shuffle_batch()`. - -This version enqueues a different list of tensors in different threads. -It adds the following to the current `Graph`: - -* A shuffling queue into which tensors from `tensors_list` are enqueued. -* A `dequeue_many` operation to create batches from the queue. -* A `QueueRunner` to `QUEUE_RUNNER` collection, to enqueue the tensors - from `tensors_list`. - -`len(tensors_list)` threads will be started, with thread `i` enqueuing -the tensors from `tensors_list[i]`. `tensors_list[i1][j]` must match -`tensors_list[i2][j]` in type and shape, except in the first dimension if -`enqueue_many` is true. - -If `enqueue_many` is `False`, each `tensors_list[i]` is assumed -to represent a single example. An input tensor with shape `[x, y, z]` -will be output as a tensor with shape `[batch_size, x, y, z]`. - -If `enqueue_many` is `True`, `tensors_list[i]` is assumed to -represent a batch of examples, where the first dimension is indexed -by example, and all members of `tensors_list[i]` should have the -same size in the first dimension. If an input tensor has shape `[*, x, -y, z]`, the output will have shape `[batch_size, x, y, z]`. - -The `capacity` argument controls the how long the prefetching is allowed to -grow the queues. - -The returned operation is a dequeue operation and will throw -`tf.errors.OutOfRangeError` if the input queue is exhausted. If this -operation is feeding another input queue, its queue runner will catch -this exception, however, if this operation is used in your main thread -you are responsible for catching this yourself. - -If `allow_smaller_final_batch` is `True`, a smaller batch value than -`batch_size` is returned when the queue is closed and there are not enough -elements to fill the batch, otherwise the pending elements are discarded. -In addition, all output tensors' static shapes, as accessed via the -`get_shape` method will have a first `Dimension` value of `None`, and -operations that depend on fixed batch_size would fail. - -##### Args: - - -* `tensors_list`: A list of tuples or dictionaries of tensors to enqueue. -* `batch_size`: An integer. The new batch size pulled from the queue. -* `capacity`: An integer. The maximum number of elements in the queue. -* `min_after_dequeue`: Minimum number elements in the queue after a - dequeue, used to ensure a level of mixing of elements. -* `seed`: Seed for the random shuffling within the queue. -* `enqueue_many`: Whether each tensor in `tensor_list_list` is a single - example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensors_list[i]`. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (optional). If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the same number and types as - `tensors_list[i]`. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensors_list`. - - -- - - - -### `tf.train.maybe_shuffle_batch_join(tensors_list, batch_size, capacity, min_after_dequeue, keep_input, seed=None, enqueue_many=False, shapes=None, allow_smaller_final_batch=False, shared_name=None, name=None)` {#maybe_shuffle_batch_join} - -Create batches by randomly shuffling conditionally-enqueued tensors. - -See docstring in `shuffle_batch_join` for more details. - -##### Args: - - -* `tensors_list`: A list of tuples or dictionaries of tensors to enqueue. -* `batch_size`: An integer. The new batch size pulled from the queue. -* `capacity`: An integer. The maximum number of elements in the queue. -* `min_after_dequeue`: Minimum number elements in the queue after a - dequeue, used to ensure a level of mixing of elements. -* `keep_input`: A `bool` Tensor. This tensor controls whether the input is - added to the queue or not. If it is a scalar and evaluates `True`, then - `tensors` are all added to the queue. If it is a vector and `enqueue_many` - is `True`, then each example is added to the queue only if the - corresonding value in `keep_input` is `True`. This tensor essentially acts - as a filtering mechanism. -* `seed`: Seed for the random shuffling within the queue. -* `enqueue_many`: Whether each tensor in `tensor_list_list` is a single - example. -* `shapes`: (Optional) The shapes for each example. Defaults to the - inferred shapes for `tensors_list[i]`. -* `allow_smaller_final_batch`: (Optional) Boolean. If `True`, allow the final - batch to be smaller if there are insufficient items left in the queue. -* `shared_name`: (optional). If set, this queue will be shared under the given - name across multiple sessions. -* `name`: (Optional) A name for the operations. - -##### Returns: - - A list or dictionary of tensors with the same number and types as - `tensors_list[i]`. - -##### Raises: - - -* `ValueError`: If the `shapes` are not specified, and cannot be - inferred from the elements of `tensors_list`. - - diff --git a/tensorflow/g3doc/api_docs/python/math_ops.md b/tensorflow/g3doc/api_docs/python/math_ops.md deleted file mode 100644 index c6e68117db..0000000000 --- a/tensorflow/g3doc/api_docs/python/math_ops.md +++ /dev/null @@ -1,3672 +0,0 @@ - - -# Math - -Note: Functions taking `Tensor` arguments can also take anything accepted by -[`tf.convert_to_tensor`](framework.md#convert_to_tensor). - -[TOC] - -Basic arithmetic operators. See the @{$python/math_ops} guide. - -- - - - -### `tf.add(x, y, name=None)` {#add} - -Returns x + y element-wise. - -*NOTE*: `Add` supports broadcasting. `AddN` does not. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`, `complex64`, `complex128`, `string`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.subtract(x, y, name=None)` {#subtract} - -Returns x - y element-wise. - -*NOTE*: `tf.subtract` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.multiply(x, y, name=None)` {#multiply} - -Returns x * y element-wise. - -*NOTE*: ``tf.multiply`` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `uint16`, `int16`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.scalar_mul(scalar, x)` {#scalar_mul} - -Multiplies a scalar times a `Tensor` or `IndexedSlices` object. - -Intended for use in gradient code which might deal with `IndexedSlices` -objects, which are easy to multiply by a scalar but more expensive to -multiply with arbitrary tensors. - -##### Args: - - -* `scalar`: A 0-D scalar `Tensor`. Must have known shape. -* `x`: A `Tensor` or `IndexedSlices` to be scaled. - -##### Returns: - - `scalar * x` of the same type (`Tensor` or `IndexedSlices`) as `x`. - -##### Raises: - - -* `ValueError`: if scalar is not a 0-D `scalar`. - - -- - - - -### `tf.div(x, y, name=None)` {#div} - -Divides x / y elementwise (using Python 2 division operator semantics). - -NOTE: Prefer using the Tensor division operator or tf.divide which obey Python -division operator semantics. - -This function divides `x` and `y`, forcing Python 2.7 semantics. That is, -if one of `x` or `y` is a float, then the result will be a float. -Otherwise, the output will be an integer type. Flooring semantics are used -for integer division. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` returns the quotient of x and y. - - -- - - - -### `tf.divide(x, y, name=None)` {#divide} - -Computes Python style division of `x` by `y`. - - -- - - - -### `tf.truediv(x, y, name=None)` {#truediv} - -Divides x / y elementwise (using Python 3 division operator semantics). - -NOTE: Prefer using the Tensor operator or tf.divide which obey Python -division operator semantics. - -This function forces Python 3 division operator semantics where all integer -arguments are cast to floating types first. This op is generated by normal -`x / y` division in Python 3 and in Python 2.7 with -`from __future__ import division`. If you want integer division that rounds -down, use `x // y` or `tf.floordiv`. - -`x` and `y` must have the same numeric type. If the inputs are floating -point, the output will have the same type. If the inputs are integral, the -inputs are cast to `float32` for `int8` and `int16` and `float64` for `int32` -and `int64` (matching the behavior of Numpy). - -##### Args: - - -* `x`: `Tensor` numerator of numeric type. -* `y`: `Tensor` denominator of numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` evaluated in floating point. - -##### Raises: - - -* `TypeError`: If `x` and `y` have different dtypes. - - -- - - - -### `tf.floordiv(x, y, name=None)` {#floordiv} - -Divides `x / y` elementwise, rounding toward the most negative integer. - -The same as `tf.div(x,y)` for integers, but uses `tf.floor(tf.div(x,y))` for -floating point arguments so that the result is always an integer (though -possibly an integer represented as floating point). This op is generated by -`x // y` floor division in Python 3 and in Python 2.7 with -`from __future__ import division`. - -Note that for efficiency, `floordiv` uses C semantics for negative numbers -(unlike Python and Numpy). - -`x` and `y` must have the same type, and the result will have the same type -as well. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` rounded down (except possibly towards zero for negative integers). - -##### Raises: - - -* `TypeError`: If the inputs are complex. - - -- - - - -### `tf.realdiv(x, y, name=None)` {#realdiv} - -Returns x / y element-wise for real types. - -If `x` and `y` are reals, this will return the floating-point division. - -*NOTE*: `Div` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `uint16`, `int16`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.truncatediv(x, y, name=None)` {#truncatediv} - -Returns x / y element-wise for integer types. - -Truncation designates that negative numbers will round fractional quantities -toward zero. I.e. -7 / 5 = 1. This matches C semantics but it is different -than Python semantics. See `FloorDiv` for a division function that matches -Python Semantics. - -*NOTE*: `TruncateDiv` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `uint16`, `int16`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.floor_div(x, y, name=None)` {#floor_div} - -Returns x // y element-wise. - -*NOTE*: `FloorDiv` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `uint16`, `int16`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.truncatemod(x, y, name=None)` {#truncatemod} - -Returns element-wise remainder of division. This emulates C semantics where - -true, this follows C semantics in that the result here is consistent -with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. - -*NOTE*: `Mod` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `float32`, `float64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.floormod(x, y, name=None)` {#floormod} - -Returns element-wise remainder of division. When `x < 0` xor `y < 0` is - -true, this follows Python semantics in that the result here is consistent -with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. - -*NOTE*: `FloorMod` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `float32`, `float64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.mod(x, y, name=None)` {#mod} - -Returns element-wise remainder of division. When `x < 0` xor `y < 0` is - -true, this follows Python semantics in that the result here is consistent -with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. - -*NOTE*: `FloorMod` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `float32`, `float64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.cross(a, b, name=None)` {#cross} - -Compute the pairwise cross product. - -`a` and `b` must be the same shape; they can either be simple 3-element vectors, -or any shape where the innermost dimension is 3. In the latter case, each pair -of corresponding 3-element vectors is cross-multiplied independently. - -##### Args: - - -* `a`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. - A tensor containing 3-element vectors. -* `b`: A `Tensor`. Must have the same type as `a`. - Another tensor, of same type and shape as `a`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `a`. - Pairwise cross product of the vectors in `a` and `b`. - - -- - - - -### `tf.add_n(inputs, name=None)` {#add_n} - -Adds all input tensors element-wise. - -##### Args: - - -* `inputs`: A list of `Tensor` objects, each with same shape and type. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of same shape and type as the elements of `inputs`. - -##### Raises: - - -* `ValueError`: If `inputs` don't all have same shape and dtype or the shape - cannot be inferred. - - -- - - - -### `tf.abs(x, name=None)` {#abs} - -Computes the absolute value of a tensor. - -Given a tensor of real numbers `x`, this operation returns a tensor -containing the absolute value of each element in `x`. For example, if x is -an input element and y is an output element, this operation computes -\\(y = |x|\\). - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor` of type `float32`, `float64`, `int32`, or - `int64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` the same size and type as `x` with absolute - values. - - -- - - - -### `tf.negative(x, name=None)` {#negative} - -Computes numerical negative value element-wise. - -I.e., \(y = -x\). - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. Must be one of the following types: `half`, - `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor`, respectively. Has the same type as `x`. - - -- - - - -### `tf.sign(x, name=None)` {#sign} - -Returns an element-wise indication of the sign of a number. - -`y = sign(x) = -1` if `x < 0`; 0 if `x == 0`; 1 if `x > 0`. - -For complex numbers, `y = sign(x) = x / |x|` if `x != 0`, otherwise `y = 0`. - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. Must be one of the following types: `half`, - `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor`, respectively. Has the same type as `x`. - - -- - - - -### `tf.reciprocal(x, name=None)` {#reciprocal} - -Computes the reciprocal of x element-wise. - -I.e., \\(y = 1 / x\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.square(x, name=None)` {#square} - -Computes square of x element-wise. - -I.e., \(y = x * x = x^2\). - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. Must be one of the following types: `half`, - `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor`. Has the same type as `x`. - - -- - - - -### `tf.round(x, name=None)` {#round} - -Rounds the values of a tensor to the nearest integer, element-wise. - -Rounds half to even. Also known as bankers rounding. If you want to round -according to the current system rounding mode use tf::cint. -For example: - -```python -# 'a' is [0.9, 2.5, 2.3, 1.5, -4.5] -tf.round(a) ==> [ 1.0, 2.0, 2.0, 2.0, -4.0 ] -``` - -##### Args: - - -* `x`: A `Tensor` of type `float32` or `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of same shape and type as `x`. - - -- - - - -### `tf.sqrt(x, name=None)` {#sqrt} - -Computes square root of x element-wise. - -I.e., \(y = \sqrt{x} = x^{1/2}\). - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor`. Must be one of the following types: `half`, - `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor`, respectively. Has the same type as `x`. - - -- - - - -### `tf.rsqrt(x, name=None)` {#rsqrt} - -Computes reciprocal of square root of x element-wise. - -I.e., \\(y = 1 / \sqrt{x}\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.pow(x, y, name=None)` {#pow} - -Computes the power of one value to another. - -Given a tensor `x` and a tensor `y`, this operation computes \\(x^y\\) for -corresponding elements in `x` and `y`. For example: - -``` -# tensor 'x' is [[2, 2], [3, 3]] -# tensor 'y' is [[8, 16], [2, 3]] -tf.pow(x, y) ==> [[256, 65536], [9, 27]] -``` - -##### Args: - - -* `x`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `y`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. - - -- - - - -### `tf.exp(x, name=None)` {#exp} - -Computes exponential of x element-wise. \\(y = e^x\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.expm1(x, name=None)` {#expm1} - -Computes exponential of x - 1 element-wise. - -I.e., \\(y = (\exp x) - 1\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.log(x, name=None)` {#log} - -Computes natural logarithm of x element-wise. - -I.e., \\(y = \log_e x\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.log1p(x, name=None)` {#log1p} - -Computes natural logarithm of (1 + x) element-wise. - -I.e., \\(y = \log_e (1 + x)\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.ceil(x, name=None)` {#ceil} - -Returns element-wise smallest integer in not less than x. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.floor(x, name=None)` {#floor} - -Returns element-wise largest integer not greater than x. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.maximum(x, y, name=None)` {#maximum} - -Returns the max of x and y (i.e. x > y ? x : y) element-wise. - -*NOTE*: `Maximum` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.minimum(x, y, name=None)` {#minimum} - -Returns the min of x and y (i.e. x < y ? x : y) element-wise. - -*NOTE*: `Minimum` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.cos(x, name=None)` {#cos} - -Computes cos of x element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.sin(x, name=None)` {#sin} - -Computes sin of x element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.lbeta(x, name='lbeta')` {#lbeta} - -Computes `ln(|Beta(x)|)`, reducing along the last dimension. - -Given one-dimensional `z = [z_0,...,z_{K-1}]`, we define - -```Beta(z) = \prod_j Gamma(z_j) / Gamma(\sum_j z_j)``` - -And for `n + 1` dimensional `x` with shape `[N1, ..., Nn, K]`, we define -`lbeta(x)[i1, ..., in] = Log(|Beta(x[i1, ..., in, :])|)`. In other words, -the last dimension is treated as the `z` vector. - -Note that if `z = [u, v]`, then -`Beta(z) = int_0^1 t^{u-1} (1 - t)^{v-1} dt`, which defines the traditional -bivariate beta function. - -##### Args: - - -* `x`: A rank `n + 1` `Tensor` with type `float`, or `double`. -* `name`: A name for the operation (optional). - -##### Returns: - - The logarithm of `|Beta(x)|` reducing along the last dimension. - -##### Raises: - - -* `ValueError`: If `x` is empty with rank one or less. - - -- - - - -### `tf.tan(x, name=None)` {#tan} - -Computes tan of x element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.acos(x, name=None)` {#acos} - -Computes acos of x element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.asin(x, name=None)` {#asin} - -Computes asin of x element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.atan(x, name=None)` {#atan} - -Computes atan of x element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.lgamma(x, name=None)` {#lgamma} - -Computes the log of the absolute value of `Gamma(x)` element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.digamma(x, name=None)` {#digamma} - -Computes Psi, the derivative of Lgamma (the log of the absolute value of - -`Gamma(x)`), element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.erf(x, name=None)` {#erf} - -Computes the Gauss error function of `x` element-wise. - -##### Args: - - -* `x`: A `Tensor` of `SparseTensor`. Must be one of the following types: `half`, - `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor`, respectively. Has the same type as `x`. - - -- - - - -### `tf.erfc(x, name=None)` {#erfc} - -Computes the complementary error function of `x` element-wise. - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.squared_difference(x, y, name=None)` {#squared_difference} - -Returns (x - y)(x - y) element-wise. - -*NOTE*: `SquaredDifference` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.igamma(a, x, name=None)` {#igamma} - -Compute the lower regularized incomplete Gamma function `Q(a, x)`. - -The lower regularized incomplete Gamma function is defined as: - -``` -P(a, x) = gamma(a, x) / Gamma(a) = 1 - Q(a, x) -``` -where -``` -gamma(a, x) = int_{0}^{x} t^{a-1} exp(-t) dt -``` -is the lower incomplete Gamma function. - -Note, above `Q(a, x)` (`Igammac`) is the upper regularized complete -Gamma function. - -##### Args: - - -* `a`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `x`: A `Tensor`. Must have the same type as `a`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `a`. - - -- - - - -### `tf.igammac(a, x, name=None)` {#igammac} - -Compute the upper regularized incomplete Gamma function `Q(a, x)`. - -The upper regularized incomplete Gamma function is defined as: - -``` -Q(a, x) = Gamma(a, x) / Gamma(a) = 1 - P(a, x) -``` -where -``` -Gamma(a, x) = int_{x}^{\infty} t^{a-1} exp(-t) dt -``` -is the upper incomplete Gama function. - -Note, above `P(a, x)` (`Igamma`) is the lower regularized complete -Gamma function. - -##### Args: - - -* `a`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `x`: A `Tensor`. Must have the same type as `a`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `a`. - - -- - - - -### `tf.zeta(x, q, name=None)` {#zeta} - -Compute the Hurwitz zeta function \\(\zeta(x, q)\\). - -The Hurwitz zeta function is defined as: - -``` -\zeta(x, q) = \sum_{n=0}^{\infty} (q + n)^{-x} -``` - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `q`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.polygamma(a, x, name=None)` {#polygamma} - -Compute the polygamma function \\(\psi^{(n)}(x)\\). - -The polygamma function is defined as: - -``` -\psi^{(n)}(x) = \frac{d^n}{dx^n} \psi(x) -``` -where \\(\psi(x)\\) is the digamma function. - -##### Args: - - -* `a`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `x`: A `Tensor`. Must have the same type as `a`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `a`. - - -- - - - -### `tf.betainc(a, b, x, name=None)` {#betainc} - -Compute the regularized incomplete beta integral \\(I_x(a, b)\\). - -The regularized incomplete beta integral is defined as: - -``` -I_x(a, b) = \frac{B(x; a, b)}{B(a, b)} -``` -where - -``` -B(x; a, b) = \int_0^x t^{a-1} (1 - t)^{b-1} dt -``` - -is the incomplete beta function and \\(B(a, b)\\) is the *complete* -beta function. - -##### Args: - - -* `a`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `b`: A `Tensor`. Must have the same type as `a`. -* `x`: A `Tensor`. Must have the same type as `a`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `a`. - - -- - - - -### `tf.rint(x, name=None)` {#rint} - -Returns element-wise integer closest to x. - -If the result is midway between two representable values, -the even representable is chosen. -For example: - -``` -rint(-1.5) ==> -2.0 -rint(0.5000001) ==> 1.0 -rint([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) ==> [-2., -2., -0., 0., 2., 2., 2.] -``` - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.diag(diagonal, name=None)` {#diag} - -Returns a diagonal tensor with a given diagonal values. - -Given a `diagonal`, this operation returns a tensor with the `diagonal` and -everything else padded with zeros. The diagonal is computed as follows: - -Assume `diagonal` has dimensions [D1,..., Dk], then the output is a tensor of -rank 2k with dimensions [D1,..., Dk, D1,..., Dk] where: - -`output[i1,..., ik, i1,..., ik] = diagonal[i1, ..., ik]` and 0 everywhere else. - -For example: - -```prettyprint -# 'diagonal' is [1, 2, 3, 4] -tf.diag(diagonal) ==> [[1, 0, 0, 0] - [0, 2, 0, 0] - [0, 0, 3, 0] - [0, 0, 0, 4]] -``` - -##### Args: - - -* `diagonal`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. - Rank k tensor where k is at most 3. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `diagonal`. - - -- - - - -### `tf.diag_part(input, name=None)` {#diag_part} - -Returns the diagonal part of the tensor. - -This operation returns a tensor with the `diagonal` part -of the `input`. The `diagonal` part is computed as follows: - -Assume `input` has dimensions `[D1,..., Dk, D1,..., Dk]`, then the output is a -tensor of rank `k` with dimensions `[D1,..., Dk]` where: - -`diagonal[i1,..., ik] = input[i1, ..., ik, i1,..., ik]`. - -For example: - -```prettyprint -# 'input' is [[1, 0, 0, 0] - [0, 2, 0, 0] - [0, 0, 3, 0] - [0, 0, 0, 4]] - -tf.diag_part(input) ==> [1, 2, 3, 4] -``` - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. - Rank k tensor where k is 2, 4, or 6. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. The extracted diagonal. - - -- - - - -### `tf.trace(x, name=None)` {#trace} - -Compute the trace of a tensor `x`. - -`trace(x)` returns the sum along the main diagonal of each inner-most matrix -in x. If x is of rank `k` with shape `[I, J, K, ..., L, M, N]`, then output -is a tensor of rank `k-2` with dimensions `[I, J, K, ..., L]` where - -`output[i, j, k, ..., l] = trace(x[i, j, i, ..., l, :, :])` - -For example: - -```python -# 'x' is [[1, 2], -# [3, 4]] -tf.trace(x) ==> 5 - -# 'x' is [[1,2,3], -# [4,5,6], -# [7,8,9]] -tf.trace(x) ==> 15 - -# 'x' is [[[1,2,3], -# [4,5,6], -# [7,8,9]], -# [[-1,-2,-3], -# [-4,-5,-6], -# [-7,-8,-9]]] -tf.trace(x) ==> [15,-15] -``` - -##### Args: - - -* `x`: tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - The trace of input tensor. - - -- - - - -### `tf.transpose(a, perm=None, name='transpose')` {#transpose} - -Transposes `a`. Permutes the dimensions according to `perm`. - -The returned tensor's dimension i will correspond to the input dimension -`perm[i]`. If `perm` is not given, it is set to (n-1...0), where n is -the rank of the input tensor. Hence by default, this operation performs a -regular matrix transpose on 2-D input Tensors. - -For example: - -```python -# 'x' is [[1 2 3] -# [4 5 6]] -tf.transpose(x) ==> [[1 4] - [2 5] - [3 6]] - -# Equivalently -tf.transpose(x, perm=[1, 0]) ==> [[1 4] - [2 5] - [3 6]] - -# 'perm' is more useful for n-dimensional tensors, for n > 2 -# 'x' is [[[1 2 3] -# [4 5 6]] -# [[7 8 9] -# [10 11 12]]] -# Take the transpose of the matrices in dimension-0 -tf.transpose(x, perm=[0, 2, 1]) ==> [[[1 4] - [2 5] - [3 6]] - - [[7 10] - [8 11] - [9 12]]] -``` - -##### Args: - - -* `a`: A `Tensor`. -* `perm`: A permutation of the dimensions of `a`. -* `name`: A name for the operation (optional). - -##### Returns: - - A transposed `Tensor`. - - -- - - - -### `tf.eye(num_rows, num_columns=None, batch_shape=None, dtype=tf.float32, name=None)` {#eye} - -Construct an identity matrix, or a batch of matrices. - -```python -# Construct one identity matrix. -tf.eye(2) -==> [[1., 0.], - [0., 1.]] - -# Construct a batch of 3 identity matricies, each 2 x 2. -# batch_identity[i, :, :] is a 2 x 2 identity matrix, i = 0, 1, 2. -batch_identity = tf.eye(2, batch_shape=[3]) - -# Construct one 2 x 3 "identity" matrix -tf.eye(2, num_columns=3) -==> [[ 1., 0., 0.], - [ 0., 1., 0.]] -``` - -##### Args: - - -* `num_rows`: Non-negative `int32` scalar `Tensor` giving the number of rows - in each batch matrix. -* `num_columns`: Optional non-negative `int32` scalar `Tensor` giving the number - of columns in each batch matrix. Defaults to `num_rows`. -* `batch_shape`: `int32` `Tensor`. If provided, returned `Tensor` will have - leading batch dimensions of this shape. -* `dtype`: The type of an element in the resulting `Tensor` -* `name`: A name for this `Op`. Defaults to "eye". - -##### Returns: - - A `Tensor` of shape `batch_shape + [num_rows, num_columns]` - - -- - - - -### `tf.matrix_diag(diagonal, name=None)` {#matrix_diag} - -Returns a batched diagonal tensor with a given batched diagonal values. - -Given a `diagonal`, this operation returns a tensor with the `diagonal` and -everything else padded with zeros. The diagonal is computed as follows: - -Assume `diagonal` has `k` dimensions `[I, J, K, ..., N]`, then the output is a -tensor of rank `k+1` with dimensions [I, J, K, ..., N, N]` where: - -`output[i, j, k, ..., m, n] = 1{m=n} * diagonal[i, j, k, ..., n]`. - -For example: - -```prettyprint -# 'diagonal' is [[1, 2, 3, 4], [5, 6, 7, 8]] - -and diagonal.shape = (2, 4) - -tf.matrix_diag(diagonal) ==> [[[1, 0, 0, 0] - [0, 2, 0, 0] - [0, 0, 3, 0] - [0, 0, 0, 4]], - [[5, 0, 0, 0] - [0, 6, 0, 0] - [0, 0, 7, 0] - [0, 0, 0, 8]]] - -which has shape (2, 4, 4) -``` - -##### Args: - - -* `diagonal`: A `Tensor`. Rank `k`, where `k >= 1`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `diagonal`. - Rank `k+1`, with `output.shape = diagonal.shape + [diagonal.shape[-1]]`. - - -- - - - -### `tf.matrix_diag_part(input, name=None)` {#matrix_diag_part} - -Returns the batched diagonal part of a batched tensor. - -This operation returns a tensor with the `diagonal` part -of the batched `input`. The `diagonal` part is computed as follows: - -Assume `input` has `k` dimensions `[I, J, K, ..., M, N]`, then the output is a -tensor of rank `k - 1` with dimensions `[I, J, K, ..., min(M, N)]` where: - -`diagonal[i, j, k, ..., n] = input[i, j, k, ..., n, n]`. - -The input must be at least a matrix. - -For example: - -```prettyprint -# 'input' is [[[1, 0, 0, 0] - [0, 2, 0, 0] - [0, 0, 3, 0] - [0, 0, 0, 4]], - [[5, 0, 0, 0] - [0, 6, 0, 0] - [0, 0, 7, 0] - [0, 0, 0, 8]]] - -and input.shape = (2, 4, 4) - -tf.matrix_diag_part(input) ==> [[1, 2, 3, 4], [5, 6, 7, 8]] - -which has shape (2, 4) -``` - -##### Args: - - -* `input`: A `Tensor`. Rank `k` tensor where `k >= 2`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - The extracted diagonal(s) having shape - `diagonal.shape = input.shape[:-2] + [min(input.shape[-2:])]`. - - -- - - - -### `tf.matrix_band_part(input, num_lower, num_upper, name=None)` {#matrix_band_part} - -Copy a tensor setting everything outside a central band in each innermost matrix - -to zero. - -The `band` part is computed as follows: -Assume `input` has `k` dimensions `[I, J, K, ..., M, N]`, then the output is a -tensor with the same shape where - -`band[i, j, k, ..., m, n] = in_band(m, n) * input[i, j, k, ..., m, n]`. - -The indicator function - -`in_band(m, n) = (num_lower < 0 || (m-n) <= num_lower)) && - (num_upper < 0 || (n-m) <= num_upper)`. - -For example: - -```prettyprint -# if 'input' is [[ 0, 1, 2, 3] - [-1, 0, 1, 2] - [-2, -1, 0, 1] - [-3, -2, -1, 0]], - -tf.matrix_band_part(input, 1, -1) ==> [[ 0, 1, 2, 3] - [-1, 0, 1, 2] - [ 0, -1, 0, 1] - [ 0, 0, -1, 0]], - -tf.matrix_band_part(input, 2, 1) ==> [[ 0, 1, 0, 0] - [-1, 0, 1, 0] - [-2, -1, 0, 1] - [ 0, -2, -1, 0]] -``` - -Useful special cases: - -```prettyprint - tf.matrix_band_part(input, 0, -1) ==> Upper triangular part. - tf.matrix_band_part(input, -1, 0) ==> Lower triangular part. - tf.matrix_band_part(input, 0, 0) ==> Diagonal. -``` - -##### Args: - - -* `input`: A `Tensor`. Rank `k` tensor. -* `num_lower`: A `Tensor` of type `int64`. - 0-D tensor. Number of subdiagonals to keep. If negative, keep entire - lower triangle. -* `num_upper`: A `Tensor` of type `int64`. - 0-D tensor. Number of superdiagonals to keep. If negative, keep - entire upper triangle. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - Rank `k` tensor of the same shape as input. The extracted banded tensor. - - -- - - - -### `tf.matrix_set_diag(input, diagonal, name=None)` {#matrix_set_diag} - -Returns a batched matrix tensor with new batched diagonal values. - -Given `input` and `diagonal`, this operation returns a tensor with the -same shape and values as `input`, except for the main diagonal of the -innermost matrices. These will be overwritten by the values in `diagonal`. - -The output is computed as follows: - -Assume `input` has `k+1` dimensions `[I, J, K, ..., M, N]` and `diagonal` has -`k` dimensions `[I, J, K, ..., min(M, N)]`. Then the output is a -tensor of rank `k+1` with dimensions `[I, J, K, ..., M, N]` where: - - * `output[i, j, k, ..., m, n] = diagonal[i, j, k, ..., n]` for `m == n`. - * `output[i, j, k, ..., m, n] = input[i, j, k, ..., m, n]` for `m != n`. - -##### Args: - - -* `input`: A `Tensor`. Rank `k+1`, where `k >= 1`. -* `diagonal`: A `Tensor`. Must have the same type as `input`. - Rank `k`, where `k >= 1`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - Rank `k+1`, with `output.shape = input.shape`. - - -- - - - -### `tf.matrix_transpose(a, name='matrix_transpose')` {#matrix_transpose} - -Transposes last two dimensions of tensor `a`. - -For example: - -```python -# Matrix with no batch dimension. -# 'x' is [[1 2 3] -# [4 5 6]] -tf.matrix_transpose(x) ==> [[1 4] - [2 5] - [3 6]] - -# Matrix with two batch dimensions. -# x.shape is [1, 2, 3, 4] -# tf.matrix_transpose(x) is shape [1, 2, 4, 3] -``` - -##### Args: - - -* `a`: A `Tensor` with `rank >= 2`. -* `name`: A name for the operation (optional). - -##### Returns: - - A transposed batch matrix `Tensor`. - -##### Raises: - - -* `ValueError`: If `a` is determined statically to have `rank < 2`. - - -- - - - -### `tf.matmul(a, b, transpose_a=False, transpose_b=False, adjoint_a=False, adjoint_b=False, a_is_sparse=False, b_is_sparse=False, name=None)` {#matmul} - -Multiplies matrix `a` by matrix `b`, producing `a` * `b`. - -The inputs must be matrices (or tensors of rank > 2, representing batches of -matrices), with matching inner dimensions, possibly after transposition. - -Both matrices must be of the same type. The supported types are: -`float16`, `float32`, `float64`, `int32`, `complex64`, `complex128`. - -Either matrix can be transposed or adjointed (conjugated and transposed) on -the fly by setting one of the corresponding flag to `True`. These are `False` -by default. - -If one or both of the matrices contain a lot of zeros, a more efficient -multiplication algorithm can be used by setting the corresponding -`a_is_sparse` or `b_is_sparse` flag to `True`. These are `False` by default. -This optimization is only available for plain matrices (rank-2 tensors) with -datatypes `bfloat16` or `float32`. - -For example: - -```python -# 2-D tensor `a` -a = tf.constant([1, 2, 3, 4, 5, 6], shape=[2, 3]) => [[1. 2. 3.] - [4. 5. 6.]] -# 2-D tensor `b` -b = tf.constant([7, 8, 9, 10, 11, 12], shape=[3, 2]) => [[7. 8.] - [9. 10.] - [11. 12.]] -c = tf.matmul(a, b) => [[58 64] - [139 154]] - - -# 3-D tensor `a` -a = tf.constant(np.arange(1, 13, dtype=np.int32), - shape=[2, 2, 3]) => [[[ 1. 2. 3.] - [ 4. 5. 6.]], - [[ 7. 8. 9.] - [10. 11. 12.]]] - -# 3-D tensor `b` -b = tf.constant(np.arange(13, 25, dtype=np.int32), - shape=[2, 3, 2]) => [[[13. 14.] - [15. 16.] - [17. 18.]], - [[19. 20.] - [21. 22.] - [23. 24.]]] -c = tf.matmul(a, b) => [[[ 94 100] - [229 244]], - [[508 532] - [697 730]]] -``` - -##### Args: - - -* `a`: `Tensor` of type `float16`, `float32`, `float64`, `int32`, `complex64`, - `complex128` and rank > 1. -* `b`: `Tensor` with same type and rank as `a`. -* `transpose_a`: If `True`, `a` is transposed before multiplication. -* `transpose_b`: If `True`, `b` is transposed before multiplication. -* `adjoint_a`: If `True`, `a` is conjugated and transposed before - multiplication. -* `adjoint_b`: If `True`, `b` is conjugated and transposed before - multiplication. -* `a_is_sparse`: If `True`, `a` is treated as a sparse matrix. -* `b_is_sparse`: If `True`, `b` is treated as a sparse matrix. -* `name`: Name for the operation (optional). - -##### Returns: - - A `Tensor` of the same type as `a` and `b` where each inner-most matrix is - the product of the corresponding matrices in `a` and `b`, e.g. if all - transpose or adjoint attributes are `False`: - - `output`[..., i, j] = sum_k (`a`[..., i, k] * `b`[..., k, j]), - for all indices i, j. - - -* `Note`: This is matrix product, not element-wise product. - - -##### Raises: - - -* `ValueError`: If transpose_a and adjoint_a, or transpose_b and adjoint_b - are both set to True. - - -- - - - -### `tf.norm(tensor, ord='euclidean', axis=None, keep_dims=False, name=None)` {#norm} - -Computes the norm of vectors, matrices, and tensors. - -This function can compute 3 different matrix norms (Frobenius, 1-norm, and -inf-norm) and up to 9218868437227405311 different vectors norms. - -##### Args: - - -* `tensor`: `Tensor` of types `float32`, `float64`, `complex64`, `complex128` -* `ord`: Order of the norm. Supported values are 'fro', 'euclidean', `0`, - `1, `2`, `np.inf` and any positive real number yielding the corresponding - p-norm. Default is 'euclidean' which is equivalent to Frobenius norm if - `tensor` is a matrix and equivalent to 2-norm for vectors. - Some restrictions apply, - a) The Frobenius norm `fro` is not defined for vectors, - b) If axis is a 2-tuple (matrix-norm), only 'euclidean', 'fro', `1`, - `np.inf` are supported. - See the description of `axis` on how to compute norms for a batch of - vectors or matrices stored in a tensor. -* `axis`: If `axis` is `None` (the default), the input is considered a vector - and a single vector norm is computed over the entire set of values in the - tensor, i.e. `norm(tensor, ord=ord)` is equivalent to - `norm(reshape(tensor, [-1]), ord=ord)`. - If `axis` is a Python integer, the input is considered a batch of vectors, - and `axis`t determines the axis in `tensor` over which to compute vector - norms. - If `axis` is a 2-tuple of Python integers it is considered a batch of - matrices and `axis` determines the axes in `tensor` over which to compute - a matrix norm. - Negative indices are supported. Example: If you are passing a tensor that - can be either a matrix or a batch of matrices at runtime, pass - `axis=[-2,-1]` instead of `axis=None` to make sure that matrix norms are - computed. -* `keep_dims`: If True, the axis indicated in `axis` are kept with size 1. - Otherwise, the dimensions in `axis` are removed from the output shape. -* `name`: The name of the op. - -##### Returns: - - -* `output`: A `Tensor` of the same type as tensor, containing the vector or - matrix norms. If `keep_dims` is True then the rank of output is equal to - the rank of `tensor`. Otherwise, if `axis` is none the output is a scalar, - if `axis` is an integer, the rank of `output` is one less than the rank - of `tensor`, if `axis` is a 2-tuple the rank of `output` is two less - than the rank of `tensor`. - -##### Raises: - - -* `ValueError`: If `ord` or `axis` is invalid. - -@compatibility(numpy) -Mostly equivalent to numpy.linalg.norm. -Not supported: ord <= 0, 2-norm for matrices, nuclear norm. - -##### Other differences: - - a) If axis is `None`, treats the the flattened `tensor` as a vector - regardless of rank. - b) Explicitly supports 'euclidean' norm as the default, including for - higher order tensors. -@end_compatibility - - -- - - - -### `tf.matrix_determinant(input, name=None)` {#matrix_determinant} - -Computes the determinant of one ore more square matrices. - -The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions -form square matrices. The output is a tensor containing the determinants -for all input submatrices `[..., :, :]`. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`. - Shape is `[..., M, M]`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. Shape is `[...]`. - - -- - - - -### `tf.matrix_inverse(input, adjoint=None, name=None)` {#matrix_inverse} - -Computes the inverse of one or more square invertible matrices or their - -adjoints (conjugate transposes). - -The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions -form square matrices. The output is a tensor of the same shape as the input -containing the inverse for all input submatrices `[..., :, :]`. - -The op uses LU decomposition with partial pivoting to compute the inverses. - -If a matrix is not invertible there is no guarantee what the op does. It -may detect the condition and raise an exception or it may simply return a -garbage result. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float64`, `float32`. - Shape is `[..., M, M]`. -* `adjoint`: An optional `bool`. Defaults to `False`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. Shape is `[..., M, M]`. - - @compatibility(numpy) - Equivalent to np.linalg.inv - @end_compatibility - - -- - - - -### `tf.cholesky(input, name=None)` {#cholesky} - -Computes the Cholesky decomposition of one or more square matrices. - -The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions -form square matrices, with the same constraints as the single matrix Cholesky -decomposition above. The output is a tensor of the same shape as the input -containing the Cholesky decompositions for all input submatrices `[..., :, :]`. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float64`, `float32`. - Shape is `[..., M, M]`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. Shape is `[..., M, M]`. - - -- - - - -### `tf.cholesky_solve(chol, rhs, name=None)` {#cholesky_solve} - -Solves systems of linear eqns `A X = RHS`, given Cholesky factorizations. - -```python -# Solve 10 separate 2x2 linear systems: -A = ... # shape 10 x 2 x 2 -RHS = ... # shape 10 x 2 x 1 -chol = tf.cholesky(A) # shape 10 x 2 x 2 -X = tf.cholesky_solve(chol, RHS) # shape 10 x 2 x 1 -# tf.matmul(A, X) ~ RHS -X[3, :, 0] # Solution to the linear system A[3, :, :] x = RHS[3, :, 0] - -# Solve five linear systems (K = 5) for every member of the length 10 batch. -A = ... # shape 10 x 2 x 2 -RHS = ... # shape 10 x 2 x 5 -... -X[3, :, 2] # Solution to the linear system A[3, :, :] x = RHS[3, :, 2] -``` - -##### Args: - - -* `chol`: A `Tensor`. Must be `float32` or `float64`, shape is `[..., M, M]`. - Cholesky factorization of `A`, e.g. `chol = tf.cholesky(A)`. - For that reason, only the lower triangular parts (including the diagonal) - of the last two dimensions of `chol` are used. The strictly upper part is - assumed to be zero and not accessed. -* `rhs`: A `Tensor`, same type as `chol`, shape is `[..., M, K]`. -* `name`: A name to give this `Op`. Defaults to `cholesky_solve`. - -##### Returns: - - Solution to `A x = rhs`, shape `[..., M, K]`. - - -- - - - -### `tf.matrix_solve(matrix, rhs, adjoint=None, name=None)` {#matrix_solve} - -Solves systems of linear equations. - -`Matrix` is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions -form square matrices. `Rhs` is a tensor of shape `[..., M, K]`. The `output` is -a tensor shape `[..., M, K]`. If `adjoint` is `False` then each output matrix -satisfies `matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]`. -If `adjoint` is `True` then each output matrix satisfies -`adjoint(matrix[..., :, :]) * output[..., :, :] = rhs[..., :, :]`. - -##### Args: - - -* `matrix`: A `Tensor`. Must be one of the following types: `float64`, `float32`, `complex64`, `complex128`. - Shape is `[..., M, M]`. -* `rhs`: A `Tensor`. Must have the same type as `matrix`. - Shape is `[..., M, K]`. -* `adjoint`: An optional `bool`. Defaults to `False`. - Boolean indicating whether to solve with `matrix` or its (block-wise) - adjoint. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `matrix`. Shape is `[..., M, K]`. - - -- - - - -### `tf.matrix_triangular_solve(matrix, rhs, lower=None, adjoint=None, name=None)` {#matrix_triangular_solve} - -Solves systems of linear equations with upper or lower triangular matrices by - -backsubstitution. - -`matrix` is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions form -square matrices. If `lower` is `True` then the strictly upper triangular part -of each inner-most matrix is assumed to be zero and not accessed. -If `lower` is False then the strictly lower triangular part of each inner-most -matrix is assumed to be zero and not accessed. -`rhs` is a tensor of shape `[..., M, K]`. - -The output is a tensor of shape `[..., M, K]`. If `adjoint` is -`True` then the innermost matrices in output` satisfy matrix equations -`matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]`. -If `adjoint` is `False` then the strictly then the innermost matrices in -`output` satisfy matrix equations -`adjoint(matrix[..., i, k]) * output[..., k, j] = rhs[..., i, j]`. - -##### Args: - - -* `matrix`: A `Tensor`. Must be one of the following types: `float64`, `float32`. - Shape is `[..., M, M]`. -* `rhs`: A `Tensor`. Must have the same type as `matrix`. - Shape is `[..., M, K]`. -* `lower`: An optional `bool`. Defaults to `True`. - Boolean indicating whether the innermost matrices in `matrix` are - lower or upper triangular. -* `adjoint`: An optional `bool`. Defaults to `False`. - Boolean indicating whether to solve with `matrix` or its (block-wise) - adjoint. - - @compatibility(numpy) - Equivalent to np.linalg.triangular_solve - @end_compatibility - -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `matrix`. Shape is `[..., M, K]`. - - -- - - - -### `tf.matrix_solve_ls(matrix, rhs, l2_regularizer=0.0, fast=True, name=None)` {#matrix_solve_ls} - -Solves one or more linear least-squares problems. - -`matrix` is a tensor of shape `[..., M, N]` whose inner-most 2 dimensions -form `M`-by-`N` matrices. Rhs is a tensor of shape `[..., M, K]` whose -inner-most 2 dimensions form `M`-by-`K` matrices. The computed output is a -`Tensor` of shape `[..., N, K]` whose inner-most 2 dimensions form `M`-by-`K` -matrices that solve the equations -`matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]` in the least squares -sense. - -Below we will use the following notation for each pair of matrix and -right-hand sides in the batch: - -`matrix`=\\(A \in \Re^{m \times n}\\), -`rhs`=\\(B \in \Re^{m \times k}\\), -`output`=\\(X \in \Re^{n \times k}\\), -`l2_regularizer`=\\(\lambda\\). - -If `fast` is `True`, then the solution is computed by solving the normal -equations using Cholesky decomposition. Specifically, if \\(m \ge n\\) then -\\(X = (A^T A + \lambda I)^{-1} A^T B\\), which solves the least-squares -problem \\(X = \mathrm{argmin}_{Z \in \Re^{n \times k}} ||A Z - B||_F^2 + -\lambda ||Z||_F^2\\). If \\(m \lt n\\) then `output` is computed as -\\(X = A^T (A A^T + \lambda I)^{-1} B\\), which (for \\(\lambda = 0\\)) is -the minimum-norm solution to the under-determined linear system, i.e. -\\(X = \mathrm{argmin}_{Z \in \Re^{n \times k}} ||Z||_F^2 \\), subject to -\\(A Z = B\\). Notice that the fast path is only numerically stable when -\\(A\\) is numerically full rank and has a condition number -\\(\mathrm{cond}(A) \lt \frac{1}{\sqrt{\epsilon_{mach}}}\\) or\\(\lambda\\) -is sufficiently large. - -If `fast` is `False` an algorithm based on the numerically robust complete -orthogonal decomposition is used. This computes the minimum-norm -least-squares solution, even when \\(A\\) is rank deficient. This path is -typically 6-7 times slower than the fast path. If `fast` is `False` then -`l2_regularizer` is ignored. - -##### Args: - - -* `matrix`: `Tensor` of shape `[..., M, N]`. -* `rhs`: `Tensor` of shape `[..., M, K]`. -* `l2_regularizer`: 0-D `double` `Tensor`. Ignored if `fast=False`. -* `fast`: bool. Defaults to `True`. -* `name`: string, optional name of the operation. - -##### Returns: - - -* `output`: `Tensor` of shape `[..., N, K]` whose inner-most 2 dimensions form - `M`-by-`K` matrices that solve the equations - `matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]` in the least - squares sense. - - -- - - - -### `tf.qr(input, full_matrices=None, name=None)` {#qr} - -Computes the QR decompositions of one or more matrices. - -Computes the QR decomposition of each inner matrix in `tensor` such that -`tensor[..., :, :] = q[..., :, :] * r[..., :,:])` - -```prettyprint -# a is a tensor. -# q is a tensor of orthonormal matrices. -# r is a tensor of upper triangular matrices. -q, r = qr(a) -q_full, r_full = qr(a, full_matrices=True) -``` - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float64`, `float32`, `complex64`, `complex128`. - A tensor of shape `[..., M, N]` whose inner-most 2 dimensions - form matrices of size `[M, N]`. Let `P` be the minimum of `M` and `N`. -* `full_matrices`: An optional `bool`. Defaults to `False`. - If true, compute full-sized `q` and `r`. If false - (the default), compute only the leading `P` columns of `q`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (q, r). - -* `q`: A `Tensor`. Has the same type as `input`. Orthonormal basis for range of `a`. If `full_matrices` is `False` then - shape is `[..., M, P]`; if `full_matrices` is `True` then shape is - `[..., M, M]`. -* `r`: A `Tensor`. Has the same type as `input`. Triangular factor. If `full_matrices` is `False` then shape is - `[..., P, N]`. If `full_matrices` is `True` then shape is `[..., M, N]`. - - -- - - - -### `tf.self_adjoint_eig(tensor, name=None)` {#self_adjoint_eig} - -Computes the eigen decomposition of a batch of self-adjoint matrices. - -Computes the eigenvalues and eigenvectors of the innermost N-by-N matrices -in `tensor` such that -`tensor[...,:,:] * v[..., :,i] = e[..., i] * v[...,:,i]`, for i=0...N-1. - -##### Args: - - -* `tensor`: `Tensor` of shape `[..., N, N]`. Only the lower triangular part of - each inner inner matrix is referenced. -* `name`: string, optional name of the operation. - -##### Returns: - - -* `e`: Eigenvalues. Shape is `[..., N]`. -* `v`: Eigenvectors. Shape is `[..., N, N]`. The columns of the inner most - matrices contain eigenvectors of the corresponding matrices in `tensor` - - -- - - - -### `tf.self_adjoint_eigvals(tensor, name=None)` {#self_adjoint_eigvals} - -Computes the eigenvalues of one or more self-adjoint matrices. - -##### Args: - - -* `tensor`: `Tensor` of shape `[..., N, N]`. -* `name`: string, optional name of the operation. - -##### Returns: - - -* `e`: Eigenvalues. Shape is `[..., N]`. The vector `e[..., :]` contains the `N` - eigenvalues of `tensor[..., :, :]`. - - -- - - - -### `tf.svd(tensor, full_matrices=False, compute_uv=True, name=None)` {#svd} - -Computes the singular value decompositions of one or more matrices. - -Computes the SVD of each inner matrix in `tensor` such that -`tensor[..., :, :] = u[..., :, :] * diag(s[..., :, :]) * transpose(v[..., :, -:])` - -```prettyprint -# a is a tensor. -# s is a tensor of singular values. -# u is a tensor of left singular vectors. -#v is a tensor of right singular vectors. -s, u, v = svd(a) -s = svd(a, compute_uv=False) -``` - -##### Args: - - -* `tensor`: `Tensor` of shape `[..., M, N]`. Let `P` be the minimum of `M` and - `N`. -* `full_matrices`: If true, compute full-sized `u` and `v`. If false - (the default), compute only the leading `P` singular vectors. - Ignored if `compute_uv` is `False`. -* `compute_uv`: If `True` then left and right singular vectors will be - computed and returned in `u` and `v`, respectively. Otherwise, only the - singular values will be computed, which can be significantly faster. -* `name`: string, optional name of the operation. - -##### Returns: - - -* `s`: Singular values. Shape is `[..., P]`. -* `u`: Right singular vectors. If `full_matrices` is `False` (default) then - shape is `[..., M, P]`; if `full_matrices` is `True` then shape is - `[..., M, M]`. Not returned if `compute_uv` is `False`. -* `v`: Left singular vectors. If `full_matrices` is `False` (default) then - shape is `[..., N, P]`. If `full_matrices` is `True` then shape is - `[..., N, N]`. Not returned if `compute_uv` is `False`. - -@compatibility(numpy) -Mostly equivalent to numpy.linalg.svd, except that the order of output -arguments here is `s`, `u`, `v` when `compute_uv` is `True`, as opposed to -`u`, `s`, `v` for numpy.linalg.svd. -@end_compatibility - - -- - - - -### `tf.tensordot(a, b, axes, name=None)` {#tensordot} - -Tensor contraction of a and b along specified axes. - -Tensordot (also known as tensor contraction) sums the product of elements -from `a` and `b` over the indices specified by `a_axes` and `b_axes`. -The lists `a_axes` and `b_axes` specify those pairs of axes along which to -contract the tensors. The axis `a_axes[i]` of `a` must have the same dimension -as axis `b_axes[i]` of `b` for all `i` in `range(0, len(a_axes))`. The lists -`a_axes` and `b_axes` must have identical length and consist of unique -integers that specify valid axes for each of the tensors. - -This operation corresponds to `numpy.tensordot(a, b, axes)`. - -Example 1: When `a` and `b` are matrices (order 2), the case `axes = 1` -is equivalent to matrix multiplication. - -Example 2: When `a` and `b` are matrices (order 2), the case -`axes = [[1], [0]]` is equivalent to matrix multiplication. - -Example 3: Suppose that \\(a_ijk\\) and \\(b_lmn\\) represent two -tensors of order 3. Then, `contract(a, b, [0], [2])` is the order 4 tensor -\\(c_{jklm}\\) whose entry -corresponding to the indices \\((j,k,l,m)\\) is given by: - -\\( c_{jklm} = \sum_i a_{ijk} b_{lmi} \\). - -In general, `order(c) = order(a) + order(b) - 2*len(axes[0])`. - -##### Args: - - -* `a`: `Tensor` of type `float32` or `float64`. -* `b`: `Tensor` with the same type as `a`. -* `axes`: Either a scalar `N`, or a list or an `int32` `Tensor` of shape [2, k]. - If axes is a scalar, sum over the last N axes of a and the first N axes - of b in order. - If axes is a list or `Tensor` the first and second row contain the set of - unique integers specifying axes along which the contraction is computed, - for `a` and `b`, respectively. The number of axes for `a` and `b` must - be equal. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` with the same type as `a`. - -##### Raises: - - -* `ValueError`: If the shapes of `a`, `b`, and `axes` are incompatible. -* `IndexError`: If the values in axes exceed the rank of the corresponding - tensor. - - -- - - - -### `tf.complex(real, imag, name=None)` {#complex} - -Converts two real numbers to a complex number. - -Given a tensor `real` representing the real part of a complex number, and a -tensor `imag` representing the imaginary part of a complex number, this -operation returns complex numbers elementwise of the form \\(a + bj\\), where -*a* represents the `real` part and *b* represents the `imag` part. - -The input tensors `real` and `imag` must have the same shape. - -For example: - -``` -# tensor 'real' is [2.25, 3.25] -# tensor `imag` is [4.75, 5.75] -tf.complex(real, imag) ==> [[2.25 + 4.75j], [3.25 + 5.75j]] -``` - -##### Args: - - -* `real`: A `Tensor`. Must be one of the following types: `float32`, - `float64`. -* `imag`: A `Tensor`. Must have the same type as `real`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `complex64` or `complex128`. - - -- - - - -### `tf.conj(x, name=None)` {#conj} - -Returns the complex conjugate of a complex number. - -Given a tensor `input` of complex numbers, this operation returns a tensor of -complex numbers that are the complex conjugate of each element in `input`. The -complex numbers in `input` must be of the form \\(a + bj\\), where *a* is the -real part and *b* is the imaginary part. - -The complex conjugate returned by this operation is of the form \\(a - bj\\). - -For example: - - # tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j] - tf.conj(input) ==> [-2.25 - 4.75j, 3.25 - 5.75j] - -If `x` is real, it is returned unchanged. - -##### Args: - - -* `x`: `Tensor` to conjugate. Must have numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` that is the conjugate of `x` (with the same type). - -##### Raises: - - -* `TypeError`: If `x` is not a numeric tensor. - - -- - - - -### `tf.imag(input, name=None)` {#imag} - -Returns the imaginary part of a complex number. - -Given a tensor `input` of complex numbers, this operation returns a tensor of -type `float32` or `float64` that is the imaginary part of each element in -`input`. All elements in `input` must be complex numbers of the form \(a + -bj\), where *a* is the real part and *b* is the imaginary part returned by -this operation. - -For example: - -``` -# tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j] -tf.imag(input) ==> [4.75, 5.75] -``` - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `complex64`, - `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32` or `float64`. - - -- - - - -### `tf.real(input, name=None)` {#real} - -Returns the real part of a complex number. - -Given a tensor `input` of complex numbers, this operation returns a tensor of -type `float32` or `float64` that is the real part of each element in `input`. -All elements in `input` must be complex numbers of the form \\(a + bj\\), -where *a* is the real part returned by this operation and *b* is the -imaginary part. - -For example: - -``` -# tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j] -tf.real(input) ==> [-2.25, 3.25] -``` - -If `input` is already real, it is returned unchanged. - -##### Args: - - -* `input`: A `Tensor`. Must have numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `float32` or `float64`. - - -- - - - -### `tf.fft(input, name=None)` {#fft} - -Compute the 1-dimensional discrete Fourier Transform over the inner-most - -dimension of `input`. - -##### Args: - - -* `input`: A `Tensor` of type `complex64`. A complex64 tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `complex64`. - A complex64 tensor of the same shape as `input`. The inner-most - dimension of `input` is replaced with its 1D Fourier Transform. - - -- - - - -### `tf.ifft(input, name=None)` {#ifft} - -Compute the inverse 1-dimensional discrete Fourier Transform over the inner-most - -dimension of `input`. - -##### Args: - - -* `input`: A `Tensor` of type `complex64`. A complex64 tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `complex64`. - A complex64 tensor of the same shape as `input`. The inner-most - dimension of `input` is replaced with its inverse 1D Fourier Transform. - - -- - - - -### `tf.fft2d(input, name=None)` {#fft2d} - -Compute the 2-dimensional discrete Fourier Transform over the inner-most - -2 dimensions of `input`. - -##### Args: - - -* `input`: A `Tensor` of type `complex64`. A complex64 tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `complex64`. - A complex64 tensor of the same shape as `input`. The inner-most 2 - dimensions of `input` are replaced with their 2D Fourier Transform. - - @compatibility(numpy) - Equivalent to np.fft2 - @end_compatibility - - -- - - - -### `tf.ifft2d(input, name=None)` {#ifft2d} - -Compute the inverse 2-dimensional discrete Fourier Transform over the inner-most - -2 dimensions of `input`. - -##### Args: - - -* `input`: A `Tensor` of type `complex64`. A complex64 tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `complex64`. - A complex64 tensor of the same shape as `input`. The inner-most 2 - dimensions of `input` are replaced with their inverse 2D Fourier Transform. - - @compatibility(numpy) - Equivalent to np.ifft2 - @end_compatibility - - -- - - - -### `tf.fft3d(input, name=None)` {#fft3d} - -Compute the 3-dimensional discrete Fourier Transform over the inner-most 3 - -dimensions of `input`. - -##### Args: - - -* `input`: A `Tensor` of type `complex64`. A complex64 tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `complex64`. - A complex64 tensor of the same shape as `input`. The inner-most 3 - dimensions of `input` are replaced with their 3D Fourier Transform. - - @compatibility(numpy) - Equivalent to np.fft3 - @end_compatibility - - -- - - - -### `tf.ifft3d(input, name=None)` {#ifft3d} - -Compute the inverse 3-dimensional discrete Fourier Transform over the inner-most - -3 dimensions of `input`. - -##### Args: - - -* `input`: A `Tensor` of type `complex64`. A complex64 tensor. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `complex64`. - A complex64 tensor of the same shape as `input`. The inner-most 3 - dimensions of `input` are replaced with their inverse 3D Fourier Transform. - - @compatibility(numpy) - Equivalent to np.fft3 - @end_compatibility - - -- - - - -### `tf.reduce_sum(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_sum} - -Computes the sum of elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -For example: - -```python -# 'x' is [[1, 1, 1] -# [1, 1, 1]] -tf.reduce_sum(x) ==> 6 -tf.reduce_sum(x, 0) ==> [2, 2, 2] -tf.reduce_sum(x, 1) ==> [3, 3] -tf.reduce_sum(x, 1, keep_dims=True) ==> [[3], [3]] -tf.reduce_sum(x, [0, 1]) ==> 6 -``` - -##### Args: - - -* `input_tensor`: The tensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - -@compatibility(numpy) -Equivalent to np.sum -@end_compatibility - - -- - - - -### `tf.reduce_prod(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_prod} - -Computes the product of elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -##### Args: - - -* `input_tensor`: The tensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - -@compatibility(numpy) -Equivalent to np.prod -@end_compatibility - - -- - - - -### `tf.reduce_min(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_min} - -Computes the minimum of elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -##### Args: - - -* `input_tensor`: The tensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - -@compatibility(numpy) -Equivalent to np.min -@end_compatibility - - -- - - - -### `tf.reduce_max(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_max} - -Computes the maximum of elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -##### Args: - - -* `input_tensor`: The tensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - -@compatibility(numpy) -Equivalent to np.max -@end_compatibility - - -- - - - -### `tf.reduce_mean(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_mean} - -Computes the mean of elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -For example: - -```python -# 'x' is [[1., 1.] -# [2., 2.]] -tf.reduce_mean(x) ==> 1.5 -tf.reduce_mean(x, 0) ==> [1.5, 1.5] -tf.reduce_mean(x, 1) ==> [1., 2.] -``` - -##### Args: - - -* `input_tensor`: The tensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - -@compatibility(numpy) -Equivalent to np.mean -@end_compatibility - - -- - - - -### `tf.reduce_all(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_all} - -Computes the "logical and" of elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -For example: - -```python -# 'x' is [[True, True] -# [False, False]] -tf.reduce_all(x) ==> False -tf.reduce_all(x, 0) ==> [False, False] -tf.reduce_all(x, 1) ==> [True, False] -``` - -##### Args: - - -* `input_tensor`: The boolean tensor to reduce. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - -@compatibility(numpy) -Equivalent to np.all -@end_compatibility - - -- - - - -### `tf.reduce_any(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_any} - -Computes the "logical or" of elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -For example: - -```python -# 'x' is [[True, True] -# [False, False]] -tf.reduce_any(x) ==> True -tf.reduce_any(x, 0) ==> [True, True] -tf.reduce_any(x, 1) ==> [True, False] -``` - -##### Args: - - -* `input_tensor`: The boolean tensor to reduce. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - -@compatibility(numpy) -Equivalent to np.any -@end_compatibility - - -- - - - -### `tf.reduce_logsumexp(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None)` {#reduce_logsumexp} - -Computes log(sum(exp(elements across dimensions of a tensor))). - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -This function is more numerically stable than log(sum(exp(input))). It avoids -overflows caused by taking the exp of large inputs and underflows caused by -taking the log of small inputs. - -For example: - -```python -# 'x' is [[0, 0, 0]] -# [0, 0, 0]] -tf.reduce_logsumexp(x) ==> log(6) -tf.reduce_logsumexp(x, 0) ==> [log(2), log(2), log(2)] -tf.reduce_logsumexp(x, 1) ==> [log(3), log(3)] -tf.reduce_logsumexp(x, 1, keep_dims=True) ==> [[log(3)], [log(3)]] -tf.reduce_logsumexp(x, [0, 1]) ==> log(6) -``` - -##### Args: - - -* `input_tensor`: The tensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor. - - -- - - - -### `tf.count_nonzero(input_tensor, axis=None, keep_dims=False, dtype=tf.int64, name=None, reduction_indices=None)` {#count_nonzero} - -Computes number of nonzero elements across dimensions of a tensor. - -Reduces `input_tensor` along the dimensions given in `axis`. -Unless `keep_dims` is true, the rank of the tensor is reduced by 1 for each -entry in `axis`. If `keep_dims` is true, the reduced dimensions -are retained with length 1. - -If `axis` has no entries, all dimensions are reduced, and a -tensor with a single element is returned. - -**NOTE** Floating point comparison to zero is done by exact floating point -equality check. Small values are **not** rounded to zero for purposes of -the nonzero check. - -For example: - -```python -# 'x' is [[0, 1, 0] -# [1, 1, 0]] -tf.count_nonzero(x) ==> 3 -tf.count_nonzero(x, 0) ==> [1, 2, 0] -tf.count_nonzero(x, 1) ==> [1, 2] -tf.count_nonzero(x, 1, keep_dims=True) ==> [[1], [2]] -tf.count_nonzero(x, [0, 1]) ==> 3 -``` - -##### Args: - - -* `input_tensor`: The tensor to reduce. Should be of numeric type, or `bool`. -* `axis`: The dimensions to reduce. If `None` (the default), - reduces all dimensions. -* `keep_dims`: If true, retains reduced dimensions with length 1. -* `dtype`: The output dtype; defaults to `tf.int64`. -* `name`: A name for the operation (optional). -* `reduction_indices`: The old (deprecated) name for axis. - -##### Returns: - - The reduced tensor (number of nonzero values). - - -- - - - -### `tf.accumulate_n(inputs, shape=None, tensor_dtype=None, name=None)` {#accumulate_n} - -Returns the element-wise sum of a list of tensors. - -Optionally, pass `shape` and `tensor_dtype` for shape and type checking, -otherwise, these are inferred. - -NOTE: This operation is not differentiable and cannot be used if inputs depend -on trainable variables. Please use `tf.add_n` for such cases. - -For example: - -```python -# tensor 'a' is [[1, 2], [3, 4]] -# tensor `b` is [[5, 0], [0, 6]] -tf.accumulate_n([a, b, a]) ==> [[7, 4], [6, 14]] - -# Explicitly pass shape and type -tf.accumulate_n([a, b, a], shape=[2, 2], tensor_dtype=tf.int32) - ==> [[7, 4], [6, 14]] -``` - -##### Args: - - -* `inputs`: A list of `Tensor` objects, each with same shape and type. -* `shape`: Shape of elements of `inputs`. -* `tensor_dtype`: The type of `inputs`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of same shape and type as the elements of `inputs`. - -##### Raises: - - -* `ValueError`: If `inputs` don't all have same shape and dtype or the shape - cannot be inferred. - - -- - - - -### `tf.einsum(equation, *inputs)` {#einsum} - -A generalized contraction between tensors of arbitrary dimension. - -This function returns a tensor whose elements are defined by `equation`, -which is written in a shorthand form inspired by the Einstein summation -convention. As an example, consider multiplying two matrices -A and B to form a matrix C. The elements of C are given by: - -``` - C[i,k] = sum_j A[i,j] * B[j,k] -``` - -The corresponding `equation` is: - -``` - ij,jk->ik -``` - -In general, the `equation` is obtained from the more familiar element-wise -equation by - 1. removing variable names, brackets, and commas, - 2. replacing "*" with ",", - 3. dropping summation signs, and - 4. moving the output to the right, and replacing "=" with "->". - -Many common operations can be expressed in this way. For example: - -```python -# Matrix multiplication ->>> einsum('ij,jk->ik', m0, m1) # output[i,k] = sum_j m0[i,j] * m1[j, k] - -# Dot product ->>> einsum('i,i->', u, v) # output = sum_i u[i]*v[i] - -# Outer product ->>> einsum('i,j->ij', u, v) # output[i,j] = u[i]*v[j] - -# Transpose ->>> einsum('ij->ji', m) # output[j,i] = m[i,j] - -# Batch matrix multiplication ->>> einsum('aij,ajk->aik', s, t) # out[a,i,k] = sum_j s[a,i,j] * t[a, j, k] -``` - -This function behaves like `numpy.einsum`, but does not support: -* Ellipses (subscripts like `ij...,jk...->ik...`) -* Subscripts where an axis appears more than once for a single input - (e.g. `ijj,k->ik`). -* Subscripts that are summed across multiple inputs (e.g., `ij,ij,jk->ik`). - -##### Args: - - -* `equation`: a `str` describing the contraction, in the same format as - `numpy.einsum`. -* `inputs`: the inputs to contract (each one a `Tensor`), whose shapes should - be consistent with `equation`. - -##### Returns: - - The contracted `Tensor`, with shape determined by `equation`. - -##### Raises: - - -* `ValueError`: If - - the format of `equation` is incorrect, - - the number of inputs implied by `equation` does not match `len(inputs)`, - - an axis appears in the output subscripts but not in any of the inputs, - - the number of dimensions of an input differs from the number of - indices in its subscript, or - - the input shapes are inconsistent along a particular axis. - - -- - - - -### `tf.cumsum(x, axis=0, exclusive=False, reverse=False, name=None)` {#cumsum} - -Compute the cumulative sum of the tensor `x` along `axis`. - -By default, this op performs an inclusive cumsum, which means that the first -element of the input is identical to the first element of the output: -```prettyprint -tf.cumsum([a, b, c]) ==> [a, a + b, a + b + c] -``` - -By setting the `exclusive` kwarg to `True`, an exclusive cumsum is performed -instead: -```prettyprint -tf.cumsum([a, b, c], exclusive=True) ==> [0, a, a + b] -``` - -By setting the `reverse` kwarg to `True`, the cumsum is performed in the -opposite direction: -```prettyprint -tf.cumsum([a, b, c], reverse=True) ==> [a + b + c, b + c, c] -``` -This is more efficient than using separate `tf.reverse` ops. - -The `reverse` and `exclusive` kwargs can also be combined: -```prettyprint -tf.cumsum([a, b, c], exclusive=True, reverse=True) ==> [b + c, c, 0] -``` - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, - `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, - `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `axis`: A `Tensor` of type `int32` (default: 0). -* `reverse`: A `bool` (default: False). -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.cumprod(x, axis=0, exclusive=False, reverse=False, name=None)` {#cumprod} - -Compute the cumulative product of the tensor `x` along `axis`. - -By default, this op performs an inclusive cumprod, which means that the -first -element of the input is identical to the first element of the output: -```prettyprint -tf.cumprod([a, b, c]) ==> [a, a * b, a * b * c] -``` - -By setting the `exclusive` kwarg to `True`, an exclusive cumprod is -performed -instead: -```prettyprint -tf.cumprod([a, b, c], exclusive=True) ==> [1, a, a * b] -``` - -By setting the `reverse` kwarg to `True`, the cumprod is performed in the -opposite direction: -```prettyprint -tf.cumprod([a, b, c], reverse=True) ==> [a * b * c, b * c, c] -``` -This is more efficient than using separate `tf.reverse` ops. - -The `reverse` and `exclusive` kwargs can also be combined: -```prettyprint -tf.cumprod([a, b, c], exclusive=True, reverse=True) ==> [b * c, c, 1] -``` - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, - `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, - `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `axis`: A `Tensor` of type `int32` (default: 0). -* `reverse`: A `bool` (default: False). -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -### `tf.segment_sum(data, segment_ids, name=None)` {#segment_sum} - -Computes the sum along segments of a tensor. - -Read [the section on Segmentation](../../api_docs/python/math_ops.md#segmentation) -for an explanation of segments. - -Computes a tensor such that -\\(output_i = \sum_j data_j\\) where sum is over `j` such -that `segment_ids[j] == i`. - -
- -
- -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `segment_ids`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor whose rank is equal to the rank of `data`'s - first dimension. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - - -- - - - -### `tf.segment_prod(data, segment_ids, name=None)` {#segment_prod} - -Computes the product along segments of a tensor. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -Computes a tensor such that -\\(output_i = \prod_j data_j\\) where the product is over `j` such -that `segment_ids[j] == i`. - -
- -
- -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `segment_ids`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor whose rank is equal to the rank of `data`'s - first dimension. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - - -- - - - -### `tf.segment_min(data, segment_ids, name=None)` {#segment_min} - -Computes the minimum along segments of a tensor. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -Computes a tensor such that -\\(output_i = \min_j(data_j)\\) where `min` is over `j` such -that `segment_ids[j] == i`. - -
- -
- -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `segment_ids`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor whose rank is equal to the rank of `data`'s - first dimension. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - - -- - - - -### `tf.segment_max(data, segment_ids, name=None)` {#segment_max} - -Computes the maximum along segments of a tensor. - -Read [the section on Segmentation](../../api_docs/python/math_ops.md#segmentation) -for an explanation of segments. - -Computes a tensor such that -\\(output_i = \max_j(data_j)\\) where `max` is over `j` such -that `segment_ids[j] == i`. - -
- -
- -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `segment_ids`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor whose rank is equal to the rank of `data`'s - first dimension. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - - -- - - - -### `tf.segment_mean(data, segment_ids, name=None)` {#segment_mean} - -Computes the mean along segments of a tensor. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -Computes a tensor such that -\\(output_i = \frac{\sum_j data_j}{N}\\) where `mean` is -over `j` such that `segment_ids[j] == i` and `N` is the total number of -values summed. - -
- -
- -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `segment_ids`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor whose rank is equal to the rank of `data`'s - first dimension. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - - -- - - - -### `tf.unsorted_segment_sum(data, segment_ids, num_segments, name=None)` {#unsorted_segment_sum} - -Computes the sum along segments of a tensor. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -Computes a tensor such that -`(output[i] = sum_{j...} data[j...]` where the sum is over tuples `j...` such -that `segment_ids[j...] == i`. Unlike `SegmentSum`, `segment_ids` -need not be sorted and need not cover all values in the full -range of valid values. - -If the sum is empty for a given segment ID `i`, `output[i] = 0`. - -`num_segments` should equal the number of distinct segment IDs. - -
- -
- -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `segment_ids`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A tensor whose shape is a prefix of `data.shape`. -* `num_segments`: A `Tensor` of type `int32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for the first `segment_ids.rank` - dimensions, which are replaced with a single dimension which has size - `num_segments`. - - -- - - - -### `tf.unsorted_segment_max(data, segment_ids, num_segments, name=None)` {#unsorted_segment_max} - -Computes the Max along segments of a tensor. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -This operator is similar to the [unsorted segment sum operator](../../api_docs/python/math_ops.md#UnsortedSegmentSum). -Instead of computing the sum over segments, it computes the maximum -such that: - -\\(output_i = \max_j data_j\\) where max is over `j` such -that `segment_ids[j] == i`. - -If the maximum is empty for a given segment ID `i`, it outputs the smallest possible value for specific numeric type, - `output[i] = numeric_limits::min()`. - -
- -
- -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `segment_ids`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor whose rank is equal to the rank of `data`'s - first dimension. -* `num_segments`: A `Tensor` of type `int32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `num_segments`. - - -- - - - -### `tf.sparse_segment_sum(data, indices, segment_ids, name=None)` {#sparse_segment_sum} - -Computes the sum along sparse segments of a tensor. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -Like `SegmentSum`, but `segment_ids` can have rank less than `data`'s first -dimension, selecting a subset of dimension 0, specified by `indices`. - -For example: - -```prettyprint -c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]]) - -# Select two rows, one segment. -tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 0])) - ==> [[0 0 0 0]] - -# Select two rows, two segment. -tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 1])) - ==> [[ 1 2 3 4] - [-1 -2 -3 -4]] - -# Select all rows, two segments. -tf.sparse_segment_sum(c, tf.constant([0, 1, 2]), tf.constant([0, 0, 1])) - ==> [[0 0 0 0] - [5 6 7 8]] - -# Which is equivalent to: -tf.segment_sum(c, tf.constant([0, 0, 1])) -``` - -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor. Has same rank as `segment_ids`. -* `segment_ids`: A `Tensor` of type `int32`. - A 1-D tensor. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - - -- - - - -### `tf.sparse_segment_mean(data, indices, segment_ids, name=None)` {#sparse_segment_mean} - -Computes the mean along sparse segments of a tensor. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -Like `SegmentMean`, but `segment_ids` can have rank less than `data`'s first -dimension, selecting a subset of dimension 0, specified by `indices`. - -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor. Has same rank as `segment_ids`. -* `segment_ids`: A `Tensor` of type `int32`. - A 1-D tensor. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - - -- - - - -### `tf.sparse_segment_sqrt_n(data, indices, segment_ids, name=None)` {#sparse_segment_sqrt_n} - -Computes the sum along sparse segments of a tensor divided by the sqrt of N. - -N is the size of the segment being reduced. - -Read [the section on -Segmentation](../../api_docs/python/math_ops.md#segmentation) for an explanation -of segments. - -##### Args: - - -* `data`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A 1-D tensor. Has same rank as `segment_ids`. -* `segment_ids`: A `Tensor` of type `int32`. - A 1-D tensor. Values should be sorted and can be repeated. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `data`. - Has same shape as data, except for dimension 0 which - has size `k`, the number of segments. - - -- - - - -### `tf.argmin(input, axis=None, name=None, dimension=None)` {#argmin} - -Returns the index with the smallest value across axes of a tensor. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `axis`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - int32, 0 <= axis < rank(input). Describes which axis - of the input Tensor to reduce across. For vectors, use axis = 0. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `int64`. - - -- - - - -### `tf.argmax(input, axis=None, name=None, dimension=None)` {#argmax} - -Returns the index with the largest value across axes of a tensor. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. -* `axis`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - int32, 0 <= axis < rank(input). Describes which axis - of the input Tensor to reduce across. For vectors, use axis = 0. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `int64`. - - -- - - - -### `tf.setdiff1d(x, y, index_dtype=tf.int32, name=None)` {#setdiff1d} - -Computes the difference between two lists of numbers or strings. - -Given a list `x` and a list `y`, this operation returns a list `out` that -represents all values that are in `x` but not in `y`. The returned list `out` -is sorted in the same order that the numbers appear in `x` (duplicates are -preserved). This operation also returns a list `idx` that represents the -position of each `out` element in `x`. In other words: - -`out[i] = x[idx[i]] for i in [0, 1, ..., len(out) - 1]` - -For example, given this input: - -```prettyprint -x = [1, 2, 3, 4, 5, 6] -y = [1, 3, 5] -``` - -This operation would return: - -```prettyprint -out ==> [2, 4, 6] -idx ==> [1, 3, 5] -``` - -##### Args: - - -* `x`: A `Tensor`. 1-D. Values to keep. -* `y`: A `Tensor`. Must have the same type as `x`. 1-D. Values to remove. -* `out_idx`: An optional `tf.DType` from: `tf.int32, tf.int64`. Defaults to `tf.int32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (out, idx). - -* `out`: A `Tensor`. Has the same type as `x`. 1-D. Values present in `x` but not in `y`. -* `idx`: A `Tensor` of type `out_idx`. 1-D. Positions of `x` values preserved in `out`. - - -- - - - -### `tf.where(condition, x=None, y=None, name=None)` {#where} - -Return the elements, either from `x` or `y`, depending on the `condition`. - -If both `x` and `y` are None, then this operation returns the coordinates of -true elements of `condition`. The coordinates are returned in a 2-D tensor -where the first dimension (rows) represents the number of true elements, and -the second dimension (columns) represents the coordinates of the true -elements. Keep in mind, the shape of the output tensor can vary depending on -how many true values there are in input. Indices are output in row-major -order. - -If both non-None, `x` and `y` must have the same shape. -The `condition` tensor must be a scalar if `x` and `y` are scalar. -If `x` and `y` are vectors or higher rank, then `condition` must be either a -vector with size matching the first dimension of `x`, or must have the same -shape as `x`. - -The `condition` tensor acts as a mask that chooses, based on the value at each -element, whether the corresponding element / row in the output should be taken -from `x` (if true) or `y` (if false). - -If `condition` is a vector and `x` and `y` are higher rank matrices, then it -chooses which row (outer dimension) to copy from `x` and `y`. If `condition` -has the same shape as `x` and `y`, then it chooses which element to copy from -`x` and `y`. - -##### Args: - - -* `condition`: A `Tensor` of type `bool` -* `x`: A Tensor which may have the same shape as `condition`. If `condition` is - rank 1, `x` may have higher rank, but its first dimension must match the - size of `condition`. -* `y`: A `tensor` with the same shape and type as `x`. -* `name`: A name of the operation (optional) - -##### Returns: - - A `Tensor` with the same type and shape as `x`, `y` if they are non-None. - A `Tensor` with shape `(num_true, dim_size(condition))`. - -##### Raises: - - -* `ValueError`: When exactly one of `x` or `y` is non-None. - - -- - - - -### `tf.unique(x, out_idx=None, name=None)` {#unique} - -Finds unique elements in a 1-D tensor. - -This operation returns a tensor `y` containing all of the unique elements of `x` -sorted in the same order that they occur in `x`. This operation also returns a -tensor `idx` the same size as `x` that contains the index of each value of `x` -in the unique output `y`. In other words: - -`y[idx[i]] = x[i] for i in [0, 1,...,rank(x) - 1]` - -For example: - -```prettyprint -# tensor 'x' is [1, 1, 2, 4, 4, 4, 7, 8, 8] -y, idx = unique(x) -y ==> [1, 2, 4, 7, 8] -idx ==> [0, 0, 1, 2, 2, 2, 3, 4, 4] -``` - -##### Args: - - -* `x`: A `Tensor`. 1-D. -* `out_idx`: An optional `tf.DType` from: `tf.int32, tf.int64`. Defaults to `tf.int32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (y, idx). - -* `y`: A `Tensor`. Has the same type as `x`. 1-D. -* `idx`: A `Tensor` of type `out_idx`. 1-D. - - -- - - - -### `tf.edit_distance(hypothesis, truth, normalize=True, name='edit_distance')` {#edit_distance} - -Computes the Levenshtein distance between sequences. - -This operation takes variable-length sequences (`hypothesis` and `truth`), -each provided as a `SparseTensor`, and computes the Levenshtein distance. -You can normalize the edit distance by length of `truth` by setting -`normalize` to true. - -For example, given the following input: - -```python -# 'hypothesis' is a tensor of shape `[2, 1]` with variable-length values: -# (0,0) = ["a"] -# (1,0) = ["b"] -hypothesis = tf.SparseTensor( - [[0, 0, 0], - [1, 0, 0]], - ["a", "b"] - (2, 1, 1)) - -# 'truth' is a tensor of shape `[2, 2]` with variable-length values: -# (0,0) = [] -# (0,1) = ["a"] -# (1,0) = ["b", "c"] -# (1,1) = ["a"] -truth = tf.SparseTensor( - [[0, 1, 0], - [1, 0, 0], - [1, 0, 1], - [1, 1, 0]] - ["a", "b", "c", "a"], - (2, 2, 2)) - -normalize = True -``` - -This operation would return the following: - -```python -# 'output' is a tensor of shape `[2, 2]` with edit distances normalized -# by 'truth' lengths. -output ==> [[inf, 1.0], # (0,0): no truth, (0,1): no hypothesis - [0.5, 1.0]] # (1,0): addition, (1,1): no hypothesis -``` - -##### Args: - - -* `hypothesis`: A `SparseTensor` containing hypothesis sequences. -* `truth`: A `SparseTensor` containing truth sequences. -* `normalize`: A `bool`. If `True`, normalizes the Levenshtein distance by - length of `truth.` -* `name`: A name for the operation (optional). - -##### Returns: - - A dense `Tensor` with rank `R - 1`, where R is the rank of the - `SparseTensor` inputs `hypothesis` and `truth`. - -##### Raises: - - -* `TypeError`: If either `hypothesis` or `truth` are not a `SparseTensor`. - - -- - - - -### `tf.invert_permutation(x, name=None)` {#invert_permutation} - -Computes the inverse permutation of a tensor. - -This operation computes the inverse of an index permutation. It takes a 1-D -integer tensor `x`, which represents the indices of a zero-based array, and -swaps each value with its index position. In other words, for an output tensor -`y` and an input tensor `x`, this operation computes the following: - -`y[x[i]] = i for i in [0, 1, ..., len(x) - 1]` - -The values must include 0. There can be no duplicate values or negative values. - -For example: - -```prettyprint -# tensor `x` is [3, 4, 0, 2, 1] -invert_permutation(x) ==> [2, 4, 3, 0, 1] -``` - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`. 1-D. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. 1-D. - - diff --git a/tensorflow/g3doc/api_docs/python/nn.md b/tensorflow/g3doc/api_docs/python/nn.md deleted file mode 100644 index cda8959391..0000000000 --- a/tensorflow/g3doc/api_docs/python/nn.md +++ /dev/null @@ -1,3634 +0,0 @@ - - -# Neural Network - -Note: Functions taking `Tensor` arguments can also take anything accepted by -[`tf.convert_to_tensor`](framework.md#convert_to_tensor). - -[TOC] - -## Neural network support. See the @{$python/nn} guide. - -- - - - -### `tf.nn.relu(features, name=None)` {#relu} - -Computes rectified linear: `max(features, 0)`. - -##### Args: - - -* `features`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `features`. - - -- - - - -### `tf.nn.relu6(features, name=None)` {#relu6} - -Computes Rectified Linear 6: `min(max(features, 0), 6)`. - -##### Args: - - -* `features`: A `Tensor` with type `float`, `double`, `int32`, `int64`, `uint8`, - `int16`, or `int8`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` with the same type as `features`. - - -- - - - -### `tf.nn.crelu(features, name=None)` {#crelu} - -Computes Concatenated ReLU. - -Concatenates a ReLU which selects only the positive part of the activation -with a ReLU which selects only the *negative* part of the activation. -Note that as a result this non-linearity doubles the depth of the activations. -Source: https://arxiv.org/abs/1603.05201 - -##### Args: - - -* `features`: A `Tensor` with type `float`, `double`, `int32`, `int64`, `uint8`, - `int16`, or `int8`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` with the same type as `features`. - - -- - - - -### `tf.nn.elu(features, name=None)` {#elu} - -Computes exponential linear: `exp(features) - 1` if < 0, `features` otherwise. - -See [Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs) -](http://arxiv.org/abs/1511.07289) - -##### Args: - - -* `features`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `features`. - - -- - - - -### `tf.nn.softplus(features, name=None)` {#softplus} - -Computes softplus: `log(exp(features) + 1)`. - -##### Args: - - -* `features`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `features`. - - -- - - - -### `tf.nn.softsign(features, name=None)` {#softsign} - -Computes softsign: `features / (abs(features) + 1)`. - -##### Args: - - -* `features`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `features`. - - -- - - - -### `tf.nn.dropout(x, keep_prob, noise_shape=None, seed=None, name=None)` {#dropout} - -Computes dropout. - -With probability `keep_prob`, outputs the input element scaled up by -`1 / keep_prob`, otherwise outputs `0`. The scaling is so that the expected -sum is unchanged. - -By default, each element is kept or dropped independently. If `noise_shape` -is specified, it must be -[broadcastable](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) -to the shape of `x`, and only dimensions with `noise_shape[i] == shape(x)[i]` -will make independent decisions. For example, if `shape(x) = [k, l, m, n]` -and `noise_shape = [k, 1, 1, n]`, each batch and channel component will be -kept independently and each row and column will be kept or not kept together. - -##### Args: - - -* `x`: A tensor. -* `keep_prob`: A scalar `Tensor` with the same type as x. The probability - that each element is kept. -* `noise_shape`: A 1-D `Tensor` of type `int32`, representing the - shape for randomly generated keep/drop flags. -* `seed`: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -* `name`: A name for this operation (optional). - -##### Returns: - - A Tensor of the same shape of `x`. - -##### Raises: - - -* `ValueError`: If `keep_prob` is not in `(0, 1]`. - - -- - - - -### `tf.nn.bias_add(value, bias, data_format=None, name=None)` {#bias_add} - -Adds `bias` to `value`. - -This is (mostly) a special case of `tf.add` where `bias` is restricted to 1-D. -Broadcasting is supported, so `value` may have any number of dimensions. -Unlike `tf.add`, the type of `bias` is allowed to differ from `value` in the -case where both types are quantized. - -##### Args: - - -* `value`: A `Tensor` with type `float`, `double`, `int64`, `int32`, `uint8`, - `int16`, `int8`, `complex64`, or `complex128`. -* `bias`: A 1-D `Tensor` with size matching the last dimension of `value`. - Must be the same type as `value` unless `value` is a quantized type, - in which case a different quantized type may be used. -* `data_format`: A string. 'NHWC' and 'NCHW' are supported. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` with the same type as `value`. - - -- - - - -### `tf.sigmoid(x, name=None)` {#sigmoid} - -Computes sigmoid of `x` element-wise. - -Specifically, `y = 1 / (1 + exp(-x))`. - -##### Args: - - -* `x`: A Tensor with type `float32`, `float64`, `int32`, `complex64`, `int64`, - or `qint32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A Tensor with the same type as `x` if `x.dtype != qint32` - otherwise the return type is `quint8`. - -@compatibility(numpy) -Equivalent to np.scipy.special.expit -@end_compatibility - - -- - - - -### `tf.tanh(x, name=None)` {#tanh} - -Computes hyperbolic tangent of `x` element-wise. - -##### Args: - - -* `x`: A Tensor or SparseTensor with type `float`, `double`, `int32`, - `complex64`, `int64`, or `qint32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A Tensor or SparseTensor respectively with the same type as `x` if - `x.dtype != qint32` otherwise the return type is `quint8`. - - -- - - - -### `tf.nn.convolution(input, filter, padding, strides=None, dilation_rate=None, name=None, data_format=None)` {#convolution} - -Computes sums of N-D convolutions (actually cross-correlation). - -This also supports either output striding via the optional `strides` parameter -or atrous convolution (also known as convolution with holes or dilated -convolution, based on the French word "trous" meaning holes in English) via -the optional `dilation_rate` parameter. Currently, however, output striding -is not supported for atrous convolutions. - -Specifically, in the case that `data_format` does not start with "NC", given -a rank (N+2) `input` Tensor of shape - - [num_batches, - input_spatial_shape[0], - ..., - input_spatial_shape[N-1], - num_input_channels], - -a rank (N+2) `filter` Tensor of shape - - [spatial_filter_shape[0], - ..., - spatial_filter_shape[N-1], - num_input_channels, - num_output_channels], - -an optional `dilation_rate` tensor of shape [N] (defaulting to [1]*N) -specifying the filter upsampling/input downsampling rate, and an optional list -of N `strides` (defaulting [1]*N), this computes for each N-D spatial output -position (x[0], ..., x[N-1]): - - output[b, x[0], ..., x[N-1], k] = - - sum_{z[0], ..., z[N-1], q} - - filter[z[0], ..., z[N-1], q, k] * - padded_input[b, - x[0]*strides[0] + dilation_rate[0]*z[0], - ..., - x[N-1]*strides[N-1] + dilation_rate[N-1]*z[N-1], - q] - -where `padded_input` is obtained by zero padding the input using an effective -spatial filter shape of `(spatial_filter_shape-1) * dilation_rate + 1` and -output striding `strides` as described in the -[comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution). - -In the case that `data_format` does start with `"NC"`, the `input` and output -(but not the `filter`) are simply transposed as follows: - - convolution(input, data_format, **kwargs) = - tf.transpose(convolution(tf.transpose(input, [0] + range(2,N+2) + [1]), - **kwargs), - [0, N+1] + range(1, N+1)) - -It is required that 1 <= N <= 3. - -##### Args: - - -* `input`: An N-D `Tensor` of type `T`, of shape - `[batch_size] + input_spatial_shape + [in_channels]` if data_format does - not start with "NC" (default), or - `[batch_size, in_channels] + input_spatial_shape` if data_format starts - with "NC". -* `filter`: An N-D `Tensor` with the same type as `input` and shape - `spatial_filter_shape + [in_channels, out_channels]`. -* `padding`: A string, either `"VALID"` or `"SAME"`. The padding algorithm. -* `strides`: Optional. Sequence of N ints >= 1. Specifies the output stride. - Defaults to [1]*N. If any value of strides is > 1, then all values of - dilation_rate must be 1. -* `dilation_rate`: Optional. Sequence of N ints >= 1. Specifies the filter - upsampling/input downsampling rate. In the literature, the same parameter - is sometimes called `input stride` or `dilation`. The effective filter - size used for the convolution will be `spatial_filter_shape + - (spatial_filter_shape - 1) * (rate - 1)`, obtained by inserting - (dilation_rate[i]-1) zeros between consecutive elements of the original - filter in each spatial dimension i. If any value of dilation_rate is > 1, - then all values of strides must be 1. -* `name`: Optional name for the returned tensor. -* `data_format`: A string or None. Specifies whether the channel dimension of - the `input` and output is the last dimension (default, or if `data_format` - does not start with "NC"), or the second dimension (if `data_format` - starts with "NC"). For N=1, the valid values are "NWC" (default) and - "NCW". For N=2, the valid values are "NHWC" (default) and "NCHW". For - N=3, the valid value is "NDHWC". - -##### Returns: - - A `Tensor` with the same type as `input` of shape - - `[batch_size] + output_spatial_shape + [out_channels]` - - if data_format is None or does not start with "NC", or - - `[batch_size, out_channels] + output_spatial_shape` - - if data_format starts with "NC", - where `output_spatial_shape` depends on the value of `padding`. - - If padding == "SAME": - output_spatial_shape[i] = ceil(input_spatial_shape[i] / strides[i]) - - If padding == "VALID": - output_spatial_shape[i] = - ceil((input_spatial_shape[i] - - (spatial_filter_shape[i]-1) * dilation_rate[i]) - / strides[i]). - -##### Raises: - - -* `ValueError`: If input/output depth does not match `filter` shape, if padding - is other than `"VALID"` or `"SAME"`, or if data_format is invalid. - - -- - - - -### `tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, data_format=None, name=None)` {#conv2d} - -Computes a 2-D convolution given 4-D `input` and `filter` tensors. - -Given an input tensor of shape `[batch, in_height, in_width, in_channels]` -and a filter / kernel tensor of shape -`[filter_height, filter_width, in_channels, out_channels]`, this op -performs the following: - -1. Flattens the filter to a 2-D matrix with shape - `[filter_height * filter_width * in_channels, output_channels]`. -2. Extracts image patches from the input tensor to form a *virtual* - tensor of shape `[batch, out_height, out_width, - filter_height * filter_width * in_channels]`. -3. For each patch, right-multiplies the filter matrix and the image patch - vector. - -In detail, with the default NHWC format, - - output[b, i, j, k] = - sum_{di, dj, q} input[b, strides[1] * i + di, strides[2] * j + dj, q] * - filter[di, dj, q, k] - -Must have `strides[0] = strides[3] = 1`. For the most common case of the same -horizontal and vertices strides, `strides = [1, stride, stride, 1]`. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. -* `filter`: A `Tensor`. Must have the same type as `input`. -* `strides`: A list of `ints`. - 1-D of length 4. The stride of the sliding window for each dimension - of `input`. Must be in the same order as the dimension specified with format. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `use_cudnn_on_gpu`: An optional `bool`. Defaults to `True`. -* `data_format`: An optional `string` from: `"NHWC", "NCHW"`. Defaults to `"NHWC"`. - Specify the data format of the input and output data. With the - default format "NHWC", the data is stored in the order of: - [batch, in_height, in_width, in_channels]. - Alternatively, the format could be "NCHW", the data storage order of: - [batch, in_channels, in_height, in_width]. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - - -- - - - -### `tf.nn.depthwise_conv2d(input, filter, strides, padding, rate=None, name=None)` {#depthwise_conv2d} - -Depthwise 2-D convolution. - -Given an input tensor of shape `[batch, in_height, in_width, in_channels]` -and a filter tensor of shape -`[filter_height, filter_width, in_channels, channel_multiplier]` -containing `in_channels` convolutional filters of depth 1, `depthwise_conv2d` -applies a different filter to each input channel (expanding from 1 channel -to `channel_multiplier` channels for each), then concatenates the results -together. The output has `in_channels * channel_multiplier` channels. - -In detail, - - output[b, i, j, k * channel_multiplier + q] = sum_{di, dj} - filter[di, dj, k, q] * input[b, strides[1] * i + rate[0] * di, - strides[2] * j + rate[1] * dj, k] - -Must have `strides[0] = strides[3] = 1`. For the most common case of the -same horizontal and vertical strides, `strides = [1, stride, stride, 1]`. -If any value in `rate` is greater than 1, we perform atrous depthwise -convolution, in which case all values in the `strides` tensor must be equal -to 1. - -##### Args: - - -* `input`: 4-D with shape `[batch, in_height, in_width, in_channels]`. -* `filter`: 4-D with shape - `[filter_height, filter_width, in_channels, channel_multiplier]`. -* `strides`: 1-D of size 4. The stride of the sliding window for each - dimension of `input`. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. - See the [comment - here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `rate`: 1-D of size 2. The dilation rate in which we sample input values - across the `height` and `width` dimensions in atrous convolution. If it is - greater than 1, then all values of strides must be 1. -* `name`: A name for this operation (optional). - -##### Returns: - - A 4-D `Tensor` of shape - `[batch, out_height, out_width, in_channels * channel_multiplier].` - - -- - - - -### `tf.nn.depthwise_conv2d_native(input, filter, strides, padding, name=None)` {#depthwise_conv2d_native} - -Computes a 2-D depthwise convolution given 4-D `input` and `filter` tensors. - -Given an input tensor of shape `[batch, in_height, in_width, in_channels]` -and a filter / kernel tensor of shape -`[filter_height, filter_width, in_channels, channel_multiplier]`, containing -`in_channels` convolutional filters of depth 1, `depthwise_conv2d` applies -a different filter to each input channel (expanding from 1 channel to -`channel_multiplier` channels for each), then concatenates the results -together. Thus, the output has `in_channels * channel_multiplier` channels. - -for k in 0..in_channels-1 - for q in 0..channel_multiplier-1 - output[b, i, j, k * channel_multiplier + q] = - sum_{di, dj} input[b, strides[1] * i + di, strides[2] * j + dj, k] * - filter[di, dj, k, q] - -Must have `strides[0] = strides[3] = 1`. For the most common case of the same -horizontal and vertices strides, `strides = [1, stride, stride, 1]`. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`. -* `filter`: A `Tensor`. Must have the same type as `input`. -* `strides`: A list of `ints`. - 1-D of length 4. The stride of the sliding window for each dimension - of `input`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - - -- - - - -### `tf.nn.separable_conv2d(input, depthwise_filter, pointwise_filter, strides, padding, rate=None, name=None)` {#separable_conv2d} - -2-D convolution with separable filters. - -Performs a depthwise convolution that acts separately on channels followed by -a pointwise convolution that mixes channels. Note that this is separability -between dimensions `[1, 2]` and `3`, not spatial separability between -dimensions `1` and `2`. - -In detail, - - output[b, i, j, k] = sum_{di, dj, q, r] - input[b, strides[1] * i + di, strides[2] * j + dj, q] * - depthwise_filter[di, dj, q, r] * - pointwise_filter[0, 0, q * channel_multiplier + r, k] - -`strides` controls the strides for the depthwise convolution only, since -the pointwise convolution has implicit strides of `[1, 1, 1, 1]`. Must have -`strides[0] = strides[3] = 1`. For the most common case of the same -horizontal and vertical strides, `strides = [1, stride, stride, 1]`. -If any value in `rate` is greater than 1, we perform atrous depthwise -convolution, in which case all values in the `strides` tensor must be equal -to 1. - -##### Args: - - -* `input`: 4-D `Tensor` with shape `[batch, in_height, in_width, in_channels]`. -* `depthwise_filter`: 4-D `Tensor` with shape - `[filter_height, filter_width, in_channels, channel_multiplier]`. - Contains `in_channels` convolutional filters of depth 1. -* `pointwise_filter`: 4-D `Tensor` with shape - `[1, 1, channel_multiplier * in_channels, out_channels]`. Pointwise - filter to mix channels after `depthwise_filter` has convolved spatially. -* `strides`: 1-D of size 4. The strides for the depthwise convolution for - each dimension of `input`. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. - See the [comment - here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `rate`: 1-D of size 2. The dilation rate in which we sample input values - across the `height` and `width` dimensions in atrous convolution. If it is - greater than 1, then all values of strides must be 1. -* `name`: A name for this operation (optional). - -##### Returns: - - A 4-D `Tensor` of shape `[batch, out_height, out_width, out_channels]`. - -##### Raises: - - -* `ValueError`: If channel_multiplier * in_channels > out_channels, - which means that the separable convolution is overparameterized. - - -- - - - -### `tf.nn.atrous_conv2d(value, filters, rate, padding, name=None)` {#atrous_conv2d} - -Atrous convolution (a.k.a. convolution with holes or dilated convolution). - -Computes a 2-D atrous convolution, also known as convolution with holes or -dilated convolution, given 4-D `value` and `filters` tensors. If the `rate` -parameter is equal to one, it performs regular 2-D convolution. If the `rate` -parameter is greater than one, it performs convolution with holes, sampling -the input values every `rate` pixels in the `height` and `width` dimensions. -This is equivalent to convolving the input with a set of upsampled filters, -produced by inserting `rate - 1` zeros between two consecutive values of the -filters along the `height` and `width` dimensions, hence the name atrous -convolution or convolution with holes (the French word trous means holes in -English). - -More specifically: - - output[b, i, j, k] = sum_{di, dj, q} filters[di, dj, q, k] * - value[b, i + rate * di, j + rate * dj, q] - -Atrous convolution allows us to explicitly control how densely to compute -feature responses in fully convolutional networks. Used in conjunction with -bilinear interpolation, it offers an alternative to `conv2d_transpose` in -dense prediction tasks such as semantic image segmentation, optical flow -computation, or depth estimation. It also allows us to effectively enlarge -the field of view of filters without increasing the number of parameters or -the amount of computation. - -For a description of atrous convolution and how it can be used for dense -feature extraction, please see: [Semantic Image Segmentation with Deep -Convolutional Nets and Fully Connected CRFs](http://arxiv.org/abs/1412.7062). -The same operation is investigated further in [Multi-Scale Context Aggregation -by Dilated Convolutions](http://arxiv.org/abs/1511.07122). Previous works -that effectively use atrous convolution in different ways are, among others, -[OverFeat: Integrated Recognition, Localization and Detection using -Convolutional Networks](http://arxiv.org/abs/1312.6229) and [Fast Image -Scanning with Deep Max-Pooling Convolutional Neural Networks](http://arxiv.org/abs/1302.1700). -Atrous convolution is also closely related to the so-called noble identities -in multi-rate signal processing. - -There are many different ways to implement atrous convolution (see the refs -above). The implementation here reduces - -```python - atrous_conv2d(value, filters, rate, padding=padding) -``` - -to the following three operations: - -```python - paddings = ... - net = space_to_batch(value, paddings, block_size=rate) - net = conv2d(net, filters, strides=[1, 1, 1, 1], padding="VALID") - crops = ... - net = batch_to_space(net, crops, block_size=rate) -``` - -Advanced usage. Note the following optimization: A sequence of `atrous_conv2d` -operations with identical `rate` parameters, 'SAME' `padding`, and filters -with odd heights/ widths: - -```python - net = atrous_conv2d(net, filters1, rate, padding="SAME") - net = atrous_conv2d(net, filters2, rate, padding="SAME") - ... - net = atrous_conv2d(net, filtersK, rate, padding="SAME") -``` - -can be equivalently performed cheaper in terms of computation and memory as: - -```python - pad = ... # padding so that the input dims are multiples of rate - net = space_to_batch(net, paddings=pad, block_size=rate) - net = conv2d(net, filters1, strides=[1, 1, 1, 1], padding="SAME") - net = conv2d(net, filters2, strides=[1, 1, 1, 1], padding="SAME") - ... - net = conv2d(net, filtersK, strides=[1, 1, 1, 1], padding="SAME") - net = batch_to_space(net, crops=pad, block_size=rate) -``` - -because a pair of consecutive `space_to_batch` and `batch_to_space` ops with -the same `block_size` cancel out when their respective `paddings` and `crops` -inputs are identical. - -##### Args: - - -* `value`: A 4-D `Tensor` of type `float`. It needs to be in the default "NHWC" - format. Its shape is `[batch, in_height, in_width, in_channels]`. -* `filters`: A 4-D `Tensor` with the same type as `value` and shape - `[filter_height, filter_width, in_channels, out_channels]`. `filters`' - `in_channels` dimension must match that of `value`. Atrous convolution is - equivalent to standard convolution with upsampled filters with effective - height `filter_height + (filter_height - 1) * (rate - 1)` and effective - width `filter_width + (filter_width - 1) * (rate - 1)`, produced by - inserting `rate - 1` zeros along consecutive elements across the - `filters`' spatial dimensions. -* `rate`: A positive int32. The stride with which we sample input values across - the `height` and `width` dimensions. Equivalently, the rate by which we - upsample the filter values by inserting zeros across the `height` and - `width` dimensions. In the literature, the same parameter is sometimes - called `input stride` or `dilation`. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. -* `name`: Optional name for the returned tensor. - -##### Returns: - - A `Tensor` with the same type as `value`. - -##### Raises: - - -* `ValueError`: If input/output depth does not match `filters`' shape, or if - padding is other than `'VALID'` or `'SAME'`. - - -- - - - -### `tf.nn.atrous_conv2d_transpose(value, filters, output_shape, rate, padding, name=None)` {#atrous_conv2d_transpose} - -The transpose of `atrous_conv2d`. - -This operation is sometimes called "deconvolution" after [Deconvolutional -Networks](http://www.matthewzeiler.com/pubs/cvpr2010/cvpr2010.pdf), but is -actually the transpose (gradient) of `atrous_conv2d` rather than an actual -deconvolution. - -##### Args: - - -* `value`: A 4-D `Tensor` of type `float`. It needs to be in the default `NHWC` - format. Its shape is `[batch, in_height, in_width, in_channels]`. -* `filters`: A 4-D `Tensor` with the same type as `value` and shape - `[filter_height, filter_width, out_channels, in_channels]`. `filters`' - `in_channels` dimension must match that of `value`. Atrous convolution is - equivalent to standard convolution with upsampled filters with effective - height `filter_height + (filter_height - 1) * (rate - 1)` and effective - width `filter_width + (filter_width - 1) * (rate - 1)`, produced by - inserting `rate - 1` zeros along consecutive elements across the - `filters`' spatial dimensions. -* `output_shape`: A 1-D `Tensor` of shape representing the output shape of the - deconvolution op. -* `rate`: A positive int32. The stride with which we sample input values across - the `height` and `width` dimensions. Equivalently, the rate by which we - upsample the filter values by inserting zeros across the `height` and - `width` dimensions. In the literature, the same parameter is sometimes - called `input stride` or `dilation`. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. -* `name`: Optional name for the returned tensor. - -##### Returns: - - A `Tensor` with the same type as `value`. - -##### Raises: - - -* `ValueError`: If input/output depth does not match `filters`' shape, or if - padding is other than `'VALID'` or `'SAME'`, or if the `rate` is less - than one, or if the output_shape is not a tensor with 4 elements. - - -- - - - -### `tf.nn.conv2d_transpose(value, filter, output_shape, strides, padding='SAME', data_format='NHWC', name=None)` {#conv2d_transpose} - -The transpose of `conv2d`. - -This operation is sometimes called "deconvolution" after [Deconvolutional -Networks](http://www.matthewzeiler.com/pubs/cvpr2010/cvpr2010.pdf), but is -actually the transpose (gradient) of `conv2d` rather than an actual -deconvolution. - -##### Args: - - -* `value`: A 4-D `Tensor` of type `float` and shape - `[batch, height, width, in_channels]` for `NHWC` data format or - `[batch, in_channels, height, width]` for `NCHW` data format. -* `filter`: A 4-D `Tensor` with the same type as `value` and shape - `[height, width, output_channels, in_channels]`. `filter`'s - `in_channels` dimension must match that of `value`. -* `output_shape`: A 1-D `Tensor` representing the output shape of the - deconvolution op. -* `strides`: A list of ints. The stride of the sliding window for each - dimension of the input tensor. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. - See the [comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `data_format`: A string. 'NHWC' and 'NCHW' are supported. -* `name`: Optional name for the returned tensor. - -##### Returns: - - A `Tensor` with the same type as `value`. - -##### Raises: - - -* `ValueError`: If input/output depth does not match `filter`'s shape, or if - padding is other than `'VALID'` or `'SAME'`. - - -- - - - -### `tf.nn.conv1d(value, filters, stride, padding, use_cudnn_on_gpu=None, data_format=None, name=None)` {#conv1d} - -Computes a 1-D convolution given 3-D input and filter tensors. - -Given an input tensor of shape - [batch, in_width, in_channels] -if data_format is "NHWC", or - [batch, in_channels, in_width] -if data_format is "NCHW", -and a filter / kernel tensor of shape -[filter_width, in_channels, out_channels], this op reshapes -the arguments to pass them to conv2d to perform the equivalent -convolution operation. - -Internally, this op reshapes the input tensors and invokes `tf.nn.conv2d`. -For example, if `data_format` does not start with "NC", a tensor of shape - [batch, in_width, in_channels] -is reshaped to - [batch, 1, in_width, in_channels], -and the filter is reshaped to - [1, filter_width, in_channels, out_channels]. -The result is then reshaped back to - [batch, out_width, out_channels] -(where out_width is a function of the stride and padding as in conv2d) and -returned to the caller. - -##### Args: - - -* `value`: A 3D `Tensor`. Must be of type `float32` or `float64`. -* `filters`: A 3D `Tensor`. Must have the same type as `input`. -* `stride`: An `integer`. The number of entries by which - the filter is moved right at each step. -* `padding`: 'SAME' or 'VALID' -* `use_cudnn_on_gpu`: An optional `bool`. Defaults to `True`. -* `data_format`: An optional `string` from `"NHWC", "NCHW"`. Defaults - to `"NHWC"`, the data is stored in the order of - [batch, in_width, in_channels]. The `"NCHW"` format stores - data as [batch, in_channels, in_width]. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as input. - -##### Raises: - - -* `ValueError`: if `data_format` is invalid. - - -- - - - -### `tf.nn.conv3d(input, filter, strides, padding, name=None)` {#conv3d} - -Computes a 3-D convolution given 5-D `input` and `filter` tensors. - -In signal processing, cross-correlation is a measure of similarity of -two waveforms as a function of a time-lag applied to one of them. This -is also known as a sliding dot product or sliding inner-product. - -Our Conv3D implements a form of cross-correlation. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Shape `[batch, in_depth, in_height, in_width, in_channels]`. -* `filter`: A `Tensor`. Must have the same type as `input`. - Shape `[filter_depth, filter_height, filter_width, in_channels, - out_channels]`. `in_channels` must match between `input` and `filter`. -* `strides`: A list of `ints` that has length `>= 5`. - 1-D tensor of length 5. The stride of the sliding window for each - dimension of `input`. Must have `strides[0] = strides[4] = 1`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - - -- - - - -### `tf.nn.conv3d_transpose(value, filter, output_shape, strides, padding='SAME', name=None)` {#conv3d_transpose} - -The transpose of `conv3d`. - -This operation is sometimes called "deconvolution" after [Deconvolutional -Networks](http://www.matthewzeiler.com/pubs/cvpr2010/cvpr2010.pdf), but is -actually the transpose (gradient) of `conv3d` rather than an actual -deconvolution. - -##### Args: - - -* `value`: A 5-D `Tensor` of type `float` and shape - `[batch, depth, height, width, in_channels]`. -* `filter`: A 5-D `Tensor` with the same type as `value` and shape - `[depth, height, width, output_channels, in_channels]`. `filter`'s - `in_channels` dimension must match that of `value`. -* `output_shape`: A 1-D `Tensor` representing the output shape of the - deconvolution op. -* `strides`: A list of ints. The stride of the sliding window for each - dimension of the input tensor. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. - See the [comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `name`: Optional name for the returned tensor. - -##### Returns: - - A `Tensor` with the same type as `value`. - -##### Raises: - - -* `ValueError`: If input/output depth does not match `filter`'s shape, or if - padding is other than `'VALID'` or `'SAME'`. - - -- - - - -### `tf.nn.conv2d_backprop_filter(input, filter_sizes, out_backprop, strides, padding, use_cudnn_on_gpu=None, data_format=None, name=None)` {#conv2d_backprop_filter} - -Computes the gradients of convolution with respect to the filter. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. - 4-D with shape `[batch, in_height, in_width, in_channels]`. -* `filter_sizes`: A `Tensor` of type `int32`. - An integer vector representing the tensor shape of `filter`, - where `filter` is a 4-D - `[filter_height, filter_width, in_channels, out_channels]` tensor. -* `out_backprop`: A `Tensor`. Must have the same type as `input`. - 4-D with shape `[batch, out_height, out_width, out_channels]`. - Gradients w.r.t. the output of the convolution. -* `strides`: A list of `ints`. - The stride of the sliding window for each dimension of the input - of the convolution. Must be in the same order as the dimension specified with - format. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `use_cudnn_on_gpu`: An optional `bool`. Defaults to `True`. -* `data_format`: An optional `string` from: `"NHWC", "NCHW"`. Defaults to `"NHWC"`. - Specify the data format of the input and output data. With the - default format "NHWC", the data is stored in the order of: - [batch, in_height, in_width, in_channels]. - Alternatively, the format could be "NCHW", the data storage order of: - [batch, in_channels, in_height, in_width]. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. 4-D with shape - `[filter_height, filter_width, in_channels, out_channels]`. Gradient w.r.t. - the `filter` input of the convolution. - - -- - - - -### `tf.nn.conv2d_backprop_input(input_sizes, filter, out_backprop, strides, padding, use_cudnn_on_gpu=None, data_format=None, name=None)` {#conv2d_backprop_input} - -Computes the gradients of convolution with respect to the input. - -##### Args: - - -* `input_sizes`: A `Tensor` of type `int32`. - An integer vector representing the shape of `input`, - where `input` is a 4-D `[batch, height, width, channels]` tensor. -* `filter`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`. - 4-D with shape - `[filter_height, filter_width, in_channels, out_channels]`. -* `out_backprop`: A `Tensor`. Must have the same type as `filter`. - 4-D with shape `[batch, out_height, out_width, out_channels]`. - Gradients w.r.t. the output of the convolution. -* `strides`: A list of `ints`. - The stride of the sliding window for each dimension of the input - of the convolution. Must be in the same order as the dimension specified with - format. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `use_cudnn_on_gpu`: An optional `bool`. Defaults to `True`. -* `data_format`: An optional `string` from: `"NHWC", "NCHW"`. Defaults to `"NHWC"`. - Specify the data format of the input and output data. With the - default format "NHWC", the data is stored in the order of: - [batch, in_height, in_width, in_channels]. - Alternatively, the format could be "NCHW", the data storage order of: - [batch, in_channels, in_height, in_width]. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `filter`. - 4-D with shape `[batch, in_height, in_width, in_channels]`. Gradient - w.r.t. the input of the convolution. - - -- - - - -### `tf.nn.conv3d_backprop_filter_v2(input, filter_sizes, out_backprop, strides, padding, name=None)` {#conv3d_backprop_filter_v2} - -Computes the gradients of 3-D convolution with respect to the filter. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Shape `[batch, depth, rows, cols, in_channels]`. -* `filter_sizes`: A `Tensor` of type `int32`. - An integer vector representing the tensor shape of `filter`, - where `filter` is a 5-D - `[filter_depth, filter_height, filter_width, in_channels, out_channels]` - tensor. -* `out_backprop`: A `Tensor`. Must have the same type as `input`. - Backprop signal of shape `[batch, out_depth, out_rows, out_cols, - out_channels]`. -* `strides`: A list of `ints` that has length `>= 5`. - 1-D tensor of length 5. The stride of the sliding window for each - dimension of `input`. Must have `strides[0] = strides[4] = 1`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - - -- - - - -### `tf.nn.depthwise_conv2d_native_backprop_filter(input, filter_sizes, out_backprop, strides, padding, name=None)` {#depthwise_conv2d_native_backprop_filter} - -Computes the gradients of depthwise convolution with respect to the filter. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`. - 4-D with shape `[batch, in_height, in_width, in_channels]`. -* `filter_sizes`: A `Tensor` of type `int32`. - An integer vector representing the tensor shape of `filter`, - where `filter` is a 4-D - `[filter_height, filter_width, in_channels, depthwise_multiplier]` tensor. -* `out_backprop`: A `Tensor`. Must have the same type as `input`. - 4-D with shape `[batch, out_height, out_width, out_channels]`. - Gradients w.r.t. the output of the convolution. -* `strides`: A list of `ints`. - The stride of the sliding window for each dimension of the input - of the convolution. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. 4-D with shape - `[filter_height, filter_width, in_channels, out_channels]`. Gradient w.r.t. - the `filter` input of the convolution. - - -- - - - -### `tf.nn.depthwise_conv2d_native_backprop_input(input_sizes, filter, out_backprop, strides, padding, name=None)` {#depthwise_conv2d_native_backprop_input} - -Computes the gradients of depthwise convolution with respect to the input. - -##### Args: - - -* `input_sizes`: A `Tensor` of type `int32`. - An integer vector representing the shape of `input`, - where `input` is a 4-D `[batch, height, width, channels]` tensor. -* `filter`: A `Tensor`. Must be one of the following types: `float32`, `float64`. - 4-D with shape - `[filter_height, filter_width, in_channels, depthwise_multiplier]`. -* `out_backprop`: A `Tensor`. Must have the same type as `filter`. - 4-D with shape `[batch, out_height, out_width, out_channels]`. - Gradients w.r.t. the output of the convolution. -* `strides`: A list of `ints`. - The stride of the sliding window for each dimension of the input - of the convolution. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `filter`. - 4-D with shape `[batch, in_height, in_width, in_channels]`. Gradient - w.r.t. the input of the convolution. - - -- - - - -### `tf.nn.avg_pool(value, ksize, strides, padding, data_format='NHWC', name=None)` {#avg_pool} - -Performs the average pooling on the input. - -Each entry in `output` is the mean of the corresponding size `ksize` -window in `value`. - -##### Args: - - -* `value`: A 4-D `Tensor` of shape `[batch, height, width, channels]` and type - `float32`, `float64`, `qint8`, `quint8`, or `qint32`. -* `ksize`: A list of ints that has length >= 4. - The size of the window for each dimension of the input tensor. -* `strides`: A list of ints that has length >= 4. - The stride of the sliding window for each dimension of the - input tensor. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. - See the [comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `data_format`: A string. 'NHWC' and 'NCHW' are supported. -* `name`: Optional name for the operation. - -##### Returns: - - A `Tensor` with the same type as `value`. The average pooled output tensor. - - -- - - - -### `tf.nn.max_pool(value, ksize, strides, padding, data_format='NHWC', name=None)` {#max_pool} - -Performs the max pooling on the input. - -##### Args: - - -* `value`: A 4-D `Tensor` with shape `[batch, height, width, channels]` and - type `tf.float32`. -* `ksize`: A list of ints that has length >= 4. The size of the window for - each dimension of the input tensor. -* `strides`: A list of ints that has length >= 4. The stride of the sliding - window for each dimension of the input tensor. -* `padding`: A string, either `'VALID'` or `'SAME'`. The padding algorithm. - See the [comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `data_format`: A string. 'NHWC' and 'NCHW' are supported. -* `name`: Optional name for the operation. - -##### Returns: - - A `Tensor` with type `tf.float32`. The max pooled output tensor. - - -- - - - -### `tf.nn.max_pool_with_argmax(input, ksize, strides, padding, Targmax=None, name=None)` {#max_pool_with_argmax} - -Performs max pooling on the input and outputs both max values and indices. - -The indices in `argmax` are flattened, so that a maximum value at position -`[b, y, x, c]` becomes flattened index -`((b * height + y) * width + x) * channels + c`. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `half`. - 4-D with shape `[batch, height, width, channels]`. Input to pool over. -* `ksize`: A list of `ints` that has length `>= 4`. - The size of the window for each dimension of the input tensor. -* `strides`: A list of `ints` that has length `>= 4`. - The stride of the sliding window for each dimension of the - input tensor. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `Targmax`: An optional `tf.DType` from: `tf.int32, tf.int64`. Defaults to `tf.int64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, argmax). - -* `output`: A `Tensor`. Has the same type as `input`. The max pooled output tensor. -* `argmax`: A `Tensor` of type `Targmax`. 4-D. The flattened indices of the max values chosen for each output. - - -- - - - -### `tf.nn.avg_pool3d(input, ksize, strides, padding, name=None)` {#avg_pool3d} - -Performs 3D average pooling on the input. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Shape `[batch, depth, rows, cols, channels]` tensor to pool over. -* `ksize`: A list of `ints` that has length `>= 5`. - 1-D tensor of length 5. The size of the window for each dimension of - the input tensor. Must have `ksize[0] = ksize[4] = 1`. -* `strides`: A list of `ints` that has length `>= 5`. - 1-D tensor of length 5. The stride of the sliding window for each - dimension of `input`. Must have `strides[0] = strides[4] = 1`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - The average pooled output tensor. - - -- - - - -### `tf.nn.max_pool3d(input, ksize, strides, padding, name=None)` {#max_pool3d} - -Performs 3D max pooling on the input. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Shape `[batch, depth, rows, cols, channels]` tensor to pool over. -* `ksize`: A list of `ints` that has length `>= 5`. - 1-D tensor of length 5. The size of the window for each dimension of - the input tensor. Must have `ksize[0] = ksize[4] = 1`. -* `strides`: A list of `ints` that has length `>= 5`. - 1-D tensor of length 5. The stride of the sliding window for each - dimension of `input`. Must have `strides[0] = strides[4] = 1`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. The max pooled output tensor. - - -- - - - -### `tf.nn.fractional_avg_pool(value, pooling_ratio, pseudo_random=None, overlapping=None, deterministic=None, seed=None, seed2=None, name=None)` {#fractional_avg_pool} - -Performs fractional average pooling on the input. - -Fractional average pooling is similar to Fractional max pooling in the pooling -region generation step. The only difference is that after pooling regions are -generated, a mean operation is performed instead of a max operation in each -pooling region. - -##### Args: - - -* `value`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`. - 4-D with shape `[batch, height, width, channels]`. -* `pooling_ratio`: A list of `floats` that has length `>= 4`. - Pooling ratio for each dimension of `value`, currently only - supports row and col dimension and should be >= 1.0. For example, a valid - pooling ratio looks like [1.0, 1.44, 1.73, 1.0]. The first and last elements - must be 1.0 because we don't allow pooling on batch and channels - dimensions. 1.44 and 1.73 are pooling ratio on height and width dimensions - respectively. -* `pseudo_random`: An optional `bool`. Defaults to `False`. - When set to True, generates the pooling sequence in a - pseudorandom fashion, otherwise, in a random fashion. Check paper [Benjamin - Graham, Fractional Max-Pooling](http://arxiv.org/abs/1412.6071) for - difference between pseudorandom and random. -* `overlapping`: An optional `bool`. Defaults to `False`. - When set to True, it means when pooling, the values at the boundary - of adjacent pooling cells are used by both cells. For example: - - `index 0 1 2 3 4` - - `value 20 5 16 3 7` - - If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. - The result would be [41/3, 26/3] for fractional avg pooling. - -* `deterministic`: An optional `bool`. Defaults to `False`. - When set to True, a fixed pooling region will be used when - iterating over a FractionalAvgPool node in the computation graph. Mainly used - in unit test to make FractionalAvgPool deterministic. -* `seed`: An optional `int`. Defaults to `0`. - If either seed or seed2 are set to be non-zero, the random number - generator is seeded by the given seed. Otherwise, it is seeded by a - random seed. -* `seed2`: An optional `int`. Defaults to `0`. - An second seed to avoid seed collision. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, row_pooling_sequence, col_pooling_sequence). - -* `output`: A `Tensor`. Has the same type as `value`. output tensor after fractional avg pooling. -* `row_pooling_sequence`: A `Tensor` of type `int64`. row pooling sequence, needed to calculate gradient. -* `col_pooling_sequence`: A `Tensor` of type `int64`. column pooling sequence, needed to calculate gradient. - - -- - - - -### `tf.nn.fractional_max_pool(value, pooling_ratio, pseudo_random=None, overlapping=None, deterministic=None, seed=None, seed2=None, name=None)` {#fractional_max_pool} - -Performs fractional max pooling on the input. - -Fractional max pooling is slightly different than regular max pooling. In -regular max pooling, you downsize an input set by taking the maximum value of -smaller N x N subsections of the set (often 2x2), and try to reduce the set by -a factor of N, where N is an integer. Fractional max pooling, as you might -expect from the word "fractional", means that the overall reduction ratio N -does not have to be an integer. - -The sizes of the pooling regions are generated randomly but are fairly uniform. -For example, let's look at the height dimension, and the constraints on the -list of rows that will be pool boundaries. - -First we define the following: - -1. input_row_length : the number of rows from the input set -2. output_row_length : which will be smaller than the input -3. alpha = input_row_length / output_row_length : our reduction ratio -4. K = floor(alpha) -5. row_pooling_sequence : this is the result list of pool boundary rows - -Then, row_pooling_sequence should satisfy: - -1. a[0] = 0 : the first value of the sequence is 0 -2. a[end] = input_row_length : the last value of the sequence is the size -3. K <= (a[i+1] - a[i]) <= K+1 : all intervals are K or K+1 size -4. length(row_pooling_sequence) = output_row_length+1 - -For more details on fractional max pooling, see this paper: -[Benjamin Graham, Fractional Max-Pooling](http://arxiv.org/abs/1412.6071) - -##### Args: - - -* `value`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`. - 4-D with shape `[batch, height, width, channels]`. -* `pooling_ratio`: A list of `floats` that has length `>= 4`. - Pooling ratio for each dimension of `value`, currently only - supports row and col dimension and should be >= 1.0. For example, a valid - pooling ratio looks like [1.0, 1.44, 1.73, 1.0]. The first and last elements - must be 1.0 because we don't allow pooling on batch and channels - dimensions. 1.44 and 1.73 are pooling ratio on height and width dimensions - respectively. -* `pseudo_random`: An optional `bool`. Defaults to `False`. - When set to True, generates the pooling sequence in a - pseudorandom fashion, otherwise, in a random fashion. Check paper [Benjamin - Graham, Fractional Max-Pooling](http://arxiv.org/abs/1412.6071) for - difference between pseudorandom and random. -* `overlapping`: An optional `bool`. Defaults to `False`. - When set to True, it means when pooling, the values at the boundary - of adjacent pooling cells are used by both cells. For example: - - `index 0 1 2 3 4` - - `value 20 5 16 3 7` - - If the pooling sequence is [0, 2, 4], then 16, at index 2 will be used twice. - The result would be [20, 16] for fractional max pooling. - -* `deterministic`: An optional `bool`. Defaults to `False`. - When set to True, a fixed pooling region will be used when - iterating over a FractionalMaxPool node in the computation graph. Mainly used - in unit test to make FractionalMaxPool deterministic. -* `seed`: An optional `int`. Defaults to `0`. - If either seed or seed2 are set to be non-zero, the random number - generator is seeded by the given seed. Otherwise, it is seeded by a - random seed. -* `seed2`: An optional `int`. Defaults to `0`. - An second seed to avoid seed collision. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, row_pooling_sequence, col_pooling_sequence). - -* `output`: A `Tensor`. Has the same type as `value`. output tensor after fractional max pooling. -* `row_pooling_sequence`: A `Tensor` of type `int64`. row pooling sequence, needed to calculate gradient. -* `col_pooling_sequence`: A `Tensor` of type `int64`. column pooling sequence, needed to calculate gradient. - - -- - - - -### `tf.nn.pool(input, window_shape, pooling_type, padding, dilation_rate=None, strides=None, name=None, data_format=None)` {#pool} - -Performs an N-D pooling operation. - -In the case that `data_format` does not start with "NC", computes for - 0 <= b < batch_size, - 0 <= x[i] < output_spatial_shape[i], - 0 <= c < num_channels: - - output[b, x[0], ..., x[N-1], c] = - REDUCE_{z[0], ..., z[N-1]} - input[b, - x[0] * strides[0] - pad_before[0] + dilation_rate[0]*z[0], - ... - x[N-1]*strides[N-1] - pad_before[N-1] + dilation_rate[N-1]*z[N-1], - c], - -where the reduction function REDUCE depends on the value of `pooling_type`, -and pad_before is defined based on the value of `padding` as described in the -[comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution). -The reduction never includes out-of-bounds positions. - -In the case that `data_format` starts with `"NC"`, the `input` and output are -simply transposed as follows: - - pool(input, data_format, **kwargs) = - tf.transpose(pool(tf.transpose(input, [0] + range(2,N+2) + [1]), - **kwargs), - [0, N+1] + range(1, N+1)) - -##### Args: - - -* `input`: Tensor of rank N+2, of shape - `[batch_size] + input_spatial_shape + [num_channels]` if data_format does - not start with "NC" (default), or - `[batch_size, num_channels] + input_spatial_shape` if data_format starts - with "NC". Pooling happens over the spatial dimensions only. -* `window_shape`: Sequence of N ints >= 1. -* `pooling_type`: Specifies pooling operation, must be "AVG" or "MAX". -* `padding`: The padding algorithm, must be "SAME" or "VALID". - See the [comment here](https://www.tensorflow.org/api_docs/python/nn.html#convolution) -* `dilation_rate`: Optional. Dilation rate. List of N ints >= 1. - Defaults to [1]*N. If any value of dilation_rate is > 1, then all values - of strides must be 1. -* `strides`: Optional. Sequence of N ints >= 1. Defaults to [1]*N. - If any value of strides is > 1, then all values of dilation_rate must be - 1. -* `name`: Optional. Name of the op. -* `data_format`: A string or None. Specifies whether the channel dimension of - the `input` and output is the last dimension (default, or if `data_format` - does not start with "NC"), or the second dimension (if `data_format` - starts with "NC"). For N=1, the valid values are "NWC" (default) and - "NCW". For N=2, the valid values are "NHWC" (default) and "NCHW". For - N=3, the valid value is "NDHWC". - -##### Returns: - - Tensor of rank N+2, of shape - [batch_size] + output_spatial_shape + [num_channels] - - if data_format is None or does not start with "NC", or - - [batch_size, num_channels] + output_spatial_shape - - if data_format starts with "NC", - where `output_spatial_shape` depends on the value of padding: - - If padding = "SAME": - output_spatial_shape[i] = ceil(input_spatial_shape[i] / strides[i]) - If padding = "VALID": - output_spatial_shape[i] = - ceil((input_spatial_shape[i] - (window_shape[i] - 1) * dilation_rate[i]) - / strides[i]). - -##### Raises: - - -* `ValueError`: if arguments are invalid. - - -- - - - -### `tf.nn.dilation2d(input, filter, strides, rates, padding, name=None)` {#dilation2d} - -Computes the grayscale dilation of 4-D `input` and 3-D `filter` tensors. - -The `input` tensor has shape `[batch, in_height, in_width, depth]` and the -`filter` tensor has shape `[filter_height, filter_width, depth]`, i.e., each -input channel is processed independently of the others with its own structuring -function. The `output` tensor has shape -`[batch, out_height, out_width, depth]`. The spatial dimensions of the output -tensor depend on the `padding` algorithm. We currently only support the default -"NHWC" `data_format`. - -In detail, the grayscale morphological 2-D dilation is the max-sum correlation -(for consistency with `conv2d`, we use unmirrored filters): - - output[b, y, x, c] = - max_{dy, dx} input[b, - strides[1] * y + rates[1] * dy, - strides[2] * x + rates[2] * dx, - c] + - filter[dy, dx, c] - -Max-pooling is a special case when the filter has size equal to the pooling -kernel size and contains all zeros. - -Note on duality: The dilation of `input` by the `filter` is equal to the -negation of the erosion of `-input` by the reflected `filter`. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. - 4-D with shape `[batch, in_height, in_width, depth]`. -* `filter`: A `Tensor`. Must have the same type as `input`. - 3-D with shape `[filter_height, filter_width, depth]`. -* `strides`: A list of `ints` that has length `>= 4`. - The stride of the sliding window for each dimension of the input - tensor. Must be: `[1, stride_height, stride_width, 1]`. -* `rates`: A list of `ints` that has length `>= 4`. - The input stride for atrous morphological dilation. Must be: - `[1, rate_height, rate_width, 1]`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - 4-D with shape `[batch, out_height, out_width, depth]`. - - -- - - - -### `tf.nn.erosion2d(value, kernel, strides, rates, padding, name=None)` {#erosion2d} - -Computes the grayscale erosion of 4-D `value` and 3-D `kernel` tensors. - -The `value` tensor has shape `[batch, in_height, in_width, depth]` and the -`kernel` tensor has shape `[kernel_height, kernel_width, depth]`, i.e., -each input channel is processed independently of the others with its own -structuring function. The `output` tensor has shape -`[batch, out_height, out_width, depth]`. The spatial dimensions of the -output tensor depend on the `padding` algorithm. We currently only support the -default "NHWC" `data_format`. - -In detail, the grayscale morphological 2-D erosion is given by: - - output[b, y, x, c] = - min_{dy, dx} value[b, - strides[1] * y - rates[1] * dy, - strides[2] * x - rates[2] * dx, - c] - - kernel[dy, dx, c] - -Duality: The erosion of `value` by the `kernel` is equal to the negation of -the dilation of `-value` by the reflected `kernel`. - -##### Args: - - -* `value`: A `Tensor`. 4-D with shape `[batch, in_height, in_width, depth]`. -* `kernel`: A `Tensor`. Must have the same type as `value`. - 3-D with shape `[kernel_height, kernel_width, depth]`. -* `strides`: A list of `ints` that has length `>= 4`. - 1-D of length 4. The stride of the sliding window for each dimension of - the input tensor. Must be: `[1, stride_height, stride_width, 1]`. -* `rates`: A list of `ints` that has length `>= 4`. - 1-D of length 4. The input stride for atrous morphological dilation. - Must be: `[1, rate_height, rate_width, 1]`. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). If not specified "erosion2d" - is used. - -##### Returns: - - A `Tensor`. Has the same type as `value`. - 4-D with shape `[batch, out_height, out_width, depth]`. - -##### Raises: - - -* `ValueError`: If the `value` depth does not match `kernel`' shape, or if - padding is other than `'VALID'` or `'SAME'`. - - -- - - - -### `tf.nn.with_space_to_batch(input, dilation_rate, padding, op, filter_shape=None, spatial_dims=None)` {#with_space_to_batch} - -Performs `op` on the space-to-batch representation of `input`. - -This has the effect of transforming sliding window operations into the -corresponding "atrous" operation in which the input is sampled at the -specified `dilation_rate`. - -In the special case that `dilation_rate` is uniformly 1, this simply returns: - - op(input, num_spatial_dims, padding) - -Otherwise, it returns: - - batch_to_space_nd( - op(space_to_batch_nd(input, adjusted_dilation_rate, adjusted_paddings), - num_spatial_dims, - "VALID") - adjusted_dilation_rate, - adjusted_crops), - -where: - - adjusted_dilation_rate is an int64 tensor of shape [max(spatial_dims)], - adjusted_{paddings,crops} are int64 tensors of shape [max(spatial_dims), 2] - -defined as follows: - -We first define two int64 tensors `paddings` and `crops` of shape -`[num_spatial_dims, 2]` based on the value of `padding` and the spatial -dimensions of the `input`: - -If `padding = "VALID"`, then: - - paddings, crops = required_space_to_batch_paddings( - input_shape[spatial_dims], - dilation_rate) - -If `padding = "SAME"`, then: - - dilated_filter_shape = - filter_shape + (filter_shape - 1) * (dilation_rate - 1) - - paddings, crops = required_space_to_batch_paddings( - input_shape[spatial_dims], - dilation_rate, - [(dilated_filter_shape - 1) // 2, - dilated_filter_shape - 1 - (dilated_filter_shape - 1) // 2]) - -Because `space_to_batch_nd` and `batch_to_space_nd` assume that the spatial -dimensions are contiguous starting at the second dimension, but the specified -`spatial_dims` may not be, we must adjust `dilation_rate`, `paddings` and -`crops` in order to be usable with these operations. For a given dimension, -if the block size is 1, and both the starting and ending padding and crop -amounts are 0, then space_to_batch_nd effectively leaves that dimension alone, -which is what is needed for dimensions not part of `spatial_dims`. -Furthermore, `space_to_batch_nd` and `batch_to_space_nd` handle this case -efficiently for any number of leading and trailing dimensions. - -For 0 <= i < len(spatial_dims), we assign: - - adjusted_dilation_rate[spatial_dims[i] - 1] = dilation_rate[i] - adjusted_paddings[spatial_dims[i] - 1, :] = paddings[i, :] - adjusted_crops[spatial_dims[i] - 1, :] = crops[i, :] - -All unassigned values of `adjusted_dilation_rate` default to 1, while all -unassigned values of `adjusted_paddings` and `adjusted_crops` default to 0. - -Note in the case that `dilation_rate` is not uniformly 1, specifying "VALID" -padding is equivalent to specifying `padding = "SAME"` with a filter_shape of -`[1]*N`. - -Advanced usage. Note the following optimization: A sequence of -`with_space_to_batch` operations with identical (not uniformly 1) -`dilation_rate` parameters and "VALID" padding - - net = with_space_to_batch(net, dilation_rate, "VALID", op_1) - ... - net = with_space_to_batch(net, dilation_rate, "VALID", op_k) - -can be combined into a single `with_space_to_batch` operation as follows: - - def combined_op(converted_input, num_spatial_dims, _): - result = op_1(converted_input, num_spatial_dims, "VALID") - ... - result = op_k(result, num_spatial_dims, "VALID") - - net = with_space_to_batch(net, dilation_rate, "VALID", combined_op) - -This eliminates the overhead of `k-1` calls to `space_to_batch_nd` and -`batch_to_space_nd`. - -Similarly, a sequence of `with_space_to_batch` operations with identical (not -uniformly 1) `dilation_rate` parameters, "SAME" padding, and odd filter -dimensions - - net = with_space_to_batch(net, dilation_rate, "SAME", op_1, filter_shape_1) - ... - net = with_space_to_batch(net, dilation_rate, "SAME", op_k, filter_shape_k) - -can be combined into a single `with_space_to_batch` operation as follows: - - def combined_op(converted_input, num_spatial_dims, _): - result = op_1(converted_input, num_spatial_dims, "SAME") - ... - result = op_k(result, num_spatial_dims, "SAME") - - net = with_space_to_batch(net, dilation_rate, "VALID", combined_op) - -##### Args: - - -* `input`: Tensor of rank > max(spatial_dims). -* `dilation_rate`: int32 Tensor of *known* shape [num_spatial_dims]. -* `padding`: str constant equal to "VALID" or "SAME" -* `op`: Function that maps (input, num_spatial_dims, padding) -> output -* `filter_shape`: If padding = "SAME", specifies the shape of the convolution - kernel/pooling window as an integer Tensor of shape [>=num_spatial_dims]. - If padding = "VALID", filter_shape is ignored and need not be specified. -* `spatial_dims`: Monotonically increasing sequence of `num_spatial_dims` - integers (which are >= 1) specifying the spatial dimensions of `input` - and output. Defaults to: `range(1, num_spatial_dims+1)`. - -##### Returns: - - The output Tensor as described above. - -##### Raises: - - -* `ValueError`: if `padding` is invalid or the arguments are incompatible. -* `ValueError`: if `spatial_dims` are invalid. - - -- - - - -### `tf.nn.l2_normalize(x, dim, epsilon=1e-12, name=None)` {#l2_normalize} - -Normalizes along dimension `dim` using an L2 norm. - -For a 1-D tensor with `dim = 0`, computes - - output = x / sqrt(max(sum(x**2), epsilon)) - -For `x` with more dimensions, independently normalizes each 1-D slice along -dimension `dim`. - -##### Args: - - -* `x`: A `Tensor`. -* `dim`: Dimension along which to normalize. A scalar or a vector of - integers. -* `epsilon`: A lower bound value for the norm. Will use `sqrt(epsilon)` as the - divisor if `norm < sqrt(epsilon)`. -* `name`: A name for this operation (optional). - -##### Returns: - - A `Tensor` with the same shape as `x`. - - -- - - - -### `tf.nn.local_response_normalization(input, depth_radius=None, bias=None, alpha=None, beta=None, name=None)` {#local_response_normalization} - -Local Response Normalization. - -The 4-D `input` tensor is treated as a 3-D array of 1-D vectors (along the last -dimension), and each vector is normalized independently. Within a given vector, -each component is divided by the weighted, squared sum of inputs within -`depth_radius`. In detail, - - sqr_sum[a, b, c, d] = - sum(input[a, b, c, d - depth_radius : d + depth_radius + 1] ** 2) - output = input / (bias + alpha * sqr_sum) ** beta - -For details, see [Krizhevsky et al., ImageNet classification with deep -convolutional neural networks (NIPS 2012)](http://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks). - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `float32`, `half`. - 4-D. -* `depth_radius`: An optional `int`. Defaults to `5`. - 0-D. Half-width of the 1-D normalization window. -* `bias`: An optional `float`. Defaults to `1`. - An offset (usually positive to avoid dividing by 0). -* `alpha`: An optional `float`. Defaults to `1`. - A scale factor, usually positive. -* `beta`: An optional `float`. Defaults to `0.5`. An exponent. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - - -- - - - -### `tf.nn.sufficient_statistics(x, axes, shift=None, keep_dims=False, name=None)` {#sufficient_statistics} - -Calculate the sufficient statistics for the mean and variance of `x`. - -These sufficient statistics are computed using the one pass algorithm on -an input that's optionally shifted. See: -https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Computing_shifted_data - -##### Args: - - -* `x`: A `Tensor`. -* `axes`: Array of ints. Axes along which to compute mean and variance. -* `shift`: A `Tensor` containing the value by which to shift the data for - numerical stability, or `None` if no shift is to be performed. A shift - close to the true mean provides the most numerically stable results. -* `keep_dims`: produce statistics with the same dimensionality as the input. -* `name`: Name used to scope the operations that compute the sufficient stats. - -##### Returns: - - Four `Tensor` objects of the same type as `x`: - - * the count (number of elements to average over). - * the (possibly shifted) sum of the elements in the array. - * the (possibly shifted) sum of squares of the elements in the array. - * the shift by which the mean must be corrected or None if `shift` is None. - - -- - - - -### `tf.nn.normalize_moments(counts, mean_ss, variance_ss, shift, name=None)` {#normalize_moments} - -Calculate the mean and variance of based on the sufficient statistics. - -##### Args: - - -* `counts`: A `Tensor` containing a the total count of the data (one value). -* `mean_ss`: A `Tensor` containing the mean sufficient statistics: the (possibly - shifted) sum of the elements to average over. -* `variance_ss`: A `Tensor` containing the variance sufficient statistics: the - (possibly shifted) squared sum of the data to compute the variance over. -* `shift`: A `Tensor` containing the value by which the data is shifted for - numerical stability, or `None` if no shift was performed. -* `name`: Name used to scope the operations that compute the moments. - -##### Returns: - - Two `Tensor` objects: `mean` and `variance`. - - -- - - - -### `tf.nn.moments(x, axes, shift=None, name=None, keep_dims=False)` {#moments} - -Calculate the mean and variance of `x`. - -The mean and variance are calculated by aggregating the contents of `x` -across `axes`. If `x` is 1-D and `axes = [0]` this is just the mean -and variance of a vector. - -Note: for numerical stability, when shift=None, the true mean -would be computed and used as shift. - -When using these moments for batch normalization (see -`tf.nn.batch_normalization`): - - * for so-called "global normalization", used with convolutional filters with - shape `[batch, height, width, depth]`, pass `axes=[0, 1, 2]`. - * for simple batch normalization pass `axes=[0]` (batch only). - -##### Args: - - -* `x`: A `Tensor`. -* `axes`: Array of ints. Axes along which to compute mean and - variance. -* `shift`: A `Tensor` containing the value by which to shift the data for - numerical stability, or `None` in which case the true mean of the data is - used as shift. A shift close to the true mean provides the most - numerically stable results. -* `name`: Name used to scope the operations that compute the moments. -* `keep_dims`: produce moments with the same dimensionality as the input. - -##### Returns: - - Two `Tensor` objects: `mean` and `variance`. - - -- - - - -### `tf.nn.weighted_moments(x, axes, frequency_weights, name=None, keep_dims=False)` {#weighted_moments} - -Returns the frequency-weighted mean and variance of `x`. - -##### Args: - - -* `x`: A tensor. -* `axes`: 1-d tensor of int32 values; these are the axes along which - to compute mean and variance. -* `frequency_weights`: A tensor of positive weights which can be - broadcast with x. -* `name`: Name used to scope the operation. -* `keep_dims`: Produce moments with the same dimensionality as the input. - -##### Returns: - - Two tensors: `weighted_mean` and `weighted_variance`. - - -- - - - -### `tf.nn.fused_batch_norm(x, scale, offset, mean=None, variance=None, epsilon=0.001, data_format='NHWC', is_training=True, name=None)` {#fused_batch_norm} - -Batch normalization. - -As described in http://arxiv.org/abs/1502.03167. - -##### Args: - - -* `x`: Input `Tensor` of 4 dimensions. -* `scale`: A `Tensor` of 1 dimension for scaling. -* `offset`: A `Tensor` of 1 dimension for bias. -* `mean`: A `Tensor` of 1 dimension for population mean used for inference. -* `variance`: A `Tensor` of 1 dimension for population variance - used for inference. -* `epsilon`: A small float number added to the variance of x. -* `data_format`: The data format for x. Either "NHWC" (default) or "NCHW". -* `is_training`: A bool value to specify if the operation is used for - training or inference. -* `name`: A name for this operation (optional). - -##### Returns: - - -* `y`: A 4D Tensor for the normalized, scaled, offsetted x. -* `batch_mean`: A 1D Tensor for the mean of x. -* `batch_var`: A 1D Tensor for the variance of x. - -##### Raises: - - -* `ValueError`: If mean or variance is not None when is_training is True. - - -- - - - -### `tf.nn.batch_normalization(x, mean, variance, offset, scale, variance_epsilon, name=None)` {#batch_normalization} - -Batch normalization. - -As described in http://arxiv.org/abs/1502.03167. -Normalizes a tensor by `mean` and `variance`, and applies (optionally) a -`scale` \\(\gamma\\) to it, as well as an `offset` \\(\beta\\): - -\\(\frac{\gamma(x-\mu)}{\sigma}+\beta\\) - -`mean`, `variance`, `offset` and `scale` are all expected to be of one of two -shapes: - - * In all generality, they can have the same number of dimensions as the - input `x`, with identical sizes as `x` for the dimensions that are not - normalized over (the 'depth' dimension(s)), and dimension 1 for the - others which are being normalized over. - `mean` and `variance` in this case would typically be the outputs of - `tf.nn.moments(..., keep_dims=True)` during training, or running averages - thereof during inference. - * In the common case where the 'depth' dimension is the last dimension in - the input tensor `x`, they may be one dimensional tensors of the same - size as the 'depth' dimension. - This is the case for example for the common `[batch, depth]` layout of - fully-connected layers, and `[batch, height, width, depth]` for - convolutions. - `mean` and `variance` in this case would typically be the outputs of - `tf.nn.moments(..., keep_dims=False)` during training, or running averages - thereof during inference. - -##### Args: - - -* `x`: Input `Tensor` of arbitrary dimensionality. -* `mean`: A mean `Tensor`. -* `variance`: A variance `Tensor`. -* `offset`: An offset `Tensor`, often denoted \\(\beta\\) in equations, or - None. If present, will be added to the normalized tensor. -* `scale`: A scale `Tensor`, often denoted \\(\gamma\\) in equations, or - `None`. If present, the scale is applied to the normalized tensor. -* `variance_epsilon`: A small float number to avoid dividing by 0. -* `name`: A name for this operation (optional). - -##### Returns: - - the normalized, scaled, offset tensor. - - -- - - - -### `tf.nn.batch_norm_with_global_normalization(t, m, v, beta, gamma, variance_epsilon, scale_after_normalization, name=None)` {#batch_norm_with_global_normalization} - -Batch normalization. - -This op is deprecated. See `tf.nn.batch_normalization`. - -##### Args: - - -* `t`: A 4D input Tensor. -* `m`: A 1D mean Tensor with size matching the last dimension of t. - This is the first output from tf.nn.moments, - or a saved moving average thereof. -* `v`: A 1D variance Tensor with size matching the last dimension of t. - This is the second output from tf.nn.moments, - or a saved moving average thereof. -* `beta`: A 1D beta Tensor with size matching the last dimension of t. - An offset to be added to the normalized tensor. -* `gamma`: A 1D gamma Tensor with size matching the last dimension of t. - If "scale_after_normalization" is true, this tensor will be multiplied - with the normalized tensor. -* `variance_epsilon`: A small float number to avoid dividing by 0. -* `scale_after_normalization`: A bool indicating whether the resulted tensor - needs to be multiplied with gamma. -* `name`: A name for this operation (optional). - -##### Returns: - - A batch-normalized `t`. - - -- - - - -### `tf.nn.l2_loss(t, name=None)` {#l2_loss} - -L2 Loss. - -Computes half the L2 norm of a tensor without the `sqrt`: - - output = sum(t ** 2) / 2 - -##### Args: - - -* `t`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Typically 2-D, but may have any dimensions. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `t`. 0-D. - - -- - - - -### `tf.nn.log_poisson_loss(targets, log_input, compute_full_loss=False, name=None)` {#log_poisson_loss} - -Computes log Poisson loss given `log_input`. - -Gives the log-likelihood loss between the prediction and the target under the -assumption that the target has a Poisson distribution. -Caveat: By default, this is not the exact loss, but the loss minus a - constant term [log(z!)]. That has no effect for optimization, but - does not play well with relative loss comparisons. To compute an - approximation of the log factorial term, specify - compute_full_loss=True to enable Stirling's Approximation. - -For brevity, let `c = log(x) = log_input`, `z = targets`. The log Poisson -loss is - - -log(exp(-x) * (x^z) / z!) - = -log(exp(-x) * (x^z)) + log(z!) - ~ -log(exp(-x)) - log(x^z) [+ z * log(z) - z + 0.5 * log(2 * pi * z)] - [ Note the second term is the Stirling's Approximation for log(z!). - It is invariant to x and does not affect optimization, though - important for correct relative loss comparisons. It is only - computed when compute_full_loss == True. ] - = x - z * log(x) [+ z * log(z) - z + 0.5 * log(2 * pi * z)] - = exp(c) - z * c [+ z * log(z) - z + 0.5 * log(2 * pi * z)] - -##### Args: - - -* `targets`: A `Tensor` of the same type and shape as `log_input`. -* `log_input`: A `Tensor` of type `float32` or `float64`. -* `compute_full_loss`: whether to compute the full loss. If false, a constant - term is dropped in favor of more efficient optimization. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of the same shape as `log_input` with the componentwise - logistic losses. - -##### Raises: - - -* `ValueError`: If `log_input` and `targets` do not have the same shape. - - -- - - - -### `tf.nn.sigmoid_cross_entropy_with_logits(_sentinel=None, labels=None, logits=None, name=None)` {#sigmoid_cross_entropy_with_logits} - -Computes sigmoid cross entropy given `logits`. - -Measures the probability error in discrete classification tasks in which each -class is independent and not mutually exclusive. For instance, one could -perform multilabel classification where a picture can contain both an elephant -and a dog at the same time. - -For brevity, let `x = logits`, `z = labels`. The logistic loss is - - z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) - = z * -log(1 / (1 + exp(-x))) + (1 - z) * -log(exp(-x) / (1 + exp(-x))) - = z * log(1 + exp(-x)) + (1 - z) * (-log(exp(-x)) + log(1 + exp(-x))) - = z * log(1 + exp(-x)) + (1 - z) * (x + log(1 + exp(-x)) - = (1 - z) * x + log(1 + exp(-x)) - = x - x * z + log(1 + exp(-x)) - -For x < 0, to avoid overflow in exp(-x), we reformulate the above - - x - x * z + log(1 + exp(-x)) - = log(exp(x)) - x * z + log(1 + exp(-x)) - = - x * z + log(1 + exp(x)) - -Hence, to ensure stability and avoid overflow, the implementation uses this -equivalent formulation - - max(x, 0) - x * z + log(1 + exp(-abs(x))) - -`logits` and `labels` must have the same type and shape. - -##### Args: - - _sentinel: Used to prevent positional parameters. Internal, do not use. - -* `labels`: A `Tensor` of the same type and shape as `logits`. -* `logits`: A `Tensor` of type `float32` or `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of the same shape as `logits` with the componentwise - logistic losses. - -##### Raises: - - -* `ValueError`: If `logits` and `labels` do not have the same shape. - - -- - - - -### `tf.nn.softmax(logits, dim=-1, name=None)` {#softmax} - -Computes softmax activations. - -For each batch `i` and class `j` we have - - softmax = exp(logits) / reduce_sum(exp(logits), dim) - -##### Args: - - -* `logits`: A non-empty `Tensor`. Must be one of the following types: `half`, - `float32`, `float64`. -* `dim`: The dimension softmax would be performed on. The default is -1 which - indicates the last dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `logits`. Same shape as `logits`. - -##### Raises: - - -* `InvalidArgumentError`: if `logits` is empty or `dim` is beyond the last - dimension of `logits`. - - -- - - - -### `tf.nn.log_softmax(logits, dim=-1, name=None)` {#log_softmax} - -Computes log softmax activations. - -For each batch `i` and class `j` we have - - logsoftmax = logits - log(reduce_sum(exp(logits), dim)) - -##### Args: - - -* `logits`: A non-empty `Tensor`. Must be one of the following types: `half`, - `float32`, `float64`. -* `dim`: The dimension softmax would be performed on. The default is -1 which - indicates the last dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `logits`. Same shape as `logits`. - -##### Raises: - - -* `InvalidArgumentError`: if `logits` is empty or `dim` is beyond the last - dimension of `logits`. - - -- - - - -### `tf.nn.softmax_cross_entropy_with_logits(_sentinel=None, labels=None, logits=None, dim=-1, name=None)` {#softmax_cross_entropy_with_logits} - -Computes softmax cross entropy between `logits` and `labels`. - -Measures the probability error in discrete classification tasks in which the -classes are mutually exclusive (each entry is in exactly one class). For -example, each CIFAR-10 image is labeled with one and only one label: an image -can be a dog or a truck, but not both. - -**NOTE:** While the classes are mutually exclusive, their probabilities -need not be. All that is required is that each row of `labels` is -a valid probability distribution. If they are not, the computation of the -gradient will be incorrect. - -If using exclusive `labels` (wherein one and only -one class is true at a time), see `sparse_softmax_cross_entropy_with_logits`. - -**WARNING:** This op expects unscaled logits, since it performs a `softmax` -on `logits` internally for efficiency. Do not call this op with the -output of `softmax`, as it will produce incorrect results. - -`logits` and `labels` must have the same shape `[batch_size, num_classes]` -and the same dtype (either `float16`, `float32`, or `float64`). - -**Note that to avoid confusion, it is required to pass only named arguments to -this function.** - -##### Args: - - _sentinel: Used to prevent positional parameters. Internal, do not use. - -* `labels`: Each row `labels[i]` must be a valid probability distribution. -* `logits`: Unscaled log probabilities. -* `dim`: The class dimension. Defaulted to -1 which is the last dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A 1-D `Tensor` of length `batch_size` of the same type as `logits` with the - softmax cross entropy loss. - - -- - - - -### `tf.nn.sparse_softmax_cross_entropy_with_logits(_sentinel=None, labels=None, logits=None, name=None)` {#sparse_softmax_cross_entropy_with_logits} - -Computes sparse softmax cross entropy between `logits` and `labels`. - -Measures the probability error in discrete classification tasks in which the -classes are mutually exclusive (each entry is in exactly one class). For -example, each CIFAR-10 image is labeled with one and only one label: an image -can be a dog or a truck, but not both. - -**NOTE:** For this operation, the probability of a given label is considered -exclusive. That is, soft classes are not allowed, and the `labels` vector -must provide a single specific index for the true class for each row of -`logits` (each minibatch entry). For soft softmax classification with -a probability distribution for each entry, see -`softmax_cross_entropy_with_logits`. - -**WARNING:** This op expects unscaled logits, since it performs a softmax -on `logits` internally for efficiency. Do not call this op with the -output of `softmax`, as it will produce incorrect results. - -A common use case is to have logits of shape `[batch_size, num_classes]` and -labels of shape `[batch_size]`. But higher dimensions are supported. - -**Note that to avoid confusion, it is required to pass only named arguments to -this function.** - -##### Args: - - _sentinel: Used to prevent positional parameters. Internal, do not use. - -* `labels`: `Tensor` of shape `[d_0, d_1, ..., d_{r-1}]` (where `r` is rank of - `labels` and result) and dtype `int32` or `int64`. Each entry in `labels` - must be an index in `[0, num_classes)`. Other values will raise an - exception when this op is run on CPU, and return `NaN` for corresponding - loss and gradient rows on GPU. -* `logits`: Unscaled log probabilities of shape - `[d_0, d_1, ..., d_{r-1}, num_classes]` and dtype `float32` or `float64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of the same shape as `labels` and of the same type as `logits` - with the softmax cross entropy loss. - -##### Raises: - - -* `ValueError`: If logits are scalars (need to have rank >= 1) or if the rank - of the labels is not equal to the rank of the labels minus one. - - -- - - - -### `tf.nn.weighted_cross_entropy_with_logits(targets, logits, pos_weight, name=None)` {#weighted_cross_entropy_with_logits} - -Computes a weighted cross entropy. - -This is like `sigmoid_cross_entropy_with_logits()` except that `pos_weight`, -allows one to trade off recall and precision by up- or down-weighting the -cost of a positive error relative to a negative error. - -The usual cross-entropy cost is defined as: - - targets * -log(sigmoid(logits)) + (1 - targets) * -log(1 - sigmoid(logits)) - -The argument `pos_weight` is used as a multiplier for the positive targets: - - targets * -log(sigmoid(logits)) * pos_weight + - (1 - targets) * -log(1 - sigmoid(logits)) - -For brevity, let `x = logits`, `z = targets`, `q = pos_weight`. -The loss is: - - qz * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) - = qz * -log(1 / (1 + exp(-x))) + (1 - z) * -log(exp(-x) / (1 + exp(-x))) - = qz * log(1 + exp(-x)) + (1 - z) * (-log(exp(-x)) + log(1 + exp(-x))) - = qz * log(1 + exp(-x)) + (1 - z) * (x + log(1 + exp(-x)) - = (1 - z) * x + (qz + 1 - z) * log(1 + exp(-x)) - = (1 - z) * x + (1 + (q - 1) * z) * log(1 + exp(-x)) - -Setting `l = (1 + (q - 1) * z)`, to ensure stability and avoid overflow, -the implementation uses - - (1 - z) * x + l * (log(1 + exp(-abs(x))) + max(-x, 0)) - -`logits` and `targets` must have the same type and shape. - -##### Args: - - -* `targets`: A `Tensor` of the same type and shape as `logits`. -* `logits`: A `Tensor` of type `float32` or `float64`. -* `pos_weight`: A coefficient to use on the positive examples. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of the same shape as `logits` with the componentwise - weighted logistic losses. - -##### Raises: - - -* `ValueError`: If `logits` and `targets` do not have the same shape. - - -- - - - -### `tf.nn.embedding_lookup(params, ids, partition_strategy='mod', name=None, validate_indices=True, max_norm=None)` {#embedding_lookup} - -Looks up `ids` in a list of embedding tensors. - -This function is used to perform parallel lookups on the list of -tensors in `params`. It is a generalization of -[`tf.gather()`](../../api_docs/python/array_ops.md#gather), where `params` is -interpreted as a partitioning of a large embedding tensor. `params` may be -a `PartitionedVariable` as returned by using `tf.get_variable()` with a -partitioner. - -If `len(params) > 1`, each element `id` of `ids` is partitioned between -the elements of `params` according to the `partition_strategy`. -In all strategies, if the id space does not evenly divide the number of -partitions, each of the first `(max_id + 1) % len(params)` partitions will -be assigned one more id. - -If `partition_strategy` is `"mod"`, we assign each id to partition -`p = id % len(params)`. For instance, -13 ids are split across 5 partitions as: -`[[0, 5, 10], [1, 6, 11], [2, 7, 12], [3, 8], [4, 9]]` - -If `partition_strategy` is `"div"`, we assign ids to partitions in a -contiguous manner. In this case, 13 ids are split across 5 partitions as: -`[[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10], [11, 12]]` - -The results of the lookup are concatenated into a dense -tensor. The returned tensor has shape `shape(ids) + shape(params)[1:]`. - -##### Args: - - -* `params`: A single tensor representing the complete embedding tensor, - or a list of P tensors all of same shape except for the first dimension, - representing sharded embedding tensors. Alternatively, a - `PartitionedVariable`, created by partitioning along dimension 0. Each - element must be appropriately sized for the given `partition_strategy`. -* `ids`: A `Tensor` with type `int32` or `int64` containing the ids to be looked - up in `params`. -* `partition_strategy`: A string specifying the partitioning strategy, relevant - if `len(params) > 1`. Currently `"div"` and `"mod"` are supported. Default - is `"mod"`. -* `name`: A name for the operation (optional). -* `validate_indices`: Whether or not to validate gather indices. -* `max_norm`: If not None, embedding values are l2-normalized to the value of - max_norm. - -##### Returns: - - A `Tensor` with the same type as the tensors in `params`. - -##### Raises: - - -* `ValueError`: If `params` is empty. - - -- - - - -### `tf.nn.embedding_lookup_sparse(params, sp_ids, sp_weights, partition_strategy='mod', name=None, combiner=None, max_norm=None)` {#embedding_lookup_sparse} - -Computes embeddings for the given ids and weights. - -This op assumes that there is at least one id for each row in the dense tensor -represented by sp_ids (i.e. there are no rows with empty features), and that -all the indices of sp_ids are in canonical row-major order. - -It also assumes that all id values lie in the range [0, p0), where p0 -is the sum of the size of params along dimension 0. - -##### Args: - - -* `params`: A single tensor representing the complete embedding tensor, - or a list of P tensors all of same shape except for the first dimension, - representing sharded embedding tensors. Alternatively, a - `PartitionedVariable`, created by partitioning along dimension 0. Each - element must be appropriately sized for the given `partition_strategy`. -* `sp_ids`: N x M SparseTensor of int64 ids (typically from FeatureValueToId), - where N is typically batch size and M is arbitrary. -* `sp_weights`: either a SparseTensor of float / double weights, or None to - indicate all weights should be taken to be 1. If specified, sp_weights - must have exactly the same shape and indices as sp_ids. -* `partition_strategy`: A string specifying the partitioning strategy, relevant - if `len(params) > 1`. Currently `"div"` and `"mod"` are supported. Default - is `"mod"`. See `tf.nn.embedding_lookup` for more details. -* `name`: Optional name for the op. -* `combiner`: A string specifying the reduction op. Currently "mean", "sqrtn" - and "sum" are supported. - "sum" computes the weighted sum of the embedding results for each row. - "mean" is the weighted sum divided by the total weight. - "sqrtn" is the weighted sum divided by the square root of the sum of the - squares of the weights. -* `max_norm`: If not None, each embedding is normalized to have l2 norm equal - to max_norm before combining. - -##### Returns: - - A dense tensor representing the combined embeddings for the - sparse ids. For each row in the dense tensor represented by sp_ids, the op - looks up the embeddings for all ids in that row, multiplies them by the - corresponding weight, and combines these embeddings as specified. - - In other words, if - - shape(combined params) = [p0, p1, ..., pm] - - and - - shape(sp_ids) = shape(sp_weights) = [d0, d1, ..., dn] - - then - - shape(output) = [d0, d1, ..., dn-1, p1, ..., pm]. - - For instance, if params is a 10x20 matrix, and sp_ids / sp_weights are - - [0, 0]: id 1, weight 2.0 - [0, 1]: id 3, weight 0.5 - [1, 0]: id 0, weight 1.0 - [2, 3]: id 1, weight 3.0 - - with `combiner`="mean", then the output will be a 3x20 matrix where - - output[0, :] = (params[1, :] * 2.0 + params[3, :] * 0.5) / (2.0 + 0.5) - output[1, :] = params[0, :] * 1.0 - output[2, :] = params[1, :] * 3.0 - -##### Raises: - - -* `TypeError`: If sp_ids is not a SparseTensor, or if sp_weights is neither - None nor SparseTensor. -* `ValueError`: If combiner is not one of {"mean", "sqrtn", "sum"}. - - -- - - - -### `tf.nn.dynamic_rnn(cell, inputs, sequence_length=None, initial_state=None, dtype=None, parallel_iterations=None, swap_memory=False, time_major=False, scope=None)` {#dynamic_rnn} - -Creates a recurrent neural network specified by RNNCell `cell`. - -This function is functionally identical to the function `rnn` above, but -performs fully dynamic unrolling of `inputs`. - -Unlike `rnn`, the input `inputs` is not a Python list of `Tensors`, one for -each frame. Instead, `inputs` may be a single `Tensor` where -the maximum time is either the first or second dimension (see the parameter -`time_major`). Alternatively, it may be a (possibly nested) tuple of -Tensors, each of them having matching batch and time dimensions. -The corresponding output is either a single `Tensor` having the same number -of time steps and batch size, or a (possibly nested) tuple of such tensors, -matching the nested structure of `cell.output_size`. - -The parameter `sequence_length` is optional and is used to copy-through state -and zero-out outputs when past a batch element's sequence length. So it's more -for correctness than performance, unlike in rnn(). - -##### Args: - - -* `cell`: An instance of RNNCell. -* `inputs`: The RNN inputs. - - If `time_major == False` (default), this must be a `Tensor` of shape: - `[batch_size, max_time, ...]`, or a nested tuple of such - elements. - - If `time_major == True`, this must be a `Tensor` of shape: - `[max_time, batch_size, ...]`, or a nested tuple of such - elements. - - This may also be a (possibly nested) tuple of Tensors satisfying - this property. The first two dimensions must match across all the inputs, - but otherwise the ranks and other shape components may differ. - In this case, input to `cell` at each time-step will replicate the - structure of these tuples, except for the time dimension (from which the - time is taken). - - The input to `cell` at each time step will be a `Tensor` or (possibly - nested) tuple of Tensors each with dimensions `[batch_size, ...]`. - -* `sequence_length`: (optional) An int32/int64 vector sized `[batch_size]`. -* `initial_state`: (optional) An initial state for the RNN. - If `cell.state_size` is an integer, this must be - a `Tensor` of appropriate type and shape `[batch_size, cell.state_size]`. - If `cell.state_size` is a tuple, this should be a tuple of - tensors having shapes `[batch_size, s] for s in cell.state_size`. -* `dtype`: (optional) The data type for the initial state and expected output. - Required if initial_state is not provided or RNN state has a heterogeneous - dtype. -* `parallel_iterations`: (Default: 32). The number of iterations to run in - parallel. Those operations which do not have any temporal dependency - and can be run in parallel, will be. This parameter trades off - time for space. Values >> 1 use more memory but take less time, - while smaller values use less memory but computations take longer. -* `swap_memory`: Transparently swap the tensors produced in forward inference - but needed for back prop from GPU to CPU. This allows training RNNs - which would typically not fit on a single GPU, with very minimal (or no) - performance penalty. -* `time_major`: The shape format of the `inputs` and `outputs` Tensors. - If true, these `Tensors` must be shaped `[max_time, batch_size, depth]`. - If false, these `Tensors` must be shaped `[batch_size, max_time, depth]`. - Using `time_major = True` is a bit more efficient because it avoids - transposes at the beginning and end of the RNN calculation. However, - most TensorFlow data is batch-major, so by default this function - accepts input and emits output in batch-major form. -* `scope`: VariableScope for the created subgraph; defaults to "rnn". - -##### Returns: - - A pair (outputs, state) where: - - -* `outputs`: The RNN output `Tensor`. - - If time_major == False (default), this will be a `Tensor` shaped: - `[batch_size, max_time, cell.output_size]`. - - If time_major == True, this will be a `Tensor` shaped: - `[max_time, batch_size, cell.output_size]`. - - Note, if `cell.output_size` is a (possibly nested) tuple of integers - or `TensorShape` objects, then `outputs` will be a tuple having the - same structure as `cell.output_size`, containing Tensors having shapes - corresponding to the shape data in `cell.output_size`. - - -* `state`: The final state. If `cell.state_size` is an int, this - will be shaped `[batch_size, cell.state_size]`. If it is a - `TensorShape`, this will be shaped `[batch_size] + cell.state_size`. - If it is a (possibly nested) tuple of ints or `TensorShape`, this will - be a tuple having the corresponding shapes. - -##### Raises: - - -* `TypeError`: If `cell` is not an instance of RNNCell. -* `ValueError`: If inputs is None or an empty list. - - -- - - - -### `tf.nn.bidirectional_dynamic_rnn(cell_fw, cell_bw, inputs, sequence_length=None, initial_state_fw=None, initial_state_bw=None, dtype=None, parallel_iterations=None, swap_memory=False, time_major=False, scope=None)` {#bidirectional_dynamic_rnn} - -Creates a dynamic version of bidirectional recurrent neural network. - -Similar to the unidirectional case above (rnn) but takes input and builds -independent forward and backward RNNs. The input_size of forward and -backward cell must match. The initial state for both directions is zero by -default (but can be set optionally) and no intermediate states are ever -returned -- the network is fully unrolled for the given (passed in) -length(s) of the sequence(s) or completely unrolled if length(s) is not -given. - -##### Args: - - -* `cell_fw`: An instance of RNNCell, to be used for forward direction. -* `cell_bw`: An instance of RNNCell, to be used for backward direction. -* `inputs`: The RNN inputs. - If time_major == False (default), this must be a tensor of shape: - `[batch_size, max_time, input_size]`. - If time_major == True, this must be a tensor of shape: - `[max_time, batch_size, input_size]`. - [batch_size, input_size]. -* `sequence_length`: An int32/int64 vector, size `[batch_size]`, - containing the actual lengths for each of the sequences. -* `initial_state_fw`: (optional) An initial state for the forward RNN. - This must be a tensor of appropriate type and shape - `[batch_size, cell_fw.state_size]`. - If `cell_fw.state_size` is a tuple, this should be a tuple of - tensors having shapes `[batch_size, s] for s in cell_fw.state_size`. -* `initial_state_bw`: (optional) Same as for `initial_state_fw`, but using - the corresponding properties of `cell_bw`. -* `dtype`: (optional) The data type for the initial states and expected output. - Required if initial_states are not provided or RNN states have a - heterogeneous dtype. -* `parallel_iterations`: (Default: 32). The number of iterations to run in - parallel. Those operations which do not have any temporal dependency - and can be run in parallel, will be. This parameter trades off - time for space. Values >> 1 use more memory but take less time, - while smaller values use less memory but computations take longer. -* `swap_memory`: Transparently swap the tensors produced in forward inference - but needed for back prop from GPU to CPU. This allows training RNNs - which would typically not fit on a single GPU, with very minimal (or no) - performance penalty. -* `time_major`: The shape format of the `inputs` and `outputs` Tensors. - If true, these `Tensors` must be shaped `[max_time, batch_size, depth]`. - If false, these `Tensors` must be shaped `[batch_size, max_time, depth]`. - Using `time_major = True` is a bit more efficient because it avoids - transposes at the beginning and end of the RNN calculation. However, - most TensorFlow data is batch-major, so by default this function - accepts input and emits output in batch-major form. -* `dtype`: (optional) The data type for the initial state. Required if - either of the initial states are not provided. -* `scope`: VariableScope for the created subgraph; defaults to - "bidirectional_rnn" - -##### Returns: - - A tuple (outputs, output_states) where: - -* `outputs`: A tuple (output_fw, output_bw) containing the forward and - the backward rnn output `Tensor`. - If time_major == False (default), - output_fw will be a `Tensor` shaped: - `[batch_size, max_time, cell_fw.output_size]` - and output_bw will be a `Tensor` shaped: - `[batch_size, max_time, cell_bw.output_size]`. - If time_major == True, - output_fw will be a `Tensor` shaped: - `[max_time, batch_size, cell_fw.output_size]` - and output_bw will be a `Tensor` shaped: - `[max_time, batch_size, cell_bw.output_size]`. - It returns a tuple instead of a single concatenated `Tensor`, unlike - in the `bidirectional_rnn`. If the concatenated one is preferred, - the forward and backward outputs can be concatenated as - `tf.concat(outputs, 2)`. -* `output_states`: A tuple (output_state_fw, output_state_bw) containing - the forward and the backward final states of bidirectional rnn. - -##### Raises: - - -* `TypeError`: If `cell_fw` or `cell_bw` is not an instance of `RNNCell`. - - -- - - - -### `tf.nn.raw_rnn(cell, loop_fn, parallel_iterations=None, swap_memory=False, scope=None)` {#raw_rnn} - -Creates an `RNN` specified by RNNCell `cell` and loop function `loop_fn`. - -**NOTE: This method is still in testing, and the API may change.** - -This function is a more primitive version of `dynamic_rnn` that provides -more direct access to the inputs each iteration. It also provides more -control over when to start and finish reading the sequence, and -what to emit for the output. - -For example, it can be used to implement the dynamic decoder of a seq2seq -model. - -Instead of working with `Tensor` objects, most operations work with -`TensorArray` objects directly. - -The operation of `raw_rnn`, in pseudo-code, is basically the following: - -```python -time = tf.constant(0, dtype=tf.int32) -(finished, next_input, initial_state, _, loop_state) = loop_fn( - time=time, cell_output=None, cell_state=None, loop_state=None) -emit_ta = TensorArray(dynamic_size=True, dtype=initial_state.dtype) -state = initial_state -while not all(finished): - (output, cell_state) = cell(next_input, state) - (next_finished, next_input, next_state, emit, loop_state) = loop_fn( - time=time + 1, cell_output=output, cell_state=cell_state, - loop_state=loop_state) - # Emit zeros and copy forward state for minibatch entries that are finished. - state = tf.where(finished, state, next_state) - emit = tf.where(finished, tf.zeros_like(emit), emit) - emit_ta = emit_ta.write(time, emit) - # If any new minibatch entries are marked as finished, mark these. - finished = tf.logical_or(finished, next_finished) - time += 1 -return (emit_ta, state, loop_state) -``` - -with the additional properties that output and state may be (possibly nested) -tuples, as determined by `cell.output_size` and `cell.state_size`, and -as a result the final `state` and `emit_ta` may themselves be tuples. - -A simple implementation of `dynamic_rnn` via `raw_rnn` looks like this: - -```python -inputs = tf.placeholder(shape=(max_time, batch_size, input_depth), - dtype=tf.float32) -sequence_length = tf.placeholder(shape=(batch_size,), dtype=tf.int32) -inputs_ta = tf.TensorArray(dtype=tf.float32, size=max_time) -inputs_ta = inputs_ta.unstack(inputs) - -cell = tf.contrib.rnn.LSTMCell(num_units) - -def loop_fn(time, cell_output, cell_state, loop_state): - emit_output = cell_output # == None for time == 0 - if cell_output is None: # time == 0 - next_cell_state = cell.zero_state(batch_size, tf.float32) - else: - next_cell_state = cell_state - elements_finished = (time >= sequence_length) - finished = tf.reduce_all(elements_finished) - next_input = tf.cond( - finished, - lambda: tf.zeros([batch_size, input_depth], dtype=tf.float32), - lambda: inputs_ta.read(time)) - next_loop_state = None - return (elements_finished, next_input, next_cell_state, - emit_output, next_loop_state) - -outputs_ta, final_state, _ = raw_rnn(cell, loop_fn) -outputs = outputs_ta.stack() -``` - -##### Args: - - -* `cell`: An instance of RNNCell. -* `loop_fn`: A callable that takes inputs - `(time, cell_output, cell_state, loop_state)` - and returns the tuple - `(finished, next_input, next_cell_state, emit_output, next_loop_state)`. - Here `time` is an int32 scalar `Tensor`, `cell_output` is a - `Tensor` or (possibly nested) tuple of tensors as determined by - `cell.output_size`, and `cell_state` is a `Tensor` - or (possibly nested) tuple of tensors, as determined by the `loop_fn` - on its first call (and should match `cell.state_size`). - The outputs are: `finished`, a boolean `Tensor` of - shape `[batch_size]`, `next_input`: the next input to feed to `cell`, - `next_cell_state`: the next state to feed to `cell`, - and `emit_output`: the output to store for this iteration. - - Note that `emit_output` should be a `Tensor` or (possibly nested) - tuple of tensors with shapes and structure matching `cell.output_size` - and `cell_output` above. The parameter `cell_state` and output - `next_cell_state` may be either a single or (possibly nested) tuple - of tensors. The parameter `loop_state` and - output `next_loop_state` may be either a single or (possibly nested) tuple - of `Tensor` and `TensorArray` objects. This last parameter - may be ignored by `loop_fn` and the return value may be `None`. If it - is not `None`, then the `loop_state` will be propagated through the RNN - loop, for use purely by `loop_fn` to keep track of its own state. - The `next_loop_state` parameter returned may be `None`. - - The first call to `loop_fn` will be `time = 0`, `cell_output = None`, - `cell_state = None`, and `loop_state = None`. For this call: - The `next_cell_state` value should be the value with which to initialize - the cell's state. It may be a final state from a previous RNN or it - may be the output of `cell.zero_state()`. It should be a - (possibly nested) tuple structure of tensors. - If `cell.state_size` is an integer, this must be - a `Tensor` of appropriate type and shape `[batch_size, cell.state_size]`. - If `cell.state_size` is a `TensorShape`, this must be a `Tensor` of - appropriate type and shape `[batch_size] + cell.state_size`. - If `cell.state_size` is a (possibly nested) tuple of ints or - `TensorShape`, this will be a tuple having the corresponding shapes. - The `emit_output` value may be either `None` or a (possibly nested) - tuple structure of tensors, e.g., - `(tf.zeros(shape_0, dtype=dtype_0), tf.zeros(shape_1, dtype=dtype_1))`. - If this first `emit_output` return value is `None`, - then the `emit_ta` result of `raw_rnn` will have the same structure and - dtypes as `cell.output_size`. Otherwise `emit_ta` will have the same - structure, shapes (prepended with a `batch_size` dimension), and dtypes - as `emit_output`. The actual values returned for `emit_output` at this - initializing call are ignored. Note, this emit structure must be - consistent across all time steps. - - -* `parallel_iterations`: (Default: 32). The number of iterations to run in - parallel. Those operations which do not have any temporal dependency - and can be run in parallel, will be. This parameter trades off - time for space. Values >> 1 use more memory but take less time, - while smaller values use less memory but computations take longer. -* `swap_memory`: Transparently swap the tensors produced in forward inference - but needed for back prop from GPU to CPU. This allows training RNNs - which would typically not fit on a single GPU, with very minimal (or no) - performance penalty. -* `scope`: VariableScope for the created subgraph; defaults to "rnn". - -##### Returns: - - A tuple `(emit_ta, final_state, final_loop_state)` where: - - `emit_ta`: The RNN output `TensorArray`. - If `loop_fn` returns a (possibly nested) set of Tensors for - `emit_output` during initialization, (inputs `time = 0`, - `cell_output = None`, and `loop_state = None`), then `emit_ta` will - have the same structure, dtypes, and shapes as `emit_output` instead. - If `loop_fn` returns `emit_output = None` during this call, - the structure of `cell.output_size` is used: - If `cell.output_size` is a (possibly nested) tuple of integers - or `TensorShape` objects, then `emit_ta` will be a tuple having the - same structure as `cell.output_size`, containing TensorArrays whose - elements' shapes correspond to the shape data in `cell.output_size`. - - `final_state`: The final cell state. If `cell.state_size` is an int, this - will be shaped `[batch_size, cell.state_size]`. If it is a - `TensorShape`, this will be shaped `[batch_size] + cell.state_size`. - If it is a (possibly nested) tuple of ints or `TensorShape`, this will - be a tuple having the corresponding shapes. - - `final_loop_state`: The final loop state as returned by `loop_fn`. - -##### Raises: - - -* `TypeError`: If `cell` is not an instance of RNNCell, or `loop_fn` is not - a `callable`. - - -- - - - -### `tf.nn.ctc_loss(labels, inputs, sequence_length, preprocess_collapse_repeated=False, ctc_merge_repeated=True, time_major=True)` {#ctc_loss} - -Computes the CTC (Connectionist Temporal Classification) Loss. - -This op implements the CTC loss as presented in the article: - -A. Graves, S. Fernandez, F. Gomez, J. Schmidhuber. -Connectionist Temporal Classification: Labelling Unsegmented Sequence Data -with Recurrent Neural Networks. ICML 2006, Pittsburgh, USA, pp. 369-376. - -http://www.cs.toronto.edu/~graves/icml_2006.pdf - -Input requirements: - -``` -sequence_length(b) <= time for all b - -max(labels.indices(labels.indices[:, 1] == b, 2)) - <= sequence_length(b) for all b. -``` - -Notes: - -This class performs the softmax operation for you, so inputs should -be e.g. linear projections of outputs by an LSTM. - -The `inputs` Tensor's innermost dimension size, `num_classes`, represents -`num_labels + 1` classes, where num_labels is the number of true labels, and -the largest value `(num_classes - 1)` is reserved for the blank label. - -For example, for a vocabulary containing 3 labels `[a, b, c]`, -`num_classes = 4` and the labels indexing is `{a: 0, b: 1, c: 2, blank: 3}`. - -Regarding the arguments `preprocess_collapse_repeated` and -`ctc_merge_repeated`: - -If `preprocess_collapse_repeated` is True, then a preprocessing step runs -before loss calculation, wherein repeated labels passed to the loss -are merged into single labels. This is useful if the training labels come -from, e.g., forced alignments and therefore have unnecessary repetitions. - -If `ctc_merge_repeated` is set False, then deep within the CTC calculation, -repeated non-blank labels will not be merged and are interpreted -as individual labels. This is a simplified (non-standard) version of CTC. - -Here is a table of the (roughly) expected first order behavior: - -* `preprocess_collapse_repeated=False`, `ctc_merge_repeated=True` - - Classical CTC behavior: Outputs true repeated classes with blanks in - between, and can also output repeated classes with no blanks in - between that need to be collapsed by the decoder. - -* `preprocess_collapse_repeated=True`, `ctc_merge_repeated=False` - - Never learns to output repeated classes, as they are collapsed - in the input labels before training. - -* `preprocess_collapse_repeated=False`, `ctc_merge_repeated=False` - - Outputs repeated classes with blanks in between, but generally does not - require the decoder to collapse/merge repeated classes. - -* `preprocess_collapse_repeated=True`, `ctc_merge_repeated=True` - - Untested. Very likely will not learn to output repeated classes. - -##### Args: - - -* `labels`: An `int32` `SparseTensor`. - `labels.indices[i, :] == [b, t]` means `labels.values[i]` stores - the id for (batch b, time t). - `labels.values[i]` must take on values in `[0, num_labels)`. - See `core/ops/ctc_ops.cc` for more details. -* `inputs`: 3-D `float` `Tensor`. - If time_major == False, this will be a `Tensor` shaped: - `[batch_size x max_time x num_classes]`. - If time_major == True (default), this will be a `Tensor` shaped: - `[max_time x batch_size x num_classes]`. - The logits. -* `sequence_length`: 1-D `int32` vector, size `[batch_size]`. - The sequence lengths. -* `preprocess_collapse_repeated`: Boolean. Default: False. - If True, repeated labels are collapsed prior to the CTC calculation. -* `ctc_merge_repeated`: Boolean. Default: True. -* `time_major`: The shape format of the `inputs` Tensors. - If True, these `Tensors` must be shaped `[max_time, batch_size, num_classes]`. - If False, these `Tensors` must be shaped `[batch_size, max_time, num_classes]`. - Using `time_major = True` (default) is a bit more efficient because it avoids - transposes at the beginning of the ctc_loss calculation. However, most - TensorFlow data is batch-major, so by this function also accepts inputs - in batch-major form. - -##### Returns: - - A 1-D `float` `Tensor`, size `[batch]`, containing the negative log probabilities. - -##### Raises: - - -* `TypeError`: if labels is not a `SparseTensor`. - - -- - - - -### `tf.nn.ctc_greedy_decoder(inputs, sequence_length, merge_repeated=True)` {#ctc_greedy_decoder} - -Performs greedy decoding on the logits given in input (best path). - -Note: Regardless of the value of merge_repeated, if the maximum index of a -given time and batch corresponds to the blank index `(num_classes - 1)`, no -new element is emitted. - -If `merge_repeated` is `True`, merge repeated classes in output. -This means that if consecutive logits' maximum indices are the same, -only the first of these is emitted. The sequence `A B B * B * B` (where '*' -is the blank label) becomes - - * `A B B B` if `merge_repeated=True`. - * `A B B B B` if `merge_repeated=False`. - -##### Args: - - -* `inputs`: 3-D `float` `Tensor` sized - `[max_time x batch_size x num_classes]`. The logits. -* `sequence_length`: 1-D `int32` vector containing sequence lengths, - having size `[batch_size]`. -* `merge_repeated`: Boolean. Default: True. - -##### Returns: - - A tuple `(decoded, log_probabilities)` where - -* `decoded`: A single-element list. `decoded[0]` - is an `SparseTensor` containing the decoded outputs s.t.: - `decoded.indices`: Indices matrix `(total_decoded_outputs x 2)`. - The rows store: `[batch, time]`. - `decoded.values`: Values vector, size `(total_decoded_outputs)`. - The vector stores the decoded classes. - `decoded.shape`: Shape vector, size `(2)`. - The shape values are: `[batch_size, max_decoded_length]` -* `log_probability`: A `float` matrix `(batch_size x 1)` containing sequence - log-probabilities. - - -- - - - -### `tf.nn.ctc_beam_search_decoder(inputs, sequence_length, beam_width=100, top_paths=1, merge_repeated=True)` {#ctc_beam_search_decoder} - -Performs beam search decoding on the logits given in input. - -**Note** The `ctc_greedy_decoder` is a special case of the -`ctc_beam_search_decoder` with `top_paths=1` and `beam_width=1` (but -that decoder is faster for this special case). - -If `merge_repeated` is `True`, merge repeated classes in the output beams. -This means that if consecutive entries in a beam are the same, -only the first of these is emitted. That is, when the top path -is `A B B B B`, the return value is: - - * `A B` if `merge_repeated = True`. - * `A B B B B` if `merge_repeated = False`. - -##### Args: - - -* `inputs`: 3-D `float` `Tensor`, size - `[max_time x batch_size x num_classes]`. The logits. -* `sequence_length`: 1-D `int32` vector containing sequence lengths, - having size `[batch_size]`. -* `beam_width`: An int scalar >= 0 (beam search beam width). -* `top_paths`: An int scalar >= 0, <= beam_width (controls output size). -* `merge_repeated`: Boolean. Default: True. - -##### Returns: - - A tuple `(decoded, log_probabilities)` where - -* `decoded`: A list of length top_paths, where `decoded[j]` - is a `SparseTensor` containing the decoded outputs: - `decoded[j].indices`: Indices matrix `(total_decoded_outputs[j] x 2)` - The rows store: [batch, time]. - `decoded[j].values`: Values vector, size `(total_decoded_outputs[j])`. - The vector stores the decoded classes for beam j. - `decoded[j].shape`: Shape vector, size `(2)`. - The shape values are: `[batch_size, max_decoded_length[j]]`. -* `log_probability`: A `float` matrix `(batch_size x top_paths)` containing - sequence log-probabilities. - - -- - - - -### `tf.nn.top_k(input, k=1, sorted=True, name=None)` {#top_k} - -Finds values and indices of the `k` largest entries for the last dimension. - -If the input is a vector (rank-1), finds the `k` largest entries in the vector -and outputs their values and indices as vectors. Thus `values[j]` is the -`j`-th largest entry in `input`, and its index is `indices[j]`. - -For matrices (resp. higher rank input), computes the top `k` entries in each -row (resp. vector along the last dimension). Thus, - - values.shape = indices.shape = input.shape[:-1] + [k] - -If two elements are equal, the lower-index element appears first. - -##### Args: - - -* `input`: 1-D or higher `Tensor` with last dimension at least `k`. -* `k`: 0-D `int32` `Tensor`. Number of top elements to look for along the last - dimension (along each row for matrices). -* `sorted`: If true the resulting `k` elements will be sorted by the values in - descending order. -* `name`: Optional name for the operation. - -##### Returns: - - -* `values`: The `k` largest elements along each last dimensional slice. -* `indices`: The indices of `values` within the last dimension of `input`. - - -- - - - -### `tf.nn.in_top_k(predictions, targets, k, name=None)` {#in_top_k} - -Says whether the targets are in the top `K` predictions. - -This outputs a `batch_size` bool array, an entry `out[i]` is `true` if the -prediction for the target class is among the top `k` predictions among -all predictions for example `i`. Note that the behavior of `InTopK` differs -from the `TopK` op in its handling of ties; if multiple classes have the -same prediction value and straddle the top-`k` boundary, all of those -classes are considered to be in the top `k`. - -More formally, let - - \\(predictions_i\\) be the predictions for all classes for example `i`, - \\(targets_i\\) be the target class for example `i`, - \\(out_i\\) be the output for example `i`, - -$$out_i = predictions_{i, targets_i} \in TopKIncludingTies(predictions_i)$$ - -##### Args: - - -* `predictions`: A `Tensor` of type `float32`. - A `batch_size` x `classes` tensor. -* `targets`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A `batch_size` vector of class ids. -* `k`: An `int`. Number of top elements to look at for computing precision. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. Computed Precision at `k` as a `bool Tensor`. - - -- - - - -### `tf.nn.nce_loss(weights, biases, labels, inputs, num_sampled, num_classes, num_true=1, sampled_values=None, remove_accidental_hits=False, partition_strategy='mod', name='nce_loss')` {#nce_loss} - -Computes and returns the noise-contrastive estimation training loss. - -See [Noise-contrastive estimation: A new estimation principle for -unnormalized statistical -models](http://www.jmlr.org/proceedings/papers/v9/gutmann10a/gutmann10a.pdf). -Also see our [Candidate Sampling Algorithms -Reference](../../extras/candidate_sampling.pdf) - -Note: By default this uses a log-uniform (Zipfian) distribution for sampling, -so your labels must be sorted in order of decreasing frequency to achieve -good results. For more details, see -[log_uniform_candidate_sampler](#log_uniform_candidate_sampler). - -Note: In the case where `num_true` > 1, we assign to each target class -the target probability 1 / `num_true` so that the target probabilities -sum to 1 per-example. - -Note: It would be useful to allow a variable number of target classes per -example. We hope to provide this functionality in a future release. -For now, if you have a variable number of target classes, you can pad them -out to a constant number by either repeating them or by padding -with an otherwise unused class. - -##### Args: - - -* `weights`: A `Tensor` of shape `[num_classes, dim]`, or a list of `Tensor` - objects whose concatenation along dimension 0 has shape - [num_classes, dim]. The (possibly-partitioned) class embeddings. -* `biases`: A `Tensor` of shape `[num_classes]`. The class biases. -* `labels`: A `Tensor` of type `int64` and shape `[batch_size, - num_true]`. The target classes. -* `inputs`: A `Tensor` of shape `[batch_size, dim]`. The forward - activations of the input network. -* `num_sampled`: An `int`. The number of classes to randomly sample per batch. -* `num_classes`: An `int`. The number of possible classes. -* `num_true`: An `int`. The number of target classes per training example. -* `sampled_values`: a tuple of (`sampled_candidates`, `true_expected_count`, - `sampled_expected_count`) returned by a `*_candidate_sampler` function. - (if None, we default to `log_uniform_candidate_sampler`) -* `remove_accidental_hits`: A `bool`. Whether to remove "accidental hits" - where a sampled class equals one of the target classes. If set to - `True`, this is a "Sampled Logistic" loss instead of NCE, and we are - learning to generate log-odds instead of log probabilities. See - our [Candidate Sampling Algorithms Reference] - (../../extras/candidate_sampling.pdf). - Default is False. -* `partition_strategy`: A string specifying the partitioning strategy, relevant - if `len(weights) > 1`. Currently `"div"` and `"mod"` are supported. - Default is `"mod"`. See `tf.nn.embedding_lookup` for more details. -* `name`: A name for the operation (optional). - -##### Returns: - - A `batch_size` 1-D tensor of per-example NCE losses. - - -- - - - -### `tf.nn.sampled_softmax_loss(weights, biases, labels, inputs, num_sampled, num_classes, num_true=1, sampled_values=None, remove_accidental_hits=True, partition_strategy='mod', name='sampled_softmax_loss')` {#sampled_softmax_loss} - -Computes and returns the sampled softmax training loss. - -This is a faster way to train a softmax classifier over a huge number of -classes. - -This operation is for training only. It is generally an underestimate of -the full softmax loss. - -At inference time, you can compute full softmax probabilities with the -expression `tf.nn.softmax(tf.matmul(inputs, tf.transpose(weights)) + biases)`. - -See our [Candidate Sampling Algorithms Reference] -(../../extras/candidate_sampling.pdf) - -Also see Section 3 of [Jean et al., 2014](http://arxiv.org/abs/1412.2007) -([pdf](http://arxiv.org/pdf/1412.2007.pdf)) for the math. - -##### Args: - - -* `weights`: A `Tensor` of shape `[num_classes, dim]`, or a list of `Tensor` - objects whose concatenation along dimension 0 has shape - [num_classes, dim]. The (possibly-sharded) class embeddings. -* `biases`: A `Tensor` of shape `[num_classes]`. The class biases. -* `labels`: A `Tensor` of type `int64` and shape `[batch_size, - num_true]`. The target classes. Note that this format differs from - the `labels` argument of `nn.softmax_cross_entropy_with_logits`. -* `inputs`: A `Tensor` of shape `[batch_size, dim]`. The forward - activations of the input network. -* `num_sampled`: An `int`. The number of classes to randomly sample per batch. -* `num_classes`: An `int`. The number of possible classes. -* `num_true`: An `int`. The number of target classes per training example. -* `sampled_values`: a tuple of (`sampled_candidates`, `true_expected_count`, - `sampled_expected_count`) returned by a `*_candidate_sampler` function. - (if None, we default to `log_uniform_candidate_sampler`) -* `remove_accidental_hits`: A `bool`. whether to remove "accidental hits" - where a sampled class equals one of the target classes. Default is - True. -* `partition_strategy`: A string specifying the partitioning strategy, relevant - if `len(weights) > 1`. Currently `"div"` and `"mod"` are supported. - Default is `"mod"`. See `tf.nn.embedding_lookup` for more details. -* `name`: A name for the operation (optional). - -##### Returns: - - A `batch_size` 1-D tensor of per-example sampled softmax losses. - - -- - - - -### `tf.nn.uniform_candidate_sampler(true_classes, num_true, num_sampled, unique, range_max, seed=None, name=None)` {#uniform_candidate_sampler} - -Samples a set of classes using a uniform base distribution. - -This operation randomly samples a tensor of sampled classes -(`sampled_candidates`) from the range of integers `[0, range_max)`. - -The elements of `sampled_candidates` are drawn without replacement -(if `unique=True`) or with replacement (if `unique=False`) from -the base distribution. - -The base distribution for this operation is the uniform distribution -over the range of integers `[0, range_max)`. - -In addition, this operation returns tensors `true_expected_count` -and `sampled_expected_count` representing the number of times each -of the target classes (`true_classes`) and the sampled -classes (`sampled_candidates`) is expected to occur in an average -tensor of sampled classes. These values correspond to `Q(y|x)` -defined in [this -document](http://www.tensorflow.org/extras/candidate_sampling.pdf). -If `unique=True`, then these are post-rejection probabilities and we -compute them approximately. - -##### Args: - - -* `true_classes`: A `Tensor` of type `int64` and shape `[batch_size, - num_true]`. The target classes. -* `num_true`: An `int`. The number of target classes per training example. -* `num_sampled`: An `int`. The number of classes to randomly sample per batch. -* `unique`: A `bool`. Determines whether all sampled classes in a batch are - unique. -* `range_max`: An `int`. The number of possible classes. -* `seed`: An `int`. An operation-specific seed. Default is 0. -* `name`: A name for the operation (optional). - -##### Returns: - - -* `sampled_candidates`: A tensor of type `int64` and shape `[num_sampled]`. - The sampled classes. -* `true_expected_count`: A tensor of type `float`. Same shape as - `true_classes`. The expected counts under the sampling distribution - of each of `true_classes`. -* `sampled_expected_count`: A tensor of type `float`. Same shape as - `sampled_candidates`. The expected counts under the sampling distribution - of each of `sampled_candidates`. - - -- - - - -### `tf.nn.log_uniform_candidate_sampler(true_classes, num_true, num_sampled, unique, range_max, seed=None, name=None)` {#log_uniform_candidate_sampler} - -Samples a set of classes using a log-uniform (Zipfian) base distribution. - -This operation randomly samples a tensor of sampled classes -(`sampled_candidates`) from the range of integers `[0, range_max)`. - -The elements of `sampled_candidates` are drawn without replacement -(if `unique=True`) or with replacement (if `unique=False`) from -the base distribution. - -The base distribution for this operation is an approximately log-uniform -or Zipfian distribution: - -`P(class) = (log(class + 2) - log(class + 1)) / log(range_max + 1)` - -This sampler is useful when the target classes approximately follow such -a distribution - for example, if the classes represent words in a lexicon -sorted in decreasing order of frequency. If your classes are not ordered by -decreasing frequency, do not use this op. - -In addition, this operation returns tensors `true_expected_count` -and `sampled_expected_count` representing the number of times each -of the target classes (`true_classes`) and the sampled -classes (`sampled_candidates`) is expected to occur in an average -tensor of sampled classes. These values correspond to `Q(y|x)` -defined in [this -document](http://www.tensorflow.org/extras/candidate_sampling.pdf). -If `unique=True`, then these are post-rejection probabilities and we -compute them approximately. - -##### Args: - - -* `true_classes`: A `Tensor` of type `int64` and shape `[batch_size, - num_true]`. The target classes. -* `num_true`: An `int`. The number of target classes per training example. -* `num_sampled`: An `int`. The number of classes to randomly sample per batch. -* `unique`: A `bool`. Determines whether all sampled classes in a batch are - unique. -* `range_max`: An `int`. The number of possible classes. -* `seed`: An `int`. An operation-specific seed. Default is 0. -* `name`: A name for the operation (optional). - -##### Returns: - - -* `sampled_candidates`: A tensor of type `int64` and shape `[num_sampled]`. - The sampled classes. -* `true_expected_count`: A tensor of type `float`. Same shape as - `true_classes`. The expected counts under the sampling distribution - of each of `true_classes`. -* `sampled_expected_count`: A tensor of type `float`. Same shape as - `sampled_candidates`. The expected counts under the sampling distribution - of each of `sampled_candidates`. - - -- - - - -### `tf.nn.learned_unigram_candidate_sampler(true_classes, num_true, num_sampled, unique, range_max, seed=None, name=None)` {#learned_unigram_candidate_sampler} - -Samples a set of classes from a distribution learned during training. - -This operation randomly samples a tensor of sampled classes -(`sampled_candidates`) from the range of integers `[0, range_max)`. - -The elements of `sampled_candidates` are drawn without replacement -(if `unique=True`) or with replacement (if `unique=False`) from -the base distribution. - -The base distribution for this operation is constructed on the fly -during training. It is a unigram distribution over the target -classes seen so far during training. Every integer in `[0, range_max)` -begins with a weight of 1, and is incremented by 1 each time it is -seen as a target class. The base distribution is not saved to checkpoints, -so it is reset when the model is reloaded. - -In addition, this operation returns tensors `true_expected_count` -and `sampled_expected_count` representing the number of times each -of the target classes (`true_classes`) and the sampled -classes (`sampled_candidates`) is expected to occur in an average -tensor of sampled classes. These values correspond to `Q(y|x)` -defined in [this -document](http://www.tensorflow.org/extras/candidate_sampling.pdf). -If `unique=True`, then these are post-rejection probabilities and we -compute them approximately. - -##### Args: - - -* `true_classes`: A `Tensor` of type `int64` and shape `[batch_size, - num_true]`. The target classes. -* `num_true`: An `int`. The number of target classes per training example. -* `num_sampled`: An `int`. The number of classes to randomly sample per batch. -* `unique`: A `bool`. Determines whether all sampled classes in a batch are - unique. -* `range_max`: An `int`. The number of possible classes. -* `seed`: An `int`. An operation-specific seed. Default is 0. -* `name`: A name for the operation (optional). - -##### Returns: - - -* `sampled_candidates`: A tensor of type `int64` and shape `[num_sampled]`. - The sampled classes. -* `true_expected_count`: A tensor of type `float`. Same shape as - `true_classes`. The expected counts under the sampling distribution - of each of `true_classes`. -* `sampled_expected_count`: A tensor of type `float`. Same shape as - `sampled_candidates`. The expected counts under the sampling distribution - of each of `sampled_candidates`. - - -- - - - -### `tf.nn.fixed_unigram_candidate_sampler(true_classes, num_true, num_sampled, unique, range_max, vocab_file='', distortion=1.0, num_reserved_ids=0, num_shards=1, shard=0, unigrams=(), seed=None, name=None)` {#fixed_unigram_candidate_sampler} - -Samples a set of classes using the provided (fixed) base distribution. - -This operation randomly samples a tensor of sampled classes -(`sampled_candidates`) from the range of integers `[0, range_max)`. - -The elements of `sampled_candidates` are drawn without replacement -(if `unique=True`) or with replacement (if `unique=False`) from -the base distribution. - -The base distribution is read from a file or passed in as an -in-memory array. There is also an option to skew the distribution by -applying a distortion power to the weights. - -In addition, this operation returns tensors `true_expected_count` -and `sampled_expected_count` representing the number of times each -of the target classes (`true_classes`) and the sampled -classes (`sampled_candidates`) is expected to occur in an average -tensor of sampled classes. These values correspond to `Q(y|x)` -defined in [this -document](http://www.tensorflow.org/extras/candidate_sampling.pdf). -If `unique=True`, then these are post-rejection probabilities and we -compute them approximately. - -##### Args: - - -* `true_classes`: A `Tensor` of type `int64` and shape `[batch_size, - num_true]`. The target classes. -* `num_true`: An `int`. The number of target classes per training example. -* `num_sampled`: An `int`. The number of classes to randomly sample per batch. -* `unique`: A `bool`. Determines whether all sampled classes in a batch are - unique. -* `range_max`: An `int`. The number of possible classes. -* `vocab_file`: Each valid line in this file (which should have a CSV-like - format) corresponds to a valid word ID. IDs are in sequential order, - starting from num_reserved_ids. The last entry in each line is expected - to be a value corresponding to the count or relative probability. Exactly - one of `vocab_file` and `unigrams` needs to be passed to this operation. -* `distortion`: The distortion is used to skew the unigram probability - distribution. Each weight is first raised to the distortion's power - before adding to the internal unigram distribution. As a result, - `distortion = 1.0` gives regular unigram sampling (as defined by the vocab - file), and `distortion = 0.0` gives a uniform distribution. -* `num_reserved_ids`: Optionally some reserved IDs can be added in the range - `[0, num_reserved_ids]` by the users. One use case is that a special - unknown word token is used as ID 0. These IDs will have a sampling - probability of 0. -* `num_shards`: A sampler can be used to sample from a subset of the original - range in order to speed up the whole computation through parallelism. This - parameter (together with `shard`) indicates the number of partitions that - are being used in the overall computation. -* `shard`: A sampler can be used to sample from a subset of the original range - in order to speed up the whole computation through parallelism. This - parameter (together with `num_shards`) indicates the particular partition - number of the operation, when partitioning is being used. -* `unigrams`: A list of unigram counts or probabilities, one per ID in - sequential order. Exactly one of `vocab_file` and `unigrams` should be - passed to this operation. -* `seed`: An `int`. An operation-specific seed. Default is 0. -* `name`: A name for the operation (optional). - -##### Returns: - - -* `sampled_candidates`: A tensor of type `int64` and shape `[num_sampled]`. - The sampled classes. -* `true_expected_count`: A tensor of type `float`. Same shape as - `true_classes`. The expected counts under the sampling distribution - of each of `true_classes`. -* `sampled_expected_count`: A tensor of type `float`. Same shape as - `sampled_candidates`. The expected counts under the sampling distribution - of each of `sampled_candidates`. - - -- - - - -### `tf.nn.compute_accidental_hits(true_classes, sampled_candidates, num_true, seed=None, name=None)` {#compute_accidental_hits} - -Compute the position ids in `sampled_candidates` matching `true_classes`. - -In Candidate Sampling, this operation facilitates virtually removing -sampled classes which happen to match target classes. This is done -in Sampled Softmax and Sampled Logistic. - -See our [Candidate Sampling Algorithms -Reference](http://www.tensorflow.org/extras/candidate_sampling.pdf). - -We presuppose that the `sampled_candidates` are unique. - -We call it an 'accidental hit' when one of the target classes -matches one of the sampled classes. This operation reports -accidental hits as triples `(index, id, weight)`, where `index` -represents the row number in `true_classes`, `id` represents the -position in `sampled_candidates`, and weight is `-FLOAT_MAX`. - -The result of this op should be passed through a `sparse_to_dense` -operation, then added to the logits of the sampled classes. This -removes the contradictory effect of accidentally sampling the true -target classes as noise classes for the same example. - -##### Args: - - -* `true_classes`: A `Tensor` of type `int64` and shape `[batch_size, - num_true]`. The target classes. -* `sampled_candidates`: A tensor of type `int64` and shape `[num_sampled]`. - The sampled_candidates output of CandidateSampler. -* `num_true`: An `int`. The number of target classes per training example. -* `seed`: An `int`. An operation-specific seed. Default is 0. -* `name`: A name for the operation (optional). - -##### Returns: - - -* `indices`: A `Tensor` of type `int32` and shape `[num_accidental_hits]`. - Values indicate rows in `true_classes`. -* `ids`: A `Tensor` of type `int64` and shape `[num_accidental_hits]`. - Values indicate positions in `sampled_candidates`. -* `weights`: A `Tensor` of type `float` and shape `[num_accidental_hits]`. - Each value is `-FLOAT_MAX`. - - -- - - - -### `tf.nn.quantized_conv2d(input, filter, min_input, max_input, min_filter, max_filter, strides, padding, out_type=None, name=None)` {#quantized_conv2d} - -Computes a 2D convolution given quantized 4D input and filter tensors. - -The inputs are quantized tensors where the lowest value represents the real -number of the associated minimum, and the highest represents the maximum. -This means that you can only interpret the quantized output in the same way, by -taking the returned minimum and maximum values into account. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `qint8`, `quint8`, `qint16`, `quint16`, `qint32`. -* `filter`: A `Tensor`. Must be one of the following types: `qint8`, `quint8`, `qint16`, `quint16`, `qint32`. - filter's input_depth dimension must match input's depth dimensions. -* `min_input`: A `Tensor` of type `float32`. - The float value that the lowest quantized input value represents. -* `max_input`: A `Tensor` of type `float32`. - The float value that the highest quantized input value represents. -* `min_filter`: A `Tensor` of type `float32`. - The float value that the lowest quantized filter value represents. -* `max_filter`: A `Tensor` of type `float32`. - The float value that the highest quantized filter value represents. -* `strides`: A list of `ints`. - The stride of the sliding window for each dimension of the input - tensor. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `out_type`: An optional `tf.DType` from: `tf.qint8, tf.quint8, tf.qint16, tf.quint16, tf.qint32`. Defaults to `tf.qint32`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, min_output, max_output). - -* `output`: A `Tensor` of type `out_type`. -* `min_output`: A `Tensor` of type `float32`. The float value that the lowest quantized output value represents. -* `max_output`: A `Tensor` of type `float32`. The float value that the highest quantized output value represents. - - -- - - - -### `tf.nn.quantized_relu_x(features, max_value, min_features, max_features, out_type=None, name=None)` {#quantized_relu_x} - -Computes Quantized Rectified Linear X: `min(max(features, 0), max_value)` - -##### Args: - - -* `features`: A `Tensor`. Must be one of the following types: `qint8`, `quint8`, `qint16`, `quint16`, `qint32`. -* `max_value`: A `Tensor` of type `float32`. -* `min_features`: A `Tensor` of type `float32`. - The float value that the lowest quantized value represents. -* `max_features`: A `Tensor` of type `float32`. - The float value that the highest quantized value represents. -* `out_type`: An optional `tf.DType` from: `tf.qint8, tf.quint8, tf.qint16, tf.quint16, tf.qint32`. Defaults to `tf.quint8`. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (activations, min_activations, max_activations). - -* `activations`: A `Tensor` of type `out_type`. Has the same output shape as "features". -* `min_activations`: A `Tensor` of type `float32`. The float value that the lowest quantized value represents. -* `max_activations`: A `Tensor` of type `float32`. The float value that the highest quantized value represents. - - -- - - - -### `tf.nn.quantized_max_pool(input, min_input, max_input, ksize, strides, padding, name=None)` {#quantized_max_pool} - -Produces the max pool of the input tensor for quantized types. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `qint8`, `quint8`, `qint16`, `quint16`, `qint32`. - The 4D (batch x rows x cols x depth) Tensor to MaxReduce over. -* `min_input`: A `Tensor` of type `float32`. - The float value that the lowest quantized input value represents. -* `max_input`: A `Tensor` of type `float32`. - The float value that the highest quantized input value represents. -* `ksize`: A list of `ints`. - The size of the window for each dimension of the input tensor. - The length must be 4 to match the number of dimensions of the input. -* `strides`: A list of `ints`. - The stride of the sliding window for each dimension of the input - tensor. The length must be 4 to match the number of dimensions of the input. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, min_output, max_output). - -* `output`: A `Tensor`. Has the same type as `input`. -* `min_output`: A `Tensor` of type `float32`. The float value that the lowest quantized output value represents. -* `max_output`: A `Tensor` of type `float32`. The float value that the highest quantized output value represents. - - -- - - - -### `tf.nn.quantized_avg_pool(input, min_input, max_input, ksize, strides, padding, name=None)` {#quantized_avg_pool} - -Produces the average pool of the input tensor for quantized types. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `qint8`, `quint8`, `qint16`, `quint16`, `qint32`. - 4-D with shape `[batch, height, width, channels]`. -* `min_input`: A `Tensor` of type `float32`. - The float value that the lowest quantized input value represents. -* `max_input`: A `Tensor` of type `float32`. - The float value that the highest quantized input value represents. -* `ksize`: A list of `ints`. - The size of the window for each dimension of the input tensor. - The length must be 4 to match the number of dimensions of the input. -* `strides`: A list of `ints`. - The stride of the sliding window for each dimension of the input - tensor. The length must be 4 to match the number of dimensions of the input. -* `padding`: A `string` from: `"SAME", "VALID"`. - The type of padding algorithm to use. -* `name`: A name for the operation (optional). - -##### Returns: - - A tuple of `Tensor` objects (output, min_output, max_output). - -* `output`: A `Tensor`. Has the same type as `input`. -* `min_output`: A `Tensor` of type `float32`. The float value that the lowest quantized output value represents. -* `max_output`: A `Tensor` of type `float32`. The float value that the highest quantized output value represents. - - - -## Other Functions and Classes -- - - - -### `tf.nn.zero_fraction(value, name=None)` {#zero_fraction} - -Returns the fraction of zeros in `value`. - -If `value` is empty, the result is `nan`. - -This is useful in summaries to measure and report sparsity. For example, - -```python - z = tf.Relu(...) - summ = tf.contrib.deprecated.scalar_summary('sparsity', - tf.nn.zero_fraction(z)) -``` - -##### Args: - - -* `value`: A tensor of numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - The fraction of zeros in `value`, with type `float32`. - - diff --git a/tensorflow/g3doc/api_docs/python/python_io.md b/tensorflow/g3doc/api_docs/python/python_io.md deleted file mode 100644 index c41fe3ada0..0000000000 --- a/tensorflow/g3doc/api_docs/python/python_io.md +++ /dev/null @@ -1,117 +0,0 @@ - - -# Data IO (Python functions) -[TOC] - -Python functions for directly manipulating TFRecord-formatted files. - -See the @{$python/python_io} guide. - -- - - - -### `class tf.python_io.TFRecordWriter` {#TFRecordWriter} - -A class to write records to a TFRecords file. - -This class implements `__enter__` and `__exit__`, and can be used -in `with` blocks like a normal file. -- - - - -#### `tf.python_io.TFRecordWriter.__enter__()` {#TFRecordWriter.__enter__} - -Enter a `with` block. - - -- - - - -#### `tf.python_io.TFRecordWriter.__exit__(unused_type, unused_value, unused_traceback)` {#TFRecordWriter.__exit__} - -Exit a `with` block, closing the file. - - -- - - - -#### `tf.python_io.TFRecordWriter.__init__(path, options=None)` {#TFRecordWriter.__init__} - -Opens file `path` and creates a `TFRecordWriter` writing to it. - -##### Args: - - -* `path`: The path to the TFRecords file. -* `options`: (optional) A TFRecordOptions object. - -##### Raises: - - -* `IOError`: If `path` cannot be opened for writing. - - -- - - - -#### `tf.python_io.TFRecordWriter.close()` {#TFRecordWriter.close} - -Close the file. - - -- - - - -#### `tf.python_io.TFRecordWriter.write(record)` {#TFRecordWriter.write} - -Write a string record to the file. - -##### Args: - - -* `record`: str - - - -- - - - -### `tf.python_io.tf_record_iterator(path, options=None)` {#tf_record_iterator} - -An iterator that read the records from a TFRecords file. - -##### Args: - - -* `path`: The path to the TFRecords file. -* `options`: (optional) A TFRecordOptions object. - -##### Yields: - - Strings. - -##### Raises: - - -* `IOError`: If `path` cannot be opened for reading. - - -- - - - -### `class tf.python_io.TFRecordCompressionType` {#TFRecordCompressionType} - -The type of compression for the record. - -- - - - -### `class tf.python_io.TFRecordOptions` {#TFRecordOptions} - -Options used for manipulating TFRecord files. -- - - - -#### `tf.python_io.TFRecordOptions.__init__(compression_type)` {#TFRecordOptions.__init__} - - - - -- - - - -#### `tf.python_io.TFRecordOptions.get_compression_type_string(cls, options)` {#TFRecordOptions.get_compression_type_string} - - - - - diff --git a/tensorflow/g3doc/api_docs/python/script_ops.md b/tensorflow/g3doc/api_docs/python/script_ops.md deleted file mode 100644 index 13e9feb865..0000000000 --- a/tensorflow/g3doc/api_docs/python/script_ops.md +++ /dev/null @@ -1,65 +0,0 @@ - - -# Wraps python functions - -Note: Functions taking `Tensor` arguments can also take anything accepted by -[`tf.convert_to_tensor`](framework.md#convert_to_tensor). - -[TOC] - -Script Language Operators. See the @{python/script_ops} guide. - -- - - - -### `tf.py_func(func, inp, Tout, stateful=True, name=None)` {#py_func} - -Wraps a python function and uses it as a TensorFlow op. - -Given a python function `func`, which takes numpy arrays as its -inputs and returns numpy arrays as its outputs, wrap this function as an -operation in a TensorFlow graph. The following snippet constructs a simple -TensorFlow graph that invokes the `np.sinh()` NumPy function as a operation -in the graph: - -```python -def my_func(x): - # x will be a numpy array with the contents of the placeholder below - return np.sinh(x) -inp = tf.placeholder(tf.float32) -y = tf.py_func(my_func, [inp], tf.float32) -``` - -**N.B.** The `tf.py_func()` operation has the following known limitations: - -* The body of the function (i.e. `func`) will not be serialized in a - `GraphDef`. Therefore, you should not use this function if you need to - serialize your model and restore it in a different environment. - -* The operation must run in the same address space as the Python program - that calls `tf.py_func()`. If you are using distributed TensorFlow, you - must run a `tf.train.Server` in the same process as the program that calls - `tf.py_func()` and you must pin the created operation to a device in that - server (e.g. using `with tf.device():`). - -##### Args: - - -* `func`: A Python function, which accepts a list of NumPy `ndarray` objects - having element types that match the corresponding `tf.Tensor` objects - in `inp`, and returns a list of `ndarray` objects (or a single `ndarray`) - having element types that match the corresponding values in `Tout`. -* `inp`: A list of `Tensor` objects. -* `Tout`: A list or tuple of tensorflow data types or a single tensorflow data - type if there is only one, indicating what `func` returns. -* `stateful`: (Boolean.) If True, the function should be considered stateful. - If a function is stateless, when given the same input it will return the - same output and have no observable side effects. Optimizations such as - common subexpression elimination are only performed on stateless - operations. -* `name`: A name for the operation (optional). - -##### Returns: - - A list of `Tensor` or a single `Tensor` which `func` computes. - - diff --git a/tensorflow/g3doc/api_docs/python/session_ops.md b/tensorflow/g3doc/api_docs/python/session_ops.md deleted file mode 100644 index 9794923c79..0000000000 --- a/tensorflow/g3doc/api_docs/python/session_ops.md +++ /dev/null @@ -1,116 +0,0 @@ - - -# Tensor Handle Operations - -Note: Functions taking `Tensor` arguments can also take anything accepted by -[`tf.convert_to_tensor`](framework.md#convert_to_tensor). - -[TOC] - -Tensor Handle Operations. See the @{python/session_ops} guide. - -- - - - -### `tf.get_session_handle(data, name=None)` {#get_session_handle} - -Return the handle of `data`. - -This is EXPERIMENTAL and subject to change. - -Keep `data` "in-place" in the runtime and create a handle that can be -used to retrieve `data` in a subsequent run(). - -Combined with `get_session_tensor`, we can keep a tensor produced in -one run call in place, and use it as the input in a future run call. - -##### Args: - - -* `data`: A tensor to be stored in the session. -* `name`: Optional name prefix for the return tensor. - -##### Returns: - - A scalar string tensor representing a unique handle for `data`. - -##### Raises: - - -* `TypeError`: if `data` is not a Tensor. - - -* `Example`: - -```python -c = tf.multiply(a, b) -h = tf.get_session_handle(c) -h = sess.run(h) - -p, a = tf.get_session_tensor(h.handle, tf.float32) -b = tf.multiply(a, 10) -c = sess.run(b, feed_dict={p: h.handle}) -``` - - -- - - - -### `tf.get_session_tensor(handle, dtype, name=None)` {#get_session_tensor} - -Get the tensor of type `dtype` by feeding a tensor handle. - -This is EXPERIMENTAL and subject to change. - -Get the value of the tensor from a tensor handle. The tensor -is produced in a previous run() and stored in the state of the -session. - -##### Args: - - -* `handle`: The string representation of a persistent tensor handle. -* `dtype`: The type of the output tensor. -* `name`: Optional name prefix for the return tensor. - -##### Returns: - - A pair of tensors. The first is a placeholder for feeding a - tensor handle and the second is the tensor in the session state - keyed by the tensor handle. - - -* `Example`: - -```python -c = tf.multiply(a, b) -h = tf.get_session_handle(c) -h = sess.run(h) - -p, a = tf.get_session_tensor(h.handle, tf.float32) -b = tf.multiply(a, 10) -c = sess.run(b, feed_dict={p: h.handle}) -``` - - -- - - - -### `tf.delete_session_tensor(handle, name=None)` {#delete_session_tensor} - -Delete the tensor for the given tensor handle. - -This is EXPERIMENTAL and subject to change. - -Delete the tensor of a given tensor handle. The tensor is produced -in a previous run() and stored in the state of the session. - -##### Args: - - -* `handle`: The string representation of a persistent tensor handle. -* `name`: Optional name prefix for the return tensor. - -##### Returns: - - A pair of graph elements. The first is a placeholder for feeding a - tensor handle and the second is a deletion operation. - - diff --git a/tensorflow/g3doc/api_docs/python/sparse_ops.md b/tensorflow/g3doc/api_docs/python/sparse_ops.md deleted file mode 100644 index b933d2251b..0000000000 --- a/tensorflow/g3doc/api_docs/python/sparse_ops.md +++ /dev/null @@ -1,1439 +0,0 @@ - - -# Sparse Tensors - -Note: Functions taking `Tensor` arguments can also take anything accepted by -[`tf.convert_to_tensor`](framework.md#convert_to_tensor). - -[TOC] - -Sparse Tensor Representation. See the @{python/sparse_ops} guide. - -- - - - -### `class tf.SparseTensor` {#SparseTensor} - -Represents a sparse tensor. - -TensorFlow represents a sparse tensor as three separate dense tensors: -`indices`, `values`, and `dense_shape`. In Python, the three tensors are -collected into a `SparseTensor` class for ease of use. If you have separate -`indices`, `values`, and `dense_shape` tensors, wrap them in a `SparseTensor` -object before passing to the ops below. - -Concretely, the sparse tensor `SparseTensor(indices, values, dense_shape)` -comprises the following components, where `N` and `ndims` are the number -of values and number of dimensions in the `SparseTensor`, respectively: - -* `indices`: A 2-D int64 tensor of dense_shape `[N, ndims]`, which specifies - the indices of the elements in the sparse tensor that contain nonzero - values (elements are zero-indexed). For example, `indices=[[1,3], [2,4]]` - specifies that the elements with indexes of [1,3] and [2,4] have - nonzero values. - -* `values`: A 1-D tensor of any type and dense_shape `[N]`, which supplies the - values for each element in `indices`. For example, given - `indices=[[1,3], [2,4]]`, the parameter `values=[18, 3.6]` specifies - that element [1,3] of the sparse tensor has a value of 18, and element - [2,4] of the tensor has a value of 3.6. - -* `dense_shape`: A 1-D int64 tensor of dense_shape `[ndims]`, which specifies - the dense_shape of the sparse tensor. Takes a list indicating the number of - elements in each dimension. For example, `dense_shape=[3,6]` specifies a - two-dimensional 3x6 tensor, `dense_shape=[2,3,4]` specifies a - three-dimensional 2x3x4 tensor, and `dense_shape=[9]` specifies a - one-dimensional tensor with 9 elements. - -The corresponding dense tensor satisfies: - -```python -dense.shape = dense_shape -dense[tuple(indices[i])] = values[i] -``` - -By convention, `indices` should be sorted in row-major order (or equivalently -lexicographic order on the tuples `indices[i]`). This is not enforced when -`SparseTensor` objects are constructed, but most ops assume correct ordering. -If the ordering of sparse tensor `st` is wrong, a fixed version can be -obtained by calling `tf.sparse_reorder(st)`. - -Example: The sparse tensor - -```python -SparseTensor(indices=[[0, 0], [1, 2]], values=[1, 2], dense_shape=[3, 4]) -``` - -represents the dense tensor - -```python -[[1, 0, 0, 0] - [0, 0, 2, 0] - [0, 0, 0, 0]] -``` -- - - - -#### `tf.SparseTensor.__div__(sp_x, y)` {#SparseTensor.__div__} - -Component-wise divides a SparseTensor by a dense Tensor. - -*Limitation*: this Op only broadcasts the dense side to the sparse side, but not -the other direction. - -##### Args: - - -* `sp_indices`: A `Tensor` of type `int64`. - 2-D. `N x R` matrix with the indices of non-empty values in a - SparseTensor, possibly not in canonical ordering. -* `sp_values`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - 1-D. `N` non-empty values corresponding to `sp_indices`. -* `sp_shape`: A `Tensor` of type `int64`. - 1-D. Shape of the input SparseTensor. -* `dense`: A `Tensor`. Must have the same type as `sp_values`. - `R`-D. The dense Tensor operand. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `sp_values`. - 1-D. The `N` values that are operated on. - - -- - - - -#### `tf.SparseTensor.__init__(indices, values, dense_shape)` {#SparseTensor.__init__} - -Creates a `SparseTensor`. - -##### Args: - - -* `indices`: A 2-D int64 tensor of shape `[N, ndims]`. -* `values`: A 1-D tensor of any type and shape `[N]`. -* `dense_shape`: A 1-D int64 tensor of shape `[ndims]`. - -##### Returns: - - A `SparseTensor`. - - -- - - - -#### `tf.SparseTensor.__mul__(sp_x, y)` {#SparseTensor.__mul__} - -Component-wise multiplies a SparseTensor by a dense Tensor. - -The output locations corresponding to the implicitly zero elements in the sparse -tensor will be zero (i.e., will not take up storage space), regardless of the -contents of the dense tensor (even if it's +/-INF and that INF*0 == NaN). - -*Limitation*: this Op only broadcasts the dense side to the sparse side, but not -the other direction. - -##### Args: - - -* `sp_indices`: A `Tensor` of type `int64`. - 2-D. `N x R` matrix with the indices of non-empty values in a - SparseTensor, possibly not in canonical ordering. -* `sp_values`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - 1-D. `N` non-empty values corresponding to `sp_indices`. -* `sp_shape`: A `Tensor` of type `int64`. - 1-D. Shape of the input SparseTensor. -* `dense`: A `Tensor`. Must have the same type as `sp_values`. - `R`-D. The dense Tensor operand. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `sp_values`. - 1-D. The `N` values that are operated on. - - -- - - - -#### `tf.SparseTensor.__str__()` {#SparseTensor.__str__} - - - - -- - - - -#### `tf.SparseTensor.__truediv__(sp_x, y)` {#SparseTensor.__truediv__} - -Internal helper function for 'sp_t / dense_t'. - - -- - - - -#### `tf.SparseTensor.dense_shape` {#SparseTensor.dense_shape} - -A 1-D Tensor of int64 representing the shape of the dense tensor. - - -- - - - -#### `tf.SparseTensor.dtype` {#SparseTensor.dtype} - -The `DType` of elements in this tensor. - - -- - - - -#### `tf.SparseTensor.eval(feed_dict=None, session=None)` {#SparseTensor.eval} - -Evaluates this sparse tensor in a `Session`. - -Calling this method will execute all preceding operations that -produce the inputs needed for the operation that produces this -tensor. - -*N.B.* Before invoking `SparseTensor.eval()`, its graph must have been -launched in a session, and either a default session must be -available, or `session` must be specified explicitly. - -##### Args: - - -* `feed_dict`: A dictionary that maps `Tensor` objects to feed values. - See [`Session.run()`](../../api_docs/python/client.md#Session.run) for a - description of the valid feed values. -* `session`: (Optional.) The `Session` to be used to evaluate this sparse - tensor. If none, the default session will be used. - -##### Returns: - - A `SparseTensorValue` object. - - -- - - - -#### `tf.SparseTensor.from_value(cls, sparse_tensor_value)` {#SparseTensor.from_value} - - - - -- - - - -#### `tf.SparseTensor.get_shape()` {#SparseTensor.get_shape} - -Get the `TensorShape` representing the shape of the dense tensor. - -##### Returns: - - A `TensorShape` object. - - -- - - - -#### `tf.SparseTensor.graph` {#SparseTensor.graph} - -The `Graph` that contains the index, value, and dense_shape tensors. - - -- - - - -#### `tf.SparseTensor.indices` {#SparseTensor.indices} - -The indices of non-zero values in the represented dense tensor. - -##### Returns: - - A 2-D Tensor of int64 with dense_shape `[N, ndims]`, where `N` is the - number of non-zero values in the tensor, and `ndims` is the rank. - - -- - - - -#### `tf.SparseTensor.op` {#SparseTensor.op} - -The `Operation` that produces `values` as an output. - - -- - - - -#### `tf.SparseTensor.values` {#SparseTensor.values} - -The non-zero values in the represented dense tensor. - -##### Returns: - - A 1-D Tensor of any data type. - - - -- - - - -### `class tf.SparseTensorValue` {#SparseTensorValue} - -SparseTensorValue(indices, values, dense_shape) -- - - - -#### `tf.SparseTensorValue.__getnewargs__()` {#SparseTensorValue.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.SparseTensorValue.__getstate__()` {#SparseTensorValue.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.SparseTensorValue.__new__(_cls, indices, values, dense_shape)` {#SparseTensorValue.__new__} - -Create new instance of SparseTensorValue(indices, values, dense_shape) - - -- - - - -#### `tf.SparseTensorValue.__repr__()` {#SparseTensorValue.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.SparseTensorValue.dense_shape` {#SparseTensorValue.dense_shape} - -Alias for field number 2 - - -- - - - -#### `tf.SparseTensorValue.indices` {#SparseTensorValue.indices} - -Alias for field number 0 - - -- - - - -#### `tf.SparseTensorValue.values` {#SparseTensorValue.values} - -Alias for field number 1 - - - -- - - - -### `tf.sparse_to_dense(sparse_indices, output_shape, sparse_values, default_value=0, validate_indices=True, name=None)` {#sparse_to_dense} - -Converts a sparse representation into a dense tensor. - -Builds an array `dense` with shape `output_shape` such that - -```python -# If sparse_indices is scalar -dense[i] = (i == sparse_indices ? sparse_values : default_value) - -# If sparse_indices is a vector, then for each i -dense[sparse_indices[i]] = sparse_values[i] - -# If sparse_indices is an n by d matrix, then for each i in [0, n) -dense[sparse_indices[i][0], ..., sparse_indices[i][d-1]] = sparse_values[i] -``` - -All other values in `dense` are set to `default_value`. If `sparse_values` -is a scalar, all sparse indices are set to this single value. - -Indices should be sorted in lexicographic order, and indices must not -contain any repeats. If `validate_indices` is True, these properties -are checked during execution. - -##### Args: - - -* `sparse_indices`: A 0-D, 1-D, or 2-D `Tensor` of type `int32` or `int64`. - `sparse_indices[i]` contains the complete index where `sparse_values[i]` - will be placed. -* `output_shape`: A 1-D `Tensor` of the same type as `sparse_indices`. Shape - of the dense output tensor. -* `sparse_values`: A 0-D or 1-D `Tensor`. Values corresponding to each row of - `sparse_indices`, or a scalar value to be used for all sparse indices. -* `default_value`: A 0-D `Tensor` of the same type as `sparse_values`. Value - to set for indices not specified in `sparse_indices`. Defaults to zero. -* `validate_indices`: A boolean value. If True, indices are checked to make - sure they are sorted in lexicographic order and that there are no repeats. -* `name`: A name for the operation (optional). - -##### Returns: - - Dense `Tensor` of shape `output_shape`. Has the same type as - `sparse_values`. - - -- - - - -### `tf.sparse_tensor_to_dense(sp_input, default_value=0, validate_indices=True, name=None)` {#sparse_tensor_to_dense} - -Converts a `SparseTensor` into a dense tensor. - -This op is a convenience wrapper around `sparse_to_dense` for `SparseTensor`s. - -For example, if `sp_input` has shape `[3, 5]` and non-empty string values: - - [0, 1]: a - [0, 3]: b - [2, 0]: c - -and `default_value` is `x`, then the output will be a dense `[3, 5]` -string tensor with values: - - [[x a x b x] - [x x x x x] - [c x x x x]] - -Indices must be without repeats. This is only -tested if validate_indices is True. - -##### Args: - - -* `sp_input`: The input `SparseTensor`. -* `default_value`: Scalar value to set for indices not specified in - `sp_input`. Defaults to zero. -* `validate_indices`: A boolean value. If `True`, indices are checked to make - sure they are sorted in lexicographic order and that there are no repeats. -* `name`: A name prefix for the returned tensors (optional). - -##### Returns: - - A dense tensor with shape `sp_input.dense_shape` and values specified by - the non-empty values in `sp_input`. Indices not in `sp_input` are assigned - `default_value`. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. - - -- - - - -### `tf.sparse_to_indicator(sp_input, vocab_size, name=None)` {#sparse_to_indicator} - -Converts a `SparseTensor` of ids into a dense bool indicator tensor. - -The last dimension of `sp_input.indices` is discarded and replaced with -the values of `sp_input`. If `sp_input.dense_shape = [D0, D1, ..., Dn, K]`, -then `output.shape = [D0, D1, ..., Dn, vocab_size]`, where - - output[d_0, d_1, ..., d_n, sp_input[d_0, d_1, ..., d_n, k]] = True - -and False elsewhere in `output`. - -For example, if `sp_input.dense_shape = [2, 3, 4]` with non-empty values: - - [0, 0, 0]: 0 - [0, 1, 0]: 10 - [1, 0, 3]: 103 - [1, 1, 2]: 150 - [1, 1, 3]: 149 - [1, 1, 4]: 150 - [1, 2, 1]: 121 - -and `vocab_size = 200`, then the output will be a `[2, 3, 200]` dense bool -tensor with False everywhere except at positions - - (0, 0, 0), (0, 1, 10), (1, 0, 103), (1, 1, 149), (1, 1, 150), - (1, 2, 121). - -Note that repeats are allowed in the input SparseTensor. -This op is useful for converting `SparseTensor`s into dense formats for -compatibility with ops that expect dense tensors. - -The input `SparseTensor` must be in row-major order. - -##### Args: - - -* `sp_input`: A `SparseTensor` with `values` property of type `int32` or - `int64`. -* `vocab_size`: A scalar int64 Tensor (or Python int) containing the new size - of the last dimension, `all(0 <= sp_input.values < vocab_size)`. -* `name`: A name prefix for the returned tensors (optional) - -##### Returns: - - A dense bool indicator tensor representing the indices with specified value. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. - - -- - - - -### `tf.sparse_merge(sp_ids, sp_values, vocab_size, name=None, already_sorted=False)` {#sparse_merge} - -Combines a batch of feature ids and values into a single `SparseTensor`. - -The most common use case for this function occurs when feature ids and -their corresponding values are stored in `Example` protos on disk. -`parse_example` will return a batch of ids and a batch of values, and this -function joins them into a single logical `SparseTensor` for use in -functions such as `sparse_tensor_dense_matmul`, `sparse_to_dense`, etc. - -The `SparseTensor` returned by this function has the following properties: - - - `indices` is equivalent to `sp_ids.indices` with the last - dimension discarded and replaced with `sp_ids.values`. - - `values` is simply `sp_values.values`. - - If `sp_ids.dense_shape = [D0, D1, ..., Dn, K]`, then - `output.shape = [D0, D1, ..., Dn, vocab_size]`. - -For example, consider the following feature vectors: - -```python - vector1 = [-3, 0, 0, 0, 0, 0] - vector2 = [ 0, 1, 0, 4, 1, 0] - vector3 = [ 5, 0, 0, 9, 0, 0] -``` - -These might be stored sparsely in the following Example protos by storing -only the feature ids (column number if the vectors are treated as a matrix) -of the non-zero elements and the corresponding values: - -```python - examples = [Example(features={ - "ids": Feature(int64_list=Int64List(value=[0])), - "values": Feature(float_list=FloatList(value=[-3]))}), - Example(features={ - "ids": Feature(int64_list=Int64List(value=[1, 4, 3])), - "values": Feature(float_list=FloatList(value=[1, 1, 4]))}), - Example(features={ - "ids": Feature(int64_list=Int64List(value=[0, 3])), - "values": Feature(float_list=FloatList(value=[5, 9]))})] -``` - -The result of calling parse_example on these examples will produce a -dictionary with entries for "ids" and "values". Passing those two objects -to this function along with vocab_size=6, will produce a `SparseTensor` that -sparsely represents all three instances. Namely, the `indices` property will -contain the coordinates of the non-zero entries in the feature matrix (the -first dimension is the row number in the matrix, i.e., the index within the -batch, and the second dimension is the column number, i.e., the feature id); -`values` will contain the actual values. `shape` will be the shape of the -original matrix, i.e., (3, 6). For our example above, the output will be -equal to: - -```python - SparseTensor(indices=[[0, 0], [1, 1], [1, 3], [1, 4], [2, 0], [2, 3]], - values=[-3, 1, 4, 1, 5, 9], - dense_shape=[3, 6]) -``` - -This method generalizes to higher-dimensions by simply providing a list for -both the sp_ids as well as the vocab_size. -In this case the resulting `SparseTensor` has the following properties: - - `indices` is equivalent to `sp_ids[0].indices` with the last - dimension discarded and concatenated with - `sp_ids[0].values, sp_ids[1].values, ...`. - - `values` is simply `sp_values.values`. - - If `sp_ids.dense_shape = [D0, D1, ..., Dn, K]`, then - `output.shape = [D0, D1, ..., Dn] + vocab_size`. - -##### Args: - - -* `sp_ids`: A single `SparseTensor` with `values` property of type `int32` - or `int64` or a Python list of such `SparseTensor`s or a list thereof. -* `sp_values`: A`SparseTensor` of any type. -* `vocab_size`: A scalar `int64` Tensor (or Python int) containing the new size - of the last dimension, `all(0 <= sp_ids.values < vocab_size)`. - Or a list thereof with `all(0 <= sp_ids[i].values < vocab_size[i])` for - all `i`. -* `name`: A name prefix for the returned tensors (optional) -* `already_sorted`: A boolean to specify whether the per-batch values in - `sp_values` are already sorted. If so skip sorting, False by default - (optional). - -##### Returns: - - A `SparseTensor` compactly representing a batch of feature ids and values, - useful for passing to functions that expect such a `SparseTensor`. - -##### Raises: - - -* `TypeError`: If `sp_values` is not a `SparseTensor`. Or if `sp_ids` is neither - a `SparseTensor` nor a list thereof. Or if `vocab_size` is not a - `Tensor` or a Python int and `sp_ids` is a `SparseTensor`. Or if - `vocab_size` is not a or list thereof and `sp_ids` is a list. -* `ValueError`: If `sp_ids` and `vocab_size` are lists of different lengths. - - -- - - - -### `tf.sparse_concat(axis, sp_inputs, name=None, expand_nonconcat_dim=False, concat_dim=None)` {#sparse_concat} - -Concatenates a list of `SparseTensor` along the specified dimension. - -Concatenation is with respect to the dense versions of each sparse input. -It is assumed that each inputs is a `SparseTensor` whose elements are ordered -along increasing dimension number. - -If expand_nonconcat_dim is False, all inputs' shapes must match, except for -the concat dimension. If expand_nonconcat_dim is True, then inputs' shapes are -allowed to vary among all inputs. - -The `indices`, `values`, and `shapes` lists must have the same length. - -If expand_nonconcat_dim is False, then the output shape is identical to the -inputs', except along the concat dimension, where it is the sum of the inputs' -sizes along that dimension. - -If expand_nonconcat_dim is True, then the output shape along the non-concat -dimensions will be expand to be the largest among all inputs, and it is the -sum of the inputs sizes along the concat dimension. - -The output elements will be resorted to preserve the sort order along -increasing dimension number. - -This op runs in `O(M log M)` time, where `M` is the total number of non-empty -values across all inputs. This is due to the need for an internal sort in -order to concatenate efficiently across an arbitrary dimension. - -For example, if `axis = 1` and the inputs are - - sp_inputs[0]: shape = [2, 3] - [0, 2]: "a" - [1, 0]: "b" - [1, 1]: "c" - - sp_inputs[1]: shape = [2, 4] - [0, 1]: "d" - [0, 2]: "e" - -then the output will be - - shape = [2, 7] - [0, 2]: "a" - [0, 4]: "d" - [0, 5]: "e" - [1, 0]: "b" - [1, 1]: "c" - -Graphically this is equivalent to doing - - [ a] concat [ d e ] = [ a d e ] - [b c ] [ ] [b c ] - -Another example, if 'axis = 1' and the inputs are - - sp_inputs[0]: shape = [3, 3] - [0, 2]: "a" - [1, 0]: "b" - [2, 1]: "c" - - sp_inputs[1]: shape = [2, 4] - [0, 1]: "d" - [0, 2]: "e" - -if expand_nonconcat_dim = False, this will result in an error. But if -expand_nonconcat_dim = True, this will result in: - - shape = [3, 7] - [0, 2]: "a" - [0, 4]: "d" - [0, 5]: "e" - [1, 0]: "b" - [2, 1]: "c" - -Graphically this is equivalent to doing - - [ a] concat [ d e ] = [ a d e ] - [b ] [ ] [b ] - [ c ] [ c ] - - -##### Args: - - -* `axis`: Dimension to concatenate along. Must be in range [-rank, rank), - where rank is the number of dimensions in each input `SparseTensor`. -* `sp_inputs`: List of `SparseTensor` to concatenate. -* `name`: A name prefix for the returned tensors (optional). -* `expand_nonconcat_dim`: Whether to allow the expansion in the non-concat - dimensions. Defaulted to False. -* `concat_dim`: The old (deprecated) name for axis. - -##### Returns: - - A `SparseTensor` with the concatenated output. - -##### Raises: - - -* `TypeError`: If `sp_inputs` is not a list of `SparseTensor`. - - -- - - - -### `tf.sparse_reorder(sp_input, name=None)` {#sparse_reorder} - -Reorders a `SparseTensor` into the canonical, row-major ordering. - -Note that by convention, all sparse ops preserve the canonical ordering -along increasing dimension number. The only time ordering can be violated -is during manual manipulation of the indices and values to add entries. - -Reordering does not affect the shape of the `SparseTensor`. - -For example, if `sp_input` has shape `[4, 5]` and `indices` / `values`: - - [0, 3]: b - [0, 1]: a - [3, 1]: d - [2, 0]: c - -then the output will be a `SparseTensor` of shape `[4, 5]` and -`indices` / `values`: - - [0, 1]: a - [0, 3]: b - [2, 0]: c - [3, 1]: d - -##### Args: - - -* `sp_input`: The input `SparseTensor`. -* `name`: A name prefix for the returned tensors (optional) - -##### Returns: - - A `SparseTensor` with the same shape and non-empty values, but in - canonical ordering. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. - - -- - - - -### `tf.sparse_reshape(sp_input, shape, name=None)` {#sparse_reshape} - -Reshapes a `SparseTensor` to represent values in a new dense shape. - -This operation has the same semantics as `reshape` on the represented dense -tensor. The indices of non-empty values in `sp_input` are recomputed based -on the new dense shape, and a new `SparseTensor` is returned containing the -new indices and new shape. The order of non-empty values in `sp_input` is -unchanged. - -If one component of `shape` is the special value -1, the size of that -dimension is computed so that the total dense size remains constant. At -most one component of `shape` can be -1. The number of dense elements -implied by `shape` must be the same as the number of dense elements -originally represented by `sp_input`. - -For example, if `sp_input` has shape `[2, 3, 6]` and `indices` / `values`: - - [0, 0, 0]: a - [0, 0, 1]: b - [0, 1, 0]: c - [1, 0, 0]: d - [1, 2, 3]: e - -and `shape` is `[9, -1]`, then the output will be a `SparseTensor` of -shape `[9, 4]` and `indices` / `values`: - - [0, 0]: a - [0, 1]: b - [1, 2]: c - [4, 2]: d - [8, 1]: e - -##### Args: - - -* `sp_input`: The input `SparseTensor`. -* `shape`: A 1-D (vector) int64 `Tensor` specifying the new dense shape of the - represented `SparseTensor`. -* `name`: A name prefix for the returned tensors (optional) - -##### Returns: - - A `SparseTensor` with the same non-empty values but with indices calculated - by the new dense shape. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. - - -- - - - -### `tf.sparse_split(keyword_required=KeywordRequired(), sp_input=None, num_split=None, axis=None, name=None, split_dim=None)` {#sparse_split} - -Split a `SparseTensor` into `num_split` tensors along `axis`. - -If the `sp_input.dense_shape[axis]` is not an integer multiple of `num_split` -each slice starting from 0:`shape[axis] % num_split` gets extra one -dimension. For example, if `axis = 1` and `num_split = 2` and the -input is: - - input_tensor = shape = [2, 7] - [ a d e ] - [b c ] - -Graphically the output tensors are: - - output_tensor[0] = - [ a ] - [b c ] - - output_tensor[1] = - [ d e ] - [ ] - -##### Args: - - -* `keyword_required`: Python 2 standin for * (temporary for argument reorder) -* `sp_input`: The `SparseTensor` to split. -* `num_split`: A Python integer. The number of ways to split. -* `axis`: A 0-D `int32` `Tensor`. The dimension along which to split. -* `name`: A name for the operation (optional). -* `split_dim`: Deprecated old name for axis. - -##### Returns: - - `num_split` `SparseTensor` objects resulting from splitting `value`. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. -* `ValueError`: If the deprecated `split_dim` and `axis` are both non None. - - -- - - - -### `tf.sparse_retain(sp_input, to_retain)` {#sparse_retain} - -Retains specified non-empty values within a `SparseTensor`. - -For example, if `sp_input` has shape `[4, 5]` and 4 non-empty string values: - - [0, 1]: a - [0, 3]: b - [2, 0]: c - [3, 1]: d - -and `to_retain = [True, False, False, True]`, then the output will -be a `SparseTensor` of shape `[4, 5]` with 2 non-empty values: - - [0, 1]: a - [3, 1]: d - -##### Args: - - -* `sp_input`: The input `SparseTensor` with `N` non-empty elements. -* `to_retain`: A bool vector of length `N` with `M` true values. - -##### Returns: - - A `SparseTensor` with the same shape as the input and `M` non-empty - elements corresponding to the true positions in `to_retain`. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. - - -- - - - -### `tf.sparse_reset_shape(sp_input, new_shape=None)` {#sparse_reset_shape} - -Resets the shape of a `SparseTensor` with indices and values unchanged. - -If `new_shape` is None, returns a copy of `sp_input` with its shape reset -to the tight bounding box of `sp_input`. - -If `new_shape` is provided, then it must be larger or equal in all dimensions -compared to the shape of `sp_input`. When this condition is met, the returned -SparseTensor will have its shape reset to `new_shape` and its indices and -values unchanged from that of `sp_input.` - -For example: - - Consider a `sp_input` with shape [2, 3, 5]: - - [0, 0, 1]: a - [0, 1, 0]: b - [0, 2, 2]: c - [1, 0, 3]: d - - - It is an error to set `new_shape` as [3, 7] since this represents a - rank-2 tensor while `sp_input` is rank-3. This is either a ValueError - during graph construction (if both shapes are known) or an OpError during - run time. - - - Setting `new_shape` as [2, 3, 6] will be fine as this shape is larger or - equal in every dimension compared to the original shape [2, 3, 5]. - - - On the other hand, setting new_shape as [2, 3, 4] is also an error: The - third dimension is smaller than the original shape [2, 3, 5] (and an - `InvalidArgumentError` will be raised). - - - If `new_shape` is None, the returned SparseTensor will have a shape - [2, 3, 4], which is the tight bounding box of `sp_input`. - -##### Args: - - -* `sp_input`: The input `SparseTensor`. -* `new_shape`: None or a vector representing the new shape for the returned - `SparseTensor`. - -##### Returns: - - A `SparseTensor` indices and values unchanged from `input_sp`. Its shape is - `new_shape` if that is set. Otherwise it is the tight bounding box of - `input_sp` - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. -* `ValueError`: If `new_shape` represents a tensor with a different rank from - that of `sp_input` (if shapes are known when graph is constructed). -* `OpError`: - - If `new_shape` has dimension sizes that are too small. - - If shapes are not known during graph construction time, and during run - time it is found out that the ranks do not match. - - -- - - - -### `tf.sparse_fill_empty_rows(sp_input, default_value, name=None)` {#sparse_fill_empty_rows} - -Fills empty rows in the input 2-D `SparseTensor` with a default value. - -This op adds entries with the specified `default_value` at index -`[row, 0]` for any row in the input that does not already have a value. - -For example, suppose `sp_input` has shape `[5, 6]` and non-empty values: - - [0, 1]: a - [0, 3]: b - [2, 0]: c - [3, 1]: d - -Rows 1 and 4 are empty, so the output will be of shape `[5, 6]` with values: - - [0, 1]: a - [0, 3]: b - [1, 0]: default_value - [2, 0]: c - [3, 1]: d - [4, 0]: default_value - -Note that the input may have empty columns at the end, with no effect on -this op. - -The output `SparseTensor` will be in row-major order and will have the -same shape as the input. - -This op also returns an indicator vector such that - - empty_row_indicator[i] = True iff row i was an empty row. - -##### Args: - - -* `sp_input`: A `SparseTensor` with shape `[N, M]`. -* `default_value`: The value to fill for empty rows, with the same type as - `sp_input.` -* `name`: A name prefix for the returned tensors (optional) - -##### Returns: - - -* `sp_ordered_output`: A `SparseTensor` with shape `[N, M]`, and with all empty - rows filled in with `default_value`. -* `empty_row_indicator`: A bool vector of length `N` indicating whether each - input row was empty. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. - - -- - - - -### `tf.sparse_transpose(sp_input, perm=None, name=None)` {#sparse_transpose} - -Transposes a `SparseTensor` - -The returned tensor's dimension i will correspond to the input dimension -`perm[i]`. If `perm` is not given, it is set to (n-1...0), where n is -the rank of the input tensor. Hence by default, this operation performs a -regular matrix transpose on 2-D input Tensors. - -For example, if `sp_input` has shape `[4, 5]` and `indices` / `values`: - - [0, 3]: b - [0, 1]: a - [3, 1]: d - [2, 0]: c - -then the output will be a `SparseTensor` of shape `[5, 4]` and -`indices` / `values`: - - [0, 2]: c - [1, 0]: a - [1, 3]: d - [3, 0]: b - -##### Args: - - -* `sp_input`: The input `SparseTensor`. -* `perm`: A permutation of the dimensions of `sp_input`. -* `name`: A name prefix for the returned tensors (optional) - -##### Returns: - - A transposed `SparseTensor`. - -##### Raises: - - -* `TypeError`: If `sp_input` is not a `SparseTensor`. - - -- - - - -### `tf.sparse_reduce_sum(sp_input, axis=None, keep_dims=False, reduction_axes=None)` {#sparse_reduce_sum} - -Computes the sum of elements across dimensions of a SparseTensor. - -This Op takes a SparseTensor and is the sparse counterpart to -`tf.reduce_sum()`. In particular, this Op also returns a dense `Tensor` -instead of a sparse one. - -Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless -`keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in -`reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained -with length 1. - -If `reduction_axes` has no entries, all dimensions are reduced, and a tensor -with a single element is returned. Additionally, the axes can be negative, -similar to the indexing rules in Python. - -For example: - -```python -# 'x' represents [[1, ?, 1] -# [?, 1, ?]] -# where ? is implicitly-zero. -tf.sparse_reduce_sum(x) ==> 3 -tf.sparse_reduce_sum(x, 0) ==> [1, 1, 1] -tf.sparse_reduce_sum(x, 1) ==> [2, 1] # Can also use -1 as the axis. -tf.sparse_reduce_sum(x, 1, keep_dims=True) ==> [[2], [1]] -tf.sparse_reduce_sum(x, [0, 1]) ==> 3 -``` - -##### Args: - - -* `sp_input`: The SparseTensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce; list or scalar. If `None` (the - default), reduces all dimensions. -* `keep_dims`: If true, retain reduced dimensions with length 1. -* `reduction_axes`: Deprecated name of axis. - -##### Returns: - - The reduced Tensor. - - -- - - - -### `tf.sparse_reduce_sum_sparse(sp_input, axis=None, keep_dims=False, reduction_axes=None)` {#sparse_reduce_sum_sparse} - -Computes the sum of elements across dimensions of a SparseTensor. - -This Op takes a SparseTensor and is the sparse counterpart to -`tf.reduce_sum()`. In contrast to SparseReduceSum, this Op returns a -SparseTensor. - -Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless -`keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in -`reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained -with length 1. - -If `reduction_axes` has no entries, all dimensions are reduced, and a tensor -with a single element is returned. Additionally, the axes can be negative, -which are interpreted according to the indexing rules in Python. - -##### Args: - - -* `sp_input`: The SparseTensor to reduce. Should have numeric type. -* `axis`: The dimensions to reduce; list or scalar. If `None` (the - default), reduces all dimensions. -* `keep_dims`: If true, retain reduced dimensions with length 1. -* `reduction_axes`: Deprecated name of axis - -##### Returns: - - The reduced SparseTensor. - - -- - - - -### `tf.sparse_add(a, b, thresh=0)` {#sparse_add} - -Adds two tensors, at least one of each is a `SparseTensor`. - -If one `SparseTensor` and one `Tensor` are passed in, returns a `Tensor`. If -both arguments are `SparseTensor`s, this returns a `SparseTensor`. The order -of arguments does not matter. Use vanilla `tf.add()` for adding two dense -`Tensor`s. - -The indices of any input `SparseTensor` are assumed ordered in standard -lexicographic order. If this is not the case, before this step run -`SparseReorder` to restore index ordering. - -If both arguments are sparse, we perform "clipping" as follows. By default, -if two values sum to zero at some index, the output `SparseTensor` would still -include that particular location in its index, storing a zero in the -corresponding value slot. To override this, callers can specify `thresh`, -indicating that if the sum has a magnitude strictly smaller than `thresh`, its -corresponding value and index would then not be included. In particular, -`thresh == 0.0` (default) means everything is kept and actual thresholding -happens only for a positive value. - -For example, suppose the logical sum of two sparse operands is (densified): - - [ 2] - [.1 0] - [ 6 -.2] - -Then, - - * `thresh == 0` (the default): all 5 index/value pairs will be returned. - * `thresh == 0.11`: only .1 and 0 will vanish, and the remaining three - index/value pairs will be returned. - * `thresh == 0.21`: .1, 0, and -.2 will vanish. - -##### Args: - - -* `a`: The first operand; `SparseTensor` or `Tensor`. -* `b`: The second operand; `SparseTensor` or `Tensor`. At least one operand - must be sparse. -* `thresh`: A 0-D `Tensor`. The magnitude threshold that determines if an - output value/index pair takes space. Its dtype should match that of the - values if they are real; if the latter are complex64/complex128, then the - dtype should be float32/float64, correspondingly. - -##### Returns: - - A `SparseTensor` or a `Tensor`, representing the sum. - -##### Raises: - - -* `TypeError`: If both `a` and `b` are `Tensor`s. Use `tf.add()` instead. - - -- - - - -### `tf.sparse_softmax(sp_input, name=None)` {#sparse_softmax} - -Applies softmax to a batched N-D `SparseTensor`. - -The inputs represent an N-D SparseTensor with logical shape `[..., B, C]` -(where `N >= 2`), and with indices sorted in the canonical lexicographic -order. - -This op is equivalent to applying the normal `tf.nn.softmax()` to each -innermost logical submatrix with shape `[B, C]`, but with the catch that *the -implicitly zero elements do not participate*. Specifically, the algorithm is -equivalent to: - - (1) Applies `tf.nn.softmax()` to a densified view of each innermost - submatrix with shape `[B, C]`, along the size-C dimension; - (2) Masks out the original implicitly-zero locations; - (3) Renormalizes the remaining elements. - -Hence, the `SparseTensor` result has exactly the same non-zero indices and -shape. - -Example: - -```python -# First batch: -# [? e.] -# [1. ? ] -# Second batch: -# [e ? ] -# [e e ] -shape = [2, 2, 2] # 3-D SparseTensor -values = np.asarray([[[0., np.e], [1., 0.]], [[np.e, 0.], [np.e, np.e]]]) -indices = np.vstack(np.where(values)).astype(np.int64).T - -result = tf.sparse_softmax(tf.SparseTensor(indices, values, shape)) -# ...returning a 3-D SparseTensor, equivalent to: -# [? 1.] [1 ?] -# [1. ? ] and [.5 .5] -# where ? means implicitly zero. -``` - -##### Args: - - -* `sp_input`: N-D `SparseTensor`, where `N >= 2`. -* `name`: optional name of the operation. - -##### Returns: - - -* `output`: N-D `SparseTensor` representing the results. - - -- - - - -### `tf.sparse_tensor_dense_matmul(sp_a, b, adjoint_a=False, adjoint_b=False, name=None)` {#sparse_tensor_dense_matmul} - -Multiply SparseTensor (of rank 2) "A" by dense matrix "B". - -No validity checking is performed on the indices of A. However, the following -input format is recommended for optimal behavior: - -if adjoint_a == false: - A should be sorted in lexicographically increasing order. Use - sparse_reorder if you're not sure. -if adjoint_a == true: - A should be sorted in order of increasing dimension 1 (i.e., "column major" - order instead of "row major" order). - -Deciding when to use sparse_tensor_dense_matmul vs. matmul(sp_a=True): - -There are a number of questions to ask in the decision process, including: - -* Will the SparseTensor A fit in memory if densified? -* Is the column count of the product large (>> 1)? -* Is the density of A larger than approximately 15%? - -If the answer to several of these questions is yes, consider -converting the `SparseTensor` to a dense one and using `tf.matmul` with -`sp_a=True`. - -This operation tends to perform well when A is more sparse, if the column size -of the product is small (e.g. matrix-vector multiplication), if -`sp_a.dense_shape` takes on large values. - -Below is a rough speed comparison between sparse_tensor_dense_matmul, -labelled 'sparse', and matmul(sp_a=True), labelled 'dense'. For purposes of -the comparison, the time spent converting from a SparseTensor to a dense -Tensor is not included, so it is overly conservative with respect to -the time ratio. - -Benchmark system: -CPU: Intel Ivybridge with HyperThreading (6 cores) dL1:32KB dL2:256KB dL3:12MB -GPU: NVidia Tesla k40c - -Compiled with: -`-c opt --config=cuda --copt=-mavx` - -``` -tensorflow/python/sparse_tensor_dense_matmul_op_test --benchmarks -A sparse [m, k] with % nonzero values between 1% and 80% -B dense [k, n] - -% nnz n gpu m k dt(dense) dt(sparse) dt(sparse)/dt(dense) -0.01 1 True 100 100 0.000221166 0.00010154 0.459112 -0.01 1 True 100 1000 0.00033858 0.000109275 0.322745 -0.01 1 True 1000 100 0.000310557 9.85661e-05 0.317385 -0.01 1 True 1000 1000 0.0008721 0.000100875 0.115669 -0.01 1 False 100 100 0.000208085 0.000107603 0.51711 -0.01 1 False 100 1000 0.000327112 9.51118e-05 0.290762 -0.01 1 False 1000 100 0.000308222 0.00010345 0.335635 -0.01 1 False 1000 1000 0.000865721 0.000101397 0.117124 -0.01 10 True 100 100 0.000218522 0.000105537 0.482958 -0.01 10 True 100 1000 0.000340882 0.000111641 0.327506 -0.01 10 True 1000 100 0.000315472 0.000117376 0.372064 -0.01 10 True 1000 1000 0.000905493 0.000123263 0.136128 -0.01 10 False 100 100 0.000221529 9.82571e-05 0.44354 -0.01 10 False 100 1000 0.000330552 0.000112615 0.340687 -0.01 10 False 1000 100 0.000341277 0.000114097 0.334324 -0.01 10 False 1000 1000 0.000819944 0.000120982 0.147549 -0.01 25 True 100 100 0.000207806 0.000105977 0.509981 -0.01 25 True 100 1000 0.000322879 0.00012921 0.400181 -0.01 25 True 1000 100 0.00038262 0.00014158 0.370035 -0.01 25 True 1000 1000 0.000865438 0.000202083 0.233504 -0.01 25 False 100 100 0.000209401 0.000104696 0.499979 -0.01 25 False 100 1000 0.000321161 0.000130737 0.407076 -0.01 25 False 1000 100 0.000377012 0.000136801 0.362856 -0.01 25 False 1000 1000 0.000861125 0.00020272 0.235413 -0.2 1 True 100 100 0.000206952 9.69219e-05 0.46833 -0.2 1 True 100 1000 0.000348674 0.000147475 0.422959 -0.2 1 True 1000 100 0.000336908 0.00010122 0.300439 -0.2 1 True 1000 1000 0.001022 0.000203274 0.198898 -0.2 1 False 100 100 0.000207532 9.5412e-05 0.459746 -0.2 1 False 100 1000 0.000356127 0.000146824 0.41228 -0.2 1 False 1000 100 0.000322664 0.000100918 0.312764 -0.2 1 False 1000 1000 0.000998987 0.000203442 0.203648 -0.2 10 True 100 100 0.000211692 0.000109903 0.519165 -0.2 10 True 100 1000 0.000372819 0.000164321 0.440753 -0.2 10 True 1000 100 0.000338651 0.000144806 0.427596 -0.2 10 True 1000 1000 0.00108312 0.000758876 0.70064 -0.2 10 False 100 100 0.000215727 0.000110502 0.512231 -0.2 10 False 100 1000 0.000375419 0.0001613 0.429653 -0.2 10 False 1000 100 0.000336999 0.000145628 0.432132 -0.2 10 False 1000 1000 0.00110502 0.000762043 0.689618 -0.2 25 True 100 100 0.000218705 0.000129913 0.594009 -0.2 25 True 100 1000 0.000394794 0.00029428 0.745402 -0.2 25 True 1000 100 0.000404483 0.0002693 0.665788 -0.2 25 True 1000 1000 0.0012002 0.00194494 1.62052 -0.2 25 False 100 100 0.000221494 0.0001306 0.589632 -0.2 25 False 100 1000 0.000396436 0.000297204 0.74969 -0.2 25 False 1000 100 0.000409346 0.000270068 0.659754 -0.2 25 False 1000 1000 0.00121051 0.00193737 1.60046 -0.5 1 True 100 100 0.000214981 9.82111e-05 0.456836 -0.5 1 True 100 1000 0.000415328 0.000223073 0.537101 -0.5 1 True 1000 100 0.000358324 0.00011269 0.314492 -0.5 1 True 1000 1000 0.00137612 0.000437401 0.317851 -0.5 1 False 100 100 0.000224196 0.000101423 0.452386 -0.5 1 False 100 1000 0.000400987 0.000223286 0.556841 -0.5 1 False 1000 100 0.000368825 0.00011224 0.304318 -0.5 1 False 1000 1000 0.00136036 0.000429369 0.31563 -0.5 10 True 100 100 0.000222125 0.000112308 0.505608 -0.5 10 True 100 1000 0.000461088 0.00032357 0.701753 -0.5 10 True 1000 100 0.000394624 0.000225497 0.571422 -0.5 10 True 1000 1000 0.00158027 0.00190898 1.20801 -0.5 10 False 100 100 0.000232083 0.000114978 0.495418 -0.5 10 False 100 1000 0.000454574 0.000324632 0.714146 -0.5 10 False 1000 100 0.000379097 0.000227768 0.600817 -0.5 10 False 1000 1000 0.00160292 0.00190168 1.18638 -0.5 25 True 100 100 0.00023429 0.000151703 0.647501 -0.5 25 True 100 1000 0.000497462 0.000598873 1.20386 -0.5 25 True 1000 100 0.000460778 0.000557038 1.20891 -0.5 25 True 1000 1000 0.00170036 0.00467336 2.74845 -0.5 25 False 100 100 0.000228981 0.000155334 0.678371 -0.5 25 False 100 1000 0.000496139 0.000620789 1.25124 -0.5 25 False 1000 100 0.00045473 0.000551528 1.21287 -0.5 25 False 1000 1000 0.00171793 0.00467152 2.71927 -0.8 1 True 100 100 0.000222037 0.000105301 0.47425 -0.8 1 True 100 1000 0.000410804 0.000329327 0.801664 -0.8 1 True 1000 100 0.000349735 0.000131225 0.375212 -0.8 1 True 1000 1000 0.00139219 0.000677065 0.48633 -0.8 1 False 100 100 0.000214079 0.000107486 0.502085 -0.8 1 False 100 1000 0.000413746 0.000323244 0.781261 -0.8 1 False 1000 100 0.000348983 0.000131983 0.378193 -0.8 1 False 1000 1000 0.00136296 0.000685325 0.50282 -0.8 10 True 100 100 0.000229159 0.00011825 0.516017 -0.8 10 True 100 1000 0.000498845 0.000532618 1.0677 -0.8 10 True 1000 100 0.000383126 0.00029935 0.781336 -0.8 10 True 1000 1000 0.00162866 0.00307312 1.88689 -0.8 10 False 100 100 0.000230783 0.000124958 0.541452 -0.8 10 False 100 1000 0.000493393 0.000550654 1.11606 -0.8 10 False 1000 100 0.000377167 0.000298581 0.791642 -0.8 10 False 1000 1000 0.00165795 0.00305103 1.84024 -0.8 25 True 100 100 0.000233496 0.000175241 0.75051 -0.8 25 True 100 1000 0.00055654 0.00102658 1.84458 -0.8 25 True 1000 100 0.000463814 0.000783267 1.68875 -0.8 25 True 1000 1000 0.00186905 0.00755344 4.04132 -0.8 25 False 100 100 0.000240243 0.000175047 0.728625 -0.8 25 False 100 1000 0.000578102 0.00104499 1.80763 -0.8 25 False 1000 100 0.000485113 0.000776849 1.60138 -0.8 25 False 1000 1000 0.00211448 0.00752736 3.55992 -``` - -##### Args: - - -* `sp_a`: SparseTensor A, of rank 2. -* `b`: A dense Matrix with the same dtype as sp_a. -* `adjoint_a`: Use the adjoint of A in the matrix multiply. If A is complex, - this is transpose(conj(A)). Otherwise it's transpose(A). -* `adjoint_b`: Use the adjoint of B in the matrix multiply. If B is complex, - this is transpose(conj(B)). Otherwise it's transpose(B). -* `name`: A name prefix for the returned tensors (optional) - -##### Returns: - - A dense matrix (pseudo-code in dense np.matrix notation): - A = A.H if adjoint_a else A - B = B.H if adjoint_b else B - return A*B - - -- - - - -### `tf.sparse_maximum(sp_a, sp_b, name=None)` {#sparse_maximum} - -Returns the element-wise max of two SparseTensors. - -Assumes the two SparseTensors have the same shape, i.e., no broadcasting. -Example: - -```python -sp_zero = sparse_tensor.SparseTensor([[0]], [0], [7]) -sp_one = sparse_tensor.SparseTensor([[1]], [1], [7]) -res = tf.sparse_maximum(sp_zero, sp_one).eval() -# "res" should be equal to SparseTensor([[0], [1]], [0, 1], [7]). -``` - -##### Args: - - -* `sp_a`: a `SparseTensor` operand whose dtype is real, and indices - lexicographically ordered. -* `sp_b`: the other `SparseTensor` operand with the same requirements (and the - same shape). -* `name`: optional name of the operation. - -##### Returns: - - -* `output`: the output SparseTensor. - - -- - - - -### `tf.sparse_minimum(sp_a, sp_b, name=None)` {#sparse_minimum} - -Returns the element-wise min of two SparseTensors. - -Assumes the two SparseTensors have the same shape, i.e., no broadcasting. -Example: - -```python -sp_zero = sparse_tensor.SparseTensor([[0]], [0], [7]) -sp_one = sparse_tensor.SparseTensor([[1]], [1], [7]) -res = tf.sparse_minimum(sp_zero, sp_one).eval() -# "res" should be equal to SparseTensor([[0], [1]], [0, 0], [7]). -``` - -##### Args: - - -* `sp_a`: a `SparseTensor` operand whose dtype is real, and indices - lexicographically ordered. -* `sp_b`: the other `SparseTensor` operand with the same requirements (and the - same shape). -* `name`: optional name of the operation. - -##### Returns: - - -* `output`: the output SparseTensor. - - diff --git a/tensorflow/g3doc/api_docs/python/state_ops.md b/tensorflow/g3doc/api_docs/python/state_ops.md deleted file mode 100644 index 5477beda8a..0000000000 --- a/tensorflow/g3doc/api_docs/python/state_ops.md +++ /dev/null @@ -1,3657 +0,0 @@ - - -# Variables - -Note: Functions taking `Tensor` arguments can also take anything accepted by -[`tf.convert_to_tensor`](framework.md#convert_to_tensor). - -[TOC] - -Variables. See the @{python/state_ops} guide. - -- - - - -### `class tf.Variable` {#Variable} - -See the [Variables How To](../../how_tos/variables/index.md) for a high -level overview. - -A variable maintains state in the graph across calls to `run()`. You add a -variable to the graph by constructing an instance of the class `Variable`. - -The `Variable()` constructor requires an initial value for the variable, -which can be a `Tensor` of any type and shape. The initial value defines the -type and shape of the variable. After construction, the type and shape of -the variable are fixed. The value can be changed using one of the assign -methods. - -If you want to change the shape of a variable later you have to use an -`assign` Op with `validate_shape=False`. - -Just like any `Tensor`, variables created with `Variable()` can be used as -inputs for other Ops in the graph. Additionally, all the operators -overloaded for the `Tensor` class are carried over to variables, so you can -also add nodes to the graph by just doing arithmetic on variables. - -```python -import tensorflow as tf - -# Create a variable. -w = tf.Variable(, name=) - -# Use the variable in the graph like any Tensor. -y = tf.matmul(w, ...another variable or tensor...) - -# The overloaded operators are available too. -z = tf.sigmoid(w + y) - -# Assign a new value to the variable with `assign()` or a related method. -w.assign(w + 1.0) -w.assign_add(1.0) -``` - -When you launch the graph, variables have to be explicitly initialized before -you can run Ops that use their value. You can initialize a variable by -running its *initializer op*, restoring the variable from a save file, or -simply running an `assign` Op that assigns a value to the variable. In fact, -the variable *initializer op* is just an `assign` Op that assigns the -variable's initial value to the variable itself. - -```python -# Launch the graph in a session. -with tf.Session() as sess: - # Run the variable initializer. - sess.run(w.initializer) - # ...you now can run ops that use the value of 'w'... -``` - -The most common initialization pattern is to use the convenience function -`global_variables_initializer()` to add an Op to the graph that initializes -all the variables. You then run that Op after launching the graph. - -```python -# Add an Op to initialize global variables. -init_op = tf.global_variables_initializer() - -# Launch the graph in a session. -with tf.Session() as sess: - # Run the Op that initializes global variables. - sess.run(init_op) - # ...you can now run any Op that uses variable values... -``` - -If you need to create a variable with an initial value dependent on another -variable, use the other variable's `initialized_value()`. This ensures that -variables are initialized in the right order. - -All variables are automatically collected in the graph where they are -created. By default, the constructor adds the new variable to the graph -collection `GraphKeys.GLOBAL_VARIABLES`. The convenience function -`global_variables()` returns the contents of that collection. - -When building a machine learning model it is often convenient to distinguish -between variables holding the trainable model parameters and other variables -such as a `global step` variable used to count training steps. To make this -easier, the variable constructor supports a `trainable=` parameter. If -`True`, the new variable is also added to the graph collection -`GraphKeys.TRAINABLE_VARIABLES`. The convenience function -`trainable_variables()` returns the contents of this collection. The -various `Optimizer` classes use this collection as the default list of -variables to optimize. - - -Creating a variable. - -- - - - -#### `tf.Variable.__init__(initial_value=None, trainable=True, collections=None, validate_shape=True, caching_device=None, name=None, variable_def=None, dtype=None, expected_shape=None, import_scope=None)` {#Variable.__init__} - -Creates a new variable with value `initial_value`. - -The new variable is added to the graph collections listed in `collections`, -which defaults to `[GraphKeys.GLOBAL_VARIABLES]`. - -If `trainable` is `True` the variable is also added to the graph collection -`GraphKeys.TRAINABLE_VARIABLES`. - -This constructor creates both a `variable` Op and an `assign` Op to set the -variable to its initial value. - -##### Args: - - -* `initial_value`: A `Tensor`, or Python object convertible to a `Tensor`, - which is the initial value for the Variable. The initial value must have - a shape specified unless `validate_shape` is set to False. Can also be a - callable with no argument that returns the initial value when called. In - that case, `dtype` must be specified. (Note that initializer functions - from init_ops.py must first be bound to a shape before being used here.) -* `trainable`: If `True`, the default, also adds the variable to the graph - collection `GraphKeys.TRAINABLE_VARIABLES`. This collection is used as - the default list of variables to use by the `Optimizer` classes. -* `collections`: List of graph collections keys. The new variable is added to - these collections. Defaults to `[GraphKeys.GLOBAL_VARIABLES]`. -* `validate_shape`: If `False`, allows the variable to be initialized with a - value of unknown shape. If `True`, the default, the shape of - `initial_value` must be known. -* `caching_device`: Optional device string describing where the Variable - should be cached for reading. Defaults to the Variable's device. - If not `None`, caches on another device. Typical use is to cache - on the device where the Ops using the Variable reside, to deduplicate - copying through `Switch` and other conditional statements. -* `name`: Optional name for the variable. Defaults to `'Variable'` and gets - uniquified automatically. -* `variable_def`: `VariableDef` protocol buffer. If not `None`, recreates - the Variable object with its contents. `variable_def` and the other - arguments are mutually exclusive. -* `dtype`: If set, initial_value will be converted to the given type. - If `None`, either the datatype will be kept (if `initial_value` is - a Tensor), or `convert_to_tensor` will decide. -* `expected_shape`: A TensorShape. If set, initial_value is expected - to have this shape. -* `import_scope`: Optional `string`. Name scope to add to the - `Variable.` Only used when initializing from protocol buffer. - -##### Raises: - - -* `ValueError`: If both `variable_def` and initial_value are specified. -* `ValueError`: If the initial value is not specified, or does not have a - shape and `validate_shape` is `True`. - - -- - - - -#### `tf.Variable.initialized_value()` {#Variable.initialized_value} - -Returns the value of the initialized variable. - -You should use this instead of the variable itself to initialize another -variable with a value that depends on the value of this variable. - -Beware of using initialized_value except during initialization: -initialized_value causes the Variable's initializer op to be run, so running -this op resets the variable to the initial value. - -```python -# Initialize 'v' with a random tensor. -v = tf.Variable(tf.truncated_normal([10, 40])) -# Use `initialized_value` to guarantee that `v` has been -# initialized before its value is used to initialize `w`. -# The random values are picked only once. -w = tf.Variable(v.initialized_value() * 2.0) -``` - -##### Returns: - - A `Tensor` holding the value of this variable after its initializer - has run. - - - -Changing a variable value. - -- - - - -#### `tf.Variable.assign(value, use_locking=False)` {#Variable.assign} - -Assigns a new value to the variable. - -This is essentially a shortcut for `assign(self, value)`. - -##### Args: - - -* `value`: A `Tensor`. The new value for this variable. -* `use_locking`: If `True`, use locking during the assignment. - -##### Returns: - - A `Tensor` that will hold the new value of this variable after - the assignment has completed. - - -- - - - -#### `tf.Variable.assign_add(delta, use_locking=False)` {#Variable.assign_add} - -Adds a value to this variable. - - This is essentially a shortcut for `assign_add(self, delta)`. - -##### Args: - - -* `delta`: A `Tensor`. The value to add to this variable. -* `use_locking`: If `True`, use locking during the operation. - -##### Returns: - - A `Tensor` that will hold the new value of this variable after - the addition has completed. - - -- - - - -#### `tf.Variable.assign_sub(delta, use_locking=False)` {#Variable.assign_sub} - -Subtracts a value from this variable. - -This is essentially a shortcut for `assign_sub(self, delta)`. - -##### Args: - - -* `delta`: A `Tensor`. The value to subtract from this variable. -* `use_locking`: If `True`, use locking during the operation. - -##### Returns: - - A `Tensor` that will hold the new value of this variable after - the subtraction has completed. - - -- - - - -#### `tf.Variable.scatter_sub(sparse_delta, use_locking=False)` {#Variable.scatter_sub} - -Subtracts `IndexedSlices` from this variable. - -This is essentially a shortcut for `scatter_sub(self, sparse_delta.indices, -sparse_delta.values)`. - -##### Args: - - -* `sparse_delta`: `IndexedSlices` to be subtracted from this variable. -* `use_locking`: If `True`, use locking during the operation. - -##### Returns: - - A `Tensor` that will hold the new value of this variable after - the scattered subtraction has completed. - -##### Raises: - - -* `ValueError`: if `sparse_delta` is not an `IndexedSlices`. - - -- - - - -#### `tf.Variable.count_up_to(limit)` {#Variable.count_up_to} - -Increments this variable until it reaches `limit`. - -When that Op is run it tries to increment the variable by `1`. If -incrementing the variable would bring it above `limit` then the Op raises -the exception `OutOfRangeError`. - -If no error is raised, the Op outputs the value of the variable before -the increment. - -This is essentially a shortcut for `count_up_to(self, limit)`. - -##### Args: - - -* `limit`: value at which incrementing the variable raises an error. - -##### Returns: - - A `Tensor` that will hold the variable value before the increment. If no - other Op modifies this variable, the values produced will all be - distinct. - - - -- - - - -#### `tf.Variable.eval(session=None)` {#Variable.eval} - -In a session, computes and returns the value of this variable. - -This is not a graph construction method, it does not add ops to the graph. - -This convenience method requires a session where the graph containing this -variable has been launched. If no session is passed, the default session is -used. See the [Session class](../../api_docs/python/client.md#Session) for -more information on launching a graph and on sessions. - -```python -v = tf.Variable([1, 2]) -init = tf.global_variables_initializer() - -with tf.Session() as sess: - sess.run(init) - # Usage passing the session explicitly. - print(v.eval(sess)) - # Usage with the default session. The 'with' block - # above makes 'sess' the default session. - print(v.eval()) -``` - -##### Args: - - -* `session`: The session to use to evaluate this variable. If - none, the default session is used. - -##### Returns: - - A numpy `ndarray` with a copy of the value of this variable. - - - -Properties. - -- - - - -#### `tf.Variable.name` {#Variable.name} - -The name of this variable. - - -- - - - -#### `tf.Variable.dtype` {#Variable.dtype} - -The `DType` of this variable. - - -- - - - -#### `tf.Variable.get_shape()` {#Variable.get_shape} - -The `TensorShape` of this variable. - -##### Returns: - - A `TensorShape`. - - -- - - - -#### `tf.Variable.device` {#Variable.device} - -The device of this variable. - - -- - - - -#### `tf.Variable.initializer` {#Variable.initializer} - -The initializer operation for this variable. - - -- - - - -#### `tf.Variable.graph` {#Variable.graph} - -The `Graph` of this variable. - - -- - - - -#### `tf.Variable.op` {#Variable.op} - -The `Operation` of this variable. - - - -#### Other Methods -- - - - -#### `tf.Variable.__abs__(a, *args)` {#Variable.__abs__} - -Computes the absolute value of a tensor. - -Given a tensor of real numbers `x`, this operation returns a tensor -containing the absolute value of each element in `x`. For example, if x is -an input element and y is an output element, this operation computes -\\(y = |x|\\). - -##### Args: - - -* `x`: A `Tensor` or `SparseTensor` of type `float32`, `float64`, `int32`, or - `int64`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` or `SparseTensor` the same size and type as `x` with absolute - values. - - -- - - - -#### `tf.Variable.__add__(a, *args)` {#Variable.__add__} - -Returns x + y element-wise. - -*NOTE*: `Add` supports broadcasting. `AddN` does not. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`, `complex64`, `complex128`, `string`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Variable.__and__(a, *args)` {#Variable.__and__} - -Returns the truth value of x AND y element-wise. - -*NOTE*: `LogicalAnd` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__div__(a, *args)` {#Variable.__div__} - -Divide two values using Python 2 semantics. Used for Tensor.__div__. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` returns the quotient of x and y. - - -- - - - -#### `tf.Variable.__floordiv__(a, *args)` {#Variable.__floordiv__} - -Divides `x / y` elementwise, rounding toward the most negative integer. - -The same as `tf.div(x,y)` for integers, but uses `tf.floor(tf.div(x,y))` for -floating point arguments so that the result is always an integer (though -possibly an integer represented as floating point). This op is generated by -`x // y` floor division in Python 3 and in Python 2.7 with -`from __future__ import division`. - -Note that for efficiency, `floordiv` uses C semantics for negative numbers -(unlike Python and Numpy). - -`x` and `y` must have the same type, and the result will have the same type -as well. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` rounded down (except possibly towards zero for negative integers). - -##### Raises: - - -* `TypeError`: If the inputs are complex. - - -- - - - -#### `tf.Variable.__ge__(a, *args)` {#Variable.__ge__} - -Returns the truth value of (x >= y) element-wise. - -*NOTE*: `GreaterEqual` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__getitem__(var, slice_spec)` {#Variable.__getitem__} - -Creates a slice helper object given a variable. - -This allows creating a sub-tensor from part of the current contents -of a variable. -See -[`Tensor.__getitem__`](../../api_docs/python/framework.md#Tensor.__getitem__) -for detailed examples of slicing. - -This function in addition also allows assignment to a sliced range. -This is similar to `__setitem__` functionality in Python. However, -the syntax is different so that the user can capture the assignment -operation for grouping or passing to `sess.run()`. -For example, - -```prettyprint -import tensorflow as tf -A = tf.Variable([[1,2,3], [4,5,6], [7,8,9]], dtype=tf.float32) -with tf.Session() as sess: - sess.run(tf.global_variables_initializer()) - print sess.run(A[:2, :2]) # => [[1,2], [4,5]] - - op = A[:2,:2].assign(22. * tf.ones((2, 2))) - print sess.run(op) # => [[22, 22, 3], [22, 22, 6], [7,8,9]] -``` - -Note that assignments currently do not support NumPy broadcasting -semantics. - -##### Args: - - -* `var`: An `ops.Variable` object. -* `slice_spec`: The arguments to `Tensor.__getitem__`. - -##### Returns: - - The appropriate slice of "tensor", based on "slice_spec". - As an operator. The operator also has a `assign()` method - that can be used to generate an assignment operator. - -##### Raises: - - -* `ValueError`: If a slice range is negative size. -* `TypeError`: If the slice indices aren't int, slice, or Ellipsis. - - -- - - - -#### `tf.Variable.__gt__(a, *args)` {#Variable.__gt__} - -Returns the truth value of (x > y) element-wise. - -*NOTE*: `Greater` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__invert__(a, *args)` {#Variable.__invert__} - -Returns the truth value of NOT x element-wise. - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__iter__()` {#Variable.__iter__} - -Dummy method to prevent iteration. Do not call. - -NOTE(mrry): If we register __getitem__ as an overloaded operator, -Python will valiantly attempt to iterate over the variable's Tensor from 0 -to infinity. Declaring this method prevents this unintended behavior. - -##### Raises: - - -* `TypeError`: when invoked. - - -- - - - -#### `tf.Variable.__le__(a, *args)` {#Variable.__le__} - -Returns the truth value of (x <= y) element-wise. - -*NOTE*: `LessEqual` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__lt__(a, *args)` {#Variable.__lt__} - -Returns the truth value of (x < y) element-wise. - -*NOTE*: `Less` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__mod__(a, *args)` {#Variable.__mod__} - -Returns element-wise remainder of division. When `x < 0` xor `y < 0` is - -true, this follows Python semantics in that the result here is consistent -with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. - -*NOTE*: `FloorMod` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `float32`, `float64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Variable.__mul__(a, *args)` {#Variable.__mul__} - -Dispatches cwise mul for "Dense*Dense" and "Dense*Sparse". - - -- - - - -#### `tf.Variable.__neg__(a, *args)` {#Variable.__neg__} - -Computes numerical negative value element-wise. - -I.e., \\(y = -x\\). - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Variable.__or__(a, *args)` {#Variable.__or__} - -Returns the truth value of x OR y element-wise. - -*NOTE*: `LogicalOr` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__pow__(a, *args)` {#Variable.__pow__} - -Computes the power of one value to another. - -Given a tensor `x` and a tensor `y`, this operation computes \\(x^y\\) for -corresponding elements in `x` and `y`. For example: - -``` -# tensor 'x' is [[2, 2], [3, 3]] -# tensor 'y' is [[8, 16], [2, 3]] -tf.pow(x, y) ==> [[256, 65536], [9, 27]] -``` - -##### Args: - - -* `x`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `y`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. - - -- - - - -#### `tf.Variable.__radd__(a, *args)` {#Variable.__radd__} - -Returns x + y element-wise. - -*NOTE*: `Add` supports broadcasting. `AddN` does not. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`, `complex64`, `complex128`, `string`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Variable.__rand__(a, *args)` {#Variable.__rand__} - -Returns the truth value of x AND y element-wise. - -*NOTE*: `LogicalAnd` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__rdiv__(a, *args)` {#Variable.__rdiv__} - -Divide two values using Python 2 semantics. Used for Tensor.__div__. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` returns the quotient of x and y. - - -- - - - -#### `tf.Variable.__rfloordiv__(a, *args)` {#Variable.__rfloordiv__} - -Divides `x / y` elementwise, rounding toward the most negative integer. - -The same as `tf.div(x,y)` for integers, but uses `tf.floor(tf.div(x,y))` for -floating point arguments so that the result is always an integer (though -possibly an integer represented as floating point). This op is generated by -`x // y` floor division in Python 3 and in Python 2.7 with -`from __future__ import division`. - -Note that for efficiency, `floordiv` uses C semantics for negative numbers -(unlike Python and Numpy). - -`x` and `y` must have the same type, and the result will have the same type -as well. - -##### Args: - - -* `x`: `Tensor` numerator of real numeric type. -* `y`: `Tensor` denominator of real numeric type. -* `name`: A name for the operation (optional). - -##### Returns: - - `x / y` rounded down (except possibly towards zero for negative integers). - -##### Raises: - - -* `TypeError`: If the inputs are complex. - - -- - - - -#### `tf.Variable.__rmod__(a, *args)` {#Variable.__rmod__} - -Returns element-wise remainder of division. When `x < 0` xor `y < 0` is - -true, this follows Python semantics in that the result here is consistent -with a flooring divide. E.g. `floor(x / y) * y + mod(x, y) = x`. - -*NOTE*: `FloorMod` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `float32`, `float64`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Variable.__rmul__(a, *args)` {#Variable.__rmul__} - -Dispatches cwise mul for "Dense*Dense" and "Dense*Sparse". - - -- - - - -#### `tf.Variable.__ror__(a, *args)` {#Variable.__ror__} - -Returns the truth value of x OR y element-wise. - -*NOTE*: `LogicalOr` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor` of type `bool`. -* `y`: A `Tensor` of type `bool`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `bool`. - - -- - - - -#### `tf.Variable.__rpow__(a, *args)` {#Variable.__rpow__} - -Computes the power of one value to another. - -Given a tensor `x` and a tensor `y`, this operation computes \\(x^y\\) for -corresponding elements in `x` and `y`. For example: - -``` -# tensor 'x' is [[2, 2], [3, 3]] -# tensor 'y' is [[8, 16], [2, 3]] -tf.pow(x, y) ==> [[256, 65536], [9, 27]] -``` - -##### Args: - - -* `x`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `y`: A `Tensor` of type `float32`, `float64`, `int32`, `int64`, `complex64`, - or `complex128`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. - - -- - - - -#### `tf.Variable.__rsub__(a, *args)` {#Variable.__rsub__} - -Returns x - y element-wise. - -*NOTE*: `Sub` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Variable.__rtruediv__(a, *args)` {#Variable.__rtruediv__} - - - - -- - - - -#### `tf.Variable.__rxor__(a, *args)` {#Variable.__rxor__} - -x ^ y = (x | y) & ~(x & y). - - -- - - - -#### `tf.Variable.__str__()` {#Variable.__str__} - - - - -- - - - -#### `tf.Variable.__sub__(a, *args)` {#Variable.__sub__} - -Returns x - y element-wise. - -*NOTE*: `Sub` supports broadcasting. More about broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - -##### Args: - - -* `x`: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. -* `y`: A `Tensor`. Must have the same type as `x`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `x`. - - -- - - - -#### `tf.Variable.__truediv__(a, *args)` {#Variable.__truediv__} - - - - -- - - - -#### `tf.Variable.__xor__(a, *args)` {#Variable.__xor__} - -x ^ y = (x | y) & ~(x & y). - - -- - - - -#### `tf.Variable.from_proto(variable_def, import_scope=None)` {#Variable.from_proto} - -Returns a `Variable` object created from `variable_def`. - - -- - - - -#### `tf.Variable.initial_value` {#Variable.initial_value} - -Returns the Tensor used as the initial value for the variable. - -Note that this is different from `initialized_value()` which runs -the op that initializes the variable before returning its value. -This method returns the tensor that is used by the op that initializes -the variable. - -##### Returns: - - A `Tensor`. - - -- - - - -#### `tf.Variable.load(value, session=None)` {#Variable.load} - -Load new value into this variable - -Writes new value to variable's memory. Doesn't add ops to the graph. - -This convenience method requires a session where the graph containing this -variable has been launched. If no session is passed, the default session is -used. See the [Session class](../../api_docs/python/client.md#Session) for -more information on launching a graph and on sessions. - -```python -v = tf.Variable([1, 2]) -init = tf.global_variables_initializer() - -with tf.Session() as sess: - sess.run(init) - # Usage passing the session explicitly. - v.load([2, 3], sess) - print(v.eval(sess)) # prints [2 3] - # Usage with the default session. The 'with' block - # above makes 'sess' the default session. - v.load([3, 4], sess) - print(v.eval()) # prints [3 4] -``` - -##### Args: - - -* `value`: New variable value -* `session`: The session to use to evaluate this variable. If - none, the default session is used. - -##### Raises: - - -* `ValueError`: Session is not passed and no default session - - -- - - - -#### `tf.Variable.read_value()` {#Variable.read_value} - -Returns the value of this variable, read in the current context. - -Can be different from value() if it's on another device, with control -dependencies, etc. - -##### Returns: - - A `Tensor` containing the value of the variable. - - -- - - - -#### `tf.Variable.set_shape(shape)` {#Variable.set_shape} - -Overrides the shape for this variable. - -##### Args: - - -* `shape`: the `TensorShape` representing the overridden shape. - - -- - - - -#### `tf.Variable.to_proto(export_scope=None)` {#Variable.to_proto} - -Converts a `Variable` to a `VariableDef` protocol buffer. - -##### Args: - - -* `export_scope`: Optional `string`. Name scope to remove. - -##### Returns: - - A `VariableDef` protocol buffer, or `None` if the `Variable` is not - in the specified name scope. - - -- - - - -#### `tf.Variable.value()` {#Variable.value} - -Returns the last snapshot of this variable. - -You usually do not need to call this method as all ops that need the value -of the variable call it automatically through a `convert_to_tensor()` call. - -Returns a `Tensor` which holds the value of the variable. You can not -assign a new value to this tensor as it is not a reference to the variable. - -To avoid copies, if the consumer of the returned value is on the same device -as the variable, this actually returns the live value of the variable, not -a copy. Updates to the variable are seen by the consumer. If the consumer -is on a different device it will get a copy of the variable. - -##### Returns: - - A `Tensor` containing the value of the variable. - - - -- - - - -### `tf.global_variables()` {#global_variables} - -Returns global variables. - -Global variables are variables that are shared across machines in a -distributed environment. The `Variable()` constructor or `get_variable()` -automatically adds new variables to the graph collection -`GraphKeys.GLOBAL_VARIABLES`. -This convenience function returns the contents of that collection. - -An alternative to global variables are local variables. See -[`tf.local_variables()`](../../api_docs/python/state_ops.md#local_variables) - -##### Returns: - - A list of `Variable` objects. - - -- - - - -### `tf.local_variables()` {#local_variables} - -Returns local variables. - -Local variables - per process variables, usually not saved/restored to -checkpoint and used for temporary or intermediate values. -For example, they can be used as counters for metrics computation or -number of epochs this machine has read data. -The `tf.contrib.framework.local_variable()` function automatically adds the -new variable to `GraphKeys.LOCAL_VARIABLES`. -This convenience function returns the contents of that collection. - -An alternative to local variables are global variables. See -[`tf.global_variables()`](../../api_docs/python/state_ops.md#global_variables) - -##### Returns: - - A list of local `Variable` objects. - - -- - - - -### `tf.model_variables()` {#model_variables} - -Returns all variables in the MODEL_VARIABLES collection. - -##### Returns: - - A list of local Variable objects. - - -- - - - -### `tf.trainable_variables()` {#trainable_variables} - -Returns all variables created with `trainable=True`. - -When passed `trainable=True`, the `Variable()` constructor automatically -adds new variables to the graph collection -`GraphKeys.TRAINABLE_VARIABLES`. This convenience function returns the -contents of that collection. - -##### Returns: - - A list of Variable objects. - - -- - - - -### `tf.moving_average_variables()` {#moving_average_variables} - -Returns all variables that maintain their moving averages. - -If an `ExponentialMovingAverage` object is created and the `apply()` -method is called on a list of variables, these variables will -be added to the `GraphKeys.MOVING_AVERAGE_VARIABLES` collection. -This convenience function returns the contents of that collection. - -##### Returns: - - A list of Variable objects. - - -- - - - -### `tf.global_variables_initializer()` {#global_variables_initializer} - -Returns an Op that initializes global variables. - -This is just a shortcut for `variable_initializers(global_variables())` - -##### Returns: - - An Op that initializes global variables in the graph. - - -- - - - -### `tf.local_variables_initializer()` {#local_variables_initializer} - -Returns an Op that initializes all local variables. - -This is just a shortcut for `variable_initializers(local_variables())` - -##### Returns: - - An Op that initializes all local variables in the graph. - - -- - - - -### `tf.variables_initializer(var_list, name='init')` {#variables_initializer} - -Returns an Op that initializes a list of variables. - -After you launch the graph in a session, you can run the returned Op to -initialize all the variables in `var_list`. This Op runs all the -initializers of the variables in `var_list` in parallel. - -Calling `initialize_variables()` is equivalent to passing the list of -initializers to `Group()`. - -If `var_list` is empty, however, the function still returns an Op that can -be run. That Op just has no effect. - -##### Args: - - -* `var_list`: List of `Variable` objects to initialize. -* `name`: Optional name for the returned operation. - -##### Returns: - - An Op that run the initializers of all the specified variables. - - -- - - - -### `tf.is_variable_initialized(variable)` {#is_variable_initialized} - -Tests if a variable has been initialized. - -##### Args: - - -* `variable`: A `Variable`. - -##### Returns: - - Returns a scalar boolean Tensor, `True` if the variable has been - initialized, `False` otherwise. - - -- - - - -### `tf.report_uninitialized_variables(var_list=None, name='report_uninitialized_variables')` {#report_uninitialized_variables} - -Adds ops to list the names of uninitialized variables. - -When run, it returns a 1-D tensor containing the names of uninitialized -variables if there are any, or an empty array if there are none. - -##### Args: - - -* `var_list`: List of `Variable` objects to check. Defaults to the - value of `global_variables() + local_variables()` -* `name`: Optional name of the `Operation`. - -##### Returns: - - A 1-D tensor containing names of the uninitialized variables, or an empty - 1-D tensor if there are no variables or no uninitialized variables. - - -- - - - -### `tf.assert_variables_initialized(var_list=None)` {#assert_variables_initialized} - -Returns an Op to check if variables are initialized. - -NOTE: This function is obsolete and will be removed in 6 months. Please -change your implementation to use `report_uninitialized_variables()`. - -When run, the returned Op will raise the exception `FailedPreconditionError` -if any of the variables has not yet been initialized. - -Note: This function is implemented by trying to fetch the values of the -variables. If one of the variables is not initialized a message may be -logged by the C++ runtime. This is expected. - -##### Args: - - -* `var_list`: List of `Variable` objects to check. Defaults to the - value of `global_variables().` - -##### Returns: - - An Op, or None if there are no variables. - - -- - - - -### `tf.assign(ref, value, validate_shape=None, use_locking=None, name=None)` {#assign} - -Update 'ref' by assigning 'value' to it. - -This operation outputs "ref" after the assignment is done. -This makes it easier to chain operations that need to use the reset value. - -##### Args: - - -* `ref`: A mutable `Tensor`. - Should be from a `Variable` node. May be uninitialized. -* `value`: A `Tensor`. Must have the same type as `ref`. - The value to be assigned to the variable. -* `validate_shape`: An optional `bool`. Defaults to `True`. - If true, the operation will validate that the shape - of 'value' matches the shape of the Tensor being assigned to. If false, - 'ref' will take on the shape of 'value'. -* `use_locking`: An optional `bool`. Defaults to `True`. - If True, the assignment will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as "ref". Returned as a convenience for operations that want - to use the new value after the variable has been reset. - - -- - - - -### `tf.assign_add(ref, value, use_locking=None, name=None)` {#assign_add} - -Update 'ref' by adding 'value' to it. - -This operation outputs "ref" after the update is done. -This makes it easier to chain operations that need to use the reset value. - -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: - `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, - `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Should be from a `Variable` node. -* `value`: A `Tensor`. Must have the same type as `ref`. - The value to be added to the variable. -* `use_locking`: An optional `bool`. Defaults to `False`. - If True, the addition will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as "ref". Returned as a convenience for operations that want - to use the new value after the variable has been updated. - - -- - - - -### `tf.assign_sub(ref, value, use_locking=None, name=None)` {#assign_sub} - -Update 'ref' by subtracting 'value' from it. - -This operation outputs "ref" after the update is done. -This makes it easier to chain operations that need to use the reset value. - -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: - `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, - `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Should be from a `Variable` node. -* `value`: A `Tensor`. Must have the same type as `ref`. - The value to be subtracted to the variable. -* `use_locking`: An optional `bool`. Defaults to `False`. - If True, the subtraction will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as "ref". Returned as a convenience for operations that want - to use the new value after the variable has been updated. - - -- - - - -### `class tf.train.Saver` {#Saver} - -Saves and restores variables. - -See [Variables](../../how_tos/variables/index.md) -for an overview of variables, saving and restoring. - -The `Saver` class adds ops to save and restore variables to and from -*checkpoints*. It also provides convenience methods to run these ops. - -Checkpoints are binary files in a proprietary format which map variable names -to tensor values. The best way to examine the contents of a checkpoint is to -load it using a `Saver`. - -Savers can automatically number checkpoint filenames with a provided counter. -This lets you keep multiple checkpoints at different steps while training a -model. For example you can number the checkpoint filenames with the training -step number. To avoid filling up disks, savers manage checkpoint files -automatically. For example, they can keep only the N most recent files, or -one checkpoint for every N hours of training. - -You number checkpoint filenames by passing a value to the optional -`global_step` argument to `save()`: - -```python -saver.save(sess, 'my-model', global_step=0) ==> filename: 'my-model-0' -... -saver.save(sess, 'my-model', global_step=1000) ==> filename: 'my-model-1000' -``` - -Additionally, optional arguments to the `Saver()` constructor let you control -the proliferation of checkpoint files on disk: - -* `max_to_keep` indicates the maximum number of recent checkpoint files to - keep. As new files are created, older files are deleted. If None or 0, - all checkpoint files are kept. Defaults to 5 (that is, the 5 most recent - checkpoint files are kept.) - -* `keep_checkpoint_every_n_hours`: In addition to keeping the most recent - `max_to_keep` checkpoint files, you might want to keep one checkpoint file - for every N hours of training. This can be useful if you want to later - analyze how a model progressed during a long training session. For - example, passing `keep_checkpoint_every_n_hours=2` ensures that you keep - one checkpoint file for every 2 hours of training. The default value of - 10,000 hours effectively disables the feature. - -Note that you still have to call the `save()` method to save the model. -Passing these arguments to the constructor will not save variables -automatically for you. - -A training program that saves regularly looks like: - -```python -... -# Create a saver. -saver = tf.train.Saver(...variables...) -# Launch the graph and train, saving the model every 1,000 steps. -sess = tf.Session() -for step in xrange(1000000): - sess.run(..training_op..) - if step % 1000 == 0: - # Append the step number to the checkpoint name: - saver.save(sess, 'my-model', global_step=step) -``` - -In addition to checkpoint files, savers keep a protocol buffer on disk with -the list of recent checkpoints. This is used to manage numbered checkpoint -files and by `latest_checkpoint()`, which makes it easy to discover the path -to the most recent checkpoint. That protocol buffer is stored in a file named -'checkpoint' next to the checkpoint files. - -If you create several savers, you can specify a different filename for the -protocol buffer file in the call to `save()`. - -- - - - -#### `tf.train.Saver.__init__(var_list=None, reshape=False, sharded=False, max_to_keep=5, keep_checkpoint_every_n_hours=10000.0, name=None, restore_sequentially=False, saver_def=None, builder=None, defer_build=False, allow_empty=False, write_version=2, pad_step_number=False)` {#Saver.__init__} - -Creates a `Saver`. - -The constructor adds ops to save and restore variables. - -`var_list` specifies the variables that will be saved and restored. It can -be passed as a `dict` or a list: - -* A `dict` of names to variables: The keys are the names that will be - used to save or restore the variables in the checkpoint files. -* A list of variables: The variables will be keyed with their op name in - the checkpoint files. - -For example: - -```python -v1 = tf.Variable(..., name='v1') -v2 = tf.Variable(..., name='v2') - -# Pass the variables as a dict: -saver = tf.train.Saver({'v1': v1, 'v2': v2}) - -# Or pass them as a list. -saver = tf.train.Saver([v1, v2]) -# Passing a list is equivalent to passing a dict with the variable op names -# as keys: -saver = tf.train.Saver({v.op.name: v for v in [v1, v2]}) -``` - -The optional `reshape` argument, if `True`, allows restoring a variable from -a save file where the variable had a different shape, but the same number -of elements and type. This is useful if you have reshaped a variable and -want to reload it from an older checkpoint. - -The optional `sharded` argument, if `True`, instructs the saver to shard -checkpoints per device. - -##### Args: - - -* `var_list`: A list of `Variable`/`SaveableObject`, or a dictionary mapping - names to `SaveableObject`s. If `None`, defaults to the list of all - saveable objects. -* `reshape`: If `True`, allows restoring parameters from a checkpoint - where the variables have a different shape. -* `sharded`: If `True`, shard the checkpoints, one per device. -* `max_to_keep`: Maximum number of recent checkpoints to keep. - Defaults to 5. -* `keep_checkpoint_every_n_hours`: How often to keep checkpoints. - Defaults to 10,000 hours. -* `name`: String. Optional name to use as a prefix when adding operations. -* `restore_sequentially`: A `Bool`, which if true, causes restore of different - variables to happen sequentially within each device. This can lower - memory usage when restoring very large models. -* `saver_def`: Optional `SaverDef` proto to use instead of running the - builder. This is only useful for specialty code that wants to recreate - a `Saver` object for a previously built `Graph` that had a `Saver`. - The `saver_def` proto should be the one returned by the - `as_saver_def()` call of the `Saver` that was created for that `Graph`. -* `builder`: Optional `SaverBuilder` to use if a `saver_def` was not provided. - Defaults to `BaseSaverBuilder()`. -* `defer_build`: If `True`, defer adding the save and restore ops to the - `build()` call. In that case `build()` should be called before - finalizing the graph or using the saver. -* `allow_empty`: If `False` (default) raise an error if there are no - variables in the graph. Otherwise, construct the saver anyway and make - it a no-op. -* `write_version`: controls what format to use when saving checkpoints. It - also affects certain filepath matching logic. The V2 format is the - recommended choice: it is much more optimized than V1 in terms of - memory required and latency incurred during restore. Regardless of - this flag, the Saver is able to restore from both V2 and V1 checkpoints. -* `pad_step_number`: if True, pads the global step number in the checkpoint - filepaths to some fixed width (8 by default). This is turned off by - default. - -##### Raises: - - -* `TypeError`: If `var_list` is invalid. -* `ValueError`: If any of the keys or values in `var_list` are not unique. - - -- - - - -#### `tf.train.Saver.save(sess, save_path, global_step=None, latest_filename=None, meta_graph_suffix='meta', write_meta_graph=True, write_state=True)` {#Saver.save} - -Saves variables. - -This method runs the ops added by the constructor for saving variables. -It requires a session in which the graph was launched. The variables to -save must also have been initialized. - -The method returns the path of the newly created checkpoint file. This -path can be passed directly to a call to `restore()`. - -##### Args: - - -* `sess`: A Session to use to save the variables. -* `save_path`: String. Path to the checkpoint filename. If the saver is - `sharded`, this is the prefix of the sharded checkpoint filename. -* `global_step`: If provided the global step number is appended to - `save_path` to create the checkpoint filename. The optional argument - can be a `Tensor`, a `Tensor` name or an integer. -* `latest_filename`: Optional name for the protocol buffer file that will - contains the list of most recent checkpoint filenames. That file, - kept in the same directory as the checkpoint files, is automatically - managed by the saver to keep track of recent checkpoints. Defaults to - 'checkpoint'. -* `meta_graph_suffix`: Suffix for `MetaGraphDef` file. Defaults to 'meta'. -* `write_meta_graph`: `Boolean` indicating whether or not to write the meta - graph file. -* `write_state`: `Boolean` indicating whether or not to write the - `CheckpointStateProto`. - -##### Returns: - - A string: path at which the variables were saved. If the saver is - sharded, this string ends with: '-?????-of-nnnnn' where 'nnnnn' - is the number of shards created. - If the saver is empty, returns None. - -##### Raises: - - -* `TypeError`: If `sess` is not a `Session`. -* `ValueError`: If `latest_filename` contains path components, or if it - collides with `save_path`. -* `RuntimeError`: If save and restore ops weren't built. - - -- - - - -#### `tf.train.Saver.restore(sess, save_path)` {#Saver.restore} - -Restores previously saved variables. - -This method runs the ops added by the constructor for restoring variables. -It requires a session in which the graph was launched. The variables to -restore do not have to have been initialized, as restoring is itself a way -to initialize variables. - -The `save_path` argument is typically a value previously returned from a -`save()` call, or a call to `latest_checkpoint()`. - -##### Args: - - -* `sess`: A `Session` to use to restore the parameters. -* `save_path`: Path where parameters were previously saved. - - - -Other utility methods. - -- - - - -#### `tf.train.Saver.last_checkpoints` {#Saver.last_checkpoints} - -List of not-yet-deleted checkpoint filenames. - -You can pass any of the returned values to `restore()`. - -##### Returns: - - A list of checkpoint filenames, sorted from oldest to newest. - - -- - - - -#### `tf.train.Saver.set_last_checkpoints_with_time(last_checkpoints_with_time)` {#Saver.set_last_checkpoints_with_time} - -Sets the list of old checkpoint filenames and timestamps. - -##### Args: - - -* `last_checkpoints_with_time`: A list of tuples of checkpoint filenames and - timestamps. - -##### Raises: - - -* `AssertionError`: If last_checkpoints_with_time is not a list. - - -- - - - -#### `tf.train.Saver.recover_last_checkpoints(checkpoint_paths)` {#Saver.recover_last_checkpoints} - -Recovers the internal saver state after a crash. - -This method is useful for recovering the "self._last_checkpoints" state. - -Globs for the checkpoints pointed to by `checkpoint_paths`. If the files -exist, use their mtime as the checkpoint timestamp. - -##### Args: - - -* `checkpoint_paths`: a list of checkpoint paths. - - -- - - - -#### `tf.train.Saver.as_saver_def()` {#Saver.as_saver_def} - -Generates a `SaverDef` representation of this saver. - -##### Returns: - - A `SaverDef` proto. - - - -#### Other Methods -- - - - -#### `tf.train.Saver.build()` {#Saver.build} - -Builds saver_def. - - -- - - - -#### `tf.train.Saver.export_meta_graph(filename=None, collection_list=None, as_text=False, export_scope=None, clear_devices=False)` {#Saver.export_meta_graph} - -Writes `MetaGraphDef` to save_path/filename. - -##### Args: - - -* `filename`: Optional meta_graph filename including the path. -* `collection_list`: List of string keys to collect. -* `as_text`: If `True`, writes the meta_graph as an ASCII proto. -* `export_scope`: Optional `string`. Name scope to remove. -* `clear_devices`: Whether or not to clear the device field for an `Operation` - or `Tensor` during export. - -##### Returns: - - A `MetaGraphDef` proto. - - -- - - - -#### `tf.train.Saver.from_proto(saver_def, import_scope=None)` {#Saver.from_proto} - -Returns a `Saver` object created from `saver_def`. - -##### Args: - - -* `saver_def`: a `SaveDef` protocol buffer. -* `import_scope`: Optional `string`. Name scope to use. - -##### Returns: - - A `Saver` built from saver_def. - - -- - - - -#### `tf.train.Saver.set_last_checkpoints(last_checkpoints)` {#Saver.set_last_checkpoints} - -DEPRECATED: Use set_last_checkpoints_with_time. - -Sets the list of old checkpoint filenames. - -##### Args: - - -* `last_checkpoints`: A list of checkpoint filenames. - -##### Raises: - - -* `AssertionError`: If last_checkpoints is not a list. - - -- - - - -#### `tf.train.Saver.to_proto(export_scope=None)` {#Saver.to_proto} - -Converts this `Saver` to a `SaverDef` protocol buffer. - -##### Args: - - -* `export_scope`: Optional `string`. Name scope to remove. - -##### Returns: - - A `SaverDef` protocol buffer. - - - -- - - - -### `tf.train.latest_checkpoint(checkpoint_dir, latest_filename=None)` {#latest_checkpoint} - -Finds the filename of latest saved checkpoint file. - -##### Args: - - -* `checkpoint_dir`: Directory where the variables were saved. -* `latest_filename`: Optional name for the protocol buffer file that - contains the list of most recent checkpoint filenames. - See the corresponding argument to `Saver.save()`. - -##### Returns: - - The full path to the latest checkpoint or `None` if no checkpoint was found. - - -- - - - -### `tf.train.get_checkpoint_state(checkpoint_dir, latest_filename=None)` {#get_checkpoint_state} - -Returns CheckpointState proto from the "checkpoint" file. - -If the "checkpoint" file contains a valid CheckpointState -proto, returns it. - -##### Args: - - -* `checkpoint_dir`: The directory of checkpoints. -* `latest_filename`: Optional name of the checkpoint file. Default to - 'checkpoint'. - -##### Returns: - - A CheckpointState if the state was available, None - otherwise. - -##### Raises: - - -* `ValueError`: if the checkpoint read doesn't have model_checkpoint_path set. - - -- - - - -### `tf.train.update_checkpoint_state(save_dir, model_checkpoint_path, all_model_checkpoint_paths=None, latest_filename=None)` {#update_checkpoint_state} - -Updates the content of the 'checkpoint' file. - -This updates the checkpoint file containing a CheckpointState -proto. - -##### Args: - - -* `save_dir`: Directory where the model was saved. -* `model_checkpoint_path`: The checkpoint file. -* `all_model_checkpoint_paths`: List of strings. Paths to all not-yet-deleted - checkpoints, sorted from oldest to newest. If this is a non-empty list, - the last element must be equal to model_checkpoint_path. These paths - are also saved in the CheckpointState proto. -* `latest_filename`: Optional name of the checkpoint file. Default to - 'checkpoint'. - -##### Raises: - - -* `RuntimeError`: If the save paths conflict. - - -- - - - -### `tf.get_variable(name, shape=None, dtype=None, initializer=None, regularizer=None, trainable=True, collections=None, caching_device=None, partitioner=None, validate_shape=True, use_resource=None, custom_getter=None)` {#get_variable} - -Gets an existing variable with these parameters or create a new one. - -This function prefixes the name with the current variable scope -and performs reuse checks. See the -[Variable Scope How To](../../how_tos/variable_scope/index.md) -for an extensive description of how reusing works. Here is a basic example: - -```python -with tf.variable_scope("foo"): - v = tf.get_variable("v", [1]) # v.name == "foo/v:0" - w = tf.get_variable("w", [1]) # w.name == "foo/w:0" -with tf.variable_scope("foo", reuse=True): - v1 = tf.get_variable("v") # The same as v above. -``` - -If initializer is `None` (the default), the default initializer passed in -the variable scope will be used. If that one is `None` too, a -`glorot_uniform_initializer` will be used. The initializer can also be -a Tensor, in which case the variable is initialized to this value and shape. - -Similarly, if the regularizer is `None` (the default), the default regularizer -passed in the variable scope will be used (if that is `None` too, -then by default no regularization is performed). - -If a partitioner is provided, a `PartitionedVariable` is returned. -Accessing this object as a `Tensor` returns the shards concatenated along -the partition axis. - -Some useful partitioners are available. See, e.g., -`variable_axis_size_partitioner` and `min_max_variable_partitioner`. - -##### Args: - - -* `name`: The name of the new or existing variable. -* `shape`: Shape of the new or existing variable. -* `dtype`: Type of the new or existing variable (defaults to `DT_FLOAT`). -* `initializer`: Initializer for the variable if one is created. -* `regularizer`: A (Tensor -> Tensor or None) function; the result of - applying it on a newly created variable will be added to the collection - @{tf.GraphKeys.REGULARIZATION_LOSSES} and can be used for regularization. -* `trainable`: If `True` also add the variable to the graph collection - `GraphKeys.TRAINABLE_VARIABLES` (see `tf.Variable`). -* `collections`: List of graph collections keys to add the Variable to. - Defaults to `[GraphKeys.GLOBAL_VARIABLES]` (see `tf.Variable`). -* `caching_device`: Optional device string or function describing where the - Variable should be cached for reading. Defaults to the Variable's - device. If not `None`, caches on another device. Typical use is to - cache on the device where the Ops using the Variable reside, to - deduplicate copying through `Switch` and other conditional statements. -* `partitioner`: Optional callable that accepts a fully defined `TensorShape` - and `dtype` of the Variable to be created, and returns a list of - partitions for each axis (currently only one axis can be partitioned). -* `validate_shape`: If False, allows the variable to be initialized with a - value of unknown shape. If True, the default, the shape of initial_value - must be known. -* `use_resource`: If False, creates a regular Variable. If true, creates an - experimental ResourceVariable instead with well-defined semantics. - Defaults to False (will later change to True). -* `custom_getter`: Callable that takes as a first argument the true getter, and - allows overwriting the internal get_variable method. - The signature of `custom_getter` should match that of this method, - but the most future-proof version will allow for changes: - `def custom_getter(getter, *args, **kwargs)`. Direct access to - all `get_variable` parameters is also allowed: - `def custom_getter(getter, name, *args, **kwargs)`. A simple identity - custom getter that simply creates variables with modified names is: - ```python - def custom_getter(getter, name, *args, **kwargs): - return getter(name + '_suffix', *args, **kwargs) - ``` - -##### Returns: - - The created or existing `Variable` (or `PartitionedVariable`, if a - partitioner was used). - -##### Raises: - - -* `ValueError`: when creating a new variable and shape is not declared, - when violating reuse during variable creation, or when `initializer` dtype - and `dtype` don't match. Reuse is set inside `variable_scope`. - - -- - - - -### `tf.get_local_variable(*args, **kwargs)` {#get_local_variable} - -Gets an existing *local* variable or creates a new one. - -Behavior is the same as in `get_variable`, except that variables are -added to the `LOCAL_VARIABLES` collection and `trainable` is set to -`False`. -This function prefixes the name with the current variable scope -and performs reuse checks. See the -[Variable Scope How To](../../how_tos/variable_scope/index.md) -for an extensive description of how reusing works. Here is a basic example: - -```python -with tf.variable_scope("foo"): - v = tf.get_variable("v", [1]) # v.name == "foo/v:0" - w = tf.get_variable("w", [1]) # w.name == "foo/w:0" -with tf.variable_scope("foo", reuse=True): - v1 = tf.get_variable("v") # The same as v above. -``` - -If initializer is `None` (the default), the default initializer passed in -the variable scope will be used. If that one is `None` too, a -`glorot_uniform_initializer` will be used. The initializer can also be -a Tensor, in which case the variable is initialized to this value and shape. - -Similarly, if the regularizer is `None` (the default), the default regularizer -passed in the variable scope will be used (if that is `None` too, -then by default no regularization is performed). - -If a partitioner is provided, a `PartitionedVariable` is returned. -Accessing this object as a `Tensor` returns the shards concatenated along -the partition axis. - -Some useful partitioners are available. See, e.g., -`variable_axis_size_partitioner` and `min_max_variable_partitioner`. - -##### Args: - - -* `name`: The name of the new or existing variable. -* `shape`: Shape of the new or existing variable. -* `dtype`: Type of the new or existing variable (defaults to `DT_FLOAT`). -* `initializer`: Initializer for the variable if one is created. -* `regularizer`: A (Tensor -> Tensor or None) function; the result of - applying it on a newly created variable will be added to the collection - @{tf.GraphKeys.REGULARIZATION_LOSSES} and can be used for regularization. -* `collections`: List of graph collections keys to add the Variable to. - Defaults to `[GraphKeys.LOCAL_VARIABLES]` (see `tf.Variable`). -* `caching_device`: Optional device string or function describing where the - Variable should be cached for reading. Defaults to the Variable's - device. If not `None`, caches on another device. Typical use is to - cache on the device where the Ops using the Variable reside, to - deduplicate copying through `Switch` and other conditional statements. -* `partitioner`: Optional callable that accepts a fully defined `TensorShape` - and `dtype` of the Variable to be created, and returns a list of - partitions for each axis (currently only one axis can be partitioned). -* `validate_shape`: If False, allows the variable to be initialized with a - value of unknown shape. If True, the default, the shape of initial_value - must be known. -* `use_resource`: If False, creates a regular Variable. If true, creates an - experimental ResourceVariable instead with well-defined semantics. - Defaults to False (will later change to True). -* `custom_getter`: Callable that takes as a first argument the true getter, and - allows overwriting the internal get_variable method. - The signature of `custom_getter` should match that of this method, - but the most future-proof version will allow for changes: - `def custom_getter(getter, *args, **kwargs)`. Direct access to - all `get_variable` parameters is also allowed: - `def custom_getter(getter, name, *args, **kwargs)`. A simple identity - custom getter that simply creates variables with modified names is: - ```python - def custom_getter(getter, name, *args, **kwargs): - return getter(name + '_suffix', *args, **kwargs) - ``` - -##### Returns: - - The created or existing `Variable` (or `PartitionedVariable`, if a - partitioner was used). - -##### Raises: - - -* `ValueError`: when creating a new variable and shape is not declared, - when violating reuse during variable creation, or when `initializer` dtype - and `dtype` don't match. Reuse is set inside `variable_scope`. - - -- - - - -### `class tf.VariableScope` {#VariableScope} - -Variable scope object to carry defaults to provide to `get_variable`. - -Many of the arguments we need for `get_variable` in a variable store are most -easily handled with a context. This object is used for the defaults. - -Attributes: - name: name of the current scope, used as prefix in get_variable. - initializer: default initializer passed to get_variable. - regularizer: default regularizer passed to get_variable. - reuse: Boolean or None, setting the reuse in get_variable. - caching_device: string, callable, or None: the caching device passed to - get_variable. - partitioner: callable or `None`: the partitioner passed to `get_variable`. - custom_getter: default custom getter passed to get_variable. - name_scope: The name passed to `tf.name_scope`. - dtype: default type passed to get_variable (defaults to DT_FLOAT). - use_resource: if False, create a normal Variable; if True create an - experimental ResourceVariable with well-defined semantics. Defaults - to False (will later change to True). -- - - - -#### `tf.VariableScope.__init__(reuse, name='', initializer=None, regularizer=None, caching_device=None, partitioner=None, custom_getter=None, name_scope='', dtype=tf.float32, use_resource=None)` {#VariableScope.__init__} - -Creates a new VariableScope with the given properties. - - -- - - - -#### `tf.VariableScope.caching_device` {#VariableScope.caching_device} - - - - -- - - - -#### `tf.VariableScope.custom_getter` {#VariableScope.custom_getter} - - - - -- - - - -#### `tf.VariableScope.dtype` {#VariableScope.dtype} - - - - -- - - - -#### `tf.VariableScope.get_variable(var_store, name, shape=None, dtype=None, initializer=None, regularizer=None, trainable=True, collections=None, caching_device=None, partitioner=None, validate_shape=True, use_resource=None, custom_getter=None)` {#VariableScope.get_variable} - -Gets an existing variable with this name or create a new one. - - -- - - - -#### `tf.VariableScope.initializer` {#VariableScope.initializer} - - - - -- - - - -#### `tf.VariableScope.name` {#VariableScope.name} - - - - -- - - - -#### `tf.VariableScope.original_name_scope` {#VariableScope.original_name_scope} - - - - -- - - - -#### `tf.VariableScope.partitioner` {#VariableScope.partitioner} - - - - -- - - - -#### `tf.VariableScope.regularizer` {#VariableScope.regularizer} - - - - -- - - - -#### `tf.VariableScope.reuse` {#VariableScope.reuse} - - - - -- - - - -#### `tf.VariableScope.reuse_variables()` {#VariableScope.reuse_variables} - -Reuse variables in this scope. - - -- - - - -#### `tf.VariableScope.set_caching_device(caching_device)` {#VariableScope.set_caching_device} - -Set caching_device for this scope. - - -- - - - -#### `tf.VariableScope.set_custom_getter(custom_getter)` {#VariableScope.set_custom_getter} - -Set custom getter for this scope. - - -- - - - -#### `tf.VariableScope.set_dtype(dtype)` {#VariableScope.set_dtype} - -Set data type for this scope. - - -- - - - -#### `tf.VariableScope.set_initializer(initializer)` {#VariableScope.set_initializer} - -Set initializer for this scope. - - -- - - - -#### `tf.VariableScope.set_partitioner(partitioner)` {#VariableScope.set_partitioner} - -Set partitioner for this scope. - - -- - - - -#### `tf.VariableScope.set_regularizer(regularizer)` {#VariableScope.set_regularizer} - -Set regularizer for this scope. - - -- - - - -#### `tf.VariableScope.set_use_resource(use_resource)` {#VariableScope.set_use_resource} - -Sets whether to use ResourceVariables for this scope. - - -- - - - -#### `tf.VariableScope.use_resource` {#VariableScope.use_resource} - - - - - -- - - - -### `tf.variable_scope(name_or_scope, default_name=None, values=None, initializer=None, regularizer=None, caching_device=None, partitioner=None, custom_getter=None, reuse=None, dtype=None, use_resource=None)` {#variable_scope} - -Returns a context manager for defining ops that creates variables (layers). - -This context manager validates that the (optional) `values` are from -the same graph, ensures that graph is the default graph, and pushes a -name scope and a variable scope. - -If `name_or_scope` is not None, it is used as is. If `scope` is None, then -`default_name` is used. In that case, if the same name has been previously -used in the same scope, it will made unique be appending `_N` to it. - -Variable scope allows to create new variables and to share already created -ones while providing checks to not create or share by accident. For details, -see the [Variable Scope How To](../../how_tos/variable_scope/index.md), -here we present only a few basic examples. - -Simple example of how to create a new variable: - -```python -with tf.variable_scope("foo"): - with tf.variable_scope("bar"): - v = tf.get_variable("v", [1]) - assert v.name == "foo/bar/v:0" -``` - -Basic example of sharing a variable: - -```python -with tf.variable_scope("foo"): - v = tf.get_variable("v", [1]) -with tf.variable_scope("foo", reuse=True): - v1 = tf.get_variable("v", [1]) -assert v1 == v -``` - -Sharing a variable by capturing a scope and setting reuse: - -```python -with tf.variable_scope("foo") as scope: - v = tf.get_variable("v", [1]) - scope.reuse_variables() - v1 = tf.get_variable("v", [1]) -assert v1 == v -``` - -To prevent accidental sharing of variables, we raise an exception when -getting an existing variable in a non-reusing scope. - -```python -with tf.variable_scope("foo"): - v = tf.get_variable("v", [1]) - v1 = tf.get_variable("v", [1]) - # Raises ValueError("... v already exists ..."). -``` - -Similarly, we raise an exception when trying to get a variable that -does not exist in reuse mode. - -```python -with tf.variable_scope("foo", reuse=True): - v = tf.get_variable("v", [1]) - # Raises ValueError("... v does not exists ..."). -``` - -Note that the `reuse` flag is inherited: if we open a reusing scope, -then all its sub-scopes become reusing as well. - -##### Args: - - -* `name_or_scope`: `string` or `VariableScope`: the scope to open. -* `default_name`: The default name to use if the `name_or_scope` argument is - `None`, this name will be uniquified. If name_or_scope is provided it - won't be used and therefore it is not required and can be None. -* `values`: The list of `Tensor` arguments that are passed to the op function. -* `initializer`: default initializer for variables within this scope. -* `regularizer`: default regularizer for variables within this scope. -* `caching_device`: default caching device for variables within this scope. -* `partitioner`: default partitioner for variables within this scope. -* `custom_getter`: default custom getter for variables within this scope. -* `reuse`: `True` or `None`; if `True`, we go into reuse mode for this scope as - well as all sub-scopes; if `None`, we just inherit the parent scope reuse. -* `dtype`: type of variables created in this scope (defaults to the type - in the passed scope, or inherited from parent scope). -* `use_resource`: If False, all variables will be regular Variables. If True, - experimental ResourceVariables with well-defined semantics will be used - instead. Defaults to False (will later change to True). - -##### Returns: - - A scope that can be to captured and reused. - -##### Raises: - - -* `ValueError`: when trying to reuse within a create scope, or create within - a reuse scope, or if reuse is not `None` or `True`. -* `TypeError`: when the types of some arguments are not appropriate. - - -- - - - -### `tf.variable_op_scope(values, name_or_scope, default_name=None, initializer=None, regularizer=None, caching_device=None, partitioner=None, custom_getter=None, reuse=None, dtype=None, use_resource=None)` {#variable_op_scope} - -Deprecated: context manager for defining an op that creates variables. - - -- - - - -### `tf.get_variable_scope()` {#get_variable_scope} - -Returns the current variable scope. - - -- - - - -### `tf.make_template(name_, func_, create_scope_now_=False, unique_name_=None, custom_getter_=None, **kwargs)` {#make_template} - -Given an arbitrary function, wrap it so that it does variable sharing. - -This wraps `func_` in a Template and partially evaluates it. Templates are -functions that create variables the first time they are called and reuse them -thereafter. In order for `func_` to be compatible with a `Template` it must -have the following properties: - -* The function should create all trainable variables and any variables that - should be reused by calling `tf.get_variable`. If a trainable variable is - created using `tf.Variable`, then a ValueError will be thrown. Variables - that are intended to be locals can be created by specifying - `tf.Variable(..., trainable=false)`. -* The function may use variable scopes and other templates internally to - create and reuse variables, but it shouldn't use `tf.global_variables` to - capture variables that are defined outside of the scope of the function. -* Internal scopes and variable names should not depend on any arguments that - are not supplied to `make_template`. In general you will get a ValueError - telling you that you are trying to reuse a variable that doesn't exist - if you make a mistake. - -In the following example, both `z` and `w` will be scaled by the same `y`. It -is important to note that if we didn't assign `scalar_name` and used a -different name for z and w that a `ValueError` would be thrown because it -couldn't reuse the variable. - -```python -def my_op(x, scalar_name): - var1 = tf.get_variable(scalar_name, - shape=[], - initializer=tf.constant_initializer(1)) - return x * var1 - -scale_by_y = tf.make_template('scale_by_y', my_op, scalar_name='y') - -z = scale_by_y(input1) -w = scale_by_y(input2) -``` - -As a safe-guard, the returned function will raise a `ValueError` after the -first call if trainable variables are created by calling `tf.Variable`. - -If all of these are true, then 2 properties are enforced by the template: - -1. Calling the same template multiple times will share all non-local - variables. -2. Two different templates are guaranteed to be unique, unless you reenter the - same variable scope as the initial definition of a template and redefine - it. An examples of this exception: - -```python -def my_op(x, scalar_name): - var1 = tf.get_variable(scalar_name, - shape=[], - initializer=tf.constant_initializer(1)) - return x * var1 - -with tf.variable_scope('scope') as vs: - scale_by_y = tf.make_template('scale_by_y', my_op, scalar_name='y') - z = scale_by_y(input1) - w = scale_by_y(input2) - -# Creates a template that reuses the variables above. -with tf.variable_scope(vs, reuse=True): - scale_by_y2 = tf.make_template('scale_by_y', my_op, scalar_name='y') - z2 = scale_by_y2(input1) - w2 = scale_by_y2(input2) -``` - -Depending on the value of `create_scope_now_`, the full variable scope may be -captured either at the time of first call or at the time of construction. If -this option is set to True, then all Tensors created by repeated calls to the -template will have an extra trailing _N+1 to their name, as the first time the -scope is entered in the Template constructor no Tensors are created. - -Note: `name_`, `func_` and `create_scope_now_` have a trailing underscore to -reduce the likelihood of collisions with kwargs. - -##### Args: - - -* `name_`: A name for the scope created by this template. If necessary, the name - will be made unique by appending `_N` to the name. -* `func_`: The function to wrap. -* `create_scope_now_`: Boolean controlling whether the scope should be created - when the template is constructed or when the template is called. Default - is False, meaning the scope is created when the template is called. -* `unique_name_`: When used, it overrides name_ and is not made unique. If a - template of the same scope/unique_name already exists and reuse is false, - an error is raised. Defaults to None. -* `custom_getter_`: Optional custom getter for variables used in `func_`. See - the [`get_variable`](#get_variable) `custom_getter` documentation for - more information. -* `**kwargs`: Keyword arguments to apply to `func_`. - -##### Returns: - - A function to encapsulate a set of variables which should be created once - and reused. An enclosing scope will created, either where `make_template` - is called, or wherever the result is called, depending on the value of - `create_scope_now_`. Regardless of the value, the first time the template - is called it will enter the scope with no reuse, and call `func_` to create - variables, which are guaranteed to be unique. All subsequent calls will - re-enter the scope and reuse those variables. - -##### Raises: - - -* `ValueError`: if the name is None. - - -- - - - -### `tf.no_regularizer(_)` {#no_regularizer} - -Use this function to prevent regularization of variables. - - -- - - - -### `class tf.constant_initializer` {#constant_initializer} - -Initializer that generates tensors with constant values. - -The resulting tensor is populated with values of type `dtype`, as -specified by arguments `value` following the desired `shape` of the -new tensor (see examples below). - -The argument `value` can be a constant value, or a list of values of type -`dtype`. If `value` is a list, then the length of the list must be less -than or equal to the number of elements implied by the desired shape of the -tensor. In the case where the total number of elements in `value` is less -than the number of elements required by the tensor shape, the last element -in `value` will be used to fill the remaining entries. If the total number of -elements in `value` is greater than the number of elements required by the -tensor shape, the initializer will raise a `ValueError`. - -Args: - value: A Python scalar, list of values, or a N-dimensional numpy array. All - elements of the initialized variable will be set to the corresponding - value in the `value` argument. - dtype: The data type. - verify_shape: Boolean that enables verification of the shape of `value`. If - `True`, the initializer will throw an error if the shape of `value` is not - compatible with the shape of the initialized tensor. - -Examples: - The following example can be rewritten using a numpy.ndarray instead - of the `value` list, even reshaped, as shown in the two commented lines - below the `value` list initialization. - -```python - >>> import numpy as np - >>> import tensorflow as tf - - >>> value = [0, 1, 2, 3, 4, 5, 6, 7] - >>> # value = np.array(value) - >>> # value = value.reshape([2, 4]) - >>> init = tf.constant_initializer(value) - - >>> print('fitting shape:') - >>> with tf.Session(): - >>> x = tf.get_variable('x', shape=[2, 4], initializer=init) - >>> x.initializer.run() - >>> print(x.eval()) - - fitting shape: - [[ 0. 1. 2. 3.] - [ 4. 5. 6. 7.]] - - >>> print('larger shape:') - >>> with tf.Session(): - >>> x = tf.get_variable('x', shape=[3, 4], initializer=init) - >>> x.initializer.run() - >>> print(x.eval()) - - larger shape: - [[ 0. 1. 2. 3.] - [ 4. 5. 6. 7.] - [ 7. 7. 7. 7.]] - - >>> print('smaller shape:') - >>> with tf.Session(): - >>> x = tf.get_variable('x', shape=[2, 3], initializer=init) - - ValueError: Too many elements provided. Needed at most 6, but received 8 - - >>> print('shape verification:') - >>> init_verify = tf.constant_initializer(value, verify_shape=True) - >>> with tf.Session(): - >>> x = tf.get_variable('x', shape=[3, 4], initializer=init_verify) - - TypeError: Expected Tensor's shape: (3, 4), got (8,). -``` -- - - - -#### `tf.constant_initializer.__call__(shape, dtype=None, partition_info=None)` {#constant_initializer.__call__} - - - - -- - - - -#### `tf.constant_initializer.__init__(value=0, dtype=tf.float32, verify_shape=False)` {#constant_initializer.__init__} - - - - - -- - - - -### `class tf.random_normal_initializer` {#random_normal_initializer} - -Initializer that generates tensors with a normal distribution. - -Args: - mean: a python scalar or a scalar tensor. Mean of the random values - to generate. - stddev: a python scalar or a scalar tensor. Standard deviation of the - random values to generate. - seed: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - dtype: The data type. Only floating point types are supported. -- - - - -#### `tf.random_normal_initializer.__call__(shape, dtype=None, partition_info=None)` {#random_normal_initializer.__call__} - - - - -- - - - -#### `tf.random_normal_initializer.__init__(mean=0.0, stddev=1.0, seed=None, dtype=tf.float32)` {#random_normal_initializer.__init__} - - - - - -- - - - -### `class tf.truncated_normal_initializer` {#truncated_normal_initializer} - -Initializer that generates a truncated normal distribution. - -These values are similar to values from a `random_normal_initializer` -except that values more than two standard deviations from the mean -are discarded and re-drawn. This is the recommended initializer for -neural network weights and filters. - -Args: - mean: a python scalar or a scalar tensor. Mean of the random values - to generate. - stddev: a python scalar or a scalar tensor. Standard deviation of the - random values to generate. - seed: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - dtype: The data type. Only floating point types are supported. -- - - - -#### `tf.truncated_normal_initializer.__call__(shape, dtype=None, partition_info=None)` {#truncated_normal_initializer.__call__} - - - - -- - - - -#### `tf.truncated_normal_initializer.__init__(mean=0.0, stddev=1.0, seed=None, dtype=tf.float32)` {#truncated_normal_initializer.__init__} - - - - - -- - - - -### `class tf.random_uniform_initializer` {#random_uniform_initializer} - -Initializer that generates tensors with a uniform distribution. - -Args: - minval: A python scalar or a scalar tensor. Lower bound of the range - of random values to generate. - maxval: A python scalar or a scalar tensor. Upper bound of the range - of random values to generate. Defaults to 1 for float types. - seed: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - dtype: The data type. -- - - - -#### `tf.random_uniform_initializer.__call__(shape, dtype=None, partition_info=None)` {#random_uniform_initializer.__call__} - - - - -- - - - -#### `tf.random_uniform_initializer.__init__(minval=0, maxval=None, seed=None, dtype=tf.float32)` {#random_uniform_initializer.__init__} - - - - - -- - - - -### `class tf.uniform_unit_scaling_initializer` {#uniform_unit_scaling_initializer} - -Initializer that generates tensors without scaling variance. - -When initializing a deep network, it is in principle advantageous to keep -the scale of the input variance constant, so it does not explode or diminish -by reaching the final layer. If the input is `x` and the operation `x * W`, -and we want to initialize `W` uniformly at random, we need to pick `W` from - - [-sqrt(3) / sqrt(dim), sqrt(3) / sqrt(dim)] - -to keep the scale intact, where `dim = W.shape[0]` (the size of the input). -A similar calculation for convolutional networks gives an analogous result -with `dim` equal to the product of the first 3 dimensions. When -nonlinearities are present, we need to multiply this by a constant `factor`. -See [Sussillo et al., 2014](https://arxiv.org/abs/1412.6558) -([pdf](http://arxiv.org/pdf/1412.6558.pdf)) for deeper motivation, experiments -and the calculation of constants. In section 2.3 there, the constants were -numerically computed: for a linear layer it's 1.0, relu: ~1.43, tanh: ~1.15. - -Args: - factor: Float. A multiplicative factor by which the values will be scaled. - seed: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. - dtype: The data type. Only floating point types are supported. -- - - - -#### `tf.uniform_unit_scaling_initializer.__call__(shape, dtype=None, partition_info=None)` {#uniform_unit_scaling_initializer.__call__} - - - - -- - - - -#### `tf.uniform_unit_scaling_initializer.__init__(factor=1.0, seed=None, dtype=tf.float32)` {#uniform_unit_scaling_initializer.__init__} - - - - - -- - - - -### `class tf.zeros_initializer` {#zeros_initializer} - -Initializer that generates tensors initialized to 0. -- - - - -#### `tf.zeros_initializer.__call__(shape, dtype=None, partition_info=None)` {#zeros_initializer.__call__} - - - - -- - - - -#### `tf.zeros_initializer.__init__(dtype=tf.float32)` {#zeros_initializer.__init__} - - - - - -- - - - -### `class tf.ones_initializer` {#ones_initializer} - -Initializer that generates tensors initialized to 1. -- - - - -#### `tf.ones_initializer.__call__(shape, dtype=None, partition_info=None)` {#ones_initializer.__call__} - - - - -- - - - -#### `tf.ones_initializer.__init__(dtype=tf.float32)` {#ones_initializer.__init__} - - - - - -- - - - -### `class tf.orthogonal_initializer` {#orthogonal_initializer} - -Initializer that generates an orthogonal matrix. - -If the shape of the tensor to initialize is two-dimensional, i is initialized -with an orthogonal matrix obtained from the singular value decomposition of a -matrix of uniform random numbers. - -If the shape of the tensor to initialize is more than two-dimensional, -a matrix of shape `(shape[0] * ... * shape[n - 2], shape[n - 1])` -is initialized, where `n` is the length of the shape vector. -The matrix is subsequently reshaped to give a tensor of the desired shape. - -Args: - gain: multiplicative factor to apply to the orthogonal matrix - dtype: The type of the output. - seed: A Python integer. Used to create random seeds. See - [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed) - for behavior. -- - - - -#### `tf.orthogonal_initializer.__call__(shape, dtype=None, partition_info=None)` {#orthogonal_initializer.__call__} - - - - -- - - - -#### `tf.orthogonal_initializer.__init__(gain=1.0, dtype=tf.float32, seed=None)` {#orthogonal_initializer.__init__} - - - - - -- - - - -### `tf.fixed_size_partitioner(num_shards, axis=0)` {#fixed_size_partitioner} - -Partitioner to specify a fixed number of shards along given axis. - -##### Args: - - -* `num_shards`: `int`, number of shards to partition variable. -* `axis`: `int`, axis to partition on. - -##### Returns: - - A partition function usable as the `partitioner` argument to - `variable_scope`, `get_variable`, and `get_partitioned_variable_list`. - - -- - - - -### `tf.variable_axis_size_partitioner(max_shard_bytes, axis=0, bytes_per_string_element=16, max_shards=None)` {#variable_axis_size_partitioner} - -Get a partitioner for VariableScope to keep shards below `max_shard_bytes`. - -This partitioner will shard a Variable along one axis, attempting to keep -the maximum shard size below `max_shard_bytes`. In practice, this is not -always possible when sharding along only one axis. When this happens, -this axis is sharded as much as possible (i.e., every dimension becomes -a separate shard). - -If the partitioner hits the `max_shards` limit, then each shard may end up -larger than `max_shard_bytes`. By default `max_shards` equals `None` and no -limit on the number of shards is enforced. - -One reasonable value for `max_shard_bytes` is `(64 << 20) - 1`, or almost -`64MB`, to keep below the protobuf byte limit. - -##### Args: - - -* `max_shard_bytes`: The maximum size any given shard is allowed to be. -* `axis`: The axis to partition along. Default: outermost axis. -* `bytes_per_string_element`: If the `Variable` is of type string, this provides - an estimate of how large each scalar in the `Variable` is. -* `max_shards`: The maximum number of shards in int created taking precedence - over `max_shard_bytes`. - -##### Returns: - - A partition function usable as the `partitioner` argument to - `variable_scope`, `get_variable`, and `get_partitioned_variable_list`. - -##### Raises: - - -* `ValueError`: If any of the byte counts are non-positive. - - -- - - - -### `tf.min_max_variable_partitioner(max_partitions=1, axis=0, min_slice_size=262144, bytes_per_string_element=16)` {#min_max_variable_partitioner} - -Partitioner to allocate minimum size per slice. - -Returns a partitioner that partitions the variable of given shape and dtype -such that each partition has a minimum of `min_slice_size` slice of the -variable. The maximum number of such partitions (upper bound) is given by -`max_partitions`. - -##### Args: - - -* `max_partitions`: Upper bound on the number of partitions. Defaults to 1. -* `axis`: Axis along which to partition the variable. Defaults to 0. -* `min_slice_size`: Minimum size of the variable slice per partition. Defaults - to 256K. -* `bytes_per_string_element`: If the `Variable` is of type string, this provides - an estimate of how large each scalar in the `Variable` is. - -##### Returns: - - A partition function usable as the `partitioner` argument to - `variable_scope`, `get_variable`, and `get_partitioned_variable_list`. - - -- - - - -### `tf.scatter_update(ref, indices, updates, use_locking=None, name=None)` {#scatter_update} - -Applies sparse updates to a variable reference. - -This operation computes - - # Scalar indices - ref[indices, ...] = updates[...] - - # Vector indices (for each i) - ref[indices[i], ...] = updates[i, ...] - - # High rank indices (for each i, ..., j) - ref[indices[i, ..., j], ...] = updates[i, ..., j, ...] - -This operation outputs `ref` after the update is done. -This makes it easier to chain operations that need to use the reset value. - -If values in `ref` is to be updated more than once, because there are -duplicate entries in `indices`, the order at which the updates happen -for each value is undefined. - -Requires `updates.shape = indices.shape + ref.shape[1:]`. - -
- -
- -##### Args: - - -* `ref`: A mutable `Tensor`. Should be from a `Variable` node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A tensor of indices into the first dimension of `ref`. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A tensor of updated values to store in `ref`. -* `use_locking`: An optional `bool`. Defaults to `True`. - If True, the assignment will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as `ref`. Returned as a convenience for operations that want - to use the updated values after the update is done. - - -- - - - -### `tf.scatter_add(ref, indices, updates, use_locking=None, name=None)` {#scatter_add} - -Adds sparse updates to a variable reference. - -This operation computes - - # Scalar indices - ref[indices, ...] += updates[...] - - # Vector indices (for each i) - ref[indices[i], ...] += updates[i, ...] - - # High rank indices (for each i, ..., j) - ref[indices[i, ..., j], ...] += updates[i, ..., j, ...] - -This operation outputs `ref` after the update is done. -This makes it easier to chain operations that need to use the reset value. - -Duplicate entries are handled correctly: if multiple `indices` reference -the same location, their contributions add. - -Requires `updates.shape = indices.shape + ref.shape[1:]`. - -
- -
- -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Should be from a `Variable` node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A tensor of indices into the first dimension of `ref`. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A tensor of updated values to add to `ref`. -* `use_locking`: An optional `bool`. Defaults to `False`. - If True, the addition will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as `ref`. Returned as a convenience for operations that want - to use the updated values after the update is done. - - -- - - - -### `tf.scatter_sub(ref, indices, updates, use_locking=None, name=None)` {#scatter_sub} - -Subtracts sparse updates to a variable reference. - - # Scalar indices - ref[indices, ...] -= updates[...] - - # Vector indices (for each i) - ref[indices[i], ...] -= updates[i, ...] - - # High rank indices (for each i, ..., j) - ref[indices[i, ..., j], ...] -= updates[i, ..., j, ...] - -This operation outputs `ref` after the update is done. -This makes it easier to chain operations that need to use the reset value. - -Duplicate entries are handled correctly: if multiple `indices` reference -the same location, their (negated) contributions add. - -Requires `updates.shape = indices.shape + ref.shape[1:]`. - -
- -
- -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Should be from a `Variable` node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A tensor of indices into the first dimension of `ref`. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A tensor of updated values to subtract from `ref`. -* `use_locking`: An optional `bool`. Defaults to `False`. - If True, the subtraction will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as `ref`. Returned as a convenience for operations that want - to use the updated values after the update is done. - - -- - - - -### `tf.scatter_mul(ref, indices, updates, use_locking=None, name=None)` {#scatter_mul} - -Multiplies sparse updates into a variable reference. - -This operation computes - - # Scalar indices - ref[indices, ...] *= updates[...] - - # Vector indices (for each i) - ref[indices[i], ...] *= updates[i, ...] - - # High rank indices (for each i, ..., j) - ref[indices[i, ..., j], ...] *= updates[i, ..., j, ...] - -This operation outputs `ref` after the update is done. -This makes it easier to chain operations that need to use the reset value. - -Duplicate entries are handled correctly: if multiple `indices` reference -the same location, their contributions multiply. - -Requires `updates.shape = indices.shape + ref.shape[1:]`. - -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Should be from a `Variable` node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A tensor of indices into the first dimension of `ref`. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A tensor of updated values to multiply to `ref`. -* `use_locking`: An optional `bool`. Defaults to `False`. - If True, the operation will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as `ref`. Returned as a convenience for operations that want - to use the updated values after the update is done. - - -- - - - -### `tf.scatter_div(ref, indices, updates, use_locking=None, name=None)` {#scatter_div} - -Divides a variable reference by sparse updates. - -This operation computes - - # Scalar indices - ref[indices, ...] /= updates[...] - - # Vector indices (for each i) - ref[indices[i], ...] /= updates[i, ...] - - # High rank indices (for each i, ..., j) - ref[indices[i, ..., j], ...] /= updates[i, ..., j, ...] - -This operation outputs `ref` after the update is done. -This makes it easier to chain operations that need to use the reset value. - -Duplicate entries are handled correctly: if multiple `indices` reference -the same location, their contributions divide. - -Requires `updates.shape = indices.shape + ref.shape[1:]`. - -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - Should be from a `Variable` node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A tensor of indices into the first dimension of `ref`. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A tensor of values that `ref` is divided by. -* `use_locking`: An optional `bool`. Defaults to `False`. - If True, the operation will be protected by a lock; - otherwise the behavior is undefined, but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - Same as `ref`. Returned as a convenience for operations that want - to use the updated values after the update is done. - - -- - - - -### `tf.scatter_nd_update(ref, indices, updates, use_locking=None, name=None)` {#scatter_nd_update} - -Applies sparse `updates` to individual values or slices within a given - -variable according to `indices`. - -`ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. - -`indices` must be integer tensor, containing indices into `ref`. -It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. - -The innermost dimension of `indices` (with length `K`) corresponds to -indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th -dimension of `ref`. - -`updates` is `Tensor` of rank `Q-1+P-K` with shape: - -``` -[d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]]. -``` - -For example, say we want to update 4 scattered elements to a rank-1 tensor to -8 elements. In Python, that update would look like this: - - ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8]) - indices = tf.constant([[4], [3], [1] ,[7]]) - updates = tf.constant([9, 10, 11, 12]) - update = tf.scatter_nd_update(ref, indices, updates) - with tf.Session() as sess: - print sess.run(update) - -The resulting update to ref would look like this: - - [1, 11, 3, 10, 9, 6, 7, 12] - -See [tf.scatter_nd](#scatter_nd) for more details about how to make updates to -slices. - -##### Args: - - -* `ref`: A mutable `Tensor`. A mutable Tensor. Should be from a Variable node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A Tensor. Must be one of the following types: int32, int64. - A tensor of indices into ref. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A Tensor. Must have the same type as ref. A tensor of updated - values to add to ref. -* `use_locking`: An optional `bool`. Defaults to `True`. - An optional bool. Defaults to True. If True, the assignment will - be protected by a lock; otherwise the behavior is undefined, - but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - A mutable `Tensor`. Has the same type as `ref`. - Same as ref. Returned as a convenience for operations that want to - use the updated values after the update is done. - - -- - - - -### `tf.scatter_nd_add(ref, indices, updates, use_locking=None, name=None)` {#scatter_nd_add} - -Applies sparse addition between `updates` and individual values or slices - -within a given variable according to `indices`. - -`ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. - -`indices` must be integer tensor, containing indices into `ref`. -It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. - -The innermost dimension of `indices` (with length `K`) corresponds to -indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th -dimension of `ref`. - -`updates` is `Tensor` of rank `Q-1+P-K` with shape: - -``` -[d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]]. -``` - -For example, say we want to add 4 scattered elements to a rank-1 tensor to 8 -elements. In Python, that addition would look like this: - - ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8]) - indices = tf.constant([[4], [3], [1], [7]]) - updates = tf.constant([9, 10, 11, 12]) - add = tf.scatter_nd_add(ref, indices, updates) - with tf.Session() as sess: - print sess.run(add) - -The resulting update to ref would look like this: - - [1, 13, 3, 14, 14, 6, 7, 20] - -See [tf.scatter_nd](#scatter_nd) for more details about how to make updates to -slices. - -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - A mutable Tensor. Should be from a Variable node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A Tensor. Must be one of the following types: int32, int64. - A tensor of indices into ref. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A Tensor. Must have the same type as ref. A tensor of updated values - to add to ref. -* `use_locking`: An optional `bool`. Defaults to `False`. - An optional bool. Defaults to True. If True, the assignment will - be protected by a lock; otherwise the behavior is undefined, - but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - A mutable `Tensor`. Has the same type as `ref`. - Same as ref. Returned as a convenience for operations that want - to use the updated values after the update is done. - - -- - - - -### `tf.scatter_nd_sub(ref, indices, updates, use_locking=None, name=None)` {#scatter_nd_sub} - -Applies sparse subtraction between `updates` and individual values or slices - -within a given variable according to `indices`. - -`ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. - -`indices` must be integer tensor, containing indices into `ref`. -It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. - -The innermost dimension of `indices` (with length `K`) corresponds to -indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th -dimension of `ref`. - -`updates` is `Tensor` of rank `Q-1+P-K` with shape: - -``` -[d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]]. -``` - -For example, say we want to subtract 4 scattered elements from a rank-1 tensor -with 8 elements. In Python, that subtraction would look like this: - - ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8]) - indices = tf.constant([[4], [3], [1], [7]]) - updates = tf.constant([9, 10, 11, 12]) - sub = tf.scatter_nd_sub(ref, indices, updates) - with tf.Session() as sess: - print sess.run(sub) - -The resulting update to ref would look like this: - - [1, -9, 3, -6, -4, 6, 7, -4] - -See [tf.scatter_nd](#scatter_nd) for more details about how to make updates to -slices. - -##### Args: - - -* `ref`: A mutable `Tensor`. Must be one of the following types: `float32`, `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. - A mutable Tensor. Should be from a Variable node. -* `indices`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - A Tensor. Must be one of the following types: int32, int64. - A tensor of indices into ref. -* `updates`: A `Tensor`. Must have the same type as `ref`. - A Tensor. Must have the same type as ref. A tensor of updated values - to subtract from ref. -* `use_locking`: An optional `bool`. Defaults to `False`. - An optional bool. Defaults to True. If True, the assignment will - be protected by a lock; otherwise the behavior is undefined, - but may exhibit less contention. -* `name`: A name for the operation (optional). - -##### Returns: - - A mutable `Tensor`. Has the same type as `ref`. - Same as ref. Returned as a convenience for operations that want - to use the updated values after the update is done. - - -- - - - -### `tf.sparse_mask(a, mask_indices, name=None)` {#sparse_mask} - -Masks elements of `IndexedSlices`. - -Given an `IndexedSlices` instance `a`, returns another `IndexedSlices` that -contains a subset of the slices of `a`. Only the slices at indices not -specified in `mask_indices` are returned. - -This is useful when you need to extract a subset of slices in an -`IndexedSlices` object. - -For example: - -```python -# `a` contains slices at indices [12, 26, 37, 45] from a large tensor -# with shape [1000, 10] -a.indices => [12, 26, 37, 45] -tf.shape(a.values) => [4, 10] - -# `b` will be the subset of `a` slices at its second and third indices, so -# we want to mask its first and last indices (which are at absolute -# indices 12, 45) -b = tf.sparse_mask(a, [12, 45]) - -b.indices => [26, 37] -tf.shape(b.values) => [2, 10] - -``` - -##### Args: - - -* `a`: An `IndexedSlices` instance. -* `mask_indices`: Indices of elements to mask. -* `name`: A name for the operation (optional). - -##### Returns: - - The masked `IndexedSlices` instance. - - -- - - - -### `class tf.IndexedSlices` {#IndexedSlices} - -A sparse representation of a set of tensor slices at given indices. - -This class is a simple wrapper for a pair of `Tensor` objects: - -* `values`: A `Tensor` of any dtype with shape `[D0, D1, ..., Dn]`. -* `indices`: A 1-D integer `Tensor` with shape `[D0]`. - -An `IndexedSlices` is typically used to represent a subset of a larger -tensor `dense` of shape `[LARGE0, D1, .. , DN]` where `LARGE0 >> D0`. -The values in `indices` are the indices in the first dimension of -the slices that have been extracted from the larger tensor. - -The dense tensor `dense` represented by an `IndexedSlices` `slices` has - -```python -dense[slices.indices[i], :, :, :, ...] = slices.values[i, :, :, :, ...] -``` - -The `IndexedSlices` class is used principally in the definition of -gradients for operations that have sparse gradients -(e.g. [`tf.gather`](../../api_docs/python/array_ops.md#gather)). - -Contrast this representation with -[`SparseTensor`](../../api_docs/python/sparse_ops.md#SparseTensor), -which uses multi-dimensional indices and scalar values. -- - - - -#### `tf.IndexedSlices.__init__(values, indices, dense_shape=None)` {#IndexedSlices.__init__} - -Creates an `IndexedSlices`. - - -- - - - -#### `tf.IndexedSlices.__neg__()` {#IndexedSlices.__neg__} - - - - -- - - - -#### `tf.IndexedSlices.__str__()` {#IndexedSlices.__str__} - - - - -- - - - -#### `tf.IndexedSlices.dense_shape` {#IndexedSlices.dense_shape} - -A 1-D `Tensor` containing the shape of the corresponding dense tensor. - - -- - - - -#### `tf.IndexedSlices.device` {#IndexedSlices.device} - -The name of the device on which `values` will be produced, or `None`. - - -- - - - -#### `tf.IndexedSlices.dtype` {#IndexedSlices.dtype} - -The `DType` of elements in this tensor. - - -- - - - -#### `tf.IndexedSlices.graph` {#IndexedSlices.graph} - -The `Graph` that contains the values, indices, and shape tensors. - - -- - - - -#### `tf.IndexedSlices.indices` {#IndexedSlices.indices} - -A 1-D `Tensor` containing the indices of the slices. - - -- - - - -#### `tf.IndexedSlices.name` {#IndexedSlices.name} - -The name of this `IndexedSlices`. - - -- - - - -#### `tf.IndexedSlices.op` {#IndexedSlices.op} - -The `Operation` that produces `values` as an output. - - -- - - - -#### `tf.IndexedSlices.values` {#IndexedSlices.values} - -A `Tensor` containing the values of the slices. - - - -- - - - -### `tf.initialize_all_tables(*args, **kwargs)` {#initialize_all_tables} - -Returns an Op that initializes all tables of the default graph. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-02. -Instructions for updating: -Use `tf.tables_initializer` instead. - -##### Args: - - -* `name`: Optional name for the initialization op. - -##### Returns: - - An Op that initializes all tables. Note that if there are - not tables the returned Op is a NoOp. - - -- - - - -### `tf.tables_initializer(name='init_all_tables')` {#tables_initializer} - -Returns an Op that initializes all tables of the default graph. - -##### Args: - - -* `name`: Optional name for the initialization op. - -##### Returns: - - An Op that initializes all tables. Note that if there are - not tables the returned Op is a NoOp. - - -- - - - -### `tf.train.export_meta_graph(filename=None, meta_info_def=None, graph_def=None, saver_def=None, collection_list=None, as_text=False, graph=None, export_scope=None, clear_devices=False, **kwargs)` {#export_meta_graph} - -Returns `MetaGraphDef` proto. Optionally writes it to filename. - -This function exports the graph, saver, and collection objects into -`MetaGraphDef` protocol buffer with the intention of it being imported -at a later time or location to restart training, run inference, or be -a subgraph. - -##### Args: - - -* `filename`: Optional filename including the path for writing the - generated `MetaGraphDef` protocol buffer. -* `meta_info_def`: `MetaInfoDef` protocol buffer. -* `graph_def`: `GraphDef` protocol buffer. -* `saver_def`: `SaverDef` protocol buffer. -* `collection_list`: List of string keys to collect. -* `as_text`: If `True`, writes the `MetaGraphDef` as an ASCII proto. -* `graph`: The `Graph` to import into. If `None`, use the default graph. -* `export_scope`: Optional `string`. Name scope under which to extract - the subgraph. The scope name will be striped from the node definitions - for easy import later into new name scopes. If `None`, the whole graph - is exported. graph_def and export_scope cannot both be specified. -* `clear_devices`: Whether or not to clear the device field for an `Operation` - or `Tensor` during export. -* `**kwargs`: Optional keyed arguments. - -##### Returns: - - A `MetaGraphDef` proto. - -##### Raises: - - -* `ValueError`: When the `GraphDef` is larger than 2GB. - - -- - - - -### `tf.train.import_meta_graph(meta_graph_or_file, clear_devices=False, import_scope=None, **kwargs)` {#import_meta_graph} - -Recreates a Graph saved in a `MetaGraphDef` proto. - -This function takes a `MetaGraphDef` protocol buffer as input. If -the argument is a file containing a `MetaGraphDef` protocol buffer , -it constructs a protocol buffer from the file content. The function -then adds all the nodes from the `graph_def` field to the -current graph, recreates all the collections, and returns a saver -constructed from the `saver_def` field. - -In combination with `export_meta_graph()`, this function can be used to - -* Serialize a graph along with other Python objects such as `QueueRunner`, - `Variable` into a `MetaGraphDef`. - -* Restart training from a saved graph and checkpoints. - -* Run inference from a saved graph and checkpoints. - -```Python -... -# Create a saver. -saver = tf.train.Saver(...variables...) -# Remember the training_op we want to run by adding it to a collection. -tf.add_to_collection('train_op', train_op) -sess = tf.Session() -for step in xrange(1000000): - sess.run(train_op) - if step % 1000 == 0: - # Saves checkpoint, which by default also exports a meta_graph - # named 'my-model-global_step.meta'. - saver.save(sess, 'my-model', global_step=step) -``` - -Later we can continue training from this saved `meta_graph` without building -the model from scratch. - -```Python -with tf.Session() as sess: - new_saver = tf.train.import_meta_graph('my-save-dir/my-model-10000.meta') - new_saver.restore(sess, 'my-save-dir/my-model-10000') - # tf.get_collection() returns a list. In this example we only want the - # first one. - train_op = tf.get_collection('train_op')[0] - for step in xrange(1000000): - sess.run(train_op) -``` - -NOTE: Restarting training from saved `meta_graph` only works if the -device assignments have not changed. - -##### Args: - - -* `meta_graph_or_file`: `MetaGraphDef` protocol buffer or filename (including - the path) containing a `MetaGraphDef`. -* `clear_devices`: Whether or not to clear the device field for an `Operation` - or `Tensor` during import. -* `import_scope`: Optional `string`. Name scope to add. Only used when - initializing from protocol buffer. -* `**kwargs`: Optional keyed arguments. - -##### Returns: - - A saver constructed from `saver_def` in `MetaGraphDef` or None. - - A None value is returned if no variables exist in the `MetaGraphDef` - (i.e., there are no variables to restore). - - -- - - - -### `tf.all_variables(*args, **kwargs)` {#all_variables} - -See `tf.global_variables`. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-02. -Instructions for updating: -Please use tf.global_variables instead. - - -- - - - -### `tf.initialize_all_variables(*args, **kwargs)` {#initialize_all_variables} - -See `tf.global_variables_initializer`. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-02. -Instructions for updating: -Use `tf.global_variables_initializer` instead. - - -- - - - -### `tf.initialize_local_variables(*args, **kwargs)` {#initialize_local_variables} - -See `tf.local_variables_initializer`. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-02. -Instructions for updating: -Use `tf.local_variables_initializer` instead. - - -- - - - -### `tf.initialize_variables(*args, **kwargs)` {#initialize_variables} - -See `tf.variables_initializer`. (deprecated) - -THIS FUNCTION IS DEPRECATED. It will be removed after 2017-03-02. -Instructions for updating: -Use `tf.variables_initializer` instead. - - diff --git a/tensorflow/g3doc/api_docs/python/string_ops.md b/tensorflow/g3doc/api_docs/python/string_ops.md deleted file mode 100644 index ad170934a3..0000000000 --- a/tensorflow/g3doc/api_docs/python/string_ops.md +++ /dev/null @@ -1,392 +0,0 @@ - - -# Strings - -Note: Functions taking `Tensor` arguments can also take anything accepted by -[`tf.convert_to_tensor`](framework.md#convert_to_tensor). - -[TOC] - -Operations for working with string Tensors. - -See the @{$python/string_ops} guide. - -- - - - -### `tf.string_to_hash_bucket_fast(input, num_buckets, name=None)` {#string_to_hash_bucket_fast} - -Converts each string in the input Tensor to its hash mod by a number of buckets. - -The hash function is deterministic on the content of the string within the -process and will never change. However, it is not suitable for cryptography. -This function may be used when CPU time is scarce and inputs are trusted or -unimportant. There is a risk of adversaries constructing inputs that all hash -to the same bucket. To prevent this problem, use a strong hash function with -`tf.string_to_hash_bucket_strong`. - -##### Args: - - -* `input`: A `Tensor` of type `string`. The strings to assign a hash bucket. -* `num_buckets`: An `int` that is `>= 1`. The number of buckets. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `int64`. - A Tensor of the same shape as the input `string_tensor`. - - -- - - - -### `tf.string_to_hash_bucket_strong(input, num_buckets, key, name=None)` {#string_to_hash_bucket_strong} - -Converts each string in the input Tensor to its hash mod by a number of buckets. - -The hash function is deterministic on the content of the string within the -process. The hash function is a keyed hash function, where attribute `key` -defines the key of the hash function. `key` is an array of 2 elements. - -A strong hash is important when inputs may be malicious, e.g. URLs with -additional components. Adversaries could try to make their inputs hash to the -same bucket for a denial-of-service attack or to skew the results. A strong -hash prevents this by making it dificult, if not infeasible, to compute inputs -that hash to the same bucket. This comes at a cost of roughly 4x higher compute -time than `tf.string_to_hash_bucket_fast`. - -##### Args: - - -* `input`: A `Tensor` of type `string`. The strings to assign a hash bucket. -* `num_buckets`: An `int` that is `>= 1`. The number of buckets. -* `key`: A list of `ints`. - The key for the keyed hash function passed as a list of two uint64 - elements. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `int64`. - A Tensor of the same shape as the input `string_tensor`. - - -- - - - -### `tf.string_to_hash_bucket(string_tensor, num_buckets, name=None)` {#string_to_hash_bucket} - -Converts each string in the input Tensor to its hash mod by a number of buckets. - -The hash function is deterministic on the content of the string within the -process. - -Note that the hash function may change from time to time. -This functionality will be deprecated and it's recommended to use -`tf.string_to_hash_bucket_fast()` or `tf.string_to_hash_bucket_strong()`. - -##### Args: - - -* `string_tensor`: A `Tensor` of type `string`. -* `num_buckets`: An `int` that is `>= 1`. The number of buckets. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `int64`. - A Tensor of the same shape as the input `string_tensor`. - - -- - - - -### `tf.reduce_join(inputs, axis=None, keep_dims=False, separator='', name=None, reduction_indices=None)` {#reduce_join} - -Joins a string Tensor across the given dimensions. - -Computes the string join across dimensions in the given string Tensor of shape -`[d_0, d_1, ..., d_n-1]`. Returns a new Tensor created by joining the input -strings with the given separator (default: empty string). Negative indices are -counted backwards from the end, with `-1` being equivalent to `n - 1`. - -For example: - -``` -# tensor `a` is [["a", "b"], ["c", "d"]] -tf.reduce_join(a, 0) ==> ["ac", "bd"] -tf.reduce_join(a, 1) ==> ["ab", "cd"] -tf.reduce_join(a, -2) = tf.reduce_join(a, 0) ==> ["ac", "bd"] -tf.reduce_join(a, -1) = tf.reduce_join(a, 1) ==> ["ab", "cd"] -tf.reduce_join(a, 0, keep_dims=True) ==> [["ac", "bd"]] -tf.reduce_join(a, 1, keep_dims=True) ==> [["ab"], ["cd"]] -tf.reduce_join(a, 0, separator=".") ==> ["a.c", "b.d"] -tf.reduce_join(a, [0, 1]) ==> ["acbd"] -tf.reduce_join(a, [1, 0]) ==> ["abcd"] -tf.reduce_join(a, []) ==> ["abcd"] -``` - -##### Args: - - -* `inputs`: A `Tensor` of type `string`. - The input to be joined. All reduced indices must have non-zero size. -* `axis`: A `Tensor` of type `int32`. - The dimensions to reduce over. Dimensions are reduced in the - order specified. Omitting `axis` is equivalent to passing - `[n-1, n-2, ..., 0]`. Negative indices from `-n` to `-1` are supported. -* `keep_dims`: An optional `bool`. Defaults to `False`. - If `True`, retain reduced dimensions with length `1`. -* `separator`: An optional `string`. Defaults to `""`. - The separator to use when joining. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. - Has shape equal to that of the input with reduced dimensions removed or - set to `1` depending on `keep_dims`. - - -- - - - -### `tf.string_join(inputs, separator=None, name=None)` {#string_join} - -Joins the strings in the given list of string tensors into one tensor; - -with the given separator (default is an empty separator). - -##### Args: - - -* `inputs`: A list of at least 1 `Tensor` objects of type `string`. - A list of string tensors. The tensors must all have the same shape, - or be scalars. Scalars may be mixed in; these will be broadcast to the shape - of non-scalar inputs. -* `separator`: An optional `string`. Defaults to `""`. - string, an optional join separator. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. - - -- - - - -### `tf.string_split(source, delimiter=' ')` {#string_split} - -Split elements of `source` based on `delimiter` into a `SparseTensor`. - -Let N be the size of source (typically N will be the batch size). Split each -element of `source` based on `delimiter` and return a `SparseTensor` -containing the splitted tokens. Empty tokens are ignored. - -If `delimiter` is an empty string, each element of the `source` is split -into individual strings, each containing one byte. (This includes splitting -multibyte sequences of UTF-8.) If delimiter contains multiple bytes, it is -treated as a set of delimiters with each considered a potential split point. - -For example: -N = 2, source[0] is 'hello world' and source[1] is 'a b c', then the output -will be - -st.indices = [0, 0; - 0, 1; - 1, 0; - 1, 1; - 1, 2] -st.shape = [2, 3] -st.values = ['hello', 'world', 'a', 'b', 'c'] - -##### Args: - - -* `source`: `1-D` string `Tensor`, the strings to split. -* `delimiter`: `0-D` string `Tensor`, the delimiter character, the string should - be length 0 or 1. - -##### Raises: - - -* `ValueError`: If delimiter is not a string. - -##### Returns: - - A `SparseTensor` of rank `2`, the strings split according to the delimiter. - The first column of the indices corresponds to the row in `source` and the - second column corresponds to the index of the split component in this row. - - -- - - - -### `tf.substr(input, pos, len, name=None)` {#substr} - -Return substrings from `Tensor` of strings. - -For each string in the input `Tensor`, creates a substring starting at index -`pos` with a total length of `len`. - -If `len` defines a substring that would extend beyond the length of the input -string, then as many characters as possible are used. - -If `pos` is negative or specifies a character index larger than any of the input -strings, then an `InvalidArgumentError` is thrown. - -`pos` and `len` must have the same shape, otherwise a `ValueError` is thrown on -Op creation. - -*NOTE*: `Substr` supports broadcasting up to two dimensions. More about -broadcasting -[here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) - ---- - -Examples - -Using scalar `pos` and `len`: - -``` -input = [b'Hello', b'World'] -position = 1 -length = 3 - -output = [b'ell', b'orl'] -``` - -Using `pos` and `len` with same shape as `input`: - -``` -input = [[b'ten', b'eleven', b'twelve'], - [b'thirteen', b'fourteen', b'fifteen'], - [b'sixteen', b'seventeen', b'eighteen']] -position = [[1, 2, 3], - [1, 2, 3], - [1, 2, 3]] -length = [[2, 3, 4], - [4, 3, 2], - [5, 5, 5]] - -output = [[b'en', b'eve', b'lve'], - [b'hirt', b'urt', b'te'], - [b'ixtee', b'vente', b'hteen']] -``` - -Broadcasting `pos` and `len` onto `input`: - -``` -input = [[b'ten', b'eleven', b'twelve'], - [b'thirteen', b'fourteen', b'fifteen'], - [b'sixteen', b'seventeen', b'eighteen'], - [b'nineteen', b'twenty', b'twentyone']] -position = [1, 2, 3] -length = [1, 2, 3] - -output = [[b'e', b'ev', b'lve'], - [b'h', b'ur', b'tee'], - [b'i', b've', b'hte'], - [b'i', b'en', b'nty']] -``` - -Broadcasting `input` onto `pos` and `len`: - -``` -input = b'thirteen' -position = [1, 5, 7] -length = [3, 2, 1] - -output = [b'hir', b'ee', b'n"] -``` - -##### Args: - - -* `input`: A `Tensor` of type `string`. Tensor of strings -* `pos`: A `Tensor`. Must be one of the following types: `int32`, `int64`. - Scalar defining the position of first character in each substring -* `len`: A `Tensor`. Must have the same type as `pos`. - Scalar defining the number of characters to include in each substring -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. Tensor of substrings - - -- - - - -### `tf.as_string(input, precision=None, scientific=None, shortest=None, width=None, fill=None, name=None)` {#as_string} - -Converts each entry in the given tensor to strings. Supports many numeric - -types and boolean. - -##### Args: - - -* `input`: A `Tensor`. Must be one of the following types: `int32`, `int64`, `complex64`, `float32`, `float64`, `bool`, `int8`. -* `precision`: An optional `int`. Defaults to `-1`. - The post-decimal precision to use for floating point numbers. - Only used if precision > -1. -* `scientific`: An optional `bool`. Defaults to `False`. - Use scientific notation for floating point numbers. -* `shortest`: An optional `bool`. Defaults to `False`. - Use shortest representation (either scientific or standard) for - floating point numbers. -* `width`: An optional `int`. Defaults to `-1`. - Pad pre-decimal numbers to this width. - Applies to both floating point and integer numbers. - Only used if width > -1. -* `fill`: An optional `string`. Defaults to `""`. - The value to pad if width > -1. If empty, pads with spaces. - Another typical value is '0'. String cannot be longer than 1 character. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. - - -- - - - -### `tf.encode_base64(input, pad=None, name=None)` {#encode_base64} - -Encode strings into web-safe base64 format. - -Refer to the following article for more information on base64 format: -en.wikipedia.org/wiki/Base64. Base64 strings may have padding with '=' at the -end so that the encoded has length multiple of 4. See Padding section of the -link above. - -Web-safe means that the encoder uses - and _ instead of + and /. - -##### Args: - - -* `input`: A `Tensor` of type `string`. Strings to be encoded. -* `pad`: An optional `bool`. Defaults to `False`. - Bool whether padding is applied at the ends. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. Input strings encoded in base64. - - -- - - - -### `tf.decode_base64(input, name=None)` {#decode_base64} - -Decode web-safe base64-encoded strings. - -Input may or may not have padding at the end. See EncodeBase64 for padding. -Web-safe means that input must use - and _ instead of + and /. - -##### Args: - - -* `input`: A `Tensor` of type `string`. Base64 strings to decode. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor` of type `string`. Decoded strings. - - diff --git a/tensorflow/g3doc/api_docs/python/summary.md b/tensorflow/g3doc/api_docs/python/summary.md deleted file mode 100644 index e7b3fe3511..0000000000 --- a/tensorflow/g3doc/api_docs/python/summary.md +++ /dev/null @@ -1,1004 +0,0 @@ - - -# Summary Operations -[TOC] - -Tensor summaries for exporting information about a model. - -See the @{$python/summary} guide. - -- - - - -### `class tf.summary.FileWriter` {#FileWriter} - -Writes `Summary` protocol buffers to event files. - -The `FileWriter` class provides a mechanism to create an event file in a -given directory and add summaries and events to it. The class updates the -file contents asynchronously. This allows a training program to call methods -to add data to the file directly from the training loop, without slowing down -training. -- - - - -#### `tf.summary.FileWriter.__init__(logdir, graph=None, max_queue=10, flush_secs=120, graph_def=None)` {#FileWriter.__init__} - -Creates a `FileWriter` and an event file. - -On construction the summary writer creates a new event file in `logdir`. -This event file will contain `Event` protocol buffers constructed when you -call one of the following functions: `add_summary()`, `add_session_log()`, -`add_event()`, or `add_graph()`. - -If you pass a `Graph` to the constructor it is added to -the event file. (This is equivalent to calling `add_graph()` later). - -TensorBoard will pick the graph from the file and display it graphically so -you can interactively explore the graph you built. You will usually pass -the graph from the session in which you launched it: - -```python -...create a graph... -# Launch the graph in a session. -sess = tf.Session() -# Create a summary writer, add the 'graph' to the event file. -writer = tf.summary.FileWriter(, sess.graph) -``` - -The other arguments to the constructor control the asynchronous writes to -the event file: - -* `flush_secs`: How often, in seconds, to flush the added summaries - and events to disk. -* `max_queue`: Maximum number of summaries or events pending to be - written to disk before one of the 'add' calls block. - -##### Args: - - -* `logdir`: A string. Directory where event file will be written. -* `graph`: A `Graph` object, such as `sess.graph`. -* `max_queue`: Integer. Size of the queue for pending events and summaries. -* `flush_secs`: Number. How often, in seconds, to flush the - pending events and summaries to disk. -* `graph_def`: DEPRECATED: Use the `graph` argument instead. - - -- - - - -#### `tf.summary.FileWriter.add_event(event)` {#FileWriter.add_event} - -Adds an event to the event file. - -##### Args: - - -* `event`: An `Event` protocol buffer. - - -- - - - -#### `tf.summary.FileWriter.add_graph(graph, global_step=None, graph_def=None)` {#FileWriter.add_graph} - -Adds a `Graph` to the event file. - -The graph described by the protocol buffer will be displayed by -TensorBoard. Most users pass a graph in the constructor instead. - -##### Args: - - -* `graph`: A `Graph` object, such as `sess.graph`. -* `global_step`: Number. Optional global step counter to record with the - graph. -* `graph_def`: DEPRECATED. Use the `graph` parameter instead. - -##### Raises: - - -* `ValueError`: If both graph and graph_def are passed to the method. - - -- - - - -#### `tf.summary.FileWriter.add_meta_graph(meta_graph_def, global_step=None)` {#FileWriter.add_meta_graph} - -Adds a `MetaGraphDef` to the event file. - -The `MetaGraphDef` allows running the given graph via -`saver.import_meta_graph()`. - -##### Args: - - -* `meta_graph_def`: A `MetaGraphDef` object, often as retured by - `saver.export_meta_graph()`. -* `global_step`: Number. Optional global step counter to record with the - graph. - -##### Raises: - - -* `TypeError`: If both `meta_graph_def` is not an instance of `MetaGraphDef`. - - -- - - - -#### `tf.summary.FileWriter.add_run_metadata(run_metadata, tag, global_step=None)` {#FileWriter.add_run_metadata} - -Adds a metadata information for a single session.run() call. - -##### Args: - - -* `run_metadata`: A `RunMetadata` protobuf object. -* `tag`: The tag name for this metadata. -* `global_step`: Number. Optional global step counter to record with the - StepStats. - -##### Raises: - - -* `ValueError`: If the provided tag was already used for this type of event. - - -- - - - -#### `tf.summary.FileWriter.add_session_log(session_log, global_step=None)` {#FileWriter.add_session_log} - -Adds a `SessionLog` protocol buffer to the event file. - -This method wraps the provided session in an `Event` protocol buffer -and adds it to the event file. - -##### Args: - - -* `session_log`: A `SessionLog` protocol buffer. -* `global_step`: Number. Optional global step value to record with the - summary. - - -- - - - -#### `tf.summary.FileWriter.add_summary(summary, global_step=None)` {#FileWriter.add_summary} - -Adds a `Summary` protocol buffer to the event file. - -This method wraps the provided summary in an `Event` protocol buffer -and adds it to the event file. - -You can pass the result of evaluating any summary op, using -[`Session.run()`](client.md#Session.run) or -[`Tensor.eval()`](framework.md#Tensor.eval), to this -function. Alternatively, you can pass a `tf.Summary` protocol -buffer that you populate with your own data. The latter is -commonly done to report evaluation results in event files. - -##### Args: - - -* `summary`: A `Summary` protocol buffer, optionally serialized as a string. -* `global_step`: Number. Optional global step value to record with the - summary. - - -- - - - -#### `tf.summary.FileWriter.close()` {#FileWriter.close} - -Flushes the event file to disk and close the file. - -Call this method when you do not need the summary writer anymore. - - -- - - - -#### `tf.summary.FileWriter.flush()` {#FileWriter.flush} - -Flushes the event file to disk. - -Call this method to make sure that all pending events have been written to -disk. - - -- - - - -#### `tf.summary.FileWriter.get_logdir()` {#FileWriter.get_logdir} - -Returns the directory where event file will be written. - - -- - - - -#### `tf.summary.FileWriter.reopen()` {#FileWriter.reopen} - -Reopens the EventFileWriter. - -Can be called after `close()` to add more events in the same directory. -The events will go into a new events file. - -Does nothing if the EventFileWriter was not closed. - - - -- - - - -### `class tf.summary.FileWriterCache` {#FileWriterCache} - -Cache for file writers. - -This class caches file writers, one per directory. -- - - - -#### `tf.summary.FileWriterCache.clear()` {#FileWriterCache.clear} - -Clear cached summary writers. Currently only used for unit tests. - - -- - - - -#### `tf.summary.FileWriterCache.get(logdir)` {#FileWriterCache.get} - -Returns the FileWriter for the specified directory. - -##### Args: - - -* `logdir`: str, name of the directory. - -##### Returns: - - A `FileWriter`. - - - -- - - - -### `tf.summary.tensor_summary(name, tensor, summary_description=None, collections=None)` {#tensor_summary} - -Outputs a `Summary` protocol buffer with a serialized tensor.proto. - -The generated -[`Summary`](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto) -has one summary value containing the input tensor. - -##### Args: - - -* `name`: A name for the generated node. Will also serve as the series name in - TensorBoard. -* `tensor`: A tensor of any type and shape to serialize. -* `summary_description`: Optional summary_pb2.SummaryDescription() -* `collections`: Optional list of graph collections keys. The new summary op is - added to these collections. Defaults to `[GraphKeys.SUMMARIES]`. - -##### Returns: - - A scalar `Tensor` of type `string`. The serialized `Summary` protocol - buffer. - - -- - - - -### `tf.summary.scalar(name, tensor, collections=None)` {#scalar} - -Outputs a `Summary` protocol buffer containing a single scalar value. - -The generated Summary has a Tensor.proto containing the input Tensor. - -##### Args: - - -* `name`: A name for the generated node. Will also serve as the series name in - TensorBoard. -* `tensor`: A real numeric Tensor containing a single value. -* `collections`: Optional list of graph collections keys. The new summary op is - added to these collections. Defaults to `[GraphKeys.SUMMARIES]`. - -##### Returns: - - A scalar `Tensor` of type `string`. Which contains a `Summary` protobuf. - -##### Raises: - - -* `ValueError`: If tensor has the wrong shape or type. - - -- - - - -### `tf.summary.histogram(name, values, collections=None)` {#histogram} - -Outputs a `Summary` protocol buffer with a histogram. - -The generated -[`Summary`](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto) -has one summary value containing a histogram for `values`. - -This op reports an `InvalidArgument` error if any value is not finite. - -##### Args: - - -* `name`: A name for the generated node. Will also serve as a series name in - TensorBoard. -* `values`: A real numeric `Tensor`. Any shape. Values to use to - build the histogram. -* `collections`: Optional list of graph collections keys. The new summary op is - added to these collections. Defaults to `[GraphKeys.SUMMARIES]`. - -##### Returns: - - A scalar `Tensor` of type `string`. The serialized `Summary` protocol - buffer. - - -- - - - -### `tf.summary.audio(name, tensor, sample_rate, max_outputs=3, collections=None)` {#audio} - -Outputs a `Summary` protocol buffer with audio. - -The summary has up to `max_outputs` summary values containing audio. The -audio is built from `tensor` which must be 3-D with shape `[batch_size, -frames, channels]` or 2-D with shape `[batch_size, frames]`. The values are -assumed to be in the range of `[-1.0, 1.0]` with a sample rate of -`sample_rate`. - -The `tag` in the outputted Summary.Value protobufs is generated based on the -name, with a suffix depending on the max_outputs setting: - -* If `max_outputs` is 1, the summary value tag is '*name*/audio'. -* If `max_outputs` is greater than 1, the summary value tags are - generated sequentially as '*name*/audio/0', '*name*/audio/1', etc - -##### Args: - - -* `name`: A name for the generated node. Will also serve as a series name in - TensorBoard. -* `tensor`: A 3-D `float32` `Tensor` of shape `[batch_size, frames, channels]` - or a 2-D `float32` `Tensor` of shape `[batch_size, frames]`. -* `sample_rate`: A Scalar `float32` `Tensor` indicating the sample rate of the - signal in hertz. -* `max_outputs`: Max number of batch elements to generate audio for. -* `collections`: Optional list of ops.GraphKeys. The collections to add the - summary to. Defaults to [_ops.GraphKeys.SUMMARIES] - -##### Returns: - - A scalar `Tensor` of type `string`. The serialized `Summary` protocol - buffer. - - -- - - - -### `tf.summary.image(name, tensor, max_outputs=3, collections=None)` {#image} - -Outputs a `Summary` protocol buffer with images. - -The summary has up to `max_outputs` summary values containing images. The -images are built from `tensor` which must be 4-D with shape `[batch_size, -height, width, channels]` and where `channels` can be: - -* 1: `tensor` is interpreted as Grayscale. -* 3: `tensor` is interpreted as RGB. -* 4: `tensor` is interpreted as RGBA. - -The images have the same number of channels as the input tensor. For float -input, the values are normalized one image at a time to fit in the range -`[0, 255]`. `uint8` values are unchanged. The op uses two different -normalization algorithms: - -* If the input values are all positive, they are rescaled so the largest one - is 255. - -* If any input value is negative, the values are shifted so input value 0.0 - is at 127. They are then rescaled so that either the smallest value is 0, - or the largest one is 255. - -The `tag` in the outputted Summary.Value protobufs is generated based on the -name, with a suffix depending on the max_outputs setting: - -* If `max_outputs` is 1, the summary value tag is '*name*/image'. -* If `max_outputs` is greater than 1, the summary value tags are - generated sequentially as '*name*/image/0', '*name*/image/1', etc. - -##### Args: - - -* `name`: A name for the generated node. Will also serve as a series name in - TensorBoard. -* `tensor`: A 4-D `uint8` or `float32` `Tensor` of shape `[batch_size, height, - width, channels]` where `channels` is 1, 3, or 4. -* `max_outputs`: Max number of batch elements to generate images for. -* `collections`: Optional list of ops.GraphKeys. The collections to add the - summary to. Defaults to [_ops.GraphKeys.SUMMARIES] - -##### Returns: - - A scalar `Tensor` of type `string`. The serialized `Summary` protocol - buffer. - - -- - - - -### `tf.summary.merge(inputs, collections=None, name=None)` {#merge} - -Merges summaries. - -This op creates a -[`Summary`](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto) -protocol buffer that contains the union of all the values in the input -summaries. - -When the Op is run, it reports an `InvalidArgument` error if multiple values -in the summaries to merge use the same tag. - -##### Args: - - -* `inputs`: A list of `string` `Tensor` objects containing serialized `Summary` - protocol buffers. -* `collections`: Optional list of graph collections keys. The new summary op is - added to these collections. Defaults to `[]`. -* `name`: A name for the operation (optional). - -##### Returns: - - A scalar `Tensor` of type `string`. The serialized `Summary` protocol - buffer resulting from the merging. - - -- - - - -### `tf.summary.merge_all(key='summaries')` {#merge_all} - -Merges all summaries collected in the default graph. - -##### Args: - - -* `key`: `GraphKey` used to collect the summaries. Defaults to - `GraphKeys.SUMMARIES`. - -##### Returns: - - If no summaries were collected, returns None. Otherwise returns a scalar - `Tensor` of type `string` containing the serialized `Summary` protocol - buffer resulting from the merging. - - -- - - - -### `tf.summary.get_summary_description(node_def)` {#get_summary_description} - -Given a TensorSummary node_def, retrieve its SummaryDescription. - -When a Summary op is instantiated, a SummaryDescription of associated -metadata is stored in its NodeDef. This method retrieves the description. - -##### Args: - - -* `node_def`: the node_def_pb2.NodeDef of a TensorSummary op - -##### Returns: - - a summary_pb2.SummaryDescription - -##### Raises: - - -* `ValueError`: if the node is not a summary op. - - - -## Other Functions and Classes -- - - - -### `class tf.summary.SummaryDescription` {#SummaryDescription} - - -- - - - -#### `tf.summary.SummaryDescription.ByteSize()` {#SummaryDescription.ByteSize} - - - - -- - - - -#### `tf.summary.SummaryDescription.Clear()` {#SummaryDescription.Clear} - - - - -- - - - -#### `tf.summary.SummaryDescription.ClearExtension(extension_handle)` {#SummaryDescription.ClearExtension} - - - - -- - - - -#### `tf.summary.SummaryDescription.ClearField(field_name)` {#SummaryDescription.ClearField} - - - - -- - - - -#### `tf.summary.SummaryDescription.CopyFrom(other_msg)` {#SummaryDescription.CopyFrom} - -Copies the content of the specified message into the current message. - -The method clears the current message and then merges the specified -message using MergeFrom. - -##### Args: - - -* `other_msg`: Message to copy into the current one. - - -- - - - -#### `tf.summary.SummaryDescription.DiscardUnknownFields()` {#SummaryDescription.DiscardUnknownFields} - - - - -- - - - -#### `tf.summary.SummaryDescription.FindInitializationErrors()` {#SummaryDescription.FindInitializationErrors} - -Finds required fields which are not initialized. - -##### Returns: - - A list of strings. Each string is a path to an uninitialized field from - the top-level message, e.g. "foo.bar[5].baz". - - -- - - - -#### `tf.summary.SummaryDescription.FromString(s)` {#SummaryDescription.FromString} - - - - -- - - - -#### `tf.summary.SummaryDescription.HasExtension(extension_handle)` {#SummaryDescription.HasExtension} - - - - -- - - - -#### `tf.summary.SummaryDescription.HasField(field_name)` {#SummaryDescription.HasField} - - - - -- - - - -#### `tf.summary.SummaryDescription.IsInitialized(errors=None)` {#SummaryDescription.IsInitialized} - -Checks if all required fields of a message are set. - -##### Args: - - -* `errors`: A list which, if provided, will be populated with the field - paths of all missing required fields. - -##### Returns: - - True iff the specified message has all required fields set. - - -- - - - -#### `tf.summary.SummaryDescription.ListFields()` {#SummaryDescription.ListFields} - - - - -- - - - -#### `tf.summary.SummaryDescription.MergeFrom(msg)` {#SummaryDescription.MergeFrom} - - - - -- - - - -#### `tf.summary.SummaryDescription.MergeFromString(serialized)` {#SummaryDescription.MergeFromString} - - - - -- - - - -#### `tf.summary.SummaryDescription.ParseFromString(serialized)` {#SummaryDescription.ParseFromString} - -Parse serialized protocol buffer data into this message. - -Like MergeFromString(), except we clear the object first and -do not return the value that MergeFromString returns. - - -- - - - -#### `tf.summary.SummaryDescription.RegisterExtension(extension_handle)` {#SummaryDescription.RegisterExtension} - - - - -- - - - -#### `tf.summary.SummaryDescription.SerializePartialToString()` {#SummaryDescription.SerializePartialToString} - - - - -- - - - -#### `tf.summary.SummaryDescription.SerializeToString()` {#SummaryDescription.SerializeToString} - - - - -- - - - -#### `tf.summary.SummaryDescription.SetInParent()` {#SummaryDescription.SetInParent} - -Sets the _cached_byte_size_dirty bit to true, -and propagates this to our listener iff this was a state change. - - -- - - - -#### `tf.summary.SummaryDescription.WhichOneof(oneof_name)` {#SummaryDescription.WhichOneof} - -Returns the name of the currently set field inside a oneof, or None. - - -- - - - -#### `tf.summary.SummaryDescription.__deepcopy__(memo=None)` {#SummaryDescription.__deepcopy__} - - - - -- - - - -#### `tf.summary.SummaryDescription.__eq__(other)` {#SummaryDescription.__eq__} - - - - -- - - - -#### `tf.summary.SummaryDescription.__getstate__()` {#SummaryDescription.__getstate__} - -Support the pickle protocol. - - -- - - - -#### `tf.summary.SummaryDescription.__hash__()` {#SummaryDescription.__hash__} - - - - -- - - - -#### `tf.summary.SummaryDescription.__init__(**kwargs)` {#SummaryDescription.__init__} - - - - -- - - - -#### `tf.summary.SummaryDescription.__ne__(other_msg)` {#SummaryDescription.__ne__} - - - - -- - - - -#### `tf.summary.SummaryDescription.__repr__()` {#SummaryDescription.__repr__} - - - - -- - - - -#### `tf.summary.SummaryDescription.__setstate__(state)` {#SummaryDescription.__setstate__} - -Support the pickle protocol. - - -- - - - -#### `tf.summary.SummaryDescription.__str__()` {#SummaryDescription.__str__} - - - - -- - - - -#### `tf.summary.SummaryDescription.__unicode__()` {#SummaryDescription.__unicode__} - - - - -- - - - -#### `tf.summary.SummaryDescription.type_hint` {#SummaryDescription.type_hint} - -Magic attribute generated for "type_hint" proto field. - - - -- - - - -### `class tf.summary.TaggedRunMetadata` {#TaggedRunMetadata} - - -- - - - -#### `tf.summary.TaggedRunMetadata.ByteSize()` {#TaggedRunMetadata.ByteSize} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.Clear()` {#TaggedRunMetadata.Clear} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.ClearExtension(extension_handle)` {#TaggedRunMetadata.ClearExtension} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.ClearField(field_name)` {#TaggedRunMetadata.ClearField} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.CopyFrom(other_msg)` {#TaggedRunMetadata.CopyFrom} - -Copies the content of the specified message into the current message. - -The method clears the current message and then merges the specified -message using MergeFrom. - -##### Args: - - -* `other_msg`: Message to copy into the current one. - - -- - - - -#### `tf.summary.TaggedRunMetadata.DiscardUnknownFields()` {#TaggedRunMetadata.DiscardUnknownFields} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.FindInitializationErrors()` {#TaggedRunMetadata.FindInitializationErrors} - -Finds required fields which are not initialized. - -##### Returns: - - A list of strings. Each string is a path to an uninitialized field from - the top-level message, e.g. "foo.bar[5].baz". - - -- - - - -#### `tf.summary.TaggedRunMetadata.FromString(s)` {#TaggedRunMetadata.FromString} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.HasExtension(extension_handle)` {#TaggedRunMetadata.HasExtension} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.HasField(field_name)` {#TaggedRunMetadata.HasField} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.IsInitialized(errors=None)` {#TaggedRunMetadata.IsInitialized} - -Checks if all required fields of a message are set. - -##### Args: - - -* `errors`: A list which, if provided, will be populated with the field - paths of all missing required fields. - -##### Returns: - - True iff the specified message has all required fields set. - - -- - - - -#### `tf.summary.TaggedRunMetadata.ListFields()` {#TaggedRunMetadata.ListFields} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.MergeFrom(msg)` {#TaggedRunMetadata.MergeFrom} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.MergeFromString(serialized)` {#TaggedRunMetadata.MergeFromString} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.ParseFromString(serialized)` {#TaggedRunMetadata.ParseFromString} - -Parse serialized protocol buffer data into this message. - -Like MergeFromString(), except we clear the object first and -do not return the value that MergeFromString returns. - - -- - - - -#### `tf.summary.TaggedRunMetadata.RegisterExtension(extension_handle)` {#TaggedRunMetadata.RegisterExtension} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.SerializePartialToString()` {#TaggedRunMetadata.SerializePartialToString} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.SerializeToString()` {#TaggedRunMetadata.SerializeToString} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.SetInParent()` {#TaggedRunMetadata.SetInParent} - -Sets the _cached_byte_size_dirty bit to true, -and propagates this to our listener iff this was a state change. - - -- - - - -#### `tf.summary.TaggedRunMetadata.WhichOneof(oneof_name)` {#TaggedRunMetadata.WhichOneof} - -Returns the name of the currently set field inside a oneof, or None. - - -- - - - -#### `tf.summary.TaggedRunMetadata.__deepcopy__(memo=None)` {#TaggedRunMetadata.__deepcopy__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.__eq__(other)` {#TaggedRunMetadata.__eq__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.__getstate__()` {#TaggedRunMetadata.__getstate__} - -Support the pickle protocol. - - -- - - - -#### `tf.summary.TaggedRunMetadata.__hash__()` {#TaggedRunMetadata.__hash__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.__init__(**kwargs)` {#TaggedRunMetadata.__init__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.__ne__(other_msg)` {#TaggedRunMetadata.__ne__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.__repr__()` {#TaggedRunMetadata.__repr__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.__setstate__(state)` {#TaggedRunMetadata.__setstate__} - -Support the pickle protocol. - - -- - - - -#### `tf.summary.TaggedRunMetadata.__str__()` {#TaggedRunMetadata.__str__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.__unicode__()` {#TaggedRunMetadata.__unicode__} - - - - -- - - - -#### `tf.summary.TaggedRunMetadata.run_metadata` {#TaggedRunMetadata.run_metadata} - -Magic attribute generated for "run_metadata" proto field. - - -- - - - -#### `tf.summary.TaggedRunMetadata.tag` {#TaggedRunMetadata.tag} - -Magic attribute generated for "tag" proto field. - - - diff --git a/tensorflow/g3doc/api_docs/python/tensor_array_ops.md b/tensorflow/g3doc/api_docs/python/tensor_array_ops.md deleted file mode 100644 index b605a3a199..0000000000 --- a/tensorflow/g3doc/api_docs/python/tensor_array_ops.md +++ /dev/null @@ -1,297 +0,0 @@ - - -# TensorArray Operations - -Note: Functions taking `Tensor` arguments can also take anything accepted by -[`tf.convert_to_tensor`](framework.md#convert_to_tensor). - -[TOC] - -TensorArray: a dynamically sized array of Tensors. - -- - - - -### `class tf.TensorArray` {#TensorArray} - -Class wrapping dynamic-sized, per-time-step, write-once Tensor arrays. - -This class is meant to be used with dynamic iteration primitives such as -`while_loop` and `map_fn`. It supports gradient back-propagation via special -"flow" control flow dependencies. -- - - - -#### `tf.TensorArray.__init__(dtype, size=None, dynamic_size=None, clear_after_read=None, tensor_array_name=None, handle=None, flow=None, infer_shape=True, element_shape=None, name=None)` {#TensorArray.__init__} - -Construct a new TensorArray or wrap an existing TensorArray handle. - -A note about the parameter `name`: - -The name of the `TensorArray` (even if passed in) is uniquified: each time -a new `TensorArray` is created at runtime it is assigned its own name for -the duration of the run. This avoids name collisions if a `TensorArray` -is created within a `while_loop`. - -##### Args: - - -* `dtype`: (required) data type of the TensorArray. -* `size`: (optional) int32 scalar `Tensor`: the size of the TensorArray. - Required if handle is not provided. -* `dynamic_size`: (optional) Python bool: If true, writes to the TensorArray - can grow the TensorArray past its initial size. Default: False. -* `clear_after_read`: Boolean (optional, default: True). If True, clear - TensorArray values after reading them. This disables read-many - semantics, but allows early release of memory. -* `tensor_array_name`: (optional) Python string: the name of the TensorArray. - This is used when creating the TensorArray handle. If this value is - set, handle should be None. -* `handle`: (optional) A `Tensor` handle to an existing TensorArray. If this - is set, tensor_array_name should be None. -* `flow`: (optional) A float `Tensor` scalar coming from an existing - `TensorArray.flow`. -* `infer_shape`: (optional, default: True) If True, shape inference - is enabled. In this case, all elements must have the same shape. -* `element_shape`: (optional, default: None) A `TensorShape` object specifying - the shape constraints of each of the elements of the TensorArray. - Need not be fully defined. -* `name`: A name for the operation (optional). - -##### Raises: - - -* `ValueError`: if both handle and tensor_array_name are provided. -* `TypeError`: if handle is provided but is not a Tensor. - - -- - - - -#### `tf.TensorArray.close(name=None)` {#TensorArray.close} - -Close the current TensorArray. - - -- - - - -#### `tf.TensorArray.concat(name=None)` {#TensorArray.concat} - -Return the values in the TensorArray as a concatenated `Tensor`. - -All of the values must have been written, their ranks must match, and -and their shapes must all match for all dimensions except the first. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - All the tensors in the TensorArray concatenated into one tensor. - - -- - - - -#### `tf.TensorArray.dtype` {#TensorArray.dtype} - -The data type of this TensorArray. - - -- - - - -#### `tf.TensorArray.flow` {#TensorArray.flow} - -The flow `Tensor` forcing ops leading to this TensorArray state. - - -- - - - -#### `tf.TensorArray.gather(indices, name=None)` {#TensorArray.gather} - -Return selected values in the TensorArray as a packed `Tensor`. - -All of selected values must have been written and their shapes -must all match. - -##### Args: - - -* `indices`: A `1-D` `Tensor` taking values in `[0, max_value)`. If - the `TensorArray` is not dynamic, `max_value=size()`. -* `name`: A name for the operation (optional). - -##### Returns: - - The in the `TensorArray` selected by `indices`, packed into one tensor. - - -- - - - -#### `tf.TensorArray.grad(source, flow=None, name=None)` {#TensorArray.grad} - - - - -- - - - -#### `tf.TensorArray.handle` {#TensorArray.handle} - -The reference to the TensorArray. - - -- - - - -#### `tf.TensorArray.identity()` {#TensorArray.identity} - -Returns a TensorArray with the same content and properties. - -##### Returns: - - A new TensorArray object with flow that ensures the control dependencies - from the contexts will become control dependencies for writes, reads, etc. - Use this object all for subsequent operations. - - -- - - - -#### `tf.TensorArray.read(index, name=None)` {#TensorArray.read} - -Read the value at location `index` in the TensorArray. - -##### Args: - - -* `index`: 0-D. int32 tensor with the index to read from. -* `name`: A name for the operation (optional). - -##### Returns: - - The tensor at index `index`. - - -- - - - -#### `tf.TensorArray.scatter(indices, value, name=None)` {#TensorArray.scatter} - -Scatter the values of a `Tensor` in specific indices of a `TensorArray`. - -##### Args: - - -* `indices`: A `1-D` `Tensor` taking values in `[0, max_value)`. If - the `TensorArray` is not dynamic, `max_value=size()`. -* `value`: (N+1)-D. Tensor of type `dtype`. The Tensor to unpack. -* `name`: A name for the operation (optional). - -##### Returns: - - A new TensorArray object with flow that ensures the scatter occurs. - Use this object all for subsequent operations. - -##### Raises: - - -* `ValueError`: if the shape inference fails. - - -- - - - -#### `tf.TensorArray.size(name=None)` {#TensorArray.size} - -Return the size of the TensorArray. - - -- - - - -#### `tf.TensorArray.split(value, lengths, name=None)` {#TensorArray.split} - -Split the values of a `Tensor` into the TensorArray. - -##### Args: - - -* `value`: (N+1)-D. Tensor of type `dtype`. The Tensor to split. -* `lengths`: 1-D. int32 vector with the lengths to use when splitting - `value` along its first dimension. -* `name`: A name for the operation (optional). - -##### Returns: - - A new TensorArray object with flow that ensures the split occurs. - Use this object all for subsequent operations. - -##### Raises: - - -* `ValueError`: if the shape inference fails. - - -- - - - -#### `tf.TensorArray.stack(name=None)` {#TensorArray.stack} - -Return the values in the TensorArray as a stacked `Tensor`. - -All of the values must have been written and their shapes must all match. -If input shapes have rank-`R`, then output shape will have rank-`(R+1)`. - -##### Args: - - -* `name`: A name for the operation (optional). - -##### Returns: - - All the tensors in the TensorArray stacked into one tensor. - - -- - - - -#### `tf.TensorArray.unstack(value, name=None)` {#TensorArray.unstack} - -Unstack the values of a `Tensor` in the TensorArray. - -If input value shapes have rank-`R`, then the output TensorArray will -contain elements whose shapes are rank-`(R-1)`. - -##### Args: - - -* `value`: (N+1)-D. Tensor of type `dtype`. The Tensor to unstack. -* `name`: A name for the operation (optional). - -##### Returns: - - A new TensorArray object with flow that ensures the unstack occurs. - Use this object all for subsequent operations. - -##### Raises: - - -* `ValueError`: if the shape inference fails. - - -- - - - -#### `tf.TensorArray.write(index, value, name=None)` {#TensorArray.write} - -Write `value` into index `index` of the TensorArray. - -##### Args: - - -* `index`: 0-D. int32 scalar with the index to write to. -* `value`: N-D. Tensor of type `dtype`. The Tensor to write to this index. -* `name`: A name for the operation (optional). - -##### Returns: - - A new TensorArray object with flow that ensures the write occurs. - Use this object all for subsequent operations. - -##### Raises: - - -* `ValueError`: if there are more writers than specified. - - - diff --git a/tensorflow/g3doc/api_docs/python/test.md b/tensorflow/g3doc/api_docs/python/test.md deleted file mode 100644 index 189a368ad2..0000000000 --- a/tensorflow/g3doc/api_docs/python/test.md +++ /dev/null @@ -1,1133 +0,0 @@ - - -# Testing -[TOC] - -Testing. See the @{$python/test} guide. - -- - - - -### `tf.test.main(argv=None)` {#main} - -Runs all unit tests. - - -- - - - -### `class tf.test.TestCase` {#TestCase} - -Base class for tests that need to test TensorFlow. -- - - - -#### `tf.test.TestCase.__call__(*args, **kwds)` {#TestCase.__call__} - - - - -- - - - -#### `tf.test.TestCase.__eq__(other)` {#TestCase.__eq__} - - - - -- - - - -#### `tf.test.TestCase.__hash__()` {#TestCase.__hash__} - - - - -- - - - -#### `tf.test.TestCase.__init__(methodName='runTest')` {#TestCase.__init__} - - - - -- - - - -#### `tf.test.TestCase.__ne__(other)` {#TestCase.__ne__} - - - - -- - - - -#### `tf.test.TestCase.__repr__()` {#TestCase.__repr__} - - - - -- - - - -#### `tf.test.TestCase.__str__()` {#TestCase.__str__} - - - - -- - - - -#### `tf.test.TestCase.addCleanup(function, *args, **kwargs)` {#TestCase.addCleanup} - -Add a function, with arguments, to be called when the test is -completed. Functions added are called on a LIFO basis and are -called after tearDown on test failure or success. - -Cleanup items are called even if setUp fails (unlike tearDown). - - -- - - - -#### `tf.test.TestCase.addTypeEqualityFunc(typeobj, function)` {#TestCase.addTypeEqualityFunc} - -Add a type specific assertEqual style function to compare a type. - -This method is for use by TestCase subclasses that need to register -their own type equality functions to provide nicer error messages. - -##### Args: - - -* `typeobj`: The data type to call this function on when both values - are of the same type in assertEqual(). -* `function`: The callable taking two arguments and an optional - msg= argument that raises self.failureException with a - useful error message when the two arguments are not equal. - - -- - - - -#### `tf.test.TestCase.assertAllClose(a, b, rtol=1e-06, atol=1e-06)` {#TestCase.assertAllClose} - -Asserts that two numpy arrays have near values. - -##### Args: - - -* `a`: a numpy ndarray or anything can be converted to one. -* `b`: a numpy ndarray or anything can be converted to one. -* `rtol`: relative tolerance -* `atol`: absolute tolerance - - -- - - - -#### `tf.test.TestCase.assertAllCloseAccordingToType(a, b, rtol=1e-06, atol=1e-06, float_rtol=1e-06, float_atol=1e-06, half_rtol=0.001, half_atol=0.001)` {#TestCase.assertAllCloseAccordingToType} - -Like assertAllClose, but also suitable for comparing fp16 arrays. - -In particular, the tolerance is reduced to 1e-3 if at least -one of the arguments is of type float16. - -##### Args: - - -* `a`: a numpy ndarray or anything can be converted to one. -* `b`: a numpy ndarray or anything can be converted to one. -* `rtol`: relative tolerance -* `atol`: absolute tolerance -* `float_rtol`: relative tolerance for float32 -* `float_atol`: absolute tolerance for float32 -* `half_rtol`: relative tolerance for float16 -* `half_atol`: absolute tolerance for float16 - - -- - - - -#### `tf.test.TestCase.assertAllEqual(a, b)` {#TestCase.assertAllEqual} - -Asserts that two numpy arrays have the same values. - -##### Args: - - -* `a`: a numpy ndarray or anything can be converted to one. -* `b`: a numpy ndarray or anything can be converted to one. - - -- - - - -#### `tf.test.TestCase.assertAlmostEqual(first, second, places=None, msg=None, delta=None)` {#TestCase.assertAlmostEqual} - -Fail if the two objects are unequal as determined by their -difference rounded to the given number of decimal places -(default 7) and comparing to zero, or by comparing that the -between the two objects is more than the given delta. - -Note that decimal places (from zero) are usually not the same -as significant digits (measured from the most signficant digit). - -If the two objects compare equal then they will automatically -compare almost equal. - - -- - - - -#### `tf.test.TestCase.assertAlmostEquals(first, second, places=None, msg=None, delta=None)` {#TestCase.assertAlmostEquals} - -Fail if the two objects are unequal as determined by their -difference rounded to the given number of decimal places -(default 7) and comparing to zero, or by comparing that the -between the two objects is more than the given delta. - -Note that decimal places (from zero) are usually not the same -as significant digits (measured from the most signficant digit). - -If the two objects compare equal then they will automatically -compare almost equal. - - -- - - - -#### `tf.test.TestCase.assertArrayNear(farray1, farray2, err)` {#TestCase.assertArrayNear} - -Asserts that two float arrays are near each other. - -Checks that for all elements of farray1 and farray2 -|f1 - f2| < err. Asserts a test failure if not. - -##### Args: - - -* `farray1`: a list of float values. -* `farray2`: a list of float values. -* `err`: a float value. - - -- - - - -#### `tf.test.TestCase.assertDeviceEqual(device1, device2)` {#TestCase.assertDeviceEqual} - -Asserts that the two given devices are the same. - -##### Args: - - -* `device1`: A string device name or TensorFlow `DeviceSpec` object. -* `device2`: A string device name or TensorFlow `DeviceSpec` object. - - -- - - - -#### `tf.test.TestCase.assertDictContainsSubset(expected, actual, msg=None)` {#TestCase.assertDictContainsSubset} - -Checks whether actual is a superset of expected. - - -- - - - -#### `tf.test.TestCase.assertDictEqual(d1, d2, msg=None)` {#TestCase.assertDictEqual} - - - - -- - - - -#### `tf.test.TestCase.assertEqual(first, second, msg=None)` {#TestCase.assertEqual} - -Fail if the two objects are unequal as determined by the '==' -operator. - - -- - - - -#### `tf.test.TestCase.assertEquals(first, second, msg=None)` {#TestCase.assertEquals} - -Fail if the two objects are unequal as determined by the '==' -operator. - - -- - - - -#### `tf.test.TestCase.assertFalse(expr, msg=None)` {#TestCase.assertFalse} - -Check that the expression is false. - - -- - - - -#### `tf.test.TestCase.assertGreater(a, b, msg=None)` {#TestCase.assertGreater} - -Just like self.assertTrue(a > b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertGreaterEqual(a, b, msg=None)` {#TestCase.assertGreaterEqual} - -Just like self.assertTrue(a >= b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertIn(member, container, msg=None)` {#TestCase.assertIn} - -Just like self.assertTrue(a in b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertIs(expr1, expr2, msg=None)` {#TestCase.assertIs} - -Just like self.assertTrue(a is b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertIsInstance(obj, cls, msg=None)` {#TestCase.assertIsInstance} - -Same as self.assertTrue(isinstance(obj, cls)), with a nicer -default message. - - -- - - - -#### `tf.test.TestCase.assertIsNone(obj, msg=None)` {#TestCase.assertIsNone} - -Same as self.assertTrue(obj is None), with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertIsNot(expr1, expr2, msg=None)` {#TestCase.assertIsNot} - -Just like self.assertTrue(a is not b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertIsNotNone(obj, msg=None)` {#TestCase.assertIsNotNone} - -Included for symmetry with assertIsNone. - - -- - - - -#### `tf.test.TestCase.assertItemsEqual(expected_seq, actual_seq, msg=None)` {#TestCase.assertItemsEqual} - -An unordered sequence specific comparison. It asserts that -actual_seq and expected_seq have the same element counts. -Equivalent to:: - - self.assertEqual(Counter(iter(actual_seq)), - Counter(iter(expected_seq))) - -Asserts that each element has the same count in both sequences. - -##### Example: - - - [0, 1, 1] and [1, 0, 1] compare equal. - - [0, 0, 1] and [0, 1] compare unequal. - - -- - - - -#### `tf.test.TestCase.assertLess(a, b, msg=None)` {#TestCase.assertLess} - -Just like self.assertTrue(a < b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertLessEqual(a, b, msg=None)` {#TestCase.assertLessEqual} - -Just like self.assertTrue(a <= b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertListEqual(list1, list2, msg=None)` {#TestCase.assertListEqual} - -A list-specific equality assertion. - -##### Args: - - -* `list1`: The first list to compare. -* `list2`: The second list to compare. -* `msg`: Optional message to use on failure instead of a list of - differences. - - -- - - - -#### `tf.test.TestCase.assertMultiLineEqual(first, second, msg=None)` {#TestCase.assertMultiLineEqual} - -Assert that two multi-line strings are equal. - - -- - - - -#### `tf.test.TestCase.assertNDArrayNear(ndarray1, ndarray2, err)` {#TestCase.assertNDArrayNear} - -Asserts that two numpy arrays have near values. - -##### Args: - - -* `ndarray1`: a numpy ndarray. -* `ndarray2`: a numpy ndarray. -* `err`: a float. The maximum absolute difference allowed. - - -- - - - -#### `tf.test.TestCase.assertNear(f1, f2, err, msg=None)` {#TestCase.assertNear} - -Asserts that two floats are near each other. - -Checks that |f1 - f2| < err and asserts a test failure -if not. - -##### Args: - - -* `f1`: A float value. -* `f2`: A float value. -* `err`: A float value. -* `msg`: An optional string message to append to the failure message. - - -- - - - -#### `tf.test.TestCase.assertNotAlmostEqual(first, second, places=None, msg=None, delta=None)` {#TestCase.assertNotAlmostEqual} - -Fail if the two objects are equal as determined by their -difference rounded to the given number of decimal places -(default 7) and comparing to zero, or by comparing that the -between the two objects is less than the given delta. - -Note that decimal places (from zero) are usually not the same -as significant digits (measured from the most signficant digit). - -Objects that are equal automatically fail. - - -- - - - -#### `tf.test.TestCase.assertNotAlmostEquals(first, second, places=None, msg=None, delta=None)` {#TestCase.assertNotAlmostEquals} - -Fail if the two objects are equal as determined by their -difference rounded to the given number of decimal places -(default 7) and comparing to zero, or by comparing that the -between the two objects is less than the given delta. - -Note that decimal places (from zero) are usually not the same -as significant digits (measured from the most signficant digit). - -Objects that are equal automatically fail. - - -- - - - -#### `tf.test.TestCase.assertNotEqual(first, second, msg=None)` {#TestCase.assertNotEqual} - -Fail if the two objects are equal as determined by the '!=' -operator. - - -- - - - -#### `tf.test.TestCase.assertNotEquals(first, second, msg=None)` {#TestCase.assertNotEquals} - -Fail if the two objects are equal as determined by the '!=' -operator. - - -- - - - -#### `tf.test.TestCase.assertNotIn(member, container, msg=None)` {#TestCase.assertNotIn} - -Just like self.assertTrue(a not in b), but with a nicer default message. - - -- - - - -#### `tf.test.TestCase.assertNotIsInstance(obj, cls, msg=None)` {#TestCase.assertNotIsInstance} - -Included for symmetry with assertIsInstance. - - -- - - - -#### `tf.test.TestCase.assertNotRegexpMatches(text, unexpected_regexp, msg=None)` {#TestCase.assertNotRegexpMatches} - -Fail the test if the text matches the regular expression. - - -- - - - -#### `tf.test.TestCase.assertProtoEquals(expected_message_maybe_ascii, message)` {#TestCase.assertProtoEquals} - -Asserts that message is same as parsed expected_message_ascii. - -Creates another prototype of message, reads the ascii message into it and -then compares them using self._AssertProtoEqual(). - -##### Args: - - -* `expected_message_maybe_ascii`: proto message in original or ascii form -* `message`: the message to validate - - -- - - - -#### `tf.test.TestCase.assertProtoEqualsVersion(expected, actual, producer=21, min_consumer=0)` {#TestCase.assertProtoEqualsVersion} - - - - -- - - - -#### `tf.test.TestCase.assertRaises(excClass, callableObj=None, *args, **kwargs)` {#TestCase.assertRaises} - -Fail unless an exception of class excClass is raised -by callableObj when invoked with arguments args and keyword -arguments kwargs. If a different type of exception is -raised, it will not be caught, and the test case will be -deemed to have suffered an error, exactly as for an -unexpected exception. - -If called with callableObj omitted or None, will return a -context object used like this:: - - with self.assertRaises(SomeException): - do_something() - -The context manager keeps a reference to the exception as -the 'exception' attribute. This allows you to inspect the -exception after the assertion:: - - with self.assertRaises(SomeException) as cm: - do_something() - the_exception = cm.exception - self.assertEqual(the_exception.error_code, 3) - - -- - - - -#### `tf.test.TestCase.assertRaisesOpError(expected_err_re_or_predicate)` {#TestCase.assertRaisesOpError} - - - - -- - - - -#### `tf.test.TestCase.assertRaisesRegexp(expected_exception, expected_regexp, callable_obj=None, *args, **kwargs)` {#TestCase.assertRaisesRegexp} - -Asserts that the message in a raised exception matches a regexp. - -##### Args: - - -* `expected_exception`: Exception class expected to be raised. -* `expected_regexp`: Regexp (re pattern object or string) expected - to be found in error message. -* `callable_obj`: Function to be called. -* `args`: Extra args. -* `kwargs`: Extra kwargs. - - -- - - - -#### `tf.test.TestCase.assertRaisesWithPredicateMatch(exception_type, expected_err_re_or_predicate)` {#TestCase.assertRaisesWithPredicateMatch} - -Returns a context manager to enclose code expected to raise an exception. - -If the exception is an OpError, the op stack is also included in the message -predicate search. - -##### Args: - - -* `exception_type`: The expected type of exception that should be raised. -* `expected_err_re_or_predicate`: If this is callable, it should be a function - of one argument that inspects the passed-in exception and - returns True (success) or False (please fail the test). Otherwise, the - error message is expected to match this regular expression partially. - -##### Returns: - - A context manager to surround code that is expected to raise an - exception. - - -- - - - -#### `tf.test.TestCase.assertRegexpMatches(text, expected_regexp, msg=None)` {#TestCase.assertRegexpMatches} - -Fail the test unless the text matches the regular expression. - - -- - - - -#### `tf.test.TestCase.assertSequenceEqual(seq1, seq2, msg=None, seq_type=None)` {#TestCase.assertSequenceEqual} - -An equality assertion for ordered sequences (like lists and tuples). - -For the purposes of this function, a valid ordered sequence type is one -which can be indexed, has a length, and has an equality operator. - -##### Args: - - -* `seq1`: The first sequence to compare. -* `seq2`: The second sequence to compare. -* `seq_type`: The expected datatype of the sequences, or None if no - datatype should be enforced. -* `msg`: Optional message to use on failure instead of a list of - differences. - - -- - - - -#### `tf.test.TestCase.assertSetEqual(set1, set2, msg=None)` {#TestCase.assertSetEqual} - -A set-specific equality assertion. - -##### Args: - - -* `set1`: The first set to compare. -* `set2`: The second set to compare. -* `msg`: Optional message to use on failure instead of a list of - differences. - -assertSetEqual uses ducktyping to support different types of sets, and -is optimized for sets specifically (parameters must support a -difference method). - - -- - - - -#### `tf.test.TestCase.assertShapeEqual(np_array, tf_tensor)` {#TestCase.assertShapeEqual} - -Asserts that a Numpy ndarray and a TensorFlow tensor have the same shape. - -##### Args: - - -* `np_array`: A Numpy ndarray or Numpy scalar. -* `tf_tensor`: A Tensor. - -##### Raises: - - -* `TypeError`: If the arguments have the wrong type. - - -- - - - -#### `tf.test.TestCase.assertStartsWith(actual, expected_start, msg=None)` {#TestCase.assertStartsWith} - -Assert that actual.startswith(expected_start) is True. - -##### Args: - - -* `actual`: str -* `expected_start`: str -* `msg`: Optional message to report on failure. - - -- - - - -#### `tf.test.TestCase.assertTrue(expr, msg=None)` {#TestCase.assertTrue} - -Check that the expression is true. - - -- - - - -#### `tf.test.TestCase.assertTupleEqual(tuple1, tuple2, msg=None)` {#TestCase.assertTupleEqual} - -A tuple-specific equality assertion. - -##### Args: - - -* `tuple1`: The first tuple to compare. -* `tuple2`: The second tuple to compare. -* `msg`: Optional message to use on failure instead of a list of - differences. - - -- - - - -#### `tf.test.TestCase.assert_(expr, msg=None)` {#TestCase.assert_} - -Check that the expression is true. - - -- - - - -#### `tf.test.TestCase.checkedThread(target, args=None, kwargs=None)` {#TestCase.checkedThread} - -Returns a Thread wrapper that asserts 'target' completes successfully. - -This method should be used to create all threads in test cases, as -otherwise there is a risk that a thread will silently fail, and/or -assertions made in the thread will not be respected. - -##### Args: - - -* `target`: A callable object to be executed in the thread. -* `args`: The argument tuple for the target invocation. Defaults to (). -* `kwargs`: A dictionary of keyword arguments for the target invocation. - Defaults to {}. - -##### Returns: - - A wrapper for threading.Thread that supports start() and join() methods. - - -- - - - -#### `tf.test.TestCase.countTestCases()` {#TestCase.countTestCases} - - - - -- - - - -#### `tf.test.TestCase.debug()` {#TestCase.debug} - -Run the test without collecting errors in a TestResult - - -- - - - -#### `tf.test.TestCase.defaultTestResult()` {#TestCase.defaultTestResult} - - - - -- - - - -#### `tf.test.TestCase.doCleanups()` {#TestCase.doCleanups} - -Execute all cleanup functions. Normally called for you after -tearDown. - - -- - - - -#### `tf.test.TestCase.fail(msg=None)` {#TestCase.fail} - -Fail immediately, with the given message. - - -- - - - -#### `tf.test.TestCase.failIf(*args, **kwargs)` {#TestCase.failIf} - - - - -- - - - -#### `tf.test.TestCase.failIfAlmostEqual(*args, **kwargs)` {#TestCase.failIfAlmostEqual} - - - - -- - - - -#### `tf.test.TestCase.failIfEqual(*args, **kwargs)` {#TestCase.failIfEqual} - - - - -- - - - -#### `tf.test.TestCase.failUnless(*args, **kwargs)` {#TestCase.failUnless} - - - - -- - - - -#### `tf.test.TestCase.failUnlessAlmostEqual(*args, **kwargs)` {#TestCase.failUnlessAlmostEqual} - - - - -- - - - -#### `tf.test.TestCase.failUnlessEqual(*args, **kwargs)` {#TestCase.failUnlessEqual} - - - - -- - - - -#### `tf.test.TestCase.failUnlessRaises(*args, **kwargs)` {#TestCase.failUnlessRaises} - - - - -- - - - -#### `tf.test.TestCase.get_temp_dir()` {#TestCase.get_temp_dir} - -Returns a unique temporary directory for the test to use. - -Across different test runs, this method will return a different folder. -This will ensure that across different runs tests will not be able to -pollute each others environment. - -##### Returns: - - string, the path to the unique temporary directory created for this test. - - -- - - - -#### `tf.test.TestCase.id()` {#TestCase.id} - - - - -- - - - -#### `tf.test.TestCase.run(result=None)` {#TestCase.run} - - - - -- - - - -#### `tf.test.TestCase.setUp()` {#TestCase.setUp} - - - - -- - - - -#### `tf.test.TestCase.setUpClass(cls)` {#TestCase.setUpClass} - -Hook method for setting up class fixture before running tests in the class. - - -- - - - -#### `tf.test.TestCase.shortDescription()` {#TestCase.shortDescription} - -Returns a one-line description of the test, or None if no -description has been provided. - -The default implementation of this method returns the first line of -the specified test method's docstring. - - -- - - - -#### `tf.test.TestCase.skipTest(reason)` {#TestCase.skipTest} - -Skip this test. - - -- - - - -#### `tf.test.TestCase.tearDown()` {#TestCase.tearDown} - - - - -- - - - -#### `tf.test.TestCase.tearDownClass(cls)` {#TestCase.tearDownClass} - -Hook method for deconstructing the class fixture after running all tests in the class. - - -- - - - -#### `tf.test.TestCase.test_session(graph=None, config=None, use_gpu=False, force_gpu=False)` {#TestCase.test_session} - -Returns a TensorFlow Session for use in executing tests. - -This method should be used for all functional tests. - -This method behaves different than session.Session: for performance reasons -`test_session` will by default (if `graph` is None) reuse the same session -across tests. This means you may want to either call the function -`reset_default_graph()` before tests, or if creating an explicit new graph, -pass it here (simply setting it with `as_default()` won't do it), which will -trigger the creation of a new session. - -Use the `use_gpu` and `force_gpu` options to control where ops are run. If -`force_gpu` is True, all ops are pinned to `/gpu:0`. Otherwise, if `use_gpu` -is True, TensorFlow tries to run as many ops on the GPU as possible. If both -`force_gpu and `use_gpu` are False, all ops are pinned to the CPU. - -Example: - - class MyOperatorTest(test_util.TensorFlowTestCase): - def testMyOperator(self): - with self.test_session(use_gpu=True): - valid_input = [1.0, 2.0, 3.0, 4.0, 5.0] - result = MyOperator(valid_input).eval() - self.assertEqual(result, [1.0, 2.0, 3.0, 5.0, 8.0] - invalid_input = [-1.0, 2.0, 7.0] - with self.assertRaisesOpError("negative input not supported"): - MyOperator(invalid_input).eval() - -##### Args: - - -* `graph`: Optional graph to use during the returned session. -* `config`: An optional config_pb2.ConfigProto to use to configure the - session. -* `use_gpu`: If True, attempt to run as many ops as possible on GPU. -* `force_gpu`: If True, pin all ops to `/gpu:0`. - -##### Returns: - - A Session object that should be used as a context manager to surround - the graph building and execution code in a test case. - - - -- - - - -### `tf.test.test_src_dir_path(relative_path)` {#test_src_dir_path} - -Creates an absolute test srcdir path given a relative path. - -##### Args: - - -* `relative_path`: a path relative to tensorflow root. - e.g. "core/platform". - -##### Returns: - - An absolute path to the linked in runfiles. - - -- - - - -### `tf.test.assert_equal_graph_def(actual, expected, checkpoint_v2=False)` {#assert_equal_graph_def} - -Asserts that two `GraphDef`s are (mostly) the same. - -Compares two `GraphDef` protos for equality, ignoring versions and ordering of -nodes, attrs, and control inputs. Node names are used to match up nodes -between the graphs, so the naming of nodes must be consistent. - -##### Args: - - -* `actual`: The `GraphDef` we have. -* `expected`: The `GraphDef` we expected. -* `checkpoint_v2`: boolean determining whether to ignore randomized attribute - values that appear in V2 checkpoints. - -##### Raises: - - -* `AssertionError`: If the `GraphDef`s do not match. -* `TypeError`: If either argument is not a `GraphDef`. - - -- - - - -### `tf.test.get_temp_dir()` {#get_temp_dir} - -Returns a temporary directory for use during tests. - -There is no need to delete the directory after the test. - -##### Returns: - - The temporary directory. - - -- - - - -### `tf.test.is_built_with_cuda()` {#is_built_with_cuda} - -Returns whether TensorFlow was built with CUDA (GPU) support. - - -- - - - -### `tf.test.is_gpu_available(cuda_only=False)` {#is_gpu_available} - -Returns whether TensorFlow can access a GPU. - -##### Args: - - -* `cuda_only`: limit the search to CUDA gpus. - -##### Returns: - - True iff a gpu device of the requested kind is available. - - -- - - - -### `tf.test.gpu_device_name()` {#gpu_device_name} - -Returns the name of a GPU device if available or the empty string. - - -- - - - -### `tf.test.compute_gradient(x, x_shape, y, y_shape, x_init_value=None, delta=0.001, init_targets=None, extra_feed_dict=None)` {#compute_gradient} - -Computes and returns the theoretical and numerical Jacobian. - -If `x` or `y` is complex, the Jacobian will still be real but the -corresponding Jacobian dimension(s) will be twice as large. This is required -even if both input and output is complex since TensorFlow graphs are not -necessarily holomorphic, and may have gradients not expressible as complex -numbers. For example, if `x` is complex with shape `[m]` and `y` is complex -with shape `[n]`, each Jacobian `J` will have shape `[m * 2, n * 2]` with - - J[:m, :n] = d(Re y)/d(Re x) - J[:m, n:] = d(Im y)/d(Re x) - J[m:, :n] = d(Re y)/d(Im x) - J[m:, n:] = d(Im y)/d(Im x) - -##### Args: - - -* `x`: a tensor or list of tensors -* `x_shape`: the dimensions of x as a tuple or an array of ints. If x is a list, - then this is the list of shapes. - -* `y`: a tensor -* `y_shape`: the dimensions of y as a tuple or an array of ints. -* `x_init_value`: (optional) a numpy array of the same shape as "x" - representing the initial value of x. If x is a list, this should be a list - of numpy arrays. If this is none, the function will pick a random tensor - as the initial value. -* `delta`: (optional) the amount of perturbation. -* `init_targets`: list of targets to run to initialize model params. - TODO(mrry): remove this argument. -* `extra_feed_dict`: dict that allows fixing specified tensor values - during the Jacobian calculation. - -##### Returns: - - Two 2-d numpy arrays representing the theoretical and numerical - Jacobian for dy/dx. Each has "x_size" rows and "y_size" columns - where "x_size" is the number of elements in x and "y_size" is the - number of elements in y. If x is a list, returns a list of two numpy arrays. - - -- - - - -### `tf.test.compute_gradient_error(x, x_shape, y, y_shape, x_init_value=None, delta=0.001, init_targets=None, extra_feed_dict=None)` {#compute_gradient_error} - -Computes the gradient error. - -Computes the maximum error for dy/dx between the computed Jacobian and the -numerically estimated Jacobian. - -This function will modify the tensors passed in as it adds more operations -and hence changing the consumers of the operations of the input tensors. - -This function adds operations to the current session. To compute the error -using a particular device, such as a GPU, use the standard methods for -setting a device (e.g. using with sess.graph.device() or setting a device -function in the session constructor). - -##### Args: - - -* `x`: a tensor or list of tensors -* `x_shape`: the dimensions of x as a tuple or an array of ints. If x is a list, - then this is the list of shapes. - -* `y`: a tensor -* `y_shape`: the dimensions of y as a tuple or an array of ints. -* `x_init_value`: (optional) a numpy array of the same shape as "x" - representing the initial value of x. If x is a list, this should be a list - of numpy arrays. If this is none, the function will pick a random tensor - as the initial value. -* `delta`: (optional) the amount of perturbation. -* `init_targets`: list of targets to run to initialize model params. - TODO(mrry): Remove this argument. -* `extra_feed_dict`: dict that allows fixing specified tensor values - during the Jacobian calculation. - -##### Returns: - - The maximum error in between the two Jacobians. - - - -## Other Functions and Classes -- - - - -### `class tf.test.Benchmark` {#Benchmark} - -Abstract class that provides helpers for TensorFlow benchmarks. -- - - - -#### `tf.test.Benchmark.is_abstract(cls)` {#Benchmark.is_abstract} - - - - -- - - - -#### `tf.test.Benchmark.report_benchmark(iters=None, cpu_time=None, wall_time=None, throughput=None, extras=None, name=None)` {#Benchmark.report_benchmark} - -Report a benchmark. - -##### Args: - - -* `iters`: (optional) How many iterations were run -* `cpu_time`: (optional) Total cpu time in seconds -* `wall_time`: (optional) Total wall time in seconds -* `throughput`: (optional) Throughput (in MB/s) -* `extras`: (optional) Dict mapping string keys to additional benchmark info. - Values may be either floats or values that are convertible to strings. -* `name`: (optional) Override the BenchmarkEntry name with `name`. - Otherwise it is inferred from the top-level method name. - - -- - - - -#### `tf.test.Benchmark.run_op_benchmark(sess, op_or_tensor, feed_dict=None, burn_iters=2, min_iters=10, store_trace=False, store_memory_usage=True, name=None, extras=None, mbs=0)` {#Benchmark.run_op_benchmark} - -Run an op or tensor in the given session. Report the results. - -##### Args: - - -* `sess`: `Session` object to use for timing. -* `op_or_tensor`: `Operation` or `Tensor` to benchmark. -* `feed_dict`: A `dict` of values to feed for each op iteration (see the - `feed_dict` parameter of `Session.run`). -* `burn_iters`: Number of burn-in iterations to run. -* `min_iters`: Minimum number of iterations to use for timing. -* `store_trace`: Boolean, whether to run an extra untimed iteration and - store the trace of iteration in the benchmark report. - The trace will be stored as a string in Google Chrome trace format - in the extras field "full_trace_chrome_format". -* `store_memory_usage`: Boolean, whether to run an extra untimed iteration, - calculate memory usage, and store that in extras fields. -* `name`: (optional) Override the BenchmarkEntry name with `name`. - Otherwise it is inferred from the top-level method name. -* `extras`: (optional) Dict mapping string keys to additional benchmark info. - Values may be either floats or values that are convertible to strings. -* `mbs`: (optional) The number of megabytes moved by this op, used to - calculate the ops throughput. - -##### Returns: - - A `dict` containing the key-value pairs that were passed to - `report_benchmark`. - - - diff --git a/tensorflow/g3doc/api_docs/python/tf_debug.md b/tensorflow/g3doc/api_docs/python/tf_debug.md deleted file mode 100644 index 38a082d408..0000000000 --- a/tensorflow/g3doc/api_docs/python/tf_debug.md +++ /dev/null @@ -1,1659 +0,0 @@ - - -# TensorFlow Debugger -[TOC] - -Public Python API of TensorFlow Debugger (tfdbg). - -See the @{$python/tfdbg} guide. - -- - - - -### `tf_debug.add_debug_tensor_watch(run_options, node_name, output_slot=0, debug_ops='DebugIdentity', debug_urls=None, global_step=-1)` {#add_debug_tensor_watch} - -Add watch on a `Tensor` to `RunOptions`. - -N.B.: Under certain circumstances, the `Tensor` may not be actually watched - (e.g., if the node of the `Tensor` is constant-folded during runtime). - -##### Args: - - -* `run_options`: An instance of `config_pb2.RunOptions` to be modified. -* `node_name`: (`str`) name of the node to watch. -* `output_slot`: (`int`) output slot index of the tensor from the watched node. -* `debug_ops`: (`str` or `list` of `str`) name(s) of the debug op(s). Can be a - `list` of `str` or a single `str`. The latter case is equivalent to a - `list` of `str` with only one element. -* `debug_urls`: (`str` or `list` of `str`) URL(s) to send debug values to, - e.g., `file:///tmp/tfdbg_dump_1`, `grpc://localhost:12345`. -* `global_step`: (`int`) Optional global_step count for this debug tensor - watch. - - -- - - - -### `tf_debug.watch_graph(run_options, graph, debug_ops='DebugIdentity', debug_urls=None, node_name_regex_whitelist=None, op_type_regex_whitelist=None, global_step=-1)` {#watch_graph} - -Add debug watches to `RunOptions` for a TensorFlow graph. - -To watch all `Tensor`s on the graph, let both `node_name_regex_whitelist` -and `op_type_regex_whitelist` be the default (`None`). - -N.B.: Under certain circumstances, not all specified `Tensor`s will be - actually watched (e.g., nodes that are constant-folded during runtime will - not be watched). - -##### Args: - - -* `run_options`: An instance of `config_pb2.RunOptions` to be modified. -* `graph`: An instance of `ops.Graph`. -* `debug_ops`: (`str` or `list` of `str`) name(s) of the debug op(s) to use. -* `debug_urls`: URLs to send debug values to. Can be a list of strings, - a single string, or None. The case of a single string is equivalent to - a list consisting of a single string, e.g., `file:///tmp/tfdbg_dump_1`, - `grpc://localhost:12345`. -* `node_name_regex_whitelist`: Regular-expression whitelist for node_name, - e.g., `"(weight_[0-9]+|bias_.*)"` -* `op_type_regex_whitelist`: Regular-expression whitelist for the op type of - nodes, e.g., `"(Variable|Add)"`. - If both `node_name_regex_whitelist` and `op_type_regex_whitelist` - are set, the two filtering operations will occur in a logical `AND` - relation. In other words, a node will be included if and only if it - hits both whitelists. -* `global_step`: (`int`) Optional global_step count for this debug tensor - watch. - - -- - - - -### `tf_debug.watch_graph_with_blacklists(run_options, graph, debug_ops='DebugIdentity', debug_urls=None, node_name_regex_blacklist=None, op_type_regex_blacklist=None, global_step=-1)` {#watch_graph_with_blacklists} - -Add debug tensor watches, blacklisting nodes and op types. - -This is similar to `watch_graph()`, but the node names and op types are -blacklisted, instead of whitelisted. - -N.B.: Under certain circumstances, not all specified `Tensor`s will be - actually watched (e.g., nodes that are constant-folded during runtime will - not be watched). - -##### Args: - - -* `run_options`: An instance of `config_pb2.RunOptions` to be modified. -* `graph`: An instance of `ops.Graph`. -* `debug_ops`: (`str` or `list` of `str`) name(s) of the debug op(s) to use. -* `debug_urls`: URL(s) to send ebug values to, e.g., - `file:///tmp/tfdbg_dump_1`, `grpc://localhost:12345`. -* `node_name_regex_blacklist`: Regular-expression blacklist for node_name. - This should be a string, e.g., `"(weight_[0-9]+|bias_.*)"`. -* `op_type_regex_blacklist`: Regular-expression blacklist for the op type of - nodes, e.g., `"(Variable|Add)"`. - If both node_name_regex_blacklist and op_type_regex_blacklist - are set, the two filtering operations will occur in a logical `OR` - relation. In other words, a node will be excluded if it hits either of - the two blacklists; a node will be included if and only if it hits - neither of the blacklists. -* `global_step`: (`int`) Optional global_step count for this debug tensor - watch. - - -- - - - -### `class tf_debug.DebugTensorDatum` {#DebugTensorDatum} - -A single tensor dumped by TensorFlow Debugger (tfdbg). - -Contains metadata about the dumped tensor, including `timestamp`, -`node_name`, `output_slot`, `debug_op`, and path to the dump file -(`file_path`). - -This type does not hold the generally space-expensive tensor value (numpy -array). Instead, it points to the file from which the tensor value can be -loaded (with the `get_tensor` method) if needed. -- - - - -#### `tf_debug.DebugTensorDatum.__init__(dump_root, debug_dump_rel_path)` {#DebugTensorDatum.__init__} - -`DebugTensorDatum` constructor. - -##### Args: - - -* `dump_root`: (`str`) Debug dump root directory. -* `debug_dump_rel_path`: (`str`) Path to a debug dump file, relative to the - `dump_root`. For example, suppose the debug dump root - directory is `/tmp/tfdbg_1` and the dump file is at - `/tmp/tfdbg_1/ns_1/node_a_0_DebugIdentity_123456789`, then - the value of the debug_dump_rel_path should be - `ns_1/node_a_0_DebugIdenity_1234456789`. - -##### Raises: - - -* `ValueError`: If the base file name of the dump file does not conform to - the dump file naming pattern: - `node_name`_`output_slot`_`debug_op`_`timestamp` - - -- - - - -#### `tf_debug.DebugTensorDatum.__repr__()` {#DebugTensorDatum.__repr__} - - - - -- - - - -#### `tf_debug.DebugTensorDatum.__str__()` {#DebugTensorDatum.__str__} - - - - -- - - - -#### `tf_debug.DebugTensorDatum.debug_op` {#DebugTensorDatum.debug_op} - -Name of the debug op. - -##### Returns: - - (`str`) debug op name (e.g., `DebugIdentity`). - - -- - - - -#### `tf_debug.DebugTensorDatum.dump_size_bytes` {#DebugTensorDatum.dump_size_bytes} - -Size of the dump file. - -Unit: byte. - -##### Returns: - - If the dump file exists, size of the dump file, in bytes. - If the dump file does not exist, None. - - -- - - - -#### `tf_debug.DebugTensorDatum.file_path` {#DebugTensorDatum.file_path} - -Path to the file which stores the value of the dumped tensor. - - -- - - - -#### `tf_debug.DebugTensorDatum.get_tensor()` {#DebugTensorDatum.get_tensor} - -Get tensor from the dump (`Event`) file. - -##### Returns: - - The tensor loaded from the dump (`Event`) file. - - -- - - - -#### `tf_debug.DebugTensorDatum.node_name` {#DebugTensorDatum.node_name} - -Name of the node from which the tensor value was dumped. - -##### Returns: - - (`str`) name of the node watched by the debug op. - - -- - - - -#### `tf_debug.DebugTensorDatum.output_slot` {#DebugTensorDatum.output_slot} - -Output slot index from which the tensor value was dumped. - -##### Returns: - - (`int`) output slot index watched by the debug op. - - -- - - - -#### `tf_debug.DebugTensorDatum.tensor_name` {#DebugTensorDatum.tensor_name} - -Name of the tensor watched by the debug op. - -##### Returns: - - (`str`) `Tensor` name, in the form of `node_name`:`output_slot` - - -- - - - -#### `tf_debug.DebugTensorDatum.timestamp` {#DebugTensorDatum.timestamp} - -Timestamp of when this tensor value was dumped. - -##### Returns: - - (`int`) The timestamp in microseconds. - - -- - - - -#### `tf_debug.DebugTensorDatum.watch_key` {#DebugTensorDatum.watch_key} - -Watch key identities a debug watch on a tensor. - -##### Returns: - - (`str`) A watch key, in the form of `tensor_name`:`debug_op`. - - - -- - - - -### `class tf_debug.DebugDumpDir` {#DebugDumpDir} - -Data set from a debug-dump directory on filesystem. - -An instance of `DebugDumpDir` contains all `DebugTensorDatum` instances -in a tfdbg dump root directory. -- - - - -#### `tf_debug.DebugDumpDir.__init__(dump_root, partition_graphs=None, validate=True)` {#DebugDumpDir.__init__} - -`DebugDumpDir` constructor. - -##### Args: - - -* `dump_root`: (`str`) path to the dump root directory. -* `partition_graphs`: A repeated field of GraphDefs representing the - partition graphs executed by the TensorFlow runtime. -* `validate`: (`bool`) whether the dump files are to be validated against the - partition graphs. - -##### Raises: - - -* `IOError`: If dump_root does not exist as a directory. - - -- - - - -#### `tf_debug.DebugDumpDir.core_metadata` {#DebugDumpDir.core_metadata} - -Metadata about the `Session.run()` call from the core runtime. - -Of the three counters available in the return value, `global_step` is -supplied by the caller of the debugged `Session.run()`, while -`session_run_count` and `executor_step_count` are determined by the state -of the core runtime, automatically. For the same fetch list, feed keys and -debug tensor watch options, the same executor will be used and -`executor_step_count` should increase by one at a time. However, runs with -different fetch lists, feed keys and debug_tensor watch options that all -share the same `Session` object can lead to gaps in `session_run_count`. - -##### Returns: - - If core metadata are loaded, a `namedtuple` with the fields: - `global_step`: A global step count supplied by the caller of - `Session.run()`. It is optional to the caller. If the caller did not - supply this parameter, its value will be -1. - `session_run_count`: A counter for Run() calls to the underlying - TensorFlow `Session` object. - `executor_step_count`: A counter for invocations of a given runtime - executor. The same executor is re-used for the same fetched tensors, - target nodes, input feed keys and debug tensor watch options. - `input_names`: Names of the input (feed) Tensors. - `output_names`: Names of the output (fetched) Tensors. - `target_nodes`: Names of the target nodes. - If the core metadata have not been loaded, `None`. - - -- - - - -#### `tf_debug.DebugDumpDir.debug_watch_keys(node_name)` {#DebugDumpDir.debug_watch_keys} - -Get all tensor watch keys of given node according to partition graphs. - -##### Args: - - -* `node_name`: (`str`) name of the node. - -##### Returns: - - (`list` of `str`) all debug tensor watch keys. Returns an empty list if - the node name does not correspond to any debug watch keys. - -##### Raises: - - `LookupError`: If debug watch information has not been loaded from - partition graphs yet. - - -- - - - -#### `tf_debug.DebugDumpDir.devices()` {#DebugDumpDir.devices} - -Get the list of devices. - -##### Returns: - - (`list` of `str`) names of the devices. - -##### Raises: - - -* `LookupError`: If node inputs and control inputs have not been loaded - from partition graphs yet. - - -- - - - -#### `tf_debug.DebugDumpDir.dumped_tensor_data` {#DebugDumpDir.dumped_tensor_data} - - - - -- - - - -#### `tf_debug.DebugDumpDir.find(predicate, first_n=0)` {#DebugDumpDir.find} - -Find dumped tensor data by a certain predicate. - -##### Args: - - -* `predicate`: A callable that takes two input arguments: - - ```python - def predicate(debug_tensor_datum, tensor): - # returns a bool - ``` - - where `debug_tensor_datum` is an instance of `DebugTensorDatum`, which - carries the metadata, such as the `Tensor`'s node name, output slot - timestamp, debug op name, etc.; and `tensor` is the dumped tensor value - as a `numpy.ndarray`. - -* `first_n`: (`int`) return only the first n `DebugTensotDatum` instances (in - time order) for which the predicate returns True. To return all the - `DebugTensotDatum` instances, let first_n be <= 0. - -##### Returns: - - A list of all `DebugTensorDatum` objects in this `DebugDumpDir` object - for which predicate returns True, sorted in ascending order of the - timestamp. - - -- - - - -#### `tf_debug.DebugDumpDir.get_dump_sizes_bytes(node_name, output_slot, debug_op)` {#DebugDumpDir.get_dump_sizes_bytes} - -Get the sizes of the dump files for a debug-dumped tensor. - -Unit of the file size: byte. - -##### Args: - - -* `node_name`: (`str`) name of the node that the tensor is produced by. -* `output_slot`: (`int`) output slot index of tensor. -* `debug_op`: (`str`) name of the debug op. - -##### Returns: - - (`list` of `int`): list of dump file sizes in bytes. - -##### Raises: - - -* `ValueError`: If the tensor watch key does not exist in the debug dump data. - - -- - - - -#### `tf_debug.DebugDumpDir.get_rel_timestamps(node_name, output_slot, debug_op)` {#DebugDumpDir.get_rel_timestamps} - -Get the relative timestamp from for a debug-dumped tensor. - -Relative timestamp means (absolute timestamp - `t0`), where `t0` is the -absolute timestamp of the first dumped tensor in the dump root. The tensor -may be dumped multiple times in the dump root directory, so a list of -relative timestamps (`numpy.ndarray`) is returned. - -##### Args: - - -* `node_name`: (`str`) name of the node that the tensor is produced by. -* `output_slot`: (`int`) output slot index of tensor. -* `debug_op`: (`str`) name of the debug op. - -##### Returns: - - (`list` of `int`) list of relative timestamps. - -##### Raises: - - -* `ValueError`: If the tensor watch key does not exist in the debug dump data. - - -- - - - -#### `tf_debug.DebugDumpDir.get_tensor_file_paths(node_name, output_slot, debug_op)` {#DebugDumpDir.get_tensor_file_paths} - -Get the file paths from a debug-dumped tensor. - -##### Args: - - -* `node_name`: (`str`) name of the node that the tensor is produced by. -* `output_slot`: (`int`) output slot index of tensor. -* `debug_op`: (`str`) name of the debug op. - -##### Returns: - - List of file path(s) loaded. This is a list because each debugged tensor - may be dumped multiple times. - -##### Raises: - - -* `ValueError`: If the tensor does not exist in the debug-dump data. - - -- - - - -#### `tf_debug.DebugDumpDir.get_tensors(node_name, output_slot, debug_op)` {#DebugDumpDir.get_tensors} - -Get the tensor value from for a debug-dumped tensor. - -The tensor may be dumped multiple times in the dump root directory, so a -list of tensors (`numpy.ndarray`) is returned. - -##### Args: - - -* `node_name`: (`str`) name of the node that the tensor is produced by. -* `output_slot`: (`int`) output slot index of tensor. -* `debug_op`: (`str`) name of the debug op. - -##### Returns: - - List of tensors (`numpy.ndarray`) loaded from the debug-dump file(s). - -##### Raises: - - -* `ValueError`: If the tensor does not exist in the debug-dump data. - - -- - - - -#### `tf_debug.DebugDumpDir.loaded_partition_graphs()` {#DebugDumpDir.loaded_partition_graphs} - -Test whether partition graphs have been loaded. - - -- - - - -#### `tf_debug.DebugDumpDir.node_attributes(node_name)` {#DebugDumpDir.node_attributes} - -Get the attributes of a node. - -##### Args: - - -* `node_name`: Name of the node in question. - -##### Returns: - - Attributes of the node. - -##### Raises: - - -* `LookupError`: If no partition graphs have been loaded. -* `ValueError`: If no node named node_name exists. - - -- - - - -#### `tf_debug.DebugDumpDir.node_device(node_name)` {#DebugDumpDir.node_device} - -Get the device of a node. - -##### Args: - - -* `node_name`: (`str`) name of the node. - -##### Returns: - - (`str`) name of the device on which the node is placed. - -##### Raises: - - -* `LookupError`: If node inputs and control inputs have not been loaded - from partition graphs yet. -* `ValueError`: If the node does not exist in partition graphs. - - -- - - - -#### `tf_debug.DebugDumpDir.node_exists(node_name)` {#DebugDumpDir.node_exists} - -Test if a node exists in the partition graphs. - -##### Args: - - -* `node_name`: (`str`) name of the node to be checked. - -##### Returns: - - A boolean indicating whether the node exists. - -##### Raises: - - -* `LookupError`: If no partition graphs have been loaded yet. - - -- - - - -#### `tf_debug.DebugDumpDir.node_inputs(node_name, is_control=False)` {#DebugDumpDir.node_inputs} - -Get the inputs of given node according to partition graphs. - -##### Args: - - -* `node_name`: Name of the node. -* `is_control`: (`bool`) Whether control inputs, rather than non-control - inputs, are to be returned. - -##### Returns: - - (`list` of `str`) inputs to the node, as a list of node names. - -##### Raises: - - -* `LookupError`: If node inputs and control inputs have not been loaded - from partition graphs yet. -* `ValueError`: If the node does not exist in partition graphs. - - -- - - - -#### `tf_debug.DebugDumpDir.node_op_type(node_name)` {#DebugDumpDir.node_op_type} - -Get the op type of given node. - -##### Args: - - -* `node_name`: (`str`) name of the node. - -##### Returns: - - (`str`) op type of the node. - -##### Raises: - - -* `LookupError`: If node op types have not been loaded - from partition graphs yet. -* `ValueError`: If the node does not exist in partition graphs. - - -- - - - -#### `tf_debug.DebugDumpDir.node_recipients(node_name, is_control=False)` {#DebugDumpDir.node_recipients} - -Get recipient of the given node's output according to partition graphs. - -##### Args: - - -* `node_name`: (`str`) name of the node. -* `is_control`: (`bool`) whether control outputs, rather than non-control - outputs, are to be returned. - -##### Returns: - - (`list` of `str`) all inputs to the node, as a list of node names. - -##### Raises: - - -* `LookupError`: If node inputs and control inputs have not been loaded - from partition graphs yet. -* `ValueError`: If the node does not exist in partition graphs. - - -- - - - -#### `tf_debug.DebugDumpDir.node_traceback(element_name)` {#DebugDumpDir.node_traceback} - -Try to retrieve the Python traceback of node's construction. - -##### Args: - - -* `element_name`: (`str`) Name of a graph element (node or tensor). - -##### Returns: - - (list) The traceback list object as returned by the `extract_trace` - method of Python's traceback module. - -##### Raises: - - -* `LookupError`: If Python graph is not available for traceback lookup. -* `KeyError`: If the node cannot be found in the Python graph loaded. - - -- - - - -#### `tf_debug.DebugDumpDir.nodes()` {#DebugDumpDir.nodes} - -Get a list of all nodes from the partition graphs. - -##### Returns: - - All nodes' names, as a list of str. - -##### Raises: - - -* `LookupError`: If no partition graphs have been loaded. - - -- - - - -#### `tf_debug.DebugDumpDir.partition_graphs()` {#DebugDumpDir.partition_graphs} - -Get the partition graphs. - -##### Returns: - - Partition graphs as repeated fields of GraphDef. - -##### Raises: - - -* `LookupError`: If no partition graphs have been loaded. - - -- - - - -#### `tf_debug.DebugDumpDir.run_feed_keys_info` {#DebugDumpDir.run_feed_keys_info} - -Get a str representation of the feed_dict used in the Session.run() call. - -##### Returns: - - If the information is available, a `str` obtained from `repr(feed_dict)`. - If the information is not available, `None`. - - -- - - - -#### `tf_debug.DebugDumpDir.run_fetches_info` {#DebugDumpDir.run_fetches_info} - -Get a str representation of the fetches used in the Session.run() call. - -##### Returns: - - If the information is available, a `str` obtained from `repr(fetches)`. - If the information is not available, `None`. - - -- - - - -#### `tf_debug.DebugDumpDir.set_python_graph(python_graph)` {#DebugDumpDir.set_python_graph} - -Provide Python `Graph` object to the wrapper. - -Unlike the partition graphs, which are protobuf `GraphDef` objects, `Graph` -is a Python object and carries additional information such as the traceback -of the construction of the nodes in the graph. - -##### Args: - - -* `python_graph`: (ops.Graph) The Python Graph object. - - -- - - - -#### `tf_debug.DebugDumpDir.size` {#DebugDumpDir.size} - -Total number of dumped tensors in the dump root directory. - -##### Returns: - - (`int`) total number of dumped tensors in the dump root directory. - - -- - - - -#### `tf_debug.DebugDumpDir.t0` {#DebugDumpDir.t0} - -Absolute timestamp of the first dumped tensor. - -##### Returns: - - (`int`) absolute timestamp of the first dumped tensor, in microseconds. - - -- - - - -#### `tf_debug.DebugDumpDir.transitive_inputs(node_name, include_control=True)` {#DebugDumpDir.transitive_inputs} - -Get the transitive inputs of given node according to partition graphs. - -##### Args: - - -* `node_name`: Name of the node -* `include_control`: Include control inputs (True by default). - -##### Returns: - - (`list` of `str`) all transitive inputs to the node, as a list of node - names. - -##### Raises: - - -* `LookupError`: If node inputs and control inputs have not been loaded - from partition graphs yet. -* `ValueError`: If the node does not exist in partition graphs. - - -- - - - -#### `tf_debug.DebugDumpDir.watch_key_to_data(debug_watch_key)` {#DebugDumpDir.watch_key_to_data} - -Get all `DebugTensorDatum` instances corresponding to a debug watch key. - -##### Args: - - -* `debug_watch_key`: (`str`) debug watch key. - -##### Returns: - - A list of `DebugTensorDatum` instances that correspond to the debug watch - key. If the watch key does not exist, returns an empty list. - -##### Raises: - - -* `ValueError`: If the debug watch key does not exist. - - - -- - - - -### `tf_debug.load_tensor_from_event_file(event_file_path)` {#load_tensor_from_event_file} - -Load a tensor from an event file. - -Assumes that the event file contains a `Event` protobuf and the `Event` -protobuf contains a `Tensor` value. - -##### Args: - - -* `event_file_path`: (`str`) path to the event file. - -##### Returns: - - The tensor value loaded from the event file, as a `numpy.ndarray`. For - uninitialized Tensors, returns `None`. For Tensors of data types that - cannot be converted to `numpy.ndarray` (e.g., `tf.resource`), return - `None`. - - -- - - - -### `tf_debug.has_inf_or_nan(datum, tensor)` {#has_inf_or_nan} - -A predicate for whether a tensor consists of any bad numerical values. - -This predicate is common enough to merit definition in this module. -Bad numerical values include `nan`s and `inf`s. -The signature of this function follows the requirement of the method -`DebugDumpDir.find()`. - -##### Args: - - -* `datum`: (`DebugTensorDatum`) Datum metadata. -* `tensor`: (`numpy.ndarray` or None) Value of the tensor. None represents - an uninitialized tensor. - -##### Returns: - - (`bool`) True if and only if tensor consists of any nan or inf values. - - -- - - - -### `class tf_debug.DumpingDebugHook` {#DumpingDebugHook} - -A debugger hook that dumps debug data to filesystem. - -Can be used as a monitor/hook for `tf.train.MonitoredSession`s and -`tf.contrib.learn`'s `Estimator`s and `Experiment`s. -- - - - -#### `tf_debug.DumpingDebugHook.__enter__()` {#DumpingDebugHook.__enter__} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.__exit__(exec_type, exec_value, exec_tb)` {#DumpingDebugHook.__exit__} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.__init__(session_root, watch_fn=None, log_usage=True)` {#DumpingDebugHook.__init__} - -Create a local debugger command-line interface (CLI) hook. - -##### Args: - - -* `session_root`: See doc of - `dumping_wrapper.DumpingDebugWrapperSession.__init__`. -* `watch_fn`: See doc of - `dumping_wrapper.DumpingDebugWrapperSession.__init__`. -* `log_usage`: (bool) Whether usage is to be logged. - - -- - - - -#### `tf_debug.DumpingDebugHook.after_create_session(session, coord)` {#DumpingDebugHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf_debug.DumpingDebugHook.after_run(run_context, run_values)` {#DumpingDebugHook.after_run} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.before_run(run_context)` {#DumpingDebugHook.before_run} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.begin()` {#DumpingDebugHook.begin} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.close()` {#DumpingDebugHook.close} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.end(session)` {#DumpingDebugHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - -- - - - -#### `tf_debug.DumpingDebugHook.graph` {#DumpingDebugHook.graph} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.invoke_node_stepper(node_stepper, restore_variable_values_on_exit=True)` {#DumpingDebugHook.invoke_node_stepper} - -See doc of BaseDebugWrapperSession.invoke_node_stepper. - - -- - - - -#### `tf_debug.DumpingDebugHook.on_run_end(request)` {#DumpingDebugHook.on_run_end} - -See doc of BaseDebugWrapperSession.on_run_end. - - -- - - - -#### `tf_debug.DumpingDebugHook.on_run_start(request)` {#DumpingDebugHook.on_run_start} - -See doc of BaseDebugWrapperSession.on_run_start. - - -- - - - -#### `tf_debug.DumpingDebugHook.on_session_init(request)` {#DumpingDebugHook.on_session_init} - -See doc of BaseDebugWrapperSession.on_run_start. - - -- - - - -#### `tf_debug.DumpingDebugHook.partial_run(handle, fetches, feed_dict=None)` {#DumpingDebugHook.partial_run} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.partial_run_setup(fetches, feeds=None)` {#DumpingDebugHook.partial_run_setup} - -Sets up the feeds and fetches for partial runs in the session. - - -- - - - -#### `tf_debug.DumpingDebugHook.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#DumpingDebugHook.run} - -Wrapper around Session.run() that inserts tensor watch options. - -##### Args: - - -* `fetches`: Same as the `fetches` arg to regular `Session.run()`. -* `feed_dict`: Same as the `feed_dict` arg to regular `Session.run()`. -* `options`: Same as the `options` arg to regular `Session.run()`. -* `run_metadata`: Same as the `run_metadata` arg to regular `Session.run()`. - -##### Returns: - - Simply forwards the output of the wrapped `Session.run()` call. - -##### Raises: - - -* `ValueError`: On invalid `OnRunStartAction` value. - - -- - - - -#### `tf_debug.DumpingDebugHook.sess_str` {#DumpingDebugHook.sess_str} - - - - -- - - - -#### `tf_debug.DumpingDebugHook.session` {#DumpingDebugHook.session} - - - - - -- - - - -### `class tf_debug.DumpingDebugWrapperSession` {#DumpingDebugWrapperSession} - -Debug Session wrapper that dumps debug data to filesystem. -- - - - -#### `tf_debug.DumpingDebugWrapperSession.__enter__()` {#DumpingDebugWrapperSession.__enter__} - - - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.__exit__(exec_type, exec_value, exec_tb)` {#DumpingDebugWrapperSession.__exit__} - - - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.__init__(sess, session_root, watch_fn=None, log_usage=True)` {#DumpingDebugWrapperSession.__init__} - -Constructor of DumpingDebugWrapperSession. - -##### Args: - - -* `sess`: The TensorFlow `Session` object being wrapped. -* `session_root`: (`str`) Path to the session root directory. Must be a - directory that does not exist or an empty directory. If the directory - does not exist, it will be created by the debugger core during debug - [`Session.run()`](../../../g3doc/api_docs/python/client.md#session.run) - calls. - As the `run()` calls occur, subdirectories will be added to - `session_root`. The subdirectories' names has the following pattern: - run__ - E.g., run_1480734393835964_ad4c953a85444900ae79fc1b652fb324 -* `watch_fn`: (`Callable`) A Callable that can be used to define per-run - debug ops and watched tensors. See the doc of - `NonInteractiveDebugWrapperSession.__init__()` for details. -* `log_usage`: (`bool`) whether the usage of this class is to be logged. - -##### Raises: - - -* `ValueError`: If `session_root` is an existing and non-empty directory or - if `session_root` is a file. - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.close()` {#DumpingDebugWrapperSession.close} - - - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.graph` {#DumpingDebugWrapperSession.graph} - - - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.invoke_node_stepper(node_stepper, restore_variable_values_on_exit=True)` {#DumpingDebugWrapperSession.invoke_node_stepper} - -See doc of BaseDebugWrapperSession.invoke_node_stepper. - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.on_run_end(request)` {#DumpingDebugWrapperSession.on_run_end} - -See doc of BaseDebugWrapperSession.on_run_end. - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.on_run_start(request)` {#DumpingDebugWrapperSession.on_run_start} - -See doc of BaseDebugWrapperSession.on_run_start. - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.on_session_init(request)` {#DumpingDebugWrapperSession.on_session_init} - -See doc of BaseDebugWrapperSession.on_run_start. - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.partial_run(handle, fetches, feed_dict=None)` {#DumpingDebugWrapperSession.partial_run} - - - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.partial_run_setup(fetches, feeds=None)` {#DumpingDebugWrapperSession.partial_run_setup} - -Sets up the feeds and fetches for partial runs in the session. - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#DumpingDebugWrapperSession.run} - -Wrapper around Session.run() that inserts tensor watch options. - -##### Args: - - -* `fetches`: Same as the `fetches` arg to regular `Session.run()`. -* `feed_dict`: Same as the `feed_dict` arg to regular `Session.run()`. -* `options`: Same as the `options` arg to regular `Session.run()`. -* `run_metadata`: Same as the `run_metadata` arg to regular `Session.run()`. - -##### Returns: - - Simply forwards the output of the wrapped `Session.run()` call. - -##### Raises: - - -* `ValueError`: On invalid `OnRunStartAction` value. - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.sess_str` {#DumpingDebugWrapperSession.sess_str} - - - - -- - - - -#### `tf_debug.DumpingDebugWrapperSession.session` {#DumpingDebugWrapperSession.session} - - - - - -- - - - -### `class tf_debug.LocalCLIDebugHook` {#LocalCLIDebugHook} - -Command-line-interface debugger hook. - -Can be used as a monitor/hook for `tf.train.MonitoredSession`s and -`tf.contrib.learn`'s `Estimator`s and `Experiment`s. -- - - - -#### `tf_debug.LocalCLIDebugHook.__enter__()` {#LocalCLIDebugHook.__enter__} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.__exit__(exec_type, exec_value, exec_tb)` {#LocalCLIDebugHook.__exit__} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.__init__(ui_type='curses')` {#LocalCLIDebugHook.__init__} - -Create a local debugger command-line interface (CLI) hook. - -##### Args: - - -* `ui_type`: (str) user-interface type. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.add_tensor_filter(filter_name, tensor_filter)` {#LocalCLIDebugHook.add_tensor_filter} - -Add a tensor filter. - -See doc of `LocalCLIDebugWrapperSession.add_tensor_filter()` for details. -Override default behavior to accomodate the possibility of this method being -called prior to the initialization of the underlying -`LocalCLIDebugWrapperSession` object. - -##### Args: - - -* `filter_name`: See doc of `LocalCLIDebugWrapperSession.add_tensor_filter()` - for details. -* `tensor_filter`: See doc of - `LocalCLIDebugWrapperSession.add_tensor_filter()` for details. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.after_create_session(session, coord)` {#LocalCLIDebugHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.after_run(run_context, run_values)` {#LocalCLIDebugHook.after_run} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.before_run(run_context)` {#LocalCLIDebugHook.before_run} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.begin()` {#LocalCLIDebugHook.begin} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.close()` {#LocalCLIDebugHook.close} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.end(session)` {#LocalCLIDebugHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.graph` {#LocalCLIDebugHook.graph} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.invoke_node_stepper(node_stepper, restore_variable_values_on_exit=True)` {#LocalCLIDebugHook.invoke_node_stepper} - -Overrides method in base class to implement interactive node stepper. - -##### Args: - - -* `node_stepper`: (`stepper.NodeStepper`) The underlying NodeStepper API - object. -* `restore_variable_values_on_exit`: (`bool`) Whether any variables whose - values have been altered during this node-stepper invocation should be - restored to their old values when this invocation ends. - -##### Returns: - - The same return values as the `Session.run()` call on the same fetches as - the NodeStepper. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.on_run_end(request)` {#LocalCLIDebugHook.on_run_end} - -Overrides on-run-end callback. - -##### Actions taken: - - 1) Load the debug dump. - 2) Bring up the Analyzer CLI. - -##### Args: - - -* `request`: An instance of OnSessionInitRequest. - -##### Returns: - - An instance of OnSessionInitResponse. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.on_run_start(request)` {#LocalCLIDebugHook.on_run_start} - -Overrides on-run-start callback. - -##### Invoke the CLI to let user choose what action to take: - - `run` / `invoke_stepper`. - -##### Args: - - -* `request`: An instance of `OnSessionInitRequest`. - -##### Returns: - - An instance of `OnSessionInitResponse`. - -##### Raises: - - -* `RuntimeError`: If user chooses to prematurely exit the debugger. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.on_session_init(request)` {#LocalCLIDebugHook.on_session_init} - -Overrides on-session-init callback. - -##### Args: - - -* `request`: An instance of `OnSessionInitRequest`. - -##### Returns: - - An instance of `OnSessionInitResponse`. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.partial_run(handle, fetches, feed_dict=None)` {#LocalCLIDebugHook.partial_run} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.partial_run_setup(fetches, feeds=None)` {#LocalCLIDebugHook.partial_run_setup} - -Sets up the feeds and fetches for partial runs in the session. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#LocalCLIDebugHook.run} - -Wrapper around Session.run() that inserts tensor watch options. - -##### Args: - - -* `fetches`: Same as the `fetches` arg to regular `Session.run()`. -* `feed_dict`: Same as the `feed_dict` arg to regular `Session.run()`. -* `options`: Same as the `options` arg to regular `Session.run()`. -* `run_metadata`: Same as the `run_metadata` arg to regular `Session.run()`. - -##### Returns: - - Simply forwards the output of the wrapped `Session.run()` call. - -##### Raises: - - -* `ValueError`: On invalid `OnRunStartAction` value. - - -- - - - -#### `tf_debug.LocalCLIDebugHook.sess_str` {#LocalCLIDebugHook.sess_str} - - - - -- - - - -#### `tf_debug.LocalCLIDebugHook.session` {#LocalCLIDebugHook.session} - - - - - -- - - - -### `class tf_debug.LocalCLIDebugWrapperSession` {#LocalCLIDebugWrapperSession} - -Concrete subclass of BaseDebugWrapperSession implementing a local CLI. - -This class has all the methods that a `session.Session` object has, in order -to support debugging with minimal code changes. Invoking its `run()` method -will launch the command-line interface (CLI) of tfdbg. -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.__enter__()` {#LocalCLIDebugWrapperSession.__enter__} - - - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.__exit__(exec_type, exec_value, exec_tb)` {#LocalCLIDebugWrapperSession.__exit__} - - - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.__init__(sess, dump_root=None, log_usage=True, ui_type='curses')` {#LocalCLIDebugWrapperSession.__init__} - -Constructor of LocalCLIDebugWrapperSession. - -##### Args: - - -* `sess`: The TensorFlow `Session` object being wrapped. -* `dump_root`: (`str`) optional path to the dump root directory. Must be a - directory that does not exist or an empty directory. If the directory - does not exist, it will be created by the debugger core during debug - `run()` calls and removed afterwards. -* `log_usage`: (`bool`) whether the usage of this class is to be logged. -* `ui_type`: (`str`) requested UI type. Currently supported: - (curses | readline) - -##### Raises: - - -* `ValueError`: If dump_root is an existing and non-empty directory or if - dump_root is a file. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.add_tensor_filter(filter_name, tensor_filter)` {#LocalCLIDebugWrapperSession.add_tensor_filter} - -Add a tensor filter. - -##### Args: - - -* `filter_name`: (`str`) name of the filter. -* `tensor_filter`: (`callable`) the filter callable. See the doc string of - `DebugDumpDir.find()` for more details about its signature. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.close()` {#LocalCLIDebugWrapperSession.close} - - - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.graph` {#LocalCLIDebugWrapperSession.graph} - - - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.invoke_node_stepper(node_stepper, restore_variable_values_on_exit=True)` {#LocalCLIDebugWrapperSession.invoke_node_stepper} - -Overrides method in base class to implement interactive node stepper. - -##### Args: - - -* `node_stepper`: (`stepper.NodeStepper`) The underlying NodeStepper API - object. -* `restore_variable_values_on_exit`: (`bool`) Whether any variables whose - values have been altered during this node-stepper invocation should be - restored to their old values when this invocation ends. - -##### Returns: - - The same return values as the `Session.run()` call on the same fetches as - the NodeStepper. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.on_run_end(request)` {#LocalCLIDebugWrapperSession.on_run_end} - -Overrides on-run-end callback. - -##### Actions taken: - - 1) Load the debug dump. - 2) Bring up the Analyzer CLI. - -##### Args: - - -* `request`: An instance of OnSessionInitRequest. - -##### Returns: - - An instance of OnSessionInitResponse. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.on_run_start(request)` {#LocalCLIDebugWrapperSession.on_run_start} - -Overrides on-run-start callback. - -##### Invoke the CLI to let user choose what action to take: - - `run` / `invoke_stepper`. - -##### Args: - - -* `request`: An instance of `OnSessionInitRequest`. - -##### Returns: - - An instance of `OnSessionInitResponse`. - -##### Raises: - - -* `RuntimeError`: If user chooses to prematurely exit the debugger. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.on_session_init(request)` {#LocalCLIDebugWrapperSession.on_session_init} - -Overrides on-session-init callback. - -##### Args: - - -* `request`: An instance of `OnSessionInitRequest`. - -##### Returns: - - An instance of `OnSessionInitResponse`. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.partial_run(handle, fetches, feed_dict=None)` {#LocalCLIDebugWrapperSession.partial_run} - - - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.partial_run_setup(fetches, feeds=None)` {#LocalCLIDebugWrapperSession.partial_run_setup} - -Sets up the feeds and fetches for partial runs in the session. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#LocalCLIDebugWrapperSession.run} - -Wrapper around Session.run() that inserts tensor watch options. - -##### Args: - - -* `fetches`: Same as the `fetches` arg to regular `Session.run()`. -* `feed_dict`: Same as the `feed_dict` arg to regular `Session.run()`. -* `options`: Same as the `options` arg to regular `Session.run()`. -* `run_metadata`: Same as the `run_metadata` arg to regular `Session.run()`. - -##### Returns: - - Simply forwards the output of the wrapped `Session.run()` call. - -##### Raises: - - -* `ValueError`: On invalid `OnRunStartAction` value. - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.sess_str` {#LocalCLIDebugWrapperSession.sess_str} - - - - -- - - - -#### `tf_debug.LocalCLIDebugWrapperSession.session` {#LocalCLIDebugWrapperSession.session} - - - - - diff --git a/tensorflow/g3doc/api_docs/python/train.md b/tensorflow/g3doc/api_docs/python/train.md deleted file mode 100644 index 06f0087ac2..0000000000 --- a/tensorflow/g3doc/api_docs/python/train.md +++ /dev/null @@ -1,6664 +0,0 @@ - - -# Training -[TOC] - -Support for training models. See the @{$python/train} guide. - -- - - - -### `class tf.train.Optimizer` {#Optimizer} - -Base class for optimizers. - -This class defines the API to add Ops to train a model. You never use this -class directly, but instead instantiate one of its subclasses such as -`GradientDescentOptimizer`, `AdagradOptimizer`, or `MomentumOptimizer`. - -### Usage - -```python -# Create an optimizer with the desired parameters. -opt = GradientDescentOptimizer(learning_rate=0.1) -# Add Ops to the graph to minimize a cost by updating a list of variables. -# "cost" is a Tensor, and the list of variables contains tf.Variable -# objects. -opt_op = opt.minimize(cost, var_list=) -``` - -In the training program you will just have to run the returned Op. - -```python -# Execute opt_op to do one step of training: -opt_op.run() -``` - -### Processing gradients before applying them. - -Calling `minimize()` takes care of both computing the gradients and -applying them to the variables. If you want to process the gradients -before applying them you can instead use the optimizer in three steps: - -1. Compute the gradients with `compute_gradients()`. -2. Process the gradients as you wish. -3. Apply the processed gradients with `apply_gradients()`. - -Example: - -```python -# Create an optimizer. -opt = GradientDescentOptimizer(learning_rate=0.1) - -# Compute the gradients for a list of variables. -grads_and_vars = opt.compute_gradients(loss, ) - -# grads_and_vars is a list of tuples (gradient, variable). Do whatever you -# need to the 'gradient' part, for example cap them, etc. -capped_grads_and_vars = [(MyCapper(gv[0]), gv[1]) for gv in grads_and_vars] - -# Ask the optimizer to apply the capped gradients. -opt.apply_gradients(capped_grads_and_vars) -``` - -- - - - -#### `tf.train.Optimizer.__init__(use_locking, name)` {#Optimizer.__init__} - -Create a new Optimizer. - -This must be called by the constructors of subclasses. - -##### Args: - - -* `use_locking`: Bool. If True apply use locks to prevent concurrent updates - to variables. -* `name`: A non-empty string. The name to use for accumulators created - for the optimizer. - -##### Raises: - - -* `ValueError`: If name is malformed. - - - -- - - - -#### `tf.train.Optimizer.minimize(loss, global_step=None, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, name=None, grad_loss=None)` {#Optimizer.minimize} - -Add operations to minimize `loss` by updating `var_list`. - -This method simply combines calls `compute_gradients()` and -`apply_gradients()`. If you want to process the gradient before applying -them call `compute_gradients()` and `apply_gradients()` explicitly instead -of using this function. - -##### Args: - - -* `loss`: A `Tensor` containing the value to minimize. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `name`: Optional name for the returned operation. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - An Operation that updates the variables in `var_list`. If `global_step` - was not `None`, that operation also increments `global_step`. - -##### Raises: - - -* `ValueError`: If some of the variables are not `Variable` objects. - - -- - - - -#### `tf.train.Optimizer.compute_gradients(loss, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, grad_loss=None)` {#Optimizer.compute_gradients} - -Compute gradients of `loss` for the variables in `var_list`. - -This is the first part of `minimize()`. It returns a list -of (gradient, variable) pairs where "gradient" is the gradient -for "variable". Note that "gradient" can be a `Tensor`, an -`IndexedSlices`, or `None` if there is no gradient for the -given variable. - -##### Args: - - -* `loss`: A Tensor containing the value to minimize. -* `var_list`: Optional list of `tf.Variable` to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKey.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - A list of (gradient, variable) pairs. Variable is always present, but - gradient can be `None`. - -##### Raises: - - -* `TypeError`: If `var_list` contains anything else than `Variable` objects. -* `ValueError`: If some arguments are invalid. - - -- - - - -#### `tf.train.Optimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#Optimizer.apply_gradients} - -Apply gradients to variables. - -This is the second part of `minimize()`. It returns an `Operation` that -applies gradients. - -##### Args: - - -* `grads_and_vars`: List of (gradient, variable) pairs as returned by - `compute_gradients()`. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `name`: Optional name for the returned operation. Default to the - name passed to the `Optimizer` constructor. - -##### Returns: - - An `Operation` that applies the specified gradients. If `global_step` - was not None, that operation also increments `global_step`. - -##### Raises: - - -* `TypeError`: If `grads_and_vars` is malformed. -* `ValueError`: If none of the variables have gradients. - - - -### Gating Gradients - -Both `minimize()` and `compute_gradients()` accept a `gate_gradients` -argument that controls the degree of parallelism during the application of -the gradients. - -The possible values are: `GATE_NONE`, `GATE_OP`, and `GATE_GRAPH`. - -`GATE_NONE`: Compute and apply gradients in parallel. This provides -the maximum parallelism in execution, at the cost of some non-reproducibility -in the results. For example the two gradients of `matmul` depend on the input -values: With `GATE_NONE` one of the gradients could be applied to one of the -inputs _before_ the other gradient is computed resulting in non-reproducible -results. - -`GATE_OP`: For each Op, make sure all gradients are computed before -they are used. This prevents race conditions for Ops that generate gradients -for multiple inputs where the gradients depend on the inputs. - -`GATE_GRAPH`: Make sure all gradients for all variables are computed -before any one of them is used. This provides the least parallelism but can -be useful if you want to process all gradients before applying any of them. - -### Slots - -Some optimizer subclasses, such as `MomentumOptimizer` and `AdagradOptimizer` -allocate and manage additional variables associated with the variables to -train. These are called Slots. Slots have names and you can ask the -optimizer for the names of the slots that it uses. Once you have a slot name -you can ask the optimizer for the variable it created to hold the slot value. - -This can be useful if you want to log debug a training algorithm, report stats -about the slots, etc. - -- - - - -#### `tf.train.Optimizer.get_slot_names()` {#Optimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -See `get_slot()`. - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.train.Optimizer.get_slot(var, name)` {#Optimizer.get_slot} - -Return a slot named `name` created for `var` by the Optimizer. - -Some `Optimizer` subclasses use additional variables. For example -`Momentum` and `Adagrad` use variables to accumulate updates. This method -gives access to these `Variable` objects if for some reason you need them. - -Use `get_slot_names()` to get the list of slot names created by the -`Optimizer`. - -##### Args: - - -* `var`: A variable passed to `minimize()` or `apply_gradients()`. -* `name`: A string. - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - - -#### Other Methods -- - - - -#### `tf.train.Optimizer.get_name()` {#Optimizer.get_name} - - - - - -- - - - -### `class tf.train.GradientDescentOptimizer` {#GradientDescentOptimizer} - -Optimizer that implements the gradient descent algorithm. - -- - - - -#### `tf.train.GradientDescentOptimizer.__init__(learning_rate, use_locking=False, name='GradientDescent')` {#GradientDescentOptimizer.__init__} - -Construct a new gradient descent optimizer. - -##### Args: - - -* `learning_rate`: A Tensor or a floating point value. The learning - rate to use. -* `use_locking`: If True use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "GradientDescent". - - - -- - - - -### `class tf.train.AdadeltaOptimizer` {#AdadeltaOptimizer} - -Optimizer that implements the Adadelta algorithm. - -See [M. D. Zeiler](http://arxiv.org/abs/1212.5701) -([pdf](http://arxiv.org/pdf/1212.5701v1.pdf)) -- - - - -#### `tf.train.AdadeltaOptimizer.__init__(learning_rate=0.001, rho=0.95, epsilon=1e-08, use_locking=False, name='Adadelta')` {#AdadeltaOptimizer.__init__} - -Construct a new Adadelta optimizer. - -##### Args: - - -* `learning_rate`: A `Tensor` or a floating point value. The learning rate. -* `rho`: A `Tensor` or a floating point value. The decay rate. -* `epsilon`: A `Tensor` or a floating point value. A constant epsilon used - to better conditioning the grad update. -* `use_locking`: If `True` use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "Adadelta". - - -- - - - -#### `tf.train.AdadeltaOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#AdadeltaOptimizer.apply_gradients} - -Apply gradients to variables. - -This is the second part of `minimize()`. It returns an `Operation` that -applies gradients. - -##### Args: - - -* `grads_and_vars`: List of (gradient, variable) pairs as returned by - `compute_gradients()`. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `name`: Optional name for the returned operation. Default to the - name passed to the `Optimizer` constructor. - -##### Returns: - - An `Operation` that applies the specified gradients. If `global_step` - was not None, that operation also increments `global_step`. - -##### Raises: - - -* `TypeError`: If `grads_and_vars` is malformed. -* `ValueError`: If none of the variables have gradients. - - -- - - - -#### `tf.train.AdadeltaOptimizer.compute_gradients(loss, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, grad_loss=None)` {#AdadeltaOptimizer.compute_gradients} - -Compute gradients of `loss` for the variables in `var_list`. - -This is the first part of `minimize()`. It returns a list -of (gradient, variable) pairs where "gradient" is the gradient -for "variable". Note that "gradient" can be a `Tensor`, an -`IndexedSlices`, or `None` if there is no gradient for the -given variable. - -##### Args: - - -* `loss`: A Tensor containing the value to minimize. -* `var_list`: Optional list of `tf.Variable` to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKey.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - A list of (gradient, variable) pairs. Variable is always present, but - gradient can be `None`. - -##### Raises: - - -* `TypeError`: If `var_list` contains anything else than `Variable` objects. -* `ValueError`: If some arguments are invalid. - - -- - - - -#### `tf.train.AdadeltaOptimizer.get_name()` {#AdadeltaOptimizer.get_name} - - - - -- - - - -#### `tf.train.AdadeltaOptimizer.get_slot(var, name)` {#AdadeltaOptimizer.get_slot} - -Return a slot named `name` created for `var` by the Optimizer. - -Some `Optimizer` subclasses use additional variables. For example -`Momentum` and `Adagrad` use variables to accumulate updates. This method -gives access to these `Variable` objects if for some reason you need them. - -Use `get_slot_names()` to get the list of slot names created by the -`Optimizer`. - -##### Args: - - -* `var`: A variable passed to `minimize()` or `apply_gradients()`. -* `name`: A string. - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - -- - - - -#### `tf.train.AdadeltaOptimizer.get_slot_names()` {#AdadeltaOptimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -See `get_slot()`. - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.train.AdadeltaOptimizer.minimize(loss, global_step=None, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, name=None, grad_loss=None)` {#AdadeltaOptimizer.minimize} - -Add operations to minimize `loss` by updating `var_list`. - -This method simply combines calls `compute_gradients()` and -`apply_gradients()`. If you want to process the gradient before applying -them call `compute_gradients()` and `apply_gradients()` explicitly instead -of using this function. - -##### Args: - - -* `loss`: A `Tensor` containing the value to minimize. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `name`: Optional name for the returned operation. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - An Operation that updates the variables in `var_list`. If `global_step` - was not `None`, that operation also increments `global_step`. - -##### Raises: - - -* `ValueError`: If some of the variables are not `Variable` objects. - - - -- - - - -### `class tf.train.AdagradOptimizer` {#AdagradOptimizer} - -Optimizer that implements the Adagrad algorithm. - -See this [paper](http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf) -or this -[intro](http://cs.stanford.edu/~ppasupat/a9online/uploads/proximal_notes.pdf). -- - - - -#### `tf.train.AdagradOptimizer.__init__(learning_rate, initial_accumulator_value=0.1, use_locking=False, name='Adagrad')` {#AdagradOptimizer.__init__} - -Construct a new Adagrad optimizer. - -##### Args: - - -* `learning_rate`: A `Tensor` or a floating point value. The learning rate. -* `initial_accumulator_value`: A floating point value. - Starting value for the accumulators, must be positive. -* `use_locking`: If `True` use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "Adagrad". - -##### Raises: - - -* `ValueError`: If the `initial_accumulator_value` is invalid. - - -- - - - -#### `tf.train.AdagradOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#AdagradOptimizer.apply_gradients} - -Apply gradients to variables. - -This is the second part of `minimize()`. It returns an `Operation` that -applies gradients. - -##### Args: - - -* `grads_and_vars`: List of (gradient, variable) pairs as returned by - `compute_gradients()`. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `name`: Optional name for the returned operation. Default to the - name passed to the `Optimizer` constructor. - -##### Returns: - - An `Operation` that applies the specified gradients. If `global_step` - was not None, that operation also increments `global_step`. - -##### Raises: - - -* `TypeError`: If `grads_and_vars` is malformed. -* `ValueError`: If none of the variables have gradients. - - -- - - - -#### `tf.train.AdagradOptimizer.compute_gradients(loss, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, grad_loss=None)` {#AdagradOptimizer.compute_gradients} - -Compute gradients of `loss` for the variables in `var_list`. - -This is the first part of `minimize()`. It returns a list -of (gradient, variable) pairs where "gradient" is the gradient -for "variable". Note that "gradient" can be a `Tensor`, an -`IndexedSlices`, or `None` if there is no gradient for the -given variable. - -##### Args: - - -* `loss`: A Tensor containing the value to minimize. -* `var_list`: Optional list of `tf.Variable` to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKey.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - A list of (gradient, variable) pairs. Variable is always present, but - gradient can be `None`. - -##### Raises: - - -* `TypeError`: If `var_list` contains anything else than `Variable` objects. -* `ValueError`: If some arguments are invalid. - - -- - - - -#### `tf.train.AdagradOptimizer.get_name()` {#AdagradOptimizer.get_name} - - - - -- - - - -#### `tf.train.AdagradOptimizer.get_slot(var, name)` {#AdagradOptimizer.get_slot} - -Return a slot named `name` created for `var` by the Optimizer. - -Some `Optimizer` subclasses use additional variables. For example -`Momentum` and `Adagrad` use variables to accumulate updates. This method -gives access to these `Variable` objects if for some reason you need them. - -Use `get_slot_names()` to get the list of slot names created by the -`Optimizer`. - -##### Args: - - -* `var`: A variable passed to `minimize()` or `apply_gradients()`. -* `name`: A string. - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - -- - - - -#### `tf.train.AdagradOptimizer.get_slot_names()` {#AdagradOptimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -See `get_slot()`. - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.train.AdagradOptimizer.minimize(loss, global_step=None, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, name=None, grad_loss=None)` {#AdagradOptimizer.minimize} - -Add operations to minimize `loss` by updating `var_list`. - -This method simply combines calls `compute_gradients()` and -`apply_gradients()`. If you want to process the gradient before applying -them call `compute_gradients()` and `apply_gradients()` explicitly instead -of using this function. - -##### Args: - - -* `loss`: A `Tensor` containing the value to minimize. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `name`: Optional name for the returned operation. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - An Operation that updates the variables in `var_list`. If `global_step` - was not `None`, that operation also increments `global_step`. - -##### Raises: - - -* `ValueError`: If some of the variables are not `Variable` objects. - - - -- - - - -### `class tf.train.AdagradDAOptimizer` {#AdagradDAOptimizer} - -Adagrad Dual Averaging algorithm for sparse linear models. - -See this [paper](http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf). - -This optimizer takes care of regularization of unseen features in a mini batch -by updating them when they are seen with a closed form update rule that is -equivalent to having updated them on every mini-batch. - -AdagradDA is typically used when there is a need for large sparsity in the -trained model. This optimizer only guarantees sparsity for linear models. Be -careful when using AdagradDA for deep networks as it will require careful -initialization of the gradient accumulators for it to train. -- - - - -#### `tf.train.AdagradDAOptimizer.__init__(learning_rate, global_step, initial_gradient_squared_accumulator_value=0.1, l1_regularization_strength=0.0, l2_regularization_strength=0.0, use_locking=False, name='AdagradDA')` {#AdagradDAOptimizer.__init__} - -Construct a new AdagradDA optimizer. - -##### Args: - - -* `learning_rate`: A `Tensor` or a floating point value. The learning rate. -* `global_step`: A `Tensor` containing the current training step number. -* `initial_gradient_squared_accumulator_value`: A floating point value. - Starting value for the accumulators, must be positive. -* `l1_regularization_strength`: A float value, must be greater than or - equal to zero. -* `l2_regularization_strength`: A float value, must be greater than or - equal to zero. -* `use_locking`: If `True` use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "AdagradDA". - -##### Raises: - - -* `ValueError`: If the `initial_gradient_squared_accumulator_value` is - invalid. - - -- - - - -#### `tf.train.AdagradDAOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#AdagradDAOptimizer.apply_gradients} - -Apply gradients to variables. - -This is the second part of `minimize()`. It returns an `Operation` that -applies gradients. - -##### Args: - - -* `grads_and_vars`: List of (gradient, variable) pairs as returned by - `compute_gradients()`. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `name`: Optional name for the returned operation. Default to the - name passed to the `Optimizer` constructor. - -##### Returns: - - An `Operation` that applies the specified gradients. If `global_step` - was not None, that operation also increments `global_step`. - -##### Raises: - - -* `TypeError`: If `grads_and_vars` is malformed. -* `ValueError`: If none of the variables have gradients. - - -- - - - -#### `tf.train.AdagradDAOptimizer.compute_gradients(loss, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, grad_loss=None)` {#AdagradDAOptimizer.compute_gradients} - -Compute gradients of `loss` for the variables in `var_list`. - -This is the first part of `minimize()`. It returns a list -of (gradient, variable) pairs where "gradient" is the gradient -for "variable". Note that "gradient" can be a `Tensor`, an -`IndexedSlices`, or `None` if there is no gradient for the -given variable. - -##### Args: - - -* `loss`: A Tensor containing the value to minimize. -* `var_list`: Optional list of `tf.Variable` to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKey.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - A list of (gradient, variable) pairs. Variable is always present, but - gradient can be `None`. - -##### Raises: - - -* `TypeError`: If `var_list` contains anything else than `Variable` objects. -* `ValueError`: If some arguments are invalid. - - -- - - - -#### `tf.train.AdagradDAOptimizer.get_name()` {#AdagradDAOptimizer.get_name} - - - - -- - - - -#### `tf.train.AdagradDAOptimizer.get_slot(var, name)` {#AdagradDAOptimizer.get_slot} - -Return a slot named `name` created for `var` by the Optimizer. - -Some `Optimizer` subclasses use additional variables. For example -`Momentum` and `Adagrad` use variables to accumulate updates. This method -gives access to these `Variable` objects if for some reason you need them. - -Use `get_slot_names()` to get the list of slot names created by the -`Optimizer`. - -##### Args: - - -* `var`: A variable passed to `minimize()` or `apply_gradients()`. -* `name`: A string. - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - -- - - - -#### `tf.train.AdagradDAOptimizer.get_slot_names()` {#AdagradDAOptimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -See `get_slot()`. - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.train.AdagradDAOptimizer.minimize(loss, global_step=None, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, name=None, grad_loss=None)` {#AdagradDAOptimizer.minimize} - -Add operations to minimize `loss` by updating `var_list`. - -This method simply combines calls `compute_gradients()` and -`apply_gradients()`. If you want to process the gradient before applying -them call `compute_gradients()` and `apply_gradients()` explicitly instead -of using this function. - -##### Args: - - -* `loss`: A `Tensor` containing the value to minimize. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `name`: Optional name for the returned operation. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - An Operation that updates the variables in `var_list`. If `global_step` - was not `None`, that operation also increments `global_step`. - -##### Raises: - - -* `ValueError`: If some of the variables are not `Variable` objects. - - - -- - - - -### `class tf.train.MomentumOptimizer` {#MomentumOptimizer} - -Optimizer that implements the Momentum algorithm. - -- - - - -#### `tf.train.MomentumOptimizer.__init__(learning_rate, momentum, use_locking=False, name='Momentum', use_nesterov=False)` {#MomentumOptimizer.__init__} - -Construct a new Momentum optimizer. - -##### Args: - - -* `learning_rate`: A `Tensor` or a floating point value. The learning rate. -* `momentum`: A `Tensor` or a floating point value. The momentum. -* `use_locking`: If `True` use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "Momentum". -* `use_nesterov`: If `True` use Nesterov Momentum. - See [Sutskever et. al., 2013]( -* `http`: //jmlr.org/proceedings/papers/v28/sutskever13.pdf) - - - -- - - - -### `class tf.train.AdamOptimizer` {#AdamOptimizer} - -Optimizer that implements the Adam algorithm. - -See [Kingma et. al., 2014](http://arxiv.org/abs/1412.6980) -([pdf](http://arxiv.org/pdf/1412.6980.pdf)). -- - - - -#### `tf.train.AdamOptimizer.__init__(learning_rate=0.001, beta1=0.9, beta2=0.999, epsilon=1e-08, use_locking=False, name='Adam')` {#AdamOptimizer.__init__} - -Construct a new Adam optimizer. - -Initialization: - -``` -m_0 <- 0 (Initialize initial 1st moment vector) -v_0 <- 0 (Initialize initial 2nd moment vector) -t <- 0 (Initialize timestep) -``` - -The update rule for `variable` with gradient `g` uses an optimization -described at the end of section2 of the paper: - -``` -t <- t + 1 -lr_t <- learning_rate * sqrt(1 - beta2^t) / (1 - beta1^t) - -m_t <- beta1 * m_{t-1} + (1 - beta1) * g -v_t <- beta2 * v_{t-1} + (1 - beta2) * g * g -variable <- variable - lr_t * m_t / (sqrt(v_t) + epsilon) -``` - -The default value of 1e-8 for epsilon might not be a good default in -general. For example, when training an Inception network on ImageNet a -current good choice is 1.0 or 0.1. - -Note that in dense implement of this algorithm, m_t, v_t and variable will -update even if g is zero, but in sparse implement, m_t, v_t and variable -will not update in iterations g is zero. - -##### Args: - - -* `learning_rate`: A Tensor or a floating point value. The learning rate. -* `beta1`: A float value or a constant float tensor. - The exponential decay rate for the 1st moment estimates. -* `beta2`: A float value or a constant float tensor. - The exponential decay rate for the 2nd moment estimates. -* `epsilon`: A small constant for numerical stability. -* `use_locking`: If True use locks for update operations. -* `name`: Optional name for the operations created when applying gradients. - Defaults to "Adam". - - -- - - - -#### `tf.train.AdamOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#AdamOptimizer.apply_gradients} - -Apply gradients to variables. - -This is the second part of `minimize()`. It returns an `Operation` that -applies gradients. - -##### Args: - - -* `grads_and_vars`: List of (gradient, variable) pairs as returned by - `compute_gradients()`. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `name`: Optional name for the returned operation. Default to the - name passed to the `Optimizer` constructor. - -##### Returns: - - An `Operation` that applies the specified gradients. If `global_step` - was not None, that operation also increments `global_step`. - -##### Raises: - - -* `TypeError`: If `grads_and_vars` is malformed. -* `ValueError`: If none of the variables have gradients. - - -- - - - -#### `tf.train.AdamOptimizer.compute_gradients(loss, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, grad_loss=None)` {#AdamOptimizer.compute_gradients} - -Compute gradients of `loss` for the variables in `var_list`. - -This is the first part of `minimize()`. It returns a list -of (gradient, variable) pairs where "gradient" is the gradient -for "variable". Note that "gradient" can be a `Tensor`, an -`IndexedSlices`, or `None` if there is no gradient for the -given variable. - -##### Args: - - -* `loss`: A Tensor containing the value to minimize. -* `var_list`: Optional list of `tf.Variable` to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKey.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - A list of (gradient, variable) pairs. Variable is always present, but - gradient can be `None`. - -##### Raises: - - -* `TypeError`: If `var_list` contains anything else than `Variable` objects. -* `ValueError`: If some arguments are invalid. - - -- - - - -#### `tf.train.AdamOptimizer.get_name()` {#AdamOptimizer.get_name} - - - - -- - - - -#### `tf.train.AdamOptimizer.get_slot(var, name)` {#AdamOptimizer.get_slot} - -Return a slot named `name` created for `var` by the Optimizer. - -Some `Optimizer` subclasses use additional variables. For example -`Momentum` and `Adagrad` use variables to accumulate updates. This method -gives access to these `Variable` objects if for some reason you need them. - -Use `get_slot_names()` to get the list of slot names created by the -`Optimizer`. - -##### Args: - - -* `var`: A variable passed to `minimize()` or `apply_gradients()`. -* `name`: A string. - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - -- - - - -#### `tf.train.AdamOptimizer.get_slot_names()` {#AdamOptimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -See `get_slot()`. - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.train.AdamOptimizer.minimize(loss, global_step=None, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, name=None, grad_loss=None)` {#AdamOptimizer.minimize} - -Add operations to minimize `loss` by updating `var_list`. - -This method simply combines calls `compute_gradients()` and -`apply_gradients()`. If you want to process the gradient before applying -them call `compute_gradients()` and `apply_gradients()` explicitly instead -of using this function. - -##### Args: - - -* `loss`: A `Tensor` containing the value to minimize. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `name`: Optional name for the returned operation. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - An Operation that updates the variables in `var_list`. If `global_step` - was not `None`, that operation also increments `global_step`. - -##### Raises: - - -* `ValueError`: If some of the variables are not `Variable` objects. - - - -- - - - -### `class tf.train.FtrlOptimizer` {#FtrlOptimizer} - -Optimizer that implements the FTRL algorithm. - -See this [paper]( -https://www.eecs.tufts.edu/~dsculley/papers/ad-click-prediction.pdf). -- - - - -#### `tf.train.FtrlOptimizer.__init__(learning_rate, learning_rate_power=-0.5, initial_accumulator_value=0.1, l1_regularization_strength=0.0, l2_regularization_strength=0.0, use_locking=False, name='Ftrl')` {#FtrlOptimizer.__init__} - -Construct a new FTRL optimizer. - -##### Args: - - -* `learning_rate`: A float value or a constant float `Tensor`. -* `learning_rate_power`: A float value, must be less or equal to zero. -* `initial_accumulator_value`: The starting value for accumulators. - Only positive values are allowed. -* `l1_regularization_strength`: A float value, must be greater than or - equal to zero. -* `l2_regularization_strength`: A float value, must be greater than or - equal to zero. -* `use_locking`: If `True` use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "Ftrl". - -##### Raises: - - -* `ValueError`: If one of the arguments is invalid. - - -- - - - -#### `tf.train.FtrlOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#FtrlOptimizer.apply_gradients} - -Apply gradients to variables. - -This is the second part of `minimize()`. It returns an `Operation` that -applies gradients. - -##### Args: - - -* `grads_and_vars`: List of (gradient, variable) pairs as returned by - `compute_gradients()`. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `name`: Optional name for the returned operation. Default to the - name passed to the `Optimizer` constructor. - -##### Returns: - - An `Operation` that applies the specified gradients. If `global_step` - was not None, that operation also increments `global_step`. - -##### Raises: - - -* `TypeError`: If `grads_and_vars` is malformed. -* `ValueError`: If none of the variables have gradients. - - -- - - - -#### `tf.train.FtrlOptimizer.compute_gradients(loss, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, grad_loss=None)` {#FtrlOptimizer.compute_gradients} - -Compute gradients of `loss` for the variables in `var_list`. - -This is the first part of `minimize()`. It returns a list -of (gradient, variable) pairs where "gradient" is the gradient -for "variable". Note that "gradient" can be a `Tensor`, an -`IndexedSlices`, or `None` if there is no gradient for the -given variable. - -##### Args: - - -* `loss`: A Tensor containing the value to minimize. -* `var_list`: Optional list of `tf.Variable` to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKey.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - A list of (gradient, variable) pairs. Variable is always present, but - gradient can be `None`. - -##### Raises: - - -* `TypeError`: If `var_list` contains anything else than `Variable` objects. -* `ValueError`: If some arguments are invalid. - - -- - - - -#### `tf.train.FtrlOptimizer.get_name()` {#FtrlOptimizer.get_name} - - - - -- - - - -#### `tf.train.FtrlOptimizer.get_slot(var, name)` {#FtrlOptimizer.get_slot} - -Return a slot named `name` created for `var` by the Optimizer. - -Some `Optimizer` subclasses use additional variables. For example -`Momentum` and `Adagrad` use variables to accumulate updates. This method -gives access to these `Variable` objects if for some reason you need them. - -Use `get_slot_names()` to get the list of slot names created by the -`Optimizer`. - -##### Args: - - -* `var`: A variable passed to `minimize()` or `apply_gradients()`. -* `name`: A string. - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - -- - - - -#### `tf.train.FtrlOptimizer.get_slot_names()` {#FtrlOptimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -See `get_slot()`. - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.train.FtrlOptimizer.minimize(loss, global_step=None, var_list=None, gate_gradients=1, aggregation_method=None, colocate_gradients_with_ops=False, name=None, grad_loss=None)` {#FtrlOptimizer.minimize} - -Add operations to minimize `loss` by updating `var_list`. - -This method simply combines calls `compute_gradients()` and -`apply_gradients()`. If you want to process the gradient before applying -them call `compute_gradients()` and `apply_gradients()` explicitly instead -of using this function. - -##### Args: - - -* `loss`: A `Tensor` containing the value to minimize. -* `global_step`: Optional `Variable` to increment by one after the - variables have been updated. -* `var_list`: Optional list of `Variable` objects to update to minimize - `loss`. Defaults to the list of variables collected in the graph - under the key `GraphKeys.TRAINABLE_VARIABLES`. -* `gate_gradients`: How to gate the computation of gradients. Can be - `GATE_NONE`, `GATE_OP`, or `GATE_GRAPH`. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Valid values are defined in the class `AggregationMethod`. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `name`: Optional name for the returned operation. -* `grad_loss`: Optional. A `Tensor` holding the gradient computed for `loss`. - -##### Returns: - - An Operation that updates the variables in `var_list`. If `global_step` - was not `None`, that operation also increments `global_step`. - -##### Raises: - - -* `ValueError`: If some of the variables are not `Variable` objects. - - - -- - - - -### `class tf.train.ProximalGradientDescentOptimizer` {#ProximalGradientDescentOptimizer} - -Optimizer that implements the proximal gradient descent algorithm. - -See this [paper](http://papers.nips.cc/paper/3793-efficient-learning-using-forward-backward-splitting.pdf). - -- - - - -#### `tf.train.ProximalGradientDescentOptimizer.__init__(learning_rate, l1_regularization_strength=0.0, l2_regularization_strength=0.0, use_locking=False, name='ProximalGradientDescent')` {#ProximalGradientDescentOptimizer.__init__} - -Construct a new proximal gradient descent optimizer. - -##### Args: - - -* `learning_rate`: A Tensor or a floating point value. The learning - rate to use. -* `l1_regularization_strength`: A float value, must be greater than or - equal to zero. -* `l2_regularization_strength`: A float value, must be greater than or - equal to zero. -* `use_locking`: If True use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "GradientDescent". - - - -- - - - -### `class tf.train.ProximalAdagradOptimizer` {#ProximalAdagradOptimizer} - -Optimizer that implements the Proximal Adagrad algorithm. - -See this [paper](http://papers.nips.cc/paper/3793-efficient-learning-using-forward-backward-splitting.pdf). - -- - - - -#### `tf.train.ProximalAdagradOptimizer.__init__(learning_rate, initial_accumulator_value=0.1, l1_regularization_strength=0.0, l2_regularization_strength=0.0, use_locking=False, name='ProximalAdagrad')` {#ProximalAdagradOptimizer.__init__} - -Construct a new ProximalAdagrad optimizer. - -##### Args: - - -* `learning_rate`: A `Tensor` or a floating point value. The learning rate. -* `initial_accumulator_value`: A floating point value. - Starting value for the accumulators, must be positive. -* `l1_regularization_strength`: A float value, must be greater than or - equal to zero. -* `l2_regularization_strength`: A float value, must be greater than or - equal to zero. -* `use_locking`: If `True` use locks for update operations. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "Adagrad". - -##### Raises: - - -* `ValueError`: If the `initial_accumulator_value` is invalid. - - - -- - - - -### `class tf.train.RMSPropOptimizer` {#RMSPropOptimizer} - -Optimizer that implements the RMSProp algorithm. - -See the [paper](http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf). - -- - - - -#### `tf.train.RMSPropOptimizer.__init__(learning_rate, decay=0.9, momentum=0.0, epsilon=1e-10, use_locking=False, centered=False, name='RMSProp')` {#RMSPropOptimizer.__init__} - -Construct a new RMSProp optimizer. - -Note that in dense implement of this algorithm, m_t and v_t will -update even if g is zero, but in sparse implement, m_t and v_t -will not update in iterations g is zero. - -##### Args: - - -* `learning_rate`: A Tensor or a floating point value. The learning rate. -* `decay`: Discounting factor for the history/coming gradient -* `momentum`: A scalar tensor. -* `epsilon`: Small value to avoid zero denominator. -* `use_locking`: If True use locks for update operation. -* `centered`: If True, gradients are normalized by the estimated variance of - the gradient; if False, by the uncentered second moment. Setting this to - True may help with training, but is slightly more expensive in terms of - computation and memory. Defaults to False. -* `name`: Optional name prefix for the operations created when applying - gradients. Defaults to "RMSProp". - - - -- - - - -### `tf.gradients(ys, xs, grad_ys=None, name='gradients', colocate_gradients_with_ops=False, gate_gradients=False, aggregation_method=None)` {#gradients} - -Constructs symbolic partial derivatives of sum of `ys` w.r.t. x in `xs`. - -`ys` and `xs` are each a `Tensor` or a list of tensors. `grad_ys` -is a list of `Tensor`, holding the gradients received by the -`ys`. The list must be the same length as `ys`. - -`gradients()` adds ops to the graph to output the partial -derivatives of `ys` with respect to `xs`. It returns a list of -`Tensor` of length `len(xs)` where each tensor is the `sum(dy/dx)` -for y in `ys`. - -`grad_ys` is a list of tensors of the same length as `ys` that holds -the initial gradients for each y in `ys`. When `grad_ys` is None, -we fill in a tensor of '1's of the shape of y for each y in `ys`. A -user can provide their own initial `grad_ys` to compute the -derivatives using a different initial gradient for each y (e.g., if -one wanted to weight the gradient differently for each value in -each y). - -##### Args: - - -* `ys`: A `Tensor` or list of tensors to be differentiated. -* `xs`: A `Tensor` or list of tensors to be used for differentiation. -* `grad_ys`: Optional. A `Tensor` or list of tensors the same size as - `ys` and holding the gradients computed for each y in `ys`. -* `name`: Optional name to use for grouping all the gradient ops together. - defaults to 'gradients'. -* `colocate_gradients_with_ops`: If True, try colocating gradients with - the corresponding op. -* `gate_gradients`: If True, add a tuple around the gradients returned - for an operations. This avoids some race conditions. -* `aggregation_method`: Specifies the method used to combine gradient terms. - Accepted values are constants defined in the class `AggregationMethod`. - -##### Returns: - - A list of `sum(dy/dx)` for each x in `xs`. - -##### Raises: - - -* `LookupError`: if one of the operations between `x` and `y` does not - have a registered gradient function. -* `ValueError`: if the arguments are invalid. - - -- - - - -### `class tf.AggregationMethod` {#AggregationMethod} - -A class listing aggregation methods used to combine gradients. - -Computing partial derivatives can require aggregating gradient -contributions. This class lists the various methods that can -be used to combine gradients in the graph: - -* `ADD_N`: All of the gradient terms are summed as part of one - operation using the "AddN" op. It has the property that all - gradients must be ready before any aggregation is performed. -* `DEFAULT`: The system-chosen default aggregation method. - -- - - - -### `tf.stop_gradient(input, name=None)` {#stop_gradient} - -Stops gradient computation. - -When executed in a graph, this op outputs its input tensor as-is. - -When building ops to compute gradients, this op prevents the contribution of -its inputs to be taken into account. Normally, the gradient generator adds ops -to a graph to compute the derivatives of a specified 'loss' by recursively -finding out inputs that contributed to its computation. If you insert this op -in the graph it inputs are masked from the gradient generator. They are not -taken into account for computing gradients. - -This is useful any time you want to compute a value with TensorFlow but need -to pretend that the value was a constant. Some examples include: - -* The *EM* algorithm where the *M-step* should not involve backpropagation - through the output of the *E-step*. -* Contrastive divergence training of Boltzmann machines where, when - differentiating the energy function, the training must not backpropagate - through the graph that generated the samples from the model. -* Adversarial training, where no backprop should happen through the adversarial - example generation process. - -##### Args: - - -* `input`: A `Tensor`. -* `name`: A name for the operation (optional). - -##### Returns: - - A `Tensor`. Has the same type as `input`. - - -- - - - -### `tf.hessians(ys, xs, name='hessians', colocate_gradients_with_ops=False, gate_gradients=False, aggregation_method=None)` {#hessians} - -Constructs the Hessian of sum of `ys` with respect to `x` in `xs`. - -`hessians()` adds ops to the graph to output the Hessian matrix of `ys` -with respect to `xs`. It returns a list of `Tensor` of length `len(xs)` -where each tensor is the Hessian of `sum(ys)`. This function currently -only supports evaluating the Hessian with respect to (a list of) one- -dimensional tensors. - -The Hessian is a matrix of second-order partial derivatives of a scalar -tensor (see https://en.wikipedia.org/wiki/Hessian_matrix for more details). - -##### Args: - - -* `ys`: A `Tensor` or list of tensors to be differentiated. -* `xs`: A `Tensor` or list of tensors to be used for differentiation. -* `name`: Optional name to use for grouping all the gradient ops together. - defaults to 'hessians'. -* `colocate_gradients_with_ops`: See `gradients()` documentation for details. -* `gate_gradients`: See `gradients()` documentation for details. -* `aggregation_method`: See `gradients()` documentation for details. - -##### Returns: - - A list of Hessian matrices of `sum(y)` for each `x` in `xs`. - -##### Raises: - - -* `LookupError`: if one of the operations between `xs` and `ys` does not - have a registered gradient function. -* `ValueError`: if the arguments are invalid or not supported. Currently, - this function only supports one-dimensional `x` in `xs`. - - -- - - - -### `tf.clip_by_value(t, clip_value_min, clip_value_max, name=None)` {#clip_by_value} - -Clips tensor values to a specified min and max. - -Given a tensor `t`, this operation returns a tensor of the same type and -shape as `t` with its values clipped to `clip_value_min` and `clip_value_max`. -Any values less than `clip_value_min` are set to `clip_value_min`. Any values -greater than `clip_value_max` are set to `clip_value_max`. - -##### Args: - - -* `t`: A `Tensor`. -* `clip_value_min`: A 0-D (scalar) `Tensor`. The minimum value to clip by. -* `clip_value_max`: A 0-D (scalar) `Tensor`. The maximum value to clip by. -* `name`: A name for the operation (optional). - -##### Returns: - - A clipped `Tensor`. - - -- - - - -### `tf.clip_by_norm(t, clip_norm, axes=None, name=None)` {#clip_by_norm} - -Clips tensor values to a maximum L2-norm. - -Given a tensor `t`, and a maximum clip value `clip_norm`, this operation -normalizes `t` so that its L2-norm is less than or equal to `clip_norm`, -along the dimensions given in `axes`. Specifically, in the default case -where all dimensions are used for calculation, if the L2-norm of `t` is -already less than or equal to `clip_norm`, then `t` is not modified. If -the L2-norm is greater than `clip_norm`, then this operation returns a -tensor of the same type and shape as `t` with its values set to: - -`t * clip_norm / l2norm(t)` - -In this case, the L2-norm of the output tensor is `clip_norm`. - -As another example, if `t` is a matrix and `axes == [1]`, then each row -of the output will have L2-norm equal to `clip_norm`. If `axes == [0]` -instead, each column of the output will be clipped. - -This operation is typically used to clip gradients before applying them with -an optimizer. - -##### Args: - - -* `t`: A `Tensor`. -* `clip_norm`: A 0-D (scalar) `Tensor` > 0. A maximum clipping value. -* `axes`: A 1-D (vector) `Tensor` of type int32 containing the dimensions - to use for computing the L2-norm. If `None` (the default), uses all - dimensions. -* `name`: A name for the operation (optional). - -##### Returns: - - A clipped `Tensor`. - - -- - - - -### `tf.clip_by_average_norm(t, clip_norm, name=None)` {#clip_by_average_norm} - -Clips tensor values to a maximum average L2-norm. - -Given a tensor `t`, and a maximum clip value `clip_norm`, this operation -normalizes `t` so that its average L2-norm is less than or equal to -`clip_norm`. Specifically, if the average L2-norm is already less than or -equal to `clip_norm`, then `t` is not modified. If the average L2-norm is -greater than `clip_norm`, then this operation returns a tensor of the same -type and shape as `t` with its values set to: - -`t * clip_norm / l2norm_avg(t)` - -In this case, the average L2-norm of the output tensor is `clip_norm`. - -This operation is typically used to clip gradients before applying them with -an optimizer. - -##### Args: - - -* `t`: A `Tensor`. -* `clip_norm`: A 0-D (scalar) `Tensor` > 0. A maximum clipping value. -* `name`: A name for the operation (optional). - -##### Returns: - - A clipped `Tensor`. - - -- - - - -### `tf.clip_by_global_norm(t_list, clip_norm, use_norm=None, name=None)` {#clip_by_global_norm} - -Clips values of multiple tensors by the ratio of the sum of their norms. - -Given a tuple or list of tensors `t_list`, and a clipping ratio `clip_norm`, -this operation returns a list of clipped tensors `list_clipped` -and the global norm (`global_norm`) of all tensors in `t_list`. Optionally, -if you've already computed the global norm for `t_list`, you can specify -the global norm with `use_norm`. - -To perform the clipping, the values `t_list[i]` are set to: - - t_list[i] * clip_norm / max(global_norm, clip_norm) - -where: - - global_norm = sqrt(sum([l2norm(t)**2 for t in t_list])) - -If `clip_norm > global_norm` then the entries in `t_list` remain as they are, -otherwise they're all shrunk by the global ratio. - -Any of the entries of `t_list` that are of type `None` are ignored. - -This is the correct way to perform gradient clipping (for example, see -[Pascanu et al., 2012](http://arxiv.org/abs/1211.5063) -([pdf](http://arxiv.org/pdf/1211.5063.pdf))). - -However, it is slower than `clip_by_norm()` because all the parameters must be -ready before the clipping operation can be performed. - -##### Args: - - -* `t_list`: A tuple or list of mixed `Tensors`, `IndexedSlices`, or None. -* `clip_norm`: A 0-D (scalar) `Tensor` > 0. The clipping ratio. -* `use_norm`: A 0-D (scalar) `Tensor` of type `float` (optional). The global - norm to use. If not provided, `global_norm()` is used to compute the norm. -* `name`: A name for the operation (optional). - -##### Returns: - - -* `list_clipped`: A list of `Tensors` of the same type as `list_t`. -* `global_norm`: A 0-D (scalar) `Tensor` representing the global norm. - -##### Raises: - - -* `TypeError`: If `t_list` is not a sequence. - - -- - - - -### `tf.global_norm(t_list, name=None)` {#global_norm} - -Computes the global norm of multiple tensors. - -Given a tuple or list of tensors `t_list`, this operation returns the -global norm of the elements in all tensors in `t_list`. The global norm is -computed as: - -`global_norm = sqrt(sum([l2norm(t)**2 for t in t_list]))` - -Any entries in `t_list` that are of type None are ignored. - -##### Args: - - -* `t_list`: A tuple or list of mixed `Tensors`, `IndexedSlices`, or None. -* `name`: A name for the operation (optional). - -##### Returns: - - A 0-D (scalar) `Tensor` of type `float`. - -##### Raises: - - -* `TypeError`: If `t_list` is not a sequence. - - -- - - - -### `tf.train.exponential_decay(learning_rate, global_step, decay_steps, decay_rate, staircase=False, name=None)` {#exponential_decay} - -Applies exponential decay to the learning rate. - -When training a model, it is often recommended to lower the learning rate as -the training progresses. This function applies an exponential decay function -to a provided initial learning rate. It requires a `global_step` value to -compute the decayed learning rate. You can just pass a TensorFlow variable -that you increment at each training step. - -The function returns the decayed learning rate. It is computed as: - -```python -decayed_learning_rate = learning_rate * - decay_rate ^ (global_step / decay_steps) -``` - -If the argument `staircase` is `True`, then `global_step / decay_steps` is an -integer division and the decayed learning rate follows a staircase function. - -Example: decay every 100000 steps with a base of 0.96: - -```python -... -global_step = tf.Variable(0, trainable=False) -starter_learning_rate = 0.1 -learning_rate = tf.train.exponential_decay(starter_learning_rate, global_step, - 100000, 0.96, staircase=True) -# Passing global_step to minimize() will increment it at each step. -learning_step = ( - tf.train.GradientDescentOptimizer(learning_rate) - .minimize(...my loss..., global_step=global_step) -) -``` - -##### Args: - - -* `learning_rate`: A scalar `float32` or `float64` `Tensor` or a - Python number. The initial learning rate. -* `global_step`: A scalar `int32` or `int64` `Tensor` or a Python number. - Global step to use for the decay computation. Must not be negative. -* `decay_steps`: A scalar `int32` or `int64` `Tensor` or a Python number. - Must be positive. See the decay computation above. -* `decay_rate`: A scalar `float32` or `float64` `Tensor` or a - Python number. The decay rate. -* `staircase`: Boolean. If `True` decay the learning rate at discrete intervals -* `name`: String. Optional name of the operation. Defaults to - 'ExponentialDecay'. - -##### Returns: - - A scalar `Tensor` of the same type as `learning_rate`. The decayed - learning rate. - -##### Raises: - - -* `ValueError`: if `global_step` is not supplied. - - -- - - - -### `tf.train.inverse_time_decay(learning_rate, global_step, decay_steps, decay_rate, staircase=False, name=None)` {#inverse_time_decay} - -Applies inverse time decay to the initial learning rate. - -When training a model, it is often recommended to lower the learning rate as -the training progresses. This function applies an inverse decay function -to a provided initial learning rate. It requires an `global_step` value to -compute the decayed learning rate. You can just pass a TensorFlow variable -that you increment at each training step. - -The function returns the decayed learning rate. It is computed as: - -```python -decayed_learning_rate = learning_rate / (1 + decay_rate * t) -``` - -Example: decay 1/t with a rate of 0.5: - -```python -... -global_step = tf.Variable(0, trainable=False) -learning_rate = 0.1 -k = 0.5 -learning_rate = tf.train.inverse_time_decay(learning_rate, global_step, k) - -# Passing global_step to minimize() will increment it at each step. -learning_step = ( - tf.train.GradientDescentOptimizer(learning_rate) - .minimize(...my loss..., global_step=global_step) -) -``` - -##### Args: - - -* `learning_rate`: A scalar `float32` or `float64` `Tensor` or a - Python number. The initial learning rate. -* `global_step`: A Python number. - Global step to use for the decay computation. Must not be negative. -* `decay_steps`: How often to apply decay. -* `decay_rate`: A Python number. The decay rate. -* `staircase`: Whether to apply decay in a discrete staircase, as opposed to - continuous, fashion. -* `name`: String. Optional name of the operation. Defaults to - 'InverseTimeDecay'. - -##### Returns: - - A scalar `Tensor` of the same type as `learning_rate`. The decayed - learning rate. - -##### Raises: - - -* `ValueError`: if `global_step` is not supplied. - - -- - - - -### `tf.train.natural_exp_decay(learning_rate, global_step, decay_steps, decay_rate, staircase=False, name=None)` {#natural_exp_decay} - -Applies natural exponential decay to the initial learning rate. - -When training a model, it is often recommended to lower the learning rate as -the training progresses. This function applies an exponential decay function -to a provided initial learning rate. It requires an `global_step` value to -compute the decayed learning rate. You can just pass a TensorFlow variable -that you increment at each training step. - -The function returns the decayed learning rate. It is computed as: - -```python -decayed_learning_rate = learning_rate * exp(-decay_rate * global_step) -``` - -Example: decay exponentially with a base of 0.96: - -```python -... -global_step = tf.Variable(0, trainable=False) -learning_rate = 0.1 -k = 0.5 -learning_rate = tf.train.exponential_time_decay(learning_rate, global_step, k) - -# Passing global_step to minimize() will increment it at each step. -learning_step = ( - tf.train.GradientDescentOptimizer(learning_rate) - .minimize(...my loss..., global_step=global_step) -) -``` - -##### Args: - - -* `learning_rate`: A scalar `float32` or `float64` `Tensor` or a - Python number. The initial learning rate. -* `global_step`: A Python number. - Global step to use for the decay computation. Must not be negative. -* `decay_steps`: How often to apply decay. -* `decay_rate`: A Python number. The decay rate. -* `staircase`: Whether to apply decay in a discrete staircase, as opposed to - continuous, fashion. -* `name`: String. Optional name of the operation. Defaults to - 'ExponentialTimeDecay'. - -##### Returns: - - A scalar `Tensor` of the same type as `learning_rate`. The decayed - learning rate. - -##### Raises: - - -* `ValueError`: if `global_step` is not supplied. - - -- - - - -### `tf.train.piecewise_constant(x, boundaries, values, name=None)` {#piecewise_constant} - -Piecewise constant from boundaries and interval values. - -Example: use a learning rate that's 1.0 for the first 100000 steps, 0.5 - for steps 100001 to 110000, and 0.1 for any additional steps. - -```python -global_step = tf.Variable(0, trainable=False) -boundaries = [100000, 110000] -values = [1.0, 0.5, 0.1] -learning_rate = tf.train.piecewise_constant(global_step, boundaries, values) - -# Later, whenever we perform an optimization step, we increment global_step. -``` - -##### Args: - - -* `x`: A 0-D scalar `Tensor`. Must be one of the following types: `float32`, - `float64`, `uint8`, `int8`, `int16`, `int32`, `int64`. -* `boundaries`: A list of `Tensor`s or `int`s or `float`s with strictly - increasing entries, and with all elements having the same type as `x`. -* `values`: A list of `Tensor`s or float`s or `int`s that specifies the values - for the intervals defined by `boundaries`. It should have one more element - than `boundaries`, and all elements should have the same type. -* `name`: A string. Optional name of the operation. Defaults to - 'PiecewiseConstant'. - -##### Returns: - - A 0-D Tensor. Its value is `values[0]` when `x <= boundaries[0]`, - `values[1]` when `x > boundaries[0]` and `x <= boundaries[1]`, ..., - and values[-1] when `x > boundaries[-1]`. - -##### Raises: - - -* `ValueError`: if types of `x` and `buondaries` do not match, or types of all - `values` do not match. - - -- - - - -### `tf.train.polynomial_decay(learning_rate, global_step, decay_steps, end_learning_rate=0.0001, power=1.0, cycle=False, name=None)` {#polynomial_decay} - -Applies a polynomial decay to the learning rate. - -It is commonly observed that a monotonically decreasing learning rate, whose -degree of change is carefully chosen, results in a better performing model. -This function applies a polynomial decay function to a provided initial -`learning_rate` to reach an `end_learning_rate` in the given `decay_steps`. - -It requires a `global_step` value to compute the decayed learning rate. You -can just pass a TensorFlow variable that you increment at each training step. - -The function returns the decayed learning rate. It is computed as: - -```python -global_step = min(global_step, decay_steps) -decayed_learning_rate = (learning_rate - end_learning_rate) * - (1 - global_step / decay_steps) ^ (power) + - end_learning_rate - -``` - -If `cycle` is True then a multiple of `decay_steps` is used, the first one -that is bigger than `global_steps`. - -```python -decay_steps = decay_steps * ceil(global_step / decay_steps) -decayed_learning_rate = (learning_rate - end_learning_rate) * - (1 - global_step / decay_steps) ^ (power) + - end_learning_rate - -``` - -Example: decay from 0.1 to 0.01 in 10000 steps using sqrt (i.e. power=0.5): - -```python -... -global_step = tf.Variable(0, trainable=False) -starter_learning_rate = 0.1 -end_learning_rate = 0.01 -decay_steps = 10000 -learning_rate = tf.train.polynomial_decay(starter_learning_rate, global_step, - decay_steps, end_learning_rate, - power=0.5) -# Passing global_step to minimize() will increment it at each step. -learning_step = ( - tf.train.GradientDescentOptimizer(learning_rate) - .minimize(...my loss..., global_step=global_step) -) -``` - -##### Args: - - -* `learning_rate`: A scalar `float32` or `float64` `Tensor` or a - Python number. The initial learning rate. -* `global_step`: A scalar `int32` or `int64` `Tensor` or a Python number. - Global step to use for the decay computation. Must not be negative. -* `decay_steps`: A scalar `int32` or `int64` `Tensor` or a Python number. - Must be positive. See the decay computation above. -* `end_learning_rate`: A scalar `float32` or `float64` `Tensor` or a - Python number. The minimal end learning rate. -* `power`: A scalar `float32` or `float64` `Tensor` or a - Python number. The power of the polynomial. Defaults to sqrt, i.e. 0.5. -* `cycle`: A boolean, whether or not it should cycle beyond decay_steps. -* `name`: String. Optional name of the operation. Defaults to - 'PolynomialDecay'. - -##### Returns: - - A scalar `Tensor` of the same type as `learning_rate`. The decayed - learning rate. - -##### Raises: - - -* `ValueError`: if `global_step` is not supplied. - - -- - - - -### `class tf.train.ExponentialMovingAverage` {#ExponentialMovingAverage} - -Maintains moving averages of variables by employing an exponential decay. - -When training a model, it is often beneficial to maintain moving averages of -the trained parameters. Evaluations that use averaged parameters sometimes -produce significantly better results than the final trained values. - -The `apply()` method adds shadow copies of trained variables and add ops that -maintain a moving average of the trained variables in their shadow copies. -It is used when building the training model. The ops that maintain moving -averages are typically run after each training step. -The `average()` and `average_name()` methods give access to the shadow -variables and their names. They are useful when building an evaluation -model, or when restoring a model from a checkpoint file. They help use the -moving averages in place of the last trained values for evaluations. - -The moving averages are computed using exponential decay. You specify the -decay value when creating the `ExponentialMovingAverage` object. The shadow -variables are initialized with the same initial values as the trained -variables. When you run the ops to maintain the moving averages, each -shadow variable is updated with the formula: - - `shadow_variable -= (1 - decay) * (shadow_variable - variable)` - -This is mathematically equivalent to the classic formula below, but the use -of an `assign_sub` op (the `"-="` in the formula) allows concurrent lockless -updates to the variables: - - `shadow_variable = decay * shadow_variable + (1 - decay) * variable` - -Reasonable values for `decay` are close to 1.0, typically in the -multiple-nines range: 0.999, 0.9999, etc. - -Example usage when creating a training model: - -```python -# Create variables. -var0 = tf.Variable(...) -var1 = tf.Variable(...) -# ... use the variables to build a training model... -... -# Create an op that applies the optimizer. This is what we usually -# would use as a training op. -opt_op = opt.minimize(my_loss, [var0, var1]) - -# Create an ExponentialMovingAverage object -ema = tf.train.ExponentialMovingAverage(decay=0.9999) - -# Create the shadow variables, and add ops to maintain moving averages -# of var0 and var1. -maintain_averages_op = ema.apply([var0, var1]) - -# Create an op that will update the moving averages after each training -# step. This is what we will use in place of the usual training op. -with tf.control_dependencies([opt_op]): - training_op = tf.group(maintain_averages_op) - -...train the model by running training_op... -``` - -There are two ways to use the moving averages for evaluations: - -* Build a model that uses the shadow variables instead of the variables. - For this, use the `average()` method which returns the shadow variable - for a given variable. -* Build a model normally but load the checkpoint files to evaluate by using - the shadow variable names. For this use the `average_name()` method. See - the [Saver class](../../api_docs/python/train.md#Saver) for more - information on restoring saved variables. - -Example of restoring the shadow variable values: - -```python -# Create a Saver that loads variables from their saved shadow values. -shadow_var0_name = ema.average_name(var0) -shadow_var1_name = ema.average_name(var1) -saver = tf.train.Saver({shadow_var0_name: var0, shadow_var1_name: var1}) -saver.restore(...checkpoint filename...) -# var0 and var1 now hold the moving average values -``` - -- - - - -#### `tf.train.ExponentialMovingAverage.__init__(decay, num_updates=None, zero_debias=False, name='ExponentialMovingAverage')` {#ExponentialMovingAverage.__init__} - -Creates a new ExponentialMovingAverage object. - -The `apply()` method has to be called to create shadow variables and add -ops to maintain moving averages. - -The optional `num_updates` parameter allows one to tweak the decay rate -dynamically. It is typical to pass the count of training steps, usually -kept in a variable that is incremented at each step, in which case the -decay rate is lower at the start of training. This makes moving averages -move faster. If passed, the actual decay rate used is: - - `min(decay, (1 + num_updates) / (10 + num_updates))` - -##### Args: - - -* `decay`: Float. The decay to use. -* `num_updates`: Optional count of number of updates applied to variables. -* `zero_debias`: If `True`, zero debias moving-averages that are initialized - with tensors. -* `name`: String. Optional prefix name to use for the name of ops added in - `apply()`. - - -- - - - -#### `tf.train.ExponentialMovingAverage.apply(var_list=None)` {#ExponentialMovingAverage.apply} - -Maintains moving averages of variables. - -`var_list` must be a list of `Variable` or `Tensor` objects. This method -creates shadow variables for all elements of `var_list`. Shadow variables -for `Variable` objects are initialized to the variable's initial value. -They will be added to the `GraphKeys.MOVING_AVERAGE_VARIABLES` collection. -For `Tensor` objects, the shadow variables are initialized to 0 and zero -debiased (see docstring in `assign_moving_average` for more details). - -shadow variables are created with `trainable=False` and added to the -`GraphKeys.ALL_VARIABLES` collection. They will be returned by calls to -`tf.global_variables()`. - -Returns an op that updates all shadow variables as described above. - -Note that `apply()` can be called multiple times with different lists of -variables. - -##### Args: - - -* `var_list`: A list of Variable or Tensor objects. The variables - and Tensors must be of types float16, float32, or float64. - -##### Returns: - - An Operation that updates the moving averages. - -##### Raises: - - -* `TypeError`: If the arguments are not all float16, float32, or float64. -* `ValueError`: If the moving average of one of the variables is already - being computed. - - -- - - - -#### `tf.train.ExponentialMovingAverage.average_name(var)` {#ExponentialMovingAverage.average_name} - -Returns the name of the `Variable` holding the average for `var`. - -The typical scenario for `ExponentialMovingAverage` is to compute moving -averages of variables during training, and restore the variables from the -computed moving averages during evaluations. - -To restore variables, you have to know the name of the shadow variables. -That name and the original variable can then be passed to a `Saver()` object -to restore the variable from the moving average value with: - `saver = tf.train.Saver({ema.average_name(var): var})` - -`average_name()` can be called whether or not `apply()` has been called. - -##### Args: - - -* `var`: A `Variable` object. - -##### Returns: - - A string: The name of the variable that will be used or was used - by the `ExponentialMovingAverage class` to hold the moving average of - `var`. - - -- - - - -#### `tf.train.ExponentialMovingAverage.average(var)` {#ExponentialMovingAverage.average} - -Returns the `Variable` holding the average of `var`. - -##### Args: - - -* `var`: A `Variable` object. - -##### Returns: - - A `Variable` object or `None` if the moving average of `var` - is not maintained. - - -- - - - -#### `tf.train.ExponentialMovingAverage.variables_to_restore(moving_avg_variables=None)` {#ExponentialMovingAverage.variables_to_restore} - -Returns a map of names to `Variables` to restore. - -If a variable has a moving average, use the moving average variable name as -the restore name; otherwise, use the variable name. - -For example, - -```python - variables_to_restore = ema.variables_to_restore() - saver = tf.train.Saver(variables_to_restore) -``` - -Below is an example of such mapping: - -``` - conv/batchnorm/gamma/ExponentialMovingAverage: conv/batchnorm/gamma, - conv_4/conv2d_params/ExponentialMovingAverage: conv_4/conv2d_params, - global_step: global_step -``` - -##### Args: - - -* `moving_avg_variables`: a list of variables that require to use of the - moving variable name to be restored. If None, it will default to - variables.moving_average_variables() + variables.trainable_variables() - -##### Returns: - - A map from restore_names to variables. The restore_name can be the - moving_average version of the variable name if it exist, or the original - variable name. - - - -- - - - -### `class tf.train.Coordinator` {#Coordinator} - -A coordinator for threads. - -This class implements a simple mechanism to coordinate the termination of a -set of threads. - -#### Usage: - -```python -# Create a coordinator. -coord = Coordinator() -# Start a number of threads, passing the coordinator to each of them. -...start thread 1...(coord, ...) -...start thread N...(coord, ...) -# Wait for all the threads to terminate. -coord.join(threads) -``` - -Any of the threads can call `coord.request_stop()` to ask for all the threads -to stop. To cooperate with the requests, each thread must check for -`coord.should_stop()` on a regular basis. `coord.should_stop()` returns -`True` as soon as `coord.request_stop()` has been called. - -A typical thread running with a coordinator will do something like: - -```python -while not coord.should_stop(): - ...do some work... -``` - -#### Exception handling: - -A thread can report an exception to the coordinator as part of the -`should_stop()` call. The exception will be re-raised from the -`coord.join()` call. - -Thread code: - -```python -try: - while not coord.should_stop(): - ...do some work... -except Exception as e: - coord.request_stop(e) -``` - -Main code: - -```python -try: - ... - coord = Coordinator() - # Start a number of threads, passing the coordinator to each of them. - ...start thread 1...(coord, ...) - ...start thread N...(coord, ...) - # Wait for all the threads to terminate. - coord.join(threads) -except Exception as e: - ...exception that was passed to coord.request_stop() -``` - -To simplify the thread implementation, the Coordinator provides a -context handler `stop_on_exception()` that automatically requests a stop if -an exception is raised. Using the context handler the thread code above -can be written as: - -```python -with coord.stop_on_exception(): - while not coord.should_stop(): - ...do some work... -``` - -#### Grace period for stopping: - -After a thread has called `coord.request_stop()` the other threads have a -fixed time to stop, this is called the 'stop grace period' and defaults to 2 -minutes. If any of the threads is still alive after the grace period expires -`coord.join()` raises a RuntimeException reporting the laggards. - -```python -try: - ... - coord = Coordinator() - # Start a number of threads, passing the coordinator to each of them. - ...start thread 1...(coord, ...) - ...start thread N...(coord, ...) - # Wait for all the threads to terminate, give them 10s grace period - coord.join(threads, stop_grace_period_secs=10) -except RuntimeException: - ...one of the threads took more than 10s to stop after request_stop() - ...was called. -except Exception: - ...exception that was passed to coord.request_stop() -``` -- - - - -#### `tf.train.Coordinator.__init__(clean_stop_exception_types=None)` {#Coordinator.__init__} - -Create a new Coordinator. - -##### Args: - - -* `clean_stop_exception_types`: Optional tuple of Exception types that should - cause a clean stop of the coordinator. If an exception of one of these - types is reported to `request_stop(ex)` the coordinator will behave as - if `request_stop(None)` was called. Defaults to - `(tf.errors.OutOfRangeError,)` which is used by input queues to signal - the end of input. When feeding training data from a Python iterator it - is common to add `StopIteration` to this list. - - -- - - - -#### `tf.train.Coordinator.clear_stop()` {#Coordinator.clear_stop} - -Clears the stop flag. - -After this is called, calls to `should_stop()` will return `False`. - - -- - - - -#### `tf.train.Coordinator.join(threads=None, stop_grace_period_secs=120, ignore_live_threads=False)` {#Coordinator.join} - -Wait for threads to terminate. - -This call blocks until a set of threads have terminated. The set of thread -is the union of the threads passed in the `threads` argument and the list -of threads that registered with the coordinator by calling -`Coordinator.register_thread()`. - -After the threads stop, if an `exc_info` was passed to `request_stop`, that -exception is re-raised. - -Grace period handling: When `request_stop()` is called, threads are given -'stop_grace_period_secs' seconds to terminate. If any of them is still -alive after that period expires, a `RuntimeError` is raised. Note that if -an `exc_info` was passed to `request_stop()` then it is raised instead of -that `RuntimeError`. - -##### Args: - - -* `threads`: List of `threading.Threads`. The started threads to join in - addition to the registered threads. -* `stop_grace_period_secs`: Number of seconds given to threads to stop after - `request_stop()` has been called. -* `ignore_live_threads`: If `False`, raises an error if any of the threads are - still alive after `stop_grace_period_secs`. - -##### Raises: - - -* `RuntimeError`: If any thread is still alive after `request_stop()` - is called and the grace period expires. - - -- - - - -#### `tf.train.Coordinator.joined` {#Coordinator.joined} - - - - -- - - - -#### `tf.train.Coordinator.raise_requested_exception()` {#Coordinator.raise_requested_exception} - -If an exception has been passed to `request_stop`, this raises it. - - -- - - - -#### `tf.train.Coordinator.register_thread(thread)` {#Coordinator.register_thread} - -Register a thread to join. - -##### Args: - - -* `thread`: A Python thread to join. - - -- - - - -#### `tf.train.Coordinator.request_stop(ex=None)` {#Coordinator.request_stop} - -Request that the threads stop. - -After this is called, calls to `should_stop()` will return `True`. - -Note: If an exception is being passed in, in must be in the context of -handling the exception (i.e. `try: ... except Exception as ex: ...`) and not -a newly created one. - -##### Args: - - -* `ex`: Optional `Exception`, or Python `exc_info` tuple as returned by - `sys.exc_info()`. If this is the first call to `request_stop()` the - corresponding exception is recorded and re-raised from `join()`. - - -- - - - -#### `tf.train.Coordinator.should_stop()` {#Coordinator.should_stop} - -Check if stop was requested. - -##### Returns: - - True if a stop was requested. - - -- - - - -#### `tf.train.Coordinator.stop_on_exception()` {#Coordinator.stop_on_exception} - -Context manager to request stop when an Exception is raised. - -Code that uses a coordinator must catch exceptions and pass -them to the `request_stop()` method to stop the other threads -managed by the coordinator. - -This context handler simplifies the exception handling. -Use it as follows: - -```python -with coord.stop_on_exception(): - # Any exception raised in the body of the with - # clause is reported to the coordinator before terminating - # the execution of the body. - ...body... -``` - -This is completely equivalent to the slightly longer code: - -```python -try: - ...body... -exception Exception as ex: - coord.request_stop(ex) -``` - -##### Yields: - - nothing. - - -- - - - -#### `tf.train.Coordinator.wait_for_stop(timeout=None)` {#Coordinator.wait_for_stop} - -Wait till the Coordinator is told to stop. - -##### Args: - - -* `timeout`: Float. Sleep for up to that many seconds waiting for - should_stop() to become True. - -##### Returns: - - True if the Coordinator is told stop, False if the timeout expired. - - - -- - - - -### `class tf.train.QueueRunner` {#QueueRunner} - -Holds a list of enqueue operations for a queue, each to be run in a thread. - -Queues are a convenient TensorFlow mechanism to compute tensors -asynchronously using multiple threads. For example in the canonical 'Input -Reader' setup one set of threads generates filenames in a queue; a second set -of threads read records from the files, processes them, and enqueues tensors -on a second queue; a third set of threads dequeues these input records to -construct batches and runs them through training operations. - -There are several delicate issues when running multiple threads that way: -closing the queues in sequence as the input is exhausted, correctly catching -and reporting exceptions, etc. - -The `QueueRunner`, combined with the `Coordinator`, helps handle these issues. -- - - - -#### `tf.train.QueueRunner.__init__(queue=None, enqueue_ops=None, close_op=None, cancel_op=None, queue_closed_exception_types=None, queue_runner_def=None, import_scope=None)` {#QueueRunner.__init__} - -Create a QueueRunner. - -On construction the `QueueRunner` adds an op to close the queue. That op -will be run if the enqueue ops raise exceptions. - -When you later call the `create_threads()` method, the `QueueRunner` will -create one thread for each op in `enqueue_ops`. Each thread will run its -enqueue op in parallel with the other threads. The enqueue ops do not have -to all be the same op, but it is expected that they all enqueue tensors in -`queue`. - -##### Args: - - -* `queue`: A `Queue`. -* `enqueue_ops`: List of enqueue ops to run in threads later. -* `close_op`: Op to close the queue. Pending enqueue ops are preserved. -* `cancel_op`: Op to close the queue and cancel pending enqueue ops. -* `queue_closed_exception_types`: Optional tuple of Exception types that - indicate that the queue has been closed when raised during an enqueue - operation. Defaults to `(tf.errors.OutOfRangeError,)`. Another common - case includes `(tf.errors.OutOfRangeError, tf.errors.CancelledError)`, - when some of the enqueue ops may dequeue from other Queues. -* `queue_runner_def`: Optional `QueueRunnerDef` protocol buffer. If specified, - recreates the QueueRunner from its contents. `queue_runner_def` and the - other arguments are mutually exclusive. -* `import_scope`: Optional `string`. Name scope to add. Only used when - initializing from protocol buffer. - -##### Raises: - - -* `ValueError`: If both `queue_runner_def` and `queue` are both specified. -* `ValueError`: If `queue` or `enqueue_ops` are not provided when not - restoring from `queue_runner_def`. - - -- - - - -#### `tf.train.QueueRunner.cancel_op` {#QueueRunner.cancel_op} - - - - -- - - - -#### `tf.train.QueueRunner.close_op` {#QueueRunner.close_op} - - - - -- - - - -#### `tf.train.QueueRunner.create_threads(sess, coord=None, daemon=False, start=False)` {#QueueRunner.create_threads} - -Create threads to run the enqueue ops for the given session. - -This method requires a session in which the graph was launched. It creates -a list of threads, optionally starting them. There is one thread for each -op passed in `enqueue_ops`. - -The `coord` argument is an optional coordinator that the threads will use -to terminate together and report exceptions. If a coordinator is given, -this method starts an additional thread to close the queue when the -coordinator requests a stop. - -If previously created threads for the given session are still running, no -new threads will be created. - -##### Args: - - -* `sess`: A `Session`. -* `coord`: Optional `Coordinator` object for reporting errors and checking - stop conditions. -* `daemon`: Boolean. If `True` make the threads daemon threads. -* `start`: Boolean. If `True` starts the threads. If `False` the - caller must call the `start()` method of the returned threads. - -##### Returns: - - A list of threads. - - -- - - - -#### `tf.train.QueueRunner.enqueue_ops` {#QueueRunner.enqueue_ops} - - - - -- - - - -#### `tf.train.QueueRunner.exceptions_raised` {#QueueRunner.exceptions_raised} - -Exceptions raised but not handled by the `QueueRunner` threads. - -Exceptions raised in queue runner threads are handled in one of two ways -depending on whether or not a `Coordinator` was passed to -`create_threads()`: - -* With a `Coordinator`, exceptions are reported to the coordinator and - forgotten by the `QueueRunner`. -* Without a `Coordinator`, exceptions are captured by the `QueueRunner` and - made available in this `exceptions_raised` property. - -##### Returns: - - A list of Python `Exception` objects. The list is empty if no exception - was captured. (No exceptions are captured when using a Coordinator.) - - -- - - - -#### `tf.train.QueueRunner.from_proto(queue_runner_def, import_scope=None)` {#QueueRunner.from_proto} - -Returns a `QueueRunner` object created from `queue_runner_def`. - - -- - - - -#### `tf.train.QueueRunner.name` {#QueueRunner.name} - -The string name of the underlying Queue. - - -- - - - -#### `tf.train.QueueRunner.queue` {#QueueRunner.queue} - - - - -- - - - -#### `tf.train.QueueRunner.queue_closed_exception_types` {#QueueRunner.queue_closed_exception_types} - - - - -- - - - -#### `tf.train.QueueRunner.to_proto(export_scope=None)` {#QueueRunner.to_proto} - -Converts this `QueueRunner` to a `QueueRunnerDef` protocol buffer. - -##### Args: - - -* `export_scope`: Optional `string`. Name scope to remove. - -##### Returns: - - A `QueueRunnerDef` protocol buffer, or `None` if the `Variable` is not in - the specified name scope. - - - -- - - - -### `class tf.train.LooperThread` {#LooperThread} - -A thread that runs code repeatedly, optionally on a timer. - -This thread class is intended to be used with a `Coordinator`. It repeatedly -runs code specified either as `target` and `args` or by the `run_loop()` -method. - -Before each run the thread checks if the coordinator has requested stop. In -that case the looper thread terminates immediately. - -If the code being run raises an exception, that exception is reported to the -coordinator and the thread terminates. The coordinator will then request all -the other threads it coordinates to stop. - -You typically pass looper threads to the supervisor `Join()` method. -- - - - -#### `tf.train.LooperThread.__init__(coord, timer_interval_secs, target=None, args=None, kwargs=None)` {#LooperThread.__init__} - -Create a LooperThread. - -##### Args: - - -* `coord`: A Coordinator. -* `timer_interval_secs`: Time boundaries at which to call Run(), or None - if it should be called back to back. -* `target`: Optional callable object that will be executed in the thread. -* `args`: Optional arguments to pass to `target` when calling it. -* `kwargs`: Optional keyword arguments to pass to `target` when calling it. - -##### Raises: - - -* `ValueError`: If one of the arguments is invalid. - - -- - - - -#### `tf.train.LooperThread.__repr__()` {#LooperThread.__repr__} - - - - -- - - - -#### `tf.train.LooperThread.daemon` {#LooperThread.daemon} - -A boolean value indicating whether this thread is a daemon thread (True) or not (False). - -This must be set before start() is called, otherwise RuntimeError is -raised. Its initial value is inherited from the creating thread; the -main thread is not a daemon thread and therefore all threads created in -the main thread default to daemon = False. - -The entire Python program exits when no alive non-daemon threads are -left. - - -- - - - -#### `tf.train.LooperThread.getName()` {#LooperThread.getName} - - - - -- - - - -#### `tf.train.LooperThread.ident` {#LooperThread.ident} - -Thread identifier of this thread or None if it has not been started. - -This is a nonzero integer. See the thread.get_ident() function. Thread -identifiers may be recycled when a thread exits and another thread is -created. The identifier is available even after the thread has exited. - - -- - - - -#### `tf.train.LooperThread.isAlive()` {#LooperThread.isAlive} - -Return whether the thread is alive. - -This method returns True just before the run() method starts until just -after the run() method terminates. The module function enumerate() -returns a list of all alive threads. - - -- - - - -#### `tf.train.LooperThread.isDaemon()` {#LooperThread.isDaemon} - - - - -- - - - -#### `tf.train.LooperThread.is_alive()` {#LooperThread.is_alive} - -Return whether the thread is alive. - -This method returns True just before the run() method starts until just -after the run() method terminates. The module function enumerate() -returns a list of all alive threads. - - -- - - - -#### `tf.train.LooperThread.join(timeout=None)` {#LooperThread.join} - -Wait until the thread terminates. - -This blocks the calling thread until the thread whose join() method is -called terminates -- either normally or through an unhandled exception -or until the optional timeout occurs. - -When the timeout argument is present and not None, it should be a -floating point number specifying a timeout for the operation in seconds -(or fractions thereof). As join() always returns None, you must call -isAlive() after join() to decide whether a timeout happened -- if the -thread is still alive, the join() call timed out. - -When the timeout argument is not present or None, the operation will -block until the thread terminates. - -A thread can be join()ed many times. - -join() raises a RuntimeError if an attempt is made to join the current -thread as that would cause a deadlock. It is also an error to join() a -thread before it has been started and attempts to do so raises the same -exception. - - -- - - - -#### `tf.train.LooperThread.loop(coord, timer_interval_secs, target, args=None, kwargs=None)` {#LooperThread.loop} - -Start a LooperThread that calls a function periodically. - -If `timer_interval_secs` is None the thread calls `target(args)` -repeatedly. Otherwise `target(args)` is called every `timer_interval_secs` -seconds. The thread terminates when a stop of the coordinator is -requested. - -##### Args: - - -* `coord`: A Coordinator. -* `timer_interval_secs`: Number. Time boundaries at which to call `target`. -* `target`: A callable object. -* `args`: Optional arguments to pass to `target` when calling it. -* `kwargs`: Optional keyword arguments to pass to `target` when calling it. - -##### Returns: - - The started thread. - - -- - - - -#### `tf.train.LooperThread.name` {#LooperThread.name} - -A string used for identification purposes only. - -It has no semantics. Multiple threads may be given the same name. The -initial name is set by the constructor. - - -- - - - -#### `tf.train.LooperThread.run()` {#LooperThread.run} - - - - -- - - - -#### `tf.train.LooperThread.run_loop()` {#LooperThread.run_loop} - -Called at 'timer_interval_secs' boundaries. - - -- - - - -#### `tf.train.LooperThread.setDaemon(daemonic)` {#LooperThread.setDaemon} - - - - -- - - - -#### `tf.train.LooperThread.setName(name)` {#LooperThread.setName} - - - - -- - - - -#### `tf.train.LooperThread.start()` {#LooperThread.start} - -Start the thread's activity. - -It must be called at most once per thread object. It arranges for the -object's run() method to be invoked in a separate thread of control. - -This method will raise a RuntimeError if called more than once on the -same thread object. - - -- - - - -#### `tf.train.LooperThread.start_loop()` {#LooperThread.start_loop} - -Called when the thread starts. - - -- - - - -#### `tf.train.LooperThread.stop_loop()` {#LooperThread.stop_loop} - -Called when the thread stops. - - - -- - - - -### `tf.train.add_queue_runner(qr, collection='queue_runners')` {#add_queue_runner} - -Adds a `QueueRunner` to a collection in the graph. - -When building a complex model that uses many queues it is often difficult to -gather all the queue runners that need to be run. This convenience function -allows you to add a queue runner to a well known collection in the graph. - -The companion method `start_queue_runners()` can be used to start threads for -all the collected queue runners. - -##### Args: - - -* `qr`: A `QueueRunner`. -* `collection`: A `GraphKey` specifying the graph collection to add - the queue runner to. Defaults to `GraphKeys.QUEUE_RUNNERS`. - - -- - - - -### `tf.train.start_queue_runners(sess=None, coord=None, daemon=True, start=True, collection='queue_runners')` {#start_queue_runners} - -Starts all queue runners collected in the graph. - -This is a companion method to `add_queue_runner()`. It just starts -threads for all queue runners collected in the graph. It returns -the list of all threads. - -##### Args: - - -* `sess`: `Session` used to run the queue ops. Defaults to the - default session. -* `coord`: Optional `Coordinator` for coordinating the started threads. -* `daemon`: Whether the threads should be marked as `daemons`, meaning - they don't block program exit. -* `start`: Set to `False` to only create the threads, not start them. -* `collection`: A `GraphKey` specifying the graph collection to - get the queue runners from. Defaults to `GraphKeys.QUEUE_RUNNERS`. - -##### Returns: - - A list of threads. - - -- - - - -### `class tf.train.Server` {#Server} - -An in-process TensorFlow server, for use in distributed training. - -A `tf.train.Server` instance encapsulates a set of devices and a -[`tf.Session`](../../api_docs/python/client.md#Session) target that -can participate in distributed training. A server belongs to a -cluster (specified by a [`tf.train.ClusterSpec`](#ClusterSpec)), and -corresponds to a particular task in a named job. The server can -communicate with any other server in the same cluster. - -- - - - -#### `tf.train.Server.__init__(server_or_cluster_def, job_name=None, task_index=None, protocol=None, config=None, start=True)` {#Server.__init__} - -Creates a new server with the given definition. - -The `job_name`, `task_index`, and `protocol` arguments are optional, and -override any information provided in `server_or_cluster_def`. - -##### Args: - - -* `server_or_cluster_def`: A `tf.train.ServerDef` or - `tf.train.ClusterDef` protocol buffer, or a - `tf.train.ClusterSpec` object, describing the server to be - created and/or the cluster of which it is a member. -* `job_name`: (Optional.) Specifies the name of the job of which the server - is a member. Defaults to the value in `server_or_cluster_def`, if - specified. -* `task_index`: (Optional.) Specifies the task index of the server in its - job. Defaults to the value in `server_or_cluster_def`, if specified. - Otherwise defaults to 0 if the server's job has only one task. -* `protocol`: (Optional.) Specifies the protocol to be used by the server. - Acceptable values include `"grpc"`. Defaults to the value in - `server_or_cluster_def`, if specified. Otherwise defaults to `"grpc"`. -* `config`: (Options.) A `tf.ConfigProto` that specifies default - configuration options for all sessions that run on this server. -* `start`: (Optional.) Boolean, indicating whether to start the server - after creating it. Defaults to `True`. - -##### Raises: - - tf.errors.OpError: Or one of its subclasses if an error occurs while - creating the TensorFlow server. - - -- - - - -#### `tf.train.Server.create_local_server(config=None, start=True)` {#Server.create_local_server} - -Creates a new single-process cluster running on the local host. - -This method is a convenience wrapper for creating a -`tf.train.Server` with a `tf.train.ServerDef` that specifies a -single-process cluster containing a single task in a job called -`"local"`. - -##### Args: - - -* `config`: (Options.) A `tf.ConfigProto` that specifies default - configuration options for all sessions that run on this server. -* `start`: (Optional.) Boolean, indicating whether to start the server after - creating it. Defaults to `True`. - -##### Returns: - - A local `tf.train.Server`. - - -- - - - -#### `tf.train.Server.target` {#Server.target} - -Returns the target for a `tf.Session` to connect to this server. - -To create a -[`tf.Session`](../../api_docs/python/client.md#Session) that -connects to this server, use the following snippet: - -```python -server = tf.train.Server(...) -with tf.Session(server.target): - # ... -``` - -##### Returns: - - A string containing a session target for this server. - - -- - - - -#### `tf.train.Server.server_def` {#Server.server_def} - -Returns the `tf.train.ServerDef` for this server. - -##### Returns: - - A `tf.train.ServerDef` protocol buffer that describes the configuration - of this server. - - - -- - - - -#### `tf.train.Server.start()` {#Server.start} - -Starts this server. - -##### Raises: - - tf.errors.OpError: Or one of its subclasses if an error occurs while - starting the TensorFlow server. - - -- - - - -#### `tf.train.Server.join()` {#Server.join} - -Blocks until the server has shut down. - -This method currently blocks forever. - -##### Raises: - - tf.errors.OpError: Or one of its subclasses if an error occurs while - joining the TensorFlow server. - - - -- - - - -### `class tf.train.Supervisor` {#Supervisor} - -A training helper that checkpoints models and computes summaries. - -The Supervisor is a small wrapper around a `Coordinator`, a `Saver`, -and a `SessionManager` that takes care of common needs of TensorFlow -training programs. - -#### Use for a single program - -```python -with tf.Graph().as_default(): - ...add operations to the graph... - # Create a Supervisor that will checkpoint the model in '/tmp/mydir'. - sv = Supervisor(logdir='/tmp/mydir') - # Get a TensorFlow session managed by the supervisor. - with sv.managed_session(FLAGS.master) as sess: - # Use the session to train the graph. - while not sv.should_stop(): - sess.run() -``` - -Within the `with sv.managed_session()` block all variables in the graph have -been initialized. In addition, a few services have been started to -checkpoint the model and add summaries to the event log. - -If the program crashes and is restarted, the managed session automatically -reinitialize variables from the most recent checkpoint. - -The supervisor is notified of any exception raised by one of the services. -After an exception is raised, `should_stop()` returns `True`. In that case -the training loop should also stop. This is why the training loop has to -check for `sv.should_stop()`. - -Exceptions that indicate that the training inputs have been exhausted, -`tf.errors.OutOfRangeError`, also cause `sv.should_stop()` to return `True` -but are not re-raised from the `with` block: they indicate a normal -termination. - -#### Use for multiple replicas - -To train with replicas you deploy the same program in a `Cluster`. -One of the tasks must be identified as the *chief*: the task that handles -initialization, checkpoints, summaries, and recovery. The other tasks -depend on the *chief* for these services. - -The only change you have to do to the single program code is to indicate -if the program is running as the *chief*. - -```python -# Choose a task as the chief. This could be based on server_def.task_index, -# or job_def.name, or job_def.tasks. It's entirely up to the end user. -# But there can be only one *chief*. -is_chief = (server_def.task_index == 0) -server = tf.train.Server(server_def) - -with tf.Graph().as_default(): - ...add operations to the graph... - # Create a Supervisor that uses log directory on a shared file system. - # Indicate if you are the 'chief' - sv = Supervisor(logdir='/shared_directory/...', is_chief=is_chief) - # Get a Session in a TensorFlow server on the cluster. - with sv.managed_session(server.target) as sess: - # Use the session to train the graph. - while not sv.should_stop(): - sess.run() -``` - -In the *chief* task, the `Supervisor` works exactly as in the first example -above. In the other tasks `sv.managed_session()` waits for the Model to have -been initialized before returning a session to the training code. The -non-chief tasks depend on the chief task for initializing the model. - -If one of the tasks crashes and restarts, `managed_session()` -checks if the Model is initialized. If yes, it just creates a session and -returns it to the training code that proceeds normally. If the model needs -to be initialized, the chief task takes care of reinitializing it; the other -tasks just wait for the model to have been initialized. - -NOTE: This modified program still works fine as a single program. -The single program marks itself as the chief. - -#### What `master` string to use - -Whether you are running on your machine or in the cluster you can use the -following values for the --master flag: - -* Specifying `''` requests an in-process session that does not use RPC. - -* Specifying `'local'` requests a session that uses the RPC-based - "Master interface" to run TensorFlow programs. See - [`tf.train.Server.create_local_server()`](#Server.create_local_server) for - details. - -* Specifying `'grpc://hostname:port'` requests a session that uses - the RPC interface to a specific host, and also allows the in-process - master to access remote tensorflow workers. Often, it is - appropriate to pass `server.target` (for some `tf.train.Server` - named `server). - -#### Advanced use - -##### Launching additional services - -`managed_session()` launches the Checkpoint and Summary services (threads). -If you need more services to run you can simply launch them in the block -controlled by `managed_session()`. - -Example: Start a thread to print losses. We want this thread to run -every 60 seconds, so we launch it with `sv.loop()`. - - ```python - ... - sv = Supervisor(logdir='/tmp/mydir') - with sv.managed_session(FLAGS.master) as sess: - sv.loop(60, print_loss, (sess, )) - while not sv.should_stop(): - sess.run(my_train_op) - ``` - -##### Launching fewer services - -`managed_session()` launches the "summary" and "checkpoint" threads which use -either the optionally `summary_op` and `saver` passed to the constructor, or -default ones created automatically by the supervisor. If you want to run -your own summary and checkpointing logic, disable these services by passing -`None` to the `summary_op` and `saver` parameters. - -Example: Create summaries manually every 100 steps in the chief. - - ```python - # Create a Supervisor with no automatic summaries. - sv = Supervisor(logdir='/tmp/mydir', is_chief=is_chief, summary_op=None) - # As summary_op was None, managed_session() does not start the - # summary thread. - with sv.managed_session(FLAGS.master) as sess: - for step in xrange(1000000): - if sv.should_stop(): - break - if is_chief and step % 100 == 0: - # Create the summary every 100 chief steps. - sv.summary_computed(sess, sess.run(my_summary_op)) - else: - # Train normally - sess.run(my_train_op) - ``` - -##### Custom model initialization - -`managed_session()` only supports initializing the model by running an -`init_op` or restoring from the latest checkpoint. If you have special -initialization needs, see how to specify a `local_init_op` when creating the -supervisor. You can also use the `SessionManager` directly to create a -session and check if it could be initialized automatically. - -- - - - -#### `tf.train.Supervisor.__init__(graph=None, ready_op=0, ready_for_local_init_op=0, is_chief=True, init_op=0, init_feed_dict=None, local_init_op=0, logdir=None, summary_op=0, saver=0, global_step=0, save_summaries_secs=120, save_model_secs=600, recovery_wait_secs=30, stop_grace_secs=120, checkpoint_basename='model.ckpt', session_manager=None, summary_writer=0, init_fn=None)` {#Supervisor.__init__} - -Create a `Supervisor`. - -##### Args: - - -* `graph`: A `Graph`. The graph that the model will use. Defaults to the - default `Graph`. The supervisor may add operations to the graph before - creating a session, but the graph should not be modified by the caller - after passing it to the supervisor. -* `ready_op`: 1-D string `Tensor`. This tensor is evaluated by supervisors in - `prepare_or_wait_for_session()` to check if the model is ready to use. - The model is considered ready if it returns an empty array. Defaults to - the tensor returned from `tf.report_uninitialized_variables()` If - `None`, the model is not checked for readiness. -* `ready_for_local_init_op`: 1-D string `Tensor`. This tensor is evaluated by - supervisors in `prepare_or_wait_for_session()` to check if the model is - ready to run the local_init_op. - The model is considered ready if it returns an empty array. Defaults to - the tensor returned from - `tf.report_uninitialized_variables(tf.global_variables())`. If `None`, - the model is not checked for readiness before running local_init_op. -* `is_chief`: If True, create a chief supervisor in charge of initializing - and restoring the model. If False, create a supervisor that relies - on a chief supervisor for inits and restore. -* `init_op`: `Operation`. Used by chief supervisors to initialize the model - when it can not be recovered. Defaults to an `Operation` that - initializes all variables. If `None`, no initialization is done - automatically unless you pass a value for `init_fn`, see below. -* `init_feed_dict`: A dictionary that maps `Tensor` objects to feed values. - This feed dictionary will be used when `init_op` is evaluated. -* `local_init_op`: `Operation`. Used by all supervisors to run initializations - that should run for every new supervisor instance. By default these - are table initializers and initializers for local variables. - If `None`, no further per supervisor-instance initialization is - done automatically. -* `logdir`: A string. Optional path to a directory where to checkpoint the - model and log events for the visualizer. Used by chief supervisors. - The directory will be created if it does not exist. -* `summary_op`: An `Operation` that returns a Summary for the event logs. - Used by chief supervisors if a `logdir` was specified. Defaults to the - operation returned from summary.merge_all(). If `None`, summaries are - not computed automatically. -* `saver`: A Saver object. Used by chief supervisors if a `logdir` was - specified. Defaults to the saved returned by Saver(). - If `None`, the model is not saved automatically. -* `global_step`: An integer Tensor of size 1 that counts steps. The value - from 'global_step' is used in summaries and checkpoint filenames. - Default to the op named 'global_step' in the graph if it exists, is of - rank 1, size 1, and of type tf.int32 or tf.int64. If `None` the global - step is not recorded in summaries and checkpoint files. Used by chief - supervisors if a `logdir` was specified. -* `save_summaries_secs`: Number of seconds between the computation of - summaries for the event log. Defaults to 120 seconds. Pass 0 to - disable summaries. -* `save_model_secs`: Number of seconds between the creation of model - checkpoints. Defaults to 600 seconds. Pass 0 to disable checkpoints. -* `recovery_wait_secs`: Number of seconds between checks that the model - is ready. Used by supervisors when waiting for a chief supervisor - to initialize or restore the model. Defaults to 30 seconds. -* `stop_grace_secs`: Grace period, in seconds, given to running threads to - stop when `stop()` is called. Defaults to 120 seconds. -* `checkpoint_basename`: The basename for checkpoint saving. -* `session_manager`: `SessionManager`, which manages Session creation and - recovery. If it is `None`, a default `SessionManager` will be created - with the set of arguments passed in for backwards compatibility. -* `summary_writer`: `SummaryWriter` to use or `USE_DEFAULT`. Can be `None` - to indicate that no summaries should be written. -* `init_fn`: Optional callable used to initialize the model. Called - after the optional `init_op` is called. The callable must accept one - argument, the session being initialized. - -##### Returns: - - A `Supervisor`. - - -- - - - -#### `tf.train.Supervisor.managed_session(master='', config=None, start_standard_services=True, close_summary_writer=True)` {#Supervisor.managed_session} - -Returns a context manager for a managed session. - -This context manager creates and automatically recovers a session. It -optionally starts the standard services that handle checkpoints and -summaries. It monitors exceptions raised from the `with` block or from the -services and stops the supervisor as needed. - -The context manager is typically used as follows: - -```python -def train(): - sv = tf.train.Supervisor(...) - with sv.managed_session() as sess: - for step in xrange(..): - if sv.should_stop(): - break - sess.run() - ...do other things needed at each training step... -``` - -An exception raised from the `with` block or one of the service threads is -raised again when the block exits. This is done after stopping all threads -and closing the session. For example, an `AbortedError` exception, raised -in case of preemption of one of the workers in a distributed model, is -raised again when the block exits. - -If you want to retry the training loop in case of preemption you can do it -as follows: - -```python -def main(...): - while True - try: - train() - except tf.errors.Aborted: - pass -``` - -As a special case, exceptions used for control flow, such as -`OutOfRangeError` which reports that input queues are exhausted, are not -raised again from the `with` block: they indicate a clean termination of -the training loop and are considered normal termination. - -##### Args: - - -* `master`: name of the TensorFlow master to use. See the `tf.Session` - constructor for how this is interpreted. -* `config`: Optional `ConfigProto` proto used to configure the session. - Passed as-is to create the session. -* `start_standard_services`: Whether to start the standard services, - such as checkpoint, summary and step counter. -* `close_summary_writer`: Whether to close the summary writer when - closing the session. Defaults to True. - -##### Returns: - - A context manager that yields a `Session` restored from the latest - checkpoint or initialized from scratch if not checkpoint exists. The - session is closed when the `with` block exits. - - -- - - - -#### `tf.train.Supervisor.prepare_or_wait_for_session(master='', config=None, wait_for_checkpoint=False, max_wait_secs=7200, start_standard_services=True)` {#Supervisor.prepare_or_wait_for_session} - -Make sure the model is ready to be used. - -Create a session on 'master', recovering or initializing the model as -needed, or wait for a session to be ready. If running as the chief -and `start_standard_service` is set to True, also call the session -manager to start the standard services. - -##### Args: - - -* `master`: name of the TensorFlow master to use. See the `tf.Session` - constructor for how this is interpreted. -* `config`: Optional ConfigProto proto used to configure the session, - which is passed as-is to create the session. -* `wait_for_checkpoint`: Whether we should wait for the availability of a - checkpoint before creating Session. Defaults to False. -* `max_wait_secs`: Maximum time to wait for the session to become available. -* `start_standard_services`: Whether to start the standard services and the - queue runners. - -##### Returns: - - A Session object that can be used to drive the model. - - -- - - - -#### `tf.train.Supervisor.start_standard_services(sess)` {#Supervisor.start_standard_services} - -Start the standard services for 'sess'. - -This starts services in the background. The services started depend -on the parameters to the constructor and may include: - - - A Summary thread computing summaries every save_summaries_secs. - - A Checkpoint thread saving the model every save_model_secs. - - A StepCounter thread measure step time. - -##### Args: - - -* `sess`: A Session. - -##### Returns: - - A list of threads that are running the standard services. You can use - the Supervisor's Coordinator to join these threads with: - sv.coord.Join() - -##### Raises: - - -* `RuntimeError`: If called with a non-chief Supervisor. -* `ValueError`: If not `logdir` was passed to the constructor as the - services need a log directory. - - -- - - - -#### `tf.train.Supervisor.start_queue_runners(sess, queue_runners=None)` {#Supervisor.start_queue_runners} - -Start threads for `QueueRunners`. - -Note that the queue runners collected in the graph key `QUEUE_RUNNERS` -are already started automatically when you create a session with the -supervisor, so unless you have non-collected queue runners to start -you do not need to call this explicitly. - -##### Args: - - -* `sess`: A `Session`. -* `queue_runners`: A list of `QueueRunners`. If not specified, we'll use the - list of queue runners gathered in the graph under the key - `GraphKeys.QUEUE_RUNNERS`. - -##### Returns: - - The list of threads started for the `QueueRunners`. - - -- - - - -#### `tf.train.Supervisor.summary_computed(sess, summary, global_step=None)` {#Supervisor.summary_computed} - -Indicate that a summary was computed. - -##### Args: - - -* `sess`: A `Session` object. -* `summary`: A Summary proto, or a string holding a serialized summary proto. -* `global_step`: Int. global step this summary is associated with. If `None`, - it will try to fetch the current step. - -##### Raises: - - -* `TypeError`: if 'summary' is not a Summary proto or a string. -* `RuntimeError`: if the Supervisor was created without a `logdir`. - - - -- - - - -#### `tf.train.Supervisor.stop(threads=None, close_summary_writer=True)` {#Supervisor.stop} - -Stop the services and the coordinator. - -This does not close the session. - -##### Args: - - -* `threads`: Optional list of threads to join with the coordinator. If - `None`, defaults to the threads running the standard services, the - threads started for `QueueRunners`, and the threads started by the - `loop()` method. To wait on additional threads, pass the - list in this parameter. -* `close_summary_writer`: Whether to close the `summary_writer`. Defaults to - `True` if the summary writer was created by the supervisor, `False` - otherwise. - - -- - - - -#### `tf.train.Supervisor.request_stop(ex=None)` {#Supervisor.request_stop} - -Request that the coordinator stop the threads. - -See `Coordinator.request_stop()`. - -##### Args: - - -* `ex`: Optional `Exception`, or Python `exc_info` tuple as returned by - `sys.exc_info()`. If this is the first call to `request_stop()` the - corresponding exception is recorded and re-raised from `join()`. - - -- - - - -#### `tf.train.Supervisor.should_stop()` {#Supervisor.should_stop} - -Check if the coordinator was told to stop. - -See `Coordinator.should_stop()`. - -##### Returns: - - True if the coordinator was told to stop, False otherwise. - - -- - - - -#### `tf.train.Supervisor.stop_on_exception()` {#Supervisor.stop_on_exception} - -Context handler to stop the supervisor when an exception is raised. - -See `Coordinator.stop_on_exception()`. - -##### Returns: - - A context handler. - - -- - - - -#### `tf.train.Supervisor.wait_for_stop()` {#Supervisor.wait_for_stop} - -Block waiting for the coordinator to stop. - - - -#### Other Methods -- - - - -#### `tf.train.Supervisor.Loop(timer_interval_secs, target, args=None, kwargs=None)` {#Supervisor.Loop} - -Start a LooperThread that calls a function periodically. - -If `timer_interval_secs` is None the thread calls `target(*args, **kwargs)` -repeatedly. Otherwise it calls it every `timer_interval_secs` -seconds. The thread terminates when a stop is requested. - -The started thread is added to the list of threads managed by the supervisor -so it does not need to be passed to the `stop()` method. - -##### Args: - - -* `timer_interval_secs`: Number. Time boundaries at which to call `target`. -* `target`: A callable object. -* `args`: Optional arguments to pass to `target` when calling it. -* `kwargs`: Optional keyword arguments to pass to `target` when calling it. - -##### Returns: - - The started thread. - - -- - - - -#### `tf.train.Supervisor.PrepareSession(master='', config=None, wait_for_checkpoint=False, max_wait_secs=7200, start_standard_services=True)` {#Supervisor.PrepareSession} - -Make sure the model is ready to be used. - -Create a session on 'master', recovering or initializing the model as -needed, or wait for a session to be ready. If running as the chief -and `start_standard_service` is set to True, also call the session -manager to start the standard services. - -##### Args: - - -* `master`: name of the TensorFlow master to use. See the `tf.Session` - constructor for how this is interpreted. -* `config`: Optional ConfigProto proto used to configure the session, - which is passed as-is to create the session. -* `wait_for_checkpoint`: Whether we should wait for the availability of a - checkpoint before creating Session. Defaults to False. -* `max_wait_secs`: Maximum time to wait for the session to become available. -* `start_standard_services`: Whether to start the standard services and the - queue runners. - -##### Returns: - - A Session object that can be used to drive the model. - - -- - - - -#### `tf.train.Supervisor.RequestStop(ex=None)` {#Supervisor.RequestStop} - -Request that the coordinator stop the threads. - -See `Coordinator.request_stop()`. - -##### Args: - - -* `ex`: Optional `Exception`, or Python `exc_info` tuple as returned by - `sys.exc_info()`. If this is the first call to `request_stop()` the - corresponding exception is recorded and re-raised from `join()`. - - -- - - - -#### `tf.train.Supervisor.ShouldStop()` {#Supervisor.ShouldStop} - -Check if the coordinator was told to stop. - -See `Coordinator.should_stop()`. - -##### Returns: - - True if the coordinator was told to stop, False otherwise. - - -- - - - -#### `tf.train.Supervisor.StartQueueRunners(sess, queue_runners=None)` {#Supervisor.StartQueueRunners} - -Start threads for `QueueRunners`. - -Note that the queue runners collected in the graph key `QUEUE_RUNNERS` -are already started automatically when you create a session with the -supervisor, so unless you have non-collected queue runners to start -you do not need to call this explicitly. - -##### Args: - - -* `sess`: A `Session`. -* `queue_runners`: A list of `QueueRunners`. If not specified, we'll use the - list of queue runners gathered in the graph under the key - `GraphKeys.QUEUE_RUNNERS`. - -##### Returns: - - The list of threads started for the `QueueRunners`. - - -- - - - -#### `tf.train.Supervisor.StartStandardServices(sess)` {#Supervisor.StartStandardServices} - -Start the standard services for 'sess'. - -This starts services in the background. The services started depend -on the parameters to the constructor and may include: - - - A Summary thread computing summaries every save_summaries_secs. - - A Checkpoint thread saving the model every save_model_secs. - - A StepCounter thread measure step time. - -##### Args: - - -* `sess`: A Session. - -##### Returns: - - A list of threads that are running the standard services. You can use - the Supervisor's Coordinator to join these threads with: - sv.coord.Join() - -##### Raises: - - -* `RuntimeError`: If called with a non-chief Supervisor. -* `ValueError`: If not `logdir` was passed to the constructor as the - services need a log directory. - - -- - - - -#### `tf.train.Supervisor.Stop(threads=None, close_summary_writer=True)` {#Supervisor.Stop} - -Stop the services and the coordinator. - -This does not close the session. - -##### Args: - - -* `threads`: Optional list of threads to join with the coordinator. If - `None`, defaults to the threads running the standard services, the - threads started for `QueueRunners`, and the threads started by the - `loop()` method. To wait on additional threads, pass the - list in this parameter. -* `close_summary_writer`: Whether to close the `summary_writer`. Defaults to - `True` if the summary writer was created by the supervisor, `False` - otherwise. - - -- - - - -#### `tf.train.Supervisor.StopOnException()` {#Supervisor.StopOnException} - -Context handler to stop the supervisor when an exception is raised. - -See `Coordinator.stop_on_exception()`. - -##### Returns: - - A context handler. - - -- - - - -#### `tf.train.Supervisor.SummaryComputed(sess, summary, global_step=None)` {#Supervisor.SummaryComputed} - -Indicate that a summary was computed. - -##### Args: - - -* `sess`: A `Session` object. -* `summary`: A Summary proto, or a string holding a serialized summary proto. -* `global_step`: Int. global step this summary is associated with. If `None`, - it will try to fetch the current step. - -##### Raises: - - -* `TypeError`: if 'summary' is not a Summary proto or a string. -* `RuntimeError`: if the Supervisor was created without a `logdir`. - - -- - - - -#### `tf.train.Supervisor.WaitForStop()` {#Supervisor.WaitForStop} - -Block waiting for the coordinator to stop. - - -- - - - -#### `tf.train.Supervisor.coord` {#Supervisor.coord} - -Return the Coordinator used by the Supervisor. - -The Coordinator can be useful if you want to run multiple threads -during your training. - -##### Returns: - - A Coordinator object. - - -- - - - -#### `tf.train.Supervisor.global_step` {#Supervisor.global_step} - -Return the global_step Tensor used by the supervisor. - -##### Returns: - - An integer Tensor for the global_step. - - -- - - - -#### `tf.train.Supervisor.init_feed_dict` {#Supervisor.init_feed_dict} - -Return the feed dictionary used when evaluating the `init_op`. - -##### Returns: - - A feed dictionary or `None`. - - -- - - - -#### `tf.train.Supervisor.init_op` {#Supervisor.init_op} - -Return the Init Op used by the supervisor. - -##### Returns: - - An Op or `None`. - - -- - - - -#### `tf.train.Supervisor.is_chief` {#Supervisor.is_chief} - -Return True if this is a chief supervisor. - -##### Returns: - - A bool. - - -- - - - -#### `tf.train.Supervisor.loop(timer_interval_secs, target, args=None, kwargs=None)` {#Supervisor.loop} - -Start a LooperThread that calls a function periodically. - -If `timer_interval_secs` is None the thread calls `target(*args, **kwargs)` -repeatedly. Otherwise it calls it every `timer_interval_secs` -seconds. The thread terminates when a stop is requested. - -The started thread is added to the list of threads managed by the supervisor -so it does not need to be passed to the `stop()` method. - -##### Args: - - -* `timer_interval_secs`: Number. Time boundaries at which to call `target`. -* `target`: A callable object. -* `args`: Optional arguments to pass to `target` when calling it. -* `kwargs`: Optional keyword arguments to pass to `target` when calling it. - -##### Returns: - - The started thread. - - -- - - - -#### `tf.train.Supervisor.ready_for_local_init_op` {#Supervisor.ready_for_local_init_op} - - - - -- - - - -#### `tf.train.Supervisor.ready_op` {#Supervisor.ready_op} - -Return the Ready Op used by the supervisor. - -##### Returns: - - An Op or `None`. - - -- - - - -#### `tf.train.Supervisor.save_model_secs` {#Supervisor.save_model_secs} - -Return the delay between checkpoints. - -##### Returns: - - A timestamp. - - -- - - - -#### `tf.train.Supervisor.save_path` {#Supervisor.save_path} - -Return the save path used by the supervisor. - -##### Returns: - - A string. - - -- - - - -#### `tf.train.Supervisor.save_summaries_secs` {#Supervisor.save_summaries_secs} - -Return the delay between summary computations. - -##### Returns: - - A timestamp. - - -- - - - -#### `tf.train.Supervisor.saver` {#Supervisor.saver} - -Return the Saver used by the supervisor. - -##### Returns: - - A Saver object. - - -- - - - -#### `tf.train.Supervisor.session_manager` {#Supervisor.session_manager} - -Return the SessionManager used by the Supervisor. - -##### Returns: - - A SessionManager object. - - -- - - - -#### `tf.train.Supervisor.summary_op` {#Supervisor.summary_op} - -Return the Summary Tensor used by the chief supervisor. - -##### Returns: - - A string Tensor for the summary or `None`. - - -- - - - -#### `tf.train.Supervisor.summary_writer` {#Supervisor.summary_writer} - -Return the SummaryWriter used by the chief supervisor. - -##### Returns: - - A SummaryWriter. - - - -- - - - -### `class tf.train.SessionManager` {#SessionManager} - -Training helper that restores from checkpoint and creates session. - -This class is a small wrapper that takes care of session creation and -checkpoint recovery. It also provides functions that to facilitate -coordination among multiple training threads or processes. - -* Checkpointing trained variables as the training progresses. -* Initializing variables on startup, restoring them from the most recent - checkpoint after a crash, or wait for checkpoints to become available. - -### Usage: - -```python -with tf.Graph().as_default(): - ...add operations to the graph... - # Create a SessionManager that will checkpoint the model in '/tmp/mydir'. - sm = SessionManager() - sess = sm.prepare_session(master, init_op, saver, checkpoint_dir) - # Use the session to train the graph. - while True: - sess.run() -``` - -`prepare_session()` initializes or restores a model. It requires `init_op` -and `saver` as an argument. - -A second process could wait for the model to be ready by doing the following: - -```python -with tf.Graph().as_default(): - ...add operations to the graph... - # Create a SessionManager that will wait for the model to become ready. - sm = SessionManager() - sess = sm.wait_for_session(master) - # Use the session to train the graph. - while True: - sess.run() -``` - -`wait_for_session()` waits for a model to be initialized by other processes. -- - - - -#### `tf.train.SessionManager.__init__(local_init_op=None, ready_op=None, ready_for_local_init_op=None, graph=None, recovery_wait_secs=30)` {#SessionManager.__init__} - -Creates a SessionManager. - -The `local_init_op` is an `Operation` that is run always after a new session -was created. If `None`, this step is skipped. - -The `ready_op` is an `Operation` used to check if the model is ready. The -model is considered ready if that operation returns an empty 1D string -tensor. If the operation returns a non empty 1D string tensor, the elements -are concatenated and used to indicate to the user why the model is not -ready. - -The `ready_for_local_init_op` is an `Operation` used to check if the model -is ready to run local_init_op. The model is considered ready if that -operation returns an empty 1D string tensor. If the operation returns a non -empty 1D string tensor, the elements are concatenated and used to indicate -to the user why the model is not ready. - -If `ready_op` is `None`, the model is not checked for readiness. - -`recovery_wait_secs` is the number of seconds between checks that -the model is ready. It is used by processes to wait for a model to -be initialized or restored. Defaults to 30 seconds. - -##### Args: - - -* `local_init_op`: An `Operation` run immediately after session creation. - Usually used to initialize tables and local variables. -* `ready_op`: An `Operation` to check if the model is initialized. -* `ready_for_local_init_op`: An `Operation` to check if the model is ready - to run local_init_op. -* `graph`: The `Graph` that the model will use. -* `recovery_wait_secs`: Seconds between checks for the model to be ready. - -##### Raises: - - -* `ValueError`: If ready_for_local_init_op is not None but local_init_op is - None - - -- - - - -#### `tf.train.SessionManager.prepare_session(master, init_op=None, saver=None, checkpoint_dir=None, checkpoint_filename_with_path=None, wait_for_checkpoint=False, max_wait_secs=7200, config=None, init_feed_dict=None, init_fn=None)` {#SessionManager.prepare_session} - -Creates a `Session`. Makes sure the model is ready to be used. - -Creates a `Session` on 'master'. If a `saver` object is passed in, and -`checkpoint_dir` points to a directory containing valid checkpoint -files, then it will try to recover the model from checkpoint. If -no checkpoint files are available, and `wait_for_checkpoint` is -`True`, then the process would check every `recovery_wait_secs`, -up to `max_wait_secs`, for recovery to succeed. - -If the model cannot be recovered successfully then it is initialized by -either running the provided `init_op`, or calling the provided `init_fn`. -The local_init_op is also run after init_op and init_fn, regardless of -whether the model was recovered successfully, but only if -ready_for_local_init_op passes. - -It is an error if the model cannot be recovered and no `init_op` -or `init_fn` or `local_init_op` are passed. - -##### Args: - - -* `master`: `String` representation of the TensorFlow master to use. -* `init_op`: Optional `Operation` used to initialize the model. -* `saver`: A `Saver` object used to restore a model. -* `checkpoint_dir`: Path to the checkpoint files. The latest checkpoint in the - dir will be used to restore. -* `checkpoint_filename_with_path`: Full file name path to the checkpoint file. -* `wait_for_checkpoint`: Whether to wait for checkpoint to become available. -* `max_wait_secs`: Maximum time to wait for checkpoints to become available. -* `config`: Optional `ConfigProto` proto used to configure the session. -* `init_feed_dict`: Optional dictionary that maps `Tensor` objects to feed - values. This feed dictionary is passed to the session `run()` call when - running the init op. -* `init_fn`: Optional callable used to initialize the model. Called after the - optional `init_op` is called. The callable must accept one argument, - the session being initialized. - -##### Returns: - - A `Session` object that can be used to drive the model. - -##### Raises: - - -* `RuntimeError`: If the model cannot be initialized or recovered. - -##### Raises: - - -* `ValueError`: If both checkpoint_dir and checkpoint_filename_with_path are - set. - - -- - - - -#### `tf.train.SessionManager.recover_session(master, saver=None, checkpoint_dir=None, checkpoint_filename_with_path=None, wait_for_checkpoint=False, max_wait_secs=7200, config=None)` {#SessionManager.recover_session} - -Creates a `Session`, recovering if possible. - -Creates a new session on 'master'. If the session is not initialized -and can be recovered from a checkpoint, recover it. - -##### Args: - - -* `master`: `String` representation of the TensorFlow master to use. -* `saver`: A `Saver` object used to restore a model. -* `checkpoint_dir`: Path to the checkpoint files. The latest checkpoint in the - dir will be used to restore. -* `checkpoint_filename_with_path`: Full file name path to the checkpoint file. -* `wait_for_checkpoint`: Whether to wait for checkpoint to become available. -* `max_wait_secs`: Maximum time to wait for checkpoints to become available. -* `config`: Optional `ConfigProto` proto used to configure the session. - -##### Returns: - - A pair (sess, initialized) where 'initialized' is `True` if - the session could be recovered and initialized, `False` otherwise. - -##### Raises: - - -* `ValueError`: If both checkpoint_dir and checkpoint_filename_with_path are - set. - - -- - - - -#### `tf.train.SessionManager.wait_for_session(master, config=None, max_wait_secs=inf)` {#SessionManager.wait_for_session} - -Creates a new `Session` and waits for model to be ready. - -Creates a new `Session` on 'master'. Waits for the model to be -initialized or recovered from a checkpoint. It's expected that -another thread or process will make the model ready, and that this -is intended to be used by threads/processes that participate in a -distributed training configuration where a different thread/process -is responsible for initializing or recovering the model being trained. - -NB: The amount of time this method waits for the session is bounded -by max_wait_secs. By default, this function will wait indefinitely. - -##### Args: - - -* `master`: `String` representation of the TensorFlow master to use. -* `config`: Optional ConfigProto proto used to configure the session. -* `max_wait_secs`: Maximum time to wait for the session to become available. - -##### Returns: - - A `Session`. May be None if the operation exceeds the timeout - specified by config.operation_timeout_in_ms. - -##### Raises: - - tf.DeadlineExceededError: if the session is not available after - max_wait_secs. - - - -- - - - -### `class tf.train.ClusterSpec` {#ClusterSpec} - -Represents a cluster as a set of "tasks", organized into "jobs". - -A `tf.train.ClusterSpec` represents the set of processes that -participate in a distributed TensorFlow computation. Every -[`tf.train.Server`](#Server) is constructed in a particular cluster. - -To create a cluster with two jobs and five tasks, you specify the -mapping from job names to lists of network addresses (typically -hostname-port pairs). - -```python -cluster = tf.train.ClusterSpec({"worker": ["worker0.example.com:2222", - "worker1.example.com:2222", - "worker2.example.com:2222"], - "ps": ["ps0.example.com:2222", - "ps1.example.com:2222"]}) -``` - -Each job may also be specified as a sparse mapping from task indices -to network addresses. This enables a server to be configured without -needing to know the identity of (for example) all other worker -tasks: - -```python -cluster = tf.train.ClusterSpec({"worker": {1: "worker1.example.com:2222"}, - "ps": ["ps0.example.com:2222", - "ps1.example.com:2222"]}) -``` - -- - - - -#### `tf.train.ClusterSpec.as_cluster_def()` {#ClusterSpec.as_cluster_def} - -Returns a `tf.train.ClusterDef` protocol buffer based on this cluster. - - -- - - - -#### `tf.train.ClusterSpec.as_dict()` {#ClusterSpec.as_dict} - -Returns a dictionary from job names to their tasks. - -For each job, if the task index space is dense, the corresponding -value will be a list of network addresses; otherwise it will be a -dictionary mapping (sparse) task indices to the corresponding -addresses. - -##### Returns: - - A dictionary mapping job names to lists or dictionaries - describing the tasks in those jobs. - - - -#### Other Methods -- - - - -#### `tf.train.ClusterSpec.__bool__()` {#ClusterSpec.__bool__} - - - - -- - - - -#### `tf.train.ClusterSpec.__eq__(other)` {#ClusterSpec.__eq__} - - - - -- - - - -#### `tf.train.ClusterSpec.__init__(cluster)` {#ClusterSpec.__init__} - -Creates a `ClusterSpec`. - -##### Args: - - -* `cluster`: A dictionary mapping one or more job names to (i) a - list of network addresses, or (ii) a dictionary mapping integer - task indices to network addresses; or a `tf.train.ClusterDef` - protocol buffer. - -##### Raises: - - -* `TypeError`: If `cluster` is not a dictionary mapping strings to lists - of strings, and not a `tf.train.ClusterDef` protobuf. - - -- - - - -#### `tf.train.ClusterSpec.__ne__(other)` {#ClusterSpec.__ne__} - - - - -- - - - -#### `tf.train.ClusterSpec.__nonzero__()` {#ClusterSpec.__nonzero__} - - - - -- - - - -#### `tf.train.ClusterSpec.job_tasks(job_name)` {#ClusterSpec.job_tasks} - -Returns a mapping from task ID to address in the given job. - -NOTE: For backwards compatibility, this method returns a list. If -the given job was defined with a sparse set of task indices, the -length of this list may not reflect the number of tasks defined in -this job. Use the [`num_tasks()`](#ClusterSpec.num_tasks) method -to find the number of tasks defined in a particular job. - -##### Args: - - -* `job_name`: The string name of a job in this cluster. - -##### Returns: - - A list of task addresses, where the index in the list - corresponds to the task index of each task. The list may contain - `None` if the job was defined with a sparse set of task indices. - -##### Raises: - - -* `ValueError`: If `job_name` does not name a job in this cluster. - - -- - - - -#### `tf.train.ClusterSpec.jobs` {#ClusterSpec.jobs} - -Returns a list of job names in this cluster. - -##### Returns: - - A list of strings, corresponding to the names of jobs in this cluster. - - -- - - - -#### `tf.train.ClusterSpec.num_tasks(job_name)` {#ClusterSpec.num_tasks} - -Returns the number of tasks defined in the given job. - -##### Args: - - -* `job_name`: The string name of a job in this cluster. - -##### Returns: - - The number of tasks defined in the given job. - -##### Raises: - - -* `ValueError`: If `job_name` does not name a job in this cluster. - - -- - - - -#### `tf.train.ClusterSpec.task_address(job_name, task_index)` {#ClusterSpec.task_address} - -Returns the address of the given task in the given job. - -##### Args: - - -* `job_name`: The string name of a job in this cluster. -* `task_index`: A non-negative integer. - -##### Returns: - - The address of the given task in the given job. - -##### Raises: - - -* `ValueError`: If `job_name` does not name a job in this cluster, - or no task with index `task_index` is defined in that job. - - -- - - - -#### `tf.train.ClusterSpec.task_indices(job_name)` {#ClusterSpec.task_indices} - -Returns a list of valid task indices in the given job. - -##### Args: - - -* `job_name`: The string name of a job in this cluster. - -##### Returns: - - A list of valid task indices in the given job. - -##### Raises: - - -* `ValueError`: If `job_name` does not name a job in this cluster, - or no task with index `task_index` is defined in that job. - - - -- - - - -### `tf.train.replica_device_setter(ps_tasks=0, ps_device='/job:ps', worker_device='/job:worker', merge_devices=True, cluster=None, ps_ops=None, ps_strategy=None)` {#replica_device_setter} - -Return a `device function` to use when building a Graph for replicas. - -Device Functions are used in `with tf.device(device_function):` statement to -automatically assign devices to `Operation` objects as they are constructed, -Device constraints are added from the inner-most context first, working -outwards. The merging behavior adds constraints to fields that are yet unset -by a more inner context. Currently the fields are (job, task, cpu/gpu). - -If `cluster` is `None`, and `ps_tasks` is 0, the returned function is a no-op. -Otherwise, the value of `ps_tasks` is derived from `cluster`. - -By default, only Variable ops are placed on ps tasks, and the placement -strategy is round-robin over all ps tasks. A custom `ps_strategy` may be used -to do more intelligent placement, such as -`tf.contrib.training.GreedyLoadBalancingStrategy`. - -For example, - -```python -# To build a cluster with two ps jobs on hosts ps0 and ps1, and 3 worker -# jobs on hosts worker0, worker1 and worker2. -cluster_spec = { - "ps": ["ps0:2222", "ps1:2222"], - "worker": ["worker0:2222", "worker1:2222", "worker2:2222"]} -with tf.device(tf.train.replica_device_setter(cluster=cluster_spec)): - # Build your graph - v1 = tf.Variable(...) # assigned to /job:ps/task:0 - v2 = tf.Variable(...) # assigned to /job:ps/task:1 - v3 = tf.Variable(...) # assigned to /job:ps/task:0 -# Run compute -``` - -##### Args: - - -* `ps_tasks`: Number of tasks in the `ps` job. Ignored if `cluster` is - provided. -* `ps_device`: String. Device of the `ps` job. If empty no `ps` job is used. - Defaults to `ps`. -* `worker_device`: String. Device of the `worker` job. If empty no `worker` - job is used. -* `merge_devices`: `Boolean`. If `True`, merges or only sets a device if the - device constraint is completely unset. merges device specification rather - than overriding them. -* `cluster`: `ClusterDef` proto or `ClusterSpec`. -* `ps_ops`: List of strings representing `Operation` types that need to be - placed on `ps` devices. If `None`, defaults to `["Variable"]`. -* `ps_strategy`: A callable invoked for every ps `Operation` (i.e. matched by - `ps_ops`), that takes the `Operation` and returns the ps task index to - use. If `None`, defaults to a round-robin strategy across all `ps` - devices. - -##### Returns: - - A function to pass to `tf.device()`. - -##### Raises: - - TypeError if `cluster` is not a dictionary or `ClusterDef` protocol buffer, - or if `ps_strategy` is provided but not a callable. - - -- - - - -### `tf.train.MonitoredTrainingSession(master='', is_chief=True, checkpoint_dir=None, scaffold=None, hooks=None, chief_only_hooks=None, save_checkpoint_secs=600, save_summaries_steps=100, save_summaries_secs=None, config=None, stop_grace_period_secs=120)` {#MonitoredTrainingSession} - -Creates a `MonitoredSession` for training. - -For a chief, this utility sets proper session initializer/restorer. It also -creates hooks related to checkpoint and summary saving. For workers, this -utility sets proper session creator which waits for the chief to -inialize/restore. - - -##### Args: - - -* `master`: `String` the TensorFlow master to use. -* `is_chief`: If `True`, it will take care of initialization and recovery the - underlying TensorFlow session. If `False`, it will wait on a chief to - initialize or recover the TensorFlow session. -* `checkpoint_dir`: A string. Optional path to a directory where to restore - variables. -* `scaffold`: A `Scaffold` used for gathering or building supportive ops. If - not specified, a default one is created. It's used to finalize the graph. -* `hooks`: Optional list of `SessionRunHook` objects. -* `chief_only_hooks`: list of `SessionRunHook` objects. Activate these hooks if - `is_chief==True`, ignore otherwise. -* `save_checkpoint_secs`: The frequency, in seconds, that a checkpoint is saved - using a default checkpoint saver. If `save_checkpoint_secs` is set to - `None`, then the default checkpoint saver isn't used. -* `save_summaries_steps`: The frequency, in number of global steps, that the - summaries are written to disk using a default summary saver. If both - `save_summaries_steps` and `save_summaries_secs` are set to `None`, then - the default summary saver isn't used. -* `save_summaries_secs`: The frequency, in secs, that the summaries are written - to disk using a default summary saver. If both `save_summaries_steps` and - `save_summaries_secs` are set to `None`, then the default summary saver - isn't used. -* `config`: an instance of `tf.ConfigProto` proto used to configure the session. - It's the `config` argument of constructor of `tf.Session`. -* `stop_grace_period_secs`: Number of seconds given to threads to stop after - `close()` has been called. - -##### Returns: - - A `MonitoredSession` object. - - -- - - - -### `class tf.train.MonitoredSession` {#MonitoredSession} - -Session-like object that handles initialization, recovery and hooks. - -Example usage: - -```python -saver_hook = CheckpointSaverHook(...) -summary_hook = SummaryHook(...) -with MonitoredSession(session_creator=ChiefSessionCreator(...), - hooks=[saver_hook, summary_hook]) as sess: - while not sess.should_stop(): - sess.run(train_op) -``` - -Initialization: At creation time the monitored session does following things -in given order: - -* calls `hook.begin()` for each given hook -* finalizes the graph via `scaffold.finalize()` -* create session -* initializes the model via initialization ops provided by `Scaffold` -* restores variables if a checkpoint exists -* launches queue runners - -Run: When `run()` is called, the monitored session does following things: - -* calls `hook.before_run()` -* calls TensorFlow `session.run()` with merged fetches and feed_dict -* calls `hook.after_run()` -* returns result of `session.run()` asked by user -* if `AbortedError` occurs, it recovers or reinitializes the session before - executing the run() call again - - -Exit: At the `close()`, the monitored session does following things in order: - -* calls `hook.end()` -* closes the queue runners and the session -* suppresses `OutOfRange` error which indicates that all inputs have been - processed if the monitored_session is used as a context - -How to set `tf.Session` arguments: - -* In most cases you can set session arguments as follows: - -```python -MonitoredSession( - session_creator=ChiefSessionCreator(master=..., config=...)) -``` - -* In distributed setting for a non-chief worker, you can use following: - -```python -MonitoredSession( - session_creator=WorkerSessionCreator(master=..., config=...)) -``` - -See `MonitoredTrainingSession` for an example usage based on chief or worker. - -Args: - session_creator: A factory object to create session. Typically a - `ChiefSessionCreator` which is the default one. - hooks: An iterable of `SessionRunHook' objects. - -Returns: - A MonitoredSession object. -- - - - -#### `tf.train.MonitoredSession.__enter__()` {#MonitoredSession.__enter__} - - - - -- - - - -#### `tf.train.MonitoredSession.__exit__(exception_type, exception_value, traceback)` {#MonitoredSession.__exit__} - - - - -- - - - -#### `tf.train.MonitoredSession.__init__(session_creator=None, hooks=None, stop_grace_period_secs=120)` {#MonitoredSession.__init__} - - - - -- - - - -#### `tf.train.MonitoredSession.close()` {#MonitoredSession.close} - - - - -- - - - -#### `tf.train.MonitoredSession.graph` {#MonitoredSession.graph} - -The graph that was launched in this session. - - -- - - - -#### `tf.train.MonitoredSession.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#MonitoredSession.run} - -Run ops in the monitored session. - -This method is completely compatible with the `tf.Session.run()` method. - -##### Args: - - -* `fetches`: Same as `tf.Session.run()`. -* `feed_dict`: Same as `tf.Session.run()`. -* `options`: Same as `tf.Session.run()`. -* `run_metadata`: Same as `tf.Session.run()`. - -##### Returns: - - Same as `tf.Session.run()`. - - -- - - - -#### `tf.train.MonitoredSession.should_stop()` {#MonitoredSession.should_stop} - - - - - -- - - - -### `class tf.train.SingularMonitoredSession` {#SingularMonitoredSession} - -Session-like object that handles initialization, restoring, and hooks. - -Please note that this utility is not recommended for distributed settings. -For distributed settings, please use `tf.train.MonitoredSession`. The -differences between `MonitoredSession` and `SingularMonitoredSession` are: -* `MonitoredSession` handles `AbortedError` for distributed settings, - but `SingularMonitoredSession` does not. -* `MonitoredSession` can be created in `chief` or `worker` modes. - `SingularMonitoredSession` is always created as `chief`. -* You can access the raw `tf.Session` object used by - `SingularMonitoredSession`, whereas in MonitoredSession the raw session is - private. This can be used: - - To `run` without hooks. - - To save and restore. -* All other functionality is identical. - -Example usage: -```python -saver_hook = CheckpointSaverHook(...) -summary_hook = SummaryHook(...) -with SingularMonitoredSession(hooks=[saver_hook, summary_hook]) as sess: - while not sess.should_stop(): - sess.run(train_op) -``` - -Initialization: At creation time the hooked session does following things -in given order: - -* calls `hook.begin()` for each given hook -* finalizes the graph via `scaffold.finalize()` -* create session -* initializes the model via initialization ops provided by `Scaffold` -* restores variables if a checkpoint exists -* launches queue runners - -Run: When `run()` is called, the hooked session does following things: - -* calls `hook.before_run()` -* calls TensorFlow `session.run()` with merged fetches and feed_dict -* calls `hook.after_run()` -* returns result of `session.run()` asked by user - -Exit: At the `close()`, the hooked session does following things in order: - -* calls `hook.end()` -* closes the queue runners and the session -* surpresses `OutOfRange` error which indicates that all inputs have been - processed if the `SingularMonitoredSession` is used as a context. -- - - - -#### `tf.train.SingularMonitoredSession.__enter__()` {#SingularMonitoredSession.__enter__} - - - - -- - - - -#### `tf.train.SingularMonitoredSession.__exit__(exception_type, exception_value, traceback)` {#SingularMonitoredSession.__exit__} - - - - -- - - - -#### `tf.train.SingularMonitoredSession.__init__(hooks=None, scaffold=None, master='', config=None, checkpoint_dir=None, stop_grace_period_secs=120)` {#SingularMonitoredSession.__init__} - -Creates a SingularMonitoredSession. - -##### Args: - - -* `hooks`: An iterable of `SessionRunHook' objects. -* `scaffold`: A `Scaffold` used for gathering or building supportive ops. If - not specified a default one is created. It's used to finalize the graph. -* `master`: `String` representation of the TensorFlow master to use. -* `config`: `ConfigProto` proto used to configure the session. -* `checkpoint_dir`: A string. Optional path to a directory where to restore - variables. -* `stop_grace_period_secs`: Number of seconds given to threads to stop after - `close()` has been called. - - -- - - - -#### `tf.train.SingularMonitoredSession.close()` {#SingularMonitoredSession.close} - - - - -- - - - -#### `tf.train.SingularMonitoredSession.graph` {#SingularMonitoredSession.graph} - -The graph that was launched in this session. - - -- - - - -#### `tf.train.SingularMonitoredSession.raw_session()` {#SingularMonitoredSession.raw_session} - -Returns underlying `TensorFlow.Session` object. - - -- - - - -#### `tf.train.SingularMonitoredSession.run(fetches, feed_dict=None, options=None, run_metadata=None)` {#SingularMonitoredSession.run} - -Run ops in the monitored session. - -This method is completely compatible with the `tf.Session.run()` method. - -##### Args: - - -* `fetches`: Same as `tf.Session.run()`. -* `feed_dict`: Same as `tf.Session.run()`. -* `options`: Same as `tf.Session.run()`. -* `run_metadata`: Same as `tf.Session.run()`. - -##### Returns: - - Same as `tf.Session.run()`. - - -- - - - -#### `tf.train.SingularMonitoredSession.should_stop()` {#SingularMonitoredSession.should_stop} - - - - - -- - - - -### `class tf.train.Scaffold` {#Scaffold} - -Structure to create or gather pieces commonly needed to train a model. - -When you build a model for training you usually need ops to initialize -variables, a `Saver` to checkpoint them, an op to collect summaries for -the visualizer, and so on. - -Various libraries built on top of the core TensorFlow library take care of -creating some or all of these pieces and storing them in well known -collections in the graph. The `Scaffold` class helps pick these pieces from -the graph collections, creating and adding them to the collections if needed. - -If you call the scaffold constructor without any arguments, it will pick -pieces from the collections, creating default ones if needed when -`scaffold.finalize()` is called. You can pass arguments to the constructor to -provide your own pieces. Pieces that you pass to the constructor are not -added to the graph collections. - -The following pieces are directly accessible as attributes of the `Scaffold` -object: - -* `saver`: A `tf.Saver` object taking care of saving the variables. Picked - from and stored into the `SAVERS` collection in the graph by default. -* `init_op`: An op to run to initialize the variables. Picked from and - stored into the `INIT_OP` collection in the graph by default. -* `ready_op`: An op to verify that the variables are initialized. Picked - from and stored into the `READY_OP` collection in the graph by default. -* `ready_for_local_init_op`: An op to verify that global state has been - initialized and it is alright to run `local_init_op`. Picked from and - stored into the `READY_FOR_LOCAL_INIT_OP` collection in the graph by - default. This is needed when the initialization of local variables depends - on the values of global variables. -* `local_init_op`: An op to initialize the local variables. Picked - from and stored into the `LOCAL_INIT_OP` collection in the graph by default. -* `summary_op`: An op to run and merge the summaries in the graph. Picked - from and stored into the `SUMMARY_OP` collection in the graph by default. -* `global_step`: A tensor containing the global step counter. Picked - from and stored into the `GLOBAL_STEP` collection in the graph by default. - -You can also pass the following additional pieces to the constructor: - -* `init_feed_dict`: A sessionn feed dictionary that should be used when - running the init op. -* `init_fn`: A callable to run run after the init op to perform additional - initializations. The callable will be called as - `init_fn(scaffold, session)`. -- - - - -#### `tf.train.Scaffold.__init__(init_op=None, init_feed_dict=None, init_fn=None, ready_op=None, ready_for_local_init_op=None, local_init_op=None, summary_op=None, saver=None)` {#Scaffold.__init__} - -Create a scaffold. - -##### Args: - - -* `init_op`: Optional op for initializing variables. -* `init_feed_dict`: Optional session feed dictionary to use when running the - init_op. -* `init_fn`: Optional function to use to initialize the model after running - the init_op. Will be called as `init_fn(scaffold, session)`. -* `ready_op`: Optional op to verify that the variables are initialized. Must - return an empty 1D string tensor when the variables are initialized, or - a non-empty 1D string tensor listing the names of the non-initialized - variables. -* `ready_for_local_init_op`: Optional op to verify that the global variables - are initialized and `local_init_op` can be run. Must return an empty - 1D string tensor when the global variables are initialized, or a - non-empty 1D string tensor listing the names of the non-initialized - global variables. -* `local_init_op`: Optional op to initialize local variables. -* `summary_op`: Optional op to gather all summaries. Must return a scalar - string tensor containing a serialized `Summary` proto. -* `saver`: Optional `tf.Saver` object to use to save and restore variables. - - -- - - - -#### `tf.train.Scaffold.finalize()` {#Scaffold.finalize} - -Creates operations if needed and finalizes the graph. - - -- - - - -#### `tf.train.Scaffold.get_or_default(arg_name, collection_key, default_constructor)` {#Scaffold.get_or_default} - -Get from cache or create a default operation. - - -- - - - -#### `tf.train.Scaffold.init_feed_dict` {#Scaffold.init_feed_dict} - - - - -- - - - -#### `tf.train.Scaffold.init_fn` {#Scaffold.init_fn} - - - - -- - - - -#### `tf.train.Scaffold.init_op` {#Scaffold.init_op} - - - - -- - - - -#### `tf.train.Scaffold.local_init_op` {#Scaffold.local_init_op} - - - - -- - - - -#### `tf.train.Scaffold.ready_for_local_init_op` {#Scaffold.ready_for_local_init_op} - - - - -- - - - -#### `tf.train.Scaffold.ready_op` {#Scaffold.ready_op} - - - - -- - - - -#### `tf.train.Scaffold.saver` {#Scaffold.saver} - - - - -- - - - -#### `tf.train.Scaffold.summary_op` {#Scaffold.summary_op} - - - - - -- - - - -### `class tf.train.SessionCreator` {#SessionCreator} - -A factory for tf.Session. -- - - - -#### `tf.train.SessionCreator.create_session()` {#SessionCreator.create_session} - - - - - -- - - - -### `class tf.train.ChiefSessionCreator` {#ChiefSessionCreator} - -Creates a tf.Session for a chief. -- - - - -#### `tf.train.ChiefSessionCreator.__init__(scaffold=None, master='', config=None, checkpoint_dir=None, checkpoint_filename_with_path=None)` {#ChiefSessionCreator.__init__} - -Initializes a chief session creator. - -##### Args: - - -* `scaffold`: A `Scaffold` used for gathering or building supportive ops. If - not specified a default one is created. It's used to finalize the graph. -* `master`: `String` representation of the TensorFlow master to use. -* `config`: `ConfigProto` proto used to configure the session. -* `checkpoint_dir`: A string. Optional path to a directory where to restore - variables. -* `checkpoint_filename_with_path`: Full file name path to the checkpoint file. - - -- - - - -#### `tf.train.ChiefSessionCreator.create_session()` {#ChiefSessionCreator.create_session} - - - - - -- - - - -### `class tf.train.WorkerSessionCreator` {#WorkerSessionCreator} - -Creates a tf.Session for a worker. -- - - - -#### `tf.train.WorkerSessionCreator.__init__(scaffold=None, master='', config=None)` {#WorkerSessionCreator.__init__} - -Initializes a worker session creator. - -##### Args: - - -* `scaffold`: A `Scaffold` used for gathering or building supportive ops. If - not specified a default one is created. It's used to finalize the graph. -* `master`: `String` representation of the TensorFlow master to use. -* `config`: `ConfigProto` proto used to configure the session. - - -- - - - -#### `tf.train.WorkerSessionCreator.create_session()` {#WorkerSessionCreator.create_session} - - - - - -- - - - -### `tf.train.summary_iterator(path)` {#summary_iterator} - -An iterator for reading `Event` protocol buffers from an event file. - -You can use this function to read events written to an event file. It returns -a Python iterator that yields `Event` protocol buffers. - -Example: Print the contents of an events file. - -```python -for e in tf.train.summary_iterator(path to events file): - print(e) -``` - -Example: Print selected summary values. - -```python -# This example supposes that the events file contains summaries with a -# summary value tag 'loss'. These could have been added by calling -# `add_summary()`, passing the output of a scalar summary op created with -# with: `tf.summary.scalar('loss', loss_tensor)`. -for e in tf.train.summary_iterator(path to events file): - for v in e.summary.value: - if v.tag == 'loss': - print(v.simple_value) -``` - -See the protocol buffer definitions of -[Event](https://www.tensorflow.org/code/tensorflow/core/util/event.proto) -and -[Summary](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto) -for more information about their attributes. - -##### Args: - - -* `path`: The path to an event file created by a `SummaryWriter`. - -##### Yields: - - `Event` protocol buffers. - - -- - - - -### `class tf.train.SessionRunHook` {#SessionRunHook} - -Hook to extend calls to MonitoredSession.run(). -- - - - -#### `tf.train.SessionRunHook.after_create_session(session, coord)` {#SessionRunHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.SessionRunHook.after_run(run_context, run_values)` {#SessionRunHook.after_run} - -Called after each call to run(). - -The `run_values` argument contains results of requested ops/tensors by -`before_run()`. - -The `run_context` argument is the same one send to `before_run` call. -`run_context.request_stop()` can be called to stop the iteration. - -##### Args: - - -* `run_context`: A `SessionRunContext` object. -* `run_values`: A SessionRunValues object. - - -- - - - -#### `tf.train.SessionRunHook.before_run(run_context)` {#SessionRunHook.before_run} - -Called before each call to run(). - -You can return from this call a `SessionRunArgs` object indicating ops or -tensors to add to the upcoming `run()` call. These ops/tensors will be run -together with the ops/tensors originally passed to the original run() call. -The run args you return can also contain feeds to be added to the run() -call. - -The `run_context` argument is a `SessionRunContext` that provides -information about the upcoming `run()` call: the originally requested -op/tensors, the TensorFlow Session. - -At this point graph is finalized and you can not add ops. - -##### Args: - - -* `run_context`: A `SessionRunContext` object. - -##### Returns: - - None or a `SessionRunArgs` object. - - -- - - - -#### `tf.train.SessionRunHook.begin()` {#SessionRunHook.begin} - -Called once before using the session. - -When called, the default graph is the one that will be launched in the -session. The hook can modify the graph by adding new operations to it. -After the `begin()` call the graph will be finalized and the other callbacks -can not modify the graph anymore. Second call of `begin()` on the same -graph, should not change the graph. - - -- - - - -#### `tf.train.SessionRunHook.end(session)` {#SessionRunHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - - -- - - - -### `class tf.train.SessionRunArgs` {#SessionRunArgs} - -Represents arguments to be added to a `Session.run()` call. - -Args: - fetches: Exactly like the 'fetches' argument to Session.Run(). - Can be a single tensor or op, a list of 'fetches' or a dictionary - of fetches. For example: - fetches = global_step_tensor - fetches = [train_op, summary_op, global_step_tensor] - fetches = {'step': global_step_tensor, 'summ': summary_op} - Note that this can recurse as expected: - fetches = {'step': global_step_tensor, - 'ops': [train_op, check_nan_op]} - feed_dict: Exactly like the `feed_dict` argument to `Session.Run()` - options: Exactly like the `options` argument to `Session.run()`, i.e., a - config_pb2.RunOptions proto. -- - - - -#### `tf.train.SessionRunArgs.__getnewargs__()` {#SessionRunArgs.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.train.SessionRunArgs.__getstate__()` {#SessionRunArgs.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.train.SessionRunArgs.__new__(cls, fetches, feed_dict=None, options=None)` {#SessionRunArgs.__new__} - - - - -- - - - -#### `tf.train.SessionRunArgs.__repr__()` {#SessionRunArgs.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.train.SessionRunArgs.feed_dict` {#SessionRunArgs.feed_dict} - -Alias for field number 1 - - -- - - - -#### `tf.train.SessionRunArgs.fetches` {#SessionRunArgs.fetches} - -Alias for field number 0 - - -- - - - -#### `tf.train.SessionRunArgs.options` {#SessionRunArgs.options} - -Alias for field number 2 - - - -- - - - -### `class tf.train.SessionRunContext` {#SessionRunContext} - -Provides information about the `session.run()` call being made. - -Provides information about original request to `Session.Run()` function. -SessionRunHook objects can stop the loop by calling `request_stop()` of -`run_context`. In the future we may use this object to add more information -about run without changing the Hook API. -- - - - -#### `tf.train.SessionRunContext.__init__(original_args, session)` {#SessionRunContext.__init__} - -Initializes SessionRunContext. - - -- - - - -#### `tf.train.SessionRunContext.original_args` {#SessionRunContext.original_args} - -A `SessionRunArgs` object holding the original arguments of `run()`. - -If user called `MonitoredSession.run(fetches=a, feed_dict=b)`, then this -field is equal to SessionRunArgs(a, b). - -##### Returns: - - A `SessionRunArgs` object - - -- - - - -#### `tf.train.SessionRunContext.request_stop()` {#SessionRunContext.request_stop} - -Sets stop requested field. - -Hooks can use this function to request stop of iterations. -`MonitoredSession` checks whether this is called or not. - - -- - - - -#### `tf.train.SessionRunContext.session` {#SessionRunContext.session} - -A TensorFlow session object which will execute the `run`. - - -- - - - -#### `tf.train.SessionRunContext.stop_requested` {#SessionRunContext.stop_requested} - -Returns whether a stop is requested or not. - -If true, `MonitoredSession` stops iterations. - -##### Returns: - - A `bool` - - - -- - - - -### `class tf.train.SessionRunValues` {#SessionRunValues} - -Contains the results of `Session.run()`. - -In the future we may use this object to add more information about result of -run without changing the Hook API. - -Args: - results: The return values from `Session.run()` corresponding to the fetches - attribute returned in the RunArgs. Note that this has the same shape as - the RunArgs fetches. For example: - fetches = global_step_tensor - => results = nparray(int) - fetches = [train_op, summary_op, global_step_tensor] - => results = [None, nparray(string), nparray(int)] - fetches = {'step': global_step_tensor, 'summ': summary_op} - => results = {'step': nparray(int), 'summ': nparray(string)} - options: `RunOptions` from the `Session.run()` call. - run_metadata: `RunMetadata` from the `Session.run()` call. -- - - - -#### `tf.train.SessionRunValues.__getnewargs__()` {#SessionRunValues.__getnewargs__} - -Return self as a plain tuple. Used by copy and pickle. - - -- - - - -#### `tf.train.SessionRunValues.__getstate__()` {#SessionRunValues.__getstate__} - -Exclude the OrderedDict from pickling - - -- - - - -#### `tf.train.SessionRunValues.__new__(_cls, results, options, run_metadata)` {#SessionRunValues.__new__} - -Create new instance of SessionRunValues(results, options, run_metadata) - - -- - - - -#### `tf.train.SessionRunValues.__repr__()` {#SessionRunValues.__repr__} - -Return a nicely formatted representation string - - -- - - - -#### `tf.train.SessionRunValues.options` {#SessionRunValues.options} - -Alias for field number 1 - - -- - - - -#### `tf.train.SessionRunValues.results` {#SessionRunValues.results} - -Alias for field number 0 - - -- - - - -#### `tf.train.SessionRunValues.run_metadata` {#SessionRunValues.run_metadata} - -Alias for field number 2 - - - -- - - - -### `class tf.train.LoggingTensorHook` {#LoggingTensorHook} - -Prints the given tensors once every N local steps or once every N seconds. - -The tensors will be printed to the log, with `INFO` severity. -- - - - -#### `tf.train.LoggingTensorHook.__init__(tensors, every_n_iter=None, every_n_secs=None, formatter=None)` {#LoggingTensorHook.__init__} - -Initializes a LoggingHook monitor. - -##### Args: - - -* `tensors`: `dict` that maps string-valued tags to tensors/tensor names, - or `iterable` of tensors/tensor names. -* `every_n_iter`: `int`, print the values of `tensors` once every N local - steps taken on the current worker. -* `every_n_secs`: `int` or `float`, print the values of `tensors` once every N - seconds. Exactly one of `every_n_iter` and `every_n_secs` should be - provided. -* `formatter`: function, takes dict of `tag`->`Tensor` and returns a string. - If `None` uses default printing all tensors. - -##### Raises: - - -* `ValueError`: if `every_n_iter` is non-positive. - - -- - - - -#### `tf.train.LoggingTensorHook.after_create_session(session, coord)` {#LoggingTensorHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.LoggingTensorHook.after_run(run_context, run_values)` {#LoggingTensorHook.after_run} - - - - -- - - - -#### `tf.train.LoggingTensorHook.before_run(run_context)` {#LoggingTensorHook.before_run} - - - - -- - - - -#### `tf.train.LoggingTensorHook.begin()` {#LoggingTensorHook.begin} - - - - -- - - - -#### `tf.train.LoggingTensorHook.end(session)` {#LoggingTensorHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - - -- - - - -### `class tf.train.StopAtStepHook` {#StopAtStepHook} - -Monitor to request stop at a specified step. -- - - - -#### `tf.train.StopAtStepHook.__init__(num_steps=None, last_step=None)` {#StopAtStepHook.__init__} - -Create a StopAtStep Hook. - -This hook requests stop after either a number of steps have been -executed or a last step has been reached. Only of the two options can be -specified. - -if `num_steps` is specified, it indicates the number of steps to execute -after `begin()` is called. If instead `last_step` is specified, it -indicates the last step we want to execute, as passed to the `after_run()` -call. - -##### Args: - - -* `num_steps`: Number of steps to execute. -* `last_step`: Step after which to stop. - -##### Raises: - - -* `ValueError`: If one of the arguments is invalid. - - -- - - - -#### `tf.train.StopAtStepHook.after_create_session(session, coord)` {#StopAtStepHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.StopAtStepHook.after_run(run_context, run_values)` {#StopAtStepHook.after_run} - - - - -- - - - -#### `tf.train.StopAtStepHook.before_run(run_context)` {#StopAtStepHook.before_run} - - - - -- - - - -#### `tf.train.StopAtStepHook.begin()` {#StopAtStepHook.begin} - - - - -- - - - -#### `tf.train.StopAtStepHook.end(session)` {#StopAtStepHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - - -- - - - -### `class tf.train.CheckpointSaverHook` {#CheckpointSaverHook} - -Saves checkpoints every N steps or seconds. -- - - - -#### `tf.train.CheckpointSaverHook.__init__(checkpoint_dir, save_secs=None, save_steps=None, saver=None, checkpoint_basename='model.ckpt', scaffold=None, listeners=None)` {#CheckpointSaverHook.__init__} - -Initialize CheckpointSaverHook monitor. - -##### Args: - - -* `checkpoint_dir`: `str`, base directory for the checkpoint files. -* `save_secs`: `int`, save every N secs. -* `save_steps`: `int`, save every N steps. -* `saver`: `Saver` object, used for saving. -* `checkpoint_basename`: `str`, base name for the checkpoint files. -* `scaffold`: `Scaffold`, use to get saver object. -* `listeners`: List of `CheckpointSaverListener` subclass instances. - Used for callbacks that run immediately after the corresponding - CheckpointSaverHook callbacks, only in steps where the - CheckpointSaverHook was triggered. - -##### Raises: - - -* `ValueError`: One of `save_steps` or `save_secs` should be set. -* `ValueError`: Exactly one of saver or scaffold should be set. - - -- - - - -#### `tf.train.CheckpointSaverHook.after_create_session(session, coord)` {#CheckpointSaverHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.CheckpointSaverHook.after_run(run_context, run_values)` {#CheckpointSaverHook.after_run} - - - - -- - - - -#### `tf.train.CheckpointSaverHook.before_run(run_context)` {#CheckpointSaverHook.before_run} - - - - -- - - - -#### `tf.train.CheckpointSaverHook.begin()` {#CheckpointSaverHook.begin} - - - - -- - - - -#### `tf.train.CheckpointSaverHook.end(session)` {#CheckpointSaverHook.end} - - - - - -- - - - -### `tf.train.NewCheckpointReader(filepattern)` {#NewCheckpointReader} - - - - -- - - - -### `class tf.train.StepCounterHook` {#StepCounterHook} - -Steps per second monitor. -- - - - -#### `tf.train.StepCounterHook.__init__(every_n_steps=100, every_n_secs=None, output_dir=None, summary_writer=None)` {#StepCounterHook.__init__} - - - - -- - - - -#### `tf.train.StepCounterHook.after_create_session(session, coord)` {#StepCounterHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.StepCounterHook.after_run(run_context, run_values)` {#StepCounterHook.after_run} - - - - -- - - - -#### `tf.train.StepCounterHook.before_run(run_context)` {#StepCounterHook.before_run} - - - - -- - - - -#### `tf.train.StepCounterHook.begin()` {#StepCounterHook.begin} - - - - -- - - - -#### `tf.train.StepCounterHook.end(session)` {#StepCounterHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - - -- - - - -### `class tf.train.NanLossDuringTrainingError` {#NanLossDuringTrainingError} - - -- - - - -#### `tf.train.NanLossDuringTrainingError.__str__()` {#NanLossDuringTrainingError.__str__} - - - - - -- - - - -### `class tf.train.NanTensorHook` {#NanTensorHook} - -NaN Loss monitor. - -Monitors loss and stops training if loss is NaN. -Can either fail with exception or just stop training. -- - - - -#### `tf.train.NanTensorHook.__init__(loss_tensor, fail_on_nan_loss=True)` {#NanTensorHook.__init__} - -Initializes NanLoss monitor. - -##### Args: - - -* `loss_tensor`: `Tensor`, the loss tensor. -* `fail_on_nan_loss`: `bool`, whether to raise exception when loss is NaN. - - -- - - - -#### `tf.train.NanTensorHook.after_create_session(session, coord)` {#NanTensorHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.NanTensorHook.after_run(run_context, run_values)` {#NanTensorHook.after_run} - - - - -- - - - -#### `tf.train.NanTensorHook.before_run(run_context)` {#NanTensorHook.before_run} - - - - -- - - - -#### `tf.train.NanTensorHook.begin()` {#NanTensorHook.begin} - -Called once before using the session. - -When called, the default graph is the one that will be launched in the -session. The hook can modify the graph by adding new operations to it. -After the `begin()` call the graph will be finalized and the other callbacks -can not modify the graph anymore. Second call of `begin()` on the same -graph, should not change the graph. - - -- - - - -#### `tf.train.NanTensorHook.end(session)` {#NanTensorHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - - -- - - - -### `class tf.train.SummarySaverHook` {#SummarySaverHook} - -Saves summaries every N steps. -- - - - -#### `tf.train.SummarySaverHook.__init__(save_steps=None, save_secs=None, output_dir=None, summary_writer=None, scaffold=None, summary_op=None)` {#SummarySaverHook.__init__} - -Initializes a `SummarySaver` monitor. - -##### Args: - - -* `save_steps`: `int`, save summaries every N steps. Exactly one of - `save_secs` and `save_steps` should be set. -* `save_secs`: `int`, save summaries every N seconds. -* `output_dir`: `string`, the directory to save the summaries to. Only used - if no `summary_writer` is supplied. -* `summary_writer`: `SummaryWriter`. If `None` and an `output_dir` was passed, - one will be created accordingly. -* `scaffold`: `Scaffold` to get summary_op if it's not provided. -* `summary_op`: `Tensor` of type `string` containing the serialized `Summary` - protocol buffer or a list of `Tensor`. They are most likely an output - by TF summary methods like `tf.summary.scalar` or - `tf.summary.merge_all`. It can be passed in as one tensor; if more - than one, they must be passed in as a list. - -##### Raises: - - -* `ValueError`: Exactly one of scaffold or summary_op should be set. - - -- - - - -#### `tf.train.SummarySaverHook.after_create_session(session, coord)` {#SummarySaverHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.SummarySaverHook.after_run(run_context, run_values)` {#SummarySaverHook.after_run} - - - - -- - - - -#### `tf.train.SummarySaverHook.before_run(run_context)` {#SummarySaverHook.before_run} - - - - -- - - - -#### `tf.train.SummarySaverHook.begin()` {#SummarySaverHook.begin} - - - - -- - - - -#### `tf.train.SummarySaverHook.end(session=None)` {#SummarySaverHook.end} - - - - - -- - - - -### `class tf.train.GlobalStepWaiterHook` {#GlobalStepWaiterHook} - -Delay execution until global step reaches to wait_until_step. - -This hook delays execution until global step reaches to `wait_until_step`. It -is used to gradually start workers in distributed settings. One example usage -would be setting `wait_until_step=int(K*log(task_id+1))` assuming that -task_id=0 is the chief. -- - - - -#### `tf.train.GlobalStepWaiterHook.__init__(wait_until_step)` {#GlobalStepWaiterHook.__init__} - -Create a _GlobalStepWaiterHook. - -##### Args: - - -* `wait_until_step`: an `int` shows until which global step should we wait. - - -- - - - -#### `tf.train.GlobalStepWaiterHook.after_create_session(session, coord)` {#GlobalStepWaiterHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.GlobalStepWaiterHook.after_run(run_context, run_values)` {#GlobalStepWaiterHook.after_run} - -Called after each call to run(). - -The `run_values` argument contains results of requested ops/tensors by -`before_run()`. - -The `run_context` argument is the same one send to `before_run` call. -`run_context.request_stop()` can be called to stop the iteration. - -##### Args: - - -* `run_context`: A `SessionRunContext` object. -* `run_values`: A SessionRunValues object. - - -- - - - -#### `tf.train.GlobalStepWaiterHook.before_run(run_context)` {#GlobalStepWaiterHook.before_run} - - - - -- - - - -#### `tf.train.GlobalStepWaiterHook.begin()` {#GlobalStepWaiterHook.begin} - - - - -- - - - -#### `tf.train.GlobalStepWaiterHook.end(session)` {#GlobalStepWaiterHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - - -- - - - -### `class tf.train.FinalOpsHook` {#FinalOpsHook} - -A run hook which evaluates `Tensors` at the end of a session. -- - - - -#### `tf.train.FinalOpsHook.__init__(final_ops, final_ops_feed_dict=None)` {#FinalOpsHook.__init__} - -Constructs the FinalOpHook with ops to run at the end of the session. - -##### Args: - - -* `final_ops`: A single `Tensor`, a list of `Tensors` or a dictionary of - names to `Tensors`. -* `final_ops_feed_dict`: A feed dictionary to use when running - `final_ops_dict`. - - -- - - - -#### `tf.train.FinalOpsHook.after_create_session(session, coord)` {#FinalOpsHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.FinalOpsHook.after_run(run_context, run_values)` {#FinalOpsHook.after_run} - -Called after each call to run(). - -The `run_values` argument contains results of requested ops/tensors by -`before_run()`. - -The `run_context` argument is the same one send to `before_run` call. -`run_context.request_stop()` can be called to stop the iteration. - -##### Args: - - -* `run_context`: A `SessionRunContext` object. -* `run_values`: A SessionRunValues object. - - -- - - - -#### `tf.train.FinalOpsHook.before_run(run_context)` {#FinalOpsHook.before_run} - -Called before each call to run(). - -You can return from this call a `SessionRunArgs` object indicating ops or -tensors to add to the upcoming `run()` call. These ops/tensors will be run -together with the ops/tensors originally passed to the original run() call. -The run args you return can also contain feeds to be added to the run() -call. - -The `run_context` argument is a `SessionRunContext` that provides -information about the upcoming `run()` call: the originally requested -op/tensors, the TensorFlow Session. - -At this point graph is finalized and you can not add ops. - -##### Args: - - -* `run_context`: A `SessionRunContext` object. - -##### Returns: - - None or a `SessionRunArgs` object. - - -- - - - -#### `tf.train.FinalOpsHook.begin()` {#FinalOpsHook.begin} - -Called once before using the session. - -When called, the default graph is the one that will be launched in the -session. The hook can modify the graph by adding new operations to it. -After the `begin()` call the graph will be finalized and the other callbacks -can not modify the graph anymore. Second call of `begin()` on the same -graph, should not change the graph. - - -- - - - -#### `tf.train.FinalOpsHook.end(session)` {#FinalOpsHook.end} - - - - -- - - - -#### `tf.train.FinalOpsHook.final_ops_values` {#FinalOpsHook.final_ops_values} - - - - - -- - - - -### `class tf.train.FeedFnHook` {#FeedFnHook} - -Runs `feed_fn` and sets the `feed_dict` accordingly. -- - - - -#### `tf.train.FeedFnHook.__init__(feed_fn)` {#FeedFnHook.__init__} - -Constructs the FeedFnHook with given `feed_fn`. - -##### Args: - - -* `feed_fn`: function, no arguments and returns `dict` to feed. - - -- - - - -#### `tf.train.FeedFnHook.after_create_session(session, coord)` {#FeedFnHook.after_create_session} - -Called when new TensorFlow session is created. - -This is called to signal the hooks that a new session has been created. This -has two essential differences with the situation in which `begin` is called: - -* When this is called, the graph is finalized and ops can no longer be added - to the graph. -* This method will also be called as a result of recovering a wrapped - session, not only at the beginning of the overall session. - -##### Args: - - -* `session`: A TensorFlow Session that has been created. -* `coord`: A Coordinator object which keeps track of all threads. - - -- - - - -#### `tf.train.FeedFnHook.after_run(run_context, run_values)` {#FeedFnHook.after_run} - -Called after each call to run(). - -The `run_values` argument contains results of requested ops/tensors by -`before_run()`. - -The `run_context` argument is the same one send to `before_run` call. -`run_context.request_stop()` can be called to stop the iteration. - -##### Args: - - -* `run_context`: A `SessionRunContext` object. -* `run_values`: A SessionRunValues object. - - -- - - - -#### `tf.train.FeedFnHook.before_run(run_context)` {#FeedFnHook.before_run} - - - - -- - - - -#### `tf.train.FeedFnHook.begin()` {#FeedFnHook.begin} - -Called once before using the session. - -When called, the default graph is the one that will be launched in the -session. The hook can modify the graph by adding new operations to it. -After the `begin()` call the graph will be finalized and the other callbacks -can not modify the graph anymore. Second call of `begin()` on the same -graph, should not change the graph. - - -- - - - -#### `tf.train.FeedFnHook.end(session)` {#FeedFnHook.end} - -Called at the end of session. - -The `session` argument can be used in case the hook wants to run final ops, -such as saving a last checkpoint. - -##### Args: - - -* `session`: A TensorFlow Session that will be soon closed. - - - -- - - - -### `tf.train.global_step(sess, global_step_tensor)` {#global_step} - -Small helper to get the global step. - -```python -# Creates a variable to hold the global_step. -global_step_tensor = tf.Variable(10, trainable=False, name='global_step') -# Creates a session. -sess = tf.Session() -# Initializes the variable. -print('global_step: %s' % tf.train.global_step(sess, global_step_tensor)) - -global_step: 10 -``` - -##### Args: - - -* `sess`: A TensorFlow `Session` object. -* `global_step_tensor`: `Tensor` or the `name` of the operation that contains - the global step. - -##### Returns: - - The global step value. - - -- - - - -### `tf.train.basic_train_loop(supervisor, train_step_fn, args=None, kwargs=None, master='')` {#basic_train_loop} - -Basic loop to train a model. - -Calls `train_step_fn` in a loop to train a model. The function is called as: - -```python -train_step_fn(session, *args, **kwargs) -``` - -It is passed a `tf.Session` in addition to `args` and `kwargs`. The function -typically runs one training step in the session. - -##### Args: - - -* `supervisor`: `tf.Supervisor` to run the training services. -* `train_step_fn`: Callable to execute one training step. Called - repeatedly as `train_step_fn(session, *args **kwargs)`. -* `args`: Optional positional arguments passed to `train_step_fn`. -* `kwargs`: Optional keyword arguments passed to `train_step_fn`. -* `master`: Master to use to create the training session. Defaults to - `""` which causes the session to be created in the local process. - - -- - - - -### `tf.train.get_global_step(graph=None)` {#get_global_step} - -Get the global step tensor. - -The global step tensor must be an integer variable. We first try to find it -in the collection `GLOBAL_STEP`, or by name `global_step:0`. - -##### Args: - - -* `graph`: The graph to find the global step in. If missing, use default graph. - -##### Returns: - - The global step variable, or `None` if none was found. - -##### Raises: - - -* `TypeError`: If the global step tensor has a non-integer type, or if it is not - a `Variable`. - - -- - - - -### `tf.train.assert_global_step(global_step_tensor)` {#assert_global_step} - -Asserts `global_step_tensor` is a scalar int `Variable` or `Tensor`. - -##### Args: - - -* `global_step_tensor`: `Tensor` to test. - - -- - - - -### `tf.train.write_graph(graph_or_graph_def, logdir, name, as_text=True)` {#write_graph} - -Writes a graph proto to a file. - -The graph is written as a binary proto unless `as_text` is `True`. - -```python -v = tf.Variable(0, name='my_variable') -sess = tf.Session() -tf.train.write_graph(sess.graph_def, '/tmp/my-model', 'train.pbtxt') -``` - -or - -```python -v = tf.Variable(0, name='my_variable') -sess = tf.Session() -tf.train.write_graph(sess.graph, '/tmp/my-model', 'train.pbtxt') -``` - -##### Args: - - -* `graph_or_graph_def`: A `Graph` or a `GraphDef` protocol buffer. -* `logdir`: Directory where to write the graph. This can refer to remote - filesystems, such as Google Cloud Storage (GCS). -* `name`: Filename for the graph. -* `as_text`: If `True`, writes the graph as an ASCII proto. - -##### Returns: - - The path of the output proto file. - - - -## Other Functions and Classes -- - - - -### `class tf.train.SyncReplicasOptimizer` {#SyncReplicasOptimizer} - -Class to synchronize, aggregate gradients and pass them to the optimizer. - -In a typical asynchronous training environment, it's common to have some -stale gradients. For example, with a N-replica asynchronous training, -gradients will be applied to the variables N times independently. Depending -on each replica's training speed, some gradients might be calculated from -copies of the variable from several steps back (N-1 steps on average). This -optimizer avoids stale gradients by collecting gradients from all replicas, -averaging them, then applying them to the variables in one shot, after -which replicas can fetch the new variables and continue. - -The following accumulators/queue are created: - -* N `gradient accumulators`, one per variable to train. Gradients are pushed - to them and the chief worker will wait until enough gradients are collected - and then average them before applying to variables. The accumulator will - drop all stale gradients (more details in the accumulator op). -* 1 `token` queue where the optimizer pushes the new global_step value after - all variables are updated. - -The following local variable is created: -* `sync_rep_local_step`, one per replica. Compared against the global_step in - each accumulator to check for staleness of the gradients. - -The optimizer adds nodes to the graph to collect gradients and pause the -trainers until variables are updated. -For the Parameter Server job: - -1. An accumulator is created for each variable, and each replica pushes the - gradients into the accumulators instead of directly applying them to the - variables. -2. Each accumulator averages once enough gradients (replicas_to_aggregate) - have been accumulated. -3. Apply the averaged gradients to the variables. -4. Only after all variables have been updated, increment the global step. -5. Only after step 4, pushes `global_step` in the `token_queue`, once for - each worker replica. The workers can now fetch the global step, use it to - update its local_step variable and start the next batch. - -For the replicas: - -1. Start a step: fetch variables and compute gradients. -2. Once the gradients have been computed, push them into gradient - accumulators. Each accumulator will check the staleness and drop the stale. -3. After pushing all the gradients, dequeue an updated value of global_step - from the token queue and record that step to its local_step variable. Note - that this is effectively a barrier. -4. Start the next batch. - -### Usage - -```python -# Create any optimizer to update the variables, say a simple SGD: -opt = GradientDescentOptimizer(learning_rate=0.1) - -# Wrap the optimizer with sync_replicas_optimizer with 50 replicas: at each -# step the optimizer collects 50 gradients before applying to variables. -# Note that if you want to have 2 backup replicas, you can change -# total_num_replicas=52 and make sure this number matches how many physical -# replicas you started in your job. -opt = tf.SyncReplicasOptimizer(opt, replicas_to_aggregate=50, - total_num_replicas=50) - -# Some models have startup_delays to help stabilize the model but when using -# sync_replicas training, set it to 0. - -# Now you can call `minimize()` or `compute_gradients()` and -# `apply_gradients()` normally -training_op = opt.minimize(total_loss, global_step=self.global_step) - - -# You can create the hook which handles initialization and queues. -sync_replicas_hook = opt.make_session_run_hook(is_chief) -``` - -In the training program, every worker will run the train_op as if not -synchronized. - -```python -with training.MonitoredTrainingSession( - master=workers[worker_id].target, is_chief=is_chief, - hooks=[sync_replicas_hook]) as mon_sess: - while not mon_sess.should_stop(): - mon_sess.run(training_op) -``` - -- - - - -#### `tf.train.SyncReplicasOptimizer.__init__(opt, replicas_to_aggregate, total_num_replicas=None, variable_averages=None, variables_to_average=None, use_locking=False, name='sync_replicas')` {#SyncReplicasOptimizer.__init__} - -Construct a sync_replicas optimizer. - -##### Args: - - -* `opt`: The actual optimizer that will be used to compute and apply the - gradients. Must be one of the Optimizer classes. -* `replicas_to_aggregate`: number of replicas to aggregate for each variable - update. -* `total_num_replicas`: Total number of tasks/workers/replicas, could be - different from replicas_to_aggregate. - If total_num_replicas > replicas_to_aggregate: it is backup_replicas + - replicas_to_aggregate. - If total_num_replicas < replicas_to_aggregate: Replicas compute - multiple batches per update to variables. -* `variable_averages`: Optional `ExponentialMovingAverage` object, used to - maintain moving averages for the variables passed in - `variables_to_average`. -* `variables_to_average`: a list of variables that need to be averaged. Only - needed if variable_averages is passed in. -* `use_locking`: If True use locks for update operation. -* `name`: string. Optional name of the returned operation. - - -- - - - -#### `tf.train.SyncReplicasOptimizer.compute_gradients(*args, **kwargs)` {#SyncReplicasOptimizer.compute_gradients} - -Compute gradients of "loss" for the variables in "var_list". - -This simply wraps the compute_gradients() from the real optimizer. The -gradients will be aggregated in the apply_gradients() so that user can -modify the gradients like clipping with per replica global norm if needed. -The global norm with aggregated gradients can be bad as one replica's huge -gradients can hurt the gradients from other replicas. - -##### Args: - - -* `*args`: Arguments for compute_gradients(). -* `**kwargs`: Keyword arguments for compute_gradients(). - -##### Returns: - - A list of (gradient, variable) pairs. - - -- - - - -#### `tf.train.SyncReplicasOptimizer.apply_gradients(grads_and_vars, global_step=None, name=None)` {#SyncReplicasOptimizer.apply_gradients} - -Apply gradients to variables. - -This contains most of the synchronization implementation and also wraps the -apply_gradients() from the real optimizer. - -##### Args: - - -* `grads_and_vars`: List of (gradient, variable) pairs as returned by - compute_gradients(). -* `global_step`: Optional Variable to increment by one after the - variables have been updated. -* `name`: Optional name for the returned operation. Default to the - name passed to the Optimizer constructor. - -##### Returns: - - -* `train_op`: The op to dequeue a token so the replicas can exit this batch - and start the next one. This is executed by each replica. - -##### Raises: - - -* `ValueError`: If the grads_and_vars is empty. -* `ValueError`: If global step is not provided, the staleness cannot be - checked. - - -- - - - -#### `tf.train.SyncReplicasOptimizer.get_chief_queue_runner()` {#SyncReplicasOptimizer.get_chief_queue_runner} - -Returns the QueueRunner for the chief to execute. - -This includes the operations to synchronize replicas: aggregate gradients, -apply to variables, increment global step, insert tokens to token queue. - -Note that this can only be called after calling apply_gradients() which -actually generates this queuerunner. - -##### Returns: - - A `QueueRunner` for chief to execute. - -##### Raises: - - -* `ValueError`: If this is called before apply_gradients(). - - -- - - - -#### `tf.train.SyncReplicasOptimizer.get_init_tokens_op(num_tokens=-1)` {#SyncReplicasOptimizer.get_init_tokens_op} - -Returns the op to fill the sync_token_queue with the tokens. - -This is supposed to be executed in the beginning of the chief/sync thread -so that even if the total_num_replicas is less than replicas_to_aggregate, -the model can still proceed as the replicas can compute multiple steps per -variable update. Make sure: -`num_tokens >= replicas_to_aggregate - total_num_replicas`. - -##### Args: - - -* `num_tokens`: Number of tokens to add to the queue. - -##### Returns: - - An op for the chief/sync replica to fill the token queue. - -##### Raises: - - -* `ValueError`: If this is called before apply_gradients(). -* `ValueError`: If num_tokens are smaller than replicas_to_aggregate - - total_num_replicas. - - - -#### Other Methods -- - - - -#### `tf.train.SyncReplicasOptimizer.get_slot(*args, **kwargs)` {#SyncReplicasOptimizer.get_slot} - -Return a slot named "name" created for "var" by the Optimizer. - -This simply wraps the get_slot() from the actual optimizer. - -##### Args: - - -* `*args`: Arguments for get_slot(). -* `**kwargs`: Keyword arguments for get_slot(). - -##### Returns: - - The `Variable` for the slot if it was created, `None` otherwise. - - -- - - - -#### `tf.train.SyncReplicasOptimizer.get_slot_names(*args, **kwargs)` {#SyncReplicasOptimizer.get_slot_names} - -Return a list of the names of slots created by the `Optimizer`. - -This simply wraps the get_slot_names() from the actual optimizer. - -##### Args: - - -* `*args`: Arguments for get_slot(). -* `**kwargs`: Keyword arguments for get_slot(). - -##### Returns: - - A list of strings. - - -- - - - -#### `tf.train.SyncReplicasOptimizer.make_session_run_hook(is_chief, num_tokens=-1)` {#SyncReplicasOptimizer.make_session_run_hook} - -Creates a hook to handle SyncReplicasHook ops such as initialization. - - - -- - - - -### `tf.train.checkpoint_exists(checkpoint_prefix)` {#checkpoint_exists} - -Checks whether a V1 or V2 checkpoint exists with the specified prefix. - -This is the recommended way to check if a checkpoint exists, since it takes -into account the naming difference between V1 and V2 formats. - -##### Args: - - -* `checkpoint_prefix`: the prefix of a V1 or V2 checkpoint, with V2 taking - priority. Typically the result of `Saver.save()` or that of - `tf.train.latest_checkpoint()`, regardless of sharded/non-sharded or - V1/V2. - -##### Returns: - - A bool, true iff a checkpoint referred to by `checkpoint_prefix` exists. - - -- - - - -### `tf.train.do_quantize_training_on_graphdef(input_graph, num_bits)` {#do_quantize_training_on_graphdef} - - - - -- - - - -### `tf.train.generate_checkpoint_state_proto(save_dir, model_checkpoint_path, all_model_checkpoint_paths=None)` {#generate_checkpoint_state_proto} - -Generates a checkpoint state proto. - -##### Args: - - -* `save_dir`: Directory where the model was saved. -* `model_checkpoint_path`: The checkpoint file. -* `all_model_checkpoint_paths`: List of strings. Paths to all not-yet-deleted - checkpoints, sorted from oldest to newest. If this is a non-empty list, - the last element must be equal to model_checkpoint_path. These paths - are also saved in the CheckpointState proto. - -##### Returns: - - CheckpointState proto with model_checkpoint_path and - all_model_checkpoint_paths updated to either absolute paths or - relative paths to the current save_dir. - - -- - - - -### `tf.train.get_checkpoint_mtimes(checkpoint_prefixes)` {#get_checkpoint_mtimes} - -Returns the mtimes (modification timestamps) of the checkpoints. - -Globs for the checkpoints pointed to by `checkpoint_prefixes`. If the files -exist, collect their mtime. Both V2 and V1 checkpoints are considered, in -that priority. - -This is the recommended way to get the mtimes, since it takes into account -the naming difference between V1 and V2 formats. - -##### Args: - - -* `checkpoint_prefixes`: a list of checkpoint paths, typically the results of - `Saver.save()` or those of `tf.train.latest_checkpoint()`, regardless of - sharded/non-sharded or V1/V2. - -##### Returns: - - A list of mtimes (in microseconds) of the found checkpoints. - - diff --git a/tensorflow/g3doc/contrib/learn/get_started/index.md b/tensorflow/g3doc/contrib/learn/get_started/index.md deleted file mode 100644 index c99dbe962e..0000000000 --- a/tensorflow/g3doc/contrib/learn/get_started/index.md +++ /dev/null @@ -1,114 +0,0 @@ -# Introduction - -Below are few simple examples of the API to get you started with TensorFlow Learn. -For more examples, please see [examples](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/skflow). - -## General tips - -- It's useful to re-scale dataset before passing to estimator to 0 mean and unit standard deviation. Stochastic Gradient Descent doesn't always do the right thing when variable are very different scale. - -- Categorical variables should be managed before passing input to the estimator. - -## Linear Classifier - -Simple linear classification: - - from tensorflow.contrib import learn - from sklearn import datasets, metrics - - iris = datasets.load_iris() - classifier = learn.TensorFlowLinearClassifier(n_classes=3) - classifier.fit(iris.data, iris.target) - score = metrics.accuracy_score(iris.target, classifier.predict(iris.data)) - print("Accuracy: %f" % score) - -## Linear Regressor - -Simple linear regression: - - from tensorflow.contrib import learn - from sklearn import datasets, metrics, preprocessing - - boston = datasets.load_boston() - X = preprocessing.StandardScaler().fit_transform(boston.data) - regressor = learn.TensorFlowLinearRegressor() - regressor.fit(X, boston.target) - score = metrics.mean_squared_error(regressor.predict(X), boston.target) - print ("MSE: %f" % score) - -## Deep Neural Network - -Example of 3 layer network with 10, 20 and 10 hidden units respectively: - - from tensorflow.contrib import learn - from sklearn import datasets, metrics - - iris = datasets.load_iris() - feature_columns = learn.infer_real_valued_columns_from_input(iris.data) - classifier = learn.DNNClassifier( - feature_columns=feature_columns, hidden_units=[10, 20, 10], n_classes=3) - classifier.fit(iris.data, iris.target, steps=100) - score = metrics.accuracy_score(iris.target, classifier.predict(iris.data)) - print("Accuracy: %f" % score) - -## Custom model - -Example of how to pass a custom model to the TensorFlowEstimator: - - from tensorflow.contrib import learn - from sklearn import datasets, metrics - - iris = datasets.load_iris() - - def my_model(X, y): - """This is DNN with 10, 20, 10 hidden layers, and dropout of 0.5 probability.""" - layers = learn.ops.dnn(X, [10, 20, 10], keep_prob=0.5) - return learn.models.logistic_regression(layers, y) - - classifier = learn.TensorFlowEstimator(model_fn=my_model, n_classes=3) - classifier.fit(iris.data, iris.target) - score = metrics.accuracy_score(iris.target, classifier.predict(iris.data)) - print("Accuracy: %f" % score) - -## Saving / Restoring models - -Each estimator has a ``save`` method which takes folder path where all model information will be saved. For restoring you can just call ``learn.TensorFlowEstimator.restore(path)`` and it will return object of your class. - -Some example code: - - from tensorflow.contrib import learn - - classifier = learn.TensorFlowLinearRegression() - classifier.fit(...) - classifier.save('/tmp/tf_examples/my_model_1/') - - new_classifier = TensorFlowEstimator.restore('/tmp/tf_examples/my_model_2') - new_classifier.predict(...) - -## Summaries - -To get nice visualizations and summaries you can use ``logdir`` parameter on ``fit``. It will start writing summaries for ``loss`` and histograms for variables in your model. You can also add custom summaries in your custom model function by calling ``tf.summary`` and passing Tensors to report. - - classifier = learn.TensorFlowLinearRegression() - classifier.fit(X, y, logdir='/tmp/tf_examples/my_model_1/') - -Then run next command in command line: - - tensorboard --logdir=/tmp/tf_examples/my_model_1 - -and follow reported url. - -Graph visualization: Text classification RNN Graph image - -Loss visualization: Text classification RNN Loss image - - -## More examples - -See [examples folder](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/skflow) for: - -- Easy way to handle categorical variables - words are just an example of categorical variable. -- Text Classification - see examples for RNN, CNN on word and characters. -- Language modeling and text sequence to sequence. -- Images (CNNs) - see example for digit recognition. -- More & deeper - different examples showing DNNs and CNNs diff --git a/tensorflow/g3doc/contrib/learn/index.md b/tensorflow/g3doc/contrib/learn/index.md deleted file mode 100644 index 7d77dccca1..0000000000 --- a/tensorflow/g3doc/contrib/learn/index.md +++ /dev/null @@ -1,30 +0,0 @@ -# TensorFlow Learn - -This is an API for building learning models with TensorFlow. -This library covers variety of needs from linear models to *Deep Learning* -applications like text and image understanding. - -## Get Started - -[View Introduction](get_started/index.md) - -## Tutorials - -- [Introduction to Scikit Flow and why you want to start learning - TensorFlow](https://medium.com/@ilblackdragon/tensorflow-tutorial-part-1-c559c63c0cb1) -- [DNNs, custom model and Digit recognition - examples](https://medium.com/@ilblackdragon/tensorflow-tutorial-part-2-9ffe47049c92>) -- [Categorical variables: One hot vs Distributed - representation](https://medium.com/@ilblackdragon/tensorflow-tutorial-part-3-c5fc0662bc08>) -- More coming soon. - -## Community - -- Twitter [#skflow](https://twitter.com/search?q=skflow&src=typd>). -- StackOverflow with -[skflow tag](http://stackoverflow.com/questions/tagged/skflow>) -for questions and struggles. -- Github [issues](https://github.com/tensorflow/tensorflow/issues>) -for technical discussions and feature requests. -- [Gitter channel](https://gitter.im/tensorflow/skflow>) -for non-trivial discussions. diff --git a/tensorflow/g3doc/experimental/index.md b/tensorflow/g3doc/experimental/index.md deleted file mode 100644 index d941a336a8..0000000000 --- a/tensorflow/g3doc/experimental/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# Experimental - -Collected in this section is information about experimental features included in -Tensorflow. These features are either not complete or not included as part of -core Tensorflow. - -### XLA - -[XLA](./xla/) is a domain-specific compiler for linear algebra that optimizes -TensorFlow computations. The results are improvements in speed, memory usage, -and portability on server and mobile platforms. - -[Learn more about XLA](./xla/) diff --git a/tensorflow/g3doc/get_started/basic_usage.md b/tensorflow/g3doc/get_started/basic_usage.md deleted file mode 100644 index c39f365ed8..0000000000 --- a/tensorflow/g3doc/get_started/basic_usage.md +++ /dev/null @@ -1,324 +0,0 @@ -# Basic Usage - -To use TensorFlow you need to understand how TensorFlow: - -* Represents computations as graphs. -* Executes graphs in the context of `Sessions`. -* Represents data as tensors. -* Maintains state with `Variables`. -* Uses feeds and fetches to get data into and out of arbitrary operations. - -## Overview - -TensorFlow is a programming system in which you represent computations as -graphs. Nodes in the graph are called *ops* (short for operations). An op takes -zero or more `Tensors`, performs some computation, and produces zero or more -`Tensors`. In TensorFlow terminology, a `Tensor` is a typed multi-dimensional -array. For example, you can represent a mini-batch of images as a 4-D array of -floating point numbers with dimensions `[batch, height, width, channels]`. - -A TensorFlow graph is a *description* of computations. To compute anything, -a graph must be launched in a `Session`. A `Session` places the graph ops onto -`Devices`, such as CPUs or GPUs, and provides methods to execute them. These -methods return tensors produced by ops as [numpy](http://www.numpy.org) -`ndarray` objects in Python, and as `tensorflow::Tensor` instances in C and -C++. - -## The computation graph - -TensorFlow programs are usually structured into a construction phase that -assembles a graph, and an execution phase that uses a session to execute ops in -the graph. - -For example, it is common to create a graph to represent and train a neural -network in the construction phase, and then repeatedly execute a set of -training ops in the graph in the execution phase. - -TensorFlow can be used from C, C++, and Python programs. It is presently much -easier to use the Python library to assemble graphs, as it provides a large set -of helper functions not available in the C and C++ libraries. - -The session libraries have equivalent functionalities for the three languages. - -### Building the graph - -To build a graph, start by defining ops that do not need any input, such as -`constant`, and pass their output to other ops that do computation. - -The op constructors in the Python library return objects that represent the -output of the constructed ops. You can pass these as inputs to other op -constructors. - -The TensorFlow Python library has a *default graph* to which op constructors -add nodes. The default graph is sufficient for many applications. See the -[Graph class](../api_docs/python/framework.md#Graph) documentation for how -to explicitly manage multiple graphs. - -```python -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.]]) - -# Create another constant that produces a 2x1 matrix. -matrix2 = tf.constant([[2.],[2.]]) - -# Create a matmul op that takes 'matrix1' and 'matrix2' as inputs. -# The returned value, 'product', represents the result of the matrix -# multiplication. -product = tf.matmul(matrix1, matrix2) -``` - -The default graph now has three nodes: two `constant` ops and one `matmul` -op. To actually multiply the matrices and get the result of the multiplication, -you must *launch* the graph in a `Session`. - -### Launching the graph in a session - -After constructing a graph, you can launch it by creating a `Session` object. -The `Session` launches the default graph, unless a different graph is specified -in the constructor. See the -[Session class](../api_docs/python/client.md#session-management) for -the complete API. - -```python -# Launch the default graph. -sess = tf.Session() - -# To run the matmul op we call the session 'run()' method, passing 'product' -# which represents the output of the matmul op. This indicates to the call -# that we want to get the output of the matmul op back. -# -# All inputs needed by the op are run automatically by the session. They -# typically are run in parallel. -# -# The call 'run(product)' thus causes the execution of three ops in the -# graph: the two constants and matmul. -# -# The output of the matmul is returned in 'result' as a numpy `ndarray` object. -result = sess.run(product) -print(result) -# ==> [[ 12.]] - -# Close the Session when we're done. -sess.close() -``` - -Sessions should be closed to release resources. To manage resources more -easily, use a `with` statement. Each `Session` implements a context manager that -calls `close()` when exiting the block. - -```python -with tf.Session() as sess: - result = sess.run([product]) - print(result) -``` - -The TensorFlow implementation translates the graph definition into executable -operations distributed across available compute resources, such as the CPU or -one of your computer's GPU cards. In general you do not have to specify CPUs -or GPUs explicitly. TensorFlow uses your first GPU, if you have one, for as -many operations as possible. - -If you have more than one GPU available on your machine, to use a GPU beyond -the first you must assign ops to it explicitly. Use `with...Device` statements -to specify which CPU or GPU to use for operations: - -```python -with tf.Session() as sess: - with tf.device("/gpu:1"): - matrix1 = tf.constant([[3., 3.]]) - matrix2 = tf.constant([[2.],[2.]]) - product = tf.matmul(matrix1, matrix2) - ... -``` - -Devices are specified with strings. The currently supported devices are: - -* `"/cpu:0"`: The CPU of your machine. -* `"/gpu:0"`: The GPU of your machine, if you have one. -* `"/gpu:1"`: The second GPU of your machine, etc. - -See [Using GPUs](../how_tos/using_gpu/index.md) for more information about GPUs -and TensorFlow. - -### Launching the graph in a distributed session - -To create a TensorFlow cluster, launch a TensorFlow server on each of the -machines in the cluster. When you instantiate a Session in your client, you -pass it the network location of one of the machines in the cluster: - -```python -with tf.Session("grpc://example.org:2222") as sess: - # Calls to sess.run(...) will be executed on the cluster. - ... -``` - -This machine becomes the master for the session. The master distributes the -graph across other machines in the cluster (workers), much as the local -implementation distributes the graph across available compute resources within -a machine. - -You can use "with tf.device():" statements to directly specify workers for -particular parts of the graph: - -```python -with tf.device("/job:ps/task:0"): - weights = tf.Variable(...) - biases = tf.Variable(...) -``` - -See the [Distributed TensorFlow How To](../how_tos/distributed/) for more -information about distributed sessions and clusters. - -## Interactive Usage - -The Python examples in the documentation launch the graph with a -[`Session`](../api_docs/python/client.md#Session) and use the -[`Session.run()`](../api_docs/python/client.md#Session.run) method to execute -operations. - -For ease of use in interactive Python environments, such as -[IPython](http://ipython.org) you can instead use the -[`InteractiveSession`](../api_docs/python/client.md#InteractiveSession) class, -and the [`Tensor.eval()`](../api_docs/python/framework.md#Tensor.eval) and -[`Operation.run()`](../api_docs/python/framework.md#Operation.run) methods. This -avoids having to keep a variable holding the session. - -```python -# Enter an interactive TensorFlow Session. -import tensorflow as tf -sess = tf.InteractiveSession() - -x = tf.Variable([1.0, 2.0]) -a = tf.constant([3.0, 3.0]) - -# Initialize 'x' using the run() method of its initializer op. -x.initializer.run() - -# Add an op to subtract 'a' from 'x'. Run it and print the result -sub = tf.subtract(x, a) -print(sub.eval()) -# ==> [-2. -1.] - -# Close the Session when we're done. -sess.close() -``` - -## Tensors - -TensorFlow programs use a tensor data structure to represent all data -- only -tensors are passed between operations in the computation graph. You can think -of a TensorFlow tensor as an n-dimensional array or list. A tensor has a -static type, a rank, and a shape. To learn more about how TensorFlow handles -these concepts, see the [Rank, Shape, and Type](../resources/dims_types.md) -reference. - -## Variables - -Variables maintain state across executions of the graph. The following example -shows a variable serving as a simple counter. See -[Variables](../how_tos/variables/index.md) for more details. - -```python -# Create a Variable, that will be initialized to the scalar value 0. -state = tf.Variable(0, name="counter") - -# Create an Op to add one to `state`. - -one = tf.constant(1) -new_value = tf.add(state, one) -update = tf.assign(state, new_value) - -# Variables must be initialized by running an `init` Op after having -# launched the graph. We first have to add the `init` Op to the graph. -init_op = tf.global_variables_initializer() - -# Launch the graph and run the ops. -with tf.Session() as sess: - # Run the 'init' op - sess.run(init_op) - # Print the initial value of 'state' - print(sess.run(state)) - # Run the op that updates 'state' and print 'state'. - for _ in range(3): - sess.run(update) - print(sess.run(state)) - -# output: - -# 0 -# 1 -# 2 -# 3 -``` - -The `assign()` operation in this code is a part of the expression graph just -like the `add()` operation, so it does not actually perform the assignment -until `run()` executes the expression. - -You typically represent the parameters of a statistical model as a set of -Variables. For example, you would store the weights for a neural network as a -tensor in a Variable. During training you update this tensor by running a -training graph repeatedly. - -## Fetches - -To fetch the outputs of operations, execute the graph with a `run()` call on -the `Session` object and pass in the tensors to retrieve. In the previous -example we fetched the single node `state`, but you can also fetch multiple -tensors: - -```python -input1 = tf.constant([3.0]) -input2 = tf.constant([2.0]) -input3 = tf.constant([5.0]) -intermed = tf.add(input2, input3) -mul = tf.multiply(input1, intermed) - -with tf.Session() as sess: - result = sess.run([mul, intermed]) - print(result) - -# output: -# [array([ 21.], dtype=float32), array([ 7.], dtype=float32)] -``` - -All the ops needed to produce the values of the requested tensors are run once -(not once per requested tensor). - -## Feeds - -The examples above introduce tensors into the computation graph by storing them -in `Constants` and `Variables`. TensorFlow also provides a feed mechanism for -patching a tensor directly into any operation in the graph. - -A feed temporarily replaces the output of an operation with a tensor value. -You supply feed data as an argument to a `run()` call. The feed is only used for -the run call to which it is passed. The most common use case involves -designating specific operations to be "feed" operations by using -tf.placeholder() to create them: - -```python - -input1 = tf.placeholder(tf.float32) -input2 = tf.placeholder(tf.float32) -output = input1 * input2 - -with tf.Session() as sess: - print(sess.run([output], feed_dict={input1:[7.], input2:[2.]})) - -# output: -# [array([ 14.], dtype=float32)] -``` - -A `placeholder()` operation generates an error if you do not supply a feed for -it. See the -[MNIST fully-connected feed tutorial](../tutorials/mnist/tf/index.md) -([source code](https://www.tensorflow.org/code/tensorflow/examples/tutorials/mnist/fully_connected_feed.py)) -for a larger-scale example of feeds. - diff --git a/tensorflow/g3doc/get_started/index.md b/tensorflow/g3doc/get_started/index.md deleted file mode 100644 index 1642a87ece..0000000000 --- a/tensorflow/g3doc/get_started/index.md +++ /dev/null @@ -1,83 +0,0 @@ -# Introduction - -Let's get you up and running with TensorFlow! - -But before we even get started, let's peek at what TensorFlow -code looks like in the Python API, so you have a sense of where we're -headed. - -Here's a little Python program that makes up some data in two dimensions, and -then fits a line to it. - -```python -import tensorflow as tf -import numpy as np - -# Create 100 phony x, y data points in NumPy, y = x * 0.1 + 0.3 -x_data = np.random.rand(100).astype(np.float32) -y_data = x_data * 0.1 + 0.3 - -# Try to find values for W and b that compute y_data = W * x_data + b -# (We know that W should be 0.1 and b 0.3, but TensorFlow will -# figure that out for us.) -W = tf.Variable(tf.random_uniform([1], -1.0, 1.0)) -b = tf.Variable(tf.zeros([1])) -y = W * x_data + b - -# Minimize the mean squared errors. -loss = tf.reduce_mean(tf.square(y - y_data)) -optimizer = tf.train.GradientDescentOptimizer(0.5) -train = optimizer.minimize(loss) - -# Before starting, initialize the variables. We will 'run' this first. -init = tf.global_variables_initializer() - -# Launch the graph. -sess = tf.Session() -sess.run(init) - -# Fit the line. -for step in range(201): - sess.run(train) - if step % 20 == 0: - print(step, sess.run(W), sess.run(b)) - -# Learns best fit is W: [0.1], b: [0.3] - -# Close the Session when we're done. -sess.close() -``` - -The first part of this code builds the data flow graph. TensorFlow does not -actually run any computation until the session is created and the `run` -function is called. - -To whet your appetite further, we suggest you check out what a classical -machine learning problem looks like in TensorFlow. In the land of neural -networks the most "classic" classical problem is the MNIST handwritten digit -classification. We offer two introductions here, one for machine learning -newbies, and one for pros. If you've already trained dozens of MNIST models in -other software packages, please take the red pill. If you've never even heard -of MNIST, definitely take the blue pill. If you're somewhere in between, we -suggest skimming blue, then red. - - -

Images licensed CC BY-SA 4.0; original by W. Carter

- -If you're already sure you want to learn and install TensorFlow you can skip -these and charge ahead. Don't worry, you'll still get to see MNIST -- we'll -also use MNIST as an example in our technical tutorial where we elaborate on -TensorFlow features. - -## Recommended Next Steps -* [Download and Setup](../get_started/os_setup.md) -* [Basic Usage](../get_started/basic_usage.md) -* [TensorFlow Mechanics 101](../tutorials/mnist/tf/index.md) -* [Tinker with a neural network in your browser](http://playground.tensorflow.org) diff --git a/tensorflow/g3doc/get_started/leftnav_files b/tensorflow/g3doc/get_started/leftnav_files deleted file mode 100644 index 3fccbc0db5..0000000000 --- a/tensorflow/g3doc/get_started/leftnav_files +++ /dev/null @@ -1,3 +0,0 @@ -index.md -os_setup.md -basic_usage.md \ No newline at end of file diff --git a/tensorflow/g3doc/get_started/os_setup.md b/tensorflow/g3doc/get_started/os_setup.md deleted file mode 100644 index 66c106d2c8..0000000000 --- a/tensorflow/g3doc/get_started/os_setup.md +++ /dev/null @@ -1,1325 +0,0 @@ -# Download and Setup - -You can install TensorFlow either from our provided binary packages or from the -github source. - -## Requirements - -The TensorFlow Python API supports Python 2.7 and Python 3.3+. - -The GPU version works best with Cuda Toolkit 8.0 and -cuDNN v5.1. Other versions are supported (Cuda toolkit >= 7.0 and -cuDNN >= v3) only when installing from sources. -Please see [Cuda installation](#optional-install-cuda-gpus-on-linux) for -details. For Mac OS X, please see -[Setup GPU for Mac](#optional-setup-gpu-for-mac). - -## Overview - -We support different ways to install TensorFlow: - -* [Pip install](#pip-installation): Install TensorFlow on your machine, - possibly upgrading previously installed Python packages. May impact existing - Python programs on your machine. -* [Virtualenv install](#virtualenv-installation): Install TensorFlow in its own - directory, not impacting any existing Python programs on your machine. -* [Anaconda install](#anaconda-installation): Install TensorFlow in its own - environment for those running the Anaconda Python distribution. Does not - impact existing Python programs on your machine. -* [Docker install](#docker-installation): Run TensorFlow in a Docker container - isolated from all other programs on your machine. -* [Installing from sources](#installing-from-sources): Install TensorFlow by - building a pip wheel that you then install using pip. - -If you are familiar with Pip, Virtualenv, Anaconda, or Docker, please feel free -to adapt the instructions to your particular needs. The names of the pip and -Docker images are listed in the corresponding installation sections. - -If you encounter installation errors, see -[common problems](#common-problems) for some solutions. - -## Pip installation - -[Pip](https://en.wikipedia.org/wiki/Pip_(package_manager)) is a package -management system used to install and manage software packages written in -Python. We provide pip packages for TensorFlow on Linux, Mac OS X, and -Windows. For Windows instructions, please see -[Pip installation on Windows](#pip-installation-on-windows). - -The packages that will be installed or upgraded during the pip install are -listed in the [REQUIRED_PACKAGES section of -setup.py](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/pip_package/setup.py). - -Install pip (or pip3 for python3) if it is not already installed: - -```bash -# Ubuntu/Linux 64-bit -$ sudo apt-get install python-pip python-dev - -# Mac OS X -$ sudo easy_install pip -$ sudo easy_install --upgrade six -``` - -We have also uploaded the binaries to Pypi, so you can -simply install tensorflow on Linux, Mac or Windows with pip install. Note you will need pip version 8.1 or later for the following commands to work on Linux : - -```bash -$ pip install tensorflow -``` - -For installing the version with GPU support, please use: - -```bash -$ pip install tensorflow-gpu -``` - -If the above commands do not work on your system, you can follow these instructions: - -```bash -# Ubuntu/Linux 64-bit, CPU only, Python 2.7 -$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc2-cp27-none-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7 -# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below. -$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc2-cp27-none-linux_x86_64.whl - -# Mac OS X, CPU only, Python 2.7: -$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0rc2-py2-none-any.whl - -# Mac OS X, GPU enabled, Python 2.7: -$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-1.0.0rc2-py2-none-any.whl - -# Ubuntu/Linux 64-bit, CPU only, Python 3.3 -$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc2-cp33-cp33m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, GPU enabled, Python 3.3 -# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below. -$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc2-cp33-cp33m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, CPU only, Python 3.4 -$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc2-cp34-cp34m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, GPU enabled, Python 3.4 -# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below. -$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc2-cp34-cp34m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, CPU only, Python 3.5 -$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc2-cp35-cp35m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, GPU enabled, Python 3.5 -# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below. -$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc2-cp35-cp35m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, CPU only, Python 3.6 -$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc2-cp36-cp36m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, GPU enabled, Python 3.6 -# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below. -$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc2-cp36-cp36m-linux_x86_64.whl - -# Mac OS X, CPU only, Python 3.4 or 3.5: -$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0rc2-py3-none-any.whl - -# Mac OS X, GPU enabled, Python 3.4 or 3.5: -$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-1.0.0rc2-py3-none-any.whl -``` - -Install TensorFlow: - -```bash -# Python 2 -$ sudo pip install --upgrade $TF_BINARY_URL - -# Python 3 -$ sudo pip3 install --upgrade $TF_BINARY_URL -``` - -NOTE: If you are upgrading from a previous installation of TensorFlow < 0.7.1, -you should uninstall the previous TensorFlow *and protobuf* using `pip -uninstall` first to make sure you get a clean installation of the updated -protobuf dependency. - - -You can now [test your installation](#test-the-tensorflow-installation). - - -### Pip installation on Windows - -TensorFlow supports only 64-bit Python 3.5 on Windows. We have tested the pip packages -with the following distributions of Python: - -* [Python 3.5 from Anaconda](https://www.continuum.io/downloads#windows) - -* [Python 3.5 from python.org](https://www.python.org/downloads/release/python-352/). - - NOTE: TensorFlow requires `MSVCP140.DLL`, which may not be installed on your system. - If, when you `import tensorflow as tf`, you see an error about `No module named - "_pywrap_tensorflow"` and/or `DLL load failed`, check whether `MSVCP140.DLL` is in - your `%PATH%` and, if not, you should install the [Visual C++ 2015 - redistributable](https://www.microsoft.com/en-us/download/details.aspx?id=53587) - (x64 version). - -Both distributions include pip. To install the CPU-only version of -TensorFlow, enter the following command at a command prompt: - -```bat -C:\> pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.0rc2-cp35-cp35m-win_amd64.whl -``` - -To install the GPU version of TensorFlow, enter the following command -at a command prompt: - -```bat -C:\> pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.0.0rc2-cp35-cp35m-win_amd64.whl -``` - -You can now [test your installation](#test-the-tensorflow-installation). - -You can also [use Virtualenv](#virtualenv-installation) or [Anaconda -environments](#anaconda-installation) to manage your installation of -TensorFlow on Windows. - - -## Virtualenv installation - -[Virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/) is a tool -to keep the dependencies required by different Python projects in separate -places. The Virtualenv installation of TensorFlow will not override -pre-existing version of the Python packages needed by TensorFlow. - -With [Virtualenv](https://pypi.python.org/pypi/virtualenv) the installation is -as follows: - -* Install pip and Virtualenv. -* Create a Virtualenv environment. -* Activate the Virtualenv environment and install TensorFlow in it. -* After the install you will activate the Virtualenv environment each time you - want to use TensorFlow. - -Install pip and Virtualenv: - -```bash -# Ubuntu/Linux 64-bit -$ sudo apt-get install python-pip python-dev python-virtualenv - -# Mac OS X -$ sudo easy_install pip -$ sudo pip install --upgrade virtualenv -``` - -Create a Virtualenv environment in the directory `~/tensorflow`: - -```bash -$ virtualenv --system-site-packages ~/tensorflow -``` - -Activate the environment: - -```bash -$ source ~/tensorflow/bin/activate # If using bash -$ source ~/tensorflow/bin/activate.csh # If using csh -(tensorflow)$ # Your prompt should change -``` - -Now, install TensorFlow just as you would for a regular Pip installation. First select the correct binary to install: - -```bash -# Ubuntu/Linux 64-bit, CPU only, Python 2.7 -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc2-cp27-none-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7 -# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below. -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc2-cp27-none-linux_x86_64.whl - -# Mac OS X, CPU only, Python 2.7: -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0rc2-py2-none-any.whl - -# Mac OS X, GPU enabled, Python 2.7: -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-1.0.0rc2-py2-none-any.whl - -# Ubuntu/Linux 64-bit, CPU only, Python 3.3 -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc2-cp33-cp33m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, GPU enabled, Python 3.3 -# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below. -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc2-cp33-cp33m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, CPU only, Python 3.4 -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc2-cp34-cp34m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, GPU enabled, Python 3.4 -# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below. -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc2-cp34-cp34m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, CPU only, Python 3.5 -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc2-cp35-cp35m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, GPU enabled, Python 3.5 -# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below. -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc2-cp35-cp35m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, CPU only, Python 3.6 -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc2-cp36-cp36m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, GPU enabled, Python 3.6 -# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below. -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc2-cp36-cp36m-linux_x86_64.whl - -# Mac OS X, CPU only, Python 3.4 or 3.5: -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0rc2-py3-none-any.whl - -# Mac OS X, GPU enabled, Python 3.4 or 3.5: -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-1.0.0rc2-py3-none-any.whl -``` - -Finally install TensorFlow: - -```bash -# Python 2 -(tensorflow)$ pip install --upgrade $TF_BINARY_URL - -# Python 3 -(tensorflow)$ pip3 install --upgrade $TF_BINARY_URL -``` - -With the Virtualenv environment activated, you can now -[test your installation](#test-the-tensorflow-installation). - -When you are done using TensorFlow, deactivate the environment. - -```bash -(tensorflow)$ deactivate - -$ # Your prompt should change back -``` - -To use TensorFlow later you will have to activate the Virtualenv environment -again: - -```bash -$ source ~/tensorflow/bin/activate # If using bash. -$ source ~/tensorflow/bin/activate.csh # If using csh. -(tensorflow)$ # Your prompt should change. -# Run Python programs that use TensorFlow. -... -# When you are done using TensorFlow, deactivate the environment. -(tensorflow)$ deactivate -``` - -## Anaconda installation - -[Anaconda](https://www.continuum.io/why-anaconda) is a Python distribution that -includes a large number of standard numeric and scientific computing packages. -Anaconda uses a package manager called ["conda"](http://conda.pydata.org) that -has its own [environment system](http://conda.pydata.org/docs/using/envs.html) -similar to Virtualenv. - -As with Virtualenv, conda environments keep the dependencies required by -different Python projects in separate places. The Anaconda environment -installation of TensorFlow will not override pre-existing version of the Python -packages needed by TensorFlow. - -* Install Anaconda. -* Create a conda environment. -* Activate the conda environment and install TensorFlow in it. -* After the install you will activate the conda environment each time you - want to use TensorFlow. -* Optionally install ipython and other packages into the conda environment. - -Install Anaconda: - -Follow the instructions on the [Anaconda download -site](https://www.continuum.io/downloads). - -Note: If tensorflow has been installed via pip outside the Anaconda environment -previously, then one should uninstall it if one wants to use the tensorflow -installed within an Anaconda environment, because Anaconda searches system -site-packages from `.local` with higher priority. -```bash -# Python 2 -$ pip uninstall tensorflow - -# Python 3 -$ pip3 uninstall tensorflow -``` - - -Create a conda environment called `tensorflow`: - -```bash -# Python 2.7 -$ conda create -n tensorflow python=2.7 - -# Python 3.4 -$ conda create -n tensorflow python=3.4 - -# Python 3.5 -$ conda create -n tensorflow python=3.5 -``` - -Activate the environment and use conda or pip to install TensorFlow inside it. - - -### Using conda - -A community maintained conda package is available [from -conda-forge](https://github.com/conda-forge/tensorflow-feedstock). - -Only the CPU version of TensorFlow is available at the moment and can be -installed in the conda environment for Python 2 or Python 3. - -```bash -$ source activate tensorflow -(tensorflow)$ # Your prompt should change - -# Linux/Mac OS X, Python 2.7/3.4/3.5, CPU only: -(tensorflow)$ conda install -c conda-forge tensorflow -``` - -### Using pip - -If using pip make sure to use the `--ignore-installed` flag to prevent errors -about `easy_install`. - -```bash -$ source activate tensorflow -(tensorflow)$ # Your prompt should change -``` - -Now, install TensorFlow just as you would for a regular Pip installation. First -select the correct binary to install: - -```bash -# Ubuntu/Linux 64-bit, CPU only, Python 2.7 -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc2-cp27-none-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7 -# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below. -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc2-cp27-none-linux_x86_64.whl - -# Mac OS X, CPU only, Python 2.7: -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0rc2-py2-none-any.whl - -# Mac OS X, GPU enabled, Python 2.7: -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-1.0.0rc2-py2-none-any.whl - -# Ubuntu/Linux 64-bit, CPU only, Python 3.3 -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc2-cp33-cp33m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, GPU enabled, Python 3.3 -# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below. -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc2-cp33-cp33m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, CPU only, Python 3.4 -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc2-cp34-cp34m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, GPU enabled, Python 3.4 -# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below. -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc2-cp34-cp34m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, CPU only, Python 3.5 -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc2-cp35-cp35m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, GPU enabled, Python 3.5 -# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below. -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc2-cp35-cp35m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, CPU only, Python 3.6 -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.0rc2-cp36-cp36m-linux_x86_64.whl - -# Ubuntu/Linux 64-bit, GPU enabled, Python 3.6 -# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below. -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.0.0rc2-cp36-cp36m-linux_x86_64.whl - -# Mac OS X, CPU only, Python 3.4 or 3.5: -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0rc2-py3-none-any.whl - -# Mac OS X, GPU enabled, Python 3.4 or 3.5: -(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-1.0.0rc2-py3-none-any.whl -``` - -Finally install TensorFlow: - -```bash -# Python 2 -(tensorflow)$ pip install --ignore-installed --upgrade $TF_BINARY_URL - -# Python 3 -(tensorflow)$ pip3 install --ignore-installed --upgrade $TF_BINARY_URL -``` - -### Usage - -With the conda environment activated, you can now -[test your installation](#test-the-tensorflow-installation). - -When you are done using TensorFlow, deactivate the environment. - -```bash -(tensorflow)$ source deactivate - -$ # Your prompt should change back -``` - -To use TensorFlow later you will have to activate the conda environment again: - -```bash -$ source activate tensorflow -(tensorflow)$ # Your prompt should change. -# Run Python programs that use TensorFlow. -... -# When you are done using TensorFlow, deactivate the environment. -(tensorflow)$ source deactivate -``` - -### Install IPython - -To use tensorflow with IPython it may be necessary to install IPython into the -tensorflow environment: - -```bash -$ source activate tensorflow -(tensorflow)$ conda install ipython -``` - -Similarly, other Python packages like pandas may need to get installed into the -tensorflow environment before they can be used together with tensorflow. - - -## Docker installation - -[Docker](http://docker.com/) is a system to build self contained versions of a -Linux operating system running on your machine. When you install and run -TensorFlow via Docker it completely isolates the installation from pre-existing -packages on your machine. - -We provide 4 Docker images: - -* `gcr.io/tensorflow/tensorflow`: TensorFlow CPU binary image. -* `gcr.io/tensorflow/tensorflow:latest-devel`: CPU Binary image plus source -code. -* `gcr.io/tensorflow/tensorflow:latest-gpu`: TensorFlow GPU binary image. -* `gcr.io/tensorflow/tensorflow:latest-devel-gpu`: GPU Binary image plus source -code. - -We also have tags with `latest` replaced by a released version (e.g., -`1.0.0-rc2-gpu`). - -With Docker the installation is as follows: - -* Install Docker on your machine. -* Create a [Docker -group](https://docs.docker.com/engine/installation/linux/ubuntulinux/#/create-a-docker-group) -to allow launching containers without `sudo`. -* Launch a Docker container with the TensorFlow image. The image - gets downloaded automatically on first launch. - -See [installing Docker](http://docs.docker.com/engine/installation/) for -instructions on installing Docker on your machine. - -After Docker is installed, launch a Docker container with the TensorFlow binary -image as follows. - -```bash -$ docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow -``` - -The option `-p 8888:8888` is used to publish the Docker container᾿s internal -port to the host machine, in this case to ensure Jupyter notebook connection. - -The format of the port mapping is `hostPort:containerPort`. You can specify any -valid port number for the host port but have to use `8888` for the container -port portion. - -If you're using a container with GPU support, some additional flags must be -passed to expose the GPU device to the container. - -For NVidia GPU support install latest NVidia drivers and -[nvidia-docker](https://github.com/NVIDIA/nvidia-docker). Run with - -```bash -$ nvidia-docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow:latest-gpu -``` - -If you run into a problem running `nvidia-docker`, Please report an issue -[here](https://github.com/NVIDIA/nvidia-docker/issues). - -For more details see [TensorFlow docker -readme](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/docker). - -You can now [test your installation](#test-the-tensorflow-installation) within -the Docker container. - -## Test the TensorFlow installation - -### (Optional, Linux) Enable GPU Support - -If you installed the GPU version of TensorFlow, you must also install the Cuda -Toolkit 8.0 and cuDNN v5.1. Please see [Cuda -installation](#optional-install-cuda-gpus-on-linux). - -You also need to set the `LD_LIBRARY_PATH` and `CUDA_HOME` environment -variables. Consider adding the commands below to your `~/.bash_profile`. These -assume your CUDA installation is in `/usr/local/cuda`: - -```bash -export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64" -export CUDA_HOME=/usr/local/cuda -``` - -### Run TensorFlow from the Command Line - -See [common problems](#common-problems) if an error happens. - -Open a terminal and type the following: - -```bash -$ python -... ->>> import tensorflow as tf ->>> hello = tf.constant('Hello, TensorFlow!') ->>> sess = tf.Session() ->>> print(sess.run(hello)) -Hello, TensorFlow! ->>> a = tf.constant(10) ->>> b = tf.constant(32) ->>> print(sess.run(a + b)) -42 ->>> -``` - -## Installing from sources - -When installing from source you will build a pip wheel that you then install -using pip. You'll need pip for that, so install it as described -[above](#pip-installation). - -To build TensorFlow from source on Windows, you can use experimental -support for [Bazel on -Windows](https://bazel.build/versions/master/docs/windows.html) or the -[TensorFlow CMake -build](https://github.com/tensorflow/tensorflow/tree/r1.0/tensorflow/contrib/cmake). - -### Clone the TensorFlow repository - -```bash -$ git clone https://github.com/tensorflow/tensorflow -``` - -Note that these instructions will install the latest master branch of -tensorflow. If you want to install a specific branch (such as a release branch), -pass `-b ` to the `git clone` command and `--recurse-submodules` for -r0.8 and earlier to fetch the protobuf library that TensorFlow depends on. - -### Prepare environment for Linux - -#### Install Bazel - -Follow instructions [here](http://bazel.build/docs/install.html) to install the -dependencies for bazel. Then download the latest stable bazel version using the -[installer for your system](https://github.com/bazelbuild/bazel/releases) and -run the installer as mentioned there: - -```bash -$ chmod +x PATH_TO_INSTALL.SH -$ ./PATH_TO_INSTALL.SH --user -``` - -Remember to replace `PATH_TO_INSTALL.SH` with the location where you -downloaded the installer. - -Finally, follow the instructions in that script to place `bazel` into your -binary path. - -#### Install other dependencies - -```bash -# For Python 2.7: -$ sudo apt-get install python-numpy python-dev python-wheel python-mock -# For Python 3.x: -$ sudo apt-get install python3-numpy python3-dev python3-wheel python3-mock -``` - -#### Optional: Install CUDA (GPUs on Linux) - -In order to build or run TensorFlow with GPU support, both NVIDIA's Cuda Toolkit -(>= 7.0) and cuDNN (>= v3) need to be installed. - -TensorFlow GPU support requires having a GPU card with NVidia Compute Capability -(\>= 3.0). Supported cards include but are not limited to: - -* NVidia Titan -* NVidia Titan X -* NVidia K20 -* NVidia K40 - -##### Check NVIDIA Compute Capability of your GPU card - -[https://developer.nvidia.com/cuda-gpus](https://developer.nvidia.com/cuda-gpus) - -##### Download and install Cuda Toolkit - -[https://developer.nvidia.com/cuda-downloads](https://developer.nvidia.com/cuda-downloads) - -Install version 8.0 if using our binary releases. - -Install the toolkit into e.g. `/usr/local/cuda`. - -##### Download and install cuDNN - -[https://developer.nvidia.com/cudnn](https://developer.nvidia.com/cudnn) - -Download cuDNN v5.1. - -Uncompress and copy the cuDNN files into the toolkit directory. Assuming the -toolkit is installed in `/usr/local/cuda`, run the following commands (edited -to reflect the cuDNN version you downloaded): - -``` bash -tar xvzf cudnn-8.0-linux-x64-v5.1.tgz -sudo cp -P cuda/include/cudnn.h /usr/local/cuda/include/ -sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64/ -sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn* -``` - -##### Install other dependencies - -```bash -$ sudo apt-get install libcupti-dev -``` - -#### Optional: Install OpenCL (Experimental, Linux only) - -In order to build or run TensorFlow with OpenCL support, both OpenCL (>= 1.2) -and ComputeCpp (>= 0.1.1) need to be installed. - -TensorFlow can only take advantage of accelerators that support OpenCL 1.2. -Supported accelerators include but are not limited to: - -* AMD Fiji -* AMD Hawaii - -Note that this support is currently experimental and should not be relied upon -for production (though it will mature over time). - -##### Download and install OpenCL drivers - -The exact steps required for a functional OpenCL installation will depend on -your environment. For Unbuntu 14.04, the following steps are known to work: - -```bash -sudo apt-get install ocl-icd-opencl-dev opencl-headers -``` - -You will also need to install the drivers for the accelerator itself. We've -tested that the following drivers for AMD Fiji and Hawaii GPUs on Ubuntu 14.04: - -```bash -sudo apt-get install fglrx-core fglrx-dev -``` - -##### Download and install the ComputeCpp compiler - -Download the compiler from [Codeplay's -website](https://www.codeplay.com/products/computesuite/computecpp), uncompress -and copy the files into e.g. `/usr/local/computecpp`: - -```bash -tar -xvzf ComputeCpp-CE-0.1.1-Ubuntu.14.04-64bit.tar.gz -sudo mkdir /usr/local/computecpp -sudo cp -R ComputeCpp-CE-0.1.1-Linux /usr/local/computecpp -sudo chmod -R a+r /usr/local/computecpp/ -sudo chmod -R a+x /usr/local/computecpp/bin -``` - -### Prepare environment for Mac OS X - -We recommend using [homebrew](http://brew.sh) to install the bazel dependency, -and installing python dependencies using easy_install or pip. - -#### Dependencies - -Follow instructions [here](http://bazel.build/docs/install.html) to install the -dependencies for bazel. You can then use homebrew to install bazel: - -```bash -$ brew install bazel -``` - -You can install the python dependencies using easy_install or pip. Using -easy_install, run - -```bash -$ sudo easy_install -U six -$ sudo easy_install -U numpy -$ sudo easy_install wheel -``` - -We also recommend the [ipython](https://ipython.org) enhanced python shell, -which you can install as follows: - -```bash -$ sudo easy_install ipython -``` - -#### Optional: Setup GPU for Mac - -If you plan to build with GPU support you will need to make sure you have -GNU coreutils installed via homebrew: - -```bash -$ brew install coreutils -``` - -Next you will need to make sure you have a recent [CUDA -Toolkit](https://developer.nvidia.com/cuda-toolkit) installed by either -downloading the package for your version of OSX directly from -[NVIDIA](https://developer.nvidia.com/cuda-downloads) or by using the [Homebrew -Cask](https://caskroom.github.io/) extension: - -```bash -$ brew tap caskroom/cask -$ brew cask install cuda -``` - -Once you have the CUDA Toolkit installed you will need to setup the required -environment variables by adding the following to your `~/.bash_profile`: - -```bash -export CUDA_HOME=/usr/local/cuda -export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$CUDA_HOME/lib" -export PATH="$CUDA_HOME/bin:$PATH" -``` - -Finally, you will also want to install the [CUDA Deep Neural -Network](https://developer.nvidia.com/cudnn) (cuDNN v5.1) library which currently -requires an [Accelerated Computing Developer -Program](https://developer.nvidia.com/accelerated-computing-developer) account. -Once you have it downloaded locally, you can unzip and move the header and -libraries to your local CUDA Toolkit folder: - -```bash -$ sudo mv include/cudnn.h /Developer/NVIDIA/CUDA-8.0/include/ -$ sudo mv lib/libcudnn* /Developer/NVIDIA/CUDA-8.0/lib -$ sudo ln -s /Developer/NVIDIA/CUDA-8.0/lib/libcudnn* /usr/local/cuda/lib/ -``` - -To verify the CUDA installation, you can build and run deviceQuery to make sure -it passes. - -```bash -$ cp -r /usr/local/cuda/samples ~/cuda-samples -$ pushd ~/cuda-samples -$ make -$ popd -$ ~/cuda-samples/bin/x86_64/darwin/release/deviceQuery -``` - -If you want to compile tensorflow and have XCode 7.3 and CUDA 7.5 installed, note that -Xcode 7.3 is not yet compatible with CUDA 7.5. You can either upgrade to CUDA -8.0, or you will need to download Xcode -7.2 and select it as your default: - -```bash -$ sudo xcode-select -s /Application/Xcode-7.2/Xcode.app -``` - - -### Configure the installation - -Run the `configure` script at the root of the tree. The configure script -asks you for the path to your python interpreter and allows (optional) -configuration of the CUDA libraries. - -This step is used to locate the python and numpy header files as well as -enabling GPU support if you have a CUDA enabled GPU and Toolkit installed. -Select the option `Y` when asked to build TensorFlow with GPU support. - -If you have several versions of Cuda or cuDNN installed, you should definitely -select one explicitly instead of relying on the system default. - -For example: - -```bash -$ ./configure -Please specify the location of python. [Default is /usr/bin/python]: -Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] N -No Google Cloud Platform support will be enabled for TensorFlow -Do you wish to build TensorFlow with GPU support? [y/N] y -Do you wish to build TensorFlow with OpenCL support? [y/N] N -GPU support will be enabled for TensorFlow -Please specify which gcc nvcc should use as the host compiler. [Default is /usr/bin/gcc]: -Please specify the Cuda SDK version you want to use, e.g. 7.0. [Leave empty to use system default]: 8.0 -Please specify the location where CUDA 8.0 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: -Please specify the cuDNN version you want to use. [Leave empty to use system default]: 5 -Please specify the location where cuDNN 5 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: -Please specify a list of comma-separated Cuda compute capabilities you want to build with. -You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus. -Please note that each additional compute capability significantly increases your build time and binary size. - -Setting up Cuda include -Setting up Cuda lib -Setting up Cuda bin -Setting up Cuda nvvm -Setting up CUPTI include -Setting up CUPTI lib64 -Configuration finished -``` - -[Default is: "3.5,5.2"]: 3.0 - -This creates a canonical set of symbolic links to the Cuda libraries on your -system. Every time you change the Cuda library paths you need to run this step -again before you invoke the bazel build command. For the cuDNN libraries, use -'7.0' for R3, and '4.0.7' for R4. - -If you want to built support for OpenCL, select the option `Y` when asked to -build TensorFlow with OpenCL support, and provide the location of the ComputeCpp -compiler (e.g. /usr/local/computecpp). - -#### Known issues - -* Although it is possible to build both Cuda and non-Cuda configs under the same -source tree, we recommend to run `bazel clean` when switching between these two -configs in the same source tree. - -* You have to run configure before running bazel build. Otherwise, the build -will fail with a clear error message. In the future, we might consider making -this more convenient by including the configure step in our build process. - - -### Create the pip package and install - -When building from source, you will still build a pip package and install that. - -Please note that building from sources takes a lot of memory resources by -default and if you want to limit RAM usage you can add `--local_resources -2048,.5,1.0` while invoking bazel. - -```bash -$ bazel build --config opt //tensorflow/tools/pip_package:build_pip_package - -# To build with support for CUDA: -$ bazel build --config opt --config=cuda //tensorflow/tools/pip_package:build_pip_package - -# Alternatively, to build with support for OpenCL (Experimental): -$ bazel build --config opt --config=sycl //tensorflow/tools/pip_package:build_pip_package - -$ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg - -# The name of the .whl file will depend on your platform. -$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.0.0rc2-py2-none-any.whl -``` - -## Optimizing CPU performance - -To be compatible with as wide a range of machines as possible, TensorFlow -defaults to only using SSE4 SIMD instructions. Most modern computers support -more advanced instructions. So if you're building a binary that you'll only -be running on your own machine, you can enable these by using `-march=native` -for optimization options when running `configure`. Then you can build your -optimized binaries with the following command: - -``` bash -$ bazel build --config opt //tensorflow/tools/pip_package:build_pip_package -``` - -If you are distributing a binary but know the capabilities of the machines -you'll be running on, you can manually choose the right instructions with -something like `-march=avx`. You may also want to enable multiple -features using several arguments, for example -`-mavx2,-mfma`. - -If you run a binary built using SIMD instructions on a machine that doesn't -support them, you'll see an illegal instruction error when that code is -executed. - -## Setting up TensorFlow for Development - -If you're working on TensorFlow itself, it is useful to be able to test your -changes in an interactive python shell without having to reinstall TensorFlow. - -To set up TensorFlow such that all files are linked (instead of copied) from the -system directories, run the following commands inside the TensorFlow root -directory: - -```bash -bazel build --config opt //tensorflow/tools/pip_package:build_pip_package - -# To build with GPU support: -bazel build --config opt --config=cuda //tensorflow/tools/pip_package:build_pip_package - -mkdir _python_build -cd _python_build -ln -s ../bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/* . -ln -s ../tensorflow/tools/pip_package/* . -python setup.py develop -``` - -Note that this setup still requires you to rebuild the -`//tensorflow/tools/pip_package:build_pip_package` target every time you change -a C++ file; add, delete, or move any python file; or if you change bazel build -rules. - -Note also that `bazel test` will not always properly resolve dependencies -through these symlinks, so test results may be unreliable. A workaround is to -remove the `_python_build` directory before running `bazel test`. - -One more thing is that `python setup.py development` does not install the packages listed in `REQUIRED_PACKAGES` part of `setup.py`. You might need to install them separately. - -## Train your first TensorFlow neural net model - -Start by cloning the [TensorFlow models repo](https://github.com/tensorflow/models) from GitHub. Run the following commands: - -```bash -$ cd models/tutorials/image/mnist -$ python convolutional.py -Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes. -Successfully downloaded train-labels-idx1-ubyte.gz 28881 bytes. -Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes. -Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes. -Extracting data/train-images-idx3-ubyte.gz -Extracting data/train-labels-idx1-ubyte.gz -Extracting data/t10k-images-idx3-ubyte.gz -Extracting data/t10k-labels-idx1-ubyte.gz -Initialized! -Epoch 0.00 -Minibatch loss: 12.054, learning rate: 0.010000 -Minibatch error: 90.6% -Validation error: 84.6% -Epoch 0.12 -Minibatch loss: 3.285, learning rate: 0.010000 -Minibatch error: 6.2% -Validation error: 7.0% -... -... -``` - -## Common Problems - -### GPU-related issues - -If you encounter the following when trying to run a TensorFlow program: - -```python -ImportError: libcudart.so.7.0: cannot open shared object file: No such file or directory -``` - -Make sure you followed the GPU installation -[instructions](#optional-install-cuda-gpus-on-linux). If you built from source, -and you left the Cuda or cuDNN version empty, try specifying them explicitly. - -### Protobuf library related issues - -TensorFlow pip package depends on protobuf pip package version -3.2.0. Protobuf's pip package downloaded from [PyPI](https://pypi.python.org) -(when running `pip install protobuf`) is a Python only library, that has -Python implementations of proto serialization/deserialization which can be -10x-50x slower than the C++ implementation. Protobuf also supports a binary -extension for the Python package that contains fast C++ based proto parsing. -This extension is not available in the standard Python only PIP package. We have -created a custom binary pip package for protobuf that contains the binary -extension. Follow these instructions to install the custom binary protobuf pip -package: - -```bash -# Ubuntu/Linux 64-bit: -$ pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/protobuf-3.2.0-cp27-none-linux_x86_64.whl - -# Mac OS X: -$ pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/protobuf-3.2.0-cp27-none-macosx_10_11_x86_64.whl -``` - -And for Python 3.5: - -```bash -# Ubuntu/Linux 64-bit: -$ pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/protobuf-3.2.0-cp35-none-linux_x86_64.whl - -# Mac OS X: -$ pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/protobuf-3.2.0-cp35-none-macosx_10_11_x86_64.whl -``` - -If your system/configuration is not listed above, you can use the following -instructions to build your own protobuf wheel file. -To install its prerequisites, [see -here](https://github.com/google/protobuf/blob/master/src/README.md): - -Then: - -```bash -$ git clone https://github.com/google/protobuf.git -$ cd protobuf -$ ./autogen.sh -$ CXXFLAGS="-fPIC -g -O2" ./configure -$ make -j12 -$ export PROTOC=$PWD/src/protoc -$ cd python -$ python setup.py bdist_wheel --cpp_implementation --compile_static_extension -$ pip uninstall protobuf -$ pip install dist/ -``` - -Install the above package _after_ you have installed TensorFlow via pip, as the -standard `pip install tensorflow` would install the python only pip package. The -above pip package will over-write the existing protobuf package. -Note that the binary pip package already has support for protobuf larger than -64MB, that should fix errors such as these : - -```bash -[libprotobuf ERROR google/protobuf/src/google/protobuf/io/coded_stream.cc:207] A -protocol message was rejected because it was too big (more than 67108864 bytes). -To increase the limit (or to disable these warnings), see -CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h. - -``` - -### Pip installation issues - -#### Cannot import name 'descriptor' - -```python -ImportError: Traceback (most recent call last): - File "/usr/local/lib/python3.4/dist-packages/tensorflow/core/framework/graph_pb2.py", line 6, in - from google.protobuf import descriptor as _descriptor -ImportError: cannot import name 'descriptor' -``` - -If you the above error when upgrading to a newer version of TensorFlow, try -uninstalling both TensorFlow and protobuf (if installed) and re-installing -TensorFlow (which will also install the correct protobuf dependency). - -#### Can't find setup.py - -If, during `pip install`, you encounter an error like: - -```bash -... -IOError: [Errno 2] No such file or directory: '/tmp/pip-o6Tpui-build/setup.py' -``` - -Solution: upgrade your version of pip: - -```bash -pip install --upgrade pip -``` - -This may require `sudo`, depending on how pip is installed. - -#### SSLError: SSL_VERIFY_FAILED - -If, during pip install from a URL, you encounter an error like: - -```bash -... -SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed -``` - -Solution: Download the wheel manually via curl or wget, and pip install locally. - - -#### Operation not permitted - -If, despite using `sudo`, you encounter an error like: - -```bash -... -Installing collected packages: setuptools, protobuf, wheel, numpy, tensorflow -Found existing installation: setuptools 1.1.6 -Uninstalling setuptools-1.1.6: -Exception: -... -[Errno 1] Operation not permitted: '/tmp/pip-a1DXRT-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib' -``` - -Solution: Add an `--ignore-installed` flag to the pip command. - -#### Cannot remove entries from nonexistent file: easy-install.pth - -If during a `pip` installation using an Anaconda Python distribution you encounter the error: - -``` -Cannot remove entries from nonexistent file /anaconda[version]/lib/site-packages/easy-install.pth -``` - -1. Upgrade setuptools: -`pip install --upgrade -I setuptools` - -2. Install TensorFlow again adding `--ignore-installed` flag: -`pip install --ignore-installed --upgrade ` - - - -Step #1 might already solve the problem, however if it still persists, execute step #2. - -This issue occurs with new Anaconda installations when `pip` tries to remove `easy-install.pth`. -This file is not included in Anaconda packages, which causes the `pip` installation to fail. - -#### Cupti_wrapper.cc: Could not find cuptiActivityRegisterCallbacksin libcupti DSO - -If, when running a TensorFlow Python script, you encounter the following error: -``` -c:\tf_jenkins\home\workspace\nightly-win\device\gpu\os\windows\tensorflow\core\platform\default\gpu\cupti_wrapper.cc:59] Check failed: ::tensorflow::Status::OK() == (::tensorflow::Env::Default()->GetSymbolFromLibrary( GetDsoHandle(), kName, &f )) (OK vs. Not found: cuptiActivityRegisterCallbacks not found)could not find cuptiActivityRegisterCallbacksin libcupti DSO -``` - -Add `\NVIDIA GPU Computing Toolkit\CUDA\v8.0\extras\CUPTI\libx64` to your `PATH`. - -This issue occurs because on CUDA 8.0 the location of the file `cupti64_80.dll` is not on `PATH` by default. - - -### Linux issues - -If you encounter: - -```python -... - "__add__", "__radd__", - ^ -SyntaxError: invalid syntax -``` - -Solution: make sure you are using Python 2.7. - -#### Ubuntu build issue on Linux 16.04 when building with --config=cuda: build fail with cuda: identifier "__builtin_ia32_mwaitx" is undefined. -GitHub issue: https://github.com/tensorflow/tensorflow/issues/1066 - -Solution: Add the following compiler flags to third_party/gpus/crosstool/CROSSTOOL - -cxx_flag: "-D_MWAITXINTRIN_H_INCLUDED" -cxx_flag: "-D_FORCE_INLINES" - -### Mac OS X: ImportError: No module named copyreg - -On Mac OS X, you may encounter the following when importing tensorflow. - -```python ->>> import tensorflow as tf -... -ImportError: No module named copyreg -``` - -Solution: TensorFlow depends on protobuf, which requires the Python package -`six-1.10.0`. Apple's default Python installation only provides `six-1.4.1`. - -You can resolve the issue in one of the following ways: - -* Upgrade the Python installation with the current version of `six`: - -```bash -$ sudo easy_install -U six -``` - -* Install TensorFlow with a separate Python library: - - * Using [Virtualenv](#virtualenv-installation). - * Using [Docker](#docker-installation). - -* Install a separate copy of Python via [Homebrew](http://brew.sh/) or -[MacPorts](https://www.macports.org/) and re-install TensorFlow in that -copy of Python. - -### Mac OS X: OSError: [Errno 1] Operation not permitted: - -On El Capitan, "six" is a special package that can't be modified, and this -error is reported when "pip install" tried to modify this package. To fix use -"ignore-installed" flag, ie - -sudo pip install --ignore-installed six https://storage.googleapis.com/.... - - -### Mac OS X: TypeError: `__init__()` got an unexpected keyword argument 'syntax' - -On Mac OS X, you may encounter the following when importing tensorflow. - -``` ->>> import tensorflow as tf -Traceback (most recent call last): - File "", line 1, in - File "/usr/local/lib/python2.7/site-packages/tensorflow/__init__.py", line 4, in - from tensorflow.python import * - File "/usr/local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 13, in - from tensorflow.core.framework.graph_pb2 import * -... - File "/usr/local/lib/python2.7/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 22, in - serialized_pb=_b('\n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"d\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x02 \x03(\x0b\x32 .tensorflow.TensorShapeProto.Dim\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tb\x06proto3') -TypeError: __init__() got an unexpected keyword argument 'syntax' -``` - -This is due to a conflict between protobuf versions (we require protobuf 3.2.0). -The best current solution is to make sure older versions of protobuf are not -installed, such as: - -```bash -$ pip install --upgrade protobuf -``` - -Or (if you have protobuf installed with Homebrew): - -```bash -$ brew upgrade protobuf -``` - -### Mac OS X: Segmentation Fault when import tensorflow - -On Mac OS X, you might get the following error when importing tensorflow in python: - -``` ->>> import tensorflow -I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.dylib locally -I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.dylib locally -I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.dylib locally -"import tensorflow" terminated by signal SIGSEGV (Address boundary error) -``` - -This is due to the fact that by default, cuda creates libcuda.dylib, but tensorflow tries to load libcuda.1.dylib. -This can be resolved by create a symbolic link: - -```bash -ln -sf /usr/local/cuda/lib/libcuda.dylib /usr/local/cuda/lib/libcuda.1.dylib -``` - -### Mac OS X: RuntimeError: Broken toolchain: cannot link a simple C program - -On Mac OS X, when installing tensorflow you might see lots of warnings and errors, ending with a `Broken toolchain: cannot link a simple C program` message: - -``` ->>> sudo pip install --upgrade $TF_BINARY_URL - -... - -You have not agreed to the Xcode license agreements, please run 'xcodebuild -license' (for user-level acceptance) or 'sudo xcodebuild -license' (for system-wide acceptance) from within a Terminal window to review and agree to the Xcode license agreements. - -... - - File "numpy/core/setup.py", line 653, in get_mathlib_info - - raise RuntimeError("Broken toolchain: cannot link a simple C program") - -RuntimeError: Broken toolchain: cannot link a simple C program -``` - -This is typically because you have the Xcode build tools installed, but you still need to accept the license agreements. To resolve it, accept the license agreement by opening Xcode, or by running `xcodebuild -license` from the command line. - -### Import Error -When importing tensorflow, you may see an "ImportError" raised. Below -are some possible examples and solutions: - -``` -ImportError: /lib64/libc.so.6: version `GLIBC_2.16' not found (required by ..._pywrap_tensorflow.so) -``` - -This can occur if your operating system libraries are too old for -our provided pip package binaries. Solution: Try -[building from sources](#installing-from-sources). - -``` -ImportError: cannot import name pywrap_tensorflow -``` - -This can occur if you happen to be in the tensorflow source code directory -and try to import tensorflow: the order of search path prefers the current -directory, and so tries to import directly from the source code instead of -your installed tensorflow package. Solution: don't import tensorflow -from the tensorflow source code root directory, if you are. - diff --git a/tensorflow/g3doc/how_tos/__init__.py b/tensorflow/g3doc/how_tos/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tensorflow/g3doc/how_tos/adding_an_op/__init__.py b/tensorflow/g3doc/how_tos/adding_an_op/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tensorflow/g3doc/how_tos/adding_an_op/attr_examples.cc b/tensorflow/g3doc/how_tos/adding_an_op/attr_examples.cc deleted file mode 100644 index 4eb35668ce..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/attr_examples.cc +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -==============================================================================*/ - -#include -#include "tensorflow/core/framework/op.h" - -REGISTER_OP("RestrictedTypeExample").Attr("t: {int32, float, bool}"); - -REGISTER_OP("NumberType").Attr("t: numbertype"); - -REGISTER_OP("EnumExample").Attr("e: {'apple', 'orange'}"); - -REGISTER_OP("MinIntExample").Attr("a: int >= 2"); - -REGISTER_OP("TypeListExample").Attr("a: list({int32, float}) >= 3"); - -REGISTER_OP("AttrDefaultExample").Attr("i: int = 0"); - -REGISTER_OP("AttrDefaultExampleForAllTypes") - .Attr("s: string = 'foo'") - .Attr("i: int = 0") - .Attr("f: float = 1.0") - .Attr("b: bool = true") - .Attr("ty: type = DT_INT32") - .Attr("sh: shape = { dim { size: 1 } dim { size: 2 } }") - .Attr("te: tensor = { dtype: DT_INT32 int_val: 5 }") - .Attr("l_empty: list(int) = []") - .Attr("l_int: list(int) = [2, 3, 5, 7]"); - -int main(int argc, char* argv[]) { - printf("All registered ops:\n%s\n", - tensorflow::OpRegistry::Global()->DebugString(false).c_str()); - return 0; -} diff --git a/tensorflow/g3doc/how_tos/adding_an_op/cuda_op.py b/tensorflow/g3doc/how_tos/adding_an_op/cuda_op.py deleted file mode 100644 index dd5428870b..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/cuda_op.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2015 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== -"""Cuda op Python library.""" -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import os.path - -import tensorflow as tf - -if tf.test.is_built_with_cuda(): - _cuda_op_module = tf.load_op_library(os.path.join( - tf.resource_loader.get_data_files_path(), 'cuda_op_kernel.so')) - add_one = _cuda_op_module.add_one diff --git a/tensorflow/g3doc/how_tos/adding_an_op/cuda_op_kernel.cc b/tensorflow/g3doc/how_tos/adding_an_op/cuda_op_kernel.cc deleted file mode 100644 index eb8ea96255..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/cuda_op_kernel.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -==============================================================================*/ - -#include "tensorflow/core/framework/op.h" -#include "tensorflow/core/framework/op_kernel.h" - -using namespace tensorflow; - -REGISTER_OP("AddOne") - .Input("input: int32") - .Output("output: int32") - .Doc(R"doc( -Adds 1 to all elements of the tensor. - -output: A Tensor. - output = input + 1 -)doc"); - -void AddOneKernelLauncher(const int* in, const int N, int* out); - -class AddOneOp : public OpKernel { - public: - explicit AddOneOp(OpKernelConstruction* context) : OpKernel(context) {} - - void Compute(OpKernelContext* context) override { - // Grab the input tensor - const Tensor& input_tensor = context->input(0); - auto input = input_tensor.flat(); - - // Create an output tensor - Tensor* output_tensor = NULL; - OP_REQUIRES_OK(context, context->allocate_output(0, input_tensor.shape(), - &output_tensor)); - auto output = output_tensor->template flat(); - - // Set all but the first element of the output tensor to 0. - const int N = input.size(); - // Call the cuda kernel launcher - AddOneKernelLauncher(input.data(), N, output.data()); - } -}; - -REGISTER_KERNEL_BUILDER(Name("AddOne").Device(DEVICE_GPU), AddOneOp); diff --git a/tensorflow/g3doc/how_tos/adding_an_op/cuda_op_kernel.cu.cc b/tensorflow/g3doc/how_tos/adding_an_op/cuda_op_kernel.cu.cc deleted file mode 100644 index 65b50bd3ae..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/cuda_op_kernel.cu.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -==============================================================================*/ - -#if GOOGLE_CUDA -#define EIGEN_USE_GPU -#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor" - -__global__ void AddOneKernel(const int* in, const int N, int* out) { - for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < N; - i += blockDim.x * gridDim.x) { - out[i] = in[i] + 1; - } -} - -void AddOneKernelLauncher(const int* in, const int N, int* out) { - AddOneKernel<<<32, 256>>>(in, N, out); -} - -#endif diff --git a/tensorflow/g3doc/how_tos/adding_an_op/cuda_op_test.py b/tensorflow/g3doc/how_tos/adding_an_op/cuda_op_test.py deleted file mode 100644 index 4ae5fde171..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/cuda_op_test.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2015 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== -"""Test for version 1 of the zero_out op.""" - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import tensorflow as tf -from tensorflow.g3doc.how_tos.adding_an_op import cuda_op - - -class AddOneTest(tf.test.TestCase): - - def test(self): - if tf.test.is_built_with_cuda(): - with self.test_session(): - result = cuda_op.add_one([5, 4, 3, 2, 1]) - self.assertAllEqual(result.eval(), [6, 5, 4, 3, 2]) - - -if __name__ == '__main__': - tf.test.main() diff --git a/tensorflow/g3doc/how_tos/adding_an_op/fact_test.py b/tensorflow/g3doc/how_tos/adding_an_op/fact_test.py deleted file mode 100644 index f7f17e5180..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/fact_test.py +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2015 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== - -"""Test that user ops can be used as expected.""" -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import tensorflow as tf - - -class FactTest(tf.test.TestCase): - - def test(self): - with self.test_session(): - print(tf.user_ops.my_fact().eval()) - - -if __name__ == '__main__': - tf.test.main() diff --git a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_1_test.py b/tensorflow/g3doc/how_tos/adding_an_op/zero_out_1_test.py deleted file mode 100644 index 062e845a84..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_1_test.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2015 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== - -"""Test for version 1 of the zero_out op.""" - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import os.path - -import tensorflow as tf -from tensorflow.g3doc.how_tos.adding_an_op import zero_out_op_1 - - -class ZeroOut1Test(tf.test.TestCase): - - def test(self): - with self.test_session(): - result = zero_out_op_1.zero_out([5, 4, 3, 2, 1]) - self.assertAllEqual(result.eval(), [5, 0, 0, 0, 0]) - - def testLoadTwice(self): - zero_out_loaded_again = tf.load_op_library(os.path.join( - tf.resource_loader.get_data_files_path(), 'zero_out_op_kernel_1.so')) - self.assertEqual(zero_out_loaded_again, zero_out_op_1._zero_out_module) - - -if __name__ == '__main__': - tf.test.main() diff --git a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_2_test.py b/tensorflow/g3doc/how_tos/adding_an_op/zero_out_2_test.py deleted file mode 100644 index 2598af4b27..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_2_test.py +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2015 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== - -"""Test for version 2 of the zero_out op.""" - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import tensorflow as tf -from tensorflow.g3doc.how_tos.adding_an_op import zero_out_op_2 -from tensorflow.g3doc.how_tos.adding_an_op import zero_out_grad_2 - - -class ZeroOut2Test(tf.test.TestCase): - - def test(self): - with self.test_session(): - result = zero_out_op_2.zero_out([5, 4, 3, 2, 1]) - self.assertAllEqual(result.eval(), [5, 0, 0, 0, 0]) - - def test_2d(self): - with self.test_session(): - result = zero_out_op_2.zero_out([[6, 5, 4], [3, 2, 1]]) - self.assertAllEqual(result.eval(), [[6, 0, 0], [0, 0, 0]]) - - def test_grad(self): - with self.test_session(): - shape = (5,) - x = tf.constant([5, 4, 3, 2, 1], dtype=tf.float32) - y = zero_out_op_2.zero_out(x) - err = tf.test.compute_gradient_error(x, shape, y, shape) - self.assertLess(err, 1e-4) - - def test_grad_2d(self): - with self.test_session(): - shape = (2, 3) - x = tf.constant([[6, 5, 4], [3, 2, 1]], dtype=tf.float32) - y = zero_out_op_2.zero_out(x) - err = tf.test.compute_gradient_error(x, shape, y, shape) - self.assertLess(err, 1e-4) - - -if __name__ == '__main__': - tf.test.main() diff --git a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_3_test.py b/tensorflow/g3doc/how_tos/adding_an_op/zero_out_3_test.py deleted file mode 100644 index a6778033d3..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_3_test.py +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2015 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== - -"""Test for version 3 of the zero_out op.""" - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import tensorflow as tf -from tensorflow.g3doc.how_tos.adding_an_op import zero_out_op_3 - - -class ZeroOut3Test(tf.test.TestCase): - - def test(self): - with self.test_session(): - result = zero_out_op_3.zero_out([5, 4, 3, 2, 1]) - self.assertAllEqual(result.eval(), [5, 0, 0, 0, 0]) - - def testAttr(self): - with self.test_session(): - result = zero_out_op_3.zero_out([5, 4, 3, 2, 1], preserve_index=3) - self.assertAllEqual(result.eval(), [0, 0, 0, 2, 0]) - - def testNegative(self): - with self.test_session(): - result = zero_out_op_3.zero_out([5, 4, 3, 2, 1], preserve_index=-1) - with self.assertRaisesOpError("Need preserve_index >= 0, got -1"): - result.eval() - - def testLarge(self): - with self.test_session(): - result = zero_out_op_3.zero_out([5, 4, 3, 2, 1], preserve_index=17) - with self.assertRaisesOpError("preserve_index out of range"): - result.eval() - - -if __name__ == '__main__': - tf.test.main() diff --git a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_grad_2.py b/tensorflow/g3doc/how_tos/adding_an_op/zero_out_grad_2.py deleted file mode 100644 index dc24678e33..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_grad_2.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2015 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== - -"""The gradient of the tutorial zero_out op.""" - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -from tensorflow.python.framework import ops -from tensorflow.python.ops import array_ops -from tensorflow.python.ops import sparse_ops - - -@ops.RegisterGradient("ZeroOut") -def _zero_out_grad(op, grad): - """The gradients for `zero_out`. - - Args: - op: The `zero_out` `Operation` that we are differentiating, which we can use - to find the inputs and outputs of the original op. - grad: Gradient with respect to the output of the `zero_out` op. - - Returns: - Gradients with respect to the input of `zero_out`. - """ - to_zero = op.inputs[0] - shape = array_ops.shape(to_zero) - index = array_ops.zeros_like(shape) - first_grad = array_ops.reshape(grad, [-1])[0] - to_zero_grad = sparse_ops.sparse_to_dense([index], shape, first_grad, 0) - return [to_zero_grad] # List of one Tensor, since we have one input diff --git a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_1.py b/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_1.py deleted file mode 100644 index 6bd98b1f06..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_1.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2015 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== -"""ZeroOut op Python library.""" -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import os.path - -import tensorflow as tf - -_zero_out_module = tf.load_op_library( - os.path.join(tf.resource_loader.get_data_files_path(), - 'zero_out_op_kernel_1.so')) -zero_out = _zero_out_module.zero_out diff --git a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_2.py b/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_2.py deleted file mode 100644 index ba1e8b4d62..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_2.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2015 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== -"""ZeroOut ops Python library.""" -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import os.path - -import tensorflow as tf - -_zero_out_module = tf.load_op_library( - os.path.join(tf.resource_loader.get_data_files_path(), - 'zero_out_op_kernel_2.so')) -zero_out = _zero_out_module.zero_out -zero_out2 = _zero_out_module.zero_out2 -zero_out3 = _zero_out_module.zero_out3 diff --git a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_3.py b/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_3.py deleted file mode 100644 index 4354ecaf5a..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_3.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2015 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== -"""ZeroOut op Python library.""" -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import os.path - -import tensorflow as tf - -_zero_out_module = tf.load_op_library( - os.path.join(tf.resource_loader.get_data_files_path(), - 'zero_out_op_kernel_3.so')) -zero_out = _zero_out_module.zero_out diff --git a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_kernel_1.cc b/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_kernel_1.cc deleted file mode 100644 index 18e9d7fedf..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_kernel_1.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -==============================================================================*/ - -#include "tensorflow/core/framework/op.h" -#include "tensorflow/core/framework/op_kernel.h" -#include "tensorflow/core/framework/shape_inference.h" - -using namespace tensorflow; - -REGISTER_OP("ZeroOut") - .Input("to_zero: int32") - .Output("zeroed: int32") - .SetShapeFn([](shape_inference::InferenceContext* c) { - c->set_output(0, c->input(0)); - return Status::OK(); - }) - .Doc(R"doc( -Zeros out all but the first value of a Tensor. - -zeroed: A Tensor whose first value is identical to `to_zero`, and 0 - otherwise. -)doc"); - -class ZeroOutOp : public OpKernel { - public: - explicit ZeroOutOp(OpKernelConstruction* context) : OpKernel(context) {} - - void Compute(OpKernelContext* context) override { - // Grab the input tensor - const Tensor& input_tensor = context->input(0); - auto input = input_tensor.flat(); - - // Create an output tensor - Tensor* output_tensor = NULL; - OP_REQUIRES_OK(context, context->allocate_output(0, input_tensor.shape(), - &output_tensor)); - auto output = output_tensor->template flat(); - - // Set all but the first element of the output tensor to 0. - const int N = input.size(); - for (int i = 1; i < N; i++) { - output(i) = 0; - } - - // Preserve the first input value. - if (N > 0) output(0) = input(0); - } -}; - -REGISTER_KERNEL_BUILDER(Name("ZeroOut").Device(DEVICE_CPU), ZeroOutOp); diff --git a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_kernel_2.cc b/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_kernel_2.cc deleted file mode 100644 index c0ced5c9a5..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_kernel_2.cc +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -==============================================================================*/ - -#include "tensorflow/core/framework/common_shape_fns.h" -#include "tensorflow/core/framework/op_kernel.h" -#include "tensorflow/core/framework/register_types.h" -#include "tensorflow/core/framework/shape_inference.h" - -using namespace tensorflow; - -REGISTER_OP("ZeroOut") - .Attr("T: realnumbertype") - .Input("to_zero: T") - .Output("zeroed: T") - .SetShapeFn(shape_inference::UnchangedShape) - .Doc(R"doc( -Zeros out all but the first value of a Tensor. - -zeroed: A Tensor whose first value is identical to `to_zero`, and 0 - otherwise. -)doc"); - -REGISTER_OP("ZeroOut2") - .Attr("T: realnumbertype") - .Input("to_zero: T") - .Output("zeroed: T") - .Doc(R"doc( -Zeros out all but the first value of a Tensor. - -zeroed: A Tensor whose first value is identical to `to_zero`, and 0 - otherwise. -)doc"); - -REGISTER_OP("ZeroOut3") - .Attr("T: realnumbertype") - .Input("to_zero: T") - .Output("zeroed: T") - .Doc(R"doc( -Zeros out all but the first value of a Tensor. - -zeroed: A Tensor whose first value is identical to `to_zero`, and 0 - otherwise. -)doc"); - -template -class ZeroOutOp : public OpKernel { - public: - explicit ZeroOutOp(OpKernelConstruction* context) : OpKernel(context) {} - - void Compute(OpKernelContext* context) override { - // Grab the input tensor - const Tensor& input_tensor = context->input(0); - auto input = input_tensor.flat(); - - // Create an output tensor - Tensor* output = NULL; - OP_REQUIRES_OK(context, - context->allocate_output(0, input_tensor.shape(), &output)); - auto output_flat = output->template flat(); - - // Set all the elements of the output tensor to 0 - const int N = input.size(); - for (int i = 0; i < N; i++) { - output_flat(i) = T(0); - } - - // Preserve the first input value - if (N > 0) output_flat(0) = input(0); - } -}; - -REGISTER_KERNEL_BUILDER(Name("ZeroOut") - .Device(DEVICE_CPU) - .TypeConstraint("T"), - ZeroOutOp); -REGISTER_KERNEL_BUILDER(Name("ZeroOut") - .Device(DEVICE_CPU) - .TypeConstraint("T"), - ZeroOutOp); -REGISTER_KERNEL_BUILDER(Name("ZeroOut") - .Device(DEVICE_CPU) - .TypeConstraint("T"), - ZeroOutOp); - -#define REGISTER_KERNEL(type) \ - REGISTER_KERNEL_BUILDER( \ - Name("ZeroOut2").Device(DEVICE_CPU).TypeConstraint("T"), \ - ZeroOutOp) - -REGISTER_KERNEL(float); -REGISTER_KERNEL(double); -REGISTER_KERNEL(int32); - -#undef REGISTER_KERNEL - -#define REGISTER_KERNEL(type) \ - REGISTER_KERNEL_BUILDER( \ - Name("ZeroOut3").Device(DEVICE_CPU).TypeConstraint("T"), \ - ZeroOutOp) - -TF_CALL_REAL_NUMBER_TYPES(REGISTER_KERNEL); - -#undef REGISTER_KERNEL diff --git a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_kernel_3.cc b/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_kernel_3.cc deleted file mode 100644 index ad449dc2ea..0000000000 --- a/tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_kernel_3.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -==============================================================================*/ - -#include "tensorflow/core/framework/op.h" -#include "tensorflow/core/framework/op_kernel.h" -#include "tensorflow/core/framework/shape_inference.h" - -using namespace tensorflow; - -REGISTER_OP("ZeroOut") - .Attr("preserve_index: int = 0") - .Input("to_zero: int32") - .Output("zeroed: int32") - .SetShapeFn([](shape_inference::InferenceContext* c) { - c->set_output(0, c->input(0)); - return Status::OK(); - }); - -class ZeroOutOp : public OpKernel { - public: - explicit ZeroOutOp(OpKernelConstruction* context) : OpKernel(context) { - // Get the index of the value to preserve - OP_REQUIRES_OK(context, - context->GetAttr("preserve_index", &preserve_index_)); - // Check that preserve\_index is positive - OP_REQUIRES(context, preserve_index_ >= 0, - errors::InvalidArgument("Need preserve_index >= 0, got ", - preserve_index_)); - } - - void Compute(OpKernelContext* context) override { - // Grab the input tensor - const Tensor& input_tensor = context->input(0); - auto input = input_tensor.flat(); - - // Check that preserve_index is in range - OP_REQUIRES(context, preserve_index_ < input.dimension(0), - errors::InvalidArgument("preserve_index out of range")); - - // Create an output tensor - Tensor* output_tensor = NULL; - OP_REQUIRES_OK(context, context->allocate_output(0, input_tensor.shape(), - &output_tensor)); - auto output = output_tensor->template flat(); - - // Set all the elements of the output tensor to 0 - const int N = input.size(); - for (int i = 0; i < N; i++) { - output(i) = 0; - } - - // Preserve the requested input value - output(preserve_index_) = input(preserve_index_); - } - - private: - int preserve_index_; -}; - -REGISTER_KERNEL_BUILDER(Name("ZeroOut").Device(DEVICE_CPU), ZeroOutOp); diff --git a/tensorflow/g3doc/how_tos/index.md b/tensorflow/g3doc/how_tos/index.md deleted file mode 100644 index 2d18942792..0000000000 --- a/tensorflow/g3doc/how_tos/index.md +++ /dev/null @@ -1,174 +0,0 @@ -# How-Tos - - -## Variables: Creation, Initializing, Saving, and Restoring - -TensorFlow Variables are in-memory buffers containing tensors. Learn how to -use them to hold and update model parameters during training. - -[View Tutorial](variables/index.md) - - -## TensorFlow Mechanics 101 - -A step-by-step walk through of the details of using TensorFlow infrastructure -to train models at scale, using MNIST handwritten digit recognition as a toy -example. - -[View Tutorial](../tutorials/mnist/tf/index.md) - - -## TensorBoard: Visualizing Learning - -TensorBoard is a useful tool for visualizing the training and evaluation of -your model(s). This tutorial describes how to build and run TensorBoard as well -as how to add Summary ops to automatically output data to the Events files that -TensorBoard uses for display. - -[View Tutorial](summaries_and_tensorboard/index.md) - - -## TensorBoard: Graph Visualization - -This tutorial describes how to use the graph visualizer in TensorBoard to help -you understand the dataflow graph and debug it. - -[View Tutorial](graph_viz/index.md) - - -## TensorBoard: Embedding Visualization - -This tutorial describes how to use the embedding projector in TensorBoard to -visualize your embeddings. - -[View Tutorial](embedding_viz/index.md) - -## Reading Data - -This tutorial describes the three main methods of getting data into your -TensorFlow program: Feeding, Reading and Preloading. - -[View Tutorial](reading_data/index.md) - -## Distributed TensorFlow - -This tutorial describes how to execute TensorFlow programs using a cluster of -TensorFlow servers. - -[View Tutorial](distributed/index.md) - - -## Threading and Queues - -This tutorial describes the various constructs implemented by TensorFlow -to facilitate asynchronous and concurrent training. - -[View Tutorial](threading_and_queues/index.md) - - -## Adding a New Op - -TensorFlow already has a large suite of node operations from which you can -compose in your graph, but here are the details of how to add you own custom Op. - -[View Tutorial](adding_an_op/index.md) - - -## How to write TensorFlow code - -TensorFlow Style Guide is set of style decisions that both developers -and users of TensorFlow should follow to increase the readability of their code, -reduce the number of errors, and promote consistency. - -[View Style Guide](style_guide.md) - - -## Writing Documentation - -TensorFlow's documentation is largely generated from its source code. Here is an -introduction to the formats we use, a style guide, and instructions on how to -build updated documentation from the source. - -[View Tutorial](documentation/index.md) - - -## Custom Data Readers - -If you have a sizable custom data set, you may want to consider extending -TensorFlow to read your data directly in it's native format. Here's how. - -[View Tutorial](new_data_formats/index.md) - - -## Using GPUs - -This tutorial describes how to construct and execute models on GPU(s). - -[View Tutorial](using_gpu/index.md) - - -## Sharing Variables - -When deploying large models on multiple GPUs, or when unrolling complex LSTMs -or RNNs, it is often necessary to access the same Variable objects from -different locations in the model construction code. - -The "Variable Scope" mechanism is designed to facilitate that. - -[View Tutorial](variable_scope/index.md) - -## A Tool Developer's Guide to TensorFlow Model Files - -If you're developing a tool to load, analyze, or manipulate TensorFlow model -files, it's useful to understand a bit about the format in which they're stored. -This guide covers the details of the saved model format. - -[View Tutorial](../how_tos/tool_developers/index.md) - -## How to Retrain Inception using Transfer Learning - -Training a full object recognition model like Inception takes a long time and a -lot of images. This example shows how to use the technique of transfer learning -to retrain just the final layer of a fully-trained model to recognize new -categories of objects, which is a lot faster and easier than completely -retraining a new model. - -[View Tutorial](../how_tos/image_retraining/index.md) - -## How to use the TensorFlow Debugger - -The TensorFlow Debugger (tfdbg) is a specialized debugger for TensorFlow -models. It provides visibility into the internal structure and state of running -TensorFlow graphs. Using the command-line interface of tfdbg, you can debug -model bugs and issues with fewer code changes and more insight. - -[View Tutorial](../how_tos/debugger/index.md) - -## How to Export and Import a Model - -This tutorial describes how to export everything pertaining to a running -model and import it later for various purposes. - -[View Tutorial](../how_tos/meta_graph/index.md) - -## How to Quantize Neural Networks with TensorFlow - -This guide shows how you can convert a float model into one using eight-bit -quantized parameters and calculations. It also describes how the quantization -process works under the hood. - -[View Tutorial](../how_tos/quantization/index.md) - -## How to run TensorFlow on Hadoop - -This tutorial shows how to read and write HDFS files, and will later describe -running on cluster managers. - -[View Tutorial](../how_tos/hadoop/index.md) - -## TensorFlow in other languages - -This guide describes how TensorFlow features can be provided in other -programming languages. - -[View Tutorial](language_bindings/index.md) diff --git a/tensorflow/g3doc/how_tos/leftnav_files b/tensorflow/g3doc/how_tos/leftnav_files deleted file mode 100644 index 011444fff1..0000000000 --- a/tensorflow/g3doc/how_tos/leftnav_files +++ /dev/null @@ -1,13 +0,0 @@ -variables/index.md -summaries_and_tensorboard/index.md -graph_viz/index.md -embedding_viz/index.md -reading_data/index.md -threading_and_queues/index.md -distributed/index.md -adding_an_op/index.md -new_data_formats/index.md -using_gpu/index.md -variable_scope/index.md -hadoop/index.md -language_bindings/index.md diff --git a/tensorflow/g3doc/images/getting_started.dot b/tensorflow/g3doc/images/getting_started.dot deleted file mode 100644 index a9cae6c4b1..0000000000 --- a/tensorflow/g3doc/images/getting_started.dot +++ /dev/null @@ -1,14 +0,0 @@ -digraph Dependencies { - node [shape = oval]; - "predictions: MatMul()" -> "data: Concat()" - "data: Concat()" -> data_left - "data: Concat()" -> data_right - "predictions: MatMul()" -> "weight_matrix: Reshape()" - "weight_matrix: Reshape()" -> "new_weights: Add()" - "new_weights: Add()" -> weights - "new_weights: Add()" -> deltas - "update: Assign()" -> weights - "update: Assign()" -> "new_weights: Add()" - "InitializeAllVariables()" -> weights - "InitializeAllVariables()" -> init_value -} \ No newline at end of file diff --git a/tensorflow/g3doc/resources/bib.md b/tensorflow/g3doc/resources/bib.md deleted file mode 100644 index 907f06161e..0000000000 --- a/tensorflow/g3doc/resources/bib.md +++ /dev/null @@ -1,87 +0,0 @@ -# TensorFlow Whitepaper - -If you use TensorFlow in your research and would like to cite the TensorFlow -system, we suggest you cite the [whitepaper](http://download.tensorflow.org/paper/whitepaper2015.pdf): - -``` -@misc{tensorflow2015-whitepaper, -title={{TensorFlow}: Large-Scale Machine Learning on Heterogeneous Systems}, -url={http://tensorflow.org/}, -note={Software available from tensorflow.org}, -author={ - Mart\'{\i}n~Abadi and - Ashish~Agarwal and - Paul~Barham and - Eugene~Brevdo and - Zhifeng~Chen and - Craig~Citro and - Greg~S.~Corrado and - Andy~Davis and - Jeffrey~Dean and - Matthieu~Devin and - Sanjay~Ghemawat and - Ian~Goodfellow and - Andrew~Harp and - Geoffrey~Irving and - Michael~Isard and - Yangqing Jia and - Rafal~Jozefowicz and - Lukasz~Kaiser and - Manjunath~Kudlur and - Josh~Levenberg and - Dan~Man\'{e} and - Rajat~Monga and - Sherry~Moore and - Derek~Murray and - Chris~Olah and - Mike~Schuster and - Jonathon~Shlens and - Benoit~Steiner and - Ilya~Sutskever and - Kunal~Talwar and - Paul~Tucker and - Vincent~Vanhoucke and - Vijay~Vasudevan and - Fernanda~Vi\'{e}gas and - Oriol~Vinyals and - Pete~Warden and - Martin~Wattenberg and - Martin~Wicke and - Yuan~Yu and - Xiaoqiang~Zheng}, - year={2015}, -} -``` - -In textual form: - -``` -Martín Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, -Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, -Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, -Andrew Harp, Geoffrey Irving, Michael Isard, Rafal Jozefowicz, Yangqing Jia, -Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mané, Mike Schuster, -Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Jonathon Shlens, -Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, -Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viégas, -Oriol Vinyals, Pete Warden, Martin Wattenberg, Martin Wicke, -Yuan Yu, and Xiaoqiang Zheng. -TensorFlow: Large-scale machine learning on heterogeneous systems, -2015. Software available from tensorflow.org. -``` - -If you use [TF.Learn](https://www.tensorflow.org/tutorials/tflearn/) in your research and would like to cite it, we suggest you cite the [whitepaper](https://arxiv.org/abs/1612.04251): - -``` -@article{tang2016tflearn, - title={TF.Learn: TensorFlow's High-level Module for Distributed Machine Learning}, - author={Tang, Yuan}, - journal={arXiv preprint arXiv:1612.04251}, - year={2016} -} -``` - -In textual form: -``` -Tang, Yuan. "TF.Learn: TensorFlow's High-level Module for Distributed Machine Learning." arXiv preprint arXiv:1612.04251 (2016). -``` \ No newline at end of file diff --git a/tensorflow/g3doc/resources/glossary.md b/tensorflow/g3doc/resources/glossary.md deleted file mode 100644 index a0ae73d917..0000000000 --- a/tensorflow/g3doc/resources/glossary.md +++ /dev/null @@ -1,142 +0,0 @@ -# Glossary - -**Broadcasting operation** - -An operation that uses [numpy-style broadcasting](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) -to make the shapes of its tensor arguments compatible. - -**Device** - -A piece of hardware that can run computation and has its own address space, -like a GPU or CPU. - -**eval** - -A method of `Tensor` that returns the value of the `Tensor`, triggering any -graph computation required to determine the value. You may only call `eval()` -on a `Tensor` in a graph that has been launched in a session. - -**Feed** - -TensorFlow's mechanism for patching a tensor directly into any node in a graph -launched in a session. You apply feeds when you trigger the execution of a -graph, not when you build the graph. A feed temporarily replaces a node with a -tensor value. You supply feed data as an argument to a `run()` or `eval()` call -that initiates computation. After the run the feed disappears and the original -node definition remains. You usually designate specific nodes to be "feed" -nodes by using `tf.placeholder()` to create them. See -[Basic Usage](../get_started/basic_usage.md) for more information. - -**Fetch** - -TensorFlow's mechanism for retrieving tensors from a graph launched in a -session. You retrieve fetches when you trigger the execution of a graph, not -when you build the graph. To fetch the tensor value of a node or nodes, -execute the graph with a `run()` call on the `Session` object and pass a list of -names of nodes to retrieve. See [Basic Usage](../get_started/basic_usage.md) -for more information. - -**Graph** - -Describes a computation as a directed acyclic -graph. Nodes in the graph represent operations that must be -performed. Edges in the graph represent either data or control -dependencies. `GraphDef` is the proto used to describe a graph to the -system (it is the API), and consists of a collection of `NodeDefs` (see -below). A `GraphDef` may be converted to a (C++) `Graph` object which is -easier to operate on. - -**IndexedSlices** - -In the Python API, TensorFlow's representation of a tensor that is sparse -along only its first dimension. If the tensor is `k`-dimensional, an -`IndexedSlices` instance logically represents a collection of -`(k-1)`-dimensional slices along the tensor's first dimension. The indices of -the slices are stored concatenated into a single 1-dimensional vector, and the -corresponding slices are concatenated to form a single `k`-dimensional tensor. Use -`SparseTensor` if the sparsity is not restricted to the first dimension. - -**Node** - -An element of a graph. - -Describes how to invoke a specific operation as one node in a specific -computation `Graph`, including the values for any `attrs` needed to configure -the operation. For operations that are polymorphic, the `attrs` include -sufficient information to completely determine the signature of the `Node`. -See `graph.proto` for details. - -**Op (operation)** - -In the TensorFlow runtime: A type of computation such as `add` or `matmul` or -`concat`. You can add new ops to the runtime as described [how to add an -op](../how_tos/adding_an_op/index.md). - -In the Python API: A node in the graph. Ops are represented by instances of -the class [`tf.Operation`](../api_docs/python/framework.md#Operation). The -`type` property of an `Operation` indicates the run operation for the node, -such as `add` or `matmul`. - -**Run** - -The action of executing ops in a launched graph. Requires that the graph be -launched in a `Session`. - -In the Python API: A method of the `Session` class: -[`tf.Session.run`](../api_docs/python/client.md#Session). You can pass tensors -to feed and fetch to the `run()` call. - -In the C++ API: A method of the [`tensorflow::Session`](../api_docs/cc/ClassSession.md). - -**Session** - -A runtime object representing a launched graph. Provides methods to execute -ops in the graph. - -In the Python API: [`tf.Session`](../api_docs/python/client.md#Session) - -In the C++ API: class used to launch a graph and run operations -[`tensorflow::Session`](../api_docs/cc/ClassSession.md). - -**Shape** - -The number of dimensions of a tensor and their sizes. - -In a launched graph: Property of the tensors that flow between nodes. Some ops -have strong requirements on the shape of their inputs and report errors at -runtime if these are not met. - -In the Python API: Attribute of a Python `Tensor` in the graph construction -API. During constructions the shape of tensors can be only partially known, or -even unknown. See -[`tf.TensorShape`](../api_docs/python/framework.md#TensorShape) - -In the C++ API: class used to represent the shape of tensors -[`tensorflow::TensorShape`](../api_docs/cc/ClassTensorShape.md). - -**SparseTensor** - -In the Python API, TensorFlow's representation of a tensor that is sparse in -arbitrary positions. A `SparseTensor` stores only the non-empty values along -with their indices, using a dictionary-of-keys format. In other words, if -there are `m` non-empty values, it maintains a length-`m` vector of values and -a matrix with m rows of indices. For efficiency, `SparseTensor` requires the -indices to be sorted along increasing dimension number, i.e. in row-major -order. Use `IndexedSlices` if the sparsity is only along the first dimension. - -**Tensor** - -A `Tensor` is a typed multi-dimensional array. For example, a 4-D -array of floating point numbers representing a mini-batch of images with -dimensions `[batch, height, width, channel]`. - -In a launched graph: Type of the data that flow between nodes. - -In the Python API: class used to represent the output and inputs of ops added -to the graph [`tf.Tensor`](../api_docs/python/framework.md#Tensor). Instances of -this class do not hold data. - -In the C++ API: class used to represent tensors returned from a -[`Session::Run()`](../api_docs/cc/ClassSession.md) call -[`tensorflow::Tensor`](../api_docs/cc/ClassTensor.md). -Instances of this class hold data. diff --git a/tensorflow/g3doc/resources/leftnav_files b/tensorflow/g3doc/resources/leftnav_files deleted file mode 100644 index 0d29f95359..0000000000 --- a/tensorflow/g3doc/resources/leftnav_files +++ /dev/null @@ -1,8 +0,0 @@ -bib.md -uses.md -faq.md -glossary.md -dims_types.md -versions.md -data_versions.md -roadmap.md diff --git a/tensorflow/g3doc/tutorials/__init__.py b/tensorflow/g3doc/tutorials/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tensorflow/g3doc/tutorials/deep_cnn/cifar_tensorboard.html b/tensorflow/g3doc/tutorials/deep_cnn/cifar_tensorboard.html deleted file mode 100644 index 266faf042e..0000000000 --- a/tensorflow/g3doc/tutorials/deep_cnn/cifar_tensorboard.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - TensorBoard Demo - - - - - - - - diff --git a/tensorflow/g3doc/tutorials/index.md b/tensorflow/g3doc/tutorials/index.md deleted file mode 100644 index 505f1b4270..0000000000 --- a/tensorflow/g3doc/tutorials/index.md +++ /dev/null @@ -1,177 +0,0 @@ -# Tutorials - -## Basic Neural Networks - -The first few Tensorflow tutorials guide you through training and testing a -simple neural network to classify handwritten digits from the MNIST database of -digit images. - -### MNIST For ML Beginners - -If you're new to machine learning, we recommend starting here. You'll learn -about a classic problem, handwritten digit classification (MNIST), and get a -gentle introduction to multiclass classification. - -[View Tutorial](../tutorials/mnist/beginners/index.md) - -### Deep MNIST for Experts - -If you're already familiar with other deep learning software packages, and are -already familiar with MNIST, this tutorial will give you a very brief primer on -TensorFlow. - -[View Tutorial](../tutorials/mnist/pros/index.md) - -### TensorFlow Mechanics 101 - -This is a technical tutorial, where we walk you through the details of using -TensorFlow infrastructure to train models at scale. We use MNIST as the example. - -[View Tutorial](../tutorials/mnist/tf/index.md) - -## Easy ML with tf.contrib.learn - -### tf.contrib.learn Quickstart - -A quick introduction to tf.contrib.learn, a high-level API for TensorFlow. -Build, train, and evaluate a neural network with just a few lines of code. - -[View Tutorial](../tutorials/tflearn/index.md) - -### Overview of Linear Models with tf.contrib.learn - -An overview of tf.contrib.learn's rich set of tools for working with linear -models in TensorFlow. - -[View Tutorial](../tutorials/linear/overview.md) - -### Linear Model Tutorial - -This tutorial walks you through the code for building a linear model using -tf.contrib.learn. - -[View Tutorial](../tutorials/wide/index.md) - -### Wide and Deep Learning Tutorial - -This tutorial shows you how to use tf.contrib.learn to jointly train a linear -model and a deep neural net to harness the advantages of each type of model. - -[View Tutorial](../tutorials/wide_and_deep/index.md) - -### Logging and Monitoring Basics with tf.contrib.learn - -This tutorial shows you how to use TensorFlow’s logging capabilities and the -Monitor API to audit the in-progress training of a neural network. - -[View Tutorial](../tutorials/monitors/index.md) - -### Building Input Functions with tf.contrib.learn - -This tutorial introduces you to creating input functions in tf.contrib.learn, -and walks you through implementing an `input_fn` to train a neural network for -predicting median house values. - -[View Tutorial](../tutorials/input_fn/index.md) - -### Creating Estimators in tf.contrib.learn - -This tutorial covers how to create your own `Estimator` using the building -blocks provided in tf.contrib.learn. You'll build a model to predict the ages of -abalones based on their physical measurements. - -[View Tutorial](../tutorials/estimators/index.md) - -### A Guide to TF Layers: Building a Convolutional Neural Network - -This tutorial introduces you to building neural networks in TensorFlow using the -`tf.layers` module. You'll build a convolutional neural network `Estimator` to -recognize the handwritten digits in the MNIST data set. - -[View Tutorial](../tutorials/layers/index.md) - -## TensorFlow Serving - -### TensorFlow Serving - -An introduction to TensorFlow Serving, a flexible, high-performance system for -serving machine learning models, designed for production environments. - -[View Tutorial](../tutorials/tfserve/index.md) - -## Image Processing - -### Convolutional Neural Networks - -An introduction to convolutional neural networks using the CIFAR-10 data set. -Convolutional neural nets are particularly tailored to images, since they -exploit translation invariance to yield more compact and effective -representations of visual content. - -[View Tutorial](../tutorials/deep_cnn/index.md) - -### Image Recognition - -How to run object recognition using a convolutional neural network trained on -ImageNet Challenge data and label set. - -[View Tutorial](../tutorials/image_recognition/index.md) - -### Deep Dream Visual Hallucinations - -Building on the Inception recognition model, we will release a TensorFlow -version of the [Deep Dream](https://github.com/google/deepdream) neural network -visual hallucination software. - -[View -Tutorial](https://nbviewer.jupyter.org/github/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb) - -## Language and Sequence Processing - -### Vector Representations of Words - -This tutorial motivates why it is useful to learn to represent words as vectors -(called *word embeddings*). It introduces the word2vec model as an efficient -method for learning embeddings. It also covers the high-level details behind -noise-contrastive training methods (the biggest recent advance in training -embeddings). - -[View Tutorial](../tutorials/word2vec/index.md) - -### Recurrent Neural Networks - -An introduction to RNNs, wherein we train an LSTM network to predict the next -word in an English sentence. (A task sometimes called language modeling.) - -[View Tutorial](../tutorials/recurrent/index.md) - -### Sequence-to-Sequence Models - -A follow on to the RNN tutorial, where we assemble a sequence-to-sequence model -for machine translation. You will learn to build your own English-to-French -translator, entirely machine learned, end-to-end. - -[View Tutorial](../tutorials/seq2seq/index.md) - -### SyntaxNet: Neural Models of Syntax - -An introduction to SyntaxNet, a Natural Language Processing framework for -TensorFlow. - -[View Tutorial](../tutorials/syntaxnet/index.md) - -## Non-ML Applications - -### Mandelbrot Set - -TensorFlow can be used for computation that has nothing to do with machine -learning. Here's a naive implementation of Mandelbrot set visualization. - -[View Tutorial](../tutorials/mandelbrot/index.md) - -### Partial Differential Equations - -As another example of non-machine learning computation, we offer an example of a -naive PDE simulation of raindrops landing on a pond. - -[View Tutorial](../tutorials/pdes/index.md) diff --git a/tensorflow/g3doc/tutorials/leftnav_files b/tensorflow/g3doc/tutorials/leftnav_files deleted file mode 100644 index 77ec0a0f39..0000000000 --- a/tensorflow/g3doc/tutorials/leftnav_files +++ /dev/null @@ -1,26 +0,0 @@ -### Basic Neural Networks -mnist/beginners/index.md -mnist/pros/index.md -mnist/tf/index.md -### Easy ML with tf.contrib.learn -tflearn/index.md -linear/overview.md -wide/index.md -wide_and_deep/index.md -monitors/index.md -input_fn/index.md -estimators/index.md -layers/index.md -### TensorFlow Serving -tfserve/index.md -### Image Processing -deep_cnn/index.md -image_recognition/index.md -### Language and Sequence Processing -word2vec/index.md -recurrent/index.md -seq2seq/index.md -syntaxnet/index.md -### Non-ML Applications -mandelbrot/index.md -pdes/index.md diff --git a/tensorflow/g3doc/tutorials/syntaxnet/index.md b/tensorflow/g3doc/tutorials/syntaxnet/index.md deleted file mode 100644 index 2ba3fb401e..0000000000 --- a/tensorflow/g3doc/tutorials/syntaxnet/index.md +++ /dev/null @@ -1,17 +0,0 @@ -# SyntaxNet - -## Introduction - -SyntaxNet is a neural-network Natural Language Processing framework for -TensorFlow. - -## Basic SyntaxNet Tutorial - -The [tutorial]( -https://github.com/tensorflow/models/tree/master/syntaxnet#installation) -shows you how to: - - * Install SyntaxNet. - * Use the included, pretrained Parsey McParseface parser. - * Train your own part-of-speech tagger. - * Train your own parser. \ No newline at end of file -- GitLab From 203a4d98d696c44214854df68b43f7bd7c89ca5f Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 27 Feb 2017 13:01:01 -0800 Subject: [PATCH 018/101] Refactor the buffer forwarding code: * Moves the core forwarding logic to a new function forward_input that is not restricted to forwarding to an output slot, but also allows, e.g., reusing input buffers as temporaries or variables. * Gets rid of forward_input_to_output_with_same_shape that is now unused. * Adds convenience methods input_memory_type(), output_memory_type, and (private) input_is_ref() to OpKernelContext. * Misc. small cleanups. Change: 148683484 --- tensorflow/core/framework/op_kernel.cc | 159 ++++++++++--------------- tensorflow/core/framework/op_kernel.h | 58 ++++++--- 2 files changed, 107 insertions(+), 110 deletions(-) diff --git a/tensorflow/core/framework/op_kernel.cc b/tensorflow/core/framework/op_kernel.cc index 2b0488d944..186a0c104c 100644 --- a/tensorflow/core/framework/op_kernel.cc +++ b/tensorflow/core/framework/op_kernel.cc @@ -199,8 +199,8 @@ OpKernelContext::OpKernelContext(Params* params) : OpKernelContext( params, static_cast(params->op_kernel->output_types().size())) {} -OpKernelContext::OpKernelContext(Params* params, int noutputs) - : params_(params), outputs_(noutputs) { +OpKernelContext::OpKernelContext(Params* params, int num_outputs) + : params_(params), outputs_(num_outputs) { Allocator* eigen_gpu_allocator = get_allocator(AllocatorAttributes()); params_->ensure_eigen_gpu_device(); params_->device->ReinitializeGpuDevice(this, params_->eigen_gpu_device, @@ -258,9 +258,9 @@ Status OpKernelContext::input(StringPiece name, const Tensor** tensor) { "' when single-valued input was " "expected"); } - if ((*params_->inputs)[start].is_ref()) { + if (input_is_ref(start)) { return errors::InvalidArgument("OpKernel used ref input name '", name, - "' when immutable input was expected"); + "' when non-ref input was expected"); } *tensor = (*params_->inputs)[start].tensor; record_tensor_reference(**tensor); @@ -299,8 +299,8 @@ Status OpKernelContext::input_ref_mutex(StringPiece name, mutex** out_mutex) { const Tensor& OpKernelContext::input(int index) { DCHECK_GE(index, 0); - DCHECK_LT(index, params_->inputs->size()); - DCHECK(!(*params_->inputs)[index].is_ref()); + DCHECK_LT(index, num_inputs()); + DCHECK(!input_is_ref(index)); const Tensor& tensor = *((*params_->inputs)[index].tensor); record_tensor_reference(tensor); return tensor; @@ -308,8 +308,8 @@ const Tensor& OpKernelContext::input(int index) { Tensor OpKernelContext::mutable_input(int index, bool lock_held) { DCHECK_GE(index, 0); - DCHECK_LT(index, params_->inputs->size()); - DCHECK((*params_->inputs)[index].is_ref()); + DCHECK_LT(index, num_inputs()); + DCHECK(input_is_ref(index)); // return a copy of the Ref acquired while holding the mutex if (lock_held) { Tensor& tensor = *((*params_->inputs)[index].tensor); @@ -326,8 +326,8 @@ Tensor OpKernelContext::mutable_input(int index, bool lock_held) { void OpKernelContext::replace_ref_input(int index, const Tensor& tensor, bool lock_held) { DCHECK_GE(index, 0); - DCHECK_LT(index, params_->inputs->size()); - DCHECK((*params_->inputs)[index].is_ref()); + DCHECK_LT(index, num_inputs()); + DCHECK(input_is_ref(index)); // should only modify the tensor while holding the mutex if (lock_held) { *(*params_->inputs)[index].tensor = tensor; @@ -341,27 +341,34 @@ void OpKernelContext::replace_ref_input(int index, const Tensor& tensor, void OpKernelContext::forward_ref_input_to_ref_output(int input_index, int output_index) { DCHECK_GE(input_index, 0); - DCHECK_LT(input_index, params_->inputs->size()); - DCHECK((*params_->inputs)[input_index].is_ref()); + DCHECK_LT(input_index, num_inputs()); + DCHECK(input_is_ref(input_index)); set_output_ref(output_index, (*params_->inputs)[input_index].mutex_if_ref, (*params_->inputs)[input_index].tensor); } -bool OpKernelContext::forward_input_to_output_with_same_shape(int input_index, - int output_index, - Tensor** output) { - DCHECK_GE(input_index, 0); - DCHECK_LT(input_index, params_->inputs->size()); - const TensorValue& input = (*params_->inputs)[input_index]; - if (input.tensor == nullptr) { +bool OpKernelContext::forward_input_to_output_with_shape( + int input_index, int output_index, const TensorShape& output_shape, + Tensor** output) { + const auto output_attr = params_->output_attr_array == nullptr + ? AllocatorAttributes() + : output_alloc_attr(output_index); + std::unique_ptr new_tensor = forward_input( + input_index, expected_output_dtype(output_index), output_shape, + output_memory_type(output_index), output_attr); + if (new_tensor != nullptr) { + // Transfer ownership to the output slot in OpKernelContext. + outputs_[output_index] = TensorValue(new_tensor.release()); + *output = outputs_[output_index].tensor; + return true; + } else { return false; } - return forward_input_to_output_with_shape(input_index, output_index, - input.tensor->shape(), output); } -Status OpKernelContext::forward_input_to_output_with_same_shape( - StringPiece input_name, StringPiece output_name, Tensor** output) { +Status OpKernelContext::forward_input_to_output_with_shape( + StringPiece input_name, StringPiece output_name, + const TensorShape& output_shape, Tensor** output) { int input_index, output_index, stop; TF_RETURN_IF_ERROR( params_->op_kernel->InputRange(input_name, &input_index, &stop)); @@ -379,102 +386,68 @@ Status OpKernelContext::forward_input_to_output_with_same_shape( "' when single-valued output was " "expected"); } - if (!forward_input_to_output_with_same_shape(input_index, output_index, - output)) { + if (!forward_input_to_output_with_shape(input_index, output_index, + output_shape, output)) { return errors::FailedPrecondition("OpKernel could not forward input '", input_name, "' to output '", output_name); } return Status::OK(); } -bool OpKernelContext::forward_input_to_output_with_shape( - int input_index, int output_index, const TensorShape& output_shape, - Tensor** output) { +std::unique_ptr OpKernelContext::forward_input( + int input_index, DataType output_dtype, const TensorShape& output_shape, + MemoryType output_memory_type, const AllocatorAttributes& output_attr) { + // TODO(rmlarsen,zhengxq): Re-enable for GPU memory once kernels have been + // made forwarding aware or decorated to expose which inputs they rely on + // to access via the read-only texture cache. + // TODO(rmlarsen): Short term, move disabling logic into the kernels + // themselves for fine-grained control. + DCHECK(params_->device != nullptr); + if (output_memory_type == DEVICE_MEMORY && + params_->device->attributes().device_type() == DEVICE_GPU) { + return nullptr; + } + DCHECK_GE(input_index, 0); - DCHECK_LT(input_index, params_->inputs->size()); + DCHECK_LT(input_index, num_inputs()); const TensorValue& input = (*params_->inputs)[input_index]; - // Check that input tensor exists, is not a ref, and have no other consumers. + // Check that input tensor exists, is not a ref, and has no other consumers. if (input.tensor == nullptr || input.is_ref() || !input->RefCountIsOne()) { - return false; + return nullptr; } - DCHECK_GE(output_index, 0); - DCHECK_LT(output_index, num_outputs()); - // Check that input and output types match. - if (expected_output_dtype(output_index) != input_dtype(input_index)) { - return false; + // Check that input type matches. + if (input_dtype(input_index) != output_dtype) { + return nullptr; } // Check that the input and output sizes are compatible. if (input.tensor->shape().num_elements() != output_shape.num_elements()) { - return false; + return nullptr; } // Check that input and output memory types match, i.e. // that they either both live in host or both live in device memmory. - if (op_kernel().output_memory_types()[output_index] != - op_kernel().input_memory_types()[input_index]) { - return false; - } - - // TODO(rmlarsen,zhengxq): Re-enable for GPU memory once kernels have been - // made forwarding aware or decorated to expose which inputs they rely on - // to access via the read-only texture cache. - // TODO(rmlarsen): Short term, move disabling logic into the kernels - // themselves for fine-grained control. - DCHECK(params_->device != nullptr); - if (op_kernel().output_memory_types()[output_index] == DEVICE_MEMORY && - params_->device->attributes().device_type() == DEVICE_GPU) { - return false; + if (input_memory_type(input_index) != output_memory_type) { + return nullptr; } - // Check that output allocator attributes are not more restrictive than // input allocator attributes. const auto input_attr = params_->input_alloc_attrs == nullptr ? AllocatorAttributes() : input_alloc_attr(input_index); - const auto output_attr = params_->output_attr_array == nullptr - ? AllocatorAttributes() - : output_alloc_attr(output_index); if (!output_attr.IsEqualOrLessRestrictiveThan(input_attr)) { - return false; + return nullptr; } - Tensor* output_tensor = new Tensor(); + // TODO(rmlarsen): Use MakeUnique here. There is already a copy in + // tensorflow/compiler/xla/ptr_util.h. Perhaps this should be part of + // general cleanup of ownership in this code. + std::unique_ptr output_tensor(new Tensor()); CHECK(output_tensor->CopyFrom(*input.tensor, output_shape)); - outputs_[output_index] = TensorValue(output_tensor); - *output = outputs_[output_index].tensor; - return true; -} - -Status OpKernelContext::forward_input_to_output_with_shape( - StringPiece input_name, StringPiece output_name, - const TensorShape& output_shape, Tensor** output) { - int input_index, output_index, stop; - TF_RETURN_IF_ERROR( - params_->op_kernel->InputRange(input_name, &input_index, &stop)); - if (stop != input_index + 1) { - return errors::InvalidArgument("OpKernel used list-valued input name '", - input_name, - "' when single-valued input was " - "expected"); - } - TF_RETURN_IF_ERROR( - params_->op_kernel->OutputRange(output_name, &output_index, &stop)); - if (stop != output_index + 1) { - return errors::InvalidArgument("OpKernel used list-valued output name '", - output_name, - "' when single-valued output was " - "expected"); - } - if (!forward_input_to_output_with_shape(input_index, output_index, - output_shape, output)) { - return errors::FailedPrecondition("OpKernel could not forward input '", - input_name, "' to output '", output_name); - } - return Status::OK(); + return output_tensor; } void OpKernelContext::delete_ref_input(int index, bool lock_held) { DCHECK_GE(index, 0); - DCHECK_LT(index, params_->inputs->size()); - DCHECK((*params_->inputs)[index].is_ref()); + DCHECK_LT(index, num_inputs()); + DCHECK(input_is_ref(index)); // should only modify the tensor while holding the mutex if (lock_held) { delete (*params_->inputs)[index].tensor; @@ -493,8 +466,8 @@ Status OpKernelContext::mutable_input(StringPiece name, Tensor* tensor, name, "' when single-valued input was expected"); } - if (!(*params_->inputs)[start].is_ref()) { - return errors::InvalidArgument("OpKernel used immutable input name '", name, + if (!input_is_ref(start)) { + return errors::InvalidArgument("OpKernel used non-ref input name '", name, "' when ref input was expected"); } // return a copy of the Ref acquired while holding the mutex @@ -518,7 +491,7 @@ Status OpKernelContext::replace_ref_input(StringPiece name, name, "' when single-valued input was expected"); } - if (!(*params_->inputs)[start].is_ref()) { + if (!input_is_ref(start)) { return errors::InvalidArgument("OpKernel used immutable input name '", name, "' when ref input was expected"); } diff --git a/tensorflow/core/framework/op_kernel.h b/tensorflow/core/framework/op_kernel.h index faafe86ade..b6e302c492 100644 --- a/tensorflow/core/framework/op_kernel.h +++ b/tensorflow/core/framework/op_kernel.h @@ -569,8 +569,11 @@ class OpKernelContext { int num_inputs() const { return params_->inputs->size(); } DataType input_dtype(int index) const; Status input_dtype(StringPiece name, DataType* dtype) const; + MemoryType input_memory_type(int index) const; + int num_outputs() const { return outputs_.size(); } DataType expected_output_dtype(int index) const; + MemoryType output_memory_type(int index) const; // Input @@ -669,16 +672,6 @@ class OpKernelContext { // REQUIRES: IsRefType(output_dtype(output_index)). void forward_ref_input_to_ref_output(int input_index, int output_index); - // Returns true when an alias to input[input_index] that is safe to use for - // in-place computation was written to *output. Returns false if - // input[input_index] has a refcount greater than or if its type does not - // match the expected output type of output[output_index]. - bool forward_input_to_output_with_same_shape( - int input_index, int output_index, Tensor** output) TF_MUST_USE_RESULT; - Status forward_input_to_output_with_same_shape( - StringPiece input_name, StringPiece output_name, - Tensor** output) TF_MUST_USE_RESULT; - // Returns true when an alias to input[input_index], reshaped to output_shape, // which is is safe to use for in-place computation was written to *output. // Returns false if input[input_index] has a refcount greater than one, or if @@ -693,6 +686,19 @@ class OpKernelContext { const TensorShape& output_shape, Tensor** output) TF_MUST_USE_RESULT; + // Returns a pointer to a Tensor aliasing the underlying buffer backing + // input[input_index] iff + // * input[input_index] is not a ref, + // * the data type, shape, memory type, and allocator attributes of + // input[input_index] are compatible with those given in dtype, shape, + // memory_type, and attr, + // * refcount on the underlying buffer is one. + // Otherwise returns nullptr. + std::unique_ptr forward_input( + int input_index, DataType dtype, const TensorShape& shape, + MemoryType memory_type, + const AllocatorAttributes& attr) TF_MUST_USE_RESULT; + // Tries to forward one of the inputs given in input_indices to // output[output_index]. If none of the given inputs can be forwarded, calls // allocate_output() to allocate a new output buffer. @@ -999,6 +1005,8 @@ class OpKernelContext { TensorValue release_output(int index); private: + bool input_is_ref(int index) const; + Allocator* get_allocator(AllocatorAttributes attr); // Internal method to add a tensor's buffer to the list of buffers @@ -1187,7 +1195,7 @@ Status OpKernelConstruction::GetAttr(StringPiece attr_name, T* value) const { inline DataType OpKernelContext::input_dtype(int index) const { DCHECK_GE(index, 0); - DCHECK_LT(index, params_->inputs->size()); + DCHECK_LT(index, num_inputs()); const TensorValue& value((*params_->inputs)[index]); if (value.is_ref()) { return MakeRefType(value->dtype()); @@ -1196,12 +1204,28 @@ inline DataType OpKernelContext::input_dtype(int index) const { } } +inline MemoryType OpKernelContext::input_memory_type(int index) const { + DCHECK_GE(index, 0); + DCHECK_LT(index, num_inputs()); + return op_kernel().input_memory_types()[index]; +} + inline DataType OpKernelContext::expected_output_dtype(int index) const { DCHECK_GE(index, 0); - DCHECK_LT(index, params_->op_kernel->output_types().size()); + DCHECK_LT(index, num_outputs()); return params_->op_kernel->output_type(index); } +inline MemoryType OpKernelContext::output_memory_type(int index) const { + DCHECK_GE(index, 0); + DCHECK_LT(index, num_outputs()); + return op_kernel().output_memory_types()[index]; +} + +inline bool OpKernelContext::input_is_ref(int index) const { + return IsRefType(input_dtype(index)); +} + inline void OpKernelContext::record_tensor_reference(const Tensor& tensor) { DCHECK_EQ(params_->device->RequiresRecordingAccessedTensors(), params_->record_tensor_accesses); @@ -1221,14 +1245,14 @@ inline void OpKernelContext::retrieve_accessed_tensors( // no input if tensor == nullptr. inline bool OpKernelContext::has_input(int index) const { DCHECK_GE(index, 0); - DCHECK_LT(index, params_->inputs->size()); + DCHECK_LT(index, num_inputs()); return (*params_->inputs)[index].tensor != nullptr; } inline mutex* OpKernelContext::input_ref_mutex(int index) { DCHECK_GE(index, 0); - DCHECK_LT(index, params_->inputs->size()); - DCHECK((*params_->inputs)[index].is_ref()); + DCHECK_LT(index, num_inputs()); + DCHECK(input_is_ref(index)); return (*params_->inputs)[index].mutex_if_ref; } @@ -1240,7 +1264,7 @@ inline void OpKernelContext::NotifyUseOfPersistentTensor(const Tensor& t) { inline Tensor* OpKernelContext::mutable_output(int index) { DCHECK_GE(index, 0); - DCHECK_LT(index, outputs_.size()); + DCHECK_LT(index, num_outputs()); // No need to record_tensor_reference since the output must already // have been set by a call that did so. return outputs_[index].tensor; @@ -1248,7 +1272,7 @@ inline Tensor* OpKernelContext::mutable_output(int index) { inline TensorValue OpKernelContext::release_output(int index) { DCHECK_GE(index, 0); - DCHECK_LT(index, outputs_.size()); + DCHECK_LT(index, num_outputs()); TensorValue value = outputs_[index]; outputs_[index] = TensorValue(); return value; -- GitLab From b436f4130b54f0f422774d06f9affac417b9363e Mon Sep 17 00:00:00 2001 From: Peter Hawkins Date: Mon, 27 Feb 2017 13:02:11 -0800 Subject: [PATCH 019/101] [TF:XLA] Improvements to resource variables: * enable compilation of VarIsInitializedOp. * fix deprecated variable initializer in variable_ops_test.py * simplify variable logic in XlaContext, move intelligence into XlaOpKernelContext. * add resource variable support in the contrib layers library. Cleanups and refactorings: * merge XlaCompiler::CompileSubComputation with XlaCompiler::CompileFunction. * pass XlaCompiler arguments consistently via XlaCompiler::Options. * split the two roles of XlaCompiler::CompilationResult::input_shapes into input_mapping and xla_input_shapes. * initialize the numpy and Python seeds to a constant for XLA test cases. Change: 148683645 --- tensorflow/compiler/aot/compile.cc | 3 +- .../jit/kernels/xla_device_launch_op.cc | 31 +-- .../jit/kernels/xla_device_launch_op.h | 9 + .../jit/kernels/xla_local_launch_op.cc | 4 +- .../compiler/jit/xla_compilation_cache.cc | 1 + .../compiler/jit/xla_compilation_cache.h | 1 + tensorflow/compiler/jit/xla_device_ops.h | 7 +- .../compiler/tests/variable_ops_test.py | 4 +- tensorflow/compiler/tests/xla_test.py | 7 + .../compiler/tf2xla/kernels/retval_op.cc | 2 +- .../compiler/tf2xla/kernels/variable_ops.cc | 11 + .../compiler/tf2xla/op_registrations.cc | 2 + tensorflow/compiler/tf2xla/xla_compiler.cc | 222 +++++++----------- tensorflow/compiler/tf2xla/xla_compiler.h | 145 +++++++----- .../compiler/tf2xla/xla_compiler_test.cc | 13 +- tensorflow/compiler/tf2xla/xla_context.cc | 30 +-- tensorflow/compiler/tf2xla/xla_context.h | 29 +-- tensorflow/compiler/tf2xla/xla_op_kernel.cc | 58 ++++- tensorflow/compiler/tf2xla/xla_op_kernel.h | 8 + .../contrib/framework/python/ops/variables.py | 12 +- .../contrib/layers/python/layers/layers.py | 5 +- tensorflow/python/framework/function_test.py | 4 +- tensorflow/python/ops/variable_scope.py | 2 +- 23 files changed, 324 insertions(+), 286 deletions(-) diff --git a/tensorflow/compiler/aot/compile.cc b/tensorflow/compiler/aot/compile.cc index 6b2cf451f5..1284155c07 100644 --- a/tensorflow/compiler/aot/compile.cc +++ b/tensorflow/compiler/aot/compile.cc @@ -298,8 +298,7 @@ Status ConvertGraphToXla(xla::LocalClient* client, std::unique_ptr graph, graph->versions().producer(), flib_def, OptimizerOptions())); XlaCompiler::CompilationResult result; TF_RETURN_IF_ERROR(compiler.CompileGraph("tfcompile", std::move(graph), - flib_run.get(), xla_args, - false /* use_tuple_arg */, &result)); + flib_run.get(), xla_args, &result)); *has_context_arg = result.requires_runtime_context; *computation = std::move(result.computation); diff --git a/tensorflow/compiler/jit/kernels/xla_device_launch_op.cc b/tensorflow/compiler/jit/kernels/xla_device_launch_op.cc index a70a7921e6..c741ccfb31 100644 --- a/tensorflow/compiler/jit/kernels/xla_device_launch_op.cc +++ b/tensorflow/compiler/jit/kernels/xla_device_launch_op.cc @@ -16,7 +16,6 @@ limitations under the License. #include "tensorflow/compiler/jit/kernels/xla_device_launch_op.h" #include "tensorflow/compiler/jit/defs.h" -#include "tensorflow/compiler/jit/xla_compilation_cache.h" #include "tensorflow/compiler/jit/xla_device.h" #include "tensorflow/compiler/jit/xla_device_context.h" #include "tensorflow/compiler/xla/client/local_client.h" @@ -67,20 +66,16 @@ XlaDeviceLaunchOp::XlaDeviceLaunchOp(OpKernelConstruction* ctx) OP_REQUIRES_OK(ctx, ctx->GetAttr("Nresources", &num_resource_args_)); } -// Takes a snapshot of the values of resource variable arguments, which are -// the last `num_variables` arguments. We snapshot tensors that back -// resource variables since concurrent updates may modify the shape, and it is -// important that the shapes used for compilation match the true shapes of the -// buffers. -static std::vector SnapshotResourceVariables( - OpKernelContext* ctx, int num_variables) { +std::vector SnapshotResourceVariables(OpKernelContext* ctx, + int num_variables) { std::vector snapshot(num_variables); int first_variable = ctx->num_inputs() - num_variables; for (int i = 0; i < num_variables; ++i) { Var* variable = nullptr; - if (LookupResource(ctx, HandleFromInput(ctx, first_variable + i), &variable) - .ok()) { + ResourceHandle handle = HandleFromInput(ctx, first_variable + i); + if (LookupResource(ctx, handle, &variable).ok()) { mutex_lock lock(*variable->mu()); + snapshot[i].name = handle.name(); snapshot[i].present = true; snapshot[i].value = *variable->tensor(); } @@ -127,13 +122,13 @@ void XlaDeviceLaunchOp::Compute(OpKernelContext* ctx) { // Builds the inputs to the computation. std::vector> arg_handles( - kernel->xla_input_shapes.size()); - std::vector arg_ptrs(kernel->xla_input_shapes.size()); + kernel->input_mapping.size()); + std::vector arg_ptrs(kernel->input_mapping.size()); // Adds the argument tensors. const int first_variable_arg = ctx->num_inputs() - num_resource_args_; - for (int i = 0; i < kernel->xla_input_shapes.size(); ++i) { - int op_input_num = kernel->xla_input_shapes[i].first; + for (int i = 0; i < kernel->input_mapping.size(); ++i) { + int op_input_num = kernel->input_mapping[i]; if (op_input_num >= first_variable_arg) { arg_handles[i] = XlaTransferManager::GetTensorGlobalData( @@ -201,10 +196,10 @@ void XlaDeviceLaunchOp::Compute(OpKernelContext* ctx) { } } - // Apply variable writes, if any. - VLOG(2) << "Applying variable writes"; - for (int i = 0; i < kernel->variable_writes.size(); ++i) { - const XlaCompiler::VariableWrite& write = kernel->variable_writes[i]; + // Apply variable updates, if any. + VLOG(2) << "Applying variable updates"; + for (int i = 0; i < kernel->variable_updates.size(); ++i) { + const XlaCompiler::VariableUpdate& write = kernel->variable_updates[i]; OP_REQUIRES(ctx, write.input_index >= 0 && write.input_index < ctx->num_inputs(), errors::Internal("Invalid input index for variable write.")); diff --git a/tensorflow/compiler/jit/kernels/xla_device_launch_op.h b/tensorflow/compiler/jit/kernels/xla_device_launch_op.h index c77d5323b5..65516163c9 100644 --- a/tensorflow/compiler/jit/kernels/xla_device_launch_op.h +++ b/tensorflow/compiler/jit/kernels/xla_device_launch_op.h @@ -16,6 +16,7 @@ limitations under the License. #ifndef TENSORFLOW_COMPILER_JIT_KERNELS_XLA_DEVICE_LAUNCH_OP_H_ #define TENSORFLOW_COMPILER_JIT_KERNELS_XLA_DEVICE_LAUNCH_OP_H_ +#include "tensorflow/compiler/jit/xla_compilation_cache.h" #include "tensorflow/core/framework/allocator.h" #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/op_kernel.h" @@ -24,6 +25,14 @@ limitations under the License. namespace tensorflow { +// Takes a snapshot of the values of resource variable arguments, which are +// the last `num_variables` arguments. We snapshot tensors that back +// resource variables since concurrent updates may modify the shape, and it is +// important that the shapes used for compilation match the true shapes of the +// buffers. +std::vector SnapshotResourceVariables(OpKernelContext* ctx, + int num_variables); + // The XlaDeviceLaunchOp is used to replace a region of the TensorFlow graph // which will be compiled and executed using XLA. The XlaDeviceLaunchOp is // responsible for handling interactions with the TensorFlow executor. diff --git a/tensorflow/compiler/jit/kernels/xla_local_launch_op.cc b/tensorflow/compiler/jit/kernels/xla_local_launch_op.cc index e056442975..5bcb6b0b60 100644 --- a/tensorflow/compiler/jit/kernels/xla_local_launch_op.cc +++ b/tensorflow/compiler/jit/kernels/xla_local_launch_op.cc @@ -219,8 +219,8 @@ void XlaLocalLaunchOp::Compute(OpKernelContext* ctx) { // Pass remaining parameters. for (int i = 0; i < kernel->xla_input_shapes.size(); ++i) { - int arg_num = kernel->xla_input_shapes[i].first; - const xla::Shape& shape = kernel->xla_input_shapes[i].second; + int arg_num = kernel->input_mapping[i]; + const xla::Shape& shape = kernel->xla_input_shapes[i]; gpu::DeviceMemoryBase dmem( const_cast(ctx->input(arg_num).tensor_data().data()), ctx->input(arg_num).tensor_data().size()); diff --git a/tensorflow/compiler/jit/xla_compilation_cache.cc b/tensorflow/compiler/jit/xla_compilation_cache.cc index 32e706c50f..41abea02eb 100644 --- a/tensorflow/compiler/jit/xla_compilation_cache.cc +++ b/tensorflow/compiler/jit/xla_compilation_cache.cc @@ -181,6 +181,7 @@ Status BuildArguments(int num_constant_args, XlaCompiler::Argument& arg = (*args)[input_num]; + arg.name = variable_args[variable_id].name; if (variable_args[variable_id].present) { const Tensor& value = variable_args[variable_id].value; arg.kind = XlaCompiler::Argument::kVariable; diff --git a/tensorflow/compiler/jit/xla_compilation_cache.h b/tensorflow/compiler/jit/xla_compilation_cache.h index 2f311b961c..ff67e48d1a 100644 --- a/tensorflow/compiler/jit/xla_compilation_cache.h +++ b/tensorflow/compiler/jit/xla_compilation_cache.h @@ -31,6 +31,7 @@ namespace tensorflow { // Struct that represents a possibly-absent Tensor. struct OptionalTensor { + string name; // A descriptive name bool present = false; // Is the tensor present? Tensor value; // If present, what is the Tensor's value? }; diff --git a/tensorflow/compiler/jit/xla_device_ops.h b/tensorflow/compiler/jit/xla_device_ops.h index 7a0a212f5a..b084dcaa7d 100644 --- a/tensorflow/compiler/jit/xla_device_ops.h +++ b/tensorflow/compiler/jit/xla_device_ops.h @@ -112,12 +112,7 @@ class XlaDeviceDummyOp : public OpKernel { \ REGISTER_KERNEL_BUILDER( \ Name("VarHandleOp").Device(DEVICE).HostMemory("resource"), \ - ResourceHandleOp); \ - REGISTER_KERNEL_BUILDER(Name("VarIsInitializedOp") \ - .Device(DEVICE) \ - .HostMemory("resource") \ - .HostMemory("is_initialized"), \ - IsResourceInitialized); + ResourceHandleOp); // TODO(b/32507444): the registrations for the control flow operators are // temporary and exist primarily to work around a bug in the graph partitioning diff --git a/tensorflow/compiler/tests/variable_ops_test.py b/tensorflow/compiler/tests/variable_ops_test.py index f68e1f9fbc..dcb9e2db2f 100644 --- a/tensorflow/compiler/tests/variable_ops_test.py +++ b/tensorflow/compiler/tests/variable_ops_test.py @@ -56,7 +56,7 @@ class VariableOpsTest(XLATestCase): with ops.control_dependencies([d]): e = x.read_value() - session.run(variables.initialize_all_variables()) + session.run(variables.global_variables_initializer()) v1, v2, v3 = session.run([a, c, e]) self.assertAllClose(2.0, v1) self.assertAllClose(47.0, v2) @@ -86,7 +86,7 @@ class VariableOpsTest(XLATestCase): optimizer = GradientDescentOptimizer(0.1) train = optimizer.minimize(loss) - session.run(variables.initialize_all_variables()) + session.run(variables.global_variables_initializer()) session.run(train, {x: np.array([[7, 3, 5, 9]], dtype=np.float32)}) vw, vb = session.run([w, b]) self.assertAllClose( diff --git a/tensorflow/compiler/tests/xla_test.py b/tensorflow/compiler/tests/xla_test.py index b72e7c9713..dfb4904338 100644 --- a/tensorflow/compiler/tests/xla_test.py +++ b/tensorflow/compiler/tests/xla_test.py @@ -19,14 +19,18 @@ from __future__ import division from __future__ import print_function import contextlib +import random import re +import numpy as np + from tensorflow.contrib.compiler import jit from tensorflow.core.framework import types_pb2 from tensorflow.core.protobuf import config_pb2 from tensorflow.python.client import session from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops +from tensorflow.python.framework import random_seed from tensorflow.python.ops import array_ops from tensorflow.python.ops import variables from tensorflow.python.platform import flags @@ -81,6 +85,9 @@ class XLATestCase(test.TestCase): return logging.info('Start test case: %s', name) + random.seed(random_seed.DEFAULT_GRAPH_SEED) + np.random.seed(random_seed.DEFAULT_GRAPH_SEED) + def tearDown(self): logging.info('End test case: %s', self._testMethodName) diff --git a/tensorflow/compiler/tf2xla/kernels/retval_op.cc b/tensorflow/compiler/tf2xla/kernels/retval_op.cc index 72ab1249f9..ae9cecc10b 100644 --- a/tensorflow/compiler/tf2xla/kernels/retval_op.cc +++ b/tensorflow/compiler/tf2xla/kernels/retval_op.cc @@ -60,7 +60,7 @@ class RetvalOp : public XlaOpKernel { OP_REQUIRES_OK(ctx, ctx->ConstantInput(0, &literal)); OP_REQUIRES_OK(ctx, tc.AddConstRetval(index_, dtype_, literal)); } else { - tc.AddRetval(index_, input); + tc.AddRetval(index_, dtype_, input); } } } diff --git a/tensorflow/compiler/tf2xla/kernels/variable_ops.cc b/tensorflow/compiler/tf2xla/kernels/variable_ops.cc index ee984cd119..f7326b0edd 100644 --- a/tensorflow/compiler/tf2xla/kernels/variable_ops.cc +++ b/tensorflow/compiler/tf2xla/kernels/variable_ops.cc @@ -25,6 +25,17 @@ limitations under the License. namespace tensorflow { namespace { +class VarIsInitializedOp : public XlaOpKernel { + public: + explicit VarIsInitializedOp(OpKernelConstruction* ctx) : XlaOpKernel(ctx) {} + void Compile(XlaOpKernelContext* ctx) override { + xla::ComputationDataHandle handle; + bool initialized = ctx->ReadVariableInput(0, &handle).ok(); + ctx->SetOutput(0, ctx->builder()->ConstantR0(initialized)); + } +}; +REGISTER_XLA_OP("VarIsInitializedOp", VarIsInitializedOp); + class ReadVariableOp : public XlaOpKernel { public: explicit ReadVariableOp(OpKernelConstruction* ctx) : XlaOpKernel(ctx) {} diff --git a/tensorflow/compiler/tf2xla/op_registrations.cc b/tensorflow/compiler/tf2xla/op_registrations.cc index 7f779a28e4..171e96d3b6 100644 --- a/tensorflow/compiler/tf2xla/op_registrations.cc +++ b/tensorflow/compiler/tf2xla/op_registrations.cc @@ -276,6 +276,7 @@ REGISTER_XLA_KERNEL(DEVICE_CPU_XLA_JIT, Name("TruncateMod").TypeConstraint("T", kCpuNumericTypes)); REGISTER_XLA_KERNEL(DEVICE_CPU_XLA_JIT, Name("Unpack").TypeConstraint("T", kCpuAllTypes)); +REGISTER_XLA_KERNEL(DEVICE_CPU_XLA_JIT, Name("VarIsInitializedOp")); REGISTER_XLA_KERNEL(DEVICE_CPU_XLA_JIT, Name("ZerosLike").TypeConstraint("T", kCpuNumericTypes)); @@ -536,6 +537,7 @@ REGISTER_XLA_KERNEL(DEVICE_GPU_XLA_JIT, Name("TruncateMod").TypeConstraint("T", kGpuNumericTypes)); REGISTER_XLA_KERNEL(DEVICE_GPU_XLA_JIT, Name("Unpack").TypeConstraint("T", kGpuAllTypes)); +REGISTER_XLA_KERNEL(DEVICE_GPU_XLA_JIT, Name("VarIsInitializedOp")); REGISTER_XLA_KERNEL(DEVICE_GPU_XLA_JIT, Name("ZerosLike").TypeConstraint("T", kGpuNumericTypes)); diff --git a/tensorflow/compiler/tf2xla/xla_compiler.cc b/tensorflow/compiler/tf2xla/xla_compiler.cc index aea50bb5cd..efc8dfce93 100644 --- a/tensorflow/compiler/tf2xla/xla_compiler.cc +++ b/tensorflow/compiler/tf2xla/xla_compiler.cc @@ -27,6 +27,7 @@ limitations under the License. #include "tensorflow/core/common_runtime/function.h" #include "tensorflow/core/common_runtime/graph_optimizer.h" #include "tensorflow/core/framework/attr_value_util.h" +#include "tensorflow/core/graph/algorithm.h" #include "tensorflow/core/graph/graph_constructor.h" #include "tensorflow/core/graph/node_builder.h" #include "tensorflow/core/lib/hash/hash.h" @@ -37,36 +38,18 @@ namespace tensorflow { namespace { -Status CheckSignature(const DataTypeVector& tf_types, - const xla::Shape& xla_shape) { - if (xla::ShapeUtil::IsTuple(xla_shape)) { - if (xla::ShapeUtil::TupleElementCount(xla_shape) != tf_types.size()) { - return errors::Internal("XLA shape has ", - xla::ShapeUtil::TupleElementCount(xla_shape), - " elements while function has ", tf_types.size()); - } - for (int i = 0; i < tf_types.size(); ++i) { - xla::PrimitiveType type; - TF_RETURN_IF_ERROR(DataTypeToPrimitiveType(tf_types[i], &type)); - if (type != - xla::ShapeUtil::GetTupleElementShape(xla_shape, i).element_type()) { - return errors::Internal( - "element ", i, " has XLA type ", - xla::ShapeUtil::GetTupleElementShape(xla_shape, i).element_type(), - " and TensorFlow type ", DataTypeString(tf_types[i])); - } - } - } else { - if (tf_types.size() != 1) { - return errors::Internal("Expected singleton type, got ", tf_types.size(), - " types"); - } - xla::PrimitiveType type; - TF_RETURN_IF_ERROR(DataTypeToPrimitiveType(tf_types[0], &type)); - if (type != xla_shape.element_type()) { - return errors::Internal("singleton element has XLA type ", - xla_shape.element_type(), " and TensorFlow type ", - DataTypeString(tf_types[0])); +// Checks that arguments `args` match types `types`. +Status CheckSignature(const DataTypeVector& types, + const std::vector& args) { + if (args.size() != types.size()) { + return errors::Internal("Compilation arguments have ", args.size(), + " elements while function has ", types.size()); + } + for (int i = 0; i < types.size(); ++i) { + if (types[i] != args[i].type && types[i] != DT_RESOURCE) { + return errors::Internal( + "Argument ", i, " has declared type ", DataTypeString(args[i].type), + " but function parameter has type ", DataTypeString(types[i])); } } return Status::OK(); @@ -74,14 +57,10 @@ Status CheckSignature(const DataTypeVector& tf_types, } // namespace -XlaCompiler::XlaCompiler(const XlaCompiler::Options& options) - : client_(options.client), - allow_cpu_custom_calls_(options.allow_cpu_custom_calls), - local_executable_has_hybrid_result_( - options.local_executable_has_hybrid_result), - resolve_compile_time_constants_(options.resolve_compile_time_constants), +XlaCompiler::XlaCompiler(XlaCompiler::Options options) + : options_(std::move(options)), next_step_id_(1), - device_(new XlaCompilationDevice(SessionOptions(), options.device_type)), + device_(new XlaCompilationDevice(SessionOptions(), options_.device_type)), device_mgr_({device_}) {} XlaCompiler::~XlaCompiler() = default; @@ -91,6 +70,19 @@ int64 XlaCompiler::NextStepId() { return next_step_id_++; } +// Prunes any nodes from a function that are not dependencies of the _Retval +// nodes. Used to prune stateful ops from within a function body, such as +// variable initializers, that should not be executed unless requested. +static void PruneUnreachableNodes(Graph* graph) { + std::unordered_set nodes; + for (Node* node : graph->nodes()) { + if (node->type_string() == "_Retval") { + nodes.insert(node); + } + } + PruneForReverseReachability(graph, nodes); +} + Status XlaCompiler::CompileFunction( FunctionLibraryRuntime* flr, const NameAttrList& function, const std::vector& args, @@ -105,69 +97,14 @@ Status XlaCompiler::CompileFunction( const FunctionBody* fbody = flr->GetFunctionBody(handle); CHECK(fbody); - return CompileFunctionBody(flr, *fbody, function_id, args, - /*use_tuple_arg=*/false, result); -} - -Status XlaCompiler::CompileSubComputation(FunctionLibraryRuntime* flr, - const NameAttrList& function, - const xla::Shape& input_shape, - const xla::Shape& output_shape, - xla::Computation* computation) { - const string function_id = Canonicalize(function.name(), function.attr()); - VLOG(1) << "XlaCompiler::CompileSubComputation " << function_id; - - FunctionLibraryRuntime::Handle handle; - TF_RETURN_IF_ERROR( - flr->Instantiate(function.name(), function.attr(), &handle)); - - const FunctionBody* fbody = flr->GetFunctionBody(handle); - CHECK(fbody); - - TF_RETURN_IF_ERROR(CheckSignature(fbody->arg_types, input_shape)); - TF_RETURN_IF_ERROR(CheckSignature(fbody->ret_types, output_shape)); - - const bool use_tuple_arg = xla::ShapeUtil::IsTuple(input_shape); - - std::vector args(fbody->arg_types.size()); - if (use_tuple_arg) { - for (int i = 0; i < args.size(); ++i) { - xla::Shape xla_shape = - xla::ShapeUtil::GetTupleElementShape(input_shape, i); - args[i].kind = Argument::kParameter; - args[i].type = fbody->arg_types[i]; - args[i].shape = XLAShapeToTensorShape(xla_shape); - } - } else { - args[0].kind = Argument::kParameter; - args[0].type = fbody->arg_types[0]; - args[0].shape = XLAShapeToTensorShape(input_shape); - } - - CompilationResult result; - TF_RETURN_IF_ERROR(CompileFunctionBody(flr, *fbody, function_id, args, - use_tuple_arg, &result)); - - if (!xla::ShapeUtil::Compatible(result.xla_output_shape, output_shape)) { - return errors::Internal("output shape mismatch from compilation"); - } - *computation = std::move(result.computation); - - return Status::OK(); -} - -Status XlaCompiler::CompileFunctionBody( - FunctionLibraryRuntime* flr, const FunctionBody& fbody, - const string& function_id, const std::vector& args, - bool use_tuple_arg, XlaCompiler::CompilationResult* result) { - VLOG(1) << "XlaCompiler::CompileFunctionBody " << function_id; + TF_RETURN_IF_ERROR(CheckSignature(fbody->arg_types, args)); std::unique_ptr graph(new Graph(flr->GetFunctionLibraryDefinition())); - CopyGraph(*fbody.graph, graph.get()); + CopyGraph(*fbody->graph, graph.get()); if (VLOG_IS_ON(1)) { dump_graph::DumpGraphToFile( - strings::StrCat("xla_jit_raw_input_", function_id), *graph); + strings::StrCat("xla_compile_function_input_", function_id), *graph); } // Optimize the graph before running the compiler. @@ -179,12 +116,13 @@ Status XlaCompiler::CompileFunctionBody( if (VLOG_IS_ON(1)) { dump_graph::DumpGraphToFile( - strings::StrCat("xla_jit_final_graph_", function_id), *graph); + strings::StrCat("xla_compile_function_optimized_", function_id), + *graph); } VLOG(1) << "===================================================="; - TF_RETURN_IF_ERROR(CompileGraph(function_id, std::move(graph), flr, args, - use_tuple_arg, result)); + TF_RETURN_IF_ERROR( + CompileGraph(function_id, std::move(graph), flr, args, result)); VLOG(1) << "===================================================="; return Status::OK(); @@ -199,7 +137,7 @@ Status XlaCompiler::BuildExecutable( std::vector argument_layouts( result.xla_input_shapes.size()); for (int i = 0; i < result.xla_input_shapes.size(); ++i) { - argument_layouts[i] = &result.xla_input_shapes[i].second; + argument_layouts[i] = &result.xla_input_shapes[i]; } if (result.requires_runtime_context) { // The final arg is the XlaLocalRuntimeContext*. @@ -210,7 +148,8 @@ Status XlaCompiler::BuildExecutable( build_options.set_device_ordinal(local_client->default_device_ordinal()); build_options.set_platform(local_client->platform()); build_options.set_result_layout(result.xla_output_shape); - build_options.set_has_hybrid_result(local_executable_has_hybrid_result_); + build_options.set_has_hybrid_result( + options_.local_executable_has_hybrid_result); auto compile_result = local_client->Compile(result.computation, argument_layouts, build_options); @@ -272,13 +211,12 @@ Status ExecuteGraph(XlaContext* xla_context, std::unique_ptr graph, } // Builds XLA computations for each of the arguments to the computation. -// `args` are the arguments to the computation. If `use_tuple_arg` is true, a -// single tuple parameter will be used for all arguments; if false, each -// argument gets its own parameter. +// `args` are the arguments to the computation. Status BuildArguments(const std::vector& args, bool use_tuple_arg, xla::ComputationBuilder* builder, std::vector* context_args, - std::vector>* input_shapes) { + std::vector* input_mapping, + std::vector* input_shapes) { context_args->resize(args.size()); // Argument numbers of arguments and variables that are to be passed to the @@ -322,31 +260,30 @@ Status BuildArguments(const std::vector& args, return Status::OK(); } - std::vector parameter_shapes(parameters.size()); input_shapes->resize(parameters.size()); - for (int i = 0; i < parameters.size(); ++i) { + input_mapping->resize(parameters.size()); + for (int i = 0; i < input_shapes->size(); ++i) { const XlaCompiler::Argument& arg = args[parameters[i]]; // Computes the shapes of non-constant arguments. xla::PrimitiveType type; TF_RETURN_IF_ERROR(DataTypeToPrimitiveType(arg.type, &type)); xla::ShapeUtil::PopulateShape(type, arg.shape.dim_sizes(), - ¶meter_shapes[i]); - (*input_shapes)[i].first = parameters[i]; - (*input_shapes)[i].second = parameter_shapes[i]; + &(*input_shapes)[i]); + (*input_mapping)[i] = parameters[i]; } if (use_tuple_arg) { - xla::Shape tuple_shape = xla::ShapeUtil::MakeTupleShape(parameter_shapes); + xla::Shape tuple_shape = xla::ShapeUtil::MakeTupleShape(*input_shapes); xla::ComputationDataHandle tuple = builder->Parameter(0, tuple_shape, "arg_tuple"); - for (int i = 0; i < parameters.size(); ++i) { + for (int i = 0; i < input_shapes->size(); ++i) { (*context_args)[parameters[i]].value.handle = builder->GetTupleElement(tuple, i); } } else { - for (int i = 0; i < parameters.size(); ++i) { + for (int i = 0; i < input_shapes->size(); ++i) { (*context_args)[parameters[i]].value.handle = - builder->Parameter(i, parameter_shapes[i], strings::StrCat("arg", i)); + builder->Parameter(i, (*input_shapes)[i], strings::StrCat("arg", i)); } } return Status::OK(); @@ -359,19 +296,22 @@ Status BuildArguments(const std::vector& args, // variable states, generated by the symbolic evaluation. // If `has_side_effects` is true, the computation has side effects and should be // built even if it has no outputs. +// If `return_updated_values_for_all_variables` is true, all variables will be +// included in `variable_updates`, regardless of whether their value changed. // Sets `*num_nonconst_outputs` to the number of outputs of the `computation`. -// Sets `*variable_writes` to a description of variables whose values are +// Sets `*variable_updates` to a description of variables whose values are // written by the computation; the variable writes are the last -// `variable_writes.size()` return values from the computation. Each entry in -// `variable_writes` is a (input_index, type) pair, where `input_index` is the +// `variable_updates.size()` return values from the computation. Each entry in +// `variable_updates` is a (input_index, type) pair, where `input_index` is the // index of a resource variable argument to the computation, and `type` is the // type of the final output. Status BuildComputation( const std::vector& retvals, const std::unordered_map& variable_map, - bool has_side_effects, xla::ComputationBuilder* builder, - xla::Computation* computation, int* num_nonconst_outputs, - std::vector>* variable_writes) { + bool has_side_effects, bool return_updated_values_for_all_variables, + xla::ComputationBuilder* builder, xla::Computation* computation, + int* num_nonconst_outputs, + std::vector* variable_updates) { std::vector elems; elems.reserve(retvals.size()); for (const XlaContext::HandleOrConstant& retval : retvals) { @@ -394,8 +334,14 @@ Status BuildComputation( }); for (const auto& entry : variables) { - if (entry.second->value.handle() != entry.second->initial_value.handle()) { - variable_writes->emplace_back(entry.first, entry.second->type); + bool modified = + entry.second->value.handle() != entry.second->initial_value.handle(); + if (return_updated_values_for_all_variables || modified) { + variable_updates->emplace_back(); + XlaCompiler::VariableUpdate& update = variable_updates->back(); + update.input_index = entry.first; + update.type = entry.second->type; + update.modified = modified; elems.push_back(entry.second->value); } } @@ -428,34 +374,41 @@ Status XlaCompiler::CompileGraph(string const& name, std::unique_ptr graph, FunctionLibraryRuntime* flib, const std::vector& args, - bool use_tuple_arg, CompilationResult* result) { VLOG(1) << "Executing graph symbolically to populate ComputationBuilder."; xla::ComputationBuilder builder(client(), name); - XlaContext* context = new XlaContext(this, &builder, allow_cpu_custom_calls_, - resolve_compile_time_constants_); + XlaContext* context = + new XlaContext(this, &builder, options_.allow_cpu_custom_calls, + options_.resolve_compile_time_constants); core::ScopedUnref context_unref(context); + result->tuple_arg = options_.use_tuple_arg; + std::vector context_args; - TF_RETURN_IF_ERROR(BuildArguments(args, use_tuple_arg, &builder, - &context_args, &result->xla_input_shapes)); + TF_RETURN_IF_ERROR(BuildArguments(args, options_.use_tuple_arg, &builder, + &context_args, &result->input_mapping, + &result->xla_input_shapes)); context->set_args(std::move(context_args)); + if (options_.prune_unreachable_nodes) { + PruneUnreachableNodes(graph.get()); + } + TF_RETURN_IF_ERROR( ExecuteGraph(context, std::move(graph), device_, flib, NextStepId())); int num_nonconst_outputs; - std::vector> variable_writes; TF_RETURN_IF_ERROR(BuildComputation( context->retvals(), context->variables(), context->has_side_effects(), - &builder, &result->computation, &num_nonconst_outputs, &variable_writes)); + options_.return_updated_values_for_all_variables, &builder, + &result->computation, &num_nonconst_outputs, &result->variable_updates)); result->requires_runtime_context = context->has_context_parameter(); // Tuple arguments and runtime context parameters are incompatible. - CHECK(!(use_tuple_arg && result->requires_runtime_context)); + CHECK(!(options_.use_tuple_arg && result->requires_runtime_context)); VLOG(2) << "Outputs: total: " << context->retvals().size() << " nonconstant: " << num_nonconst_outputs; @@ -521,17 +474,14 @@ Status XlaCompiler::CompileGraph(string const& name, } } - result->variable_writes.resize(variable_writes.size()); - for (int i = 0; i < variable_writes.size(); ++i) { - result->variable_writes[i].input_index = variable_writes[i].first; - result->variable_writes[i].type = variable_writes[i].second; + for (int i = 0; i < result->variable_updates.size(); ++i) { if (num_computation_outputs > 1) { - result->variable_writes[i].shape = + result->variable_updates[i].shape = XLAShapeToTensorShape(xla::ShapeUtil::GetTupleElementShape( result->xla_output_shape, computation_output)); } else { CHECK_EQ(0, computation_output); - result->variable_writes[i].shape = + result->variable_updates[i].shape = XLAShapeToTensorShape(result->xla_output_shape); } ++computation_output; @@ -544,7 +494,7 @@ Status XlaCompiler::GetChannelHandle(const string& key, mutex_lock lock(mu_); auto result = channels_.emplace(key, xla::ChannelHandle()); if (result.second) { - TF_ASSIGN_OR_RETURN(result.first->second, client_->CreateChannelHandle()); + TF_ASSIGN_OR_RETURN(result.first->second, client()->CreateChannelHandle()); } *channel = result.first->second; VLOG(1) << "Channel: " << key << " " << channel->DebugString(); diff --git a/tensorflow/compiler/tf2xla/xla_compiler.h b/tensorflow/compiler/tf2xla/xla_compiler.h index 477802c6a7..3ed920521b 100644 --- a/tensorflow/compiler/tf2xla/xla_compiler.h +++ b/tensorflow/compiler/tf2xla/xla_compiler.h @@ -34,15 +34,48 @@ namespace tensorflow { // It does a symbolic execution of the graph starting from specific input // shapes, using a JIT device to convert operators into XLA computations. // -// It is typically invoked from an `_XlaLaunch` operator once the shapes -// of all input parameters to the computation are known. This is +// XlaCompiler is typically invoked from an `_XlaLaunch` operator once the +// shapes of all input parameters to the computation are known. This is // because the symbolic execution requires known shapes for all operations. +// +// XlaCompiler compiles Tensorflow graphs that received inputs via _Arg nodes, +// and return outputs via _Retval nodes. +// +// The XlaCompiler requires one Argument struct for each _Arg index, that +// describes each argument. Arguments can be compile-time constants +// (kind kConstant), run-time parameters (kind kParameter), or resource +// variables (kinds kVariable and kUninitializedVariable). +// +// Only kParameter and kVariable arguments become runtime parameters to the +// generated XLA computation. The XLA computation will have run-time parameters +// in the following order: +// +---------------------+-----------------------------------------+ +// | kParameter values | Initial values of kVariable arguments | +// +---------------------+-----------------------------------------+ +// Within each block, the arguments are arranged by the _Arg index from which +// they were derived. +// If `Options::requires_runtime_context` is true, then an additional runtime +// context argument is passed as a final argument. +// +// The run-time outputs of the XLA computation are arranged in the following +// order: +// +------------------+-----------------------------------------+ +// | _Retval values | Updated values of kVariable arguments | +// +------------------+-----------------------------------------+ +// _Retval values are ordered by _Retval index, whereas kVariable values are +// ordered by the original _Arg position of the variable. +// +// In both inputs and outputs, kVariable values are placed the end. When +// emitting While loop bodies, we must ensure that the loop body has +// identical input and output signatures. By moving variable values +// to the end of the argument list and using the +// `return_updated_values_for_all_variables` option, we can ensure that the +// input and output values of variables appear at the same positions. + class XlaCompiler { public: // Describes how to derive the value of each _Arg node in the graph/function - // being compiled. Each argument must be either a parameter of the generated - // XLA computation (parameter >= 0), or a compile time constant - // (parameter < 0). + // being compiled. There must be one Argument for each _Arg index. struct Argument { enum Kind { // Default value; not a valid kind. @@ -82,7 +115,8 @@ class XlaCompiler { }; struct OutputDescription { - // Shape of the output. + // Type and shape of the output. + DataType type; TensorShape shape; // Constant output value, if known to be constant at JIT compilation time. @@ -92,28 +126,38 @@ class XlaCompiler { }; // Describes a variable write side effect of the computation. - struct VariableWrite { + struct VariableUpdate { // Index of the input that contains the variable resource to write to. int input_index; // Type and shape of the tensor to be written back. DataType type; TensorShape shape; + + // Was the value of the variable modified by the computation? + // (Always true, unless `return_updated_values_for_all_variables` is true.) + bool modified; }; struct CompilationResult { - // Vector of (Tensorflow input number, XLA shape) pairs that describe - // the arguments of the compiled XLA computation. (Because of constant - // inputs, the arguments to the XLA computation are a subset of the - // inputs passed to the JIT.) - std::vector> xla_input_shapes; + // Vector that maps from the parameters of the XLA computation to their + // original argument positions. To handle compile-time constant inputs and + // variables, the parameters to the XLA computation may be a subset of the + // original arguments, and are not necessarily in the same order.) + std::vector input_mapping; // Does the computation require the local runtime context to be passed as // the last argument? bool requires_runtime_context = false; - // Output shape in XLA format. This is a tuple if and only if - // there are multiple non-constant outputs. + // Input shapes of the computation. + std::vector xla_input_shapes; + + // Should the arguments be packed into a single tuple? + bool tuple_arg; + + // Output shape in XLA format. The output shape is a tuple if and only if + // the number of non-constant outputs is not equal to 1. xla::Shape xla_output_shape; // TensorFlow shapes of outputs, together with the values of any @@ -121,10 +165,10 @@ class XlaCompiler { // containing both constant and non-constant results. std::vector outputs; - // Variables whose values should be written by the computation back, ordered - // by return value position. Variable write results follow the non-constant + // Variables whose values were updated by the computation, ordered + // by return value position. Variable updates follow the non-constant // results in the outputs of XLA computation. - std::vector variable_writes; + std::vector variable_updates; // The XLA computation built from the tensorflow subgraph. May be null // if the output consists solely of compile-time constants. @@ -153,21 +197,38 @@ class XlaCompiler { // as Tensors at compile-time, rather than as run-time outputs of the // computation. bool resolve_compile_time_constants = true; + + // If `use_tuple_arg` is true, a single tuple parameter will be used for all + // arguments; if false, each argument gets its own parameter. + bool use_tuple_arg = false; + + // If 'return_updated_values_for_all_variables' is true, then updated + // values of all resource variables arguments will be included in the + // 'variable_updates' of the computation, even if the variable was not + // modified by the computation. Used when compiling loop bodies to ensure + // the input and output signatures match. + bool return_updated_values_for_all_variables = false; + + // If 'prune_unreachable_nodes' is true, then nodes that are not + // dependencies of graph's _Retval nodes will be pruned before compilation. + // This is useful to prune stateful operators that should not be executed + // from a function body. + bool prune_unreachable_nodes = false; }; - explicit XlaCompiler(const Options& options); + explicit XlaCompiler(Options options); ~XlaCompiler(); // Compiles a Tensorflow function `fn_name_attrs` into an XLA computation. // `args` describes the arguments to the function, each of which must either - // be a parameter to the XLA computation or a compile-time constant. - // Writes the compiled output to `result`. + // be a runtime-parameter to the XLA computation, a compile-time constant, or + // a resource variable. Writes the compiled output to `result`. // // The generated XLA computation returns a tuple containing only the // non-constant outputs as a function of the input arguments. Constant // arguments are returned as host memory tensors in the output list and are // not included in the XLA computation's outputs. The XLA computation is - // null if there are no data-dependent outputs. + // null if there are no data-dependent outputs and no side effects. Status CompileFunction(FunctionLibraryRuntime* flr, const NameAttrList& fn_name_attrs, const std::vector& args, @@ -176,41 +237,17 @@ class XlaCompiler { // Compiles a tensorflow::Graph into an xla::Computation. // Similar to CompileFunction, but takes a Graph as input rather than a // function. - // If `use_tuple_arg` is true, the compilation takes all of its arguments as - // a single tuple. Status CompileGraph(string const& name, std::unique_ptr graph, FunctionLibraryRuntime* flr, - const std::vector& args, bool use_tuple_arg, + const std::vector& args, CompilationResult* result); - // Helper function that compiles a function to an XLA computation suitable - // for use as a subroutine in other Computations, e.g., the body of a - // While loop. - // - // The emitted Computation takes a single input parameter with - // input_shape. If this is a tuple then the tuple element shapes - // must match the types of the function's _Arg nodes. If input_shape - // is not a tuple then the function must have a single _Arg node - // with the same type as input_shape. The shapes of the _Arg values - // will be compiled to match input_shape. - // - // The emitted Computation also returns a single value. If output_shape is a - // tuple the tuple elements' types and shapes must match the compiled - // function's _Retval nodes. If output_shape is not a tuple the - // function must have a single _Retval node with the correct type - // (and shape after compilation). - Status CompileSubComputation(FunctionLibraryRuntime* flr, - const NameAttrList& fn_name_attrs, - const xla::Shape& input_shape, - const xla::Shape& output_shape, - xla::Computation* computation); - - // Takes <*result>, which has been compiled from a Tensorflow subgraph to a + // Takes `result` which has been compiled from a Tensorflow subgraph to a // XLA computation already, and generates an XLA LocalExecutable `executable`. Status BuildExecutable(const CompilationResult& result, std::unique_ptr* executable); - xla::Client* client() const { return client_; } + xla::Client* client() const { return options_.client; } XlaCompilationDevice* device() const { return device_; } const DeviceMgr* device_mgr() const { return &device_mgr_; } @@ -221,17 +258,7 @@ class XlaCompiler { Status GetChannelHandle(const string& key, xla::ChannelHandle* channel); private: - // Does the real work of Compile() and CompileToComputation(). - Status CompileFunctionBody(FunctionLibraryRuntime* flr, - const FunctionBody& function_body, - const string& name, - const std::vector& args, - bool use_tuple_arg, CompilationResult* result); - - xla::Client* client_; // Not owned. - const bool allow_cpu_custom_calls_; - const bool local_executable_has_hybrid_result_; - const bool resolve_compile_time_constants_; + Options options_; // Returns the next step sequence number. int64 NextStepId(); diff --git a/tensorflow/compiler/tf2xla/xla_compiler_test.cc b/tensorflow/compiler/tf2xla/xla_compiler_test.cc index b1b4c26b15..aa809f85a1 100644 --- a/tensorflow/compiler/tf2xla/xla_compiler_test.cc +++ b/tensorflow/compiler/tf2xla/xla_compiler_test.cc @@ -71,8 +71,7 @@ TEST_F(XlaCompilerTest, EmptyReturnValues) { std::unique_ptr graph(new Graph(OpRegistry::Global())); XlaCompiler::CompilationResult result; TF_ASSERT_OK(compiler.CompileGraph("add", std::move(graph), flr.get(), - /*args=*/{}, /*use_tuple_arg=*/false, - &result)); + /*args=*/{}, &result)); // No computation should be generated. EXPECT_EQ(0, result.computation.handle().handle()); @@ -103,8 +102,8 @@ TEST_F(XlaCompilerTest, Simple) { auto flr = BuildFunctionLibraryRuntime(compiler); XlaCompiler::CompilationResult result; - TF_ASSERT_OK(compiler.CompileGraph("add", std::move(graph), flr.get(), args, - /*use_tuple_arg=*/false, &result)); + TF_ASSERT_OK( + compiler.CompileGraph("add", std::move(graph), flr.get(), args, &result)); // Tests that the generated computation works. std::unique_ptr param0_literal = @@ -160,8 +159,7 @@ TEST_F(XlaCompilerTest, ConstantOutputs) { XlaCompiler::CompilationResult result; TF_ASSERT_OK(compiler.CompileGraph("constants", std::move(graph_copy), - flr.get(), args, /*use_tuple_arg=*/false, - &result)); + flr.get(), args, &result)); ASSERT_EQ(2, result.outputs.size()); EXPECT_TRUE(result.outputs[0].is_constant); @@ -198,8 +196,7 @@ TEST_F(XlaCompilerTest, ConstantOutputs) { XlaCompiler::CompilationResult result; TF_ASSERT_OK(compiler.CompileGraph("constants", std::move(graph_copy), - flr.get(), args, /*use_tuple_arg=*/false, - &result)); + flr.get(), args, &result)); ASSERT_EQ(2, result.outputs.size()); EXPECT_FALSE(result.outputs[0].is_constant); diff --git a/tensorflow/compiler/tf2xla/xla_context.cc b/tensorflow/compiler/tf2xla/xla_context.cc index 9af0f544e9..57d946509b 100644 --- a/tensorflow/compiler/tf2xla/xla_context.cc +++ b/tensorflow/compiler/tf2xla/xla_context.cc @@ -86,7 +86,7 @@ string XlaContext::DebugString() { return "TLA JIT context"; } // This is called by the Retval Op to associate a computed value // with a specific return value of the subgraph. -void XlaContext::AddRetval(int retval_index, +void XlaContext::AddRetval(int retval_index, DataType type, const xla::ComputationDataHandle& handle) { VLOG(1) << "Added retval index " << retval_index << " to XLA computation"; // Add the return value to the list being built up. @@ -94,6 +94,7 @@ void XlaContext::AddRetval(int retval_index, retvals_.resize(retval_index + 1); } retvals_[retval_index].is_constant = false; + retvals_[retval_index].type = type; retvals_[retval_index].handle = handle; } @@ -104,6 +105,7 @@ Status XlaContext::AddConstRetval(int retval_index, DataType dtype, if (retvals_.size() <= retval_index) { retvals_.resize(retval_index + 1); } + retvals_[retval_index].type = dtype; if (resolve_compile_time_constants_) { retvals_[retval_index].is_constant = true; TF_RETURN_IF_ERROR(LiteralToHostTensor( @@ -135,34 +137,12 @@ Status XlaContext::CreateVariable(int variable_id, string name, DataType type, return Status::OK(); } -Status XlaContext::AssignVariable(int variable_id, DataType type, - const xla::ComputationDataHandle& handle) { +Status XlaContext::GetVariable(int variable_id, Variable** variable) { auto it = variables_.find(variable_id); if (it == variables_.end()) { return errors::InvalidArgument("Unknown variable ID ", variable_id); } - Variable& var = it->second; - if (!((var.type == DT_INVALID && type != DT_INVALID) || (var.type == type))) { - return errors::InvalidArgument( - "Types of variables cannot change after initialization: old type was ", - DataTypeString(var.type), ", new type is ", DataTypeString(type)); - } - var.type = type; - var.value = handle; - return Status::OK(); -} - -Status XlaContext::ReadVariable(int variable_id, - xla::ComputationDataHandle* handle) { - auto it = variables_.find(variable_id); - if (it == variables_.end()) { - return errors::InvalidArgument("Unknown variable ID ", variable_id); - } - *handle = it->second.value; - if (handle->handle() == 0) { - return errors::InvalidArgument("Read of uninitialized variable ", - it->second.name); - } + *variable = &it->second; return Status::OK(); } diff --git a/tensorflow/compiler/tf2xla/xla_context.h b/tensorflow/compiler/tf2xla/xla_context.h index 5d56eedf32..657ead5391 100644 --- a/tensorflow/compiler/tf2xla/xla_context.h +++ b/tensorflow/compiler/tf2xla/xla_context.h @@ -93,7 +93,8 @@ class XlaContext : public ResourceBase { // This is called by the Retval Op to associate a computed value // with a specific return value of the subgraph. - void AddRetval(int retval_index, const xla::ComputationDataHandle& handle); + void AddRetval(int retval_index, DataType type, + const xla::ComputationDataHandle& handle); // As for Retval, but for return values that are compile-time constants. Status AddConstRetval(int retval_index, DataType dtype, @@ -104,22 +105,6 @@ class XlaContext : public ResourceBase { bool has_side_effects() const { return has_side_effects_; } - // Creates a variable with variable `variable_id` and initial type `type` and - // value `handle`. `name` is a descriptive name for use in error messages. - // Fails if the variable already exists. - Status CreateVariable(int variable_id, string name, DataType type, - const xla::ComputationDataHandle& handle); - - // Assigns value `handle` with type `type` to variable `variable_id`. Fails if - // the variable has not already been created using CreateVariable. - Status AssignVariable(int variable_id, DataType type, - const xla::ComputationDataHandle& handle); - - // Reads the current value of `variable_id`, setting `handle` to its current - // value. Returns a failure status if the variable has not been created or - // its value has not been initialized. - Status ReadVariable(int variable_id, xla::ComputationDataHandle* handle); - struct Variable { // A descriptive name for the variable, used in error messages. string name; @@ -136,6 +121,16 @@ class XlaContext : public ResourceBase { // variables have new values that need to be written back. xla::ComputationDataHandle initial_value; }; + + // Creates a variable with variable `variable_id` and initial type `type` and + // value `handle`. `name` is a descriptive name for use in error messages. + // Fails if the variable already exists. + Status CreateVariable(int variable_id, string name, DataType type, + const xla::ComputationDataHandle& handle); + + // Retrieves variable `variable_id`. Fails if the variable does not exist. + Status GetVariable(int variable_id, Variable** variable); + const std::unordered_map& variables() { return variables_; } // Get an XLA lambda to compute Max. This is cached in the diff --git a/tensorflow/compiler/tf2xla/xla_op_kernel.cc b/tensorflow/compiler/tf2xla/xla_op_kernel.cc index 4c8c2527bd..f51adba617 100644 --- a/tensorflow/compiler/tf2xla/xla_op_kernel.cc +++ b/tensorflow/compiler/tf2xla/xla_op_kernel.cc @@ -206,7 +206,51 @@ Status XlaOpKernelContext::ReadVariableInput( const Tensor& tensor = context_->input(index); const XlaExpression* expression = CastExpressionFromTensor(tensor); int variable_id = expression->variable_id(); - return XlaContext::Get(this).ReadVariable(variable_id, value); + + XlaContext::Variable* variable; + XlaContext& context = XlaContext::Get(this); + TF_RETURN_IF_ERROR(context.GetVariable(variable_id, &variable)); + if (variable->value.handle() == 0) { + return errors::InvalidArgument("Read of uninitialized variable ", + variable->name); + } + *value = variable->value; + return Status::OK(); +} + +string XlaOpKernelContext::VariableDebugString(int index) { + const Tensor& tensor = context_->input(index); + const XlaExpression* expression = CastExpressionFromTensor(tensor); + int variable_id = expression->variable_id(); + + XlaContext::Variable* variable; + XlaContext& context = XlaContext::Get(this); + if (!context.GetVariable(variable_id, &variable).ok()) { + return ""; + } + return variable->name; +} + +Status XlaOpKernelContext::GetVariableTypeAndShape(int index, DataType* type, + TensorShape* shape) const { + const Tensor& tensor = context_->input(index); + const XlaExpression* expression = CastExpressionFromTensor(tensor); + int variable_id = expression->variable_id(); + + XlaContext::Variable* variable; + XlaContext& context = XlaContext::Get(this); + TF_RETURN_IF_ERROR(context.GetVariable(variable_id, &variable)); + if (variable->value.handle() == 0) { + return errors::InvalidArgument("Read of uninitialized variable ", + variable->name); + } + *type = variable->type; + auto shape_or_status = builder()->GetShape(variable->value); + if (!shape_or_status.ok()) { + return shape_or_status.status(); + } + *shape = XLAShapeToTensorShape(*shape_or_status.ValueOrDie()); + return Status::OK(); } void XlaOpKernelContext::SetOutput(int index, @@ -272,7 +316,17 @@ Status XlaOpKernelContext::AssignVariable( const XlaExpression* expression = CastExpressionFromTensor(context_->input(index)); XlaContext& context = XlaContext::Get(this); - return context.AssignVariable(expression->variable_id(), type, handle); + XlaContext::Variable* variable; + TF_RETURN_IF_ERROR(context.GetVariable(expression->variable_id(), &variable)); + if (!((variable->type == DT_INVALID && type != DT_INVALID) || + (variable->type == type))) { + return errors::InvalidArgument( + "Types of variables cannot change after initialization: old type was ", + DataTypeString(variable->type), ", new type is ", DataTypeString(type)); + } + variable->type = type; + variable->value = handle; + return Status::OK(); } void XlaOpKernelContext::SetOpHasSideEffects() { diff --git a/tensorflow/compiler/tf2xla/xla_op_kernel.h b/tensorflow/compiler/tf2xla/xla_op_kernel.h index 8ab9498186..badc8e2274 100644 --- a/tensorflow/compiler/tf2xla/xla_op_kernel.h +++ b/tensorflow/compiler/tf2xla/xla_op_kernel.h @@ -141,6 +141,11 @@ class XlaOpKernelContext { // Variables + // Sets `*type` and `*shape` to the current type and shape of a variable's + // value. + Status GetVariableTypeAndShape(int index, DataType* type, + TensorShape* shape) const; + // Reads the current value of the resouce variable referred to by input // 'index'. Status ReadVariableInput(int index, xla::ComputationDataHandle* value); @@ -154,6 +159,9 @@ class XlaOpKernelContext { Status AssignVariable(int variable_index, DataType type, const xla::ComputationDataHandle& handle); + // Returns a human-readable debug string describing 'variable_index'. + string VariableDebugString(int variable_index); + // Helper routines for the OP_REQUIRES macros void CtxFailure(Status s); void CtxFailureWithWarning(Status s); diff --git a/tensorflow/contrib/framework/python/ops/variables.py b/tensorflow/contrib/framework/python/ops/variables.py index 1c35b2419c..8296f631a4 100644 --- a/tensorflow/contrib/framework/python/ops/variables.py +++ b/tensorflow/contrib/framework/python/ops/variables.py @@ -165,7 +165,7 @@ def local_variable(initial_value, validate_shape=True, name=None): def variable(name, shape=None, dtype=None, initializer=None, regularizer=None, trainable=True, collections=None, caching_device=None, device=None, - partitioner=None, custom_getter=None): + partitioner=None, custom_getter=None, use_resource=None): """Gets an existing variable with these parameters or creates a new one. Args: @@ -190,6 +190,7 @@ def variable(name, shape=None, dtype=None, initializer=None, partitions for each axis (currently only one axis can be partitioned). custom_getter: Callable that allows overwriting the internal get_variable method and has to have the same signature. + use_resource: If `True` use a ResourceVariable instead of a Variable. Returns: The created or existing variable. @@ -209,14 +210,15 @@ def variable(name, shape=None, dtype=None, initializer=None, trainable=trainable, collections=collections, caching_device=caching_device, - partitioner=partitioner) + partitioner=partitioner, + use_resource=use_resource) @contrib_add_arg_scope def model_variable(name, shape=None, dtype=dtypes.float32, initializer=None, regularizer=None, trainable=True, collections=None, caching_device=None, device=None, partitioner=None, - custom_getter=None): + custom_getter=None, use_resource=None): """Gets an existing model variable with these parameters or creates a new one. Args: @@ -242,6 +244,7 @@ def model_variable(name, shape=None, dtype=dtypes.float32, initializer=None, partitions for each axis (currently only one axis can be partitioned). custom_getter: Callable that allows overwriting the internal get_variable method and has to have the same signature. + use_resource: If `True` use a ResourceVariable instead of a Variable. Returns: The created or existing variable. @@ -252,7 +255,8 @@ def model_variable(name, shape=None, dtype=dtypes.float32, initializer=None, initializer=initializer, regularizer=regularizer, trainable=trainable, collections=collections, caching_device=caching_device, device=device, - partitioner=partitioner, custom_getter=custom_getter) + partitioner=partitioner, custom_getter=custom_getter, + use_resource=use_resource) return var diff --git a/tensorflow/contrib/layers/python/layers/layers.py b/tensorflow/contrib/layers/python/layers/layers.py index 03cb86601f..8fa734b089 100644 --- a/tensorflow/contrib/layers/python/layers/layers.py +++ b/tensorflow/contrib/layers/python/layers/layers.py @@ -1301,7 +1301,8 @@ def _inner_flatten(inputs, new_rank, output_collections=None, scope=None): def _model_variable_getter(getter, name, shape=None, dtype=None, initializer=None, regularizer=None, trainable=True, collections=None, caching_device=None, - partitioner=None, rename=None, **_): + partitioner=None, rename=None, use_resource=None, + **_): """Getter that uses model_variable for compatibility with core layers.""" short_name = name.split('/')[-1] if rename and short_name in rename: @@ -1312,7 +1313,7 @@ def _model_variable_getter(getter, name, shape=None, dtype=None, name, shape=shape, dtype=dtype, initializer=initializer, regularizer=regularizer, collections=collections, trainable=trainable, caching_device=caching_device, partitioner=partitioner, - custom_getter=getter) + custom_getter=getter, use_resource=use_resource) def _build_variable_getter(rename=None): diff --git a/tensorflow/python/framework/function_test.py b/tensorflow/python/framework/function_test.py index 402616db8f..bfe87a9869 100644 --- a/tensorflow/python/framework/function_test.py +++ b/tensorflow/python/framework/function_test.py @@ -995,7 +995,9 @@ class VariableHoistingTest(test.TestCase): self._testSimpleModel(True) self._testSimpleModel(False) - def testBasicResource(self): + # TODO(b/35668241): disabled because resource variable handling inside + # functions does not work. + def DISABLED_testBasicResource(self): self._testSimpleModel(True, use_resource=True) self._testSimpleModel(False, use_resource=True) diff --git a/tensorflow/python/ops/variable_scope.py b/tensorflow/python/ops/variable_scope.py index 47aeca32c3..2a89921944 100644 --- a/tensorflow/python/ops/variable_scope.py +++ b/tensorflow/python/ops/variable_scope.py @@ -346,7 +346,7 @@ class _VariableStore(object): initializer=initializer, regularizer=regularizer, reuse=reuse, trainable=trainable, collections=collections, caching_device=caching_device, partitioner=partitioner, - validate_shape=validate_shape) + validate_shape=validate_shape, use_resource=use_resource) else: return _true_getter( name, shape=shape, dtype=dtype, -- GitLab From 95a7c5e06d7c4a74041b8cc882386265b0a243ed Mon Sep 17 00:00:00 2001 From: Jianwei Xie Date: Mon, 27 Feb 2017 13:06:43 -0800 Subject: [PATCH 020/101] Fix the estimator import error on windows cmake build Change: 148684190 --- tensorflow/contrib/cmake/tf_python.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tensorflow/contrib/cmake/tf_python.cmake b/tensorflow/contrib/cmake/tf_python.cmake index f9517475e6..6a5fa561bf 100644 --- a/tensorflow/contrib/cmake/tf_python.cmake +++ b/tensorflow/contrib/cmake/tf_python.cmake @@ -182,6 +182,9 @@ add_python_module("tensorflow/python/debug/cli") add_python_module("tensorflow/python/debug/examples") add_python_module("tensorflow/python/debug/lib") add_python_module("tensorflow/python/debug/wrappers") +add_python_module("tensorflow/python/estimator") +add_python_module("tensorflow/python/estimator/inputs") +add_python_module("tensorflow/python/estimator/inputs/queues") add_python_module("tensorflow/python/framework") add_python_module("tensorflow/python/kernel_tests") add_python_module("tensorflow/python/layers") -- GitLab From 1092bfd98c1533a8f04cdc4178d1dea15137599e Mon Sep 17 00:00:00 2001 From: Asim Shankar Date: Mon, 27 Feb 2017 13:35:15 -0800 Subject: [PATCH 021/101] Java: Memory leak fix and Windows friendliness. - Delete memory allocated for exception error messages. - Use vsnprintf instead of vasprintf for allocating exception error messages since the latter doesn't seem to be easily available on Windows. Change: 148687623 --- tensorflow/java/src/main/native/exception_jni.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tensorflow/java/src/main/native/exception_jni.cc b/tensorflow/java/src/main/native/exception_jni.cc index 2df0973389..4f9a84aa9a 100644 --- a/tensorflow/java/src/main/native/exception_jni.cc +++ b/tensorflow/java/src/main/native/exception_jni.cc @@ -15,6 +15,7 @@ limitations under the License. #include #include +#include #include "tensorflow/c/c_api.h" #include "tensorflow/java/src/main/native/exception_jni.h" @@ -29,12 +30,16 @@ const char kUnsupportedOperationException[] = void throwException(JNIEnv* env, const char* clazz, const char* fmt, ...) { va_list args; va_start(args, fmt); - char* message = nullptr; - if (vasprintf(&message, fmt, args) >= 0) { + // Using vsnprintf() instead of vasprintf() because the latter doesn't seem to + // be easily available on Windows. + const size_t max_msg_len = 512; + char* message = static_cast(malloc(max_msg_len)); + if (vsnprintf(message, max_msg_len, fmt, args) >= 0) { env->ThrowNew(env->FindClass(clazz), message); } else { env->ThrowNew(env->FindClass(clazz), ""); } + free(message); va_end(args); } -- GitLab From 588b56f269ccd1dedd65b361ea9983f957ef7cac Mon Sep 17 00:00:00 2001 From: Gunhan Gulsoy Date: Mon, 27 Feb 2017 14:06:54 -0800 Subject: [PATCH 022/101] Disable evaluation_test from cmake build. It is disabled in bazel already. Change: 148691841 --- tensorflow/contrib/cmake/tf_tests.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/tensorflow/contrib/cmake/tf_tests.cmake b/tensorflow/contrib/cmake/tf_tests.cmake index d4f32e09ab..84107706ca 100644 --- a/tensorflow/contrib/cmake/tf_tests.cmake +++ b/tensorflow/contrib/cmake/tf_tests.cmake @@ -155,6 +155,7 @@ if (tensorflow_BUILD_PYTHON_TESTS) # misc "${tensorflow_source_dir}/tensorflow/python/kernel_tests/variable_scope_test.py" "${tensorflow_source_dir}/tensorflow/python/kernel_tests/reshape_op_test.py" + "${tensorflow_source_dir}/tensorflow/python/training/evaluation_test.py" "${tensorflow_source_dir}/tensorflow/tensorboard/backend/server_test.py" "${tensorflow_source_dir}/tensorflow/python/kernel_tests/diag_op_test.py" # Silently failing with GPU kernel disabled. # int32/int64 mixup -- GitLab From 28554fbc756454cd2a1f6f6bda2b2cc86c68bcff Mon Sep 17 00:00:00 2001 From: John Bates Date: Mon, 27 Feb 2017 14:56:51 -0800 Subject: [PATCH 023/101] Moved common code out of RNN Estimators. Change: 148698589 --- tensorflow/contrib/learn/BUILD | 26 ++ .../learn/estimators/dynamic_rnn_estimator.py | 230 +++----------- .../estimators/dynamic_rnn_estimator_test.py | 92 +----- .../python/learn/estimators/rnn_common.py | 199 +++++++++++++ .../learn/estimators/rnn_common_test.py | 123 ++++++++ .../estimators/state_saving_rnn_estimator.py | 280 ++++-------------- .../state_saving_rnn_estimator_test.py | 73 +---- 7 files changed, 463 insertions(+), 560 deletions(-) create mode 100644 tensorflow/contrib/learn/python/learn/estimators/rnn_common.py create mode 100644 tensorflow/contrib/learn/python/learn/estimators/rnn_common_test.py diff --git a/tensorflow/contrib/learn/BUILD b/tensorflow/contrib/learn/BUILD index 8006bd4d45..959b808d06 100644 --- a/tensorflow/contrib/learn/BUILD +++ b/tensorflow/contrib/learn/BUILD @@ -77,6 +77,16 @@ py_library( ], ) +# Exposes constants without having to build the entire :learn target. +py_library( + name = "estimator_constants_py", + srcs = [ + "python/learn/estimators/constants.py", + "python/learn/estimators/prediction_key.py", + ], + srcs_version = "PY2AND3", +) + py_test( name = "data_feeder_test", size = "small", @@ -865,6 +875,22 @@ py_test( ], ) +py_test( + name = "rnn_common_test", + size = "medium", + srcs = ["python/learn/estimators/rnn_common_test.py"], + srcs_version = "PY2AND3", + deps = [ + ":learn", + "//tensorflow/python:array_ops", + "//tensorflow/python:client_testlib", + "//tensorflow/python:framework", + "//tensorflow/python:framework_for_generated_wrappers", + "//tensorflow/python:framework_test_lib", + "//tensorflow/python:math_ops", + ], +) + py_test( name = "ops_test", size = "small", diff --git a/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator.py b/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator.py index 6b5b9a6dd9..2c0799a9b7 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator.py +++ b/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator.py @@ -27,6 +27,7 @@ from tensorflow.contrib.learn.python.learn.estimators import constants from tensorflow.contrib.learn.python.learn.estimators import estimator from tensorflow.contrib.learn.python.learn.estimators import model_fn from tensorflow.contrib.learn.python.learn.estimators import prediction_key +from tensorflow.contrib.learn.python.learn.estimators import rnn_common from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops @@ -42,90 +43,21 @@ class PredictionType(object): MULTIPLE_VALUE = 2 -# NOTE(jamieas): As of February 7, 2017, some of the `RNNKeys` have been removed -# and replaced with values from `prediction_key.PredictionKey`. The key -# `RNNKeys.PREDICTIONS_KEY` has been replaced by -# `prediction_key.PredictionKey.SCORES` for regression and -# `prediction_key.PredictionKey.CLASSES` for classification. The key -# `RNNKeys.PROBABILITIES_KEY` has been replaced by -# `prediction_key.PredictionKey.PROBABILITIES`. +# TODO(jtbates): Remove RNNKeys once all targets that reference it are updated +# to depend on its implementation in rnn_common. class RNNKeys(object): SEQUENCE_LENGTH_KEY = 'sequence_length' STATE_PREFIX = 'rnn_cell_state' + _CELL_TYPES = {'basic_rnn': contrib_rnn.BasicRNNCell, 'lstm': contrib_rnn.LSTMCell, 'gru': contrib_rnn.GRUCell,} -def mask_activations_and_labels(activations, labels, sequence_lengths): - """Remove entries outside `sequence_lengths` and returned flattened results. - - Args: - activations: Output of the RNN, shape `[batch_size, padded_length, k]`. - labels: Label values, shape `[batch_size, padded_length]`. - sequence_lengths: A `Tensor` of shape `[batch_size]` with the unpadded - length of each sequence. If `None`, then each sequence is unpadded. - - Returns: - activations_masked: `logit` values with those beyond `sequence_lengths` - removed for each batch. Batches are then concatenated. Shape - `[tf.sum(sequence_lengths), k]` if `sequence_lengths` is not `None` and - shape `[batch_size * padded_length, k]` otherwise. - labels_masked: Label values after removing unneeded entries. Shape - `[tf.sum(sequence_lengths)]` if `sequence_lengths` is not `None` and shape - `[batch_size * padded_length]` otherwise. - """ - with ops.name_scope('mask_activations_and_labels', - values=[activations, labels, sequence_lengths]): - labels_shape = array_ops.shape(labels) - batch_size = labels_shape[0] - padded_length = labels_shape[1] - if sequence_lengths is None: - flattened_dimension = padded_length * batch_size - activations_masked = array_ops.reshape(activations, - [flattened_dimension, -1]) - labels_masked = array_ops.reshape(labels, [flattened_dimension]) - else: - mask = array_ops.sequence_mask(sequence_lengths, padded_length) - activations_masked = array_ops.boolean_mask(activations, mask) - labels_masked = array_ops.boolean_mask(labels, mask) - return activations_masked, labels_masked - - -def select_last_activations(activations, sequence_lengths): - """Selects the nth set of activations for each n in `sequence_length`. - - Reuturns a `Tensor` of shape `[batch_size, k]`. If `sequence_length` is not - `None`, then `output[i, :] = activations[i, sequence_length[i], :]`. If - `sequence_length` is `None`, then `output[i, :] = activations[i, -1, :]`. - - Args: - activations: A `Tensor` with shape `[batch_size, padded_length, k]`. - sequence_lengths: A `Tensor` with shape `[batch_size]` or `None`. - Returns: - A `Tensor` of shape `[batch_size, k]`. - """ - with ops.name_scope('select_last_activations', - values=[activations, sequence_lengths]): - activations_shape = array_ops.shape(activations) - batch_size = activations_shape[0] - padded_length = activations_shape[1] - num_label_columns = activations_shape[2] - if sequence_lengths is None: - sequence_lengths = padded_length - reshaped_activations = array_ops.reshape(activations, - [-1, num_label_columns]) - indices = math_ops.range(batch_size) * padded_length + sequence_lengths - 1 - last_activations = array_ops.gather(reshaped_activations, indices) - last_activations.set_shape( - [activations.get_shape()[0], activations.get_shape()[2]]) - return last_activations - - def _get_state_name(i): """Constructs the name string for state component `i`.""" - return '{}_{}'.format(RNNKeys.STATE_PREFIX, i) + return '{}_{}'.format(rnn_common.RNNKeys.STATE_PREFIX, i) def state_tuple_to_dict(state): @@ -351,13 +283,11 @@ def _get_eval_metric_ops(problem_type, prediction_type, sequence_length, if problem_type == constants.ProblemType.CLASSIFICATION: # Multi value classification if prediction_type == PredictionType.MULTIPLE_VALUE: - masked_predictions, masked_labels = mask_activations_and_labels( - prediction_dict[prediction_key.PredictionKey.CLASSES], - labels, + mask_predictions, mask_labels = rnn_common.mask_activations_and_labels( + prediction_dict[prediction_key.PredictionKey.CLASSES], labels, sequence_length) eval_metric_ops['accuracy'] = metrics.streaming_accuracy( - predictions=masked_predictions, - labels=masked_labels) + predictions=mask_predictions, labels=mask_labels) # Single value classification elif prediction_type == PredictionType.SINGLE_VALUE: eval_metric_ops['accuracy'] = metrics.streaming_accuracy( @@ -373,64 +303,6 @@ def _get_eval_metric_ops(problem_type, prediction_type, sequence_length, return eval_metric_ops -def _multi_value_predictions( - activations, target_column, problem_type, predict_probabilities): - """Maps `activations` from the RNN to predictions for multi value models. - - If `predict_probabilities` is `False`, this function returns a `dict` - containing single entry with key `PREDICTIONS_KEY`. If `predict_probabilities` - is `True`, it will contain a second entry with key `PROBABILITIES_KEY`. The - value of this entry is a `Tensor` of probabilities with shape - `[batch_size, padded_length, num_classes]`. - - Note that variable length inputs will yield some predictions that don't have - meaning. For example, if `sequence_length = [3, 2]`, then prediction `[1, 2]` - has no meaningful interpretation. - - Args: - activations: Output from an RNN. Should have dtype `float32` and shape - `[batch_size, padded_length, ?]`. - target_column: An initialized `TargetColumn`, calculate predictions. - problem_type: Either `ProblemType.CLASSIFICATION` or - `ProblemType.LINEAR_REGRESSION`. - predict_probabilities: A Python boolean, indicating whether probabilities - should be returned. Should only be set to `True` for - classification/logistic regression problems. - Returns: - A `dict` mapping strings to `Tensors`. - """ - with ops.name_scope('MultiValuePrediction'): - activations_shape = array_ops.shape(activations) - flattened_activations = array_ops.reshape(activations, - [-1, activations_shape[2]]) - prediction_dict = {} - if predict_probabilities: - flat_probabilities = target_column.logits_to_predictions( - flattened_activations, proba=True) - flat_predictions = math_ops.argmax(flat_probabilities, 1) - if target_column.num_label_columns == 1: - probability_shape = array_ops.concat([activations_shape[:2], [2]], 0) - else: - probability_shape = activations_shape - probabilities = array_ops.reshape( - flat_probabilities, - probability_shape, - name=prediction_key.PredictionKey.PROBABILITIES) - prediction_dict[ - prediction_key.PredictionKey.PROBABILITIES] = probabilities - else: - flat_predictions = target_column.logits_to_predictions( - flattened_activations, proba=False) - predictions_name = (prediction_key.PredictionKey.CLASSES - if problem_type == constants.ProblemType.CLASSIFICATION - else prediction_key.PredictionKey.SCORES) - predictions = array_ops.reshape( - flat_predictions, [activations_shape[0], activations_shape[1]], - name=predictions_name) - prediction_dict[predictions_name] = predictions - return prediction_dict - - def _single_value_predictions(activations, sequence_length, target_column, @@ -460,7 +332,8 @@ def _single_value_predictions(activations, A `dict` mapping strings to `Tensors`. """ with ops.name_scope('SingleValuePrediction'): - last_activations = select_last_activations(activations, sequence_length) + last_activations = rnn_common.select_last_activations( + activations, sequence_length) predictions_name = (prediction_key.PredictionKey.CLASSES if problem_type == constants.ProblemType.CLASSIFICATION else prediction_key.PredictionKey.SCORES) @@ -495,7 +368,7 @@ def _multi_value_loss( A scalar `Tensor` containing the loss. """ with ops.name_scope('MultiValueLoss'): - activations_masked, labels_masked = mask_activations_and_labels( + activations_masked, labels_masked = rnn_common.mask_activations_and_labels( activations, labels, sequence_length) return target_column.loss(activations_masked, labels_masked, features) @@ -519,7 +392,8 @@ def _single_value_loss( """ with ops.name_scope('SingleValueLoss'): - last_activations = select_last_activations(activations, sequence_length) + last_activations = rnn_common.select_last_activations( + activations, sequence_length) return target_column.loss(last_activations, labels, features) @@ -544,29 +418,33 @@ def _get_output_alternatives(prediction_type, if prediction_type == PredictionType.MULTIPLE_VALUE: return None if prediction_type == PredictionType.SINGLE_VALUE: - prediction_dict_no_state = {k: v for k, v in prediction_dict.items() - if RNNKeys.STATE_PREFIX not in k} + prediction_dict_no_state = { + k: v + for k, v in prediction_dict.items() + if rnn_common.RNNKeys.STATE_PREFIX not in k + } return {'dynamic_rnn_output': (problem_type, prediction_dict_no_state)} raise ValueError('Unrecognized prediction_type: {}'.format(prediction_type)) -def _get_dynamic_rnn_model_fn(cell_type, - num_units, - target_column, - problem_type, - prediction_type, - optimizer, - sequence_feature_columns, - context_feature_columns=None, - predict_probabilities=False, - learning_rate=None, - gradient_clipping_norm=None, - dropout_keep_probabilities=None, - sequence_length_key=RNNKeys.SEQUENCE_LENGTH_KEY, - dtype=dtypes.float32, - parallel_iterations=None, - swap_memory=True, - name='DynamicRNNModel'): +def _get_dynamic_rnn_model_fn( + cell_type, + num_units, + target_column, + problem_type, + prediction_type, + optimizer, + sequence_feature_columns, + context_feature_columns=None, + predict_probabilities=False, + learning_rate=None, + gradient_clipping_norm=None, + dropout_keep_probabilities=None, + sequence_length_key=rnn_common.RNNKeys.SEQUENCE_LENGTH_KEY, + dtype=dtypes.float32, + parallel_iterations=None, + swap_memory=True, + name='DynamicRNNModel'): """Creates an RNN model function for an `Estimator`. The model function returns an instance of `ModelFnOps`. When @@ -667,7 +545,7 @@ def _get_dynamic_rnn_model_fn(cell_type, loss = None # Created below for modes TRAIN and EVAL. if prediction_type == PredictionType.MULTIPLE_VALUE: - prediction_dict = _multi_value_predictions( + prediction_dict = rnn_common.multi_value_predictions( rnn_activations, target_column, problem_type, predict_probabilities) if mode != model_fn.ModeKeys.INFER: loss = _multi_value_loss( @@ -711,38 +589,6 @@ def _get_dynamic_rnn_model_fn(cell_type, return _dynamic_rnn_model_fn -def _apply_dropout( - cells, dropout_keep_probabilities, random_seed=None): - """Applies dropout to the outputs and inputs of `cell`. - - Args: - cells: A list of `RNNCell`s. - dropout_keep_probabilities: a list whose elements are either floats in - `[0.0, 1.0]` or `None`. It must have length one greater than `cells`. - random_seed: Seed for random dropout. - - Returns: - A list of `RNNCell`s, the result of applying the supplied dropouts. - - Raises: - ValueError: If `len(dropout_keep_probabilities) != len(cells) + 1`. - """ - if len(dropout_keep_probabilities) != len(cells) + 1: - raise ValueError( - 'The number of dropout probabilites must be one greater than the ' - 'number of cells. Got {} cells and {} dropout probabilities.'.format( - len(cells), len(dropout_keep_probabilities))) - wrapped_cells = [ - contrib_rnn.DropoutWrapper(cell, prob, 1.0, random_seed) - for cell, prob in zip(cells[:-1], dropout_keep_probabilities[:-2]) - ] - wrapped_cells.append(contrib_rnn.DropoutWrapper( - cells[-1], - dropout_keep_probabilities[-2], - dropout_keep_probabilities[-1])) - return wrapped_cells - - def _get_single_cell(cell_type, num_units): """Constructs and return an single `RNNCell`. @@ -789,7 +635,7 @@ def _construct_rnn_cell(cell_type, num_units, dropout_keep_probabilities): cells = [_get_single_cell(cell_type, n) for n in num_units] if dropout_keep_probabilities: - cells = _apply_dropout(cells, dropout_keep_probabilities) + cells = rnn_common.apply_dropout(cells, dropout_keep_probabilities) if len(cells) == 1: return cells[0] return contrib_rnn.MultiRNNCell(cells) diff --git a/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator_test.py b/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator_test.py index d7d606deed..443d336214 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator_test.py @@ -35,6 +35,7 @@ from tensorflow.contrib.learn.python.learn.estimators import constants from tensorflow.contrib.learn.python.learn.estimators import dynamic_rnn_estimator from tensorflow.contrib.learn.python.learn.estimators import model_fn as model_fn_lib from tensorflow.contrib.learn.python.learn.estimators import prediction_key +from tensorflow.contrib.learn.python.learn.estimators import rnn_common from tensorflow.contrib.learn.python.learn.estimators import run_config from tensorflow.contrib.rnn.python.ops import core_rnn_cell_impl from tensorflow.python.client import session @@ -191,93 +192,6 @@ class DynamicRnnEstimatorTest(test.TestCase): expected_state_shape = np.array([3, self.NUM_RNN_CELL_UNITS]) self.assertAllEqual(expected_state_shape, final_state.shape) - def testMaskActivationsAndLabels(self): - """Test `mask_activations_and_labels`.""" - batch_size = 4 - padded_length = 6 - num_classes = 4 - np.random.seed(1234) - sequence_length = np.random.randint(0, padded_length + 1, batch_size) - activations = np.random.rand(batch_size, padded_length, num_classes) - labels = np.random.randint(0, num_classes, [batch_size, padded_length]) - (activations_masked_t, - labels_masked_t) = dynamic_rnn_estimator.mask_activations_and_labels( - constant_op.constant( - activations, dtype=dtypes.float32), - constant_op.constant( - labels, dtype=dtypes.int32), - constant_op.constant( - sequence_length, dtype=dtypes.int32)) - - with session.Session() as sess: - activations_masked, labels_masked = sess.run( - [activations_masked_t, labels_masked_t]) - - expected_activations_shape = [sum(sequence_length), num_classes] - np.testing.assert_equal( - expected_activations_shape, activations_masked.shape, - 'Wrong activations shape. Expected {}; got {}.'.format( - expected_activations_shape, activations_masked.shape)) - - expected_labels_shape = [sum(sequence_length)] - np.testing.assert_equal(expected_labels_shape, labels_masked.shape, - 'Wrong labels shape. Expected {}; got {}.'.format( - expected_labels_shape, labels_masked.shape)) - masked_index = 0 - for i in range(batch_size): - for j in range(sequence_length[i]): - actual_activations = activations_masked[masked_index] - expected_activations = activations[i, j, :] - np.testing.assert_almost_equal( - expected_activations, - actual_activations, - err_msg='Unexpected logit value at index [{}, {}, :].' - ' Expected {}; got {}.'.format(i, j, expected_activations, - actual_activations)) - - actual_labels = labels_masked[masked_index] - expected_labels = labels[i, j] - np.testing.assert_almost_equal( - expected_labels, - actual_labels, - err_msg='Unexpected logit value at index [{}, {}].' - ' Expected {}; got {}.'.format(i, j, expected_labels, - actual_labels)) - masked_index += 1 - - def testSelectLastActivations(self): - """Test `select_last_activations`.""" - batch_size = 4 - padded_length = 6 - num_classes = 4 - np.random.seed(4444) - sequence_length = np.random.randint(0, padded_length + 1, batch_size) - activations = np.random.rand(batch_size, padded_length, num_classes) - last_activations_t = dynamic_rnn_estimator.select_last_activations( - constant_op.constant( - activations, dtype=dtypes.float32), - constant_op.constant( - sequence_length, dtype=dtypes.int32)) - - with session.Session() as sess: - last_activations = sess.run(last_activations_t) - - expected_activations_shape = [batch_size, num_classes] - np.testing.assert_equal( - expected_activations_shape, last_activations.shape, - 'Wrong activations shape. Expected {}; got {}.'.format( - expected_activations_shape, last_activations.shape)) - - for i in range(batch_size): - actual_activations = last_activations[i, :] - expected_activations = activations[i, sequence_length[i] - 1, :] - np.testing.assert_almost_equal( - expected_activations, - actual_activations, - err_msg='Unexpected logit value at index [{}, :].' - ' Expected {}; got {}.'.format(i, expected_activations, - actual_activations)) - def testGetOutputAlternatives(self): test_cases = ( (dynamic_rnn_estimator.PredictionType.SINGLE_VALUE, @@ -618,7 +532,7 @@ class DynamicRnnEstimatorTest(test.TestCase): incremental_state_dict = { k: v for (k, v) in prediction_dict.items() - if k.startswith(dynamic_rnn_estimator.RNNKeys.STATE_PREFIX) + if k.startswith(rnn_common.RNNKeys.STATE_PREFIX) } return prediction_dict @@ -636,7 +550,7 @@ class DynamicRnnEstimatorTest(test.TestCase): err_msg='Mismatch on last {} predictions.'.format(prediction_steps[-1])) # Check that final states are identical. for k, v in pred_all_at_once.items(): - if k.startswith(dynamic_rnn_estimator.RNNKeys.STATE_PREFIX): + if k.startswith(rnn_common.RNNKeys.STATE_PREFIX): np.testing.assert_array_equal( v, pred_step_by_step[k], err_msg='Mismatch on state {}.'.format(k)) diff --git a/tensorflow/contrib/learn/python/learn/estimators/rnn_common.py b/tensorflow/contrib/learn/python/learn/estimators/rnn_common.py new file mode 100644 index 0000000000..b3aea01ffa --- /dev/null +++ b/tensorflow/contrib/learn/python/learn/estimators/rnn_common.py @@ -0,0 +1,199 @@ +# Copyright 2017 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +"""Common operations for RNN Estimators.""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +from tensorflow.contrib import rnn as contrib_rnn +from tensorflow.contrib.learn.python.learn.estimators import constants +from tensorflow.contrib.learn.python.learn.estimators import prediction_key +from tensorflow.python.framework import ops +from tensorflow.python.ops import array_ops +from tensorflow.python.ops import math_ops + + +# NOTE(jtbates): As of February 10, 2017, some of the `RNNKeys` have been +# removed and replaced with values from `prediction_key.PredictionKey`. The key +# `RNNKeys.PREDICTIONS_KEY` has been replaced by +# `prediction_key.PredictionKey.SCORES` for regression and +# `prediction_key.PredictionKey.CLASSES` for classification. The key +# `RNNKeys.PROBABILITIES_KEY` has been replaced by +# `prediction_key.PredictionKey.PROBABILITIES`. +class RNNKeys(object): + FINAL_STATE_KEY = 'final_state' + LABELS_KEY = '__labels__' + SEQUENCE_LENGTH_KEY = 'sequence_length' + STATE_PREFIX = 'rnn_cell_state' + + +def apply_dropout(cells, dropout_keep_probabilities, random_seed=None): + """Applies dropout to the outputs and inputs of `cell`. + + Args: + cells: A list of `RNNCell`s. + dropout_keep_probabilities: a list whose elements are either floats in + `[0.0, 1.0]` or `None`. It must have length one greater than `cells`. + random_seed: Seed for random dropout. + + Returns: + A list of `RNNCell`s, the result of applying the supplied dropouts. + + Raises: + ValueError: If `len(dropout_keep_probabilities) != len(cells) + 1`. + """ + if len(dropout_keep_probabilities) != len(cells) + 1: + raise ValueError( + 'The number of dropout probabilites must be one greater than the ' + 'number of cells. Got {} cells and {} dropout probabilities.'.format( + len(cells), len(dropout_keep_probabilities))) + wrapped_cells = [ + contrib_rnn.DropoutWrapper(cell, prob, 1.0, random_seed) + for cell, prob in zip(cells[:-1], dropout_keep_probabilities[:-2]) + ] + wrapped_cells.append( + contrib_rnn.DropoutWrapper(cells[-1], dropout_keep_probabilities[-2], + dropout_keep_probabilities[-1])) + return wrapped_cells + + +def select_last_activations(activations, sequence_lengths): + """Selects the nth set of activations for each n in `sequence_length`. + + Reuturns a `Tensor` of shape `[batch_size, k]`. If `sequence_length` is not + `None`, then `output[i, :] = activations[i, sequence_length[i], :]`. If + `sequence_length` is `None`, then `output[i, :] = activations[i, -1, :]`. + + Args: + activations: A `Tensor` with shape `[batch_size, padded_length, k]`. + sequence_lengths: A `Tensor` with shape `[batch_size]` or `None`. + Returns: + A `Tensor` of shape `[batch_size, k]`. + """ + with ops.name_scope( + 'select_last_activations', values=[activations, sequence_lengths]): + activations_shape = array_ops.shape(activations) + batch_size = activations_shape[0] + padded_length = activations_shape[1] + num_label_columns = activations_shape[2] + if sequence_lengths is None: + sequence_lengths = padded_length + reshaped_activations = array_ops.reshape(activations, + [-1, num_label_columns]) + indices = math_ops.range(batch_size) * padded_length + sequence_lengths - 1 + last_activations = array_ops.gather(reshaped_activations, indices) + last_activations.set_shape( + [activations.get_shape()[0], activations.get_shape()[2]]) + return last_activations + + +def mask_activations_and_labels(activations, labels, sequence_lengths): + """Remove entries outside `sequence_lengths` and returned flattened results. + + Args: + activations: Output of the RNN, shape `[batch_size, padded_length, k]`. + labels: Label values, shape `[batch_size, padded_length]`. + sequence_lengths: A `Tensor` of shape `[batch_size]` with the unpadded + length of each sequence. If `None`, then each sequence is unpadded. + + Returns: + activations_masked: `logit` values with those beyond `sequence_lengths` + removed for each batch. Batches are then concatenated. Shape + `[tf.sum(sequence_lengths), k]` if `sequence_lengths` is not `None` and + shape `[batch_size * padded_length, k]` otherwise. + labels_masked: Label values after removing unneeded entries. Shape + `[tf.sum(sequence_lengths)]` if `sequence_lengths` is not `None` and shape + `[batch_size * padded_length]` otherwise. + """ + with ops.name_scope( + 'mask_activations_and_labels', + values=[activations, labels, sequence_lengths]): + labels_shape = array_ops.shape(labels) + batch_size = labels_shape[0] + padded_length = labels_shape[1] + if sequence_lengths is None: + flattened_dimension = padded_length * batch_size + activations_masked = array_ops.reshape(activations, + [flattened_dimension, -1]) + labels_masked = array_ops.reshape(labels, [flattened_dimension]) + else: + mask = array_ops.sequence_mask(sequence_lengths, padded_length) + activations_masked = array_ops.boolean_mask(activations, mask) + labels_masked = array_ops.boolean_mask(labels, mask) + return activations_masked, labels_masked + + +def multi_value_predictions(activations, target_column, problem_type, + predict_probabilities): + """Maps `activations` from the RNN to predictions for multi value models. + + If `predict_probabilities` is `False`, this function returns a `dict` + containing single entry with key `prediction_key.PredictionKey.CLASSES` for + `problem_type` `ProblemType.CLASSIFICATION` or + `prediction_key.PredictionKey.SCORE` for `problem_type` + `ProblemType.LINEAR_REGRESSION`. + + If `predict_probabilities` is `True`, it will contain a second entry with key + `prediction_key.PredictionKey.PROBABILITIES`. The + value of this entry is a `Tensor` of probabilities with shape + `[batch_size, padded_length, num_classes]`. + + Note that variable length inputs will yield some predictions that don't have + meaning. For example, if `sequence_length = [3, 2]`, then prediction `[1, 2]` + has no meaningful interpretation. + + Args: + activations: Output from an RNN. Should have dtype `float32` and shape + `[batch_size, padded_length, ?]`. + target_column: An initialized `TargetColumn`, calculate predictions. + problem_type: Either `ProblemType.CLASSIFICATION` or + `ProblemType.LINEAR_REGRESSION`. + predict_probabilities: A Python boolean, indicating whether probabilities + should be returned. Should only be set to `True` for + classification/logistic regression problems. + Returns: + A `dict` mapping strings to `Tensors`. + """ + with ops.name_scope('MultiValuePrediction'): + activations_shape = array_ops.shape(activations) + flattened_activations = array_ops.reshape(activations, + [-1, activations_shape[2]]) + prediction_dict = {} + if predict_probabilities: + flat_probabilities = target_column.logits_to_predictions( + flattened_activations, proba=True) + flat_predictions = math_ops.argmax(flat_probabilities, 1) + if target_column.num_label_columns == 1: + probability_shape = array_ops.concat([activations_shape[:2], [2]], 0) + else: + probability_shape = activations_shape + probabilities = array_ops.reshape( + flat_probabilities, + probability_shape, + name=prediction_key.PredictionKey.PROBABILITIES) + prediction_dict[ + prediction_key.PredictionKey.PROBABILITIES] = probabilities + else: + flat_predictions = target_column.logits_to_predictions( + flattened_activations, proba=False) + predictions_name = (prediction_key.PredictionKey.CLASSES + if problem_type == constants.ProblemType.CLASSIFICATION + else prediction_key.PredictionKey.SCORES) + predictions = array_ops.reshape( + flat_predictions, [activations_shape[0], activations_shape[1]], + name=predictions_name) + prediction_dict[predictions_name] = predictions + return prediction_dict diff --git a/tensorflow/contrib/learn/python/learn/estimators/rnn_common_test.py b/tensorflow/contrib/learn/python/learn/estimators/rnn_common_test.py new file mode 100644 index 0000000000..1cb63995dd --- /dev/null +++ b/tensorflow/contrib/learn/python/learn/estimators/rnn_common_test.py @@ -0,0 +1,123 @@ +# Copyright 2017 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +"""Tests for layers.rnn_common.""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import sys + +# TODO: #6568 Remove this hack that makes dlopen() not crash. +if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): + import ctypes + sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) + +import numpy as np + +from tensorflow.contrib.learn.python.learn.estimators import rnn_common +from tensorflow.python.client import session +from tensorflow.python.framework import constant_op +from tensorflow.python.framework import dtypes +from tensorflow.python.platform import test + + +class RnnCommonTest(test.TestCase): + + def testMaskActivationsAndLabels(self): + """Test `mask_activations_and_labels`.""" + batch_size = 4 + padded_length = 6 + num_classes = 4 + np.random.seed(1234) + sequence_length = np.random.randint(0, padded_length + 1, batch_size) + activations = np.random.rand(batch_size, padded_length, num_classes) + labels = np.random.randint(0, num_classes, [batch_size, padded_length]) + (activations_masked_t, + labels_masked_t) = rnn_common.mask_activations_and_labels( + constant_op.constant(activations, dtype=dtypes.float32), + constant_op.constant(labels, dtype=dtypes.int32), + constant_op.constant(sequence_length, dtype=dtypes.int32)) + + with self.test_session() as sess: + activations_masked, labels_masked = sess.run( + [activations_masked_t, labels_masked_t]) + + expected_activations_shape = [sum(sequence_length), num_classes] + np.testing.assert_equal( + expected_activations_shape, activations_masked.shape, + 'Wrong activations shape. Expected {}; got {}.'.format( + expected_activations_shape, activations_masked.shape)) + + expected_labels_shape = [sum(sequence_length)] + np.testing.assert_equal(expected_labels_shape, labels_masked.shape, + 'Wrong labels shape. Expected {}; got {}.'.format( + expected_labels_shape, labels_masked.shape)) + masked_index = 0 + for i in range(batch_size): + for j in range(sequence_length[i]): + actual_activations = activations_masked[masked_index] + expected_activations = activations[i, j, :] + np.testing.assert_almost_equal( + expected_activations, + actual_activations, + err_msg='Unexpected logit value at index [{}, {}, :].' + ' Expected {}; got {}.'.format(i, j, expected_activations, + actual_activations)) + + actual_labels = labels_masked[masked_index] + expected_labels = labels[i, j] + np.testing.assert_almost_equal( + expected_labels, + actual_labels, + err_msg='Unexpected logit value at index [{}, {}].' + ' Expected {}; got {}.'.format(i, j, expected_labels, + actual_labels)) + masked_index += 1 + + def testSelectLastActivations(self): + """Test `select_last_activations`.""" + batch_size = 4 + padded_length = 6 + num_classes = 4 + np.random.seed(4444) + sequence_length = np.random.randint(0, padded_length + 1, batch_size) + activations = np.random.rand(batch_size, padded_length, num_classes) + last_activations_t = rnn_common.select_last_activations( + constant_op.constant(activations, dtype=dtypes.float32), + constant_op.constant(sequence_length, dtype=dtypes.int32)) + + with session.Session() as sess: + last_activations = sess.run(last_activations_t) + + expected_activations_shape = [batch_size, num_classes] + np.testing.assert_equal( + expected_activations_shape, last_activations.shape, + 'Wrong activations shape. Expected {}; got {}.'.format( + expected_activations_shape, last_activations.shape)) + + for i in range(batch_size): + actual_activations = last_activations[i, :] + expected_activations = activations[i, sequence_length[i] - 1, :] + np.testing.assert_almost_equal( + expected_activations, + actual_activations, + err_msg='Unexpected logit value at index [{}, :].' + ' Expected {}; got {}.'.format(i, expected_activations, + actual_activations)) + + +if __name__ == '__main__': + test.main() diff --git a/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator.py b/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator.py index f15c717c91..48ad279cc0 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator.py +++ b/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator.py @@ -31,67 +31,17 @@ from tensorflow.contrib.learn.python.learn.estimators import constants from tensorflow.contrib.learn.python.learn.estimators import estimator from tensorflow.contrib.learn.python.learn.estimators import model_fn from tensorflow.contrib.learn.python.learn.estimators import prediction_key +from tensorflow.contrib.learn.python.learn.estimators import rnn_common from tensorflow.contrib.rnn.python.ops import core_rnn from tensorflow.contrib.training.python.training import sequence_queueing_state_saver as sqss from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import sparse_tensor from tensorflow.python.ops import array_ops -from tensorflow.python.ops import math_ops from tensorflow.python.training import momentum as momentum_opt from tensorflow.python.util import nest -# NOTE(jtbates): As of February 10, 2017, some of the `RNNKeys` have been -# removed and replaced with values from `prediction_key.PredictionKey`. The key -# `RNNKeys.PREDICTIONS_KEY` has been replaced by -# `prediction_key.PredictionKey.SCORES` for regression and -# `prediction_key.PredictionKey.CLASSES` for classification. The key -# `RNNKeys.PROBABILITIES_KEY` has been replaced by -# `prediction_key.PredictionKey.PROBABILITIES`. -class RNNKeys(object): - FINAL_STATE_KEY = 'final_state' - LABELS_KEY = '__labels__' - STATE_PREFIX = 'rnn_cell_state' - - -# TODO(b/34272579): mask_activations_and_labels is shared with -# dynamic_rnn_estimator.py. Move it to a common library. -def mask_activations_and_labels(activations, labels, sequence_lengths): - """Remove entries outside `sequence_lengths` and returned flattened results. - - Args: - activations: Output of the RNN, shape `[batch_size, padded_length, k]`. - labels: Label values, shape `[batch_size, padded_length]`. - sequence_lengths: A `Tensor` of shape `[batch_size]` with the unpadded - length of each sequence. If `None`, then each sequence is unpadded. - - Returns: - activations_masked: `logit` values with those beyond `sequence_lengths` - removed for each batch. Batches are then concatenated. Shape - `[tf.sum(sequence_lengths), k]` if `sequence_lengths` is not `None` and - shape `[batch_size * padded_length, k]` otherwise. - labels_masked: Label values after removing unneeded entries. Shape - `[tf.sum(sequence_lengths)]` if `sequence_lengths` is not `None` and shape - `[batch_size * padded_length]` otherwise. - """ - with ops.name_scope('mask_activations_and_labels', - values=[activations, labels, sequence_lengths]): - labels_shape = array_ops.shape(labels) - batch_size = labels_shape[0] - padded_length = labels_shape[1] - if sequence_lengths is None: - flattened_dimension = padded_length * batch_size - activations_masked = array_ops.reshape(activations, - [flattened_dimension, -1]) - labels_masked = array_ops.reshape(labels, [flattened_dimension]) - else: - mask = array_ops.sequence_mask(sequence_lengths, padded_length) - activations_masked = array_ops.boolean_mask(activations, mask) - labels_masked = array_ops.boolean_mask(labels, mask) - return activations_masked, labels_masked - - def construct_state_saving_rnn(cell, inputs, num_label_columns, @@ -134,7 +84,8 @@ def construct_state_saving_rnn(cell, activation_fn=None, trainable=True) # Use `identity` to rename `final_state`. - final_state = array_ops.identity(final_state, name=RNNKeys.FINAL_STATE_KEY) + final_state = array_ops.identity( + final_state, name=rnn_common.RNNKeys.FINAL_STATE_KEY) return activations, final_state @@ -156,7 +107,7 @@ def _mask_multivalue(sequence_length, metric): """ @functools.wraps(metric) def _metric(predictions, labels, *args, **kwargs): - predictions, labels = mask_activations_and_labels( + predictions, labels = rnn_common.mask_activations_and_labels( predictions, labels, sequence_length) return metric(predictions, labels, *args, **kwargs) return _metric @@ -184,70 +135,6 @@ def _get_default_metrics(problem_type, sequence_length): return default_metrics -# TODO(b/34272579): _multi_value_predictions is shared with -# dynamic_rnn_estimator.py. Move it to a common library. -def _multi_value_predictions( - activations, target_column, problem_type, predict_probabilities): - """Maps `activations` from the RNN to predictions for multi value models. - - If `predict_probabilities` is `False`, this function returns a `dict` - containing single entry with key `prediction_key.PredictionKey.CLASSES` for - `problem_type` `ProblemType.CLASSIFICATION` or - `prediction_key.PredictionKey.SCORE` for `problem_type` - `ProblemType.LINEAR_REGRESSION`. - - If `predict_probabilities` is `True`, it will contain a second entry with key - `prediction_key.PredictionKey.PROBABILITIES`. The - value of this entry is a `Tensor` of probabilities with shape - `[batch_size, padded_length, num_classes]`. - - Note that variable length inputs will yield some predictions that don't have - meaning. For example, if `sequence_length = [3, 2]`, then prediction `[1, 2]` - has no meaningful interpretation. - - Args: - activations: Output from an RNN. Should have dtype `float32` and shape - `[batch_size, padded_length, ?]`. - target_column: An initialized `TargetColumn`, calculate predictions. - problem_type: Either `ProblemType.CLASSIFICATION` or - `ProblemType.LINEAR_REGRESSION`. - predict_probabilities: A Python boolean, indicating whether probabilities - should be returned. Should only be set to `True` for - classification/logistic regression problems. - Returns: - A `dict` mapping strings to `Tensors`. - """ - with ops.name_scope('MultiValuePrediction'): - activations_shape = array_ops.shape(activations) - flattened_activations = array_ops.reshape(activations, - [-1, activations_shape[2]]) - prediction_dict = {} - if predict_probabilities: - flat_probabilities = target_column.logits_to_predictions( - flattened_activations, proba=True) - flat_predictions = math_ops.argmax(flat_probabilities, 1) - if target_column.num_label_columns == 1: - probability_shape = array_ops.concat([activations_shape[:2], [2]], 0) - else: - probability_shape = activations_shape - probabilities = array_ops.reshape( - flat_probabilities, probability_shape, - name=prediction_key.PredictionKey.PROBABILITIES) - prediction_dict[ - prediction_key.PredictionKey.PROBABILITIES] = probabilities - else: - flat_predictions = target_column.logits_to_predictions( - flattened_activations, proba=False) - predictions_name = (prediction_key.PredictionKey.CLASSES - if problem_type == constants.ProblemType.CLASSIFICATION - else prediction_key.PredictionKey.SCORES) - predictions = array_ops.reshape( - flat_predictions, [activations_shape[0], activations_shape[1]], - name=predictions_name) - prediction_dict[predictions_name] = predictions - return prediction_dict - - def _multi_value_loss( activations, labels, sequence_length, target_column, features): """Maps `activations` from the RNN to loss for multi value models. @@ -266,7 +153,7 @@ def _multi_value_loss( A scalar `Tensor` containing the loss. """ with ops.name_scope('MultiValueLoss'): - activations_masked, labels_masked = mask_activations_and_labels( + activations_masked, labels_masked = rnn_common.mask_activations_and_labels( activations, labels, sequence_length) return target_column.loss(activations_masked, labels_masked, features) @@ -343,7 +230,7 @@ def _prepare_features_for_sqss(features, labels, mode, # Add labels to the resulting sequence features dict. if mode != model_fn.ModeKeys.INFER: - sequence_features[RNNKeys.LABELS_KEY] = labels + sequence_features[rnn_common.RNNKeys.LABELS_KEY] = labels return sequence_features, context_features @@ -353,7 +240,7 @@ def _read_batch(cell, labels, mode, num_unroll, - num_layers, + num_rnn_layers, batch_size, sequence_feature_columns, context_feature_columns=None, @@ -373,7 +260,7 @@ def _read_batch(cell, num_unroll: Python integer, how many time steps to unroll at a time. The input sequences of length `k` are then split into `k / num_unroll` many segments. - num_layers: Python integer, number of layers in the RNN. + num_rnn_layers: Python integer, number of layers in the RNN. batch_size: Python integer, the size of the minibatch produced by the SQSS. sequence_feature_columns: An iterable containing all the feature columns describing sequence features. All items in the set should be instances @@ -399,8 +286,8 @@ def _read_batch(cell, # Set up stateful queue reader. states = {} - state_names = _get_lstm_state_names(num_layers) - for i in range(num_layers): + state_names = _get_lstm_state_names(num_rnn_layers) + for i in range(num_rnn_layers): states[state_names[i][0]] = array_ops.squeeze(values[i][0], axis=0) states[state_names[i][1]] = array_ops.squeeze(values[i][1], axis=0) @@ -423,36 +310,9 @@ def _read_batch(cell, capacity=queue_capacity) -def apply_dropout( - cell, input_keep_probability, output_keep_probability, random_seed=None): - """Apply dropout to the outputs and inputs of `cell`. - - Args: - cell: An `RNNCell`. - input_keep_probability: Probability to keep inputs to `cell`. If `None`, - no dropout is applied. - output_keep_probability: Probability to keep outputs of `cell`. If `None`, - no dropout is applied. - random_seed: Seed for random dropout. - - Returns: - An `RNNCell`, the result of applying the supplied dropouts to `cell`. - """ - input_prob_none = input_keep_probability is None - output_prob_none = output_keep_probability is None - if input_prob_none and output_prob_none: - return cell - if input_prob_none: - input_keep_probability = 1.0 - if output_prob_none: - output_keep_probability = 1.0 - return rnn_cell.DropoutWrapper( - cell, input_keep_probability, output_keep_probability, random_seed) - - def _get_state_name(i): """Constructs the name string for state component `i`.""" - return '{}_{}'.format(RNNKeys.STATE_PREFIX, i) + return '{}_{}'.format(rnn_common.RNNKeys.STATE_PREFIX, i) def state_tuple_to_dict(state): @@ -531,12 +391,12 @@ def _prepare_inputs_for_rnn(sequence_features, context_features, axis=1) -def _get_rnn_model_fn(cell, - target_column, +def _get_rnn_model_fn(target_column, problem_type, optimizer, num_unroll, - num_layers, + num_units, + num_rnn_layers, num_threads, queue_capacity, batch_size, @@ -545,14 +405,12 @@ def _get_rnn_model_fn(cell, predict_probabilities=False, learning_rate=None, gradient_clipping_norm=None, - input_keep_probability=None, - output_keep_probability=None, + dropout_keep_probabilities=None, name='StateSavingRNNModel', seed=None): """Creates a state saving RNN model function for an `Estimator`. Args: - cell: An initialized `RNNCell` to be used in the RNN. target_column: An initialized `TargetColumn`, used to calculate prediction and loss. problem_type: `ProblemType.CLASSIFICATION` or @@ -562,7 +420,8 @@ def _get_rnn_model_fn(cell, num_unroll: Python integer, how many time steps to unroll at a time. The input sequences of length `k` are then split into `k / num_unroll` many segments. - num_layers: Python integer, number of layers in the RNN. + num_units: The number of units in the `RNNCell`. + num_rnn_layers: Python integer, number of layers in the RNN. num_threads: The Python integer number of threads enqueuing input examples into a queue. queue_capacity: The max capacity of the queue in number of examples. @@ -583,10 +442,8 @@ def _get_rnn_model_fn(cell, learning_rate: Learning rate used for optimization. This argument has no effect if `optimizer` is an instance of an `Optimizer`. gradient_clipping_norm: A float. Gradients will be clipped to this value. - input_keep_probability: Probability to keep inputs to `cell`. If `None`, - no dropout is applied. - output_keep_probability: Probability to keep outputs of `cell`. If `None`, - no dropout is applied. + dropout_keep_probabilities: a list of dropout keep probabilities or `None`. + If given a list, it must have length `num_rnn_layers + 1`. name: A string that will be used to create a scope for the RNN. seed: Fixes the random seed used for generating input keys by the SQSS. @@ -618,19 +475,18 @@ def _get_rnn_model_fn(cell, def _rnn_model_fn(features, labels, mode): """The model to be passed to an `Estimator`.""" with ops.name_scope(name): - if mode == model_fn.ModeKeys.TRAIN: - cell_for_mode = apply_dropout( - cell, input_keep_probability, output_keep_probability) - else: - cell_for_mode = cell + dropout = (dropout_keep_probabilities + if mode == model_fn.ModeKeys.TRAIN + else None) + cell = lstm_cell(num_units, num_rnn_layers, dropout) batch = _read_batch( - cell=cell_for_mode, + cell=cell, features=features, labels=labels, mode=mode, num_unroll=num_unroll, - num_layers=num_layers, + num_rnn_layers=num_rnn_layers, batch_size=batch_size, sequence_feature_columns=sequence_feature_columns, context_feature_columns=context_feature_columns, @@ -640,22 +496,20 @@ def _get_rnn_model_fn(cell, sequence_features = batch.sequences context_features = batch.context if mode != model_fn.ModeKeys.INFER: - labels = sequence_features.pop(RNNKeys.LABELS_KEY) + labels = sequence_features.pop(rnn_common.RNNKeys.LABELS_KEY) inputs = _prepare_inputs_for_rnn(sequence_features, context_features, sequence_feature_columns, num_unroll) - state_name = _get_lstm_state_names(num_layers) + state_name = _get_lstm_state_names(num_rnn_layers) rnn_activations, final_state = construct_state_saving_rnn( - cell=cell_for_mode, + cell=cell, inputs=inputs, num_label_columns=target_column.num_label_columns, state_saver=batch, state_name=state_name) loss = None # Created below for modes TRAIN and EVAL. - prediction_dict = _multi_value_predictions(rnn_activations, - target_column, - problem_type, - predict_probabilities) + prediction_dict = rnn_common.multi_value_predictions( + rnn_activations, target_column, problem_type, predict_probabilities) if mode != model_fn.ModeKeys.INFER: loss = _multi_value_loss(rnn_activations, labels, batch.length, target_column, features) @@ -686,35 +540,41 @@ def _get_rnn_model_fn(cell, return _rnn_model_fn -def _get_lstm_state_names(num_layers): - """Returns a num_layers long list of lstm state name pairs. +def _get_lstm_state_names(num_rnn_layers): + """Returns a num_rnn_layers long list of lstm state name pairs. Args: - num_layers: The number of layers in the RNN. + num_rnn_layers: The number of layers in the RNN. Returns: - A num_layers long list of lstm state name pairs of the form: - ['lstm_state_cN', 'lstm_state_mN'] for all N from 0 to num_layers. + A num_rnn_layers long list of lstm state name pairs of the form: + ['lstm_state_cN', 'lstm_state_mN'] for all N from 0 to num_rnn_layers. """ return [['lstm_state_c' + str(i), 'lstm_state_m' + str(i)] - for i in range(num_layers)] + for i in range(num_rnn_layers)] # TODO(jtbates): Allow users to specify cell types other than LSTM. -def lstm_cell(num_units, num_layers): - """Constructs a `MultiRNNCell` with num_layers `BasicLSTMCell`s. +def lstm_cell(num_units, num_rnn_layers, dropout_keep_probabilities): + """Constructs a `MultiRNNCell` with num_rnn_layers `BasicLSTMCell`s. Args: num_units: The number of units in the `RNNCell`. - num_layers: The number of layers in the RNN. + num_rnn_layers: The number of layers in the RNN. + dropout_keep_probabilities: a list whose elements are either floats in + `[0.0, 1.0]` or `None`. It must have length `num_rnn_layers + 1`. Returns: An intiialized `MultiRNNCell`. """ - return rnn_cell.MultiRNNCell([ - rnn_cell.BasicLSTMCell( - num_units=num_units, state_is_tuple=True) for _ in range(num_layers) - ]) + + cells = [ + rnn_cell.BasicLSTMCell(num_units=num_units, state_is_tuple=True) + for _ in range(num_rnn_layers) + ] + if dropout_keep_probabilities: + cells = rnn_common.apply_dropout(cells, dropout_keep_probabilities) + return rnn_cell.MultiRNNCell(cells) class StateSavingRnnEstimator(estimator.Estimator): @@ -733,9 +593,7 @@ class StateSavingRnnEstimator(estimator.Estimator): predict_probabilities=False, momentum=None, gradient_clipping_norm=5.0, - # TODO(jtbates): Support lists of input_keep_probability. - input_keep_probability=None, - output_keep_probability=None, + dropout_keep_probabilities=None, model_dir=None, config=None, feature_engineering_fn=None, @@ -773,10 +631,8 @@ class StateSavingRnnEstimator(estimator.Estimator): momentum: Momentum value. Only used if `optimizer_type` is 'Momentum'. gradient_clipping_norm: Parameter used for gradient clipping. If `None`, then no clipping is performed. - input_keep_probability: Probability to keep inputs to `cell`. If `None`, - no dropout is applied. - output_keep_probability: Probability to keep outputs of `cell`. If `None`, - no dropout is applied. + dropout_keep_probabilities: a list of dropout keep probabilities or + `None`. If given a list, it must have length `num_rnn_layers + 1`. model_dir: The directory in which to save and restore the model graph, parameters, etc. config: A `RunConfig` instance. @@ -818,14 +674,13 @@ class StateSavingRnnEstimator(estimator.Estimator): if optimizer_type == 'Momentum': optimizer_type = momentum_opt.MomentumOptimizer(learning_rate, momentum) - cell = lstm_cell(num_units, num_rnn_layers) rnn_model_fn = _get_rnn_model_fn( - cell=cell, target_column=target_column, problem_type=problem_type, optimizer=optimizer_type, num_unroll=num_unroll, - num_layers=num_rnn_layers, + num_units=num_units, + num_rnn_layers=num_rnn_layers, num_threads=num_threads, queue_capacity=queue_capacity, batch_size=batch_size, @@ -834,8 +689,7 @@ class StateSavingRnnEstimator(estimator.Estimator): predict_probabilities=predict_probabilities, learning_rate=learning_rate, gradient_clipping_norm=gradient_clipping_norm, - input_keep_probability=input_keep_probability, - output_keep_probability=output_keep_probability, + dropout_keep_probabilities=dropout_keep_probabilities, name=name, seed=seed) @@ -858,8 +712,7 @@ def multi_value_rnn_regressor(num_units, learning_rate=0.1, momentum=None, gradient_clipping_norm=5.0, - input_keep_probability=None, - output_keep_probability=None, + dropout_keep_probabilities=None, model_dir=None, config=None, feature_engineering_fn=None, @@ -891,10 +744,8 @@ def multi_value_rnn_regressor(num_units, momentum: Momentum value. Only used if `optimizer_type` is 'Momentum'. gradient_clipping_norm: Parameter used for gradient clipping. If `None`, then no clipping is performed. - input_keep_probability: Probability to keep inputs to `cell`. If `None`, - no dropout is applied. - output_keep_probability: Probability to keep outputs of `cell`. If `None`, - no dropout is applied. + dropout_keep_probabilities: a list of dropout keep probabilities or `None`. + If given a list, it must have length `num_rnn_layers + 1`. model_dir: The directory in which to save and restore the model graph, parameters, etc. config: A `RunConfig` instance. @@ -926,8 +777,7 @@ def multi_value_rnn_regressor(num_units, predict_probabilities=False, momentum=momentum, gradient_clipping_norm=gradient_clipping_norm, - input_keep_probability=input_keep_probability, - output_keep_probability=output_keep_probability, + dropout_keep_probabilities=dropout_keep_probabilities, model_dir=model_dir, config=config, feature_engineering_fn=feature_engineering_fn, @@ -950,8 +800,7 @@ def multi_value_rnn_classifier(num_classes, predict_probabilities=False, momentum=None, gradient_clipping_norm=5.0, - input_keep_probability=None, - output_keep_probability=None, + dropout_keep_probabilities=None, model_dir=None, config=None, feature_engineering_fn=None, @@ -985,10 +834,8 @@ def multi_value_rnn_classifier(num_classes, momentum: Momentum value. Only used if `optimizer_type` is 'Momentum'. gradient_clipping_norm: Parameter used for gradient clipping. If `None`, then no clipping is performed. - input_keep_probability: Probability to keep inputs to `cell`. If `None`, - no dropout is applied. - output_keep_probability: Probability to keep outputs of `cell`. If `None`, - no dropout is applied. + dropout_keep_probabilities: a list of dropout keep probabilities or `None`. + If given a list, it must have length `num_rnn_layers + 1`. model_dir: The directory in which to save and restore the model graph, parameters, etc. config: A `RunConfig` instance. @@ -1020,8 +867,7 @@ def multi_value_rnn_classifier(num_classes, predict_probabilities=predict_probabilities, momentum=momentum, gradient_clipping_norm=gradient_clipping_norm, - input_keep_probability=input_keep_probability, - output_keep_probability=output_keep_probability, + dropout_keep_probabilities=dropout_keep_probabilities, model_dir=model_dir, config=config, feature_engineering_fn=feature_engineering_fn, diff --git a/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator_test.py b/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator_test.py index 4ad6c01fee..05fc6a89a4 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator_test.py @@ -34,6 +34,7 @@ from tensorflow.contrib.layers.python.layers import target_column as target_colu from tensorflow.contrib.learn.python.learn.estimators import constants from tensorflow.contrib.learn.python.learn.estimators import model_fn as model_fn_lib from tensorflow.contrib.learn.python.learn.estimators import prediction_key +from tensorflow.contrib.learn.python.learn.estimators import rnn_common from tensorflow.contrib.learn.python.learn.estimators import run_config from tensorflow.contrib.learn.python.learn.estimators import state_saving_rnn_estimator as ssre from tensorflow.python.framework import constant_op @@ -288,7 +289,7 @@ class StateSavingRnnEstimatorTest(test.TestCase): ] expected_sequence = { - ssre.RNNKeys.LABELS_KEY: + rnn_common.RNNKeys.LABELS_KEY: np.array([5., 5., 5., 5.]), seq_feature_name: np.array([1., 1., 1., 1.]), @@ -327,78 +328,24 @@ class StateSavingRnnEstimatorTest(test.TestCase): assert_equal(expected_sequence, actual_sequence) assert_equal(expected_context, actual_context) - def testMaskActivationsAndLabels(self): - """Test `mask_activations_and_labels`.""" - batch_size = 4 - padded_length = 6 - num_classes = 4 - np.random.seed(1234) - sequence_length = np.random.randint(0, padded_length + 1, batch_size) - activations = np.random.rand(batch_size, padded_length, num_classes) - labels = np.random.randint(0, num_classes, [batch_size, padded_length]) - (activations_masked_t, labels_masked_t) = ssre.mask_activations_and_labels( - constant_op.constant( - activations, dtype=dtypes.float32), - constant_op.constant( - labels, dtype=dtypes.int32), - constant_op.constant( - sequence_length, dtype=dtypes.int32)) - - with self.test_session() as sess: - activations_masked, labels_masked = sess.run( - [activations_masked_t, labels_masked_t]) - - expected_activations_shape = [sum(sequence_length), num_classes] - np.testing.assert_equal( - expected_activations_shape, activations_masked.shape, - 'Wrong activations shape. Expected {}; got {}.'.format( - expected_activations_shape, activations_masked.shape)) - - expected_labels_shape = [sum(sequence_length)] - np.testing.assert_equal(expected_labels_shape, labels_masked.shape, - 'Wrong labels shape. Expected {}; got {}.'.format( - expected_labels_shape, labels_masked.shape)) - masked_index = 0 - for i in range(batch_size): - for j in range(sequence_length[i]): - actual_activations = activations_masked[masked_index] - expected_activations = activations[i, j, :] - np.testing.assert_almost_equal( - expected_activations, - actual_activations, - err_msg='Unexpected logit value at index [{}, {}, :].' - ' Expected {}; got {}.'.format(i, j, expected_activations, - actual_activations)) - - actual_labels = labels_masked[masked_index] - expected_labels = labels[i, j] - np.testing.assert_almost_equal( - expected_labels, - actual_labels, - err_msg='Unexpected logit value at index [{}, {}].' - ' Expected {}; got {}.'.format(i, j, expected_labels, - actual_labels)) - masked_index += 1 - def _getModelFnOpsForMode(self, mode): """Helper for testGetRnnModelFn{Train,Eval,Infer}().""" - cell_size = 4 - num_layers = 1 - cell = ssre.lstm_cell(cell_size, num_layers) + num_units = 4 + num_rnn_layers = 1 seq_columns = [ feature_column.real_valued_column( - 'inputs', dimension=cell_size) + 'inputs', dimension=num_units) ] features = { 'inputs': constant_op.constant([1., 2., 3.]), } labels = constant_op.constant([1., 0., 1.]) model_fn = ssre._get_rnn_model_fn( - cell=cell, target_column=target_column_lib.multi_class_target(n_classes=2), optimizer='SGD', num_unroll=2, - num_layers=num_layers, + num_units=num_units, + num_rnn_layers=num_rnn_layers, num_threads=1, queue_capacity=10, batch_size=1, @@ -578,6 +525,7 @@ class StateSavingRNNEstimatorLearningTest(test.TestCase): train_steps = 250 eval_steps = 20 num_units = 4 + num_rnn_layers = 1 learning_rate = 0.3 loss_threshold = 0.035 @@ -600,15 +548,16 @@ class StateSavingRNNEstimatorLearningTest(test.TestCase): 'inputs', dimension=num_units) ] config = run_config.RunConfig(tf_random_seed=1234) + dropout_keep_probabilities = [0.9] * (num_rnn_layers + 1) sequence_estimator = ssre.StateSavingRnnEstimator( constants.ProblemType.LINEAR_REGRESSION, num_units=num_units, + num_rnn_layers=num_rnn_layers, num_unroll=num_unroll, batch_size=batch_size, sequence_feature_columns=seq_columns, learning_rate=learning_rate, - input_keep_probability=0.9, - output_keep_probability=0.9, + dropout_keep_probabilities=dropout_keep_probabilities, config=config, queue_capacity=2 * batch_size, seed=1234) -- GitLab From efc8f98d45df835bac2373e19f1da57e3a1ea2d0 Mon Sep 17 00:00:00 2001 From: Jacques Pienaar Date: Mon, 27 Feb 2017 15:05:10 -0800 Subject: [PATCH 024/101] [XLA] Add basic outfeed support. Change: 148699787 --- tensorflow/compiler/xla/client/client.cc | 32 ++++++++++++ tensorflow/compiler/xla/client/client.h | 9 ++++ .../xla/client/computation_builder.cc | 2 + .../compiler/xla/client/computation_builder.h | 6 +-- .../xla/service/generic_transfer_manager.cc | 6 +++ .../xla/service/generic_transfer_manager.h | 4 ++ .../compiler/xla/service/hlo_instruction.cc | 10 +++- .../compiler/xla/service/hlo_instruction.h | 10 +++- .../compiler/xla/service/layout_assignment.cc | 9 +++- tensorflow/compiler/xla/service/service.cc | 49 +++++++++++++------ tensorflow/compiler/xla/service/service.h | 6 +++ .../compiler/xla/service/transfer_manager.h | 6 +++ .../compiler/xla/service/user_computation.cc | 16 ++++-- tensorflow/compiler/xla/service_interface.h | 4 ++ tensorflow/compiler/xla/xla.proto | 15 +++++- tensorflow/compiler/xla/xla_data.proto | 3 ++ 16 files changed, 160 insertions(+), 27 deletions(-) diff --git a/tensorflow/compiler/xla/client/client.cc b/tensorflow/compiler/xla/client/client.cc index 341c02f1a1..c4430dab65 100644 --- a/tensorflow/compiler/xla/client/client.cc +++ b/tensorflow/compiler/xla/client/client.cc @@ -132,6 +132,38 @@ Status Client::TransferToInfeed(const Literal& literal, int64 replica_id, return Status::OK(); } +StatusOr> Client::TransferFromOutfeed( + const Shape* shape_with_layout, int64 replica_id, + const DeviceHandle* device_handle) { + TransferFromOutfeedRequest request; + if (device_handle) { + *request.mutable_device_handle() = *device_handle; + } + request.set_replica_id(replica_id); + if (shape_with_layout != nullptr) { + *request.mutable_shape_with_layout() = *shape_with_layout; + } + TransferFromOutfeedResponse response; + + VLOG(1) << "making transfer from outfeed request"; + VLOG(3) << "TransferFromOutfeedRequest: {" << request.DebugString() << "}"; + Status s = stub_->TransferFromOutfeed(&request, &response); + VLOG(1) << "done with request"; + + if (!s.ok()) { + return s; + } + VLOG(3) << "TransferFromOutfeedResponse: {" << response.DebugString() << "}"; + + if (!response.has_literal()) { + return FailedPrecondition( + "server provided response without a literal in " + "TransferToClient request"); + } + + return WrapUnique(response.release_literal()); +} + Status Client::ResetDevice() { ResetDeviceRequest request; ResetDeviceResponse response; diff --git a/tensorflow/compiler/xla/client/client.h b/tensorflow/compiler/xla/client/client.h index f261de9d0d..ea166acc91 100644 --- a/tensorflow/compiler/xla/client/client.h +++ b/tensorflow/compiler/xla/client/client.h @@ -119,6 +119,15 @@ class Client { Status TransferToInfeed(const Literal& literal, int64 replica_id = 0, const DeviceHandle* device_handle = nullptr); + // Transfers from the Outfeed of the device. + // + // device_handle and replica_id together specify a particular device; a device + // assigned for the given replica_id among the replicas that the given device + // handle belongs to. + StatusOr> TransferFromOutfeed( + const Shape* shape_with_layout, int64 replica_id = 0, + const DeviceHandle* device_handle = nullptr); + // Resets the device, clearing all existing state on the device. Status ResetDevice(); diff --git a/tensorflow/compiler/xla/client/computation_builder.cc b/tensorflow/compiler/xla/client/computation_builder.cc index c4c91b7ea8..ae7695ade5 100644 --- a/tensorflow/compiler/xla/client/computation_builder.cc +++ b/tensorflow/compiler/xla/client/computation_builder.cc @@ -786,6 +786,7 @@ ComputationDataHandle ComputationBuilder::Infeed(const Shape& shape, } void ComputationBuilder::Outfeed(const ComputationDataHandle& operand, + const Shape& shape, const string& outfeed_config) { if (!first_error_.ok() || !PrepareComputation().ok()) { return; @@ -794,6 +795,7 @@ void ComputationBuilder::Outfeed(const ComputationDataHandle& operand, OutfeedRequest request; request.set_outfeed_config(outfeed_config); *request.mutable_operand() = operand; + *request.mutable_shape() = shape; OpRequest op_request; *op_request.mutable_outfeed_request() = request; *op_request.mutable_computation() = computation_.handle(); diff --git a/tensorflow/compiler/xla/client/computation_builder.h b/tensorflow/compiler/xla/client/computation_builder.h index b1a68e3687..a49e5a8843 100644 --- a/tensorflow/compiler/xla/client/computation_builder.h +++ b/tensorflow/compiler/xla/client/computation_builder.h @@ -352,13 +352,13 @@ class ComputationBuilder { tensorflow::gtl::ArraySlice rhs_dilation, const ConvolutionDimensionNumbers& dimension_numbers); - // Enqueues an infeed instruction onto the computation, which reads data of - // the given shape from the infeed buffer of the device. + // Enqueues an infeed instruction onto the computation, which writes data of + // the given shape to the infeed buffer of the device. ComputationDataHandle Infeed(const Shape& shape, const string& config = ""); // Enqueues an outfeed instruction onto the computation. This instruction // generates outgoing data transfers for the given data. - void Outfeed(const ComputationDataHandle& operand, + void Outfeed(const ComputationDataHandle& operand, const Shape& shape, const string& outfeed_config); // Enqueues a call instruction onto the computation. diff --git a/tensorflow/compiler/xla/service/generic_transfer_manager.cc b/tensorflow/compiler/xla/service/generic_transfer_manager.cc index 8f39ba8b1d..aa512f242a 100644 --- a/tensorflow/compiler/xla/service/generic_transfer_manager.cc +++ b/tensorflow/compiler/xla/service/generic_transfer_manager.cc @@ -162,6 +162,12 @@ Status GenericTransferManager::TransferLiteralToInfeed( return Unimplemented("Infeed is not supported on GPU (b/30467474)"); } +Status GenericTransferManager::TransferLiteralFromOutfeed( + perftools::gputools::StreamExecutor* executor, const Shape& literal_shape, + Literal* literal) { + return Unimplemented("Outfeed is not supported on CPU/GPU (b/30467474)"); +} + Status GenericTransferManager::ResetDevices( tensorflow::gtl::ArraySlice executors) { diff --git a/tensorflow/compiler/xla/service/generic_transfer_manager.h b/tensorflow/compiler/xla/service/generic_transfer_manager.h index 06819d65c7..2fbdb94f06 100644 --- a/tensorflow/compiler/xla/service/generic_transfer_manager.h +++ b/tensorflow/compiler/xla/service/generic_transfer_manager.h @@ -55,6 +55,10 @@ class GenericTransferManager : public TransferManager { Status TransferLiteralToInfeed(perftools::gputools::StreamExecutor* executor, const Literal& literal) override; + Status TransferLiteralFromOutfeed( + perftools::gputools::StreamExecutor* executor, const Shape& literal_shape, + Literal* literal) override; + Status ResetDevices( tensorflow::gtl::ArraySlice executors) override; diff --git a/tensorflow/compiler/xla/service/hlo_instruction.cc b/tensorflow/compiler/xla/service/hlo_instruction.cc index b5438865cb..9951f59911 100644 --- a/tensorflow/compiler/xla/service/hlo_instruction.cc +++ b/tensorflow/compiler/xla/service/hlo_instruction.cc @@ -236,11 +236,13 @@ HloInstruction::CreateCrossReplicaSum(const Shape& shape, } /* static */ std::unique_ptr HloInstruction::CreateOutfeed( - HloInstruction* operand, tensorflow::StringPiece outfeed_config) { + const Shape& shape, HloInstruction* operand, + tensorflow::StringPiece outfeed_config) { std::unique_ptr instruction = WrapUnique(new HloInstruction(HloOpcode::kOutfeed, ShapeUtil::MakeNil())); instruction->AppendOperand(operand); instruction->outfeed_config_ = outfeed_config.ToString(); + instruction->outfeed_shape_ = shape; return instruction; } @@ -1852,6 +1854,12 @@ Status HloInstruction::AcceptOrdered( return visitor->FinishVisit(this); } +const Shape& HloInstruction::outfeed_shape() const { + DCHECK_EQ(opcode_, HloOpcode::kOutfeed); + TF_DCHECK_OK(ShapeUtil::ValidateShapeWithOptionalLayout(shape_)); + return outfeed_shape_; +} + const Shape& HloInstruction::shape() const { TF_DCHECK_OK(ShapeUtil::ValidateShapeWithOptionalLayout(shape_)); return shape_; diff --git a/tensorflow/compiler/xla/service/hlo_instruction.h b/tensorflow/compiler/xla/service/hlo_instruction.h index bafb402e9d..fbde4681af 100644 --- a/tensorflow/compiler/xla/service/hlo_instruction.h +++ b/tensorflow/compiler/xla/service/hlo_instruction.h @@ -137,7 +137,8 @@ class HloInstruction { // Creates an outfeed instruction, which outputs data. static std::unique_ptr CreateOutfeed( - HloInstruction* operand, tensorflow::StringPiece outfeed_config); + const Shape& shape, HloInstruction* operand, + tensorflow::StringPiece outfeed_config); // Creates a send instruction with the given channel id, which sends the // operand data to a unique receive instruction in another computation that @@ -428,6 +429,10 @@ class HloInstruction { // Precondition: opcode() == HloOpcode::kOutfeed const string& outfeed_config() const; + // Returns the shape for the Outfeed instruction. + // Precondition: opcode() == HloOpcode::kOutfeed + const Shape& outfeed_shape() const; + // Gets/sets the while_condition or while_body HloComputation for While. The // setters should only be called by HloModule or HloComputation methods. // @@ -727,6 +732,9 @@ class HloInstruction { // Returns how this instruction uses elements of its `i`th operand. UseKind OperandElementUse(int64 i) const; + // Shape of outfeed request. + Shape outfeed_shape_; + // Result shape of this instruction. Shape shape_; diff --git a/tensorflow/compiler/xla/service/layout_assignment.cc b/tensorflow/compiler/xla/service/layout_assignment.cc index a350acc4da..6270960b34 100644 --- a/tensorflow/compiler/xla/service/layout_assignment.cc +++ b/tensorflow/compiler/xla/service/layout_assignment.cc @@ -298,8 +298,8 @@ string LayoutConstraints::ToString() const { for (int64 i = 0; i < instruction->operand_count(); ++i) { if (OperandLayout(instruction, i) != nullptr) { tensorflow::strings::StrAppend( - &output, " operand (", i, "): ", - OperandLayout(instruction, i)->ToString(), "\n"); + &output, " operand (", i, + "): ", OperandLayout(instruction, i)->ToString(), "\n"); } } for (const LogicalBuffer* buffer : @@ -338,6 +338,11 @@ Status LayoutAssignment::AddMandatoryConstraints( // TODO(b/31425034): Change infeeds to be more like parameters, with // shapes in the ComputationLayout. shape_with_layout = &instruction->shape(); + } else if (instruction->opcode() == HloOpcode::kOutfeed) { + // Constrain the input to the Outfeed instruction to be the expected + // layout of the Outfeed. + TF_RETURN_IF_ERROR(constraints->SetOperandLayout( + instruction->outfeed_shape(), instruction.get(), 0)); } else if (instruction->opcode() == HloOpcode::kParameter) { // Parameter layouts must match the respective layout in // ComputationLayout. diff --git a/tensorflow/compiler/xla/service/service.cc b/tensorflow/compiler/xla/service/service.cc index 5b6a4b1e15..249e31cf26 100644 --- a/tensorflow/compiler/xla/service/service.cc +++ b/tensorflow/compiler/xla/service/service.cc @@ -587,9 +587,8 @@ StatusOr Service::ExecuteAndRegisterResult( tensorflow::gtl::ArraySlice> repeated_arguments(backend->Replicas().size(), arguments); - TF_ASSIGN_OR_RETURN( - auto results, - executable->ExecuteOnStreams(run_options, repeated_arguments)); + TF_ASSIGN_OR_RETURN(auto results, executable->ExecuteOnStreams( + run_options, repeated_arguments)); TF_RET_CHECK(!results.empty()); result = results[0]; } @@ -927,9 +926,8 @@ tensorflow::Status Service::TransferToServer(const TransferToServerRequest* arg, se::StreamExecutor* stream_executor; if (arg->has_device_handle()) { - TF_ASSIGN_OR_RETURN( - stream_executor, - execute_backend_->stream_executor(arg->device_handle().handle())); + TF_ASSIGN_OR_RETURN(stream_executor, execute_backend_->stream_executor( + arg->device_handle().handle())); } else { stream_executor = execute_backend_->default_stream_executor(); } @@ -948,9 +946,8 @@ tensorflow::Status Service::TransferToServer(const TransferToServerRequest* arg, execute_backend_.get(), stream_executor->device_ordinal(), allocation, shape, StrCat("TransferToServer literal of size ", allocation_size)); - TF_ASSIGN_OR_RETURN( - auto replicas, - execute_backend_->Replicas(stream_executor->device_ordinal())); + TF_ASSIGN_OR_RETURN(auto replicas, execute_backend_->Replicas( + stream_executor->device_ordinal())); for (se::StreamExecutor* executor : replicas) { TF_RETURN_IF_ERROR( execute_backend_->transfer_manager()->TransferLiteralToDevice( @@ -973,9 +970,8 @@ tensorflow::Status Service::TransferToInfeed(const TransferToInfeedRequest* arg, se::StreamExecutor* executor; if (arg->has_device_handle()) { - TF_ASSIGN_OR_RETURN( - auto replicas, - execute_backend_->Replicas(arg->device_handle().handle())); + TF_ASSIGN_OR_RETURN(auto replicas, execute_backend_->Replicas( + arg->device_handle().handle())); executor = replicas[arg->replica_id()]; } else { executor = execute_backend_->Replicas()[arg->replica_id()]; @@ -985,6 +981,30 @@ tensorflow::Status Service::TransferToInfeed(const TransferToInfeedRequest* arg, executor, arg->literal()); } +tensorflow::Status Service::TransferFromOutfeed( + const TransferFromOutfeedRequest* arg, + TransferFromOutfeedResponse* result) { + const int64 replica_count = execute_backend_->Replicas().size(); + if (arg->replica_id() < 0 || arg->replica_id() >= replica_count) { + return FailedPrecondition( + "The replica_id=%lld on TransferFromOutfeedRequest not in range [0, " + "%lld)", + arg->replica_id(), replica_count); + } + + se::StreamExecutor* executor; + if (arg->has_device_handle()) { + TF_ASSIGN_OR_RETURN(auto replicas, execute_backend_->Replicas( + arg->device_handle().handle())); + executor = replicas[arg->replica_id()]; + } else { + executor = execute_backend_->Replicas()[arg->replica_id()]; + } + + return execute_backend_->transfer_manager()->TransferLiteralFromOutfeed( + executor, arg->shape_with_layout(), result->mutable_literal()); +} + tensorflow::Status Service::ResetDevice(const ResetDeviceRequest* arg, ResetDeviceResponse* result) { return execute_backend_->ResetDevices(); @@ -1151,9 +1171,8 @@ tensorflow::Status Service::GetComputationShape( VersionedComputationHandle versioned_handle = computation->GetVersionedHandle(); - TF_ASSIGN_OR_RETURN( - auto program_shape, - computation->ComputeProgramShape(versioned_handle.version)); + TF_ASSIGN_OR_RETURN(auto program_shape, computation->ComputeProgramShape( + versioned_handle.version)); *result->mutable_program_shape() = *program_shape; return tensorflow::Status::OK(); } diff --git a/tensorflow/compiler/xla/service/service.h b/tensorflow/compiler/xla/service/service.h index ba609fe881..ce07489fe0 100644 --- a/tensorflow/compiler/xla/service/service.h +++ b/tensorflow/compiler/xla/service/service.h @@ -162,6 +162,12 @@ class Service : public ServiceInterface { const TransferToInfeedRequest* arg, TransferToInfeedResponse* result) override; + // Transfers data from the Outfeed othe device to the literal provided by the + // client. + tensorflow::Status TransferFromOutfeed( + const TransferFromOutfeedRequest* arg, + TransferFromOutfeedResponse* result) override; + // Resets devices, clearing all existing state on all the devices associated // with this service (including memory allocated on the devices). // diff --git a/tensorflow/compiler/xla/service/transfer_manager.h b/tensorflow/compiler/xla/service/transfer_manager.h index 7ffce45213..83e893a14a 100644 --- a/tensorflow/compiler/xla/service/transfer_manager.h +++ b/tensorflow/compiler/xla/service/transfer_manager.h @@ -64,6 +64,12 @@ class TransferManager { perftools::gputools::StreamExecutor* executor, const Literal& literal) = 0; + // Transfers the given literal from the Outfeed interface of the device, + // using the given executor. + virtual Status TransferLiteralFromOutfeed( + perftools::gputools::StreamExecutor* executor, const Shape& literal_shape, + Literal* literal) = 0; + // Resets the devices associated with this transfer manager. virtual Status ResetDevices( tensorflow::gtl::ArraySlice diff --git a/tensorflow/compiler/xla/service/user_computation.cc b/tensorflow/compiler/xla/service/user_computation.cc index 7fde1945a5..79e44cb67a 100644 --- a/tensorflow/compiler/xla/service/user_computation.cc +++ b/tensorflow/compiler/xla/service/user_computation.cc @@ -891,6 +891,14 @@ Status UserComputation::AddOutfeedInstruction( const OutfeedRequest& outfeed_request) { tensorflow::mutex_lock lock(mutex_); + const Shape& shape = outfeed_request.shape(); + if (ShapeUtil::IsNestedTuple(shape)) { + return InvalidArgument("Outfeed does not support nested tuple shapes"); + } + if (!LayoutUtil::HasLayout(shape)) { + return InvalidArgument("Given shape to Outfeed must have a layout"); + } + // Verify that operand is valid. TF_RETURN_IF_ERROR(LookUpRequest(outfeed_request.operand()).status()); @@ -900,7 +908,7 @@ Status UserComputation::AddOutfeedInstruction( OperationRequest& request = (*session_computation_.mutable_requests())[handle.handle()]; *request.mutable_output_handle() = handle; - *request.mutable_output_shape() = ShapeUtil::MakeNil(); + *request.mutable_output_shape() = shape; *request.mutable_request()->mutable_outfeed_request() = outfeed_request; VLOG(1) << "AddOutfeedInstruction (" << GetVersionedHandleInternal() @@ -1991,9 +1999,9 @@ HloInstruction* ComputationLowerer::Visit( const OutfeedRequest& outfeed_request = request.request().outfeed_request(); HloInstruction* operand = Visit(outfeed_request.operand(), visited); - hlo_instruction = - hlo_builder_.AddInstruction(HloInstruction::CreateOutfeed( - operand, outfeed_request.outfeed_config())); + hlo_instruction = hlo_builder_.AddInstruction( + HloInstruction::CreateOutfeed(outfeed_request.shape(), operand, + outfeed_request.outfeed_config())); break; } diff --git a/tensorflow/compiler/xla/service_interface.h b/tensorflow/compiler/xla/service_interface.h index fc107480f7..2159386152 100644 --- a/tensorflow/compiler/xla/service_interface.h +++ b/tensorflow/compiler/xla/service_interface.h @@ -41,6 +41,10 @@ class ServiceInterface { virtual tensorflow::Status TransferToInfeed( const TransferToInfeedRequest* arg, TransferToInfeedResponse* result) = 0; + virtual tensorflow::Status TransferFromOutfeed( + const TransferFromOutfeedRequest* arg, + TransferFromOutfeedResponse* result) = 0; + virtual tensorflow::Status ResetDevice(const ResetDeviceRequest* arg, ResetDeviceResponse* result) = 0; diff --git a/tensorflow/compiler/xla/xla.proto b/tensorflow/compiler/xla/xla.proto index b9d82c557b..57f557c458 100644 --- a/tensorflow/compiler/xla/xla.proto +++ b/tensorflow/compiler/xla/xla.proto @@ -76,7 +76,7 @@ message TransferToClientRequest { GlobalDataHandle data = 1; // This optional field directs the service to return the literal in this - // layout. A shape is used to hold the layout to accomodate tuples. + // layout. A shape is used to hold the layout to accommodate tuples. Shape shape_with_layout = 2; } @@ -119,6 +119,19 @@ message TransferToInfeedRequest { message TransferToInfeedResponse { } +message TransferFromOutfeedRequest { + // This optional field directs the service to return the literal in this + // layout. A shape is used to hold the layout to accommodate tuples. + Shape shape_with_layout = 1; + + int64 replica_id = 2; + DeviceHandle device_handle = 3; +} + +message TransferFromOutfeedResponse { + Literal literal = 1; +} + message ResetDeviceRequest { DeviceHandle device_handle = 1; } diff --git a/tensorflow/compiler/xla/xla_data.proto b/tensorflow/compiler/xla/xla_data.proto index 99a9ba3ee0..7786c46f4c 100644 --- a/tensorflow/compiler/xla/xla_data.proto +++ b/tensorflow/compiler/xla/xla_data.proto @@ -386,6 +386,9 @@ message InfeedRequest { } message OutfeedRequest { + // The shape of the data returned by reading the device's outfeed buffer. + Shape shape = 1; + // Operand to the Outfeed. Supports tuple. ComputationDataHandle operand = 2; -- GitLab From 9a469226167de978d887b88a027bebc39070d454 Mon Sep 17 00:00:00 2001 From: Dumitru Erhan Date: Mon, 27 Feb 2017 15:12:27 -0800 Subject: [PATCH 025/101] Adding a mean per-class accuracy metric. Change: 148700711 --- .../python/kernel_tests/metrics_test.py | 240 ++++++++++++++++++ tensorflow/python/ops/metrics.py | 1 + tensorflow/python/ops/metrics_impl.py | 158 ++++++++++-- 3 files changed, 374 insertions(+), 25 deletions(-) diff --git a/tensorflow/python/kernel_tests/metrics_test.py b/tensorflow/python/kernel_tests/metrics_test.py index 91b3a88feb..931f7ec2d0 100644 --- a/tensorflow/python/kernel_tests/metrics_test.py +++ b/tensorflow/python/kernel_tests/metrics_test.py @@ -3405,5 +3405,245 @@ class MeanIOUTest(test.TestCase): self.assertAlmostEqual(desired_miou, miou.eval()) +class MeanPerClassAccuracyTest(test.TestCase): + + def setUp(self): + np.random.seed(1) + ops.reset_default_graph() + + def testVars(self): + metrics.mean_per_class_accuracy( + predictions=array_ops.ones([10, 1]), + labels=array_ops.ones([10, 1]), + num_classes=2) + _assert_local_variables(self, ('mean_accuracy/total_confusion_matrix:0',)) + + def testMetricsCollections(self): + my_collection_name = '__metrics__' + mean_accuracy, _ = metrics.mean_per_class_accuracy( + predictions=array_ops.ones([10, 1]), + labels=array_ops.ones([10, 1]), + num_classes=2, + metrics_collections=[my_collection_name]) + self.assertListEqual( + ops.get_collection(my_collection_name), [mean_accuracy]) + + def testUpdatesCollection(self): + my_collection_name = '__updates__' + _, update_op = metrics.mean_per_class_accuracy( + predictions=array_ops.ones([10, 1]), + labels=array_ops.ones([10, 1]), + num_classes=2, + updates_collections=[my_collection_name]) + self.assertListEqual(ops.get_collection(my_collection_name), [update_op]) + + def testPredictionsAndLabelsOfDifferentSizeRaisesValueError(self): + predictions = array_ops.ones([10, 3]) + labels = array_ops.ones([10, 4]) + with self.assertRaises(ValueError): + metrics.mean_per_class_accuracy(labels, predictions, num_classes=2) + + def testLabelsAndWeightsOfDifferentSizeRaisesValueError(self): + predictions = array_ops.ones([10]) + labels = array_ops.ones([10]) + weights = array_ops.zeros([9]) + with self.assertRaises(ValueError): + metrics.mean_per_class_accuracy( + labels, predictions, num_classes=2, weights=weights) + + def testValueTensorIsIdempotent(self): + num_classes = 3 + predictions = random_ops.random_uniform( + [10], maxval=num_classes, dtype=dtypes_lib.int64, seed=1) + labels = random_ops.random_uniform( + [10], maxval=num_classes, dtype=dtypes_lib.int64, seed=1) + mean_accuracy, update_op = metrics.mean_per_class_accuracy( + labels, predictions, num_classes=num_classes) + + with self.test_session() as sess: + sess.run(variables.local_variables_initializer()) + + # Run several updates. + for _ in range(10): + sess.run(update_op) + + # Then verify idempotency. + initial_mean_accuracy = mean_accuracy.eval() + for _ in range(10): + self.assertEqual(initial_mean_accuracy, mean_accuracy.eval()) + + num_classes = 3 + with self.test_session() as sess: + # Create the queue that populates the predictions. + preds_queue = data_flow_ops.FIFOQueue( + 5, dtypes=dtypes_lib.int32, shapes=(1, 1)) + _enqueue_vector(sess, preds_queue, [0]) + _enqueue_vector(sess, preds_queue, [1]) + _enqueue_vector(sess, preds_queue, [2]) + _enqueue_vector(sess, preds_queue, [1]) + _enqueue_vector(sess, preds_queue, [0]) + predictions = preds_queue.dequeue() + + # Create the queue that populates the labels. + labels_queue = data_flow_ops.FIFOQueue( + 5, dtypes=dtypes_lib.int32, shapes=(1, 1)) + _enqueue_vector(sess, labels_queue, [0]) + _enqueue_vector(sess, labels_queue, [1]) + _enqueue_vector(sess, labels_queue, [1]) + _enqueue_vector(sess, labels_queue, [2]) + _enqueue_vector(sess, labels_queue, [1]) + labels = labels_queue.dequeue() + + mean_accuracy, update_op = metrics.mean_per_class_accuracy( + labels, predictions, num_classes) + + sess.run(variables.local_variables_initializer()) + for _ in range(5): + sess.run(update_op) + desired_output = np.mean([1.0, 1.0 / 3.0, 0.0]) + self.assertAlmostEqual(desired_output, mean_accuracy.eval()) + + def testMultipleUpdatesWithWeights(self): + num_classes = 2 + with self.test_session() as sess: + # Create the queue that populates the predictions. + preds_queue = data_flow_ops.FIFOQueue( + 6, dtypes=dtypes_lib.int32, shapes=(1, 1)) + _enqueue_vector(sess, preds_queue, [0]) + _enqueue_vector(sess, preds_queue, [1]) + _enqueue_vector(sess, preds_queue, [0]) + _enqueue_vector(sess, preds_queue, [1]) + _enqueue_vector(sess, preds_queue, [0]) + _enqueue_vector(sess, preds_queue, [1]) + predictions = preds_queue.dequeue() + + # Create the queue that populates the labels. + labels_queue = data_flow_ops.FIFOQueue( + 6, dtypes=dtypes_lib.int32, shapes=(1, 1)) + _enqueue_vector(sess, labels_queue, [0]) + _enqueue_vector(sess, labels_queue, [1]) + _enqueue_vector(sess, labels_queue, [1]) + _enqueue_vector(sess, labels_queue, [0]) + _enqueue_vector(sess, labels_queue, [0]) + _enqueue_vector(sess, labels_queue, [1]) + labels = labels_queue.dequeue() + + # Create the queue that populates the weights. + weights_queue = data_flow_ops.FIFOQueue( + 6, dtypes=dtypes_lib.float32, shapes=(1, 1)) + _enqueue_vector(sess, weights_queue, [1.0]) + _enqueue_vector(sess, weights_queue, [1.0]) + _enqueue_vector(sess, weights_queue, [1.0]) + _enqueue_vector(sess, weights_queue, [0.0]) + _enqueue_vector(sess, weights_queue, [1.0]) + _enqueue_vector(sess, weights_queue, [0.0]) + weights = weights_queue.dequeue() + + mean_accuracy, update_op = metrics.mean_per_class_accuracy( + labels, predictions, num_classes, weights=weights) + + variables.local_variables_initializer().run() + for _ in range(6): + sess.run(update_op) + desired_output = np.mean([2.0 / 2.0, 1.0 / 2.0]) + self.assertAlmostEqual(desired_output, mean_accuracy.eval()) + + def testMultipleUpdatesWithMissingClass(self): + # Test the case where there are no predicions and labels for + # one class, and thus there is one row and one column with + # zero entries in the confusion matrix. + num_classes = 3 + with self.test_session() as sess: + # Create the queue that populates the predictions. + # There is no prediction for class 2. + preds_queue = data_flow_ops.FIFOQueue( + 5, dtypes=dtypes_lib.int32, shapes=(1, 1)) + _enqueue_vector(sess, preds_queue, [0]) + _enqueue_vector(sess, preds_queue, [1]) + _enqueue_vector(sess, preds_queue, [1]) + _enqueue_vector(sess, preds_queue, [1]) + _enqueue_vector(sess, preds_queue, [0]) + predictions = preds_queue.dequeue() + + # Create the queue that populates the labels. + # There is label for class 2. + labels_queue = data_flow_ops.FIFOQueue( + 5, dtypes=dtypes_lib.int32, shapes=(1, 1)) + _enqueue_vector(sess, labels_queue, [0]) + _enqueue_vector(sess, labels_queue, [1]) + _enqueue_vector(sess, labels_queue, [1]) + _enqueue_vector(sess, labels_queue, [0]) + _enqueue_vector(sess, labels_queue, [1]) + labels = labels_queue.dequeue() + + mean_accuracy, update_op = metrics.mean_per_class_accuracy( + labels, predictions, num_classes) + + sess.run(variables.local_variables_initializer()) + for _ in range(5): + sess.run(update_op) + desired_output = np.mean([1.0 / 2.0, 2.0 / 3.0, 0.]) + self.assertAlmostEqual(desired_output, mean_accuracy.eval()) + + def testUpdateOpEvalIsAccumulatedConfusionMatrix(self): + predictions = array_ops.concat([ + constant_op.constant(0, shape=[5]), constant_op.constant(1, shape=[5]) + ], 0) + labels = array_ops.concat([ + constant_op.constant(0, shape=[3]), constant_op.constant(1, shape=[7]) + ], 0) + num_classes = 2 + with self.test_session() as sess: + mean_accuracy, update_op = metrics.mean_per_class_accuracy( + labels, predictions, num_classes) + sess.run(variables.local_variables_initializer()) + confusion_matrix = update_op.eval() + self.assertAllEqual([[3, 0], [2, 5]], confusion_matrix) + desired_mean_accuracy = np.mean([3. / 3., 5. / 7.]) + self.assertAlmostEqual(desired_mean_accuracy, mean_accuracy.eval()) + + def testAllCorrect(self): + predictions = array_ops.zeros([40]) + labels = array_ops.zeros([40]) + num_classes = 1 + with self.test_session() as sess: + mean_accuracy, update_op = metrics.mean_per_class_accuracy( + labels, predictions, num_classes) + sess.run(variables.local_variables_initializer()) + self.assertEqual(40, update_op.eval()[0]) + self.assertEqual(1.0, mean_accuracy.eval()) + + def testAllWrong(self): + predictions = array_ops.zeros([40]) + labels = array_ops.ones([40]) + num_classes = 2 + with self.test_session() as sess: + mean_accuracy, update_op = metrics.mean_per_class_accuracy( + labels, predictions, num_classes) + sess.run(variables.local_variables_initializer()) + self.assertAllEqual([[0, 0], [40, 0]], update_op.eval()) + self.assertEqual(0., mean_accuracy.eval()) + + def testResultsWithSomeMissing(self): + predictions = array_ops.concat([ + constant_op.constant(0, shape=[5]), constant_op.constant(1, shape=[5]) + ], 0) + labels = array_ops.concat([ + constant_op.constant(0, shape=[3]), constant_op.constant(1, shape=[7]) + ], 0) + num_classes = 2 + weights = array_ops.concat([ + constant_op.constant(0, shape=[1]), constant_op.constant(1, shape=[8]), + constant_op.constant(0, shape=[1]) + ], 0) + with self.test_session() as sess: + mean_accuracy, update_op = metrics.mean_per_class_accuracy( + labels, predictions, num_classes, weights=weights) + sess.run(variables.local_variables_initializer()) + self.assertAllEqual([[2, 0], [2, 4]], update_op.eval()) + desired_mean_accuracy = np.mean([2. / 2., 4. / 6.]) + self.assertAlmostEqual(desired_mean_accuracy, mean_accuracy.eval()) + + if __name__ == '__main__': test.main() diff --git a/tensorflow/python/ops/metrics.py b/tensorflow/python/ops/metrics.py index bc2eaa506f..f504a46178 100644 --- a/tensorflow/python/ops/metrics.py +++ b/tensorflow/python/ops/metrics.py @@ -23,6 +23,7 @@ @@mean_absolute_error @@mean_cosine_distance @@mean_iou +@@mean_per_class_accuracy @@mean_relative_error @@mean_squared_error @@mean_tensor diff --git a/tensorflow/python/ops/metrics_impl.py b/tensorflow/python/ops/metrics_impl.py index 70c296d558..95ce8f99af 100644 --- a/tensorflow/python/ops/metrics_impl.py +++ b/tensorflow/python/ops/metrics_impl.py @@ -216,6 +216,58 @@ def _safe_scalar_div(numerator, denominator, name): name=name) +def _streaming_confusion_matrix(labels, predictions, num_classes, weights=None): + """Calculate a streaming confusion matrix. + + Calculates a confusion matrix. For estimation over a stream of data, + the function creates an `update_op` operation. + + Args: + labels: A `Tensor` of ground truth labels with shape [batch size] and of + type `int32` or `int64`. The tensor will be flattened if its rank > 1. + predictions: A `Tensor` of prediction results for semantic labels, whose + shape is [batch size] and type `int32` or `int64`. The tensor will be + flattened if its rank > 1. + num_classes: The possible number of labels the prediction task can + have. This value must be provided, since a confusion matrix of + dimension = [num_classes, num_classes] will be allocated. + weights: Optional `Tensor` whose rank is either 0, or the same rank as + `labels`, and must be broadcastable to `labels` (i.e., all dimensions must + be either `1`, or the same as the corresponding `labels` dimension). + + Returns: + total_cm: A `Tensor` representing the confusion matrix. + update_op: An operation that increments the confusion matrix. + """ + # Local variable to accumulate the predictions in the confusion matrix. + cm_dtype = dtypes.int64 if weights is not None else dtypes.float64 + total_cm = _create_local( + 'total_confusion_matrix', + shape=[num_classes, num_classes], + dtype=cm_dtype) + + # Cast the type to int64 required by confusion_matrix_ops. + predictions = math_ops.to_int64(predictions) + labels = math_ops.to_int64(labels) + num_classes = math_ops.to_int64(num_classes) + + # Flatten the input if its rank > 1. + if predictions.get_shape().ndims > 1: + predictions = array_ops.reshape(predictions, [-1]) + + if labels.get_shape().ndims > 1: + labels = array_ops.reshape(labels, [-1]) + + if (weights is not None) and (weights.get_shape().ndims > 1): + weights = array_ops.reshape(weights, [-1]) + + # Accumulate the prediction to current confusion matrix. + current_cm = confusion_matrix.confusion_matrix( + labels, predictions, num_classes, weights=weights, dtype=cm_dtype) + update_op = state_ops.assign_add(total_cm, current_cm) + return total_cm, update_op + + def mean(values, weights=None, metrics_collections=None, updates_collections=None, name=None): """Computes the (weighted) mean of the given values. @@ -706,6 +758,85 @@ def mean_cosine_distance(labels, predictions, dim, weights=None, return mean_distance, update_op +def mean_per_class_accuracy(labels, + predictions, + num_classes, + weights=None, + metrics_collections=None, + updates_collections=None, + name=None): + """Calculates the mean of the per-class accuracies. + + Calculates the accuracy for each class, then takes the mean of that. + + For estimation of the metric over a stream of data, the function creates an + `update_op` operation that updates these variables and returns the + `mean_accuracy`. + + If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. + + Args: + labels: A `Tensor` of ground truth labels with shape [batch size] and of + type `int32` or `int64`. The tensor will be flattened if its rank > 1. + predictions: A `Tensor` of prediction results for semantic labels, whose + shape is [batch size] and type `int32` or `int64`. The tensor will be + flattened if its rank > 1. + num_classes: The possible number of labels the prediction task can + have. This value must be provided, since a confusion matrix of + dimension = [num_classes, num_classes] will be allocated. + weights: Optional `Tensor` whose rank is either 0, or the same rank as + `labels`, and must be broadcastable to `labels` (i.e., all dimensions must + be either `1`, or the same as the corresponding `labels` dimension). + metrics_collections: An optional list of collections that + `mean_per_class_accuracy' + should be added to. + updates_collections: An optional list of collections `update_op` should be + added to. + name: An optional variable_scope name. + + Returns: + mean_accuracy: A `Tensor` representing the mean per class accuracy. + update_op: An operation that increments the confusion matrix. + + Raises: + ValueError: If `predictions` and `labels` have mismatched shapes, or if + `weights` is not `None` and its shape doesn't match `predictions`, or if + either `metrics_collections` or `updates_collections` are not a list or + tuple. + """ + with variable_scope.variable_scope(name, 'mean_accuracy', + (predictions, labels, weights)): + # Check if shape is compatible. + predictions.get_shape().assert_is_compatible_with(labels.get_shape()) + + total_cm, update_op = _streaming_confusion_matrix( + labels, predictions, num_classes, weights=weights) + + def compute_mean_accuracy(name): + """Compute the mean per class accuracy via the confusion matrix.""" + per_row_sum = math_ops.to_float(math_ops.reduce_sum(total_cm, 1)) + cm_diag = math_ops.to_float(array_ops.diag_part(total_cm)) + denominator = per_row_sum + + # If the value of the denominator is 0, set it to 1 to avoid + # zero division. + denominator = array_ops.where( + math_ops.greater(denominator, 0), denominator, + array_ops.ones_like(denominator)) + accuracies = math_ops.div(cm_diag, denominator) + return math_ops.reduce_mean(accuracies, name=name) + + mean_accuracy_v = compute_mean_accuracy('mean_accuracy') + + if metrics_collections: + ops.add_to_collections(metrics_collections, mean_accuracy_v) + + if updates_collections: + ops.add_to_collections(updates_collections, update_op) + + return mean_accuracy_v, update_op + + def mean_iou(labels, predictions, num_classes, @@ -761,31 +892,8 @@ def mean_iou(labels, # Check if shape is compatible. predictions.get_shape().assert_is_compatible_with(labels.get_shape()) - # Local variable to accumulate the predictions in the confusion matrix. - cm_dtype = dtypes.int64 if weights is not None else dtypes.float64 - total_cm = _create_local('total_confusion_matrix', - shape=[num_classes, num_classes], dtype=cm_dtype) - - # Cast the type to int64 required by confusion_matrix_ops. - predictions = math_ops.to_int64(predictions) - labels = math_ops.to_int64(labels) - num_classes = math_ops.to_int64(num_classes) - - # Flatten the input if its rank > 1. - if predictions.get_shape().ndims > 1: - predictions = array_ops.reshape(predictions, [-1]) - - if labels.get_shape().ndims > 1: - labels = array_ops.reshape(labels, [-1]) - - if (weights is not None) and (weights.get_shape().ndims > 1): - weights = array_ops.reshape(weights, [-1]) - - # Accumulate the prediction to current confusion matrix. - current_cm = confusion_matrix.confusion_matrix( - labels, predictions, num_classes, weights=weights, dtype=cm_dtype) - update_op = state_ops.assign_add(total_cm, current_cm) - + total_cm, update_op = _streaming_confusion_matrix(labels, predictions, + num_classes, weights) def compute_mean_iou(name): """Compute the mean intersection-over-union via the confusion matrix.""" sum_over_row = math_ops.to_float(math_ops.reduce_sum(total_cm, 0)) -- GitLab From bef5aa71ef446a7e42ec02f19df3410b11193a85 Mon Sep 17 00:00:00 2001 From: Justin Lebar Date: Mon, 27 Feb 2017 15:25:06 -0800 Subject: [PATCH 026/101] Add tensorflow::gtl::optional. Change: 148702459 --- tensorflow/core/BUILD | 2 + tensorflow/core/lib/gtl/optional.h | 565 +++++++++++++++++++++ tensorflow/core/lib/gtl/optional_test.cc | 602 +++++++++++++++++++++++ 3 files changed, 1169 insertions(+) create mode 100644 tensorflow/core/lib/gtl/optional.h create mode 100644 tensorflow/core/lib/gtl/optional_test.cc diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD index a2d835d422..78337aec54 100644 --- a/tensorflow/core/BUILD +++ b/tensorflow/core/BUILD @@ -246,6 +246,7 @@ cc_library( "lib/gtl/flatmap.h", "lib/gtl/flatset.h", "lib/gtl/inlined_vector.h", + "lib/gtl/optional.h", "lib/gtl/priority_queue_util.h", "lib/hash/crc32c.h", "lib/histogram/histogram.h", @@ -1697,6 +1698,7 @@ tf_cc_tests( "lib/gtl/iterator_range_test.cc", "lib/gtl/manual_constructor_test.cc", "lib/gtl/map_util_test.cc", + "lib/gtl/optional_test.cc", "lib/gtl/top_n_test.cc", "lib/hash/crc32c_test.cc", "lib/hash/hash_test.cc", diff --git a/tensorflow/core/lib/gtl/optional.h b/tensorflow/core/lib/gtl/optional.h new file mode 100644 index 0000000000..443e4a0f8b --- /dev/null +++ b/tensorflow/core/lib/gtl/optional.h @@ -0,0 +1,565 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_LIB_GTL_OPTIONAL_H_ +#define TENSORFLOW_LIB_GTL_OPTIONAL_H_ + +#include +#include +#include +#include + +#include "tensorflow/core/platform/logging.h" + +namespace tensorflow { +namespace gtl { + +// A value of type gtl::optional holds either a value of T or an +// "empty" value. When it holds a value of T, it stores it as a direct +// subobject, so sizeof(optional) is approximately sizeof(T)+1. The interface +// is based on the upcoming std::optional, and gtl::optional is +// designed to be cheaply drop-in replaceable by std::optional, once it is +// rolled out. +// +// This implementation is based on the specification in N4606 Section 20.6: +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf +// +// Differences between gtl::optional and std::optional include: +// - gtl::optional is basically a proper subset of +// std::optional. +// - constexpr not used. (dependency on some differences between C++11 and +// C++14.) +// - noexcept not used. +// - exceptions not used - in lieu of exceptions we use CHECK-failure. +// - (b/30115483) gtl::make_optional has a different API than +// std::make_optional. +// +// (b/30115368) std::optional might not quite be a drop-in replacement for +// std::experimental::optional because the semantics of relational operators +// are slightly different. The best way of making sure you aren't affected by +// those changes is to make sure that your type T defines all of the operators +// consistently. (x <= y is exactly equivalent to !(x > y), etc.) +// +// Synopsis: +// +// #include "tensorflow/core/lib/gtl/optional.h" +// +// tensorflow::gtl::optional f() { +// string result; +// if (...) { +// ... +// result = ...; +// return result; +// } else { +// ... +// return tensorflow::gtl::nullopt; +// } +// } +// +// int main() { +// tensorflow::gtl::optional optstr = f(); +// if (optstr) { +// // non-empty +// print(optstr.value()); +// } else { +// // empty +// error(); +// } +// } +template +class optional; + +// The tag constant `in_place` is used as the first parameter of an optional +// constructor to indicate that the remaining arguments should be forwarded +// to the underlying T constructor. +struct in_place_t {}; +extern const in_place_t in_place; + +// The tag constant `nullopt` is used to indicate an empty optional in +// certain functions, such as construction or assignment. +struct nullopt_t { + // It must not be default-constructible to avoid ambiguity for opt = {}. + explicit constexpr nullopt_t(int /*unused*/) {} +}; +extern const nullopt_t nullopt; + +// See comment above first declaration. +template +class optional { + public: + typedef T value_type; + + // A default constructed optional holds the empty value, NOT a default + // constructed T. + optional() {} + + // An optional initialized with `nullopt` holds the empty value. + optional(nullopt_t /*unused*/) {} // NOLINT(runtime/explicit) + + // Copy constructor, standard semantics. + optional(const optional& src) { + if (src) { + construct(src.reference()); + } + } + + // Move constructor, standard semantics. + optional(optional&& src) noexcept( + std::is_nothrow_move_constructible::value) { + if (src) { + construct(std::move(src.reference())); + } + } + + // Creates a non-empty optional with a copy of the given value of T. + optional(const T& src) { // NOLINT(runtime/explicit) + construct(src); + } + + // Creates a non-empty optional with a moved-in value of T. + optional(T&& src) { // NOLINT + construct(std::move(src)); + } + + // optional(in_place, arg1, arg2, arg3) constructs a non-empty optional + // with an in-place constructed value of T(arg1,arg2,arg3). + template + explicit optional(in_place_t /*unused*/, + Args&&... args) { // NOLINT(build/c++11) + construct(std::forward(args)...); + } + + // optional(in_place, {arg1, arg2, arg3}) constructs a non-empty optional + // with an in-place list-initialized value of T({arg1, arg2, arg3}). + template + explicit optional(in_place_t /*unused*/, std::initializer_list il, + Args&&... args) { // NOLINT(build/c++11) + construct(il, std::forward(args)...); + } + + // Destructor, standard semantics. + ~optional() { reset(); } + + // Assignment from nullopt: opt = nullopt + optional& operator=(nullopt_t /*unused*/) { + reset(); + return *this; + } + + // Copy assigment, standard semantics. + optional& operator=(const optional& src) { + if (src) { + operator=(src.reference()); + } else { + reset(); + } + return *this; + } + + // Move assignment, standard semantics. + optional& operator=(optional&& src) { // NOLINT(build/c++11) + if (src) { + operator=(std::move(src.reference())); + } else { + reset(); + } + return *this; + } + + // Copy assigment from T. If empty becomes copy construction. + optional& operator=(const T& src) { // NOLINT(build/c++11) + if (*this) { + reference() = src; + } else { + construct(src); + } + return *this; + } + + // Move assignment from T. If empty becomes move construction. + optional& operator=(T&& src) { // NOLINT(build/c++11) + if (*this) { + reference() = std::move(src); + } else { + construct(std::move(src)); + } + return *this; + } + + // Destroys the inner T value if one is present. + void reset() { + if (engaged_) { + destruct(); + } + DCHECK(!engaged_); + } + + // Emplace reconstruction. (Re)constructs the underlying T in-place with the + // given arguments forwarded: + // + // optional opt; + // opt.emplace(arg1,arg2,arg3); (Constructs Foo(arg1,arg2,arg3)) + // + // If the optional is non-empty, and the `args` refer to subobjects of the + // current object, then behaviour is undefined. This is because the current + // object will be destructed before the new object is constructed with `args`. + // + template + void emplace(Args&&... args) { + reset(); + construct(std::forward(args)...); + } + + // Emplace reconstruction with initializer-list. See immediately above. + template + void emplace(std::initializer_list il, Args&&... args) { + reset(); + construct(il, std::forward(args)...); + } + + // Swap, standard semantics. + void swap(optional& src) { + if (*this) { + if (src) { + using std::swap; + swap(reference(), src.reference()); + } else { + src.construct(std::move(reference())); + destruct(); + } + } else { + if (src) { + construct(std::move(src.reference())); + src.destruct(); + } else { + // no effect (swap(disengaged, disengaged)) + } + } + } + + // You may use `*opt`, and `opt->m`, to access the underlying T value and T's + // member `m`, respectively. If the optional is empty, behaviour is + // undefined. + const T* operator->() const { + DCHECK(engaged_); + return pointer(); + } + T* operator->() { + DCHECK(engaged_); + return pointer(); + } + const T& operator*() const & { + DCHECK(engaged_); + return reference(); + } + T& operator*() & { + DCHECK(engaged_); + return reference(); + } + const T&& operator*() const && { + DCHECK(engaged_); + return std::move(reference()); + } + T&& operator*() && { + DCHECK(engaged_); + return std::move(reference()); + } + + // In a bool context an optional will return false if and only if it is + // empty. + // + // if (opt) { + // // do something with opt.value(); + // } else { + // // opt is empty + // } + // + explicit operator bool() const { return engaged_; } + + // Returns false if and only if *this is empty. + bool has_value() const { return engaged_; } + + // Use `opt.value()` to get a reference to underlying value. The constness + // and lvalue/rvalue-ness of `opt` is preserved to the view of the T + // subobject. + const T& value() const & { + CHECK(*this) << "Bad optional access"; + return reference(); + } + T& value() & { + CHECK(*this) << "Bad optional access"; + return reference(); + } + T&& value() && { // NOLINT(build/c++11) + CHECK(*this) << "Bad optional access"; + return std::move(reference()); + } + const T&& value() const && { // NOLINT(build/c++11) + CHECK(*this) << "Bad optional access"; + return std::move(reference()); + } + + // Use `opt.value_or(val)` to get either the value of T or the given default + // `val` in the empty case. + template + T value_or(U&& val) const & { + if (*this) { + return reference(); + } else { + return static_cast(std::forward(val)); + } + } + template + T value_or(U&& val) && { // NOLINT(build/c++11) + if (*this) { + return std::move(reference()); + } else { + return static_cast(std::forward(val)); + } + } + + private: + // Private accessors for internal storage viewed as pointer or reference to T. + const T* pointer() const { + return static_cast(static_cast(&storage_)); + } + T* pointer() { return static_cast(static_cast(&storage_)); } + const T& reference() const { return *pointer(); } + T& reference() { return *pointer(); } + + // Construct inner T in place with given `args`. + // Precondition: engaged_ is false + // Postcondition: engaged_ is true + template + void construct(Args&&... args) { + DCHECK(!engaged_); + engaged_ = true; + new (pointer()) T(std::forward(args)...); + DCHECK(engaged_); + } + + // Destruct inner T. + // Precondition: engaged_ is true + // Postcondition: engaged_ is false + void destruct() { + DCHECK(engaged_); + pointer()->T::~T(); + engaged_ = false; + DCHECK(!engaged_); + } + + // The internal storage for a would-be T value, constructed and destroyed + // with placement new and placement delete. + typename std::aligned_storage::type storage_; + + // Whether or not this optional is non-empty. + bool engaged_ = false; + + // T constaint checks. You can't have an optional of nullopt_t, in_place_t or + // a reference. + static_assert( + !std::is_same::type>::value, + "optional is not allowed."); + static_assert( + !std::is_same::type>::value, + "optional is not allowed."); + static_assert(!std::is_reference::value, + "optional is not allowed."); +}; + +// make_optional(v) creates a non-empty optional where the type T is deduced +// from v. Can also be explicitly instantiated as make_optional(v). +template +optional::type> make_optional(T&& v) { + return optional::type>(std::forward(v)); +} + +// Relational operators. Empty optionals are considered equal to each +// other and less than non-empty optionals. Supports relations between +// optional and optional, between optional and T, and between +// optional and nullopt. +// Note: We're careful to support T having non-bool relationals. + +// Relational operators [optional.relops] +// The C++17 (N4606) "Returns:" statements are translated into code +// in an obvious way here, and the original text retained as function docs. +// Returns: If bool(x) != bool(y), false; otherwise if bool(x) == false, true; +// otherwise *x == *y. +template +constexpr bool operator==(const optional& x, const optional& y) { + return static_cast(x) != static_cast(y) + ? false + : static_cast(x) == false ? true : *x == *y; +} +// Returns: If bool(x) != bool(y), true; otherwise, if bool(x) == false, false; +// otherwise *x != *y. +template +constexpr bool operator!=(const optional& x, const optional& y) { + return static_cast(x) != static_cast(y) + ? true + : static_cast(x) == false ? false : *x != *y; +} +// Returns: If !y, false; otherwise, if !x, true; otherwise *x < *y. +template +constexpr bool operator<(const optional& x, const optional& y) { + return !y ? false : !x ? true : *x < *y; +} +// Returns: If !x, false; otherwise, if !y, true; otherwise *x > *y. +template +constexpr bool operator>(const optional& x, const optional& y) { + return !x ? false : !y ? true : *x > *y; +} +// Returns: If !x, true; otherwise, if !y, false; otherwise *x <= *y. +template +constexpr bool operator<=(const optional& x, const optional& y) { + return !x ? true : !y ? false : *x <= *y; +} +// Returns: If !y, true; otherwise, if !x, false; otherwise *x >= *y. +template +constexpr bool operator>=(const optional& x, const optional& y) { + return !y ? true : !x ? false : *x >= *y; +} + +// Comparison with nullopt [optional.nullops] +// The C++17 (N4606) "Returns:" statements are used directly here. +template +constexpr bool operator==(const optional& x, nullopt_t) noexcept { + return !x; +} +template +constexpr bool operator==(nullopt_t, const optional& x) noexcept { + return !x; +} +template +constexpr bool operator!=(const optional& x, nullopt_t) noexcept { + return static_cast(x); +} +template +constexpr bool operator!=(nullopt_t, const optional& x) noexcept { + return static_cast(x); +} +template +constexpr bool operator<(const optional& x, nullopt_t) noexcept { + return false; +} +template +constexpr bool operator<(nullopt_t, const optional& x) noexcept { + return static_cast(x); +} +template +constexpr bool operator<=(const optional& x, nullopt_t) noexcept { + return !x; +} +template +constexpr bool operator<=(nullopt_t, const optional& x) noexcept { + return true; +} +template +constexpr bool operator>(const optional& x, nullopt_t) noexcept { + return static_cast(x); +} +template +constexpr bool operator>(nullopt_t, const optional& x) noexcept { + return false; +} +template +constexpr bool operator>=(const optional& x, nullopt_t) noexcept { + return true; +} +template +constexpr bool operator>=(nullopt_t, const optional& x) noexcept { + return !x; +} + +// Comparison with T [optional.comp_with_t] +// The C++17 (N4606) "Equivalent to:" statements are used directly here. +template +constexpr bool operator==(const optional& x, const T& v) { + return static_cast(x) ? *x == v : false; +} +template +constexpr bool operator==(const T& v, const optional& x) { + return static_cast(x) ? v == *x : false; +} +template +constexpr bool operator!=(const optional& x, const T& v) { + return static_cast(x) ? *x != v : true; +} +template +constexpr bool operator!=(const T& v, const optional& x) { + return static_cast(x) ? v != *x : true; +} +template +constexpr bool operator<(const optional& x, const T& v) { + return static_cast(x) ? *x < v : true; +} +template +constexpr bool operator<(const T& v, const optional& x) { + return static_cast(x) ? v < *x : false; +} +template +constexpr bool operator<=(const optional& x, const T& v) { + return static_cast(x) ? *x <= v : true; +} +template +constexpr bool operator<=(const T& v, const optional& x) { + return static_cast(x) ? v <= *x : false; +} +template +constexpr bool operator>(const optional& x, const T& v) { + return static_cast(x) ? *x > v : false; +} +template +constexpr bool operator>(const T& v, const optional& x) { + return static_cast(x) ? v > *x : true; +} +template +constexpr bool operator>=(const optional& x, const T& v) { + return static_cast(x) ? *x >= v : false; +} +template +constexpr bool operator>=(const T& v, const optional& x) { + return static_cast(x) ? v >= *x : true; +} + +// Swap, standard semantics. +template +void swap(optional& a, optional& b) { + a.swap(b); +} + +} // namespace gtl +} // namespace tensorflow + +namespace std { + +// std::hash specialization for gtl::optional. Normally std::hash +// specializations are banned in Google code, but the arbiters granted a +// styleguide exception for this one in cl/95369397, as optional is following +// a standard library component. +template +struct hash<::tensorflow::gtl::optional> { + size_t operator()(const ::tensorflow::gtl::optional& opt) const { + if (opt) { + return hash()(*opt); + } else { + return static_cast(0x297814aaad196e6dULL); + } + } +}; + +} // namespace std + +#endif // TENSORFLOW_LIB_GTL_OPTIONAL_H_ diff --git a/tensorflow/core/lib/gtl/optional_test.cc b/tensorflow/core/lib/gtl/optional_test.cc new file mode 100644 index 0000000000..201ccf7889 --- /dev/null +++ b/tensorflow/core/lib/gtl/optional_test.cc @@ -0,0 +1,602 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#include "tensorflow/core/lib/gtl/optional.h" +#include "tensorflow/core/platform/test.h" + +namespace { + +using tensorflow::gtl::optional; +using tensorflow::gtl::nullopt; +using tensorflow::gtl::nullopt_t; +using tensorflow::gtl::in_place; +using tensorflow::gtl::make_optional; + +template string TypeQuals(T&) { return "&"; } +template string TypeQuals(T&&) { return "&&"; } +template string TypeQuals(const T&) { return "c&"; } +template string TypeQuals(const T&&) { return "c&&"; } + +struct StructorListener { + int construct0 = 0; + int construct1 = 0; + int construct2 = 0; + int listinit = 0; + int copy = 0; + int move = 0; + int copy_assign = 0; + int move_assign = 0; + int destruct = 0; +}; + +struct Listenable { + static StructorListener* listener; + + Listenable() { ++listener->construct0; } + Listenable(int /*unused*/) { ++listener->construct1; } // NOLINT + Listenable(int /*unused*/, int /*unused*/) { ++listener->construct2; } + Listenable(std::initializer_list /*unused*/) { ++listener->listinit; } + Listenable(const Listenable& /*unused*/) { ++listener->copy; } + Listenable(Listenable&& /*unused*/) { ++listener->move; } // NOLINT + Listenable& operator=(const Listenable& /*unused*/) { + ++listener->copy_assign; + return *this; + } + Listenable& operator=(Listenable&& /*unused*/) { // NOLINT + ++listener->move_assign; + return *this; + } + ~Listenable() { ++listener->destruct; } +}; + +StructorListener* Listenable::listener = nullptr; + +TEST(optionalTest, DefaultConstructor) { + optional empty; + EXPECT_FALSE(empty); +} + +TEST(optionalTest, NullOptConstructor) { + optional empty(nullopt); + EXPECT_FALSE(empty); +} + +TEST(optionalTest, CopyConstructor) { + optional empty, opt42 = 42; + optional empty_copy(empty); + EXPECT_FALSE(empty_copy); + optional opt42_copy(opt42); + EXPECT_TRUE(opt42_copy); + EXPECT_EQ(42, opt42_copy); +} + +TEST(optionalTest, StructorBasic) { + StructorListener listener; + Listenable::listener = &listener; + { + optional empty; + EXPECT_FALSE(empty); + optional opt0(in_place); + EXPECT_TRUE(opt0); + optional opt1(in_place, 1); + EXPECT_TRUE(opt1); + optional opt2(in_place, 1, 2); + EXPECT_TRUE(opt2); + } + EXPECT_EQ(1, listener.construct0); + EXPECT_EQ(1, listener.construct1); + EXPECT_EQ(1, listener.construct2); + EXPECT_EQ(3, listener.destruct); +} + +TEST(optionalTest, CopyMoveStructor) { + StructorListener listener; + Listenable::listener = &listener; + optional original(in_place); + EXPECT_EQ(1, listener.construct0); + EXPECT_EQ(0, listener.copy); + EXPECT_EQ(0, listener.move); + optional copy(original); + EXPECT_EQ(1, listener.construct0); + EXPECT_EQ(1, listener.copy); + EXPECT_EQ(0, listener.move); + optional move(std::move(original)); + EXPECT_EQ(1, listener.construct0); + EXPECT_EQ(1, listener.copy); + EXPECT_EQ(1, listener.move); +} + +TEST(optionalTest, ListInit) { + StructorListener listener; + Listenable::listener = &listener; + optional listinit1(in_place, {1}); + optional listinit2(in_place, {1, 2}); + EXPECT_EQ(2, listener.listinit); +} + +TEST(optionalTest, CopyAssignment) { + const optional empty, opt1 = 1, opt2 = 2; + optional empty_to_opt1, opt1_to_opt2, opt2_to_empty; + + EXPECT_FALSE(empty_to_opt1); + empty_to_opt1 = empty; + EXPECT_FALSE(empty_to_opt1); + empty_to_opt1 = opt1; + EXPECT_TRUE(empty_to_opt1); + EXPECT_EQ(1, empty_to_opt1.value()); + + EXPECT_FALSE(opt1_to_opt2); + opt1_to_opt2 = opt1; + EXPECT_TRUE(opt1_to_opt2); + EXPECT_EQ(1, opt1_to_opt2.value()); + opt1_to_opt2 = opt2; + EXPECT_TRUE(opt1_to_opt2); + EXPECT_EQ(2, opt1_to_opt2.value()); + + EXPECT_FALSE(opt2_to_empty); + opt2_to_empty = opt2; + EXPECT_TRUE(opt2_to_empty); + EXPECT_EQ(2, opt2_to_empty.value()); + opt2_to_empty = empty; + EXPECT_FALSE(opt2_to_empty); +} + +TEST(optionalTest, MoveAssignment) { + StructorListener listener; + Listenable::listener = &listener; + + optional empty1, empty2, set1(in_place), set2(in_place); + EXPECT_EQ(2, listener.construct0); + optional empty_to_empty, empty_to_set, set_to_empty(in_place), + set_to_set(in_place); + EXPECT_EQ(4, listener.construct0); + empty_to_empty = std::move(empty1); + empty_to_set = std::move(set1); + set_to_empty = std::move(empty2); + set_to_set = std::move(set2); + EXPECT_EQ(0, listener.copy); + EXPECT_EQ(1, listener.move); + EXPECT_EQ(1, listener.destruct); + EXPECT_EQ(1, listener.move_assign); +} + +TEST(optionalTest, AssignmentVarious) { + optional opt; + EXPECT_FALSE(opt); + opt = 42; + EXPECT_TRUE(opt); + EXPECT_EQ(42, opt.value()); + opt = nullopt; + EXPECT_FALSE(opt); + opt = 42; + EXPECT_TRUE(opt); + EXPECT_EQ(42, opt.value()); + opt = 43; + EXPECT_TRUE(opt); + EXPECT_EQ(43, opt.value()); +} + +TEST(optionalTest, ResetAndHasValue) { + StructorListener listener; + Listenable::listener = &listener; + optional opt; + EXPECT_FALSE(opt); + EXPECT_FALSE(opt.has_value()); + opt.emplace(); + EXPECT_TRUE(opt); + EXPECT_TRUE(opt.has_value()); + opt.reset(); + EXPECT_FALSE(opt); + EXPECT_FALSE(opt.has_value()); + EXPECT_EQ(1, listener.destruct); + opt.reset(); + EXPECT_FALSE(opt); + EXPECT_FALSE(opt.has_value()); +} + +TEST(optionalTest, Emplace) { + StructorListener listener; + Listenable::listener = &listener; + optional opt; + EXPECT_FALSE(opt); + opt.emplace(1); + EXPECT_TRUE(opt); + opt.emplace(1, 2); + EXPECT_EQ(1, listener.construct1); + EXPECT_EQ(1, listener.construct2); + EXPECT_EQ(1, listener.destruct); +} + +TEST(optionalTest, Swap) { + optional opt_empty, opt1 = 1, opt2 = 2; + EXPECT_FALSE(opt_empty); + EXPECT_TRUE(opt1); + EXPECT_EQ(1, opt1.value()); + EXPECT_TRUE(opt2); + EXPECT_EQ(2, opt2.value()); + swap(opt_empty, opt1); + EXPECT_FALSE(opt1); + EXPECT_TRUE(opt_empty); + EXPECT_EQ(1, opt_empty.value()); + EXPECT_TRUE(opt2); + EXPECT_EQ(2, opt2.value()); + swap(opt_empty, opt1); + EXPECT_FALSE(opt_empty); + EXPECT_TRUE(opt1); + EXPECT_EQ(1, opt1.value()); + EXPECT_TRUE(opt2); + EXPECT_EQ(2, opt2.value()); + swap(opt1, opt2); + EXPECT_FALSE(opt_empty); + EXPECT_TRUE(opt1); + EXPECT_EQ(2, opt1.value()); + EXPECT_TRUE(opt2); + EXPECT_EQ(1, opt2.value()); +} + +TEST(optionalTest, PointerStuff) { + optional opt(in_place, "foo"); + EXPECT_EQ("foo", *opt); + const auto& opt_const = opt; + EXPECT_EQ("foo", *opt_const); + EXPECT_EQ(opt->size(), 3); + EXPECT_EQ(opt_const->size(), 3); +} + +// gcc has a bug pre 4.9 where it doesn't do correct overload resolution +// between rvalue reference qualified member methods. Skip that test to make +// the build green again when using the old compiler. +#if defined(__GNUC__) && !defined(__clang__) +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9) +#define SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG +#endif +#endif + +TEST(optionalTest, Value) { + using O = optional; + using CO = const optional; + O lvalue(in_place, "lvalue"); + CO clvalue(in_place, "clvalue"); + EXPECT_EQ("lvalue", lvalue.value()); + EXPECT_EQ("clvalue", clvalue.value()); + EXPECT_EQ("xvalue", O(in_place, "xvalue").value()); +#ifndef SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG + EXPECT_EQ("cxvalue", CO(in_place, "cxvalue").value()); +#endif + EXPECT_EQ("&", TypeQuals(lvalue.value())); + EXPECT_EQ("c&", TypeQuals(clvalue.value())); + EXPECT_EQ("&&", TypeQuals(O(in_place, "xvalue").value())); + EXPECT_EQ("c&&", TypeQuals(CO(in_place, "cxvalue").value())); +} + +TEST(optionalTest, DerefOperator) { + using O = optional; + using CO = const optional; + O lvalue(in_place, "lvalue"); + CO clvalue(in_place, "clvalue"); + EXPECT_EQ("lvalue", *lvalue); + EXPECT_EQ("clvalue", *clvalue); + EXPECT_EQ("xvalue", *O(in_place, "xvalue")); +#ifndef SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG + EXPECT_EQ("cxvalue", *CO(in_place, "cxvalue")); +#endif + EXPECT_EQ("&", TypeQuals(*lvalue)); + EXPECT_EQ("c&", TypeQuals(*clvalue)); + EXPECT_EQ("&&", TypeQuals(*O(in_place, "xvalue"))); + EXPECT_EQ("c&&", TypeQuals(*CO(in_place, "cxvalue"))); +} + +TEST(optionalTest, ValueOr) { + optional opt_empty, opt_set = 1.2; + EXPECT_EQ(42.0, opt_empty.value_or(42)); + EXPECT_EQ(1.2, opt_set.value_or(42)); + EXPECT_EQ(42.0, optional().value_or(42)); + EXPECT_EQ(1.2, optional(1.2).value_or(42)); +} + +TEST(optionalTest, make_optional) { EXPECT_EQ(42, make_optional(42).value()); } + +TEST(optionalTest, Comparisons) { + optional ae, be, a2 = 2, b2 = 2, a4 = 4, b4 = 4; + +#define optionalTest_Comparisons_EXPECT_LESS(x, y) \ + EXPECT_FALSE((x) == (y)); \ + EXPECT_TRUE((x) != (y)); \ + EXPECT_TRUE((x) < (y)); \ + EXPECT_FALSE((x) > (y)); \ + EXPECT_TRUE((x) <= (y)); \ + EXPECT_FALSE((x) >= (y)); + +#define optionalTest_Comparisons_EXPECT_SAME(x, y) \ + EXPECT_TRUE((x) == (y)); \ + EXPECT_FALSE((x) != (y)); \ + EXPECT_FALSE((x) < (y)); \ + EXPECT_FALSE((x) > (y)); \ + EXPECT_TRUE((x) <= (y)); \ + EXPECT_TRUE((x) >= (y)); + +#define optionalTest_Comparisons_EXPECT_GREATER(x, y) \ + EXPECT_FALSE((x) == (y)); \ + EXPECT_TRUE((x) != (y)); \ + EXPECT_FALSE((x) < (y)); \ + EXPECT_TRUE((x) > (y)); \ + EXPECT_FALSE((x) <= (y)); \ + EXPECT_TRUE((x) >= (y)); + + // LHS: nullopt, ae, a2, 3, a4 + // RHS: nullopt, be, b2, 3, b4 + + // optionalTest_Comparisons_EXPECT_NOT_TO_WORK(nullopt,nullopt); + optionalTest_Comparisons_EXPECT_SAME(nullopt, be); + optionalTest_Comparisons_EXPECT_LESS(nullopt, b2); + // optionalTest_Comparisons_EXPECT_NOT_TO_WORK(nullopt,3); + optionalTest_Comparisons_EXPECT_LESS(nullopt, b4); + + optionalTest_Comparisons_EXPECT_SAME(ae, nullopt); + optionalTest_Comparisons_EXPECT_SAME(ae, be); + optionalTest_Comparisons_EXPECT_LESS(ae, b2); + optionalTest_Comparisons_EXPECT_LESS(ae, 3); + optionalTest_Comparisons_EXPECT_LESS(ae, b4); + + optionalTest_Comparisons_EXPECT_GREATER(a2, nullopt); + optionalTest_Comparisons_EXPECT_GREATER(a2, be); + optionalTest_Comparisons_EXPECT_SAME(a2, b2); + optionalTest_Comparisons_EXPECT_LESS(a2, 3); + optionalTest_Comparisons_EXPECT_LESS(a2, b4); + + // optionalTest_Comparisons_EXPECT_NOT_TO_WORK(3,nullopt); + optionalTest_Comparisons_EXPECT_GREATER(3, be); + optionalTest_Comparisons_EXPECT_GREATER(3, b2); + optionalTest_Comparisons_EXPECT_SAME(3, 3); + optionalTest_Comparisons_EXPECT_LESS(3, b4); + + optionalTest_Comparisons_EXPECT_GREATER(a4, nullopt); + optionalTest_Comparisons_EXPECT_GREATER(a4, be); + optionalTest_Comparisons_EXPECT_GREATER(a4, b2); + optionalTest_Comparisons_EXPECT_GREATER(a4, 3); + optionalTest_Comparisons_EXPECT_SAME(a4, b4); +} + +TEST(optionalTest, SwapRegression) { + StructorListener listener; + Listenable::listener = &listener; + + { + optional a; + optional b(in_place); + a.swap(b); + } + + EXPECT_EQ(1, listener.construct0); + EXPECT_EQ(1, listener.move); + EXPECT_EQ(2, listener.destruct); + + { + optional a(in_place); + optional b; + a.swap(b); + } + + EXPECT_EQ(2, listener.construct0); + EXPECT_EQ(2, listener.move); + EXPECT_EQ(4, listener.destruct); +} + +TEST(optionalTest, BigStringLeakCheck) { + constexpr size_t n = 1 << 16; + + using OS = optional; + + OS a; + OS b = nullopt; + OS c = string(n, 'c'); + string sd(n, 'd'); + OS d = sd; + OS e(in_place, n, 'e'); + OS f; + f.emplace(n, 'f'); + + OS ca(a); + OS cb(b); + OS cc(c); + OS cd(d); + OS ce(e); + + OS oa; + OS ob = nullopt; + OS oc = string(n, 'c'); + string sod(n, 'd'); + OS od = sod; + OS oe(in_place, n, 'e'); + OS of; + of.emplace(n, 'f'); + + OS ma(std::move(oa)); + OS mb(std::move(ob)); + OS mc(std::move(oc)); + OS md(std::move(od)); + OS me(std::move(oe)); + OS mf(std::move(of)); + + OS aa1; + OS ab1 = nullopt; + OS ac1 = string(n, 'c'); + string sad1(n, 'd'); + OS ad1 = sad1; + OS ae1(in_place, n, 'e'); + OS af1; + af1.emplace(n, 'f'); + + OS aa2; + OS ab2 = nullopt; + OS ac2 = string(n, 'c'); + string sad2(n, 'd'); + OS ad2 = sad2; + OS ae2(in_place, n, 'e'); + OS af2; + af2.emplace(n, 'f'); + + aa1 = af2; + ab1 = ae2; + ac1 = ad2; + ad1 = ac2; + ae1 = ab2; + af1 = aa2; + + OS aa3; + OS ab3 = nullopt; + OS ac3 = string(n, 'c'); + string sad3(n, 'd'); + OS ad3 = sad3; + OS ae3(in_place, n, 'e'); + OS af3; + af3.emplace(n, 'f'); + + aa3 = nullopt; + ab3 = nullopt; + ac3 = nullopt; + ad3 = nullopt; + ae3 = nullopt; + af3 = nullopt; + + OS aa4; + OS ab4 = nullopt; + OS ac4 = string(n, 'c'); + string sad4(n, 'd'); + OS ad4 = sad4; + OS ae4(in_place, n, 'e'); + OS af4; + af4.emplace(n, 'f'); + + aa4 = OS(in_place, n, 'a'); + ab4 = OS(in_place, n, 'b'); + ac4 = OS(in_place, n, 'c'); + ad4 = OS(in_place, n, 'd'); + ae4 = OS(in_place, n, 'e'); + af4 = OS(in_place, n, 'f'); + + OS aa5; + OS ab5 = nullopt; + OS ac5 = string(n, 'c'); + string sad5(n, 'd'); + OS ad5 = sad5; + OS ae5(in_place, n, 'e'); + OS af5; + af5.emplace(n, 'f'); + + string saa5(n, 'a'); + string sab5(n, 'a'); + string sac5(n, 'a'); + string sad52(n, 'a'); + string sae5(n, 'a'); + string saf5(n, 'a'); + + aa5 = saa5; + ab5 = sab5; + ac5 = sac5; + ad5 = sad52; + ae5 = sae5; + af5 = saf5; + + OS aa6; + OS ab6 = nullopt; + OS ac6 = string(n, 'c'); + string sad6(n, 'd'); + OS ad6 = sad6; + OS ae6(in_place, n, 'e'); + OS af6; + af6.emplace(n, 'f'); + + aa6 = string(n, 'a'); + ab6 = string(n, 'b'); + ac6 = string(n, 'c'); + ad6 = string(n, 'd'); + ae6 = string(n, 'e'); + af6 = string(n, 'f'); + + OS aa7; + OS ab7 = nullopt; + OS ac7 = string(n, 'c'); + string sad7(n, 'd'); + OS ad7 = sad7; + OS ae7(in_place, n, 'e'); + OS af7; + af7.emplace(n, 'f'); + + aa7.emplace(n, 'A'); + ab7.emplace(n, 'B'); + ac7.emplace(n, 'C'); + ad7.emplace(n, 'D'); + ae7.emplace(n, 'E'); + af7.emplace(n, 'F'); +} + +TEST(optionalTest, MoveAssignRegression) { + StructorListener listener; + Listenable::listener = &listener; + + { + optional a; + Listenable b; + a = std::move(b); + } + + EXPECT_EQ(1, listener.construct0); + EXPECT_EQ(1, listener.move); + EXPECT_EQ(2, listener.destruct); +} + +TEST(optionalTest, ValueType) { + EXPECT_TRUE((std::is_same::value_type, int>::value)); + EXPECT_TRUE((std::is_same::value_type, string>::value)); + EXPECT_FALSE((std::is_same::value_type, nullopt_t>::value)); +} + +TEST(optionalTest, Hash) { + std::hash> hash; + std::set hashcodes; + hashcodes.insert(hash(nullopt)); + for (int i = 0; i < 100; ++i) { + hashcodes.insert(hash(i)); + } + EXPECT_GT(hashcodes.size(), 90); +} + +struct MoveMeNoThrow { + MoveMeNoThrow() : x(0) {} + MoveMeNoThrow(const MoveMeNoThrow& other) : x(other.x) { + LOG(FATAL) << "Should not be called."; + } + MoveMeNoThrow(MoveMeNoThrow&& other) noexcept : x(other.x) {} + int x; +}; + +struct MoveMeThrow { + MoveMeThrow() : x(0) {} + MoveMeThrow(const MoveMeThrow& other) : x(other.x) {} + MoveMeThrow(MoveMeThrow&& other) : x(other.x) {} + int x; +}; + +TEST(optionalTest, NoExcept) { + static_assert( + std::is_nothrow_move_constructible>::value, ""); + static_assert( + !std::is_nothrow_move_constructible>::value, ""); + std::vector> v; + for (int i = 0; i < 10; ++i) v.emplace_back(); +} + +} // namespace -- GitLab From d840f37cf7c86af1a5b623d5a996b2702d5a974c Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 27 Feb 2017 15:47:00 -0800 Subject: [PATCH 027/101] Remove legacy special case for ToFloat in InferAllocAttr(). The ToFloat op behaves like any other cast op now. Micro-optimization: Don't call InferAllocAttr on control edges, since the result is ignored anyway. Change: 148705319 --- tensorflow/core/common_runtime/executor.cc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tensorflow/core/common_runtime/executor.cc b/tensorflow/core/common_runtime/executor.cc index b1d3d22bd8..6987d637b4 100644 --- a/tensorflow/core/common_runtime/executor.cc +++ b/tensorflow/core/common_runtime/executor.cc @@ -680,11 +680,11 @@ Status GraphView::SetAllocAttrs(const Graph* g, const Device* device) { // Examine the out edges of each node looking for special use // cases that may affect memory allocation attributes. for (auto e : n->out_edges()) { - AllocatorAttributes attr; - s = InferAllocAttr(n, e->dst(), local_dev_name, &attr); - if (!s.ok()) return s; - if (attr.value != 0) { - if (!e->IsControlEdge()) { + if (!e->IsControlEdge()) { + AllocatorAttributes attr; + s = InferAllocAttr(n, e->dst(), local_dev_name, &attr); + if (!s.ok()) return s; + if (attr.value != 0) { attrs[e->src_output()].Merge(attr); } } @@ -759,11 +759,6 @@ static Status InferAllocAttr(const Node* n, const Node* dst, VLOG(2) << "default alloc case local type " << local_dev_name.type << " remote type " << parsed_dst_name.type; } - } else if (dst->type_string() == "ToFloat") { - for (auto e : dst->out_edges()) { - s = InferAllocAttr(n, e->dst(), local_dev_name, attr); - if (!s.ok()) return s; - } } return s; } -- GitLab From a846396e562801c63119a5b163e25abe229207ed Mon Sep 17 00:00:00 2001 From: John Bates Date: Mon, 27 Feb 2017 16:03:40 -0800 Subject: [PATCH 028/101] state_saving_rnn_estimator_test.py is no longer flaky. Change: 148707426 --- .../learn/estimators/state_saving_rnn_estimator_test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator_test.py b/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator_test.py index 05fc6a89a4..efbe445c6d 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator_test.py @@ -652,12 +652,12 @@ class StateSavingRNNEstimatorLearningTest(test.TestCase): vocab = set(lyrics_list) batch_size = 16 num_classes = len(vocab) - num_unroll = 5 # not a divisor of sequence_length - train_steps = 300 + num_unroll = 7 # not a divisor of sequence_length + train_steps = 350 eval_steps = 30 num_units = 4 learning_rate = 0.4 - accuracy_threshold = 0.70 + accuracy_threshold = 0.65 def get_lyrics_input_fn(seed): -- GitLab From 14b27251a808a706fae87e20c6ed20ba1d51557b Mon Sep 17 00:00:00 2001 From: Mustafa Ispir Date: Mon, 27 Feb 2017 16:18:17 -0800 Subject: [PATCH 029/101] Added a test to check model_fn with lambda Change: 148709245 --- tensorflow/python/estimator/estimator_test.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tensorflow/python/estimator/estimator_test.py b/tensorflow/python/estimator/estimator_test.py index bd7b439108..12d392ef7d 100644 --- a/tensorflow/python/estimator/estimator_test.py +++ b/tensorflow/python/estimator/estimator_test.py @@ -97,7 +97,7 @@ class EstimatorConstructorTest(test.TestCase): with self.assertRaisesRegexp(ValueError, 'params'): estimator.Estimator(model_fn=model_fn, params={'hidden_layers': 4}) - def test_not_known_model_fn_args_without_default(self): + def test_not_known_model_fn_args(self): def model_fn(features, labels, something): _, _, _ = features, labels, something @@ -105,6 +105,14 @@ class EstimatorConstructorTest(test.TestCase): with self.assertRaisesRegexp(ValueError, 'something'): estimator.Estimator(model_fn=model_fn) + def test_not_known_model_fn_args_handled_by_lambda(self): + def model_fn(features, labels, something): + _, _, _ = features, labels, something + + new_model_fn = lambda features, labels: model_fn( # pylint: disable=g-long-lambda + features, labels, 'something') + estimator.Estimator(model_fn=new_model_fn) + def dummy_input_fn(): return {'x': [[1], [1]]}, [[1], [1]] -- GitLab From 95109f6d9d9395d67e920f4208a7ebe173fc1b6c Mon Sep 17 00:00:00 2001 From: Zakaria Haque Date: Mon, 27 Feb 2017 20:03:54 -0800 Subject: [PATCH 030/101] Users can pass a list of class ids to multiclass/multilabel heads where we compute some per class metrics. The per class AUC had a bug where we were using logits rather than probabilities. This CL fixes this bug. Change: 148727736 --- .../learn/python/learn/estimators/head.py | 4 +- .../python/learn/estimators/head_test.py | 78 +++++++++++++++++++ 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/tensorflow/contrib/learn/python/learn/estimators/head.py b/tensorflow/contrib/learn/python/learn/estimators/head.py index 3744218e37..08c98e6758 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/head.py +++ b/tensorflow/contrib/learn/python/learn/estimators/head.py @@ -952,7 +952,7 @@ class _MultiClassHead(_SingleHead): self.head_name, mkey.CLASS_LOGITS_MEAN % class_id)] = ( _predictions_streaming_mean(logits, weights, class_id)) metrics[_summary_key(self.head_name, mkey.CLASS_AUC % class_id)] = ( - _class_streaming_auc(logits, labels, weights, class_id, + _class_streaming_auc(probabilities, labels, weights, class_id, self.logits_dimension)) return metrics @@ -1201,7 +1201,7 @@ class _MultiLabelHead(_SingleHead): self.head_name, mkey.CLASS_LOGITS_MEAN % class_id)] = ( _predictions_streaming_mean(logits, weights, class_id)) metrics[_summary_key(self.head_name, mkey.CLASS_AUC % class_id)] = ( - _streaming_auc(logits, labels, weights, class_id)) + _streaming_auc(probabilities, labels, weights, class_id)) return metrics diff --git a/tensorflow/contrib/learn/python/learn/estimators/head_test.py b/tensorflow/contrib/learn/python/learn/estimators/head_test.py index da2e509a4a..725e4f72cd 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/head_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/head_test.py @@ -438,6 +438,45 @@ class MultiLabelHeadTest(test.TestCase): _assert_metrics(self, expected_loss, self._expected_eval_metrics(expected_loss), model_fn_ops) + def testMultiClassEvalModeWithLargeLogits(self): + n_classes = 3 + head = head_lib._multi_label_head( + n_classes=n_classes, metric_class_ids=range(n_classes)) + logits = ((2., 0., -1),) + with ops.Graph().as_default(), session.Session(): + # logloss: z:label, x:logit + # z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) + model_fn_ops = head.create_model_fn_ops( + {}, model_fn.ModeKeys.EVAL, self._labels, _noop_train_op, + logits=logits) + self._assert_output_alternatives(model_fn_ops) + self.assertIsNone(model_fn_ops.train_op) + _assert_no_variables(self) + _assert_summary_tags(self, ["loss"]) + expected_loss = 1.377779 + expected_eval_metrics = { + "accuracy": 1. / 3, + "auc": 9.99999e-07, + "loss": expected_loss, + "auc/class0": 1., + "auc/class1": 1., + "auc/class2": 0., + "labels/actual_label_mean/class0": 0. / 1, + "labels/actual_label_mean/class1": 0. / 1, + "labels/actual_label_mean/class2": 1. / 1, + "labels/logits_mean/class0": logits[0][0], + "labels/logits_mean/class1": logits[0][1], + "labels/logits_mean/class2": logits[0][2], + "labels/prediction_mean/class0": 1, + "labels/prediction_mean/class1": 0, + "labels/prediction_mean/class2": 0, + "labels/probability_mean/class0": _sigmoid(logits[0][0]), + "labels/probability_mean/class1": _sigmoid(logits[0][1]), + "labels/probability_mean/class2": _sigmoid(logits[0][2]), + } + _assert_metrics(self, expected_loss, + expected_eval_metrics, model_fn_ops) + def testMultiLabelWithLabelName(self): n_classes = 3 label_name = "my_label" @@ -906,6 +945,45 @@ class MultiClassHeadTest(test.TestCase): _assert_metrics(self, expected_loss, self._expected_eval_metrics(expected_loss), model_fn_ops) + def testMultiClassEvalModeWithLargeLogits(self): + n_classes = 3 + head = head_lib._multi_class_head( + n_classes=n_classes, metric_class_ids=range(n_classes)) + logits = ((2., 0., -1),) + with ops.Graph().as_default(), session.Session(): + # logloss: z:label, x:logit + # z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) + model_fn_ops = head.create_model_fn_ops( + {}, model_fn.ModeKeys.EVAL, self._labels, _noop_train_op, + logits=logits) + self._assert_output_alternatives(model_fn_ops) + self.assertIsNone(model_fn_ops.train_op) + _assert_no_variables(self) + _assert_summary_tags(self, ["loss"]) + expected_loss = 3.1698461 + expected_eval_metrics = { + "accuracy": 0., + "auc": 9.99999e-07, + "loss": expected_loss, + "auc/class0": 1., + "auc/class1": 1., + "auc/class2": 0., + "labels/actual_label_mean/class0": 0. / 1, + "labels/actual_label_mean/class1": 0. / 1, + "labels/actual_label_mean/class2": 1. / 1, + "labels/logits_mean/class0": logits[0][0], + "labels/logits_mean/class1": logits[0][1], + "labels/logits_mean/class2": logits[0][2], + "labels/prediction_mean/class0": 1, + "labels/prediction_mean/class1": 0, + "labels/prediction_mean/class2": 0, + "labels/probability_mean/class0": 0.843795, # softmax + "labels/probability_mean/class1": 0.114195, # softmax + "labels/probability_mean/class2": 0.0420101, # softmax + } + _assert_metrics(self, expected_loss, + expected_eval_metrics, model_fn_ops) + def testMultiClassWithWeight(self): n_classes = 3 head = head_lib._multi_class_head( -- GitLab From 5e1dce96a67088b8caa9dc437184cc0e9339be42 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 27 Feb 2017 21:44:04 -0800 Subject: [PATCH 031/101] Fixing variables typo in part of the code sample And param order in nce_loss in the code sample Change: 148732811 --- tensorflow/docs_src/tutorials/word2vec.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tensorflow/docs_src/tutorials/word2vec.md b/tensorflow/docs_src/tutorials/word2vec.md index a202a62b49..3845e67496 100644 --- a/tensorflow/docs_src/tutorials/word2vec.md +++ b/tensorflow/docs_src/tutorials/word2vec.md @@ -296,8 +296,12 @@ the target word using the noise-contrastive training objective. ```python # Compute the NCE loss, using a sample of the negative labels each time. loss = tf.reduce_mean( - tf.nn.nce_loss(nce_weights, nce_biases, embed, train_labels, - num_sampled, vocabulary_size)) + tf.nn.nce_loss(weights=nce_weights, + biases=nce_biases, + labels=train_labels, + inputs=embed, + num_sampled=num_sampled, + num_classes=vocabulary_size)) ``` Now that we have a loss node, we need to add the nodes required to compute @@ -318,7 +322,7 @@ in a loop. ```python for inputs, labels in generate_batch(...): - feed_dict = {training_inputs: inputs, training_labels: labels} + feed_dict = {train_inputs: inputs, train_labels: labels} _, cur_loss = session.run([optimizer, loss], feed_dict=feed_dict) ``` -- GitLab From cb126319dea3495eae48e6178e075c11da819908 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 27 Feb 2017 22:30:06 -0800 Subject: [PATCH 032/101] Work around bug in some Clang versions that can lead to these macros expanded into different string literals compared to GCC. Change: 148735423 --- tensorflow/core/kernels/aggregate_ops.cc | 6 +++++- tensorflow/core/kernels/constant_op.cc | 6 +++++- tensorflow/core/kernels/cwise_ops_common.h | 11 ++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/tensorflow/core/kernels/aggregate_ops.cc b/tensorflow/core/kernels/aggregate_ops.cc index d95dcf576c..ff6fb7add5 100644 --- a/tensorflow/core/kernels/aggregate_ops.cc +++ b/tensorflow/core/kernels/aggregate_ops.cc @@ -140,7 +140,11 @@ class AddNOp : public OpKernel { Name("AddN").Device(DEVICE_##dev).TypeConstraint("T"), \ AddNOp) -#define REGISTER_ADDN_CPU(type) REGISTER_ADDN(type, CPU) +// There can be no space in front of "CPU" here as that space would become part +// of the kernel name due to a Clang bug. +// clang-format off +#define REGISTER_ADDN_CPU(type) REGISTER_ADDN(type,CPU) +// clang-format on TF_CALL_NUMBER_TYPES(REGISTER_ADDN_CPU); #undef REGISTER_ADDN_CPU diff --git a/tensorflow/core/kernels/constant_op.cc b/tensorflow/core/kernels/constant_op.cc index 115a842d1c..3ccc727fac 100644 --- a/tensorflow/core/kernels/constant_op.cc +++ b/tensorflow/core/kernels/constant_op.cc @@ -240,7 +240,11 @@ class ZerosLikeOp : public OpKernel { Name("ZerosLike").Device(DEVICE_##dev).TypeConstraint("T"), \ ZerosLikeOp) -#define REGISTER_CPU(type) REGISTER_KERNEL(type, CPU) +// There can be no space in front of "CPU" here as that space would become part +// of the kernel name due to a Clang bug. +// clang-format off +#define REGISTER_CPU(type) REGISTER_KERNEL(type,CPU) +// clang-format on TF_CALL_POD_STRING_TYPES(REGISTER_CPU); #undef REGISTER_CPU diff --git a/tensorflow/core/kernels/cwise_ops_common.h b/tensorflow/core/kernels/cwise_ops_common.h index 1affc3a779..4627f77931 100644 --- a/tensorflow/core/kernels/cwise_ops_common.h +++ b/tensorflow/core/kernels/cwise_ops_common.h @@ -420,7 +420,16 @@ struct UnaryFunctor { } // end namespace functor -#define REGISTER(OP, D, N, F, T) \ +// This is a workaround for a bug in Clang. Clang currently keeps up to one +// space in front of a macro arg when first concatenating (##) and then +// stringifying (#). We are currently relying on a pure substring match in the +// generated SHOULD_REGISTER_OP_KERNEL macros and the space can lead to a +// mismatch. Remove when all supported versions of Clang are fixed or +// SHOULD_REGISTER_OP_KERNEL is made more robust wrt. these spaces. +// clang-format off +#define REGISTER(OP, D, N, F, T) REGISTER_INTERNAL(OP,D, N, F, T) +// clang-format on +#define REGISTER_INTERNAL(OP, D, N, F, T) \ REGISTER_KERNEL_BUILDER(Name(N).Device(DEVICE_##D).TypeConstraint("T"), \ OP>); -- GitLab From 5a31e9c8bd73265aa76a6ba70e780fcf432b2abf Mon Sep 17 00:00:00 2001 From: Gunhan Gulsoy Date: Tue, 28 Feb 2017 00:20:20 -0800 Subject: [PATCH 033/101] Automated rollback of change 148702459 Change: 148740836 --- tensorflow/core/BUILD | 2 - tensorflow/core/lib/gtl/optional.h | 565 --------------------- tensorflow/core/lib/gtl/optional_test.cc | 602 ----------------------- 3 files changed, 1169 deletions(-) delete mode 100644 tensorflow/core/lib/gtl/optional.h delete mode 100644 tensorflow/core/lib/gtl/optional_test.cc diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD index 78337aec54..a2d835d422 100644 --- a/tensorflow/core/BUILD +++ b/tensorflow/core/BUILD @@ -246,7 +246,6 @@ cc_library( "lib/gtl/flatmap.h", "lib/gtl/flatset.h", "lib/gtl/inlined_vector.h", - "lib/gtl/optional.h", "lib/gtl/priority_queue_util.h", "lib/hash/crc32c.h", "lib/histogram/histogram.h", @@ -1698,7 +1697,6 @@ tf_cc_tests( "lib/gtl/iterator_range_test.cc", "lib/gtl/manual_constructor_test.cc", "lib/gtl/map_util_test.cc", - "lib/gtl/optional_test.cc", "lib/gtl/top_n_test.cc", "lib/hash/crc32c_test.cc", "lib/hash/hash_test.cc", diff --git a/tensorflow/core/lib/gtl/optional.h b/tensorflow/core/lib/gtl/optional.h deleted file mode 100644 index 443e4a0f8b..0000000000 --- a/tensorflow/core/lib/gtl/optional.h +++ /dev/null @@ -1,565 +0,0 @@ -/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -==============================================================================*/ - -#ifndef TENSORFLOW_LIB_GTL_OPTIONAL_H_ -#define TENSORFLOW_LIB_GTL_OPTIONAL_H_ - -#include -#include -#include -#include - -#include "tensorflow/core/platform/logging.h" - -namespace tensorflow { -namespace gtl { - -// A value of type gtl::optional holds either a value of T or an -// "empty" value. When it holds a value of T, it stores it as a direct -// subobject, so sizeof(optional) is approximately sizeof(T)+1. The interface -// is based on the upcoming std::optional, and gtl::optional is -// designed to be cheaply drop-in replaceable by std::optional, once it is -// rolled out. -// -// This implementation is based on the specification in N4606 Section 20.6: -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4606.pdf -// -// Differences between gtl::optional and std::optional include: -// - gtl::optional is basically a proper subset of -// std::optional. -// - constexpr not used. (dependency on some differences between C++11 and -// C++14.) -// - noexcept not used. -// - exceptions not used - in lieu of exceptions we use CHECK-failure. -// - (b/30115483) gtl::make_optional has a different API than -// std::make_optional. -// -// (b/30115368) std::optional might not quite be a drop-in replacement for -// std::experimental::optional because the semantics of relational operators -// are slightly different. The best way of making sure you aren't affected by -// those changes is to make sure that your type T defines all of the operators -// consistently. (x <= y is exactly equivalent to !(x > y), etc.) -// -// Synopsis: -// -// #include "tensorflow/core/lib/gtl/optional.h" -// -// tensorflow::gtl::optional f() { -// string result; -// if (...) { -// ... -// result = ...; -// return result; -// } else { -// ... -// return tensorflow::gtl::nullopt; -// } -// } -// -// int main() { -// tensorflow::gtl::optional optstr = f(); -// if (optstr) { -// // non-empty -// print(optstr.value()); -// } else { -// // empty -// error(); -// } -// } -template -class optional; - -// The tag constant `in_place` is used as the first parameter of an optional -// constructor to indicate that the remaining arguments should be forwarded -// to the underlying T constructor. -struct in_place_t {}; -extern const in_place_t in_place; - -// The tag constant `nullopt` is used to indicate an empty optional in -// certain functions, such as construction or assignment. -struct nullopt_t { - // It must not be default-constructible to avoid ambiguity for opt = {}. - explicit constexpr nullopt_t(int /*unused*/) {} -}; -extern const nullopt_t nullopt; - -// See comment above first declaration. -template -class optional { - public: - typedef T value_type; - - // A default constructed optional holds the empty value, NOT a default - // constructed T. - optional() {} - - // An optional initialized with `nullopt` holds the empty value. - optional(nullopt_t /*unused*/) {} // NOLINT(runtime/explicit) - - // Copy constructor, standard semantics. - optional(const optional& src) { - if (src) { - construct(src.reference()); - } - } - - // Move constructor, standard semantics. - optional(optional&& src) noexcept( - std::is_nothrow_move_constructible::value) { - if (src) { - construct(std::move(src.reference())); - } - } - - // Creates a non-empty optional with a copy of the given value of T. - optional(const T& src) { // NOLINT(runtime/explicit) - construct(src); - } - - // Creates a non-empty optional with a moved-in value of T. - optional(T&& src) { // NOLINT - construct(std::move(src)); - } - - // optional(in_place, arg1, arg2, arg3) constructs a non-empty optional - // with an in-place constructed value of T(arg1,arg2,arg3). - template - explicit optional(in_place_t /*unused*/, - Args&&... args) { // NOLINT(build/c++11) - construct(std::forward(args)...); - } - - // optional(in_place, {arg1, arg2, arg3}) constructs a non-empty optional - // with an in-place list-initialized value of T({arg1, arg2, arg3}). - template - explicit optional(in_place_t /*unused*/, std::initializer_list il, - Args&&... args) { // NOLINT(build/c++11) - construct(il, std::forward(args)...); - } - - // Destructor, standard semantics. - ~optional() { reset(); } - - // Assignment from nullopt: opt = nullopt - optional& operator=(nullopt_t /*unused*/) { - reset(); - return *this; - } - - // Copy assigment, standard semantics. - optional& operator=(const optional& src) { - if (src) { - operator=(src.reference()); - } else { - reset(); - } - return *this; - } - - // Move assignment, standard semantics. - optional& operator=(optional&& src) { // NOLINT(build/c++11) - if (src) { - operator=(std::move(src.reference())); - } else { - reset(); - } - return *this; - } - - // Copy assigment from T. If empty becomes copy construction. - optional& operator=(const T& src) { // NOLINT(build/c++11) - if (*this) { - reference() = src; - } else { - construct(src); - } - return *this; - } - - // Move assignment from T. If empty becomes move construction. - optional& operator=(T&& src) { // NOLINT(build/c++11) - if (*this) { - reference() = std::move(src); - } else { - construct(std::move(src)); - } - return *this; - } - - // Destroys the inner T value if one is present. - void reset() { - if (engaged_) { - destruct(); - } - DCHECK(!engaged_); - } - - // Emplace reconstruction. (Re)constructs the underlying T in-place with the - // given arguments forwarded: - // - // optional opt; - // opt.emplace(arg1,arg2,arg3); (Constructs Foo(arg1,arg2,arg3)) - // - // If the optional is non-empty, and the `args` refer to subobjects of the - // current object, then behaviour is undefined. This is because the current - // object will be destructed before the new object is constructed with `args`. - // - template - void emplace(Args&&... args) { - reset(); - construct(std::forward(args)...); - } - - // Emplace reconstruction with initializer-list. See immediately above. - template - void emplace(std::initializer_list il, Args&&... args) { - reset(); - construct(il, std::forward(args)...); - } - - // Swap, standard semantics. - void swap(optional& src) { - if (*this) { - if (src) { - using std::swap; - swap(reference(), src.reference()); - } else { - src.construct(std::move(reference())); - destruct(); - } - } else { - if (src) { - construct(std::move(src.reference())); - src.destruct(); - } else { - // no effect (swap(disengaged, disengaged)) - } - } - } - - // You may use `*opt`, and `opt->m`, to access the underlying T value and T's - // member `m`, respectively. If the optional is empty, behaviour is - // undefined. - const T* operator->() const { - DCHECK(engaged_); - return pointer(); - } - T* operator->() { - DCHECK(engaged_); - return pointer(); - } - const T& operator*() const & { - DCHECK(engaged_); - return reference(); - } - T& operator*() & { - DCHECK(engaged_); - return reference(); - } - const T&& operator*() const && { - DCHECK(engaged_); - return std::move(reference()); - } - T&& operator*() && { - DCHECK(engaged_); - return std::move(reference()); - } - - // In a bool context an optional will return false if and only if it is - // empty. - // - // if (opt) { - // // do something with opt.value(); - // } else { - // // opt is empty - // } - // - explicit operator bool() const { return engaged_; } - - // Returns false if and only if *this is empty. - bool has_value() const { return engaged_; } - - // Use `opt.value()` to get a reference to underlying value. The constness - // and lvalue/rvalue-ness of `opt` is preserved to the view of the T - // subobject. - const T& value() const & { - CHECK(*this) << "Bad optional access"; - return reference(); - } - T& value() & { - CHECK(*this) << "Bad optional access"; - return reference(); - } - T&& value() && { // NOLINT(build/c++11) - CHECK(*this) << "Bad optional access"; - return std::move(reference()); - } - const T&& value() const && { // NOLINT(build/c++11) - CHECK(*this) << "Bad optional access"; - return std::move(reference()); - } - - // Use `opt.value_or(val)` to get either the value of T or the given default - // `val` in the empty case. - template - T value_or(U&& val) const & { - if (*this) { - return reference(); - } else { - return static_cast(std::forward(val)); - } - } - template - T value_or(U&& val) && { // NOLINT(build/c++11) - if (*this) { - return std::move(reference()); - } else { - return static_cast(std::forward(val)); - } - } - - private: - // Private accessors for internal storage viewed as pointer or reference to T. - const T* pointer() const { - return static_cast(static_cast(&storage_)); - } - T* pointer() { return static_cast(static_cast(&storage_)); } - const T& reference() const { return *pointer(); } - T& reference() { return *pointer(); } - - // Construct inner T in place with given `args`. - // Precondition: engaged_ is false - // Postcondition: engaged_ is true - template - void construct(Args&&... args) { - DCHECK(!engaged_); - engaged_ = true; - new (pointer()) T(std::forward(args)...); - DCHECK(engaged_); - } - - // Destruct inner T. - // Precondition: engaged_ is true - // Postcondition: engaged_ is false - void destruct() { - DCHECK(engaged_); - pointer()->T::~T(); - engaged_ = false; - DCHECK(!engaged_); - } - - // The internal storage for a would-be T value, constructed and destroyed - // with placement new and placement delete. - typename std::aligned_storage::type storage_; - - // Whether or not this optional is non-empty. - bool engaged_ = false; - - // T constaint checks. You can't have an optional of nullopt_t, in_place_t or - // a reference. - static_assert( - !std::is_same::type>::value, - "optional is not allowed."); - static_assert( - !std::is_same::type>::value, - "optional is not allowed."); - static_assert(!std::is_reference::value, - "optional is not allowed."); -}; - -// make_optional(v) creates a non-empty optional where the type T is deduced -// from v. Can also be explicitly instantiated as make_optional(v). -template -optional::type> make_optional(T&& v) { - return optional::type>(std::forward(v)); -} - -// Relational operators. Empty optionals are considered equal to each -// other and less than non-empty optionals. Supports relations between -// optional and optional, between optional and T, and between -// optional and nullopt. -// Note: We're careful to support T having non-bool relationals. - -// Relational operators [optional.relops] -// The C++17 (N4606) "Returns:" statements are translated into code -// in an obvious way here, and the original text retained as function docs. -// Returns: If bool(x) != bool(y), false; otherwise if bool(x) == false, true; -// otherwise *x == *y. -template -constexpr bool operator==(const optional& x, const optional& y) { - return static_cast(x) != static_cast(y) - ? false - : static_cast(x) == false ? true : *x == *y; -} -// Returns: If bool(x) != bool(y), true; otherwise, if bool(x) == false, false; -// otherwise *x != *y. -template -constexpr bool operator!=(const optional& x, const optional& y) { - return static_cast(x) != static_cast(y) - ? true - : static_cast(x) == false ? false : *x != *y; -} -// Returns: If !y, false; otherwise, if !x, true; otherwise *x < *y. -template -constexpr bool operator<(const optional& x, const optional& y) { - return !y ? false : !x ? true : *x < *y; -} -// Returns: If !x, false; otherwise, if !y, true; otherwise *x > *y. -template -constexpr bool operator>(const optional& x, const optional& y) { - return !x ? false : !y ? true : *x > *y; -} -// Returns: If !x, true; otherwise, if !y, false; otherwise *x <= *y. -template -constexpr bool operator<=(const optional& x, const optional& y) { - return !x ? true : !y ? false : *x <= *y; -} -// Returns: If !y, true; otherwise, if !x, false; otherwise *x >= *y. -template -constexpr bool operator>=(const optional& x, const optional& y) { - return !y ? true : !x ? false : *x >= *y; -} - -// Comparison with nullopt [optional.nullops] -// The C++17 (N4606) "Returns:" statements are used directly here. -template -constexpr bool operator==(const optional& x, nullopt_t) noexcept { - return !x; -} -template -constexpr bool operator==(nullopt_t, const optional& x) noexcept { - return !x; -} -template -constexpr bool operator!=(const optional& x, nullopt_t) noexcept { - return static_cast(x); -} -template -constexpr bool operator!=(nullopt_t, const optional& x) noexcept { - return static_cast(x); -} -template -constexpr bool operator<(const optional& x, nullopt_t) noexcept { - return false; -} -template -constexpr bool operator<(nullopt_t, const optional& x) noexcept { - return static_cast(x); -} -template -constexpr bool operator<=(const optional& x, nullopt_t) noexcept { - return !x; -} -template -constexpr bool operator<=(nullopt_t, const optional& x) noexcept { - return true; -} -template -constexpr bool operator>(const optional& x, nullopt_t) noexcept { - return static_cast(x); -} -template -constexpr bool operator>(nullopt_t, const optional& x) noexcept { - return false; -} -template -constexpr bool operator>=(const optional& x, nullopt_t) noexcept { - return true; -} -template -constexpr bool operator>=(nullopt_t, const optional& x) noexcept { - return !x; -} - -// Comparison with T [optional.comp_with_t] -// The C++17 (N4606) "Equivalent to:" statements are used directly here. -template -constexpr bool operator==(const optional& x, const T& v) { - return static_cast(x) ? *x == v : false; -} -template -constexpr bool operator==(const T& v, const optional& x) { - return static_cast(x) ? v == *x : false; -} -template -constexpr bool operator!=(const optional& x, const T& v) { - return static_cast(x) ? *x != v : true; -} -template -constexpr bool operator!=(const T& v, const optional& x) { - return static_cast(x) ? v != *x : true; -} -template -constexpr bool operator<(const optional& x, const T& v) { - return static_cast(x) ? *x < v : true; -} -template -constexpr bool operator<(const T& v, const optional& x) { - return static_cast(x) ? v < *x : false; -} -template -constexpr bool operator<=(const optional& x, const T& v) { - return static_cast(x) ? *x <= v : true; -} -template -constexpr bool operator<=(const T& v, const optional& x) { - return static_cast(x) ? v <= *x : false; -} -template -constexpr bool operator>(const optional& x, const T& v) { - return static_cast(x) ? *x > v : false; -} -template -constexpr bool operator>(const T& v, const optional& x) { - return static_cast(x) ? v > *x : true; -} -template -constexpr bool operator>=(const optional& x, const T& v) { - return static_cast(x) ? *x >= v : false; -} -template -constexpr bool operator>=(const T& v, const optional& x) { - return static_cast(x) ? v >= *x : true; -} - -// Swap, standard semantics. -template -void swap(optional& a, optional& b) { - a.swap(b); -} - -} // namespace gtl -} // namespace tensorflow - -namespace std { - -// std::hash specialization for gtl::optional. Normally std::hash -// specializations are banned in Google code, but the arbiters granted a -// styleguide exception for this one in cl/95369397, as optional is following -// a standard library component. -template -struct hash<::tensorflow::gtl::optional> { - size_t operator()(const ::tensorflow::gtl::optional& opt) const { - if (opt) { - return hash()(*opt); - } else { - return static_cast(0x297814aaad196e6dULL); - } - } -}; - -} // namespace std - -#endif // TENSORFLOW_LIB_GTL_OPTIONAL_H_ diff --git a/tensorflow/core/lib/gtl/optional_test.cc b/tensorflow/core/lib/gtl/optional_test.cc deleted file mode 100644 index 201ccf7889..0000000000 --- a/tensorflow/core/lib/gtl/optional_test.cc +++ /dev/null @@ -1,602 +0,0 @@ -/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -==============================================================================*/ - -#include "tensorflow/core/lib/gtl/optional.h" -#include "tensorflow/core/platform/test.h" - -namespace { - -using tensorflow::gtl::optional; -using tensorflow::gtl::nullopt; -using tensorflow::gtl::nullopt_t; -using tensorflow::gtl::in_place; -using tensorflow::gtl::make_optional; - -template string TypeQuals(T&) { return "&"; } -template string TypeQuals(T&&) { return "&&"; } -template string TypeQuals(const T&) { return "c&"; } -template string TypeQuals(const T&&) { return "c&&"; } - -struct StructorListener { - int construct0 = 0; - int construct1 = 0; - int construct2 = 0; - int listinit = 0; - int copy = 0; - int move = 0; - int copy_assign = 0; - int move_assign = 0; - int destruct = 0; -}; - -struct Listenable { - static StructorListener* listener; - - Listenable() { ++listener->construct0; } - Listenable(int /*unused*/) { ++listener->construct1; } // NOLINT - Listenable(int /*unused*/, int /*unused*/) { ++listener->construct2; } - Listenable(std::initializer_list /*unused*/) { ++listener->listinit; } - Listenable(const Listenable& /*unused*/) { ++listener->copy; } - Listenable(Listenable&& /*unused*/) { ++listener->move; } // NOLINT - Listenable& operator=(const Listenable& /*unused*/) { - ++listener->copy_assign; - return *this; - } - Listenable& operator=(Listenable&& /*unused*/) { // NOLINT - ++listener->move_assign; - return *this; - } - ~Listenable() { ++listener->destruct; } -}; - -StructorListener* Listenable::listener = nullptr; - -TEST(optionalTest, DefaultConstructor) { - optional empty; - EXPECT_FALSE(empty); -} - -TEST(optionalTest, NullOptConstructor) { - optional empty(nullopt); - EXPECT_FALSE(empty); -} - -TEST(optionalTest, CopyConstructor) { - optional empty, opt42 = 42; - optional empty_copy(empty); - EXPECT_FALSE(empty_copy); - optional opt42_copy(opt42); - EXPECT_TRUE(opt42_copy); - EXPECT_EQ(42, opt42_copy); -} - -TEST(optionalTest, StructorBasic) { - StructorListener listener; - Listenable::listener = &listener; - { - optional empty; - EXPECT_FALSE(empty); - optional opt0(in_place); - EXPECT_TRUE(opt0); - optional opt1(in_place, 1); - EXPECT_TRUE(opt1); - optional opt2(in_place, 1, 2); - EXPECT_TRUE(opt2); - } - EXPECT_EQ(1, listener.construct0); - EXPECT_EQ(1, listener.construct1); - EXPECT_EQ(1, listener.construct2); - EXPECT_EQ(3, listener.destruct); -} - -TEST(optionalTest, CopyMoveStructor) { - StructorListener listener; - Listenable::listener = &listener; - optional original(in_place); - EXPECT_EQ(1, listener.construct0); - EXPECT_EQ(0, listener.copy); - EXPECT_EQ(0, listener.move); - optional copy(original); - EXPECT_EQ(1, listener.construct0); - EXPECT_EQ(1, listener.copy); - EXPECT_EQ(0, listener.move); - optional move(std::move(original)); - EXPECT_EQ(1, listener.construct0); - EXPECT_EQ(1, listener.copy); - EXPECT_EQ(1, listener.move); -} - -TEST(optionalTest, ListInit) { - StructorListener listener; - Listenable::listener = &listener; - optional listinit1(in_place, {1}); - optional listinit2(in_place, {1, 2}); - EXPECT_EQ(2, listener.listinit); -} - -TEST(optionalTest, CopyAssignment) { - const optional empty, opt1 = 1, opt2 = 2; - optional empty_to_opt1, opt1_to_opt2, opt2_to_empty; - - EXPECT_FALSE(empty_to_opt1); - empty_to_opt1 = empty; - EXPECT_FALSE(empty_to_opt1); - empty_to_opt1 = opt1; - EXPECT_TRUE(empty_to_opt1); - EXPECT_EQ(1, empty_to_opt1.value()); - - EXPECT_FALSE(opt1_to_opt2); - opt1_to_opt2 = opt1; - EXPECT_TRUE(opt1_to_opt2); - EXPECT_EQ(1, opt1_to_opt2.value()); - opt1_to_opt2 = opt2; - EXPECT_TRUE(opt1_to_opt2); - EXPECT_EQ(2, opt1_to_opt2.value()); - - EXPECT_FALSE(opt2_to_empty); - opt2_to_empty = opt2; - EXPECT_TRUE(opt2_to_empty); - EXPECT_EQ(2, opt2_to_empty.value()); - opt2_to_empty = empty; - EXPECT_FALSE(opt2_to_empty); -} - -TEST(optionalTest, MoveAssignment) { - StructorListener listener; - Listenable::listener = &listener; - - optional empty1, empty2, set1(in_place), set2(in_place); - EXPECT_EQ(2, listener.construct0); - optional empty_to_empty, empty_to_set, set_to_empty(in_place), - set_to_set(in_place); - EXPECT_EQ(4, listener.construct0); - empty_to_empty = std::move(empty1); - empty_to_set = std::move(set1); - set_to_empty = std::move(empty2); - set_to_set = std::move(set2); - EXPECT_EQ(0, listener.copy); - EXPECT_EQ(1, listener.move); - EXPECT_EQ(1, listener.destruct); - EXPECT_EQ(1, listener.move_assign); -} - -TEST(optionalTest, AssignmentVarious) { - optional opt; - EXPECT_FALSE(opt); - opt = 42; - EXPECT_TRUE(opt); - EXPECT_EQ(42, opt.value()); - opt = nullopt; - EXPECT_FALSE(opt); - opt = 42; - EXPECT_TRUE(opt); - EXPECT_EQ(42, opt.value()); - opt = 43; - EXPECT_TRUE(opt); - EXPECT_EQ(43, opt.value()); -} - -TEST(optionalTest, ResetAndHasValue) { - StructorListener listener; - Listenable::listener = &listener; - optional opt; - EXPECT_FALSE(opt); - EXPECT_FALSE(opt.has_value()); - opt.emplace(); - EXPECT_TRUE(opt); - EXPECT_TRUE(opt.has_value()); - opt.reset(); - EXPECT_FALSE(opt); - EXPECT_FALSE(opt.has_value()); - EXPECT_EQ(1, listener.destruct); - opt.reset(); - EXPECT_FALSE(opt); - EXPECT_FALSE(opt.has_value()); -} - -TEST(optionalTest, Emplace) { - StructorListener listener; - Listenable::listener = &listener; - optional opt; - EXPECT_FALSE(opt); - opt.emplace(1); - EXPECT_TRUE(opt); - opt.emplace(1, 2); - EXPECT_EQ(1, listener.construct1); - EXPECT_EQ(1, listener.construct2); - EXPECT_EQ(1, listener.destruct); -} - -TEST(optionalTest, Swap) { - optional opt_empty, opt1 = 1, opt2 = 2; - EXPECT_FALSE(opt_empty); - EXPECT_TRUE(opt1); - EXPECT_EQ(1, opt1.value()); - EXPECT_TRUE(opt2); - EXPECT_EQ(2, opt2.value()); - swap(opt_empty, opt1); - EXPECT_FALSE(opt1); - EXPECT_TRUE(opt_empty); - EXPECT_EQ(1, opt_empty.value()); - EXPECT_TRUE(opt2); - EXPECT_EQ(2, opt2.value()); - swap(opt_empty, opt1); - EXPECT_FALSE(opt_empty); - EXPECT_TRUE(opt1); - EXPECT_EQ(1, opt1.value()); - EXPECT_TRUE(opt2); - EXPECT_EQ(2, opt2.value()); - swap(opt1, opt2); - EXPECT_FALSE(opt_empty); - EXPECT_TRUE(opt1); - EXPECT_EQ(2, opt1.value()); - EXPECT_TRUE(opt2); - EXPECT_EQ(1, opt2.value()); -} - -TEST(optionalTest, PointerStuff) { - optional opt(in_place, "foo"); - EXPECT_EQ("foo", *opt); - const auto& opt_const = opt; - EXPECT_EQ("foo", *opt_const); - EXPECT_EQ(opt->size(), 3); - EXPECT_EQ(opt_const->size(), 3); -} - -// gcc has a bug pre 4.9 where it doesn't do correct overload resolution -// between rvalue reference qualified member methods. Skip that test to make -// the build green again when using the old compiler. -#if defined(__GNUC__) && !defined(__clang__) -#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9) -#define SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG -#endif -#endif - -TEST(optionalTest, Value) { - using O = optional; - using CO = const optional; - O lvalue(in_place, "lvalue"); - CO clvalue(in_place, "clvalue"); - EXPECT_EQ("lvalue", lvalue.value()); - EXPECT_EQ("clvalue", clvalue.value()); - EXPECT_EQ("xvalue", O(in_place, "xvalue").value()); -#ifndef SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG - EXPECT_EQ("cxvalue", CO(in_place, "cxvalue").value()); -#endif - EXPECT_EQ("&", TypeQuals(lvalue.value())); - EXPECT_EQ("c&", TypeQuals(clvalue.value())); - EXPECT_EQ("&&", TypeQuals(O(in_place, "xvalue").value())); - EXPECT_EQ("c&&", TypeQuals(CO(in_place, "cxvalue").value())); -} - -TEST(optionalTest, DerefOperator) { - using O = optional; - using CO = const optional; - O lvalue(in_place, "lvalue"); - CO clvalue(in_place, "clvalue"); - EXPECT_EQ("lvalue", *lvalue); - EXPECT_EQ("clvalue", *clvalue); - EXPECT_EQ("xvalue", *O(in_place, "xvalue")); -#ifndef SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG - EXPECT_EQ("cxvalue", *CO(in_place, "cxvalue")); -#endif - EXPECT_EQ("&", TypeQuals(*lvalue)); - EXPECT_EQ("c&", TypeQuals(*clvalue)); - EXPECT_EQ("&&", TypeQuals(*O(in_place, "xvalue"))); - EXPECT_EQ("c&&", TypeQuals(*CO(in_place, "cxvalue"))); -} - -TEST(optionalTest, ValueOr) { - optional opt_empty, opt_set = 1.2; - EXPECT_EQ(42.0, opt_empty.value_or(42)); - EXPECT_EQ(1.2, opt_set.value_or(42)); - EXPECT_EQ(42.0, optional().value_or(42)); - EXPECT_EQ(1.2, optional(1.2).value_or(42)); -} - -TEST(optionalTest, make_optional) { EXPECT_EQ(42, make_optional(42).value()); } - -TEST(optionalTest, Comparisons) { - optional ae, be, a2 = 2, b2 = 2, a4 = 4, b4 = 4; - -#define optionalTest_Comparisons_EXPECT_LESS(x, y) \ - EXPECT_FALSE((x) == (y)); \ - EXPECT_TRUE((x) != (y)); \ - EXPECT_TRUE((x) < (y)); \ - EXPECT_FALSE((x) > (y)); \ - EXPECT_TRUE((x) <= (y)); \ - EXPECT_FALSE((x) >= (y)); - -#define optionalTest_Comparisons_EXPECT_SAME(x, y) \ - EXPECT_TRUE((x) == (y)); \ - EXPECT_FALSE((x) != (y)); \ - EXPECT_FALSE((x) < (y)); \ - EXPECT_FALSE((x) > (y)); \ - EXPECT_TRUE((x) <= (y)); \ - EXPECT_TRUE((x) >= (y)); - -#define optionalTest_Comparisons_EXPECT_GREATER(x, y) \ - EXPECT_FALSE((x) == (y)); \ - EXPECT_TRUE((x) != (y)); \ - EXPECT_FALSE((x) < (y)); \ - EXPECT_TRUE((x) > (y)); \ - EXPECT_FALSE((x) <= (y)); \ - EXPECT_TRUE((x) >= (y)); - - // LHS: nullopt, ae, a2, 3, a4 - // RHS: nullopt, be, b2, 3, b4 - - // optionalTest_Comparisons_EXPECT_NOT_TO_WORK(nullopt,nullopt); - optionalTest_Comparisons_EXPECT_SAME(nullopt, be); - optionalTest_Comparisons_EXPECT_LESS(nullopt, b2); - // optionalTest_Comparisons_EXPECT_NOT_TO_WORK(nullopt,3); - optionalTest_Comparisons_EXPECT_LESS(nullopt, b4); - - optionalTest_Comparisons_EXPECT_SAME(ae, nullopt); - optionalTest_Comparisons_EXPECT_SAME(ae, be); - optionalTest_Comparisons_EXPECT_LESS(ae, b2); - optionalTest_Comparisons_EXPECT_LESS(ae, 3); - optionalTest_Comparisons_EXPECT_LESS(ae, b4); - - optionalTest_Comparisons_EXPECT_GREATER(a2, nullopt); - optionalTest_Comparisons_EXPECT_GREATER(a2, be); - optionalTest_Comparisons_EXPECT_SAME(a2, b2); - optionalTest_Comparisons_EXPECT_LESS(a2, 3); - optionalTest_Comparisons_EXPECT_LESS(a2, b4); - - // optionalTest_Comparisons_EXPECT_NOT_TO_WORK(3,nullopt); - optionalTest_Comparisons_EXPECT_GREATER(3, be); - optionalTest_Comparisons_EXPECT_GREATER(3, b2); - optionalTest_Comparisons_EXPECT_SAME(3, 3); - optionalTest_Comparisons_EXPECT_LESS(3, b4); - - optionalTest_Comparisons_EXPECT_GREATER(a4, nullopt); - optionalTest_Comparisons_EXPECT_GREATER(a4, be); - optionalTest_Comparisons_EXPECT_GREATER(a4, b2); - optionalTest_Comparisons_EXPECT_GREATER(a4, 3); - optionalTest_Comparisons_EXPECT_SAME(a4, b4); -} - -TEST(optionalTest, SwapRegression) { - StructorListener listener; - Listenable::listener = &listener; - - { - optional a; - optional b(in_place); - a.swap(b); - } - - EXPECT_EQ(1, listener.construct0); - EXPECT_EQ(1, listener.move); - EXPECT_EQ(2, listener.destruct); - - { - optional a(in_place); - optional b; - a.swap(b); - } - - EXPECT_EQ(2, listener.construct0); - EXPECT_EQ(2, listener.move); - EXPECT_EQ(4, listener.destruct); -} - -TEST(optionalTest, BigStringLeakCheck) { - constexpr size_t n = 1 << 16; - - using OS = optional; - - OS a; - OS b = nullopt; - OS c = string(n, 'c'); - string sd(n, 'd'); - OS d = sd; - OS e(in_place, n, 'e'); - OS f; - f.emplace(n, 'f'); - - OS ca(a); - OS cb(b); - OS cc(c); - OS cd(d); - OS ce(e); - - OS oa; - OS ob = nullopt; - OS oc = string(n, 'c'); - string sod(n, 'd'); - OS od = sod; - OS oe(in_place, n, 'e'); - OS of; - of.emplace(n, 'f'); - - OS ma(std::move(oa)); - OS mb(std::move(ob)); - OS mc(std::move(oc)); - OS md(std::move(od)); - OS me(std::move(oe)); - OS mf(std::move(of)); - - OS aa1; - OS ab1 = nullopt; - OS ac1 = string(n, 'c'); - string sad1(n, 'd'); - OS ad1 = sad1; - OS ae1(in_place, n, 'e'); - OS af1; - af1.emplace(n, 'f'); - - OS aa2; - OS ab2 = nullopt; - OS ac2 = string(n, 'c'); - string sad2(n, 'd'); - OS ad2 = sad2; - OS ae2(in_place, n, 'e'); - OS af2; - af2.emplace(n, 'f'); - - aa1 = af2; - ab1 = ae2; - ac1 = ad2; - ad1 = ac2; - ae1 = ab2; - af1 = aa2; - - OS aa3; - OS ab3 = nullopt; - OS ac3 = string(n, 'c'); - string sad3(n, 'd'); - OS ad3 = sad3; - OS ae3(in_place, n, 'e'); - OS af3; - af3.emplace(n, 'f'); - - aa3 = nullopt; - ab3 = nullopt; - ac3 = nullopt; - ad3 = nullopt; - ae3 = nullopt; - af3 = nullopt; - - OS aa4; - OS ab4 = nullopt; - OS ac4 = string(n, 'c'); - string sad4(n, 'd'); - OS ad4 = sad4; - OS ae4(in_place, n, 'e'); - OS af4; - af4.emplace(n, 'f'); - - aa4 = OS(in_place, n, 'a'); - ab4 = OS(in_place, n, 'b'); - ac4 = OS(in_place, n, 'c'); - ad4 = OS(in_place, n, 'd'); - ae4 = OS(in_place, n, 'e'); - af4 = OS(in_place, n, 'f'); - - OS aa5; - OS ab5 = nullopt; - OS ac5 = string(n, 'c'); - string sad5(n, 'd'); - OS ad5 = sad5; - OS ae5(in_place, n, 'e'); - OS af5; - af5.emplace(n, 'f'); - - string saa5(n, 'a'); - string sab5(n, 'a'); - string sac5(n, 'a'); - string sad52(n, 'a'); - string sae5(n, 'a'); - string saf5(n, 'a'); - - aa5 = saa5; - ab5 = sab5; - ac5 = sac5; - ad5 = sad52; - ae5 = sae5; - af5 = saf5; - - OS aa6; - OS ab6 = nullopt; - OS ac6 = string(n, 'c'); - string sad6(n, 'd'); - OS ad6 = sad6; - OS ae6(in_place, n, 'e'); - OS af6; - af6.emplace(n, 'f'); - - aa6 = string(n, 'a'); - ab6 = string(n, 'b'); - ac6 = string(n, 'c'); - ad6 = string(n, 'd'); - ae6 = string(n, 'e'); - af6 = string(n, 'f'); - - OS aa7; - OS ab7 = nullopt; - OS ac7 = string(n, 'c'); - string sad7(n, 'd'); - OS ad7 = sad7; - OS ae7(in_place, n, 'e'); - OS af7; - af7.emplace(n, 'f'); - - aa7.emplace(n, 'A'); - ab7.emplace(n, 'B'); - ac7.emplace(n, 'C'); - ad7.emplace(n, 'D'); - ae7.emplace(n, 'E'); - af7.emplace(n, 'F'); -} - -TEST(optionalTest, MoveAssignRegression) { - StructorListener listener; - Listenable::listener = &listener; - - { - optional a; - Listenable b; - a = std::move(b); - } - - EXPECT_EQ(1, listener.construct0); - EXPECT_EQ(1, listener.move); - EXPECT_EQ(2, listener.destruct); -} - -TEST(optionalTest, ValueType) { - EXPECT_TRUE((std::is_same::value_type, int>::value)); - EXPECT_TRUE((std::is_same::value_type, string>::value)); - EXPECT_FALSE((std::is_same::value_type, nullopt_t>::value)); -} - -TEST(optionalTest, Hash) { - std::hash> hash; - std::set hashcodes; - hashcodes.insert(hash(nullopt)); - for (int i = 0; i < 100; ++i) { - hashcodes.insert(hash(i)); - } - EXPECT_GT(hashcodes.size(), 90); -} - -struct MoveMeNoThrow { - MoveMeNoThrow() : x(0) {} - MoveMeNoThrow(const MoveMeNoThrow& other) : x(other.x) { - LOG(FATAL) << "Should not be called."; - } - MoveMeNoThrow(MoveMeNoThrow&& other) noexcept : x(other.x) {} - int x; -}; - -struct MoveMeThrow { - MoveMeThrow() : x(0) {} - MoveMeThrow(const MoveMeThrow& other) : x(other.x) {} - MoveMeThrow(MoveMeThrow&& other) : x(other.x) {} - int x; -}; - -TEST(optionalTest, NoExcept) { - static_assert( - std::is_nothrow_move_constructible>::value, ""); - static_assert( - !std::is_nothrow_move_constructible>::value, ""); - std::vector> v; - for (int i = 0; i < 10; ++i) v.emplace_back(); -} - -} // namespace -- GitLab From 49a4ebbf3cb307c513653427b32f30ad35855094 Mon Sep 17 00:00:00 2001 From: Asim Shankar Date: Tue, 28 Feb 2017 03:01:11 -0800 Subject: [PATCH 034/101] Go: Provide a mechanism to configure the Session. A Session is configured using the ConfigProto protocol buffer. For now, continuing with attempts to keep the 'tensorflow' go package free of any protocol buffer dependencies, SessionOptions uses a serialized representation of this message. This choice might make sense to revisit. Change: 148750535 --- tensorflow/go/saved_model.go | 7 +++++-- tensorflow/go/session.go | 39 +++++++++++++++++++++++++++++------ tensorflow/go/session_test.go | 35 +++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 8 deletions(-) diff --git a/tensorflow/go/saved_model.go b/tensorflow/go/saved_model.go index dd8ad307b9..32e40d9a95 100644 --- a/tensorflow/go/saved_model.go +++ b/tensorflow/go/saved_model.go @@ -45,7 +45,11 @@ type SavedModel struct { // https://www.tensorflow.org/code/tensorflow/python/saved_model/ func LoadSavedModel(exportDir string, tags []string, options *SessionOptions) (*SavedModel, error) { status := newStatus() - cOpt := options.c() + cOpt, doneOpt, err := options.c() + defer doneOpt() + if err != nil { + return nil, err + } cExportDir := C.CString(exportDir) cTags := make([]*C.char, len(tags)) for i := range tags { @@ -58,7 +62,6 @@ func LoadSavedModel(exportDir string, tags []string, options *SessionOptions) (* C.free(unsafe.Pointer(cTags[i])) } C.free(unsafe.Pointer(cExportDir)) - C.TF_DeleteSessionOptions(cOpt) if err := status.Err(); err != nil { return nil, err diff --git a/tensorflow/go/session.go b/tensorflow/go/session.go index ef357cb520..5a6e1e37ad 100644 --- a/tensorflow/go/session.go +++ b/tensorflow/go/session.go @@ -20,6 +20,7 @@ import "C" import ( "errors" + "fmt" "runtime" "sync" "unsafe" @@ -47,9 +48,12 @@ type Session struct { // options may be nil to use the default options. func NewSession(graph *Graph, options *SessionOptions) (*Session, error) { status := newStatus() - cOpt := options.c() + cOpt, doneOpt, err := options.c() + defer doneOpt() + if err != nil { + return nil, err + } cSess := C.TF_NewSession(graph.c, cOpt, status.c) - C.TF_DeleteSessionOptions(cOpt) if err := status.Err(); err != nil { return nil, err } @@ -243,19 +247,42 @@ type SessionOptions struct { // If the session disconnects from the remote process during its // lifetime, session calls may fail immediately. Target string + + // Config is a binary-serialized representation of the + // tensorflow.ConfigProto protocol message + // (https://www.tensorflow.org/code/tensorflow/core/protobuf/config.proto). + Config []byte } // c converts the SessionOptions to the C API's TF_SessionOptions. Callers must -// deallocate by calling C.TF_DeleteSessionOptions(). -func (o *SessionOptions) c() *C.TF_SessionOptions { +// deallocate by calling the returned done() closure. +func (o *SessionOptions) c() (ret *C.TF_SessionOptions, done func(), err error) { opt := C.TF_NewSessionOptions() if o == nil { - return opt + return opt, func() { C.TF_DeleteSessionOptions(opt) }, nil } t := C.CString(o.Target) C.TF_SetTarget(opt, t) C.free(unsafe.Pointer(t)) - return opt + + var cConfig unsafe.Pointer + if sz := len(o.Config); sz > 0 { + status := newStatus() + // Copying into C-memory is the simplest thing to do in terms + // of memory safety and cgo rules ("C code may not keep a copy + // of a Go pointer after the call returns" from + // https://golang.org/cmd/cgo/#hdr-Passing_pointers). + cConfig = C.CBytes(o.Config) + C.TF_SetConfig(opt, cConfig, C.size_t(sz), status.c) + if err := status.Err(); err != nil { + C.TF_DeleteSessionOptions(opt) + return nil, func() {}, fmt.Errorf("invalid SessionOptions.Config: %v", err) + } + } + return opt, func() { + C.TF_DeleteSessionOptions(opt) + C.free(cConfig) + }, nil } // cRunArgs translates the arguments to Session.Run and PartialRun.Run into diff --git a/tensorflow/go/session_test.go b/tensorflow/go/session_test.go index 9afa2be3b4..4c1b862e1f 100644 --- a/tensorflow/go/session_test.go +++ b/tensorflow/go/session_test.go @@ -246,3 +246,38 @@ func ExamplePartialRun() { fmt.Println(v1, v2) // Output: 3 10 } + +func TestSessionConfig(t *testing.T) { + // Exercise SessionOptions. + // Arguably, a better API would be for SessionOptions.Config to be the + // type generated by the protocol buffer compiler. But for now, the + // tensorflow package continues to be independent of protocol buffers + // and this test exercises the option since the implementation has a + // nuanced conversion to C types. + // + // Till then, the []byte form of Config here was generated using a toy + // tensorflow Python program: + /* + import tensorflow + c = tensorflow.ConfigProto() + c.intra_op_parallelism_threads = 1 + print c.SerializeToString() + */ + graph := NewGraph() + c, err := Const(graph, "Const", int32(14)) + if err != nil { + t.Fatal(err) + } + opts := SessionOptions{Config: []byte("(\x01")} + s, err := NewSession(graph, &opts) + if err != nil { + t.Fatal(err) + } + output, err := s.Run(nil, []Output{c}, nil) + if err != nil { + t.Fatal(err) + } + if output[0].Value().(int32) != 14 { + t.Fatalf("Got %v, want -1", output[0].Value()) + } +} -- GitLab From e8548c8932e0899ffd397392cc61100ec488c1d6 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 07:14:39 -0800 Subject: [PATCH 035/101] Add a ScheduledOutputTrainingHelper. Change: 148765793 --- .../python/kernel_tests/basic_decoder_test.py | 107 ++++++++++++++++++ .../contrib/seq2seq/python/ops/helper.py | 100 ++++++++++++++++ 2 files changed, 207 insertions(+) diff --git a/tensorflow/contrib/seq2seq/python/kernel_tests/basic_decoder_test.py b/tensorflow/contrib/seq2seq/python/kernel_tests/basic_decoder_test.py index 8a1ee1e41d..01503337b4 100644 --- a/tensorflow/contrib/seq2seq/python/kernel_tests/basic_decoder_test.py +++ b/tensorflow/contrib/seq2seq/python/kernel_tests/basic_decoder_test.py @@ -282,6 +282,113 @@ class BasicDecoderTest(test.TestCase): sess_results["step_next_inputs"][batch_where_not_sampling], np.squeeze(inputs[batch_where_not_sampling, 1])) + def _testStepWithScheduledOutputTrainingHelper(self, use_next_input_layer): + sequence_length = [3, 4, 3, 1, 0] + batch_size = 5 + max_time = 8 + input_depth = 7 + cell_depth = input_depth + if use_next_input_layer: + cell_depth = 6 + + with self.test_session() as sess: + inputs = np.random.randn(batch_size, max_time, + input_depth).astype(np.float32) + cell = core_rnn_cell.LSTMCell(cell_depth) + half = constant_op.constant(0.5) + + next_input_layer = None + if use_next_input_layer: + next_input_layer = layers_core.Dense(input_depth, use_bias=False) + + helper = helper_py.ScheduledOutputTrainingHelper( + inputs=inputs, + sequence_length=sequence_length, + sampling_probability=half, + time_major=False, + next_input_layer=next_input_layer) + + my_decoder = basic_decoder.BasicDecoder( + cell=cell, + helper=helper, + initial_state=cell.zero_state( + dtype=dtypes.float32, batch_size=batch_size)) + + output_size = my_decoder.output_size + output_dtype = my_decoder.output_dtype + self.assertEqual( + basic_decoder.BasicDecoderOutput(cell_depth, + tensor_shape.TensorShape([])), + output_size) + self.assertEqual( + basic_decoder.BasicDecoderOutput(dtypes.float32, dtypes.int32), + output_dtype) + + (first_finished, first_inputs, first_state) = my_decoder.initialize() + (step_outputs, step_state, step_next_inputs, + step_finished) = my_decoder.step( + constant_op.constant(0), first_inputs, first_state) + + if use_next_input_layer: + output_after_next_input_layer = next_input_layer( + step_outputs.rnn_output) + + batch_size_t = my_decoder.batch_size + + self.assertTrue(isinstance(first_state, core_rnn_cell.LSTMStateTuple)) + self.assertTrue(isinstance(step_state, core_rnn_cell.LSTMStateTuple)) + self.assertTrue( + isinstance(step_outputs, basic_decoder.BasicDecoderOutput)) + self.assertEqual((batch_size, cell_depth), step_outputs[0].get_shape()) + self.assertEqual((batch_size,), step_outputs[1].get_shape()) + self.assertEqual((batch_size, cell_depth), first_state[0].get_shape()) + self.assertEqual((batch_size, cell_depth), first_state[1].get_shape()) + self.assertEqual((batch_size, cell_depth), step_state[0].get_shape()) + self.assertEqual((batch_size, cell_depth), step_state[1].get_shape()) + + sess.run(variables.global_variables_initializer()) + + fetches = { + "batch_size": batch_size_t, + "first_finished": first_finished, + "first_inputs": first_inputs, + "first_state": first_state, + "step_outputs": step_outputs, + "step_state": step_state, + "step_next_inputs": step_next_inputs, + "step_finished": step_finished + } + if use_next_input_layer: + fetches["output_after_next_input_layer"] = output_after_next_input_layer + + sess_results = sess.run(fetches) + + self.assertAllEqual([False, False, False, False, True], + sess_results["first_finished"]) + self.assertAllEqual([False, False, False, True, True], + sess_results["step_finished"]) + + sample_ids = sess_results["step_outputs"].sample_id + batch_where_not_sampling = np.where(np.logical_not(sample_ids)) + batch_where_sampling = np.where(sample_ids) + if use_next_input_layer: + self.assertAllClose( + sess_results["step_next_inputs"][batch_where_sampling], + sess_results["output_after_next_input_layer"][batch_where_sampling]) + else: + self.assertAllClose( + sess_results["step_next_inputs"][batch_where_sampling], + sess_results["step_outputs"].rnn_output[batch_where_sampling]) + self.assertAllClose( + sess_results["step_next_inputs"][batch_where_not_sampling], + np.squeeze(inputs[batch_where_not_sampling, 1], axis=1)) + + def testStepWithScheduledOutputTrainingHelperWithoutNextInputLayer(self): + self._testStepWithScheduledOutputTrainingHelper(use_next_input_layer=False) + + def testStepWithScheduledOutputTrainingHelperWithNextInputLayer(self): + self._testStepWithScheduledOutputTrainingHelper(use_next_input_layer=True) + if __name__ == "__main__": test.main() diff --git a/tensorflow/contrib/seq2seq/python/ops/helper.py b/tensorflow/contrib/seq2seq/python/ops/helper.py index 46d0563fe0..6599a273c5 100644 --- a/tensorflow/contrib/seq2seq/python/ops/helper.py +++ b/tensorflow/contrib/seq2seq/python/ops/helper.py @@ -23,10 +23,12 @@ import abc import six +from tensorflow.contrib.distributions.python.ops import bernoulli from tensorflow.contrib.distributions.python.ops import categorical from tensorflow.contrib.seq2seq.python.ops import decoder from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops +from tensorflow.python.layers import base as layers_base from tensorflow.python.ops import array_ops from tensorflow.python.ops import control_flow_ops from tensorflow.python.ops import embedding_ops @@ -293,6 +295,104 @@ class ScheduledEmbeddingTrainingHelper(TrainingHelper): return (finished, next_inputs, state) +class ScheduledOutputTrainingHelper(TrainingHelper): + """A training helper that adds scheduled sampling directly to outputs. + + Returns False for sample_ids where no sampling took place; True elsewhere. + """ + + def __init__(self, inputs, sequence_length, sampling_probability, + time_major=False, seed=None, next_input_layer=None, name=None): + """Initializer. + + Args: + inputs: A (structure) of input tensors. + sequence_length: An int32 vector tensor. + sampling_probability: A 0D `float32` tensor: the probability of sampling + from the outputs instead of reading directly from the inputs. + time_major: Python bool. Whether the tensors in `inputs` are time major. + If `False` (default), they are assumed to be batch major. + seed: The sampling seed. + next_input_layer: (Optional) An instance of `tf.layers.Layer`, i.e., + `tf.layers.Dense`. Optional layer to apply to the RNN output to create + the next input. + name: Name scope for any created operations. + + Raises: + ValueError: if `sampling_probability` is not a scalar or vector. + """ + with ops.name_scope(name, "ScheduledOutputTrainingHelper", + [sampling_probability]): + self._sampling_probability = ops.convert_to_tensor( + sampling_probability, name="sampling_probability") + if self._sampling_probability.get_shape().ndims not in (0, 1): + raise ValueError( + "sampling_probability must be either a scalar or a vector. " + "saw shape: %s" % (self._sampling_probability.get_shape())) + + self._seed = seed + + if (next_input_layer is not None and not isinstance(next_input_layer, + layers_base._Layer)): # pylint: disable=protected-access + raise TypeError("next_input_layer must be a Layer, received: %s" % + type(next_input_layer)) + self._next_input_layer = next_input_layer + + super(ScheduledOutputTrainingHelper, self).__init__( + inputs=inputs, + sequence_length=sequence_length, + time_major=time_major, + name=name) + + def initialize(self, name=None): + return super(ScheduledOutputTrainingHelper, self).initialize(name=name) + + def sample(self, time, outputs, state, name=None): + with ops.name_scope(name, "ScheduledOutputTrainingHelperSample", + [time, outputs, state]): + sampler = bernoulli.Bernoulli(probs=self._sampling_probability) + return math_ops.cast( + sampler.sample(sample_shape=self.batch_size, seed=self._seed), + dtypes.bool) + + def next_inputs(self, time, outputs, state, sample_ids, name=None): + with ops.name_scope(name, "ScheduledOutputTrainingHelperNextInputs", + [time, outputs, state, sample_ids]): + (finished, base_next_inputs, state) = ( + super(ScheduledOutputTrainingHelper, self).next_inputs( + time=time, + outputs=outputs, + state=state, + sample_ids=sample_ids, + name=name)) + + def maybe_sample(): + """Perform scheduled sampling.""" + if self._next_input_layer is None: + return array_ops.where(sample_ids, outputs, base_next_inputs) + + where_sampling = math_ops.cast( + array_ops.where(sample_ids), dtypes.int32) + where_not_sampling = math_ops.cast( + array_ops.where(math_ops.logical_not(sample_ids)), dtypes.int32) + outputs_sampling = array_ops.gather_nd(outputs, where_sampling) + inputs_not_sampling = array_ops.gather_nd(base_next_inputs, + where_not_sampling) + sampled_next_inputs = self._next_input_layer(outputs_sampling) + base_shape = array_ops.shape(base_next_inputs) + return (array_ops.scatter_nd(indices=where_sampling, + updates=sampled_next_inputs, + shape=base_shape) + + array_ops.scatter_nd(indices=where_not_sampling, + updates=inputs_not_sampling, + shape=base_shape)) + + all_finished = math_ops.reduce_all(finished) + next_inputs = control_flow_ops.cond( + all_finished, lambda: base_next_inputs, maybe_sample) + return (finished, next_inputs, state) + + class GreedyEmbeddingHelper(Helper): """A helper for use during inference. -- GitLab From cd134b43a6662c8306cb5f2879987af4dd6379c7 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 07:39:06 -0800 Subject: [PATCH 036/101] Work around bug in some Clang versions that can lead to these macros expanded into different string literals compared to GCC. Change: 148767816 --- tensorflow/core/kernels/scatter_op.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tensorflow/core/kernels/scatter_op.cc b/tensorflow/core/kernels/scatter_op.cc index 827eb7dbca..d1df346b95 100644 --- a/tensorflow/core/kernels/scatter_op.cc +++ b/tensorflow/core/kernels/scatter_op.cc @@ -138,9 +138,13 @@ class ScatterUpdateOp : public OpKernel { .TypeConstraint("Tindices"), \ ScatterUpdateOp) +// There can be no space in front of "dev" here as that space would become part +// of the kernel name due to a Clang bug. +// clang-format off #define REGISTER_SCATTER_KERNEL(type, dev, name, op) \ - REGISTER_SCATTER_KERNEL_INDEX(type, int32, dev, name, op); \ - REGISTER_SCATTER_KERNEL_INDEX(type, int64, dev, name, op); + REGISTER_SCATTER_KERNEL_INDEX(type, int32,dev, name, op); \ + REGISTER_SCATTER_KERNEL_INDEX(type, int64,dev, name, op); +// clang-format on #define REGISTER_SCATTER_ARITHEMTIC(type, dev) \ REGISTER_SCATTER_KERNEL(type, dev, "ScatterAdd", scatter_op::UpdateOp::ADD); \ -- GitLab From 8e0ea6ad7cea764c754fe1459f6e77e41d060331 Mon Sep 17 00:00:00 2001 From: Alexandre Passos Date: Tue, 28 Feb 2017 09:27:59 -0800 Subject: [PATCH 037/101] Simple benchmark of resource manager overhead. Change: 148778464 --- tensorflow/core/kernels/BUILD | 15 +++++ tensorflow/core/kernels/variable_ops_test.cc | 68 ++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 tensorflow/core/kernels/variable_ops_test.cc diff --git a/tensorflow/core/kernels/BUILD b/tensorflow/core/kernels/BUILD index d2ffc99383..2503b441f7 100644 --- a/tensorflow/core/kernels/BUILD +++ b/tensorflow/core/kernels/BUILD @@ -257,6 +257,21 @@ tf_cc_test( ], ) +tf_cc_test( + name = "variable_ops_test", + size = "small", + srcs = ["variable_ops_test.cc"], + deps = [ + "//tensorflow/core:all_kernels", + "//tensorflow/core:core_cpu", + "//tensorflow/core:direct_session_internal", + "//tensorflow/core:framework", + "//tensorflow/core:lib", + "//tensorflow/core:test", + "//tensorflow/core:test_main", + ], +) + tf_kernel_library( name = "stage_op", srcs = ["stage_op.cc"], diff --git a/tensorflow/core/kernels/variable_ops_test.cc b/tensorflow/core/kernels/variable_ops_test.cc new file mode 100644 index 0000000000..7a615788cc --- /dev/null +++ b/tensorflow/core/kernels/variable_ops_test.cc @@ -0,0 +1,68 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#include "tensorflow/core/framework/op.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/graph/graph.h" +#include "tensorflow/core/graph/node_builder.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/test.h" +#include "tensorflow/core/platform/test_benchmark.h" +#include "tensorflow/core/public/session.h" + +namespace tensorflow { +namespace { + +// Benchmark to simulate the overhead in training and serving workloads from too +// many threads grabbing the ResourceMgr lock at the same time because of the +// variable and queue ops. +void ManyManyVariablesHelper(int threads, int variables, int iters) { + testing::StopTiming(); + Graph g(OpRegistry::Global()); + std::vector targets; + for (int i = 0; i < variables; ++i) { + Node* v; + TF_CHECK_OK( + NodeBuilder( + g.NewName("VeryVeryLongRealistSoundingVariableName/weights"), + "VariableV2") + .Attr("shape", TensorShape()) + .Attr("dtype", DT_FLOAT) + .Finalize(&g, &v)); + targets.push_back(v->name()); + } + GraphDef gd; + g.ToGraphDef(&gd); + SessionOptions opts; + opts.config.set_inter_op_parallelism_threads(threads); + Session* sess = NewSession(opts); + TF_CHECK_OK(sess->Create(gd)); + TF_CHECK_OK(sess->Run({}, {}, targets, nullptr)); + testing::StartTiming(); + for (int i = 0; i < iters; ++i) { + TF_CHECK_OK(sess->Run({}, {}, targets, nullptr)); + } + testing::StopTiming(); + delete sess; +} + +void BM_ManyManyVariablesManyThreads(int iters, int threads) { + ManyManyVariablesHelper(threads, 1000, iters); +} + +BENCHMARK(BM_ManyManyVariablesManyThreads)->Arg(50); + +} // namespace +} // namespace tensorflow -- GitLab From ff60875e88fb34914c36bd8c233156d0bab10221 Mon Sep 17 00:00:00 2001 From: Mustafa Ispir Date: Tue, 28 Feb 2017 10:31:38 -0800 Subject: [PATCH 038/101] Used scaffold in estimator.evaluate. Change: 148786108 --- tensorflow/python/estimator/estimator.py | 1 + tensorflow/python/estimator/estimator_test.py | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/tensorflow/python/estimator/estimator.py b/tensorflow/python/estimator/estimator.py index 7770bb7012..320ef4a561 100644 --- a/tensorflow/python/estimator/estimator.py +++ b/tensorflow/python/estimator/estimator.py @@ -383,6 +383,7 @@ class Estimator(object): eval_results = evaluation._evaluate_once( # pylint: disable=protected-access checkpoint_path=checkpoint_path, master=self._config.evaluation_master, + scaffold=estimator_spec.scaffold, eval_ops=update_op, final_ops=eval_dict, hooks=hooks, diff --git a/tensorflow/python/estimator/estimator_test.py b/tensorflow/python/estimator/estimator_test.py index 12d392ef7d..ff7b883f90 100644 --- a/tensorflow/python/estimator/estimator_test.py +++ b/tensorflow/python/estimator/estimator_test.py @@ -25,6 +25,7 @@ from tensorflow.python.estimator import run_config from tensorflow.python.framework import constant_op from tensorflow.python.ops import control_flow_ops from tensorflow.python.ops import state_ops +from tensorflow.python.ops import variables from tensorflow.python.platform import test from tensorflow.python.training import saver from tensorflow.python.training import session_run_hook @@ -390,6 +391,26 @@ class EstimatorEvaluateTest(test.TestCase): 'global_step': 5}, scores) + def test_scaffold_is_used(self): + + def _model_fn_scaffold(features, labels, mode): + _, _ = features, labels + variables.Variable(1., 'weight') + real_saver = saver.Saver() + self.mock_saver = test.mock.Mock( + wraps=real_saver, saver_def=real_saver.saver_def) + return model_fn_lib.EstimatorSpec( + mode=mode, + predictions=constant_op.constant([[1.]]), + loss=constant_op.constant(0.), + train_op=constant_op.constant(0.), + scaffold=training.Scaffold(saver=self.mock_saver)) + + est = estimator.Estimator(model_fn=_model_fn_scaffold) + est.fit(dummy_input_fn, steps=1) + est.evaluate(dummy_input_fn, steps=1) + self.assertTrue(self.mock_saver.restore.called) + if __name__ == '__main__': test.main() -- GitLab From e04ca3acc2b1ba54d4d66677e6a84e2bf3c30907 Mon Sep 17 00:00:00 2001 From: Blake Hechtman Date: Tue, 28 Feb 2017 10:34:40 -0800 Subject: [PATCH 039/101] Ensures Bitcast is not performed between different elment sizes. Removes restrictive requirement that replacing an operand requires compatible shapes which is not true with broadcast optimizations. Change: 148786513 --- .../xla/service/algebraic_simplifier.cc | 89 +++++++++++++++++++ .../xla/service/algebraic_simplifier_test.cc | 27 +++++- 2 files changed, 115 insertions(+), 1 deletion(-) diff --git a/tensorflow/compiler/xla/service/algebraic_simplifier.cc b/tensorflow/compiler/xla/service/algebraic_simplifier.cc index d35c6d6adb..efbfda4d3f 100644 --- a/tensorflow/compiler/xla/service/algebraic_simplifier.cc +++ b/tensorflow/compiler/xla/service/algebraic_simplifier.cc @@ -179,6 +179,11 @@ class AlgebraicSimplifierVisitor : public DfsHloVisitorWithDefault { HloInstruction* operand, HloInstruction* max, HloInstruction* max_operand); + // A Reshape or Broadcast that feeds an element-wise operation with a unique + // non-scalar operand can sink to after the operation. + StatusOr TryToSinkReshapeOrBroadcastAfterOpWithUniqueNonScalarOperand( + HloInstruction* reshape_or_broadcast); + // Current HloComputation instance the AlgebraicSimplifierVisitor is // traversing. HloComputation* computation_; @@ -460,6 +465,15 @@ Status AlgebraicSimplifierVisitor::HandleBroadcast(HloInstruction* broadcast) { } } + // A Broadcast that feeds a unary element-wise operation can sink the + // broadcast after the unary element-wise operation. + TF_ASSIGN_OR_RETURN( + changed_, + TryToSinkReshapeOrBroadcastAfterOpWithUniqueNonScalarOperand(broadcast)); + if (changed_) { + return Status::OK(); + } + // A scalar broadcast feeding an instruction which only permutes (reshape, // transpose, sort, reverse) or selects a subset of operand elements (slice, // dynamic slice) can be replaced with a broadcast directly to the output @@ -701,6 +715,72 @@ Status AlgebraicSimplifierVisitor::HandlePower(HloInstruction* power, return Status::OK(); } +StatusOr AlgebraicSimplifierVisitor:: + TryToSinkReshapeOrBroadcastAfterOpWithUniqueNonScalarOperand( + HloInstruction* reshape_or_broadcast) { + bool changed = false; + HloInstruction* operand = reshape_or_broadcast->mutable_operand(0); + for (HloInstruction* user : reshape_or_broadcast->users()) { + if (user->user_count() == 0 && user != computation_->root_instruction()) { + continue; + } + // Do not move reshapes or broadcasts past copies since the shape the copy + // will operate on will change. + if (user->opcode() == HloOpcode::kCopy) { + continue; + } + // Do not change the shape of fusion nodes in case there a multiple shapes + // inside the fusion node already. + if (user->opcode() == HloOpcode::kFusion) { + continue; + } + if (!user->IsElementwise()) { + continue; + } + + int64 reshape_or_broadcast_operand_index = -1; + // Find the unique non-scalar operand or continue if there isn't one. + int64 scalar_count = 0; + for (int64 i = 0; i < user->operand_count(); ++i) { + if (ShapeUtil::IsScalar(user->operand(i)->shape())) { + ++scalar_count; + } else { + reshape_or_broadcast_operand_index = i; + } + } + if (scalar_count != user->operand_count() - 1) { + continue; + } + CHECK_EQ(user->operand(reshape_or_broadcast_operand_index), + reshape_or_broadcast); + std::vector new_user_operands = user->operands(); + new_user_operands[reshape_or_broadcast_operand_index] = operand; + auto new_user = computation_->AddInstruction(user->CloneWithNewOperands( + ShapeUtil::MakeShape(user->shape().element_type(), + operand->shape().dimensions()), + new_user_operands)); + HloInstruction* new_reshape_or_broadcast = nullptr; + if (reshape_or_broadcast->opcode() == HloOpcode::kReshape) { + new_reshape_or_broadcast = + computation_->AddInstruction(HloInstruction::CreateReshape( + ShapeUtil::MakeShape(user->shape().element_type(), + reshape_or_broadcast->shape().dimensions()), + new_user)); + } else { + TF_RET_CHECK(reshape_or_broadcast->opcode() == HloOpcode::kBroadcast); + new_reshape_or_broadcast = + computation_->AddInstruction(HloInstruction::CreateBroadcast( + ShapeUtil::MakeShape(user->shape().element_type(), + reshape_or_broadcast->shape().dimensions()), + new_user, reshape_or_broadcast->dimensions())); + } + TF_RETURN_IF_ERROR( + computation_->ReplaceUsesOfInstruction(user, new_reshape_or_broadcast)); + changed = true; + } + return changed; +} + Status AlgebraicSimplifierVisitor::HandleReshape(HloInstruction* reshape) { auto operand = reshape->mutable_operand(0); @@ -732,6 +812,15 @@ Status AlgebraicSimplifierVisitor::HandleReshape(HloInstruction* reshape) { } } + // A Reshape that feeds a unary element-wise operation can sink the + // reshape after the unary element-wise operation. + TF_ASSIGN_OR_RETURN( + changed_, + TryToSinkReshapeOrBroadcastAfterOpWithUniqueNonScalarOperand(reshape)); + if (changed_) { + return Status::OK(); + } + // Make this a bitcast if possible. if (is_layout_sensitive_ && ReshapeIsBitcast(reshape, valid_bitcast_callback_)) { diff --git a/tensorflow/compiler/xla/service/algebraic_simplifier_test.cc b/tensorflow/compiler/xla/service/algebraic_simplifier_test.cc index 8dd94e2c70..327234688f 100644 --- a/tensorflow/compiler/xla/service/algebraic_simplifier_test.cc +++ b/tensorflow/compiler/xla/service/algebraic_simplifier_test.cc @@ -619,7 +619,7 @@ TEST_F(AlgebraicSimplifierTest, ReshapeReplacedWithBitcast) { AlgebraicSimplifier simplifier(/*is_layout_sensitive=*/true, bitcasting_callback()); - ASSERT_TRUE(simplifier.Run(module.get()).ValueOrDie()); + simplifier.Run(module.get()).ValueOrDie(); // Verify that only the first reshape is replaced. EXPECT_NE(transformable_reshape, computation->root_instruction()->operand(0)); @@ -630,6 +630,31 @@ TEST_F(AlgebraicSimplifierTest, ReshapeReplacedWithBitcast) { EXPECT_EQ(layout_wrong_reshape, computation->root_instruction()->operand(2)); } +TEST_F(AlgebraicSimplifierTest, ReshapeAfterEffectiveUnary) { + HloComputation::Builder builder(TestName()); + HloInstruction* param = + builder.AddInstruction(HloInstruction::CreateParameter( + 0, ShapeUtil::MakeShape(F32, {2, 3, 4, 5}), "param")); + HloInstruction* movable_reshape = + builder.AddInstruction(HloInstruction::CreateReshape( + ShapeUtil::MakeShape(F32, {1, 2, 3, 4, 5}), param)); + HloInstruction* zero = builder.AddInstruction( + HloInstruction::CreateConstant(LiteralUtil::CreateR0(0.0f))); + builder.AddInstruction( + HloInstruction::CreateBinary(ShapeUtil::MakeShape(F32, {1, 2, 3, 4, 5}), + HloOpcode::kMaximum, movable_reshape, zero)); + auto module = MakeUnique(TestName()); + auto computation = module->AddEntryComputation(builder.Build()); + HloInstruction* root = computation->root_instruction(); + EXPECT_EQ(root->opcode(), HloOpcode::kMaximum); + AlgebraicSimplifier simplifier(/*is_layout_sensitive=*/false, + bitcasting_callback()); + simplifier.Run(module.get()).ValueOrDie(); + EXPECT_EQ(HloOpcode::kReshape, computation->root_instruction()->opcode()); + EXPECT_EQ(HloOpcode::kMaximum, + computation->root_instruction()->operand(0)->opcode()); +} + TEST_F(AlgebraicSimplifierTest, TransposeEqualsBitcast1) { HloComputation::Builder builder(TestName()); HloInstruction* param = -- GitLab From e3d1c7d515d7c7b335a1fd58dde03b7f52409233 Mon Sep 17 00:00:00 2001 From: Shanqing Cai Date: Tue, 28 Feb 2017 10:51:13 -0800 Subject: [PATCH 040/101] tfdbg: add option to tolerate debug op creation failures Change: 148788753 --- tensorflow/core/debug/debug_graph_utils.cc | 32 ++++++++---- tensorflow/core/protobuf/debug.proto | 4 ++ tensorflow/python/debug/BUILD | 1 + tensorflow/python/debug/lib/debug_utils.py | 17 +++++++ .../python/debug/lib/session_debug_testlib.py | 50 +++++++++++++++++++ 5 files changed, 93 insertions(+), 11 deletions(-) diff --git a/tensorflow/core/debug/debug_graph_utils.cc b/tensorflow/core/debug/debug_graph_utils.cc index 6f5fe945b7..6ae5672860 100644 --- a/tensorflow/core/debug/debug_graph_utils.cc +++ b/tensorflow/core/debug/debug_graph_utils.cc @@ -47,6 +47,9 @@ const string DebuggerState::SummarizeDebugTensorWatches() { for (const DebugTensorWatch& watch : watches) { string tensor_name = strings::StrCat(watch.node_name(), ":", watch.output_slot()); + if (watch.tolerate_debug_op_creation_failures()) { + oss << "(TOL)"; // Shorthand for "tolerate". + } oss << tensor_name << "|"; for (const string& debug_op : watch.debug_ops()) { @@ -99,6 +102,7 @@ Status DebugNodeInserter::InsertNodes( std::unordered_map> tensor_watches; // A map from tensor name to debug_url. std::unordered_map> tensor_watch_urls; + std::unordered_map tensor_tolerate_failures; // Cache the proto content for fast lookup later for (const DebugTensorWatch& watch : watches) { @@ -121,6 +125,8 @@ Status DebugNodeInserter::InsertNodes( } tensor_watches[tensor_name] = debug_ops; + tensor_tolerate_failures[tensor_name] = + watch.tolerate_debug_op_creation_failures(); std::vector urls; for (const string& url : watch.debug_urls()) { @@ -204,18 +210,22 @@ Status DebugNodeInserter::InsertNodes( Status debug_s = CreateDebugNode( graph, device_type, copy_node->name(), src_dt, tensor_name, tensor_watch_urls[tensor_name], i, debug_op_name, &debug_node); - if (!debug_s.ok()) { - return Status( - error::FAILED_PRECONDITION, - strings::StrCat("Failed to create debug node ", debug_op_name, - " for tensor ", tensor_name, ", due to: ", - debug_s.error_message())); + if (debug_s.ok()) { + graph->AddEdge(copy_node, 0, debug_node, 0); + debug_nodes.push_back(debug_node); + } else { + if (tensor_tolerate_failures[tensor_name]) { + LOG(INFO) << "Tolerating failure to create debug node: " + << "tensor name = " << tensor_name << "; " + << "debug op name = " << debug_op_name; + } else { + return Status( + error::FAILED_PRECONDITION, + strings::StrCat("Failed to create debug node ", debug_op_name, + " for tensor ", tensor_name, + ", due to: ", debug_s.error_message())); + } } - - // Create edges from the Copy node to the debug node. - graph->AddEdge(copy_node, 0, debug_node, 0); - - debug_nodes.push_back(debug_node); } // Is the output a reference? diff --git a/tensorflow/core/protobuf/debug.proto b/tensorflow/core/protobuf/debug.proto index f35d7569be..e1e51b6f18 100644 --- a/tensorflow/core/protobuf/debug.proto +++ b/tensorflow/core/protobuf/debug.proto @@ -35,6 +35,10 @@ message DebugTensorWatch { // among the invocations. // TODO(cais): More visible documentation of this in g3docs. repeated string debug_urls = 4; + + // Do not error out if debug op creation fails (e.g., due to dtype + // incompatibility). Instead, just log the failure. + bool tolerate_debug_op_creation_failures = 5; } // EXPERIMENTAL. Options for initializing DebuggerState. diff --git a/tensorflow/python/debug/BUILD b/tensorflow/python/debug/BUILD index 66b12714e3..389c6e8174 100644 --- a/tensorflow/python/debug/BUILD +++ b/tensorflow/python/debug/BUILD @@ -413,6 +413,7 @@ py_library( "//tensorflow/python:framework_for_generated_wrappers", "//tensorflow/python:framework_test_lib", "//tensorflow/python:math_ops", + "//tensorflow/python:parsing_ops", "//tensorflow/python:platform_test", "//tensorflow/python:state_ops", "//tensorflow/python:training", diff --git a/tensorflow/python/debug/lib/debug_utils.py b/tensorflow/python/debug/lib/debug_utils.py index 9bccdfa32d..32df3b43a5 100644 --- a/tensorflow/python/debug/lib/debug_utils.py +++ b/tensorflow/python/debug/lib/debug_utils.py @@ -28,6 +28,7 @@ def add_debug_tensor_watch(run_options, output_slot=0, debug_ops="DebugIdentity", debug_urls=None, + tolerate_debug_op_creation_failures=False, global_step=-1): """Add watch on a `Tensor` to `RunOptions`. @@ -43,6 +44,8 @@ def add_debug_tensor_watch(run_options, `list` of `str` with only one element. debug_urls: (`str` or `list` of `str`) URL(s) to send debug values to, e.g., `file:///tmp/tfdbg_dump_1`, `grpc://localhost:12345`. + tolerate_debug_op_creation_failures: (`bool`) Whether to tolerate debug op + creation failures by not throwing exceptions. global_step: (`int`) Optional global_step count for this debug tensor watch. """ @@ -51,6 +54,8 @@ def add_debug_tensor_watch(run_options, run_options.debug_options.global_step = global_step watch = watch_opts.add() + watch.tolerate_debug_op_creation_failures = ( + tolerate_debug_op_creation_failures) watch.node_name = node_name watch.output_slot = output_slot @@ -72,6 +77,7 @@ def watch_graph(run_options, debug_urls=None, node_name_regex_whitelist=None, op_type_regex_whitelist=None, + tolerate_debug_op_creation_failures=False, global_step=-1): """Add debug watches to `RunOptions` for a TensorFlow graph. @@ -98,6 +104,9 @@ def watch_graph(run_options, are set, the two filtering operations will occur in a logical `AND` relation. In other words, a node will be included if and only if it hits both whitelists. + tolerate_debug_op_creation_failures: (`bool`) whether debug op creation + failures (e.g., due to dtype incompatibility) are to be tolerated by not + throwing exceptions. global_step: (`int`) Optional global_step count for this debug tensor watch. """ @@ -136,6 +145,8 @@ def watch_graph(run_options, output_slot=slot, debug_ops=debug_ops, debug_urls=debug_urls, + tolerate_debug_op_creation_failures=( + tolerate_debug_op_creation_failures), global_step=global_step) @@ -145,6 +156,7 @@ def watch_graph_with_blacklists(run_options, debug_urls=None, node_name_regex_blacklist=None, op_type_regex_blacklist=None, + tolerate_debug_op_creation_failures=False, global_step=-1): """Add debug tensor watches, blacklisting nodes and op types. @@ -170,6 +182,9 @@ def watch_graph_with_blacklists(run_options, relation. In other words, a node will be excluded if it hits either of the two blacklists; a node will be included if and only if it hits neither of the blacklists. + tolerate_debug_op_creation_failures: (`bool`) whether debug op creation + failures (e.g., due to dtype incompatibility) are to be tolerated by not + throwing exceptions. global_step: (`int`) Optional global_step count for this debug tensor watch. """ @@ -208,4 +223,6 @@ def watch_graph_with_blacklists(run_options, output_slot=slot, debug_ops=debug_ops, debug_urls=debug_urls, + tolerate_debug_op_creation_failures=( + tolerate_debug_op_creation_failures), global_step=global_step) diff --git a/tensorflow/python/debug/lib/session_debug_testlib.py b/tensorflow/python/debug/lib/session_debug_testlib.py index c6b229f786..fd4b4aecd6 100644 --- a/tensorflow/python/debug/lib/session_debug_testlib.py +++ b/tensorflow/python/debug/lib/session_debug_testlib.py @@ -42,6 +42,7 @@ from tensorflow.python.ops import array_ops from tensorflow.python.ops import control_flow_ops from tensorflow.python.ops import data_flow_ops from tensorflow.python.ops import math_ops +from tensorflow.python.ops import parsing_ops from tensorflow.python.ops import state_ops from tensorflow.python.ops import variables from tensorflow.python.platform import googletest @@ -1096,6 +1097,55 @@ class SessionDebugTestBase(test_util.TensorFlowTestCase): self.assertTrue(np.isnan(numeric_summary[10])) self.assertTrue(np.isnan(numeric_summary[11])) + def testDebugNumericSummaryFailureIsToleratedWhenOrdered(self): + with session.Session() as sess: + a = variables.Variable("1", name="a") + b = variables.Variable("3", name="b") + c = variables.Variable("2", name="c") + + d = math_ops.add(a, b, name="d") + e = math_ops.add(d, c, name="e") + n = parsing_ops.string_to_number(e, name="n") + m = math_ops.add(n, n, name="m") + + sess.run(variables.global_variables_initializer()) + + # Using DebugNumericSummary on sess.run(m) with the default + # tolerate_debug_op_creation_failures=False should error out due to the + # presence of string-dtype Tensors in the graph. + run_metadata = config_pb2.RunMetadata() + run_options = config_pb2.RunOptions(output_partition_graphs=True) + debug_utils.watch_graph( + run_options, + sess.graph, + debug_ops=["DebugNumericSummary"], + debug_urls=self._debug_urls()) + with self.assertRaises(errors.FailedPreconditionError): + sess.run(m, options=run_options, run_metadata=run_metadata) + + # Using tolerate_debug_op_creation_failures=True should get rid of the + # error. + new_run_options = config_pb2.RunOptions(output_partition_graphs=True) + debug_utils.watch_graph( + new_run_options, + sess.graph, + debug_ops=["DebugNumericSummary"], + debug_urls=self._debug_urls(), + tolerate_debug_op_creation_failures=True) + + self.assertEqual(264, + sess.run( + m, + options=new_run_options, + run_metadata=run_metadata)) + + # The integer-dtype Tensors in the graph should have been dumped + # properly. + dump = debug_data.DebugDumpDir( + self._dump_root, partition_graphs=run_metadata.partition_graphs) + self.assertIn("n:0:DebugNumericSummary", dump.debug_watch_keys("n")) + self.assertIn("m:0:DebugNumericSummary", dump.debug_watch_keys("m")) + def testDebugQueueOpsDoesNotoErrorOut(self): with session.Session() as sess: q = data_flow_ops.FIFOQueue(3, "float", name="fifo_queue") -- GitLab From 38a0dd395a4ee427348f11326d4d04d9c9ea83bc Mon Sep 17 00:00:00 2001 From: Jacques Pienaar Date: Tue, 28 Feb 2017 11:09:12 -0800 Subject: [PATCH 041/101] [XLA] Add predicate reduce test. Change: 148791273 --- .../compiler/xla/client/lib/arithmetic.cc | 18 +++++ .../compiler/xla/client/lib/arithmetic.h | 6 ++ tensorflow/compiler/xla/tests/reduce_test.cc | 69 +++++++++++++++++++ 3 files changed, 93 insertions(+) diff --git a/tensorflow/compiler/xla/client/lib/arithmetic.cc b/tensorflow/compiler/xla/client/lib/arithmetic.cc index 31efd8ee64..040276f0ae 100644 --- a/tensorflow/compiler/xla/client/lib/arithmetic.cc +++ b/tensorflow/compiler/xla/client/lib/arithmetic.cc @@ -64,4 +64,22 @@ Computation CreateScalarMinComputation(PrimitiveType type, return b->BuildAndNoteError(); } +Computation CreateScalarLogicalAndComputation(ComputationBuilder* builder) { + const Shape scalar = ShapeUtil::MakeShape(PRED, {}); + auto b = builder->CreateSubBuilder("logical_and"); + auto lhs = b->Parameter(0, scalar, "lhs"); + auto rhs = b->Parameter(1, scalar, "rhs"); + b->LogicalAnd(lhs, rhs); + return b->BuildAndNoteError(); +} + +Computation CreateScalarLogicalOrComputation(ComputationBuilder* builder) { + const Shape scalar = ShapeUtil::MakeShape(PRED, {}); + auto b = builder->CreateSubBuilder("logical_or"); + auto lhs = b->Parameter(0, scalar, "lhs"); + auto rhs = b->Parameter(1, scalar, "rhs"); + b->LogicalOr(lhs, rhs); + return b->BuildAndNoteError(); +} + } // namespace xla diff --git a/tensorflow/compiler/xla/client/lib/arithmetic.h b/tensorflow/compiler/xla/client/lib/arithmetic.h index 57fe7d7462..93b6733e21 100644 --- a/tensorflow/compiler/xla/client/lib/arithmetic.h +++ b/tensorflow/compiler/xla/client/lib/arithmetic.h @@ -40,6 +40,12 @@ Computation CreateScalarMaxComputation(PrimitiveType type, Computation CreateScalarMinComputation(PrimitiveType type, ComputationBuilder* builder); +// Creates a scalar logical AND computation and returns it. +Computation CreateScalarLogicalAndComputation(ComputationBuilder* builder); + +// Creates a scalar logical OR computation and returns it. +Computation CreateScalarLogicalOrComputation(ComputationBuilder* builder); + } // namespace xla #endif // TENSORFLOW_COMPILER_XLA_CLIENT_LIB_ARITHMETIC_H_ diff --git a/tensorflow/compiler/xla/tests/reduce_test.cc b/tensorflow/compiler/xla/tests/reduce_test.cc index f3d8da5c8c..3d61b624dc 100644 --- a/tensorflow/compiler/xla/tests/reduce_test.cc +++ b/tensorflow/compiler/xla/tests/reduce_test.cc @@ -109,6 +109,41 @@ class ReduceTest : public ClientLibraryTestBase { ErrorSpec(0.001)); } + void RunR1ToR0PredTest(bool and_reduce, + tensorflow::gtl::ArraySlice input_data) { + const int element_count = input_data.size(); + ComputationBuilder builder(client_, TestName()); + const Shape input_shape = ShapeUtil::MakeShape(S32, {element_count}); + auto input_par = builder.Parameter(0, input_shape, "input"); + auto pred_values = + builder.Eq(input_par, builder.ConstantR1(element_count, 1)); + ComputationDataHandle init_value; + Computation reduce; + if (and_reduce) { + init_value = builder.ConstantR0(true); + reduce = CreateScalarLogicalAndComputation(&builder); + } else { + init_value = builder.ConstantR0(false); + reduce = CreateScalarLogicalOrComputation(&builder); + } + builder.Reduce(pred_values, init_value, reduce, + /*dimensions_to_reduce=*/{0}); + + std::unique_ptr input_literal = LiteralUtil::CreateR1(input_data); + std::unique_ptr input_global_data = + client_->TransferToServer(*input_literal).ConsumeValueOrDie(); + + bool expected = and_reduce; + for (bool item : input_data) { + if (and_reduce) { + expected = expected && item; + } else { + expected = expected || item; + } + } + ComputeAndCompareR0(&builder, expected, {input_global_data.get()}); + } + // Runs an R2 => R0 reduction test with the given number of (rows, cols). void RunR2ToR0Test(int64 rows, int64 cols, int64 minor = 1, int64 major = 0) { ComputationBuilder builder(client_, TestName()); @@ -219,6 +254,40 @@ XLA_TEST_F(ReduceTest, ReduceR2_111x50_01_To_R1) { XLA_TEST_F(ReduceTest, ReduceR2_1024x1024_To_R1) { RunR2ToR1Test(1024, 1024); } XLA_TEST_F(ReduceTest, ReduceR2_1000x1500_To_R1) { RunR2ToR1Test(1000, 1500); } +// TODO(b/34969189): Invalid CAS generated on GPU. +XLA_TEST_F(ReduceTest, DISABLED_ON_GPU(AndReduceAllOnesR1_10_Pred)) { + constexpr int element_count = 10; + std::vector input(element_count, 1); + RunR1ToR0PredTest(/*and_reduce=*/true, input); +} + +// TODO(b/34969189): Invalid CAS generated on GPU. +XLA_TEST_F(ReduceTest, DISABLED_ON_GPU(AndReduceOnesAndZerosR1_10_Pred)) { + constexpr int element_count = 10; + std::vector input(element_count); + for (int i = 0; i < element_count; ++i) { + input[i] = i % 2; + } + RunR1ToR0PredTest(/*and_reduce=*/true, input); +} + +// TODO(b/34969189): Invalid CAS generated on GPU. +XLA_TEST_F(ReduceTest, DISABLED_ON_GPU(OrReduceAllOnesR1_10_Pred)) { + constexpr int element_count = 10; + std::vector input(element_count, 1); + RunR1ToR0PredTest(/*and_reduce=*/false, input); +} + +// TODO(b/34969189): Invalid CAS generated on GPU. +XLA_TEST_F(ReduceTest, DISABLED_ON_GPU(OrReduceOnesAndZerosR1_10_Pred)) { + constexpr int element_count = 10; + std::vector input(element_count); + for (int i = 0; i < element_count; ++i) { + input[i] = i % 2; + } + RunR1ToR0PredTest(/*and_reduce=*/false, input); +} + XLA_TEST_F(ReduceTest, ReduceElementwiseR2_111x50_To_R1) { const int64 rows = 111, cols = 50; -- GitLab From 06a447464b3cb337712c0b00459671f1a0407f02 Mon Sep 17 00:00:00 2001 From: Blake Hechtman Date: Tue, 28 Feb 2017 11:32:42 -0800 Subject: [PATCH 042/101] Removes unecessary tf_gather from cross entropy loss. Change: 148794476 --- tensorflow/python/ops/nn_ops.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tensorflow/python/ops/nn_ops.py b/tensorflow/python/ops/nn_ops.py index 8fbab2b472..886dfa9cc1 100644 --- a/tensorflow/python/ops/nn_ops.py +++ b/tensorflow/python/ops/nn_ops.py @@ -1719,8 +1719,7 @@ def sparse_softmax_cross_entropy_with_logits(_sentinel=None, # pylint: disable= return cost # Reshape logits to 2 dim, labels to 1 dim. - num_classes = array_ops.gather(array_ops.shape(logits), - array_ops.rank(logits) - 1) + num_classes = array_ops.shape(logits)[array_ops.rank(logits) - 1] precise_logits = array_ops.reshape(precise_logits, [-1, num_classes]) labels = array_ops.reshape(labels, [-1]) # The second output tensor contains the gradients. We use it in -- GitLab From 59973f3c337d7953bd8870cdedf26959e3b7b185 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 11:40:49 -0800 Subject: [PATCH 043/101] Replace broken junit download link with maven. Change: 148795638 --- tensorflow/workspace.bzl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl index 3a20befef8..246c83931c 100644 --- a/tensorflow/workspace.bzl +++ b/tensorflow/workspace.bzl @@ -414,15 +414,15 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""): ) # Make junit-4.12 available as //external:junit - native.http_jar( - name = "junit_jar", - url = "https://github.com/junit-team/junit4/releases/download/r4.12/junit-4.12.jar", - sha256 = "59721f0805e223d84b90677887d9ff567dc534d7c502ca903c0c2b17f05c116a", + native.maven_jar( + name = "junit_junit", + artifact = "junit:junit:4.12", + sha1 = "2973d150c0dc1fefe998f834810d68f278ea58ec", ) native.bind( name = "junit", - actual = "@junit_jar//jar", + actual = "@junit_junit//jar", ) temp_workaround_http_archive( -- GitLab From d08b72a3e226f87ded59e3f6d2d820c49e8c78f1 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 11:55:55 -0800 Subject: [PATCH 044/101] Use buffer forwarding in assign_op. Change: 148797512 --- tensorflow/core/common_runtime/executor.cc | 27 +++---- tensorflow/core/kernels/assign_op.h | 90 ++++++++++++++-------- 2 files changed, 73 insertions(+), 44 deletions(-) diff --git a/tensorflow/core/common_runtime/executor.cc b/tensorflow/core/common_runtime/executor.cc index 6987d637b4..98da489b15 100644 --- a/tensorflow/core/common_runtime/executor.cc +++ b/tensorflow/core/common_runtime/executor.cc @@ -421,9 +421,9 @@ class ExecutorImpl : public Executor { // connected to n by a single edge, but might be a downstream // consumer of n's output by reference. *attr is updated with any // necessary attributes. -static Status InferAllocAttr(const Node* n, const Node* dst, - const DeviceNameUtils::ParsedName& local_dev_name, - AllocatorAttributes* attr); +Status InferAllocAttr(const Node* n, const Node* dst, + const DeviceNameUtils::ParsedName& local_dev_name, + AllocatorAttributes* attr); GraphView::~GraphView() { static_assert(std::is_trivially_destructible::value, @@ -478,7 +478,7 @@ char* GraphView::InitializeNode(char* ptr, const Node* n) { CHECK(node_offsets_[id] == kuint32max); // Initial value in constructor const size_t bytes = NodeItemBytes(n); - static constexpr size_t kItemAlignment = sizeof(NodeItem*); + constexpr size_t kItemAlignment = sizeof(NodeItem*); CHECK_EQ(reinterpret_cast(ptr) % kItemAlignment, 0); NodeItem* item = reinterpret_cast(ptr); @@ -568,8 +568,7 @@ void GraphView::Initialize(const Graph* g) { CHECK_EQ(ptr, space_ + total_bytes); } -static void GetMaxPendingCounts(const Node* n, int* max_pending, - int* max_dead_count) { +void GetMaxPendingCounts(const Node* n, int* max_pending, int* max_dead_count) { const int num_in_edges = n->in_edges().size(); int initial_count; if (IsMerge(n)) { @@ -691,20 +690,22 @@ Status GraphView::SetAllocAttrs(const Graph* g, const Device* device) { } for (int out = 0; out < n->num_outputs(); out++) { - OpKernel* op_kernel = item->kernel; + const OpKernel* op_kernel = item->kernel; DCHECK_LT(out, op_kernel->output_memory_types().size()); bool on_host = op_kernel->output_memory_types()[out] == HOST_MEMORY; - AllocatorAttributes h; - h.set_on_host(on_host); - attrs[out].Merge(h); + if (on_host) { + AllocatorAttributes h; + h.set_on_host(on_host); + attrs[out].Merge(h); + } } } return s; } -static Status InferAllocAttr(const Node* n, const Node* dst, - const DeviceNameUtils::ParsedName& local_dev_name, - AllocatorAttributes* attr) { +Status InferAllocAttr(const Node* n, const Node* dst, + const DeviceNameUtils::ParsedName& local_dev_name, + AllocatorAttributes* attr) { Status s; // Note that it's possible for *n to be a Recv and *dst to be a Send, // so these two cases are not mutually exclusive. diff --git a/tensorflow/core/kernels/assign_op.h b/tensorflow/core/kernels/assign_op.h index da0ccda9eb..1d2e1c8c9a 100644 --- a/tensorflow/core/kernels/assign_op.h +++ b/tensorflow/core/kernels/assign_op.h @@ -39,60 +39,88 @@ class AssignOp : public OpKernel { } void Compute(OpKernelContext* context) override { - Tensor rhs = context->input(1); + const Tensor& rhs = context->input(1); // We always return the input ref. context->forward_ref_input_to_ref_output(0, 0); - // If the left hand side is not initialized, or the shape of the - // right-hand side is different than the left hand side, we need - // to allocate a new tensor. + // We can't always know how this value will be used downstream, + // so make conservative assumptions in specifying constraints on + // the memory allocation attributes. + // TODO(rmlarsen): These conservative constraints make buffer + // forwarding unlikely to happen very often. Try to use graph analysis + // (possibly the InferAllocAttr pass in the executer) to improve the + // situation. + AllocatorAttributes attr; + attr.set_gpu_compatible(true); + attr.set_nic_compatible(true); + { mutex_lock l(*context->input_ref_mutex(0)); - - Tensor old_lhs = context->mutable_input(0, true); - + const Tensor& old_lhs = context->mutable_input(0, /* lock_held */ true); + const bool same_shape = old_lhs.shape().IsSameSize(rhs.shape()); if (validate_shape_) { OP_REQUIRES( - context, old_lhs.shape().IsSameSize(rhs.shape()), + context, same_shape, errors::InvalidArgument( "Assign requires shapes of both tensors to match. lhs shape= ", - old_lhs.shape().DebugString(), " rhs shape= ", - rhs.shape().DebugString())); + old_lhs.shape().DebugString(), + " rhs shape= ", rhs.shape().DebugString())); } - const bool same_shape = old_lhs.shape().IsSameSize(rhs.shape()); - if (!old_lhs.IsInitialized() || !same_shape) { - // Create new tensor whose shape matches the right hand side - // and copy then hand off to lhs. - // We can't always know how this value will be used downstream, - // so make conservative assumptions in specifying the memory - // allocation attributes. - AllocatorAttributes attr; - attr.set_gpu_compatible(true); - attr.set_nic_compatible(true); + // In the code below we try to minimize the amount of memory allocation + // and copying by trying the following two shortcuts: + // 1. If we can reuse the rhs buffer we avoid both a memory allocation + // and copying. + // 2. If the lhs is initialized and has the same number of elements as the + // rhs we can avoid a memory allocation. + + // 1. Try to reuse the rhs. + std::unique_ptr input_alias = context->forward_input( + 1, old_lhs.dtype(), old_lhs.shape(), DEVICE_MEMORY, attr); + if (input_alias != nullptr) { + // Transfer ownership to the ref. + context->replace_ref_input(0, *input_alias.release(), + /* lock_held */ true); + return; + } + + // 2. Try to copy into an existing buffer. + if (old_lhs.IsInitialized() && + old_lhs.shape().num_elements() == rhs.shape().num_elements()) { + // The existing lhs tensor has already been initialized and the right + // hand side can fit in the underlying buffer. + Tensor reshaped_old_lhs; + if (same_shape) { + reshaped_old_lhs = old_lhs; + } else { + CHECK(reshaped_old_lhs.CopyFrom(old_lhs, rhs.shape())); + context->replace_ref_input(0, reshaped_old_lhs, /* lock_held */ true); + } + if (use_exclusive_lock_) { + Copy(context, &reshaped_old_lhs, rhs); + return; + } + } else { + // Create a new persistent tensor whose shape matches the right hand + // side, hand off to lhs and copy the rhs into it. PersistentTensor copy; Tensor* copyTensor = nullptr; OP_REQUIRES_OK( context, context->allocate_persistent(old_lhs.dtype(), rhs.shape(), ©, ©Tensor, attr)); - Copy(context, copyTensor, rhs); - context->replace_ref_input(0, *copyTensor, true); - return; - } - - // The tensor has already been initialized and the right hand side - // matches the left hand side's shape. - if (use_exclusive_lock_) { - Copy(context, &old_lhs, rhs); - return; + context->replace_ref_input(0, *copyTensor, /* lock_held */ true); + if (use_exclusive_lock_) { + Copy(context, copyTensor, rhs); + return; + } } } // The tensor has already been initialized and the right hand side // matches the left hand side's shape. We have been told to do the // copy outside the lock. - Tensor old_unlocked_lhs = context->mutable_input(0, false); + Tensor old_unlocked_lhs = context->mutable_input(0, /* lock_held */ false); Copy(context, &old_unlocked_lhs, rhs); } -- GitLab From cc8f7a774726bff6ed44526a1a604b6efabcd850 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 12:35:30 -0800 Subject: [PATCH 045/101] Remove kubectl_util and benchmark_util from tensorflow repo since they now live under benchmarks repo (https://github.com/tensorflow/benchmarks). Change: 148802196 --- tensorflow/tools/dist_test/python/BUILD | 23 -- .../tools/dist_test/python/benchmark_util.py | 77 ------- .../dist_test/python/benchmark_util_test.py | 58 ------ tensorflow/tools/dist_test/scripts/BUILD | 16 -- .../tools/dist_test/scripts/kubectl_util.py | 196 ------------------ .../dist_test/scripts/kubectl_util_test.py | 72 ------- 6 files changed, 442 deletions(-) delete mode 100644 tensorflow/tools/dist_test/python/BUILD delete mode 100644 tensorflow/tools/dist_test/python/benchmark_util.py delete mode 100644 tensorflow/tools/dist_test/python/benchmark_util_test.py delete mode 100644 tensorflow/tools/dist_test/scripts/kubectl_util.py delete mode 100644 tensorflow/tools/dist_test/scripts/kubectl_util_test.py diff --git a/tensorflow/tools/dist_test/python/BUILD b/tensorflow/tools/dist_test/python/BUILD deleted file mode 100644 index a2927c5bfc..0000000000 --- a/tensorflow/tools/dist_test/python/BUILD +++ /dev/null @@ -1,23 +0,0 @@ -# Python tools for running distributed benchmarks. - -licenses(["notice"]) # Apache 2.0 - -py_library( - name = "benchmark_util_lib", - srcs = ["benchmark_util.py"], - srcs_version = "PY2AND3", - deps = [ - "//tensorflow/core:protos_all_py", - "//tensorflow/python:platform", - ], -) - -py_test( - name = "benchmark_util_test", - srcs = ["benchmark_util_test.py"], - srcs_version = "PY2AND3", - deps = [ - ":benchmark_util_lib", - "//tensorflow/python:client_testlib", - ], -) diff --git a/tensorflow/tools/dist_test/python/benchmark_util.py b/tensorflow/tools/dist_test/python/benchmark_util.py deleted file mode 100644 index 5727908d6f..0000000000 --- a/tensorflow/tools/dist_test/python/benchmark_util.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright 2016 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== - -"""Provides helper functions for distributed benchmarks running on Jenkins.""" -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import calendar -from collections import namedtuple -import os - -from google.protobuf import json_format - -from tensorflow.core.util import test_log_pb2 -from tensorflow.python.platform import gfile - - -_OUTPUT_FILE_ENV_VAR = 'TF_DIST_BENCHMARK_RESULTS_FILE' -_TEST_NAME_ENV_VAR = 'TF_DIST_BENCHMARK_NAME' - - -# Represents a single timing entry where -# - name is a string -# - timing is the latency to track (for e.g. mean time per iter) -# - iters is the number of iterations -TimingEntry = namedtuple( - 'TimingEntry', ['name', 'timing', 'iters']) - - -def store_data_in_json(timing_entries, start_time, output_file=None): - """Stores benchmark results in JSON format. - - Args: - timing_entries: list of TimingEntry objects. - start_time: (datetime) start time of the test run. - output_file: if specified, writes benchmark results to output_file. - If not specified, writes results to the file specified by - BENCHMARK_RESULTS_FILE environment variable. - - Raises: - ValueError: when neither output_file is passed in nor - BENCHMARK_RESULTS_FILE is set. - """ - test_result = test_log_pb2.TestResults( - start_time=calendar.timegm(start_time.timetuple())) - if not output_file: - if _OUTPUT_FILE_ENV_VAR not in os.environ: - raise ValueError('Could not determine location to store results at.') - output_file = os.environ[_OUTPUT_FILE_ENV_VAR] - - with gfile.Open(output_file, 'wb') as jsonfile: - if _TEST_NAME_ENV_VAR in os.environ: - test_result.name = os.environ['POD_NAME_PREFIX'] - else: - test_result.name = 'TestBenchmark' - - for timing_entry in timing_entries: - test_result.entries.entry.add( - name=timing_entry.name, - iters=timing_entry.iters, - wall_time=timing_entry.timing - ) - json_test_results = json_format.MessageToJson(test_result) - jsonfile.write(json_test_results) diff --git a/tensorflow/tools/dist_test/python/benchmark_util_test.py b/tensorflow/tools/dist_test/python/benchmark_util_test.py deleted file mode 100644 index e8a71f3153..0000000000 --- a/tensorflow/tools/dist_test/python/benchmark_util_test.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright 2017 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== -"""Tests for tensorflow.tools.dist_test.python.benchmark_util.""" - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import datetime -import json -import os - -from tensorflow.python.platform import googletest -from tensorflow.python.platform import test -from tensorflow.tools.dist_test.python import benchmark_util - - -class BenchmarkUtilTest(googletest.TestCase): - - def testStoreDataWithNoEntries(self): - output_file = os.path.join(test.get_temp_dir(), 'test_output1.json') - timing_entries = [] - benchmark_util.store_data_in_json( - timing_entries, datetime.date(2017, 1, 1), output_file) - json_output = json.loads(open(output_file, 'r').read()) - self.assertEquals('TestBenchmark', json_output['name']) - self.assertEquals(u'1483228800', json_output['startTime']) - - def testStoreDataWithEntries(self): - output_file = os.path.join(test.get_temp_dir(), 'test_output2.json') - timing_entries = [ - benchmark_util.TimingEntry('test', 0.1, 1)] - benchmark_util.store_data_in_json( - timing_entries, datetime.date(2017, 1, 1), output_file) - json_output = json.loads(open(output_file, 'r').read()) - - self.assertEquals(1, len(json_output['entries']['entry'])) - self.assertEquals('test', json_output['entries']['entry'][0]['name']) - self.assertEquals(0.1, json_output['entries']['entry'][0]['wallTime']) - self.assertEquals(u'1', json_output['entries']['entry'][0]['iters']) - self.assertEquals(u'1483228800', json_output['startTime']) - self.assertEquals('TestBenchmark', json_output['name']) - - -if __name__ == '__main__': - googletest.main() diff --git a/tensorflow/tools/dist_test/scripts/BUILD b/tensorflow/tools/dist_test/scripts/BUILD index 9041a19af7..abcd521a26 100644 --- a/tensorflow/tools/dist_test/scripts/BUILD +++ b/tensorflow/tools/dist_test/scripts/BUILD @@ -19,19 +19,3 @@ py_test( "//tensorflow/python:client_testlib", ], ) - -py_library( - name = "kubectl_util_lib", - srcs = ["kubectl_util.py"], - srcs_version = "PY2AND3", -) - -py_test( - name = "kubectl_util_test", - srcs = ["kubectl_util_test.py"], - srcs_version = "PY2AND3", - deps = [ - ":kubectl_util_lib", - "//tensorflow/python:client_testlib", - ], -) diff --git a/tensorflow/tools/dist_test/scripts/kubectl_util.py b/tensorflow/tools/dist_test/scripts/kubectl_util.py deleted file mode 100644 index ae0c5601e9..0000000000 --- a/tensorflow/tools/dist_test/scripts/kubectl_util.py +++ /dev/null @@ -1,196 +0,0 @@ -# Copyright 2017 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== -"""Utils for running, waiting and stopping benchmark jobs on kubernetes. - -Functions in this file assume kubernetes jobs have 'name-prefix' and 'job' -selectors set. -""" -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import logging -import subprocess -import time - - -_KUBECTL = 'kubectl' -WAIT_PERIOD_SECONDS = 20 - - -class TimeoutError(Exception): - pass - - -def _WaitUntil(timeout, predicate, *args): - start_time = time.time() - while time.time() - start_time < timeout: - time.sleep(WAIT_PERIOD_SECONDS) - if predicate(*args): - return True - return False - - -def _GetPodNames(pod_name_prefix, job_name=None): - """Get pod names based on the pod_name_prefix and job_name. - - Args: - pod_name_prefix: value of 'name-prefix' selector. - job_name: value of 'job' selector. If None, pod names will be - selected only based on 'name-prefix' selector. - - Returns: - List of pod names. - """ - pod_list_command = [ - _KUBECTL, 'get', 'pods', '-o', 'name', - '-l', _GetJobSelector(pod_name_prefix, job_name)] - logging.info('Command to get pod names: %s', ' '.join(pod_list_command)) - output = subprocess.check_output(pod_list_command, universal_newlines=True) - pod_names = [name for name in output.strip().split('\n') if name] - logging.info('Pod names: "%s"', ','.join(pod_names)) - return pod_names - - -def CreatePods(pod_name, yaml_file): - """Creates pods based on the given kubernetes config. - - Args: - pod_name: 'name-prefix' selector for the pods. - yaml_file: kubernetes yaml config. - - Raises: - TimeoutError: if jobs didn't come up for a long time. - """ - command = [_KUBECTL, 'create', '--filename=%s' % yaml_file] - logging.info('Creating pods: %s', subprocess.list2cmdline(command)) - subprocess.check_call(command) - - if not _WaitUntil(100, _GetPodNames, pod_name): - raise TimeoutError( - 'Timed out waiting for %s pod to come up.' % pod_name) - - -def DeletePods(pod_name, yaml_file): - """Deletes pods based on the given kubernetes config. - - Args: - pod_name: 'name-prefix' selector for the pods. - yaml_file: kubernetes yaml config. - - Raises: - TimeoutError: if jobs didn't terminate for a long time. - """ - command = [_KUBECTL, 'delete', '--filename=%s' % yaml_file] - logging.info('Deleting pods: %s', ' '.join(command)) - subprocess.call(command) - - def CheckPodsAreTerminated(): - return not _GetPodNames(pod_name) - if not _WaitUntil(100, CheckPodsAreTerminated): - raise TimeoutError( - 'Timed out waiting for %s pod to terminate.' % pod_name) - - -def _GetJobSelector(pod_name_prefix, job_name=None): - selector = 'name-prefix in (%s)' % pod_name_prefix - if job_name: - selector += ',job in (%s)' % job_name - return selector - - -def WaitForCompletion(pod_name_prefix, job_name='worker', timeout=2*60*60): - """Waits until jobs matching pod_name and job_name are terminated. - - Args: - pod_name_prefix: value of 'name-prefix' selector. - job_name: value of 'job' selector. - timeout: how long to wait for jobs to terminate before timing out. - - Returns: - True if jobs terminated with success, False otherwise. - - Raises: - TimeoutError: if jobs haven't terminated after timeout. - ValueError: if we couldn't find jobs matching pod_name and job_name. - """ - # Jsonpath that selects comma-separated exit codes (followed by extra comma - # at the end). - # If a job doesn't have an exit code yet, empty string will be returned - # instead. For ex. output for 2 jobs where one is missing an exit code - # and the other one has an exit code of 0 would look like: ,0, - last_state_query = ( - 'jsonpath=\'{range .items[*]}' - '{.status.containerStatuses[?(@.lastState.terminated)]' - '.lastState.terminated.exitCode},{end}\'') - status_command = [ - _KUBECTL, 'get', '-o', last_state_query, - 'pods', '-l', _GetJobSelector(pod_name_prefix, job_name) - ] - - exit_codes = [] - start_time = time.time() - while time.time() - start_time < timeout: - # Output of check_output is a string that starts and ends with '. - output = subprocess.check_output( - status_command, universal_newlines=True).strip('\'') - logging.debug('Pod status: %s', output) - if not output: - raise ValueError( - 'Query did not match any data. Query: %s' % ' '.join(status_command)) - # Output will end with an extra comma. So, we remove it before splitting. - exit_codes = output[:-1].split(',') - if '' not in exit_codes: # fetched all exit codes - break - time.sleep(WAIT_PERIOD_SECONDS) - - if '' in exit_codes: - raise TimeoutError( - 'Timed out waiting for %s %s jobs to finish.' % - (pod_name_prefix, job_name)) - _PrintLogs(pod_name_prefix, job_name) - - failed_job_count = sum(code != '0' for code in exit_codes) - if failed_job_count > 0: - logging.error('%d out of %d jobs failed. Exit codes: %s', - failed_job_count, len(exit_codes), ','.join(exit_codes)) - return False - return True - - -def _PrintLogs(pod_name_prefix, job_name): - """Prints pod logs. - - If a pod has been restarted, prints logs from previous run. Otherwise, - prints the logs from current run. We print logs for pods selected - based on pod_name_prefix and job_name. - - Args: - pod_name_prefix: value of 'name-prefix' selector. - job_name: value of 'job' selector. - """ - for pod_name in _GetPodNames(pod_name_prefix, job_name): - try: - # Get previous logs. - logs_command = [_KUBECTL, 'logs', '-p', pod_name] - logging.info('Command to get logs: %s', ' '.join(logs_command)) - output = subprocess.check_output(logs_command, universal_newlines=True) - except subprocess.CalledProcessError: - # We couldn't get previous logs, so we will try to get current logs. - logs_command = [_KUBECTL, 'logs', pod_name] - logging.info('Command to get logs: %s', ' '.join(logs_command)) - output = subprocess.check_output(logs_command, universal_newlines=True) - print('%s logs:' % pod_name) - print(output) diff --git a/tensorflow/tools/dist_test/scripts/kubectl_util_test.py b/tensorflow/tools/dist_test/scripts/kubectl_util_test.py deleted file mode 100644 index e2ddf79202..0000000000 --- a/tensorflow/tools/dist_test/scripts/kubectl_util_test.py +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright 2017 The TensorFlow Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== -"""Tests for tensorflow.tools.dist_test.scripts.kubectl_util.""" - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -import subprocess - -from tensorflow.python.platform import googletest -from tensorflow.python.platform import test -from tensorflow.tools.dist_test.scripts import kubectl_util - - -kubectl_util.WAIT_PERIOD_SECONDS = 1 - - -class KubectlUtilTest(googletest.TestCase): - - @test.mock.patch.object(subprocess, 'check_output') - @test.mock.patch.object(subprocess, 'check_call') - def testCreatePods(self, mock_check_call, mock_check_output): - mock_check_output.return_value = 'nonempty' - kubectl_util.CreatePods('test_pod', 'test.yaml') - mock_check_call.assert_called_once_with( - ['kubectl', 'create', '--filename=test.yaml']) - mock_check_output.assert_called_once_with( - ['kubectl', 'get', 'pods', '-o', 'name', '-l', - 'name-prefix in (test_pod)'], universal_newlines=True) - - @test.mock.patch.object(subprocess, 'check_output') - @test.mock.patch.object(subprocess, 'call') - def testDeletePods(self, mock_check_call, mock_check_output): - mock_check_output.return_value = '' - kubectl_util.DeletePods('test_pod', 'test.yaml') - mock_check_call.assert_called_once_with( - ['kubectl', 'delete', '--filename=test.yaml']) - mock_check_output.assert_called_once_with( - ['kubectl', 'get', 'pods', '-o', 'name', '-l', - 'name-prefix in (test_pod)'], universal_newlines=True) - - @test.mock.patch.object(subprocess, 'check_output') - def testWaitForCompletion(self, mock_check_output): - # Test success - mock_check_output.return_value = '\'0,0,\'' - self.assertTrue(kubectl_util.WaitForCompletion('test_pod')) - - # Test failure - mock_check_output.return_value = '\'0,1,\'' - self.assertFalse(kubectl_util.WaitForCompletion('test_pod')) - - # Test timeout - with self.assertRaises(kubectl_util.TimeoutError): - mock_check_output.return_value = '\'0,,\'' - kubectl_util.WaitForCompletion('test_pod', timeout=5) - - -if __name__ == '__main__': - googletest.main() -- GitLab From cfe16f41b4ce8d97f917a1154e69e202dd5427b0 Mon Sep 17 00:00:00 2001 From: Lukasz Kaiser Date: Tue, 28 Feb 2017 13:03:01 -0800 Subject: [PATCH 046/101] When reuse is False in variable_scope, treat is as None (inherit from parent). (All known callers already assumed that this was the case before.) Change: 148805391 --- tensorflow/python/kernel_tests/variable_scope_test.py | 4 ++-- tensorflow/python/ops/variable_scope.py | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tensorflow/python/kernel_tests/variable_scope_test.py b/tensorflow/python/kernel_tests/variable_scope_test.py index ddec6ec60b..751acfc854 100644 --- a/tensorflow/python/kernel_tests/variable_scope_test.py +++ b/tensorflow/python/kernel_tests/variable_scope_test.py @@ -107,7 +107,7 @@ class VariableScopeTest(test.TestCase): variable_scope.get_variable("x", initializer={}) def testInitFromNonInitializer(self): - with self.test_session() as sess: + with self.test_session(): # Test various dtypes with zeros initializer as following: types = [ dtypes.int8, dtypes.uint8, dtypes.int16, dtypes.uint16, dtypes.int32, @@ -396,7 +396,7 @@ class VariableScopeTest(test.TestCase): self.assertTrue(jump_reuse.reuse) with variable_scope.variable_scope(vs, reuse=False) as jump_no_reuse: - self.assertFalse(jump_no_reuse.reuse) + self.assertTrue(jump_no_reuse.reuse) # Inherited, cannot be undone. with variable_scope.variable_scope("jump", reuse=False) as scope: vs = scope diff --git a/tensorflow/python/ops/variable_scope.py b/tensorflow/python/ops/variable_scope.py index 2a89921944..1aef9dbaf2 100644 --- a/tensorflow/python/ops/variable_scope.py +++ b/tensorflow/python/ops/variable_scope.py @@ -683,7 +683,7 @@ class _VariableStore(object): init_val = initializer variable_dtype = None else: - init_val = lambda: initializer( + init_val = lambda: initializer( # pylint: disable=g-long-lambda shape.as_list(), dtype=dtype, partition_info=partition_info) variable_dtype = dtype.base_dtype @@ -725,7 +725,6 @@ class _VariableStore(object): return v - # Initialize variable when no initializer provided def _get_default_initializer(self, name, shape=None, dtype=dtypes.float32): """Provide a default initializer and a corresponding value. @@ -754,7 +753,7 @@ class _VariableStore(object): # NOTES:Do we need to support for handling DT_STRING and DT_COMPLEX here? else: raise ValueError("An initializer for variable %s of %s is required" - % (name, dtype.base_dtype)) + % (name, dtype.base_dtype)) return initializer, initializing_from_value @@ -1468,11 +1467,15 @@ def variable_scope(name_or_scope, Raises: ValueError: when trying to reuse within a create scope, or create within - a reuse scope, or if reuse is not `None` or `True`. + a reuse scope. TypeError: when the types of some arguments are not appropriate. """ if default_name is None and name_or_scope is None: raise TypeError("If default_name is None then name_or_scope is required") + if not (reuse is True or reuse is False or reuse is None): + raise ValueError("The reuse parameter must be True or False or None.") + if reuse is False: # We don't allow non-inheriting scopes, False = None here. + reuse = None if values is None: values = [] g = ops._get_graph_from_inputs(values) # pylint: disable=protected-access -- GitLab From 749e6b62cf4844c608204c30a356ee7e6ddfecdd Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 13:07:33 -0800 Subject: [PATCH 047/101] Fix broken tensorflow-cl-windows-cmake Change: 148805879 --- tensorflow/contrib/cmake/tf_python.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tensorflow/contrib/cmake/tf_python.cmake b/tensorflow/contrib/cmake/tf_python.cmake index 6a5fa561bf..7a05d6d265 100644 --- a/tensorflow/contrib/cmake/tf_python.cmake +++ b/tensorflow/contrib/cmake/tf_python.cmake @@ -113,6 +113,7 @@ file(GLOB_RECURSE tf_protos_python_srcs RELATIVE ${tensorflow_source_dir} "${tensorflow_source_dir}/tensorflow/python/*.proto" "${tensorflow_source_dir}/tensorflow/contrib/session_bundle/*.proto" "${tensorflow_source_dir}/tensorflow/contrib/tensorboard/*.proto" + "${tensorflow_source_dir}/tensorflow/contrib/training/*.proto" ) RELATIVE_PROTOBUF_GENERATE_PYTHON( ${tensorflow_source_dir} PYTHON_PROTO_GENFILES ${tf_protos_python_srcs} @@ -125,6 +126,7 @@ file(GLOB_RECURSE tf_python_protos_cc_srcs RELATIVE ${tensorflow_source_dir} "${tensorflow_source_dir}/tensorflow/python/*.proto" "${tensorflow_source_dir}/tensorflow/contrib/session_bundle/*.proto" "${tensorflow_source_dir}/tensorflow/contrib/tensorboard/*.proto" + "${tensorflow_source_dir}/tensorflow/contrib/training/*.proto" ) RELATIVE_PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${tensorflow_source_dir} ${tf_python_protos_cc_srcs} -- GitLab From 997368935ee6f8d595c7f2b08a6de43377a10085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dandelion=20Man=C3=A9?= Date: Tue, 28 Feb 2017 13:10:44 -0800 Subject: [PATCH 048/101] Migrate vz_distribution_chart and tf_distribution_dashboard to webfiles. Change: 148806189 --- .../tf_distribution_dashboard/BUILD | 60 +++++ .../tf_distribution_dashboard/demo/BUILD | 26 +++ .../tf_distribution_dashboard/demo/data/BUILD | 17 ++ ...pressedHistograms_run_run1_tag_histo1.json | 212 ++++++++++++++++++ ...pressedHistograms_run_run2_tag_histo1.json | 212 ++++++++++++++++++ ...pressedHistograms_run_run2_tag_histo2.json | 212 ++++++++++++++++++ .../demo/data/logdir | 1 + .../demo/data/runs.json | 4 + .../tf_distribution_dashboard/demo/index.html | 62 +++++ .../components/vz_distribution_chart/BUILD | 71 ++++++ .../vz_distribution_chart/demo/BUILD | 24 ++ .../vz_distribution_chart/demo/index.html | 17 +- .../vz_distribution_chart/index.html | 30 --- 13 files changed, 912 insertions(+), 36 deletions(-) create mode 100644 tensorflow/tensorboard/components/tf_distribution_dashboard/BUILD create mode 100644 tensorflow/tensorboard/components/tf_distribution_dashboard/demo/BUILD create mode 100644 tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/BUILD create mode 100644 tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/compressedHistograms_run_run1_tag_histo1.json create mode 100644 tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/compressedHistograms_run_run2_tag_histo1.json create mode 100644 tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/compressedHistograms_run_run2_tag_histo2.json create mode 100644 tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/logdir create mode 100644 tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/runs.json create mode 100644 tensorflow/tensorboard/components/tf_distribution_dashboard/demo/index.html create mode 100644 tensorflow/tensorboard/components/vz_distribution_chart/BUILD create mode 100644 tensorflow/tensorboard/components/vz_distribution_chart/demo/BUILD delete mode 100644 tensorflow/tensorboard/components/vz_distribution_chart/index.html diff --git a/tensorflow/tensorboard/components/tf_distribution_dashboard/BUILD b/tensorflow/tensorboard/components/tf_distribution_dashboard/BUILD new file mode 100644 index 0000000000..726fdbca93 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_distribution_dashboard/BUILD @@ -0,0 +1,60 @@ +package(default_visibility = ["//tensorflow:internal"]) + +load("@io_bazel_rules_closure//closure:defs.bzl", "webfiles") +load("//tensorflow/tensorboard:defs.bzl", "tensorboard_ts_library") +load("//tensorflow/tensorboard:defs.bzl", "tensorboard_webcomponent_library") + +licenses(["notice"]) # Apache 2.0 + +webfiles( + name = "tf_distribution_dashboard", + srcs = [ + "tf-distribution-dashboard.html", + ], + path = "/tf-distribution-dashboard", + deps = [ + "//tensorflow/tensorboard/components/tf_backend", + "//tensorflow/tensorboard/components/tf_color_scale", + "//tensorflow/tensorboard/components/tf_dashboard_common", + "//tensorflow/tensorboard/components/tf_imports:lodash", + "//tensorflow/tensorboard/components/vz_distribution_chart", + "@org_polymer", + "@org_polymer_iron_collapse", + "@org_polymer_paper_icon_button", + "@org_polymer_paper_styles", + ], +) + +filegroup( + name = "all_files", + srcs = glob(["**"]), + tags = ["notsan"], +) + +################################################################################ +# MARKED FOR DELETION + +tensorboard_webcomponent_library( + name = "legacy", + srcs = [ + "tf-distribution-dashboard.html", + ], + destdir = "tf-distribution-dashboard", + deps = [ + "//tensorflow/tensorboard/components:tf_imports", + "//tensorflow/tensorboard/components/tf_backend:legacy", + "//tensorflow/tensorboard/components/tf_dashboard_common:legacy", + "//tensorflow/tensorboard/components/vz_distribution_chart:legacy", + "//third_party/javascript/polymer/v1/iron-collapse:lib", + "//third_party/javascript/polymer/v1/paper-icon-button:lib", + "//third_party/javascript/polymer/v1/paper-styles:lib", + "//third_party/javascript/polymer/v1/polymer:lib", + ], +) + +tensorboard_ts_library( + name = "legacy_ts", + srcs = [ + ], + deps = ["//tensorflow/tensorboard/components:common_deps"], +) diff --git a/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/BUILD b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/BUILD new file mode 100644 index 0000000000..238937c0c2 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/BUILD @@ -0,0 +1,26 @@ +package(default_visibility = ["//tensorflow:internal"]) + +load("@io_bazel_rules_closure//closure:defs.bzl", "webfiles") + +licenses(["notice"]) # Apache 2.0 + +# bazel run //third_party/tensorflow/tensorboard/components/tf_distribution_dashboard/demo +webfiles( + name = "demo", + srcs = ["index.html"], + path = "/tf-distribution-dashboard/demo", + deps = [ + "//tensorflow/tensorboard/components/tf_distribution_dashboard", + "//tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data", + "//tensorflow/tensorboard/components/tf_imports:d3", + "@org_polymer_iron_demo_helpers", + "@org_polymer_paper_styles", + "@org_polymer_webcomponentsjs", + ], +) + +filegroup( + name = "all_files", + srcs = glob(["**"]), + tags = ["notsan"], +) diff --git a/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/BUILD b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/BUILD new file mode 100644 index 0000000000..589c1980e4 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/BUILD @@ -0,0 +1,17 @@ +package(default_visibility = ["//tensorflow:internal"]) + +load("@io_bazel_rules_closure//closure:defs.bzl", "webfiles") + +licenses(["notice"]) # Apache 2.0 + +webfiles( + name = "data", + srcs = glob(["*"]), + path = "/tf-distribution-dashboard/demo/data", +) + +filegroup( + name = "all_files", + srcs = glob(["**"]), + tags = ["notsan"], +) diff --git a/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/compressedHistograms_run_run1_tag_histo1.json b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/compressedHistograms_run_run1_tag_histo1.json new file mode 100644 index 0000000000..a6765285b1 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/compressedHistograms_run_run1_tag_histo1.json @@ -0,0 +1,212 @@ +[ + [ + 0.0, + 0, + [ + [ + 0, + -2.3150592308536755 + ], + [ + 668, + -2.0967547155036605 + ], + [ + 1587, + -1.4326244423655616 + ], + [ + 3085, + -0.8871306575801902 + ], + [ + 5000, + -0.09312398815580714 + ], + [ + 6915, + 0.2584093405812282 + ], + [ + 8413, + 0.8895470642005087 + ], + [ + 9332, + 1.3198979614453679 + ], + [ + 10000, + 1.6793308878855118 + ] + ] + ], + [ + 100.0, + 10, + [ + [ + 0, + -1.3417572789138936 + ], + [ + 668, + -1.183563374619141 + ], + [ + 1587, + -0.48920418783271574 + ], + [ + 3085, + 0.29326906896076954 + ], + [ + 5000, + 0.56953784145381 + ], + [ + 6915, + 0.8684655583499333 + ], + [ + 8413, + 1.4133127368907181 + ], + [ + 9332, + 1.906140650457873 + ], + [ + 10000, + 2.135771998171255 + ] + ] + ], + [ + 200.0, + 20, + [ + [ + 0, + -1.5066917525035333 + ], + [ + 668, + -1.3910909571770793 + ], + [ + 1587, + -0.902737218885874 + ], + [ + 3085, + -0.3807791904765027 + ], + [ + 5000, + 0.38900200905253046 + ], + [ + 6915, + 0.8209734209339482 + ], + [ + 8413, + 1.302385856695965 + ], + [ + 9332, + 1.9324626053521639 + ], + [ + 10000, + 2.957505317875451 + ] + ] + ], + [ + 300.0, + 30, + [ + [ + 0, + -0.5430457051469562 + ], + [ + 668, + -0.4626161834245273 + ], + [ + 1587, + 0.21573949543027715 + ], + [ + 3085, + 0.37353741100174215 + ], + [ + 5000, + 0.6891407881591103 + ], + [ + 6915, + 1.0927156232630852 + ], + [ + 8413, + 1.2745337159550916 + ], + [ + 9332, + 1.4321116832891605 + ], + [ + 10000, + 2.1913774993059034 + ] + ] + ], + [ + 400.0, + 40, + [ + [ + 0, + -0.3584790755077172 + ], + [ + 668, + -0.33301611509753215 + ], + [ + 1587, + -0.1089466072951948 + ], + [ + 3085, + 0.5792199847585249 + ], + [ + 5000, + 1.220854943811942 + ], + [ + 6915, + 1.759829438421432 + ], + [ + 8413, + 2.3072559906741614 + ], + [ + 9332, + 2.753036118353921 + ], + [ + 10000, + 3.0267252195784047 + ] + ] + ] +] diff --git a/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/compressedHistograms_run_run2_tag_histo1.json b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/compressedHistograms_run_run2_tag_histo1.json new file mode 100644 index 0000000000..9e8a55b3f2 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/compressedHistograms_run_run2_tag_histo1.json @@ -0,0 +1,212 @@ +[ + [ + 0.0, + 0, + [ + [ + 0, + -3.6801669545044846 + ], + [ + 668, + -3.192188140974744 + ], + [ + 1587, + -2.3414678549368806 + ], + [ + 3085, + -0.9632173471995873 + ], + [ + 5000, + -0.3214892636797772 + ], + [ + 6915, + 0.11870794142185205 + ], + [ + 8413, + 0.8895470642005087 + ], + [ + 9332, + 1.183563374619141 + ], + [ + 10000, + 2.665663810418372 + ] + ] + ], + [ + 100.0, + 10, + [ + [ + 0, + -3.564793583751807 + ], + [ + 668, + -3.376844436865802 + ], + [ + 1587, + -1.0366615731293798 + ], + [ + 3085, + -0.27318696312672563 + ], + [ + 5000, + 0.9718642422053263 + ], + [ + 6915, + 2.5765662807928194 + ], + [ + 8413, + 3.1415385101545126 + ], + [ + 9332, + 4.085981768607621 + ], + [ + 10000, + 4.623079406808927 + ] + ] + ], + [ + 200.0, + 20, + [ + [ + 0, + -2.235172510433281 + ], + [ + 668, + -2.004569042815611 + ], + [ + 1587, + -1.2015432383370985 + ], + [ + 3085, + 0.11835464933202625 + ], + [ + 5000, + 0.56953784145381 + ], + [ + 6915, + 1.202844810963146 + ], + [ + 8413, + 2.689066032283515 + ], + [ + 9332, + 2.8494015726499944 + ], + [ + 10000, + 3.481377676013788 + ] + ] + ], + [ + 300.0, + 30, + [ + [ + 0, + -3.360113978269659 + ], + [ + 668, + -2.8293185004961043 + ], + [ + 1587, + -1.5992540502266783 + ], + [ + 3085, + 0.14393860259807117 + ], + [ + 5000, + 1.47723448201245 + ], + [ + 6915, + 1.9510057389110733 + ], + [ + 8413, + 2.833176104473626 + ], + [ + 9332, + 4.142405216576347 + ], + [ + 10000, + 4.706937777668589 + ] + ] + ], + [ + 400.0, + 40, + [ + [ + 0, + -2.599286228987632 + ], + [ + 668, + -2.240365897443259 + ], + [ + 1587, + -1.5992540502266783 + ], + [ + 3085, + -0.9101893288861387 + ], + [ + 5000, + 0.7580548669750213 + ], + [ + 6915, + 1.6009864433919474 + ], + [ + 8413, + 2.3504002974280036 + ], + [ + 9332, + 2.7907805263353733 + ], + [ + 10000, + 3.5098048900144323 + ] + ] + ] +] diff --git a/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/compressedHistograms_run_run2_tag_histo2.json b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/compressedHistograms_run_run2_tag_histo2.json new file mode 100644 index 0000000000..7c8836f624 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/compressedHistograms_run_run2_tag_histo2.json @@ -0,0 +1,212 @@ +[ + [ + 0.0, + 0, + [ + [ + 0, + -1.9291158122759586 + ], + [ + 668, + -1.5970765333488954 + ], + [ + 1587, + -1.0923120348519078 + ], + [ + 3085, + -0.6688082872192093 + ], + [ + 5000, + 0.09312398815580714 + ], + [ + 6915, + 0.44532789251701854 + ], + [ + 8413, + 0.8238009655877649 + ], + [ + 9332, + 1.0357232383581656 + ], + [ + 10000, + 1.2741043689144438 + ] + ] + ], + [ + 100.0, + 10, + [ + [ + 0, + -0.7780725642449806 + ], + [ + 668, + -0.7138496178727424 + ], + [ + 1587, + -0.5448932415735014 + ], + [ + 3085, + -0.24370397454796228 + ], + [ + 5000, + 0.42790220995778355 + ], + [ + 6915, + 0.6191730643365096 + ], + [ + 8413, + 0.752059342118037 + ], + [ + 9332, + 1.0451472255274825 + ], + [ + 10000, + 2.5559479569222825 + ] + ] + ], + [ + 200.0, + 20, + [ + [ + 0, + -1.3876904425996377 + ], + [ + 668, + -1.1464188862638496 + ], + [ + 1587, + -0.4049955219067526 + ], + [ + 3085, + 0.04721394862139682 + ], + [ + 5000, + 0.56953784145381 + ], + [ + 6915, + 1.3221859041483333 + ], + [ + 8413, + 1.6188495656305735 + ], + [ + 9332, + 1.7613953069723651 + ], + [ + 10000, + 2.3257482385477384 + ] + ] + ], + [ + 300.0, + 30, + [ + [ + 0, + -1.600772629982185 + ], + [ + 668, + -1.1548516185367033 + ], + [ + 1587, + -0.260387173785447 + ], + [ + 3085, + 0.17416570914366614 + ], + [ + 5000, + 0.47069243095356195 + ], + [ + 6915, + 1.1559276581637614 + ], + [ + 8413, + 2.0474031182051404 + ], + [ + 9332, + 2.18821711651116 + ], + [ + 10000, + 2.2393193406467518 + ] + ] + ], + [ + 400.0, + 40, + [ + [ + 0, + -0.8286852465281818 + ], + [ + 668, + -0.7815041529866706 + ], + [ + 1587, + -0.3334896444053469 + ], + [ + 3085, + 0.21085213041026643 + ], + [ + 5000, + 0.5177616740489182 + ], + [ + 6915, + 1.077122434649409 + ], + [ + 8413, + 1.5898009703967424 + ], + [ + 9332, + 1.8859097291499742 + ], + [ + 10000, + 2.0954239138728523 + ] + ] + ] +] diff --git a/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/logdir b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/logdir new file mode 100644 index 0000000000..b6362b45d7 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/logdir @@ -0,0 +1 @@ +{"logdir": "/foo/some/fake/logdir"} \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/runs.json b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/runs.json new file mode 100644 index 0000000000..739262a9fb --- /dev/null +++ b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/data/runs.json @@ -0,0 +1,4 @@ +{ + "run1": {"compressedHistograms": ["histo1"]}, + "run2": {"compressedHistograms": ["histo2", "histo1"]} +} diff --git a/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/index.html b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/index.html new file mode 100644 index 0000000000..16c9b124e4 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_distribution_dashboard/demo/index.html @@ -0,0 +1,62 @@ + + + + + + + + +Distribution Dashboard Demo + + + + diff --git a/tensorflow/tensorboard/components/vz_distribution_chart/BUILD b/tensorflow/tensorboard/components/vz_distribution_chart/BUILD new file mode 100644 index 0000000000..225afe79d6 --- /dev/null +++ b/tensorflow/tensorboard/components/vz_distribution_chart/BUILD @@ -0,0 +1,71 @@ +package(default_visibility = ["//tensorflow:internal"]) + +load("@io_bazel_rules_closure//closure:defs.bzl", "webfiles") +load("//tensorflow/tensorboard:defs.bzl", "tensorboard_ts_library") +load("//tensorflow/tensorboard:defs.bzl", "tensorboard_typescript_genrule") +load("//tensorflow/tensorboard:defs.bzl", "tensorboard_webcomponent_library") + +licenses(["notice"]) # Apache 2.0 + +webfiles( + name = "vz_distribution_chart", + srcs = [ + "vz-distribution-chart.html", + ":ts", + ], + path = "/vz-distribution-chart", + deps = [ + "//tensorflow/tensorboard/components/tf_imports:lodash", + "//tensorflow/tensorboard/components/tf_imports:plottable", + "//tensorflow/tensorboard/components/vz_line_chart", + "@org_polymer", + ], +) + +tensorboard_typescript_genrule( + name = "ts", + srcs = [ + "vz-distribution-chart.ts", + ], + typings = [ + "@org_definitelytyped//:d3.d.ts", + "@com_palantir_plottable//:plottable.d.ts", + "@org_definitelytyped//:lodash.d.ts", + "//tensorflow/tensorboard/components/vz_line_chart:ts_typings", + ], +) + +filegroup( + name = "all_files", + srcs = glob(["**"]), + tags = ["notsan"], +) + +################################################################################ +# MARKED FOR DELETION + +tensorboard_webcomponent_library( + name = "legacy", + srcs = [ + "vz-distribution-chart.html", + ":legacy_ts", + ], + visibility = ["//visibility:public"], + destdir = "vz-distribution-chart", + deps = [ + "//tensorflow/tensorboard/components:tf_imports", + "//tensorflow/tensorboard/components/vz_sorting:legacy", + "//third_party/javascript/polymer/v1/polymer:lib", + ], +) + +tensorboard_ts_library( + name = "legacy_ts", + srcs = [ + "vz-distribution-chart.ts", + ], + deps = [ + "//tensorflow/tensorboard/components:common_deps", + "//tensorflow/tensorboard/components/vz_line_chart:legacy_ts", + ], +) diff --git a/tensorflow/tensorboard/components/vz_distribution_chart/demo/BUILD b/tensorflow/tensorboard/components/vz_distribution_chart/demo/BUILD new file mode 100644 index 0000000000..77f05aa2d4 --- /dev/null +++ b/tensorflow/tensorboard/components/vz_distribution_chart/demo/BUILD @@ -0,0 +1,24 @@ +package(default_visibility = ["//tensorflow:internal"]) + +load("@io_bazel_rules_closure//closure:defs.bzl", "webfiles") + +licenses(["notice"]) # Apache 2.0 + +# bazel run //third_party/tensorflow/tensorboard/components/vz_distribution_chart/demo +webfiles( + name = "demo", + srcs = ["index.html"], + path = "/vz-distribution-chart/demo", + deps = [ + "//tensorflow/tensorboard/components/vz_distribution_chart", + "@org_polymer_iron_demo_helpers", + "@org_polymer_paper_styles", + "@org_polymer_webcomponentsjs", + ], +) + +filegroup( + name = "all_files", + srcs = glob(["**"]), + tags = ["notsan"], +) diff --git a/tensorflow/tensorboard/components/vz_distribution_chart/demo/index.html b/tensorflow/tensorboard/components/vz_distribution_chart/demo/index.html index b2810412ab..5dca73aac4 100644 --- a/tensorflow/tensorboard/components/vz_distribution_chart/demo/index.html +++ b/tensorflow/tensorboard/components/vz_distribution_chart/demo/index.html @@ -37,20 +37,25 @@ limitations under the License.

Simple distribution chart

+ - - - diff --git a/tensorflow/tensorboard/components/vz_distribution_chart/index.html b/tensorflow/tensorboard/components/vz_distribution_chart/index.html deleted file mode 100644 index b7b399d3fc..0000000000 --- a/tensorflow/tensorboard/components/vz_distribution_chart/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - vz-line-chart - - - - - - - - - -- GitLab From 00dae17b9d1fb1cff86eae2cf0a05f36f2443816 Mon Sep 17 00:00:00 2001 From: Andrew Harp Date: Tue, 28 Feb 2017 13:11:58 -0800 Subject: [PATCH 049/101] examples/android/README.md: lower example image width to allow them to properly display on the same row. Change: 148806312 --- tensorflow/examples/android/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tensorflow/examples/android/README.md b/tensorflow/examples/android/README.md index 6507496895..3182b8f211 100644 --- a/tensorflow/examples/android/README.md +++ b/tensorflow/examples/android/README.md @@ -32,9 +32,9 @@ on API >= 14 devices. (https://arxiv.org/abs/1610.07629) to restyle the camera preview image to that of a number of different artists. - - - + + + ## Prebuilt APK: -- GitLab From 44a86ac67f0bc1789d4e1054df1050c5c12c7ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dandelion=20Man=C3=A9?= Date: Tue, 28 Feb 2017 13:22:45 -0800 Subject: [PATCH 050/101] Remove the "Legacy Underscore Categorization" option from TensorBoard. I want to clean up the UI, and I don't think it's worth supporting this feature anymore. Change: 148807695 --- .../tf_dashboard_common/categorizer.ts | 9 ------- .../test/categorizerTest.ts | 16 ------------ .../tf_dashboard_common/tf-categorizer.html | 26 +------------------ 3 files changed, 1 insertion(+), 50 deletions(-) diff --git a/tensorflow/tensorboard/components/tf_dashboard_common/categorizer.ts b/tensorflow/tensorboard/components/tf_dashboard_common/categorizer.ts index e8a9751f08..42e7cbcff4 100644 --- a/tensorflow/tensorboard/components/tf_dashboard_common/categorizer.ts +++ b/tensorflow/tensorboard/components/tf_dashboard_common/categorizer.ts @@ -51,19 +51,10 @@ module Categorizer { */ export var topLevelNamespaceCategorizer: Categorizer = splitCategorizer(/\//); - // Try to produce good categorizations on legacy graphs, which often - // are namespaced like l1_foo/bar or l2_baz/bam. - // If there is no leading underscore before the first forward slash, - // then it behaves the same as topLevelNamespaceCategorizer - export var legacyUnderscoreCategorizer: Categorizer = - splitCategorizer(/[\/_]/); - export function fallbackCategorizer(s: string): Categorizer { switch (s) { case 'TopLevelNamespaceCategorizer': return topLevelNamespaceCategorizer; - case 'LegacyUnderscoreCategorizer': - return legacyUnderscoreCategorizer; default: throw new Error('Unrecognized categorization strategy: ' + s); } diff --git a/tensorflow/tensorboard/components/tf_dashboard_common/test/categorizerTest.ts b/tensorflow/tensorboard/components/tf_dashboard_common/test/categorizerTest.ts index c28e1851fd..ea149fda47 100644 --- a/tensorflow/tensorboard/components/tf_dashboard_common/test/categorizerTest.ts +++ b/tensorflow/tensorboard/components/tf_dashboard_common/test/categorizerTest.ts @@ -64,22 +64,6 @@ module Categorizer { }); }); - describe('legacyUnderscoreCategorizer', () => { - it('splits by shorter of first _ or /', () => { - let tags = [ - 'l0_bar/foo', 'l0_bar/baz', 'l0_foo/wob', 'l1_zoink/bla', - 'l1_wibble/woz', 'l1/foo_woink', 'l2/wozzle_wizzle' - ]; - let actual = legacyUnderscoreCategorizer(tags); - let expected = [ - {name: 'l0', tags: ['l0_bar/baz', 'l0_bar/foo', 'l0_foo/wob']}, - {name: 'l1', tags: ['l1/foo_woink', 'l1_wibble/woz', 'l1_zoink/bla']}, - {name: 'l2', tags: ['l2/wozzle_wizzle']}, - ]; - assert.deepEqual(actual, expected); - }); - }); - describe('customCategorizer', () => { function noFallbackCategorizer(tags: string[]): Category[] { return []; diff --git a/tensorflow/tensorboard/components/tf_dashboard_common/tf-categorizer.html b/tensorflow/tensorboard/components/tf_dashboard_common/tf-categorizer.html index ffe11a8899..8ff95b03c6 100644 --- a/tensorflow/tensorboard/components/tf_dashboard_common/tf-categorizer.html +++ b/tensorflow/tensorboard/components/tf_dashboard_common/tf-categorizer.html @@ -46,11 +46,6 @@ categories are exclusive.
-
- Split on underscores -
@@ -75,14 +67,7 @@ categories are exclusive. categoriesAreExclusive: {type: Boolean, value: true}, fallbackCategorizer: { type: String, - computed: "chooseFallbackCategorizer(splitOnUnderscore)" - }, - splitOnUnderscore: { - type: Boolean, - notify: true, - value: TF.URIStorage.getBooleanInitializer('splitOnUnderscore', - false), - observer: '_splitOnUnderscoreObserver' + value: "TopLevelNamespaceCategorizer", }, categorizer: { type: Object, @@ -105,15 +90,6 @@ categories are exclusive. this._setCategories(categories); }) }, - chooseFallbackCategorizer: function(splitOnUnderscore) { - if (splitOnUnderscore) { - return "LegacyUnderscoreCategorizer"; - } else { - return "TopLevelNamespaceCategorizer"; - } - }, - _splitOnUnderscoreObserver: TF.URIStorage.getBooleanObserver( - 'splitOnUnderscore', false) }); -- GitLab From a0ffd865b74d8d7e19c1ceab8133bfab29ff4d67 Mon Sep 17 00:00:00 2001 From: David Soergel Date: Tue, 28 Feb 2017 13:33:22 -0800 Subject: [PATCH 051/101] Accept scalar inputs for categorical columns. Change: 148809067 --- .../contrib/layers/python/layers/feature_column.py | 1 + .../layers/python/layers/feature_column_test.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/tensorflow/contrib/layers/python/layers/feature_column.py b/tensorflow/contrib/layers/python/layers/feature_column.py index 8f755085f0..a07b551d96 100644 --- a/tensorflow/contrib/layers/python/layers/feature_column.py +++ b/tensorflow/contrib/layers/python/layers/feature_column.py @@ -418,6 +418,7 @@ class _SparseColumn(_FeatureColumn, ignore_value = "" else: ignore_value = -1 + input_tensor = _reshape_real_valued_tensor(input_tensor, 2, self.name) input_tensor = contrib_sparse_ops.dense_to_sparse_tensor( input_tensor, ignore_value=ignore_value) diff --git a/tensorflow/contrib/layers/python/layers/feature_column_test.py b/tensorflow/contrib/layers/python/layers/feature_column_test.py index a3b2c98c80..d119980db8 100644 --- a/tensorflow/contrib/layers/python/layers/feature_column_test.py +++ b/tensorflow/contrib/layers/python/layers/feature_column_test.py @@ -511,6 +511,20 @@ class FeatureColumnTest(test.TestCase): }, sc.config) self.assertEqual(1, sc._wide_embedding_lookup_arguments(None).vocab_size) + def testSparseColumnAcceptsDenseScalar(self): + """Tests that `SparseColumn`s accept dense scalar inputs.""" + batch_size = 4 + dense_scalar_input = [1, 2, 3, 4] + sparse_column = fc.sparse_column_with_integerized_feature("values", 10) + features = {"values": + constant_op.constant(dense_scalar_input, dtype=dtypes.int64)} + sparse_column.insert_transformed_feature(features) + sparse_output = features[sparse_column] + expected_shape = [batch_size, 1] + with self.test_session() as sess: + sparse_result = sess.run(sparse_output) + self.assertEquals(expected_shape, list(sparse_result.dense_shape)) + def testCreateFeatureSpec(self): sparse_col = fc.sparse_column_with_hash_bucket( "sparse_column", hash_bucket_size=100) -- GitLab From 996605db6cc2008c1346344543d2be46c1dd70bf Mon Sep 17 00:00:00 2001 From: Alexandre Passos Date: Tue, 28 Feb 2017 13:37:11 -0800 Subject: [PATCH 052/101] Adds const& in one place where it's possible. Change: 148809526 --- tensorflow/core/kernels/session_ops.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/core/kernels/session_ops.cc b/tensorflow/core/kernels/session_ops.cc index 4550115c19..59fb225b92 100644 --- a/tensorflow/core/kernels/session_ops.cc +++ b/tensorflow/core/kernels/session_ops.cc @@ -41,7 +41,7 @@ class GetSessionHandleOp : public OpKernel { : OpKernel(context) {} void Compute(OpKernelContext* ctx) override { - Tensor val = ctx->input(0); + const Tensor& val = ctx->input(0); int64 id = ctx->session_state()->GetNewId(); TensorStore::TensorAndKey tk{val, id, def().device()}; OP_REQUIRES_OK(ctx, ctx->tensor_store()->AddTensor(def().name(), tk)); -- GitLab From 96f4cdcb86f5ee00f0a7614f6cf6b224151d1c05 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 14:06:08 -0800 Subject: [PATCH 053/101] Actually forward inputs in linear algebra ops. Previously, the Tensor copies performed when building the "inputs" array would increment the refcount and prevent forwarding. Add a virtual method in the base class to disable forwarding for specific ops. In particular, the Eigen code used for MatrixSolveLS and MatrixTriangularSolve assumes no aliasing. Change: 148813349 --- tensorflow/core/kernels/linalg_ops_common.cc | 18 ++++---- tensorflow/core/kernels/linalg_ops_common.h | 6 ++- tensorflow/core/kernels/matrix_solve_ls_op.cc | 2 + tensorflow/core/kernels/matrix_solve_op.cc | 2 + .../kernels/matrix_triangular_solve_op.cc | 41 ++++++++++--------- 5 files changed, 40 insertions(+), 29 deletions(-) diff --git a/tensorflow/core/kernels/linalg_ops_common.cc b/tensorflow/core/kernels/linalg_ops_common.cc index 3ecd3182ff..dc001857d7 100644 --- a/tensorflow/core/kernels/linalg_ops_common.cc +++ b/tensorflow/core/kernels/linalg_ops_common.cc @@ -148,7 +148,7 @@ void LinearAlgebraOp::AnalyzeInputs(OpKernelContext* context, // TODO(rmlarsen): Use emplace_back when it is added to InlinedVector. Same // in several places below. input_matrix_shapes->push_back(TensorShape({num_rows, num_cols})); - inputs->push_back(in); + inputs->push_back(&in); } // Have the derived class validate that the inputs are as expected. ValidateInputMatrixShapes(context, *input_matrix_shapes); @@ -197,12 +197,14 @@ void LinearAlgebraOp::PrepareOutputs( Tensor* out = nullptr; // See if there is an input buffer we can reuse for this output. bool reused_input = false; - for (int input_idx : unused_inputs) { - if (context->forward_input_to_output_with_shape( - input_idx, output_idx, output_tensor_shape, &out)) { - reused_input = true; - unused_inputs.erase(input_idx); - break; + if (EnableInputForwarding()) { + for (int input_idx : unused_inputs) { + if (context->forward_input_to_output_with_shape( + input_idx, output_idx, output_tensor_shape, &out)) { + reused_input = true; + unused_inputs.erase(input_idx); + break; + } } } if (!reused_input) { @@ -223,7 +225,7 @@ void LinearAlgebraOp::ComputeTensorSlice( // TODO(kalakris): Handle alignment if possible. Eigen::Map is // unaligned by default. matrix_inputs.push_back( - ConstMatrixMap(inputs[i].flat().data() + + ConstMatrixMap(inputs[i]->flat().data() + matrix_index * input_matrix_shapes[i].num_elements(), input_matrix_shapes[i].dim_size(0), input_matrix_shapes[i].dim_size(1))); diff --git a/tensorflow/core/kernels/linalg_ops_common.h b/tensorflow/core/kernels/linalg_ops_common.h index 8a606ed0a9..ab4142ac93 100644 --- a/tensorflow/core/kernels/linalg_ops_common.h +++ b/tensorflow/core/kernels/linalg_ops_common.h @@ -108,6 +108,10 @@ class LinearAlgebraOp : public OpKernel { : static_cast(cost); } + // Returns true if it is safe to forward (alias) input to output buffer + // and expect the kernel to perform the computation inplace. + virtual bool EnableInputForwarding() const { return true; } + using Matrix = Eigen::Matrix; using ConstMatrixMap = Eigen::Map; @@ -127,7 +131,7 @@ class LinearAlgebraOp : public OpKernel { MatrixMaps* outputs) = 0; private: - using TensorInputs = gtl::InlinedVector; + using TensorInputs = gtl::InlinedVector; using TensorOutputs = gtl::InlinedVector; // This function maps slices (matrices) of the input and output tensors using diff --git a/tensorflow/core/kernels/matrix_solve_ls_op.cc b/tensorflow/core/kernels/matrix_solve_ls_op.cc index 716015e7de..427ffd3456 100644 --- a/tensorflow/core/kernels/matrix_solve_ls_op.cc +++ b/tensorflow/core/kernels/matrix_solve_ls_op.cc @@ -68,6 +68,8 @@ class MatrixSolveLsOp : public LinearAlgebraOp { : static_cast(cost); } + bool EnableInputForwarding() const final { return false; } + void ComputeMatrix(OpKernelContext* context, const ConstMatrixMaps& inputs, MatrixMaps* outputs) final { const ConstMatrixMap& matrix = inputs[0]; diff --git a/tensorflow/core/kernels/matrix_solve_op.cc b/tensorflow/core/kernels/matrix_solve_op.cc index e10a102871..32329beeff 100644 --- a/tensorflow/core/kernels/matrix_solve_op.cc +++ b/tensorflow/core/kernels/matrix_solve_op.cc @@ -63,6 +63,8 @@ class MatrixSolveOp : public LinearAlgebraOp { : static_cast(cost); } + bool EnableInputForwarding() const final { return false; } + void ComputeMatrix(OpKernelContext* context, const ConstMatrixMaps& inputs, MatrixMaps* outputs) final { const ConstMatrixMap& matrix = inputs[0]; diff --git a/tensorflow/core/kernels/matrix_triangular_solve_op.cc b/tensorflow/core/kernels/matrix_triangular_solve_op.cc index 5f30a95108..32aa7a8008 100644 --- a/tensorflow/core/kernels/matrix_triangular_solve_op.cc +++ b/tensorflow/core/kernels/matrix_triangular_solve_op.cc @@ -77,13 +77,15 @@ class MatrixTriangularSolveOp : public LinearAlgebraOp { int64 GetCostPerUnit(const TensorShapes& input_matrix_shapes) const final { double rows = static_cast(input_matrix_shapes[0].dim_size(0)); double num_rhss = static_cast(input_matrix_shapes[1].dim_size(1)); - double cost = rows * rows * num_rhss * - (Eigen::TensorOpCost::AddCost() + - Eigen::TensorOpCost::MulCost()); + double cost = rows * rows * num_rhss * + (Eigen::TensorOpCost::AddCost() + + Eigen::TensorOpCost::MulCost()); return cost >= static_cast(kint64max) ? kint64max : static_cast(cost); } + bool EnableInputForwarding() const final { return false; } + void ComputeMatrix(OpKernelContext* context, const ConstMatrixMaps& inputs, MatrixMaps* outputs) final { const ConstMatrixMap& matrix = inputs[0]; @@ -157,9 +159,9 @@ class MatrixTriangularSolveOpGPU : public LinearAlgebraOp { int64 GetCostPerUnit(const TensorShapes& input_matrix_shapes) const final { double rows = static_cast(input_matrix_shapes[0].dim_size(0)); double num_rhss = static_cast(input_matrix_shapes[1].dim_size(1)); - double cost = rows * rows * num_rhss * - (Eigen::TensorOpCost::AddCost() + - Eigen::TensorOpCost::MulCost()); + double cost = rows * rows * num_rhss * + (Eigen::TensorOpCost::AddCost() + + Eigen::TensorOpCost::MulCost()); return cost >= static_cast(kint64max) ? kint64max : static_cast(cost); } @@ -209,21 +211,20 @@ class MatrixTriangularSolveOpGPU : public LinearAlgebraOp { } else { transpose_matrix = perftools::gputools::blas::Transpose::kNoTranspose; } - uint64 leading_dim_matrix = matrix.cols(); - uint64 leading_dim_output = output.cols(); - uint64 colmajor_rows = output.cols(); - uint64 colmajor_cols = output.rows(); + uint64 leading_dim_matrix = matrix.cols(); + uint64 leading_dim_output = output.cols(); + uint64 colmajor_rows = output.cols(); + uint64 colmajor_cols = output.rows(); bool blas_launch_status = - stream - ->ThenBlasTrsm(perftools::gputools::blas::Side::kRight /*side*/, - upper_lower_matrix /*uplo*/, - transpose_matrix /*trans*/, - perftools::gputools::blas::Diagonal::kNonUnit /*diag*/, - colmajor_rows /*m*/, colmajor_cols /*n*/, - Scalar(1.0) /*alpha*/, - matrix_ptr, leading_dim_matrix /*lda*/, - &out_ptr, leading_dim_output /*ldb*/) - .ok(); + stream + ->ThenBlasTrsm( + perftools::gputools::blas::Side::kRight /*side*/, + upper_lower_matrix /*uplo*/, transpose_matrix /*trans*/, + perftools::gputools::blas::Diagonal::kNonUnit /*diag*/, + colmajor_rows /*m*/, colmajor_cols /*n*/, Scalar(1.0) /*alpha*/, + matrix_ptr, leading_dim_matrix /*lda*/, &out_ptr, + leading_dim_output /*ldb*/) + .ok(); if (!blas_launch_status) { context->SetStatus(errors::Internal("Blas TRSM launch failed")); } -- GitLab From 5c4df36597a2d242ffe2b241ca7147c40b0953e3 Mon Sep 17 00:00:00 2001 From: Suharsh Sivakumar Date: Tue, 28 Feb 2017 14:29:02 -0800 Subject: [PATCH 054/101] Only deprecate QuantizeAndDequantize at version 22. Change: 148816238 --- tensorflow/core/ops/array_ops.cc | 61 ++------------------------------ 1 file changed, 2 insertions(+), 59 deletions(-) diff --git a/tensorflow/core/ops/array_ops.cc b/tensorflow/core/ops/array_ops.cc index 04ba3fd376..42bc1d84dc 100644 --- a/tensorflow/core/ops/array_ops.cc +++ b/tensorflow/core/ops/array_ops.cc @@ -4289,66 +4289,9 @@ REGISTER_OP("QuantizeAndDequantize") .Output("output: T") .Attr("T: {float, double}") .SetShapeFn(shape_inference::UnchangedShape) - .Deprecated(21, "Replaced by QuantizeAndDequantizeV2") + .Deprecated(22, "Replaced by QuantizeAndDequantizeV2") .Doc(R"doc( -Quantizes then dequantizes a tensor. - -This op simulates the precision loss from the quantized forward pass by: -1. Quantizing the tensor to fixed point numbers, which should match the target - quantization method when it is used in inference. -2. Dequantizing it back to floating point numbers for the following ops, most - likely matmul. - -There are different ways to quantize. This version does not use the full range -of the output type, choosing to elide the lowest possible value for symmetry -(e.g., output range is -127 to 127, not -128 to 127 for signed 8 bit -quantization), so that 0.0 maps to 0. - -To perform this op, we first find the range of values in our tensor. The range -we use is always centered on 0, so we find m such that - -1. m = max(abs(input_min), abs(input_max)) if range_given is true, -2. m = max(max(abs(min_elem(input)), abs(max_elem(input))) otherwise. - -Our input tensor range is then [-m, m]. - -Next, we choose our fixed-point quantization buckets, [min_fixed, max_fixed]. -If signed_input is true, this is - - [min_fixed, max_fixed ] = - [-(1 << (num_bits - 1) - 1), (1 << (num_bits - 1)) - 1]. - -Otherwise, if signed_input is false, the fixed-point range is - - [min_fixed, max_fixed] = [0, (1 << num_bits) - 1]. - -From this we compute our scaling factor, s: - - s = (max_fixed - min_fixed) / (2 * m). - -Now we can quantize and dequantize the elements of our tensor. An element e -is transformed into e': - - e' = (e * s).round_to_nearest() / s. - -Note that we have a different number of buckets in the signed vs. unsigned -cases. For example, if num_bits == 8, we get 254 buckets in the signed case -vs. 255 in the unsigned case. - -For example, suppose num_bits = 8 and m = 1. Then - - [min_fixed, max_fixed] = [-127, 127], and - s = (127 + 127) / 2 = 127. - -Given the vector {-1, -0.5, 0, 0.3}, this is quantized to -{-127, -63, 0, 38}, and dequantized to {-1, -63.0/127, 0, 38.0/127}. - -input: Tensor to quantize and then dequantize. -signed_input: If the quantization is signed or unsigned. -num_bits: The bitwidth of the quantization. -range_given: If the range is given or should be computed from the tensor. -input_min: If range is given, this is the min of the range. -input_max: If range is given, this is the max of the range. +Use QuantizeAndDequantizeV2 instead. )doc"); REGISTER_OP("QuantizeAndDequantizeV2") -- GitLab From 46f5e646f4d5d524e8ebd4bf612252f31c39a986 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 15:02:43 -0800 Subject: [PATCH 055/101] Update ops-related pbtxt files. Change: 148820749 --- .../core/ops/compat/ops_history.v1.pbtxt | 59 +++++++++++++++++++ tensorflow/core/ops/ops.pbtxt | 11 +--- 2 files changed, 61 insertions(+), 9 deletions(-) diff --git a/tensorflow/core/ops/compat/ops_history.v1.pbtxt b/tensorflow/core/ops/compat/ops_history.v1.pbtxt index 0061fbc078..af7d3a33e5 100644 --- a/tensorflow/core/ops/compat/ops_history.v1.pbtxt +++ b/tensorflow/core/ops/compat/ops_history.v1.pbtxt @@ -11121,6 +11121,65 @@ op { version: 21 } } +op { + name: "QuantizeAndDequantize" + input_arg { + name: "input" + type_attr: "T" + } + output_arg { + name: "output" + type_attr: "T" + } + attr { + name: "signed_input" + type: "bool" + default_value { + b: true + } + } + attr { + name: "num_bits" + type: "int" + default_value { + i: 8 + } + } + attr { + name: "range_given" + type: "bool" + default_value { + b: false + } + } + attr { + name: "input_min" + type: "float" + default_value { + f: 0 + } + } + attr { + name: "input_max" + type: "float" + default_value { + f: 0 + } + } + attr { + name: "T" + type: "type" + allowed_values { + list { + type: DT_FLOAT + type: DT_DOUBLE + } + } + } + deprecation { + version: 22 + } +} op { name: "QuantizeAndDequantizeV2" input_arg { diff --git a/tensorflow/core/ops/ops.pbtxt b/tensorflow/core/ops/ops.pbtxt index 711571e8b5..897b6c0f11 100644 --- a/tensorflow/core/ops/ops.pbtxt +++ b/tensorflow/core/ops/ops.pbtxt @@ -12556,7 +12556,6 @@ op { name: "QuantizeAndDequantize" input_arg { name: "input" - description: "Tensor to quantize and then dequantize." type_attr: "T" } output_arg { @@ -12569,7 +12568,6 @@ op { default_value { b: true } - description: "If the quantization is signed or unsigned." } attr { name: "num_bits" @@ -12577,7 +12575,6 @@ op { default_value { i: 8 } - description: "The bitwidth of the quantization." } attr { name: "range_given" @@ -12585,7 +12582,6 @@ op { default_value { b: false } - description: "If the range is given or should be computed from the tensor." } attr { name: "input_min" @@ -12593,7 +12589,6 @@ op { default_value { f: 0 } - description: "If range is given, this is the min of the range." } attr { name: "input_max" @@ -12601,7 +12596,6 @@ op { default_value { f: 0 } - description: "If range is given, this is the max of the range." } attr { name: "T" @@ -12613,10 +12607,9 @@ op { } } } - summary: "Quantizes then dequantizes a tensor." - description: "This op simulates the precision loss from the quantized forward pass by:\n1. Quantizing the tensor to fixed point numbers, which should match the target\n quantization method when it is used in inference.\n2. Dequantizing it back to floating point numbers for the following ops, most\n likely matmul.\n\nThere are different ways to quantize. This version does not use the full range\nof the output type, choosing to elide the lowest possible value for symmetry\n(e.g., output range is -127 to 127, not -128 to 127 for signed 8 bit\nquantization), so that 0.0 maps to 0.\n\nTo perform this op, we first find the range of values in our tensor. The range\nwe use is always centered on 0, so we find m such that\n\n1. m = max(abs(input_min), abs(input_max)) if range_given is true,\n2. m = max(max(abs(min_elem(input)), abs(max_elem(input))) otherwise.\n\nOur input tensor range is then [-m, m].\n\nNext, we choose our fixed-point quantization buckets, [min_fixed, max_fixed].\nIf signed_input is true, this is\n\n [min_fixed, max_fixed ] =\n [-(1 << (num_bits - 1) - 1), (1 << (num_bits - 1)) - 1].\n\nOtherwise, if signed_input is false, the fixed-point range is\n\n [min_fixed, max_fixed] = [0, (1 << num_bits) - 1].\n\nFrom this we compute our scaling factor, s:\n\n s = (max_fixed - min_fixed) / (2 * m).\n\nNow we can quantize and dequantize the elements of our tensor. An element e\nis transformed into e\':\n\n e\' = (e * s).round_to_nearest() / s.\n\nNote that we have a different number of buckets in the signed vs. unsigned\ncases. For example, if num_bits == 8, we get 254 buckets in the signed case\nvs. 255 in the unsigned case.\n\nFor example, suppose num_bits = 8 and m = 1. Then\n\n [min_fixed, max_fixed] = [-127, 127], and\n s = (127 + 127) / 2 = 127.\n\nGiven the vector {-1, -0.5, 0, 0.3}, this is quantized to\n{-127, -63, 0, 38}, and dequantized to {-1, -63.0/127, 0, 38.0/127}." + summary: "Use QuantizeAndDequantizeV2 instead." deprecation { - version: 21 + version: 22 explanation: "Replaced by QuantizeAndDequantizeV2" } } -- GitLab From aa90cf258df7cbf2ec142de76d698b273dd614cf Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 15:04:27 -0800 Subject: [PATCH 056/101] Go: Update generated wrapper functions for TensorFlow ops. Change: 148820986 --- tensorflow/go/op/wrappers.go | 67 ++---------------------------------- 1 file changed, 2 insertions(+), 65 deletions(-) diff --git a/tensorflow/go/op/wrappers.go b/tensorflow/go/op/wrappers.go index 7cc11b6e19..93bd12c51d 100644 --- a/tensorflow/go/op/wrappers.go +++ b/tensorflow/go/op/wrappers.go @@ -601,8 +601,6 @@ func Copy(scope *Scope, input tf.Output, optional ...CopyAttr) (output tf.Output type QuantizeAndDequantizeAttr func(optionalAttr) // QuantizeAndDequantizeSignedInput sets the optional signed_input attribute to value. -// -// value: If the quantization is signed or unsigned. // If not specified, defaults to b:true func QuantizeAndDequantizeSignedInput(value bool) QuantizeAndDequantizeAttr { return func(m optionalAttr) { @@ -611,8 +609,6 @@ func QuantizeAndDequantizeSignedInput(value bool) QuantizeAndDequantizeAttr { } // QuantizeAndDequantizeNumBits sets the optional num_bits attribute to value. -// -// value: The bitwidth of the quantization. // If not specified, defaults to i:8 func QuantizeAndDequantizeNumBits(value int64) QuantizeAndDequantizeAttr { return func(m optionalAttr) { @@ -621,8 +617,6 @@ func QuantizeAndDequantizeNumBits(value int64) QuantizeAndDequantizeAttr { } // QuantizeAndDequantizeRangeGiven sets the optional range_given attribute to value. -// -// value: If the range is given or should be computed from the tensor. // If not specified, defaults to b:false func QuantizeAndDequantizeRangeGiven(value bool) QuantizeAndDequantizeAttr { return func(m optionalAttr) { @@ -631,8 +625,6 @@ func QuantizeAndDequantizeRangeGiven(value bool) QuantizeAndDequantizeAttr { } // QuantizeAndDequantizeInputMin sets the optional input_min attribute to value. -// -// value: If range is given, this is the min of the range. // If not specified, defaults to f:0 func QuantizeAndDequantizeInputMin(value float32) QuantizeAndDequantizeAttr { return func(m optionalAttr) { @@ -641,8 +633,6 @@ func QuantizeAndDequantizeInputMin(value float32) QuantizeAndDequantizeAttr { } // QuantizeAndDequantizeInputMax sets the optional input_max attribute to value. -// -// value: If range is given, this is the max of the range. // If not specified, defaults to f:0 func QuantizeAndDequantizeInputMax(value float32) QuantizeAndDequantizeAttr { return func(m optionalAttr) { @@ -650,62 +640,9 @@ func QuantizeAndDequantizeInputMax(value float32) QuantizeAndDequantizeAttr { } } -// Quantizes then dequantizes a tensor. -// -// DEPRECATED at GraphDef version 21: Replaced by QuantizeAndDequantizeV2 -// -// This op simulates the precision loss from the quantized forward pass by: -// 1. Quantizing the tensor to fixed point numbers, which should match the target -// quantization method when it is used in inference. -// 2. Dequantizing it back to floating point numbers for the following ops, most -// likely matmul. -// -// There are different ways to quantize. This version does not use the full range -// of the output type, choosing to elide the lowest possible value for symmetry -// (e.g., output range is -127 to 127, not -128 to 127 for signed 8 bit -// quantization), so that 0.0 maps to 0. -// -// To perform this op, we first find the range of values in our tensor. The range -// we use is always centered on 0, so we find m such that -// -// 1. m = max(abs(input_min), abs(input_max)) if range_given is true, -// 2. m = max(max(abs(min_elem(input)), abs(max_elem(input))) otherwise. -// -// Our input tensor range is then [-m, m]. -// -// Next, we choose our fixed-point quantization buckets, [min_fixed, max_fixed]. -// If signed_input is true, this is +// Use QuantizeAndDequantizeV2 instead. // -// [min_fixed, max_fixed ] = -// [-(1 << (num_bits - 1) - 1), (1 << (num_bits - 1)) - 1]. -// -// Otherwise, if signed_input is false, the fixed-point range is -// -// [min_fixed, max_fixed] = [0, (1 << num_bits) - 1]. -// -// From this we compute our scaling factor, s: -// -// s = (max_fixed - min_fixed) / (2 * m). -// -// Now we can quantize and dequantize the elements of our tensor. An element e -// is transformed into e': -// -// e' = (e * s).round_to_nearest() / s. -// -// Note that we have a different number of buckets in the signed vs. unsigned -// cases. For example, if num_bits == 8, we get 254 buckets in the signed case -// vs. 255 in the unsigned case. -// -// For example, suppose num_bits = 8 and m = 1. Then -// -// [min_fixed, max_fixed] = [-127, 127], and -// s = (127 + 127) / 2 = 127. -// -// Given the vector {-1, -0.5, 0, 0.3}, this is quantized to -// {-127, -63, 0, 38}, and dequantized to {-1, -63.0/127, 0, 38.0/127}. -// -// Arguments: -// input: Tensor to quantize and then dequantize. +// DEPRECATED at GraphDef version 22: Replaced by QuantizeAndDequantizeV2 func QuantizeAndDequantize(scope *Scope, input tf.Output, optional ...QuantizeAndDequantizeAttr) (output tf.Output) { if scope.Err() != nil { return -- GitLab From eb72796ab8906b5518825b69bccd62f039662da3 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 15:27:20 -0800 Subject: [PATCH 057/101] Update android version in Docker. Change: 148823878 --- WORKSPACE | 2 +- tensorflow/tools/ci_build/Dockerfile.android | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index c8aca38839..162b9b43bc 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -25,7 +25,7 @@ check_version("0.4.2") #android_sdk_repository( # name = "androidsdk", # api_level = 23, -# build_tools_version = "23.0.1", +# build_tools_version = "25.0.1", # # Replace with path to Android SDK on your system # path = "", #) diff --git a/tensorflow/tools/ci_build/Dockerfile.android b/tensorflow/tools/ci_build/Dockerfile.android index 031f8e8255..887589bc93 100644 --- a/tensorflow/tools/ci_build/Dockerfile.android +++ b/tensorflow/tools/ci_build/Dockerfile.android @@ -15,11 +15,8 @@ COPY install/.bazelrc /root/.bazelrc ENV BAZELRC /root/.bazelrc # Install extra libraries for android sdk. -# (see http://stackoverflow.com/questions/33427893/can-not-run-android-sdk-build-tools-23-0-2-aapt) RUN apt-get update && apt-get install -y \ python-numpy \ - lib32stdc++6 \ - lib32z1 \ && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* @@ -30,15 +27,15 @@ ENV ANDROID_DEV_HOME /android RUN mkdir -p ${ANDROID_DEV_HOME} # Install Android SDK. -ENV ANDROID_SDK_FILENAME android-sdk_r24.4.1-linux.tgz -ENV ANDROID_SDK_URL http://dl.google.com/android/${ANDROID_SDK_FILENAME} +ENV ANDROID_SDK_FILENAME tools_r25.2.5-linux.zip +ENV ANDROID_SDK_URL https://dl.google.com/android/repository/${ANDROID_SDK_FILENAME} ENV ANDROID_API_LEVEL 23 -ENV ANDROID_BUILD_TOOLS_VERSION 23.0.2 +ENV ANDROID_BUILD_TOOLS_VERSION 25.0.1 ENV ANDROID_SDK_HOME ${ANDROID_DEV_HOME}/sdk ENV PATH ${PATH}:${ANDROID_SDK_HOME}/tools:${ANDROID_SDK_HOME}/platform-tools RUN cd ${ANDROID_DEV_HOME} && \ wget -q ${ANDROID_SDK_URL} && \ - tar -xzf ${ANDROID_SDK_FILENAME} && \ + unzip ${ANDROID_SDK_FILENAME} -d android-sdk-linux && \ rm ${ANDROID_SDK_FILENAME} && \ bash -c "ln -s ${ANDROID_DEV_HOME}/android-sdk-* ${ANDROID_SDK_HOME}" && \ echo y | android update sdk --no-ui -a --filter tools,platform-tools,android-${ANDROID_API_LEVEL},build-tools-${ANDROID_BUILD_TOOLS_VERSION} -- GitLab From afc364bf3f2fba3576bc9dba9bcdb1fdef369883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dandelion=20Man=C3=A9?= Date: Tue, 28 Feb 2017 15:33:17 -0800 Subject: [PATCH 058/101] Migrate tf_scalar_dashboard to webfiles. Change: 148824590 --- .../components/tf_scalar_dashboard/BUILD | 75 +++++++++++++++++++ .../components/tf_scalar_dashboard/demo/BUILD | 26 +++++++ .../tf_scalar_dashboard/demo/data/BUILD | 17 +++++ .../tf_scalar_dashboard/demo/data/logdir | 1 + .../tf_scalar_dashboard/demo/data/runs.json | 26 +------ .../demo/data/scalars.json | 1 + .../demo/data/scalars/alpha/d1.json | 1 - .../demo/data/scalars/alpha/d2.json | 1 - .../demo/data/scalars/alpha/d3.json | 1 - .../demo/data/scalars/alpha/d4.json | 1 - .../demo/data/scalars/beta/d1.json | 1 - .../demo/data/scalars/beta/d2.json | 1 - .../demo/data/scalars/beta/d3.json | 1 - .../demo/data/scalars/beta/d4.json | 1 - .../scalars_run_run1_tag_bar_2Fsquare.json | 1 + .../data/scalars_run_run1_tag_foo_2Fcos.json | 1 + .../data/scalars_run_run1_tag_foo_2Fsin.json | 1 + .../scalars_run_run1_tag_foo_2Fsquare.json | 1 + .../scalars_run_run2_tag_bar_2Fsquare.json | 1 + .../data/scalars_run_run2_tag_foo_2Fcos.json | 1 + .../scalars_run_run2_tag_foo_2Fsquare.json | 1 + .../tf_scalar_dashboard/demo/index.html | 52 ++++++++----- 22 files changed, 163 insertions(+), 50 deletions(-) create mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/BUILD create mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/BUILD create mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/BUILD create mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/logdir create mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars.json delete mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d1.json delete mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d2.json delete mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d3.json delete mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d4.json delete mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d1.json delete mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d2.json delete mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d3.json delete mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d4.json create mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_bar_2Fsquare.json create mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_foo_2Fcos.json create mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_foo_2Fsin.json create mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_foo_2Fsquare.json create mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run2_tag_bar_2Fsquare.json create mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run2_tag_foo_2Fcos.json create mode 100644 tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run2_tag_foo_2Fsquare.json diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/BUILD b/tensorflow/tensorboard/components/tf_scalar_dashboard/BUILD new file mode 100644 index 0000000000..57bad96af6 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_scalar_dashboard/BUILD @@ -0,0 +1,75 @@ +package(default_visibility = ["//tensorflow:internal"]) + +load("@io_bazel_rules_closure//closure:defs.bzl", "webfiles") +load("//tensorflow/tensorboard:defs.bzl", "tensorboard_ts_library") +load("//tensorflow/tensorboard:defs.bzl", "tensorboard_webcomponent_library") + +licenses(["notice"]) # Apache 2.0 + +webfiles( + name = "tf_scalar_dashboard", + srcs = [ + "tf-scalar-dashboard.html", + "tf-smoothing-input.html", + ], + path = "/tf-scalar-dashboard", + deps = [ + "//tensorflow/tensorboard/components/tf_backend", + "//tensorflow/tensorboard/components/tf_color_scale", + "//tensorflow/tensorboard/components/tf_dashboard_common", + "//tensorflow/tensorboard/components/tf_imports:lodash", + "//tensorflow/tensorboard/components/vz_line_chart", + "@org_polymer", + "@org_polymer_iron_collapse", + "@org_polymer_paper_checkbox", + "@org_polymer_paper_dropdown_menu", + "@org_polymer_paper_icon_button", + "@org_polymer_paper_input", + "@org_polymer_paper_item", + "@org_polymer_paper_menu", + "@org_polymer_paper_slider", + "@org_polymer_paper_styles", + ], +) + +filegroup( + name = "all_files", + srcs = glob(["**"]), + tags = ["notsan"], +) + +################################################################################ +# MARKED FOR DELETION + +tensorboard_webcomponent_library( + name = "legacy", + srcs = [ + "tf-scalar-dashboard.html", + "tf-smoothing-input.html", + ], + destdir = "tf-scalar-dashboard", + deps = [ + "//tensorflow/tensorboard/components:tf_imports", + "//tensorflow/tensorboard/components/tf_backend:legacy", + "//tensorflow/tensorboard/components/tf_color_scale:legacy", + "//tensorflow/tensorboard/components/tf_dashboard_common:legacy", + "//tensorflow/tensorboard/components/vz_line_chart:legacy", + "//third_party/javascript/polymer/v1/iron-collapse:lib", + "//third_party/javascript/polymer/v1/paper-checkbox:lib", + "//third_party/javascript/polymer/v1/paper-dropdown-menu:lib", + "//third_party/javascript/polymer/v1/paper-icon-button:lib", + "//third_party/javascript/polymer/v1/paper-input:lib", + "//third_party/javascript/polymer/v1/paper-item:lib", + "//third_party/javascript/polymer/v1/paper-menu:lib", + "//third_party/javascript/polymer/v1/paper-slider:lib", + "//third_party/javascript/polymer/v1/paper-styles:lib", + "//third_party/javascript/polymer/v1/polymer:lib", + ], +) + +tensorboard_ts_library( + name = "legacy_ts", + srcs = [ + ], + deps = ["//tensorflow/tensorboard/components:common_deps"], +) diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/BUILD b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/BUILD new file mode 100644 index 0000000000..218fda3fdb --- /dev/null +++ b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/BUILD @@ -0,0 +1,26 @@ +package(default_visibility = ["//tensorflow:internal"]) + +load("@io_bazel_rules_closure//closure:defs.bzl", "webfiles") + +licenses(["notice"]) # Apache 2.0 + +# bazel run //third_party/tensorflow/tensorboard/components/tf_scalar_dashboard/demo +webfiles( + name = "demo", + srcs = ["index.html"], + path = "/tf-scalar-dashboard/demo", + deps = [ + "//tensorflow/tensorboard/components/tf_imports:d3", + "//tensorflow/tensorboard/components/tf_scalar_dashboard", + "//tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data", + "@org_polymer_iron_demo_helpers", + "@org_polymer_paper_styles", + "@org_polymer_webcomponentsjs", + ], +) + +filegroup( + name = "all_files", + srcs = glob(["**"]), + tags = ["notsan"], +) diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/BUILD b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/BUILD new file mode 100644 index 0000000000..7f39d27f60 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/BUILD @@ -0,0 +1,17 @@ +package(default_visibility = ["//tensorflow:internal"]) + +load("@io_bazel_rules_closure//closure:defs.bzl", "webfiles") + +licenses(["notice"]) # Apache 2.0 + +webfiles( + name = "data", + srcs = glob(["*"]), + path = "/tf-scalar-dashboard/demo/data", +) + +filegroup( + name = "all_files", + srcs = glob(["**"]), + tags = ["notsan"], +) diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/logdir b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/logdir new file mode 100644 index 0000000000..b6362b45d7 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/logdir @@ -0,0 +1 @@ +{"logdir": "/foo/some/fake/logdir"} \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/runs.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/runs.json index da831a00e9..d45f530763 100644 --- a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/runs.json +++ b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/runs.json @@ -1,24 +1,4 @@ { - "alpha": { - "scalars": [ - "d1", - "d2", - "d3", - "d4" - ], - "histograms": [], - "images": [], - "audio": [] - }, - "beta": { - "scalars": [ - "d1", - "d2", - "d3", - "d4" - ], - "histograms": [], - "images": [], - "audio": [] - } -} + "run1": {"scalars": ["foo/sin", "foo/cos", "foo/square", "bar/square"]}, + "run2": {"scalars": ["foo/cos", "foo/square", "bar/square"]} +} \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars.json new file mode 100644 index 0000000000..bc269395b6 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars.json @@ -0,0 +1 @@ +{"run2": {"foo/cos": [[0.0, 0, 2.0], [10.0, 1, 1.0806045532226562], [20.0, 2, -0.832293689250946], [30.0, 3, -1.979984998703003], [40.0, 4, -1.3072872161865234]], "bar/square": [[0.0, 0, 0.0], [10.0, 1, 1.0], [20.0, 2, 4.0], [30.0, 3, 9.0], [40.0, 4, 16.0]], "foo/square": [[0.0, 0, 0.0], [10.0, 1, 2.0], [20.0, 2, 8.0], [30.0, 3, 18.0], [40.0, 4, 32.0]]}, "run1": {"foo/sin": [[0.0, 0, 0.0], [10.0, 1, 0.8414709568023682], [20.0, 2, 0.9092974066734314], [30.0, 3, 0.14112000167369843], [40.0, 4, -0.756802499294281]], "foo/cos": [[0.0, 0, 1.0], [10.0, 1, 0.5403022766113281], [20.0, 2, -0.416146844625473], [30.0, 3, -0.9899924993515015], [40.0, 4, -0.6536436080932617]], "bar/square": [[0.0, 0, 0.0], [10.0, 1, 1.0], [20.0, 2, 4.0], [30.0, 3, 9.0], [40.0, 4, 16.0]], "foo/square": [[0.0, 0, 0.0], [10.0, 1, 1.0], [20.0, 2, 4.0], [30.0, 3, 9.0], [40.0, 4, 16.0]]}} \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d1.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d1.json deleted file mode 100644 index af17f5c328..0000000000 --- a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d1.json +++ /dev/null @@ -1 +0,0 @@ -[[1436926051.074826, 84, 0.6990088224411011], [1436926530.99861, 2289, 6.9384379386901855], [1436927011.134076, 7611, 13.698328971862793], [1436927490.984256, 16147, 20.168190002441406], [1436927970.957234, 26087, 20.877344131469727], [1436928450.977514, 36241, 21.269058227539062], [1436928930.989548, 46432, 21.329505920410156], [1436929410.976308, 56629, 21.220420837402344], [1436929890.966395, 66791, 21.190065383911133], [1436930370.958199, 76936, 21.108604431152344], [1436930850.985301, 87083, 21.157001495361328], [1436931331.009261, 97161, 21.02127456665039], [1436931810.966042, 107210, 20.891658782958984], [1436932290.955417, 117262, 20.930112838745117], [1436932770.964496, 127333, 20.986324310302734], [1436933250.962592, 137430, 20.981359481811523], [1436933730.992022, 147528, 21.083036422729492], [1436934210.959831, 157635, 21.092649459838867], [1436934690.97072, 167749, 21.11568832397461], [1436935170.957944, 177869, 21.145965576171875], [1436935650.959987, 188025, 21.215585708618164], [1436936130.997541, 198206, 21.227184295654297], [1436936610.965526, 208395, 21.226459503173828], [1436937090.965581, 218592, 21.264968872070312], [1436937570.964874, 228818, 21.335866928100586], [1436938050.965706, 239021, 21.286521911621094], [1436938531.013159, 249210, 21.20963478088379], [1436939010.957926, 259415, 21.28431510925293], [1436939490.96341, 269637, 21.326831817626953], [1436939970.959372, 279876, 21.38308334350586], [1436940450.963802, 290127, 21.355499267578125], [1436940931.004537, 300349, 21.31337547302246], [1436941410.979614, 310601, 21.405778884887695], [1436941890.979674, 320872, 21.368688583374023], [1436942370.975153, 331131, 21.39077377319336], [1436942850.980459, 341399, 21.41745948791504], [1436943331.000808, 351651, 21.384023666381836], [1436943810.968736, 361904, 21.326438903808594], [1436944290.95947, 372158, 21.367351531982422], [1436944770.955783, 382430, 21.476247787475586], [1436945250.966321, 392684, 21.36678695678711], [1436945731.008667, 402950, 21.349145889282227], [1436946210.977922, 413210, 21.373897552490234], [1436946690.975303, 423463, 21.322399139404297], [1436947170.964596, 433723, 21.341150283813477], [1436947650.955017, 443991, 21.366348266601562], [1436948130.992501, 454271, 21.43844223022461], [1436948610.960555, 464519, 21.36829948425293], [1436949090.961079, 474758, 21.266357421875], [1436949570.971528, 484987, 21.316511154174805], [1436950050.977787, 495228, 21.356050491333008], [1436950531.020035, 505458, 21.31462860107422], [1436951010.959775, 515682, 21.277490615844727], [1436951490.967418, 525910, 21.289737701416016], [1436951970.969778, 536112, 21.2515811920166], [1436952450.956291, 546320, 21.254491806030273], [1436952931.005547, 556541, 21.297870635986328], [1436953410.955758, 566755, 21.320045471191406], [1436953890.959151, 576957, 21.23529624938965], [1436954370.959553, 587165, 21.25132179260254], [1436954850.960546, 597371, 21.23470115661621], [1436955330.989932, 607582, 21.19434356689453], [1436955810.957128, 617790, 21.258535385131836], [1436956290.9763, 627991, 21.221921920776367], [1436956770.957785, 638208, 21.309843063354492], [1436957250.974143, 648404, 21.252185821533203], [1436957731.012441, 658613, 21.265626907348633], [1436958210.980787, 668824, 21.239660263061523], [1436958690.973474, 679034, 21.2642765045166], [1436959170.95825, 689249, 21.303138732910156], [1436959650.959345, 699454, 21.24073600769043], [1436960131.008682, 709664, 21.217615127563477], [1436960610.958074, 719876, 21.251184463500977], [1436961090.963638, 730100, 21.290971755981445], [1436961570.979029, 740316, 21.305265426635742], [1436962050.974645, 750534, 21.27857208251953], [1436962531.055479, 760757, 21.329837799072266], [1436963010.975299, 770964, 21.248849868774414], [1436963490.963107, 781164, 21.19978904724121], [1436963970.965936, 791382, 21.30535888671875], [1436964450.959947, 801590, 21.226255416870117], [1436964931.00587, 811785, 21.242237091064453], [1436965410.977997, 821977, 21.226497650146484], [1436965890.988465, 832189, 21.31219482421875], [1436966370.965612, 842399, 21.283390045166016], [1436966850.965794, 852612, 21.273908615112305], [1436967331.009476, 862825, 21.260452270507812], [1436967810.96767, 873037, 21.315444946289062], [1436968290.959107, 883248, 21.28677749633789], [1436968770.9681, 893452, 21.265335083007812], [1436969250.959332, 903655, 21.252891540527344], [1436969731.055609, 913856, 21.233684539794922], [1436970210.961426, 924047, 21.191429138183594], [1436970690.962999, 934250, 21.23288345336914], [1436971170.989107, 944430, 21.17190170288086], [1436971650.956015, 954634, 21.275972366333008], [1436972131.006841, 964844, 21.278474807739258], [1436972610.981754, 975045, 21.25553321838379], [1436973090.961548, 985239, 21.21686553955078], [1436973570.960013, 995439, 21.26004981994629], [1436974050.975653, 1005642, 21.25356101989746], [1436974530.988571, 1015842, 21.23944664001465], [1436975010.95851, 1026048, 21.293363571166992], [1436975490.97355, 1036253, 21.277101516723633], [1436975970.960916, 1046451, 21.242155075073242], [1436976450.990263, 1056636, 21.182037353515625], [1436976930.999578, 1066834, 21.21113395690918], [1436977410.962637, 1077031, 21.230762481689453], [1436977890.970389, 1087222, 21.232444763183594], [1436978370.959059, 1097405, 21.202342987060547], [1436978850.956562, 1107601, 21.23992156982422], [1436979331.021134, 1117786, 21.197628021240234], [1436979810.958593, 1127973, 21.2270565032959], [1436980290.958763, 1138163, 21.250303268432617], [1436980770.967171, 1148348, 21.215538024902344], [1436981250.960473, 1158540, 21.277185440063477], [1436981731.009465, 1168733, 21.268449783325195], [1436982210.960797, 1178930, 21.268077850341797], [1436982690.959709, 1189129, 21.243141174316406], [1436983170.961963, 1199327, 21.21793556213379], [1436983650.958504, 1209524, 21.2817440032959], [1436984130.998057, 1219726, 21.261478424072266], [1436984610.958945, 1229936, 21.300107955932617], [1436985090.978825, 1240145, 21.326183319091797], [1436985570.993741, 1250311, 21.115875244140625], [1436986050.965608, 1260436, 21.19010353088379], [1436986531.026713, 1270611, 21.183719635009766], [1436987010.969056, 1280784, 21.273176193237305], [1436987490.975071, 1290959, 21.182931900024414], [1436987970.96007, 1301147, 21.260244369506836], [1436988450.966092, 1311328, 21.225025177001953], [1436988931.004917, 1321514, 21.242164611816406], [1436989410.980351, 1331709, 21.19801139831543], [1436989890.975192, 1341910, 21.273555755615234], [1436990370.964941, 1352090, 21.175983428955078], [1436990850.973647, 1362240, 21.13412094116211], [1436991330.999346, 1372396, 21.153064727783203], [1436991811.003573, 1382550, 21.155475616455078], [1436992290.962706, 1392710, 21.17011833190918], [1436992770.999149, 1402862, 21.128713607788086], [1436993250.965124, 1413020, 21.1361026763916], [1436993731.020464, 1423164, 21.157777786254883], [1436994210.966935, 1433312, 21.119478225708008], [1436994690.962803, 1443468, 21.161104202270508], [1436995170.972952, 1453657, 21.11492919921875], [1436995650.976233, 1463820, 21.194231033325195], [1436996130.990524, 1473980, 21.169816970825195], [1436996610.97302, 1484152, 21.18223762512207], [1436997090.958457, 1494308, 21.1954402923584], [1436997570.980333, 1504463, 21.140769958496094], [1436998050.969869, 1514618, 21.162744522094727], [1436998530.99688, 1524770, 21.139591217041016], [1436999010.970375, 1534905, 21.107114791870117], [1436999490.960775, 1545070, 21.233396530151367], [1436999970.965087, 1555223, 21.201074600219727], [1437000450.969008, 1565370, 21.147083282470703], [1437000931.007425, 1575517, 21.108510971069336], [1437001410.962798, 1585666, 21.11674690246582], [1437001890.966192, 1595826, 21.17819595336914], [1437002370.961814, 1605980, 21.157669067382812], [1437002850.962206, 1616145, 21.212690353393555], [1437003330.994816, 1626291, 21.177446365356445], [1437003810.966017, 1636448, 21.17884063720703], [1437004290.959479, 1646599, 21.150310516357422], [1437004770.965083, 1656754, 21.21011734008789], [1437005250.958234, 1666902, 21.14912986755371], [1437005731.003528, 1677043, 21.125459671020508], [1437006210.961371, 1687192, 21.124374389648438], [1437006690.962663, 1697338, 21.150362014770508], [1437007170.961639, 1707484, 21.16637420654297], [1437007650.972242, 1717625, 21.163259506225586], [1437008131.003191, 1727767, 21.167280197143555], [1437008610.962644, 1737913, 21.174945831298828], [1437009090.964129, 1748068, 21.17894172668457], [1437009570.962582, 1758219, 21.116622924804688], [1437010050.984863, 1768384, 21.23469352722168], [1437010531.002295, 1778534, 21.143510818481445], [1437011010.961803, 1788677, 21.159791946411133], [1437011490.974074, 1798822, 21.119792938232422], [1437011970.959982, 1808958, 21.10943603515625], [1437012450.95932, 1819091, 21.123899459838867], [1437012931.004909, 1829227, 21.094532012939453], [1437013410.957751, 1839374, 21.200057983398438], [1437013890.960506, 1849509, 21.10895538330078], [1437014370.96113, 1859653, 21.108680725097656], [1437014850.962876, 1869791, 21.141136169433594], [1437015331.009875, 1879944, 21.160165786743164], [1437015810.960671, 1890090, 21.158742904663086], [1437016290.970743, 1900242, 21.16562271118164], [1437016770.961673, 1910391, 21.141860961914062], [1437017250.96735, 1920551, 21.19420051574707], [1437017731.000324, 1930702, 21.16814422607422], [1437018210.967878, 1940856, 21.125978469848633], [1437018690.962742, 1951005, 21.15043067932129], [1437019170.975774, 1961158, 21.157419204711914], [1437019650.964573, 1971309, 21.150177001953125], [1437020130.999343, 1981461, 21.124492645263672], [1437020610.960696, 1991611, 21.109933853149414], [1437021090.958597, 2001766, 21.169754028320312], [1437021570.964477, 2011919, 21.13479995727539], [1437022050.966522, 2022063, 21.131561279296875], [1437022531.005607, 2032219, 21.135629653930664], [1437023010.970667, 2042380, 21.207313537597656], [1437023490.964885, 2052534, 21.108623504638672], [1437023970.965596, 2062691, 21.14097023010254], [1437024450.962296, 2072837, 21.129037857055664], [1437024931.00395, 2082982, 21.077030181884766], [1437025410.96602, 2093128, 21.13152503967285], [1437025890.961753, 2103274, 21.117740631103516], [1437026370.962022, 2113424, 21.141584396362305], [1437026850.975475, 2123570, 21.143577575683594], [1437027331.009277, 2133721, 21.175586700439453], [1437027810.97206, 2143857, 21.099014282226562], [1437028290.961523, 2154015, 21.141523361206055], [1437028770.964366, 2164168, 21.141345977783203], [1437029250.962109, 2174320, 21.14827537536621], [1437029731.003068, 2184453, 21.086946487426758], [1437030210.960946, 2194602, 21.1590576171875], [1437030690.966681, 2204754, 21.17353057861328], [1437031170.961207, 2214899, 21.133989334106445], [1437031650.962809, 2225062, 21.14800453186035], [1437032130.997644, 2235215, 21.15397834777832], [1437032610.962999, 2245366, 21.15763282775879], [1437033090.962192, 2255521, 21.133577346801758], [1437033570.963341, 2265657, 21.058490753173828], [1437034050.979501, 2275787, 21.079614639282227], [1437034531.003514, 2285923, 21.12677574157715], [1437035010.960984, 2296058, 21.100793838500977], [1437035490.97325, 2306176, 21.10753059387207], [1437035970.969759, 2316297, 21.100393295288086], [1437036450.962305, 2326428, 21.041208267211914], [1437036931.001785, 2336571, 21.15167999267578], [1437037410.967681, 2346709, 21.09291648864746], [1437037890.963194, 2356854, 21.18524932861328], [1437038370.96445, 2366985, 21.116247177124023], [1437038850.960718, 2377124, 21.125469207763672], [1437039331.003148, 2387259, 21.132274627685547], [1437039810.974007, 2397400, 21.119945526123047], [1437040290.983415, 2407539, 21.154672622680664], [1437040770.961836, 2417667, 21.066741943359375], [1437041250.964281, 2427791, 21.126564025878906], [1437041731.0196, 2437923, 21.1062068939209], [1437042210.962927, 2448056, 21.124549865722656], [1437042690.964392, 2458193, 21.13232421875], [1437043170.972024, 2468318, 21.066423416137695], [1437043650.966111, 2478449, 21.123788833618164], [1437044131.030028, 2488576, 21.138349533081055], [1437044610.962532, 2498717, 21.11895179748535], [1437045090.965094, 2508839, 21.019609451293945], [1437045570.963352, 2518972, 21.079254150390625], [1437046050.96194, 2529106, 21.15033531188965], [1437046530.995016, 2539243, 21.11912727355957], [1437047010.963313, 2549369, 21.08464813232422], [1437047490.963943, 2559509, 21.133895874023438], [1437047970.958612, 2569646, 21.108659744262695], [1437048450.962392, 2579776, 21.084848403930664], [1437048931.005408, 2589906, 21.092708587646484], [1437049410.984115, 2600033, 21.130634307861328], [1437049890.964103, 2610162, 21.074010848999023], [1437050370.960886, 2620282, 21.086149215698242], [1437050850.959795, 2630402, 21.08969497680664], [1437051331.008292, 2640533, 21.134498596191406], [1437051810.96622, 2650643, 21.065444946289062], [1437052290.98584, 2660774, 21.120830535888672], [1437052770.967707, 2670900, 21.085134506225586], [1437053250.978851, 2681021, 21.037155151367188], [1437053731.021686, 2691151, 21.09203338623047], [1437054210.971744, 2701273, 21.048450469970703], [1437054690.966686, 2711425, 21.048809051513672], [1437055170.964463, 2721564, 21.13330078125], [1437055650.97301, 2731694, 21.097095489501953], [1437056130.997053, 2741810, 21.031536102294922], [1437056610.968681, 2751927, 21.04400634765625], [1437057090.976676, 2762049, 21.114444732666016], [1437057570.962334, 2772169, 21.06243896484375], [1437058050.969524, 2782292, 21.12563133239746], [1437058531.012918, 2792420, 21.12433433532715], [1437059010.972868, 2802545, 21.067407608032227], [1437059490.96188, 2812684, 21.099285125732422], [1437059970.965083, 2822806, 21.08357810974121], [1437060450.964845, 2832940, 21.142192840576172], [1437060931.011947, 2843080, 21.109895706176758], [1437061410.963414, 2853223, 21.13360023498535], [1437061890.969303, 2863361, 21.152849197387695], [1437062370.963703, 2873490, 21.08356285095215], [1437062850.964392, 2883627, 21.115087509155273], [1437063331.025516, 2893758, 21.13198471069336], [1437063810.962087, 2903877, 21.084623336791992], [1437064290.973818, 2914013, 21.14010238647461], [1437064770.967792, 2924145, 21.108346939086914], [1437065250.95886, 2934291, 21.1142635345459], [1437065731.01002, 2944434, 21.17418670654297], [1437066210.959306, 2954576, 21.084075927734375], [1437066690.960644, 2964724, 21.125164031982422], [1437067170.969539, 2974890, 21.200775146484375], [1437067650.960018, 2985036, 21.14740562438965], [1437068130.990731, 2995179, 21.11964225769043], [1437068610.960429, 3005322, 21.141313552856445], [1437069090.95752, 3015461, 21.082963943481445], [1437069570.974879, 3025595, 21.12288475036621], [1437070050.95761, 3035734, 21.107513427734375], [1437070531.0013, 3045868, 21.171630859375], [1437071010.961705, 3056004, 21.066505432128906], [1437071490.961495, 3066137, 21.10834312438965], [1437071970.978122, 3076267, 21.08027458190918], [1437072450.963299, 3086399, 21.089733123779297], [1437072931.018382, 3096524, 21.133176803588867], [1437073050.962102, 3099048, 21.041847229003906], [1437073170.96983, 3101584, 21.131967544555664], [1437073290.957895, 3104118, 21.118793487548828]] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d2.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d2.json deleted file mode 100644 index 92bb414348..0000000000 --- a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d2.json +++ /dev/null @@ -1 +0,0 @@ -[[1436925978.257845, 7, 0.04500000178813934], [1436926413.945391, 1476, 0.04500000178813934], [1436926893.945037, 6006, 0.04500000178813934], [1436927373.995472, 13786, 0.04500000178813934], [1436927853.989794, 23650, 0.04500000178813934], [1436928334.132361, 33755, 0.04500000178813934], [1436928813.973288, 43941, 0.04500000178813934], [1436929293.975949, 54146, 0.04500000178813934], [1436929773.992781, 64316, 0.04500000178813934], [1436930253.997415, 74465, 0.04500000178813934], [1436930734.203004, 84611, 0.04230000078678131], [1436931214.03644, 94700, 0.04230000078678131], [1436931694.094564, 104766, 0.04230000078678131], [1436932174.114955, 114817, 0.04230000078678131], [1436932654.161382, 124880, 0.04230000078678131], [1436933133.960214, 134977, 0.04230000078678131], [1436933614.044337, 145062, 0.04230000078678131], [1436934094.166206, 155169, 0.04230000078678131], [1436934574.106036, 165284, 0.03976200148463249], [1436935054.150647, 175402, 0.03976200148463249], [1436935533.819562, 185538, 0.03976200148463249], [1436936013.710422, 195712, 0.03976200148463249], [1436936493.609025, 205906, 0.03976200148463249], [1436936973.683892, 216099, 0.03976200148463249], [1436937454.138383, 226331, 0.03976200148463249], [1436937933.838475, 236532, 0.03976200148463249], [1436938413.89688, 246724, 0.0373762808740139], [1436938894.018652, 256925, 0.0373762808740139], [1436939373.69067, 267137, 0.0373762808740139], [1436939853.673692, 277369, 0.0373762808740139], [1436940333.651346, 287620, 0.0373762808740139], [1436940813.599579, 297848, 0.0373762808740139], [1436941293.596313, 308088, 0.0373762808740139], [1436941773.659172, 318362, 0.0373762808740139], [1436942253.648479, 328621, 0.03513370454311371], [1436942733.752284, 338892, 0.03513370454311371], [1436943213.621881, 349144, 0.03513370454311371], [1436943693.698743, 359399, 0.03513370454311371], [1436944173.578463, 369649, 0.03513370454311371], [1436944653.692217, 379912, 0.03513370454311371], [1436945133.677298, 390180, 0.03513370454311371], [1436945613.572411, 400445, 0.03302568197250366], [1436946093.56123, 410703, 0.03302568197250366], [1436946573.542364, 420958, 0.03302568197250366], [1436947053.616578, 431216, 0.03302568197250366], [1436947533.636973, 441483, 0.03302568197250366], [1436948013.541574, 451751, 0.03302568197250366], [1436948493.560223, 462015, 0.03302568197250366], [1436948973.512541, 472260, 0.03302568197250366], [1436949453.550055, 482483, 0.031044140458106995], [1436949933.828011, 492731, 0.031044140458106995], [1436950413.603177, 502957, 0.031044140458106995], [1436950893.563009, 513185, 0.031044140458106995], [1436951373.620887, 523410, 0.031044140458106995], [1436951853.61941, 533618, 0.031044140458106995], [1436952333.694447, 543828, 0.031044140458106995], [1436952813.621004, 554042, 0.031044140458106995], [1436953293.588156, 564251, 0.02918149158358574], [1436953773.599734, 574464, 0.02918149158358574], [1436954253.621309, 584672, 0.02918149158358574], [1436954733.738119, 594882, 0.02918149158358574], [1436955213.56617, 605091, 0.02918149158358574], [1436955693.585366, 615296, 0.02918149158358574], [1436956173.626395, 625501, 0.02918149158358574], [1436956653.601937, 635705, 0.02918149158358574], [1436957133.665878, 645915, 0.02743060328066349], [1436957613.584762, 656116, 0.02743060328066349], [1436958093.549783, 666331, 0.02743060328066349], [1436958573.646778, 676543, 0.02743060328066349], [1436959053.585655, 686750, 0.02743060328066349], [1436959533.679696, 696961, 0.02743060328066349], [1436960013.633292, 707173, 0.02743060328066349], [1436960493.578778, 717383, 0.02743060328066349], [1436960973.596715, 727598, 0.025784766301512718], [1436961453.625644, 737818, 0.025784766301512718], [1436961933.740339, 748040, 0.025784766301512718], [1436962413.573845, 758252, 0.025784766301512718], [1436962893.610678, 768470, 0.025784766301512718], [1436963373.642878, 778674, 0.025784766301512718], [1436963853.558388, 788877, 0.025784766301512718], [1436964333.658419, 799099, 0.025784766301512718], [1436964813.573319, 809289, 0.024237681180238724], [1436965293.542098, 819484, 0.024237681180238724], [1436965773.545453, 829687, 0.024237681180238724], [1436966253.586517, 839901, 0.024237681180238724], [1436966733.639348, 850120, 0.024237681180238724], [1436967213.697288, 860330, 0.024237681180238724], [1436967693.617172, 870539, 0.024237681180238724], [1436968173.593885, 880748, 0.024237681180238724], [1436968653.560836, 890955, 0.022783419117331505], [1436969133.676337, 901164, 0.022783419117331505], [1436969613.506638, 911358, 0.022783419117331505], [1436970093.595964, 921560, 0.022783419117331505], [1436970573.541227, 931756, 0.022783419117331505], [1436971053.624316, 941945, 0.022783419117331505], [1436971533.655543, 952138, 0.022783419117331505], [1436972013.604738, 962349, 0.02141641452908516], [1436972493.613199, 972551, 0.02141641452908516], [1436972973.501155, 982746, 0.02141641452908516], [1436973453.64842, 992945, 0.02141641452908516], [1436973933.689516, 1003147, 0.02141641452908516], [1436974413.577769, 1013350, 0.02141641452908516], [1436974893.542281, 1023545, 0.02141641452908516], [1436975373.638453, 1033759, 0.02141641452908516], [1436975853.524388, 1043955, 0.02013142965734005], [1436976333.625792, 1054148, 0.02013142965734005], [1436976813.610661, 1064342, 0.02013142965734005], [1436977293.601581, 1074539, 0.02013142965734005], [1436977773.575627, 1084733, 0.02013142965734005], [1436978253.564972, 1094914, 0.02013142965734005], [1436978733.673144, 1105109, 0.02013142965734005], [1436979213.540585, 1115293, 0.02013142965734005], [1436979693.699591, 1125483, 0.018923543393611908], [1436980173.613012, 1135670, 0.018923543393611908], [1436980653.575769, 1145862, 0.018923543393611908], [1436981133.719264, 1156045, 0.018923543393611908], [1436981613.563551, 1166236, 0.018923543393611908], [1436982093.553233, 1176436, 0.018923543393611908], [1436982573.577846, 1186636, 0.018923543393611908], [1436983053.605749, 1196837, 0.018923543393611908], [1436983533.684994, 1207025, 0.017788130789995193], [1436984013.561492, 1217233, 0.017788130789995193], [1436984493.629873, 1227437, 0.017788130789995193], [1436984973.606714, 1237643, 0.017788130789995193], [1436985453.690084, 1247835, 0.017788130789995193], [1436985933.711388, 1257951, 0.017788130789995193], [1436986413.598807, 1268125, 0.017788130789995193], [1436986893.631797, 1278290, 0.017788130789995193], [1436987373.596962, 1288473, 0.016720842570066452], [1436987853.555549, 1298650, 0.016720842570066452], [1436988333.722032, 1308841, 0.016720842570066452], [1436988813.55697, 1319018, 0.016720842570066452], [1436989293.756905, 1329221, 0.016720842570066452], [1436989773.665141, 1339417, 0.016720842570066452], [1436990253.768302, 1349610, 0.016720842570066452], [1436990733.708919, 1359759, 0.016720842570066452], [1436991213.663033, 1369914, 0.01571759209036827], [1436991693.730925, 1380074, 0.01571759209036827], [1436992173.751791, 1390224, 0.01571759209036827], [1436992653.758682, 1400383, 0.01571759209036827], [1436993133.835604, 1410542, 0.01571759209036827], [1436993613.674655, 1420684, 0.01571759209036827], [1436994093.747454, 1430832, 0.01571759209036827], [1436994573.768973, 1440986, 0.01571759209036827], [1436995053.666661, 1451174, 0.014774537645280361], [1436995533.83439, 1461345, 0.014774537645280361], [1436996013.556996, 1471495, 0.014774537645280361], [1436996493.635477, 1481663, 0.014774537645280361], [1436996973.668684, 1491822, 0.014774537645280361], [1436997453.59326, 1501979, 0.014774537645280361], [1436997933.774019, 1512139, 0.014774537645280361], [1436998413.575162, 1522290, 0.01388806477189064], [1436998893.640468, 1532431, 0.01388806477189064], [1436999373.551661, 1542579, 0.01388806477189064], [1436999853.57906, 1552734, 0.01388806477189064], [1437000333.680409, 1562888, 0.01388806477189064], [1437000813.602383, 1573037, 0.01388806477189064], [1437001293.610337, 1583190, 0.01388806477189064], [1437001773.618199, 1593341, 0.01388806477189064], [1437002253.572966, 1603497, 0.013054781593382359], [1437002733.67994, 1613657, 0.013054781593382359], [1437003213.583266, 1623809, 0.013054781593382359], [1437003693.639943, 1633966, 0.013054781593382359], [1437004173.568287, 1644113, 0.013054781593382359], [1437004653.610772, 1654268, 0.013054781593382359], [1437005133.663045, 1664424, 0.013054781593382359], [1437005613.580984, 1674567, 0.013054781593382359], [1437006093.601019, 1684715, 0.01227149460464716], [1437006573.625314, 1694857, 0.01227149460464716], [1437007053.584514, 1704999, 0.01227149460464716], [1437007533.719303, 1715150, 0.01227149460464716], [1437008013.604962, 1725282, 0.01227149460464716], [1437008493.655091, 1735432, 0.01227149460464716], [1437008973.640165, 1745584, 0.01227149460464716], [1437009453.715067, 1755742, 0.01227149460464716], [1437009933.765712, 1765896, 0.011535204015672207], [1437010413.632128, 1776052, 0.011535204015672207], [1437010893.66766, 1786195, 0.011535204015672207], [1437011373.636164, 1796346, 0.011535204015672207], [1437011853.631224, 1806481, 0.011535204015672207], [1437012333.706205, 1816617, 0.011535204015672207], [1437012813.61987, 1826754, 0.011535204015672207], [1437013293.479904, 1836883, 0.011535204015672207], [1437013773.604574, 1847029, 0.010843091644346714], [1437014253.618884, 1857175, 0.010843091644346714], [1437014733.756419, 1867312, 0.010843091644346714], [1437015213.638607, 1877459, 0.010843091644346714], [1437015693.625763, 1887608, 0.010843091644346714], [1437016173.63194, 1897759, 0.010843091644346714], [1437016653.609074, 1907909, 0.010843091644346714], [1437017133.717601, 1918074, 0.010843091644346714], [1437017613.716011, 1928220, 0.010192506946623325], [1437018093.626005, 1938377, 0.010192506946623325], [1437018573.626522, 1948523, 0.010192506946623325], [1437019053.648174, 1958678, 0.010192506946623325], [1437019533.803011, 1968831, 0.010192506946623325], [1437020013.667751, 1978978, 0.010192506946623325], [1437020493.659028, 1989133, 0.010192506946623325], [1437020973.657346, 1999287, 0.010192506946623325], [1437021453.650634, 2009437, 0.00958095584064722], [1437021933.848661, 2019588, 0.00958095584064722], [1437022413.674963, 2029736, 0.00958095584064722], [1437022893.69086, 2039894, 0.00958095584064722], [1437023373.68883, 2050054, 0.00958095584064722], [1437023853.686116, 2060205, 0.00958095584064722], [1437024333.763876, 2070362, 0.00958095584064722], [1437024813.707845, 2080507, 0.00958095584064722], [1437025293.483294, 2090645, 0.009006098844110966], [1437025773.695712, 2100793, 0.009006098844110966], [1437026253.672994, 2110943, 0.009006098844110966], [1437026733.780775, 2121094, 0.009006098844110966], [1437027213.617849, 2131235, 0.009006098844110966], [1437027693.694451, 2141382, 0.009006098844110966], [1437028173.68596, 2151537, 0.009006098844110966], [1437028653.584833, 2161685, 0.009006098844110966], [1437029133.792483, 2171839, 0.00846573244780302], [1437029613.661672, 2181977, 0.00846573244780302], [1437030093.641009, 2192118, 0.00846573244780302], [1437030573.656274, 2202268, 0.00846573244780302], [1437031053.643631, 2212416, 0.00846573244780302], [1437031533.777478, 2222583, 0.00846573244780302], [1437032013.704008, 2232736, 0.00846573244780302], [1437032493.638393, 2242882, 0.007957788184285164], [1437032973.684986, 2253041, 0.007957788184285164], [1437033453.699562, 2263183, 0.007957788184285164], [1437033933.918074, 2273320, 0.007957788184285164], [1437034413.596351, 2283443, 0.007957788184285164], [1437034893.640496, 2293579, 0.007957788184285164], [1437035373.637761, 2303701, 0.007957788184285164], [1437035853.669947, 2313823, 0.007957788184285164], [1437036333.78905, 2323961, 0.0074803209863603115], [1437036813.699727, 2334089, 0.0074803209863603115], [1437037293.662592, 2344235, 0.0074803209863603115], [1437037773.66716, 2354364, 0.0074803209863603115], [1437038253.603687, 2364507, 0.0074803209863603115], [1437038733.78864, 2374644, 0.0074803209863603115], [1437039213.641799, 2384782, 0.0074803209863603115], [1437039693.687078, 2394923, 0.0074803209863603115], [1437040173.635717, 2405058, 0.0070315017364919186], [1437040653.673331, 2415194, 0.0070315017364919186], [1437041133.764768, 2425322, 0.0070315017364919186], [1437041613.629279, 2435449, 0.0070315017364919186], [1437042093.703985, 2445575, 0.0070315017364919186], [1437042573.496029, 2455712, 0.0070315017364919186], [1437043053.686022, 2465844, 0.0070315017364919186], [1437043533.731929, 2475974, 0.0070315017364919186], [1437044013.636245, 2486095, 0.006609611678868532], [1437044493.69923, 2496238, 0.006609611678868532], [1437044973.652155, 2506373, 0.006609611678868532], [1437045453.691467, 2516497, 0.006609611678868532], [1437045933.935804, 2526637, 0.006609611678868532], [1437046413.635583, 2536770, 0.006609611678868532], [1437046893.626337, 2546896, 0.006609611678868532], [1437047373.67437, 2557029, 0.006609611678868532], [1437047853.652939, 2567169, 0.0062130349688231945], [1437048333.778436, 2577306, 0.0062130349688231945], [1437048813.654248, 2587433, 0.0062130349688231945], [1437049293.610609, 2597552, 0.0062130349688231945], [1437049773.646573, 2607690, 0.0062130349688231945], [1437050253.667925, 2617808, 0.0062130349688231945], [1437050733.735291, 2627933, 0.0062130349688231945], [1437051213.620222, 2638053, 0.0062130349688231945], [1437051693.601978, 2648171, 0.005840253084897995], [1437052173.634985, 2658299, 0.005840253084897995], [1437052653.687176, 2668425, 0.005840253084897995], [1437053133.762819, 2678556, 0.005840253084897995], [1437053613.643698, 2688671, 0.005840253084897995], [1437054093.673047, 2698804, 0.005840253084897995], [1437054573.667371, 2708956, 0.005840253084897995], [1437055053.650441, 2719087, 0.005840253084897995], [1437055533.778469, 2729219, 0.005489837843924761], [1437056013.694082, 2739343, 0.005489837843924761], [1437056493.674871, 2749458, 0.005489837843924761], [1437056973.700234, 2759575, 0.005489837843924761], [1437057453.666129, 2769697, 0.005489837843924761], [1437057933.848506, 2779821, 0.005489837843924761], [1437058413.643799, 2789941, 0.005489837843924761], [1437058893.715386, 2800076, 0.005489837843924761], [1437059373.62596, 2810207, 0.005160447675734758], [1437059853.650848, 2820334, 0.005160447675734758], [1437060333.792248, 2830465, 0.005160447675734758], [1437060813.682955, 2840600, 0.005160447675734758], [1437061293.681795, 2850745, 0.005160447675734758], [1437061773.691182, 2860880, 0.005160447675734758], [1437062253.662987, 2871013, 0.005160447675734758], [1437062733.760419, 2881153, 0.005160447675734758], [1437063213.651969, 2891278, 0.004850820638239384], [1437063693.723523, 2901406, 0.004850820638239384], [1437064173.68663, 2911533, 0.004850820638239384], [1437064653.547643, 2921667, 0.004850820638239384], [1437065133.62645, 2931813, 0.004850820638239384], [1437065613.566569, 2941947, 0.004850820638239384], [1437066093.537804, 2952102, 0.004850820638239384], [1437066573.529332, 2962243, 0.004850820638239384], [1437067053.520098, 2972400, 0.004559771623462439], [1437067533.605733, 2982561, 0.004559771623462439], [1437068013.535467, 2992698, 0.004559771623462439], [1437068493.559976, 3002839, 0.004559771623462439], [1437068973.558743, 3012983, 0.004559771623462439], [1437069453.562661, 3023116, 0.004559771623462439], [1437069933.627071, 3033256, 0.004559771623462439], [1437070413.574131, 3043386, 0.004286185372620821], [1437070893.658803, 3053528, 0.004286185372620821], [1437071373.638711, 3063659, 0.004286185372620821], [1437071853.621384, 3073794, 0.004286185372620821], [1437072333.665269, 3083926, 0.004286185372620821], [1437072813.584388, 3094040, 0.004286185372620821], [1437073293.569178, 3104172, 0.004286185372620821]] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d3.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d3.json deleted file mode 100644 index 69191b9154..0000000000 --- a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d3.json +++ /dev/null @@ -1 +0,0 @@ -[[1436925978.257845, 7, 0.0], [1436927853.989794, 23650, 7360.0], [1436929773.992781, 64316, 7360.0], [1436931694.094564, 104766, 7360.0], [1436933614.044337, 145062, 7360.0], [1436935533.819562, 185538, 7360.0], [1436937454.138383, 226331, 7360.0], [1436939373.69067, 267137, 7360.0], [1436941293.596313, 308088, 7360.0], [1436943213.621881, 349144, 7360.0], [1436945133.677298, 390180, 7360.0], [1436947053.616578, 431216, 7360.0], [1436948973.512541, 472260, 7360.0], [1436950893.563009, 513185, 7360.0], [1436952813.621004, 554042, 7360.0], [1436954733.738119, 594882, 7360.0], [1436956653.601937, 635705, 7360.0], [1436958573.646778, 676543, 7360.0], [1436960493.578778, 717383, 7360.0], [1436962413.573845, 758252, 7360.0], [1436964333.658419, 799099, 7360.0], [1436966253.586517, 839901, 7360.0], [1436968173.593885, 880748, 7360.0], [1436970093.595964, 921560, 7360.0], [1436972013.604738, 962349, 7360.0], [1436973933.689516, 1003147, 7360.0], [1436975853.524388, 1043955, 7360.0], [1436977773.575627, 1084733, 7360.0], [1436979693.699591, 1125483, 7360.0], [1436981613.563551, 1166236, 7360.0], [1436983533.684994, 1207025, 7360.0], [1436985453.690084, 1247835, 7360.0], [1436987373.596962, 1288473, 7360.0], [1436989293.756905, 1329221, 7360.0], [1436991213.663033, 1369914, 7360.0], [1436993133.835604, 1410542, 7360.0], [1436995053.666661, 1451174, 7360.0], [1436996973.668684, 1491822, 7360.0], [1436998893.640468, 1532431, 7360.0], [1437000813.602383, 1573037, 7360.0], [1437002733.67994, 1613657, 7360.0], [1437004653.610772, 1654268, 7360.0], [1437006573.625314, 1694857, 7360.0], [1437008493.655091, 1735432, 7360.0], [1437010413.632128, 1776052, 7360.0], [1437012333.706205, 1816617, 7360.0], [1437014253.618884, 1857175, 7360.0], [1437016173.63194, 1897759, 7360.0], [1437018093.626005, 1938377, 7360.0], [1437020013.667751, 1978978, 7360.0], [1437021933.848661, 2019588, 7360.0], [1437023853.686116, 2060205, 7360.0], [1437025773.695712, 2100793, 7360.0], [1437027693.694451, 2141382, 7360.0], [1437029613.661672, 2181977, 7360.0], [1437031533.777478, 2222583, 7360.0], [1437033453.699562, 2263183, 7360.0], [1437035373.637761, 2303701, 7360.0], [1437037293.662592, 2344235, 7360.0], [1437039213.641799, 2384782, 7360.0], [1437041133.764768, 2425322, 7360.0], [1437043053.686022, 2465844, 7360.0], [1437044973.652155, 2506373, 7360.0], [1437046893.626337, 2546896, 7862.0], [1437048813.654248, 2587433, 7862.0], [1437050733.735291, 2627933, 7862.0], [1437052653.687176, 2668425, 7862.0], [1437054573.667371, 2708956, 7862.0], [1437056493.674871, 2749458, 7862.0], [1437058413.643799, 2789941, 7862.0], [1437060333.792248, 2830465, 7862.0], [1437062253.662987, 2871013, 7862.0], [1437064173.68663, 2911533, 7862.0], [1437066093.537804, 2952102, 7862.0], [1437068013.535467, 2992698, 7862.0], [1437069933.627071, 3033256, 7862.0], [1437071853.621384, 3073794, 7862.0], [1437072333.665269, 3083926, 7862.0], [1437072813.584388, 3094040, 7862.0], [1437073293.569178, 3104172, 7862.0]] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d4.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d4.json deleted file mode 100644 index caf1ae6e7f..0000000000 --- a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/alpha/d4.json +++ /dev/null @@ -1 +0,0 @@ -[[1436925978.257845, 7, 2.461352825164795], [1436926413.945391, 1476, 12.772720336914062], [1436926893.945037, 6006, 12.195232391357422], [1436927373.995472, 13786, 11.528279304504395], [1436927853.989794, 23650, 10.722719192504883], [1436928334.132361, 33755, 10.215253829956055], [1436928813.973288, 43941, 9.730447769165039], [1436929293.975949, 54146, 9.399007797241211], [1436929773.992781, 64316, 9.1018648147583], [1436930253.997415, 74465, 8.961446762084961], [1436930734.203004, 84611, 8.757476806640625], [1436931214.03644, 94700, 8.4615478515625], [1436931694.094564, 104766, 8.506814956665039], [1436932174.114955, 114817, 8.246719360351562], [1436932654.161382, 124880, 8.329349517822266], [1436933133.960214, 134977, 7.90853214263916], [1436933614.044337, 145062, 8.192558288574219], [1436934094.166206, 155169, 7.865443229675293], [1436934574.106036, 165284, 7.910976886749268], [1436935054.150647, 175402, 7.925509929656982], [1436935533.819562, 185538, 7.866455078125], [1436936013.710422, 195712, 7.9123406410217285], [1436936493.609025, 205906, 7.748654842376709], [1436936973.683892, 216099, 7.849164009094238], [1436937454.138383, 226331, 7.784902572631836], [1436937933.838475, 236532, 7.749933242797852], [1436938413.89688, 246724, 7.777050971984863], [1436938894.018652, 256925, 7.663984775543213], [1436939373.69067, 267137, 7.602056980133057], [1436939853.673692, 277369, 7.539070129394531], [1436940333.651346, 287620, 7.575552463531494], [1436940813.599579, 297848, 7.47900390625], [1436941293.596313, 308088, 7.403858184814453], [1436941773.659172, 318362, 7.589539527893066], [1436942253.648479, 328621, 7.511919975280762], [1436942733.752284, 338892, 7.31054162979126], [1436943213.621881, 349144, 7.261094570159912], [1436943693.698743, 359399, 7.552957534790039], [1436944173.578463, 369649, 7.449452877044678], [1436944653.692217, 379912, 7.177209854125977], [1436945133.677298, 390180, 7.308793067932129], [1436945613.572411, 400445, 7.229344844818115], [1436946093.56123, 410703, 7.129981994628906], [1436946573.542364, 420958, 7.127549171447754], [1436947053.616578, 431216, 7.538583755493164], [1436947533.636973, 441483, 7.030594825744629], [1436948013.541574, 451751, 6.98097038269043], [1436948493.560223, 462015, 7.213271141052246], [1436948973.512541, 472260, 7.1727519035339355], [1436949453.550055, 482483, 6.985068321228027], [1436949933.828011, 492731, 7.051283836364746], [1436950413.603177, 502957, 7.082402229309082], [1436950893.563009, 513185, 7.1637864112854], [1436951373.620887, 523410, 7.193849086761475], [1436951853.61941, 533618, 7.1212921142578125], [1436952333.694447, 543828, 7.208009719848633], [1436952813.621004, 554042, 7.28671932220459], [1436953293.588156, 564251, 6.941026210784912], [1436953773.599734, 574464, 7.230144500732422], [1436954253.621309, 584672, 6.815900802612305], [1436954733.738119, 594882, 7.060589790344238], [1436955213.56617, 605091, 7.079995155334473], [1436955693.585366, 615296, 7.300849437713623], [1436956173.626395, 625501, 6.927395343780518], [1436956653.601937, 635705, 6.893837928771973], [1436957133.665878, 645915, 6.965301990509033], [1436957613.584762, 656116, 6.902514457702637], [1436958093.549783, 666331, 7.2444868087768555], [1436958573.646778, 676543, 6.784783840179443], [1436959053.585655, 686750, 6.800273418426514], [1436959533.679696, 696961, 6.743415355682373], [1436960013.633292, 707173, 7.012747764587402], [1436960493.578778, 717383, 6.548677921295166], [1436960973.596715, 727598, 6.638228416442871], [1436961453.625644, 737818, 6.884350776672363], [1436961933.740339, 748040, 6.797428607940674], [1436962413.573845, 758252, 6.815422058105469], [1436962893.610678, 768470, 6.7392377853393555], [1436963373.642878, 778674, 6.8375959396362305], [1436963853.558388, 788877, 6.7254252433776855], [1436964333.658419, 799099, 6.765130996704102], [1436964813.573319, 809289, 6.7060980796813965], [1436965293.542098, 819484, 6.63279390335083], [1436965773.545453, 829687, 6.587352752685547], [1436966253.586517, 839901, 6.4957275390625], [1436966733.639348, 850120, 6.765798091888428], [1436967213.697288, 860330, 6.681786060333252], [1436967693.617172, 870539, 6.696804523468018], [1436968173.593885, 880748, 6.571035385131836], [1436968653.560836, 890955, 6.29492712020874], [1436969133.676337, 901164, 6.679598331451416], [1436969613.506638, 911358, 6.548522472381592], [1436970093.595964, 921560, 6.585646629333496], [1436970573.541227, 931756, 6.589619159698486], [1436971053.624316, 941945, 6.333208084106445], [1436971533.655543, 952138, 6.582470417022705], [1436972013.604738, 962349, 6.289045810699463], [1436972493.613199, 972551, 6.360206127166748], [1436972973.501155, 982746, 6.567287921905518], [1436973453.64842, 992945, 6.246123313903809], [1436973933.689516, 1003147, 6.44004487991333], [1436974413.577769, 1013350, 6.315634727478027], [1436974893.542281, 1023545, 6.289544105529785], [1436975373.638453, 1033759, 6.412042140960693], [1436975853.524388, 1043955, 6.165371894836426], [1436976333.625792, 1054148, 6.403027534484863], [1436976813.610661, 1064342, 6.37597131729126], [1436977293.601581, 1074539, 6.336863994598389], [1436977773.575627, 1084733, 6.377552032470703], [1436978253.564972, 1094914, 6.28995943069458], [1436978733.673144, 1105109, 6.28420352935791], [1436979213.540585, 1115293, 6.277828216552734], [1436979693.699591, 1125483, 6.185207843780518], [1436980173.613012, 1135670, 6.186310768127441], [1436980653.575769, 1145862, 5.922095775604248], [1436981133.719264, 1156045, 6.141305923461914], [1436981613.563551, 1166236, 6.10508394241333], [1436982093.553233, 1176436, 5.967081069946289], [1436982573.577846, 1186636, 5.960882186889648], [1436983053.605749, 1196837, 6.2222185134887695], [1436983533.684994, 1207025, 6.051136493682861], [1436984013.561492, 1217233, 6.087917804718018], [1436984493.629873, 1227437, 5.95945405960083], [1436984973.606714, 1237643, 5.971570014953613], [1436985453.690084, 1247835, 5.969781398773193], [1436985933.711388, 1257951, 6.040994644165039], [1436986413.598807, 1268125, 6.142050743103027], [1436986893.631797, 1278290, 6.03120231628418], [1436987373.596962, 1288473, 5.921470642089844], [1436987853.555549, 1298650, 5.921937942504883], [1436988333.722032, 1308841, 6.050085067749023], [1436988813.55697, 1319018, 5.837893486022949], [1436989293.756905, 1329221, 5.927487850189209], [1436989773.665141, 1339417, 6.117348670959473], [1436990253.768302, 1349610, 6.052918434143066], [1436990733.708919, 1359759, 5.8977789878845215], [1436991213.663033, 1369914, 5.903198719024658], [1436991693.730925, 1380074, 5.85245418548584], [1436992173.751791, 1390224, 5.902153968811035], [1436992653.758682, 1400383, 5.822136878967285], [1436993133.835604, 1410542, 5.88037633895874], [1436993613.674655, 1420684, 5.778636932373047], [1436994093.747454, 1430832, 5.876591682434082], [1436994573.768973, 1440986, 6.196285724639893], [1436995053.666661, 1451174, 5.7718634605407715], [1436995533.83439, 1461345, 5.931266784667969], [1436996013.556996, 1471495, 5.9706597328186035], [1436996493.635477, 1481663, 5.589694023132324], [1436996973.668684, 1491822, 5.787637233734131], [1436997453.59326, 1501979, 5.634321689605713], [1436997933.774019, 1512139, 5.699962615966797], [1436998413.575162, 1522290, 5.807012557983398], [1436998893.640468, 1532431, 5.559602737426758], [1436999373.551661, 1542579, 5.918235778808594], [1436999853.57906, 1552734, 5.745569229125977], [1437000333.680409, 1562888, 5.59443473815918], [1437000813.602383, 1573037, 5.703190326690674], [1437001293.610337, 1583190, 5.468636512756348], [1437001773.618199, 1593341, 5.610755920410156], [1437002253.572966, 1603497, 5.4396867752075195], [1437002733.67994, 1613657, 5.7537946701049805], [1437003213.583266, 1623809, 5.7613725662231445], [1437003693.639943, 1633966, 5.439754009246826], [1437004173.568287, 1644113, 5.4889116287231445], [1437004653.610772, 1654268, 5.39843225479126], [1437005133.663045, 1664424, 5.576738357543945], [1437005613.580984, 1674567, 5.662004470825195], [1437006093.601019, 1684715, 5.3926777839660645], [1437006573.625314, 1694857, 5.464866638183594], [1437007053.584514, 1704999, 5.40261173248291], [1437007533.719303, 1715150, 5.23733377456665], [1437008013.604962, 1725282, 5.448479652404785], [1437008493.655091, 1735432, 5.684703826904297], [1437008973.640165, 1745584, 5.400024890899658], [1437009453.715067, 1755742, 5.378822326660156], [1437009933.765712, 1765896, 5.45297384262085], [1437010413.632128, 1776052, 5.248030185699463], [1437010893.66766, 1786195, 5.3377580642700195], [1437011373.636164, 1796346, 5.292956352233887], [1437011853.631224, 1806481, 5.438100814819336], [1437012333.706205, 1816617, 5.148743629455566], [1437012813.61987, 1826754, 5.319127559661865], [1437013293.479904, 1836883, 5.1646199226379395], [1437013773.604574, 1847029, 5.494720458984375], [1437014253.618884, 1857175, 5.17764949798584], [1437014733.756419, 1867312, 5.14331579208374], [1437015213.638607, 1877459, 5.309914588928223], [1437015693.625763, 1887608, 5.542352676391602], [1437016173.63194, 1897759, 5.075393199920654], [1437016653.609074, 1907909, 5.249225616455078], [1437017133.717601, 1918074, 5.392384052276611], [1437017613.716011, 1928220, 5.38590669631958], [1437018093.626005, 1938377, 5.229607105255127], [1437018573.626522, 1948523, 5.287610054016113], [1437019053.648174, 1958678, 5.2798333168029785], [1437019533.803011, 1968831, 5.151246070861816], [1437020013.667751, 1978978, 5.118294715881348], [1437020493.659028, 1989133, 5.327050685882568], [1437020973.657346, 1999287, 5.174264430999756], [1437021453.650634, 2009437, 5.1660661697387695], [1437021933.848661, 2019588, 5.089689254760742], [1437022413.674963, 2029736, 5.06661319732666], [1437022893.69086, 2039894, 5.031608581542969], [1437023373.68883, 2050054, 4.874476432800293], [1437023853.686116, 2060205, 5.107512474060059], [1437024333.763876, 2070362, 5.135380268096924], [1437024813.707845, 2080507, 5.087984561920166], [1437025293.483294, 2090645, 5.240448474884033], [1437025773.695712, 2100793, 4.930302619934082], [1437026253.672994, 2110943, 4.914392471313477], [1437026733.780775, 2121094, 5.182378768920898], [1437027213.617849, 2131235, 4.93843412399292], [1437027693.694451, 2141382, 4.924433708190918], [1437028173.68596, 2151537, 4.957921028137207], [1437028653.584833, 2161685, 5.040386199951172], [1437029133.792483, 2171839, 5.01956033706665], [1437029613.661672, 2181977, 4.987490177154541], [1437030093.641009, 2192118, 4.960195064544678], [1437030573.656274, 2202268, 5.0094523429870605], [1437031053.643631, 2212416, 4.83445930480957], [1437031533.777478, 2222583, 4.922268390655518], [1437032013.704008, 2232736, 5.113382339477539], [1437032493.638393, 2242882, 4.881488800048828], [1437032973.684986, 2253041, 4.953296661376953], [1437033453.699562, 2263183, 4.865671157836914], [1437033933.918074, 2273320, 4.829331874847412], [1437034413.596351, 2283443, 4.777036190032959], [1437034893.640496, 2293579, 4.864566326141357], [1437035373.637761, 2303701, 4.988693714141846], [1437035853.669947, 2313823, 5.016432285308838], [1437036333.78905, 2323961, 4.651939868927002], [1437036813.699727, 2334089, 4.767807960510254], [1437037293.662592, 2344235, 4.628738880157471], [1437037773.66716, 2354364, 4.929834842681885], [1437038253.603687, 2364507, 4.739555835723877], [1437038733.78864, 2374644, 4.821824073791504], [1437039213.641799, 2384782, 4.853730201721191], [1437039693.687078, 2394923, 4.581423759460449], [1437040173.635717, 2405058, 4.452754497528076], [1437040653.673331, 2415194, 4.837629318237305], [1437041133.764768, 2425322, 4.752482891082764], [1437041613.629279, 2435449, 4.730231761932373], [1437042093.703985, 2445575, 4.5618896484375], [1437042573.496029, 2455712, 4.673112869262695], [1437043053.686022, 2465844, 4.565918922424316], [1437043533.731929, 2475974, 4.7191481590271], [1437044013.636245, 2486095, 4.589008331298828], [1437044493.69923, 2496238, 4.599475383758545], [1437044973.652155, 2506373, 4.544175624847412], [1437045453.691467, 2516497, 4.4221673011779785], [1437045933.935804, 2526637, 4.44448709487915], [1437046413.635583, 2536770, 4.647110939025879], [1437046893.626337, 2546896, 4.768988609313965], [1437047373.67437, 2557029, 4.5318827629089355], [1437047853.652939, 2567169, 4.501277923583984], [1437048333.778436, 2577306, 4.6167216300964355], [1437048813.654248, 2587433, 4.66096305847168], [1437049293.610609, 2597552, 4.529193878173828], [1437049773.646573, 2607690, 4.455351829528809], [1437050253.667925, 2617808, 4.51211404800415], [1437050733.735291, 2627933, 4.803231716156006], [1437051213.620222, 2638053, 4.645476341247559], [1437051693.601978, 2648171, 4.419768810272217], [1437052173.634985, 2658299, 4.48175048828125], [1437052653.687176, 2668425, 4.397725582122803], [1437053133.762819, 2678556, 4.188413619995117], [1437053613.643698, 2688671, 4.291479110717773], [1437054093.673047, 2698804, 4.321218013763428], [1437054573.667371, 2708956, 4.311710834503174], [1437055053.650441, 2719087, 4.481810092926025], [1437055533.778469, 2729219, 4.452049255371094], [1437056013.694082, 2739343, 4.455989360809326], [1437056493.674871, 2749458, 4.415104866027832], [1437056973.700234, 2759575, 4.259828567504883], [1437057453.666129, 2769697, 4.510563373565674], [1437057933.848506, 2779821, 4.221935272216797], [1437058413.643799, 2789941, 4.437899112701416], [1437058893.715386, 2800076, 4.302872657775879], [1437059373.62596, 2810207, 4.228428363800049], [1437059853.650848, 2820334, 4.220061779022217], [1437060333.792248, 2830465, 4.138088703155518], [1437060813.682955, 2840600, 4.2196125984191895], [1437061293.681795, 2850745, 4.1594085693359375], [1437061773.691182, 2860880, 4.179514408111572], [1437062253.662987, 2871013, 4.202476978302002], [1437062733.760419, 2881153, 4.282044887542725], [1437063213.651969, 2891278, 4.200533866882324], [1437063693.723523, 2901406, 4.263350486755371], [1437064173.68663, 2911533, 4.378939628601074], [1437064653.547643, 2921667, 4.202810287475586], [1437065133.62645, 2931813, 4.193121910095215], [1437065613.566569, 2941947, 4.132870197296143], [1437066093.537804, 2952102, 4.35767936706543], [1437066573.529332, 2962243, 4.211732864379883], [1437067053.520098, 2972400, 4.020431041717529], [1437067533.605733, 2982561, 4.342063903808594], [1437068013.535467, 2992698, 4.197565078735352], [1437068493.559976, 3002839, 3.8806259632110596], [1437068973.558743, 3012983, 3.871702194213867], [1437069453.562661, 3023116, 4.064865589141846], [1437069933.627071, 3033256, 3.817744731903076], [1437070413.574131, 3043386, 4.106888294219971], [1437070893.658803, 3053528, 4.235474586486816], [1437071373.638711, 3063659, 4.127055644989014], [1437071853.621384, 3073794, 4.176018238067627], [1437072333.665269, 3083926, 4.048959732055664], [1437072813.584388, 3094040, 4.178991794586182], [1437073293.569178, 3104172, 3.8385396003723145]] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d1.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d1.json deleted file mode 100644 index 27ff64e5dd..0000000000 --- a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d1.json +++ /dev/null @@ -1 +0,0 @@ -[[1436925978.257845, 7, 1.009283951483666897], [1436926413.945391, 1476, 0.932567862421274185], [1436926893.945037, 6006, 0.02773338556289673], [1436927373.995472, 13786, 0.021291319280862808], [1436927853.989794, 23650, 0.515582754276692867], [1436928334.132361, 33755, 0.011689444072544575], [1436928813.973288, 43941, 0.009183925576508045], [1436929293.975949, 54146, 0.007850822061300278], [1436929773.992781, 64316, 0.007189035415649414], [1436930253.997415, 74465, 0.007230754010379314], [1436930734.203004, 84611, 0.007685001939535141], [1436931214.03644, 94700, 0.008264732547104359], [1436931694.094564, 104766, 0.008946491405367851], [1436932174.114955, 114817, 0.00966302677989006], [1436932654.161382, 124880, 0.010994276031851768], [1436933133.960214, 134977, 0.01196141354739666], [1436933614.044337, 145062, 0.012673594057559967], [1436934094.166206, 155169, 0.013639944605529308], [1436934574.106036, 165284, 0.014305333606898785], [1436935054.150647, 175402, 0.014946178533136845], [1436935533.819562, 185538, 0.015736915171146393], [1436936013.710422, 195712, 0.01633097417652607], [1436936493.609025, 205906, 0.01669587567448616], [1436936973.683892, 216099, 0.017459288239479065], [1436937454.138383, 226331, 0.018532060086727142], [1436937933.838475, 236532, 0.01949254982173443], [1436938413.89688, 246724, 0.01951725408434868], [1436938894.018652, 256925, 0.019763393327593803], [1436939373.69067, 267137, 0.02008610963821411], [1436939853.673692, 277369, 0.021090799942612648], [1436940333.651346, 287620, 0.021408839151263237], [1436940813.599579, 297848, 0.021988894790410995], [1436941293.596313, 308088, 0.02236073836684227], [1436941773.659172, 318362, 0.022547174245119095], [1436942253.648479, 328621, 0.02303086407482624], [1436942733.752284, 338892, 0.023787079378962517], [1436943213.621881, 349144, 0.024007514119148254], [1436943693.698743, 359399, 0.02414763905107975], [1436944173.578463, 369649, 0.024576496332883835], [1436944653.692217, 379912, 0.02469169721007347], [1436945133.677298, 390180, 0.024951916188001633], [1436945613.572411, 400445, 0.025548970326781273], [1436946093.56123, 410703, 0.025769377127289772], [1436946573.542364, 420958, 0.02602097950875759], [1436947053.616578, 431216, 0.026028109714388847], [1436947533.636973, 441483, 0.026348495855927467], [1436948013.541574, 451751, 0.02621930092573166], [1436948493.560223, 462015, 0.02671053633093834], [1436948973.512541, 472260, 0.0272178016602993], [1436949453.550055, 482483, 0.02734796144068241], [1436949933.828011, 492731, 0.027217809110879898], [1436950413.603177, 502957, 0.027318621054291725], [1436950893.563009, 513185, 0.027304155752062798], [1436951373.620887, 523410, 0.027759933844208717], [1436951853.61941, 533618, 0.028056234121322632], [1436952333.694447, 543828, 0.028620803728699684], [1436952813.621004, 554042, 0.028957637026906013], [1436953293.588156, 564251, 0.029187509790062904], [1436953773.599734, 574464, 0.028960268944501877], [1436954253.621309, 584672, 0.02891424670815468], [1436954733.738119, 594882, 0.029211293905973434], [1436955213.56617, 605091, 0.029444213956594467], [1436955693.585366, 615296, 0.02974688820540905], [1436956173.626395, 625501, 0.03026159666478634], [1436956653.601937, 635705, 0.03039497137069702], [1436957133.665878, 645915, 0.03041839227080345], [1436957613.584762, 656116, 0.030588043853640556], [1436958093.549783, 666331, 0.030284974724054337], [1436958573.646778, 676543, 0.030354496091604233], [1436959053.585655, 686750, 0.030551007017493248], [1436959533.679696, 696961, 0.03068561479449272], [1436960013.633292, 707173, 0.030921893194317818], [1436960493.578778, 717383, 0.031080031767487526], [1436960973.596715, 727598, 0.030773505568504333], [1436961453.625644, 737818, 0.03084484674036503], [1436961933.740339, 748040, 0.03110458515584469], [1436962413.573845, 758252, 0.03114113211631775], [1436962893.610678, 768470, 0.03101053647696972], [1436963373.642878, 778674, 0.03110116347670555], [1436963853.558388, 788877, 0.031342316418886185], [1436964333.658419, 799099, 0.03130127117037773], [1436964813.573319, 809289, 0.031288161873817444], [1436965293.542098, 819484, 0.031435444951057434], [1436965773.545453, 829687, 0.03166936710476875], [1436966253.586517, 839901, 0.03169429674744606], [1436966733.639348, 850120, 0.03191458433866501], [1436967213.697288, 860330, 0.03205746412277222], [1436967693.617172, 870539, 0.03206293657422066], [1436968173.593885, 880748, 0.031957853585481644], [1436968653.560836, 890955, 0.0316658616065979], [1436969133.676337, 901164, 0.031929533928632736], [1436969613.506638, 911358, 0.03174331784248352], [1436970093.595964, 921560, 0.03157960623502731], [1436970573.541227, 931756, 0.03176721930503845], [1436971053.624316, 941945, 0.031810544431209564], [1436971533.655543, 952138, 0.031946416944265366], [1436972013.604738, 962349, 0.03205405920743942], [1436972493.613199, 972551, 0.031924981623888016], [1436972973.501155, 982746, 0.03199697285890579], [1436973453.64842, 992945, 0.03204970061779022], [1436973933.689516, 1003147, 0.032020214945077896], [1436974413.577769, 1013350, 0.03207497298717499], [1436974893.542281, 1023545, 0.03221454098820686], [1436975373.638453, 1033759, 0.032191887497901917], [1436975853.524388, 1043955, 0.03240729123353958], [1436976333.625792, 1054148, 0.032219529151916504], [1436976813.610661, 1064342, 0.03200426697731018], [1436977293.601581, 1074539, 0.03198647499084473], [1436977773.575627, 1084733, 0.0320645235478878], [1436978253.564972, 1094914, 0.0322980061173439], [1436978733.673144, 1105109, 0.032482605427503586], [1436979213.540585, 1115293, 0.032628435641527176], [1436979693.699591, 1125483, 0.032744552940130234], [1436980173.613012, 1135670, 0.03268158435821533], [1436980653.575769, 1145862, 0.0324023962020874], [1436981133.719264, 1156045, 0.03237328305840492], [1436981613.563551, 1166236, 0.03202575817704201], [1436982093.553233, 1176436, 0.03216284513473511], [1436982573.577846, 1186636, 0.03232415020465851], [1436983053.605749, 1196837, 0.0324099175632], [1436983533.684994, 1207025, 0.03245137259364128], [1436984013.561492, 1217233, 0.032246463000774384], [1436984493.629873, 1227437, 0.032042667269706726], [1436984973.606714, 1237643, 0.0318642184138298], [1436985453.690084, 1247835, 0.03191140666604042], [1436985933.711388, 1257951, 0.032287366688251495], [1436986413.598807, 1268125, 0.03226638585329056], [1436986893.631797, 1278290, 0.03252791240811348], [1436987373.596962, 1288473, 0.03241675719618797], [1436987853.555549, 1298650, 0.032103829085826874], [1436988333.722032, 1308841, 0.031904906034469604], [1436988813.55697, 1319018, 0.03179024159908295], [1436989293.756905, 1329221, 0.03168707340955734], [1436989773.665141, 1339417, 0.03160175681114197], [1436990253.768302, 1349610, 0.03161788731813431], [1436990733.708919, 1359759, 0.031772397458553314], [1436991213.663033, 1369914, 0.031758904457092285], [1436991693.730925, 1380074, 0.031629469245672226], [1436992173.751791, 1390224, 0.03154703974723816], [1436992653.758682, 1400383, 0.031527940183877945], [1436993133.835604, 1410542, 0.03169580549001694], [1436993613.674655, 1420684, 0.03182605654001236], [1436994093.747454, 1430832, 0.03185024857521057], [1436994573.768973, 1440986, 0.03199737146496773], [1436995053.666661, 1451174, 0.03156095743179321], [1436995533.83439, 1461345, 0.03150693327188492], [1436996013.556996, 1471495, 0.031496383249759674], [1436996493.635477, 1481663, 0.0313432440161705], [1436996973.668684, 1491822, 0.031145794317126274], [1436997453.59326, 1501979, 0.03106667660176754], [1436997933.774019, 1512139, 0.03143244981765747], [1436998413.575162, 1522290, 0.03142988309264183], [1436998893.640468, 1532431, 0.03132546320557594], [1436999373.551661, 1542579, 0.03125471621751785], [1436999853.57906, 1552734, 0.03098788857460022], [1437000333.680409, 1562888, 0.0308846328407526], [1437000813.602383, 1573037, 0.03082612156867981], [1437001293.610337, 1583190, 0.030793681740760803], [1437001773.618199, 1593341, 0.03087364137172699], [1437002253.572966, 1603497, 0.030839646235108376], [1437002733.67994, 1613657, 0.030705047771334648], [1437003213.583266, 1623809, 0.03071814589202404], [1437003693.639943, 1633966, 0.0304812490940094], [1437004173.568287, 1644113, 0.03030412085354328], [1437004653.610772, 1654268, 0.03032425045967102], [1437005133.663045, 1664424, 0.030430471524596214], [1437005613.580984, 1674567, 0.03036225587129593], [1437006093.601019, 1684715, 0.03056645393371582], [1437006573.625314, 1694857, 0.03043070062994957], [1437007053.584514, 1704999, 0.030224520713090897], [1437007533.719303, 1715150, 0.03024231642484665], [1437008013.604962, 1725282, 0.03009769506752491], [1437008493.655091, 1735432, 0.030214866623282433], [1437008973.640165, 1745584, 0.030181538313627243], [1437009453.715067, 1755742, 0.03017231822013855], [1437009933.765712, 1765896, 0.030141284689307213], [1437010413.632128, 1776052, 0.030052203685045242], [1437010893.66766, 1786195, 0.030078601092100143], [1437011373.636164, 1796346, 0.029969291761517525], [1437011853.631224, 1806481, 0.02999536693096161], [1437012333.706205, 1816617, 0.030100464820861816], [1437012813.61987, 1826754, 0.03008824959397316], [1437013293.479904, 1836883, 0.029995709657669067], [1437013773.604574, 1847029, 0.02995096519589424], [1437014253.618884, 1857175, 0.02980179339647293], [1437014733.756419, 1867312, 0.029607007279992104], [1437015213.638607, 1877459, 0.02952035330235958], [1437015693.625763, 1887608, 0.02937002293765545], [1437016173.63194, 1897759, 0.029285306110978127], [1437016653.609074, 1907909, 0.029194746166467667], [1437017133.717601, 1918074, 0.029153630137443542], [1437017613.716011, 1928220, 0.029063496738672256], [1437018093.626005, 1938377, 0.028990253806114197], [1437018573.626522, 1948523, 0.0290801040828228], [1437019053.648174, 1958678, 0.029026925563812256], [1437019533.803011, 1968831, 0.029071522876620293], [1437020013.667751, 1978978, 0.02911040186882019], [1437020493.659028, 1989133, 0.02908971533179283], [1437020973.657346, 1999287, 0.028982823714613914], [1437021453.650634, 2009437, 0.028793631121516228], [1437021933.848661, 2019588, 0.02868799678981304], [1437022413.674963, 2029736, 0.028585929423570633], [1437022893.69086, 2039894, 0.028488371521234512], [1437023373.68883, 2050054, 0.028293771669268608], [1437023853.686116, 2060205, 0.028227869421243668], [1437024333.763876, 2070362, 0.0280953086912632], [1437024813.707845, 2080507, 0.02794187143445015], [1437025293.483294, 2090645, 0.0278786551207304], [1437025773.695712, 2100793, 0.02786232903599739], [1437026253.672994, 2110943, 0.02783624827861786], [1437026733.780775, 2121094, 0.027756746858358383], [1437027213.617849, 2131235, 0.027644069865345955], [1437027693.694451, 2141382, 0.02752004750072956], [1437028173.68596, 2151537, 0.0274327602237463], [1437028653.584833, 2161685, 0.027434347197413445], [1437029133.792483, 2171839, 0.02731819450855255], [1437029613.661672, 2181977, 0.027138520032167435], [1437030093.641009, 2192118, 0.027088932693004608], [1437030573.656274, 2202268, 0.02713087759912014], [1437031053.643631, 2212416, 0.027159670367836952], [1437031533.777478, 2222583, 0.027089878916740417], [1437032013.704008, 2232736, 0.026989545673131943], [1437032493.638393, 2242882, 0.02692277729511261], [1437032973.684986, 2253041, 0.026783647015690804], [1437033453.699562, 2263183, 0.026735099032521248], [1437033933.918074, 2273320, 0.02665248140692711], [1437034413.596351, 2283443, 0.02659791149199009], [1437034893.640496, 2293579, 0.026540575549006462], [1437035373.637761, 2303701, 0.02647154964506626], [1437035853.669947, 2313823, 0.02645135670900345], [1437036333.78905, 2323961, 0.026429900899529457], [1437036813.699727, 2334089, 0.026324935257434845], [1437037293.662592, 2344235, 0.026287639513611794], [1437037773.66716, 2354364, 0.02626391313970089], [1437038253.603687, 2364507, 0.026225272566080093], [1437038733.78864, 2374644, 0.026248561218380928], [1437039213.641799, 2384782, 0.026243599131703377], [1437039693.687078, 2394923, 0.026255469769239426], [1437040173.635717, 2405058, 0.026186810806393623], [1437040653.673331, 2415194, 0.02606010064482689], [1437041133.764768, 2425322, 0.026031550019979477], [1437041613.629279, 2435449, 0.02595149166882038], [1437042093.703985, 2445575, 0.025885630398988724], [1437042573.496029, 2455712, 0.025858554989099503], [1437043053.686022, 2465844, 0.0257696695625782], [1437043533.731929, 2475974, 0.02574242651462555], [1437044013.636245, 2486095, 0.025741754099726677], [1437044493.69923, 2496238, 0.02561314031481743], [1437044973.652155, 2506373, 0.02550213597714901], [1437045453.691467, 2516497, 0.025422468781471252], [1437045933.935804, 2526637, 0.025300107896327972], [1437046413.635583, 2536770, 0.02533198893070221], [1437046893.626337, 2546896, 0.025261884555220604], [1437047373.67437, 2557029, 0.025176096707582474], [1437047853.652939, 2567169, 0.025054505094885826], [1437048333.778436, 2577306, 0.024978378787636757], [1437048813.654248, 2587433, 0.024952610954642296], [1437049293.610609, 2597552, 0.02484666183590889], [1437049773.646573, 2607690, 0.024764036759734154], [1437050253.667925, 2617808, 0.024689028039574623], [1437050733.735291, 2627933, 0.024599267169833183], [1437051213.620222, 2638053, 0.024585112929344177], [1437051693.601978, 2648171, 0.024474989622831345], [1437052173.634985, 2658299, 0.024343013763427734], [1437052653.687176, 2668425, 0.024294432252645493], [1437053133.762819, 2678556, 0.024164099246263504], [1437053613.643698, 2688671, 0.024035055190324783], [1437054093.673047, 2698804, 0.024000361561775208], [1437054573.667371, 2708956, 0.023914529010653496], [1437055053.650441, 2719087, 0.023955287411808968], [1437055533.778469, 2729219, 0.023859601467847824], [1437056013.694082, 2739343, 0.023759596049785614], [1437056493.674871, 2749458, 0.02367720566689968], [1437056973.700234, 2759575, 0.023645451292395592], [1437057453.666129, 2769697, 0.023565715178847313], [1437057933.848506, 2779821, 0.023514313623309135], [1437058413.643799, 2789941, 0.023489659652113914], [1437058893.715386, 2800076, 0.023429812863469124], [1437059373.62596, 2810207, 0.023344023153185844], [1437059853.650848, 2820334, 0.023226741701364517], [1437060333.792248, 2830465, 0.023134270682930946], [1437060813.682955, 2840600, 0.02305578999221325], [1437061293.681795, 2850745, 0.02298513427376747], [1437061773.691182, 2860880, 0.022913720458745956], [1437062253.662987, 2871013, 0.022864067927002907], [1437062733.760419, 2881153, 0.02278953418135643], [1437063213.651969, 2891278, 0.02276339940726757], [1437063693.723523, 2901406, 0.022675812244415283], [1437064173.68663, 2911533, 0.022622767835855484], [1437064653.547643, 2921667, 0.02255198359489441], [1437065133.62645, 2931813, 0.022431762889027596], [1437065613.566569, 2941947, 0.022368362173438072], [1437066093.537804, 2952102, 0.022323831915855408], [1437066573.529332, 2962243, 0.02226843684911728], [1437067053.520098, 2972400, 0.022210361436009407], [1437067533.605733, 2982561, 0.022118505090475082], [1437068013.535467, 2992698, 0.022013112902641296], [1437068493.559976, 3002839, 0.02197197824716568], [1437068973.558743, 3012983, 0.02191166952252388], [1437069453.562661, 3023116, 0.021851476281881332], [1437069933.627071, 3033256, 0.021762533113360405], [1437070413.574131, 3043386, 0.021733969449996948], [1437070893.658803, 3053528, 0.021669406443834305], [1437071373.638711, 3063659, 0.02159426547586918], [1437071853.621384, 3073794, 0.02153114229440689], [1437072333.665269, 3083926, 0.021499117836356163], [1437072813.584388, 3094040, 0.021457014605402946], [1437073293.569178, 3104172, 0.021365314722061157]] diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d2.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d2.json deleted file mode 100644 index fb5a18d53a..0000000000 --- a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d2.json +++ /dev/null @@ -1 +0,0 @@ -[[1436925978.257845, 7, 0.01034154836088419], [1436926413.945391, 1476, 0.03646053001284599], [1436926893.945037, 6006, 0.031110260635614395], [1436927373.995472, 13786, 0.024214591830968857], [1436927853.989794, 23650, 0.01820789836347103], [1436928334.132361, 33755, 0.01442798599600792], [1436928813.973288, 43941, 0.012150184251368046], [1436929293.975949, 54146, 0.011141776107251644], [1436929773.992781, 64316, 0.010859030298888683], [1436930253.997415, 74465, 0.011160558089613914], [1436930734.203004, 84611, 0.011997541412711143], [1436931214.03644, 94700, 0.01278648804873228], [1436931694.094564, 104766, 0.014073861762881279], [1436932174.114955, 114817, 0.01523376815021038], [1436932654.161382, 124880, 0.016527879983186722], [1436933133.960214, 134977, 0.01782997138798237], [1436933614.044337, 145062, 0.019055265933275223], [1436934094.166206, 155169, 0.02028629370033741], [1436934574.106036, 165284, 0.02116803079843521], [1436935054.150647, 175402, 0.022192901000380516], [1436935533.819562, 185538, 0.022869590669870377], [1436936013.710422, 195712, 0.023398980498313904], [1436936493.609025, 205906, 0.02443159930408001], [1436936973.683892, 216099, 0.025154944509267807], [1436937454.138383, 226331, 0.025802481919527054], [1436937933.838475, 236532, 0.027000702917575836], [1436938413.89688, 246724, 0.02752412110567093], [1436938894.018652, 256925, 0.0278119258582592], [1436939373.69067, 267137, 0.027698883786797523], [1436939853.673692, 277369, 0.028744956478476524], [1436940333.651346, 287620, 0.029281964525580406], [1436940813.599579, 297848, 0.03002205118536949], [1436941293.596313, 308088, 0.030467400327324867], [1436941773.659172, 318362, 0.03132195770740509], [1436942253.648479, 328621, 0.031431782990694046], [1436942733.752284, 338892, 0.03147844970226288], [1436943213.621881, 349144, 0.032013144344091415], [1436943693.698743, 359399, 0.03241390734910965], [1436944173.578463, 369649, 0.03261363133788109], [1436944653.692217, 379912, 0.033306822180747986], [1436945133.677298, 390180, 0.03390969708561897], [1436945613.572411, 400445, 0.03396527096629143], [1436946093.56123, 410703, 0.03388286381959915], [1436946573.542364, 420958, 0.03399669751524925], [1436947053.616578, 431216, 0.03394070267677307], [1436947533.636973, 441483, 0.03419327735900879], [1436948013.541574, 451751, 0.0342416949570179], [1436948493.560223, 462015, 0.034808479249477386], [1436948973.512541, 472260, 0.03552314639091492], [1436949453.550055, 482483, 0.036012329161167145], [1436949933.828011, 492731, 0.035826291888952255], [1436950413.603177, 502957, 0.03600003197789192], [1436950893.563009, 513185, 0.03563224524259567], [1436951373.620887, 523410, 0.03584449738264084], [1436951853.61941, 533618, 0.03587675839662552], [1436952333.694447, 543828, 0.036698292940855026], [1436952813.621004, 554042, 0.03698749095201492], [1436953293.588156, 564251, 0.03712376952171326], [1436953773.599734, 574464, 0.03729996830224991], [1436954253.621309, 584672, 0.03730553761124611], [1436954733.738119, 594882, 0.037479378283023834], [1436955213.56617, 605091, 0.03754287213087082], [1436955693.585366, 615296, 0.0377657376229763], [1436956173.626395, 625501, 0.038117796182632446], [1436956653.601937, 635705, 0.03822959586977959], [1436957133.665878, 645915, 0.03776161000132561], [1436957613.584762, 656116, 0.03816362842917442], [1436958093.549783, 666331, 0.03853853791952133], [1436958573.646778, 676543, 0.03826189786195755], [1436959053.585655, 686750, 0.0381099209189415], [1436959533.679696, 696961, 0.03844142332673073], [1436960013.633292, 707173, 0.03868117928504944], [1436960493.578778, 717383, 0.0390009842813015], [1436960973.596715, 727598, 0.0383562371134758], [1436961453.625644, 737818, 0.0382055900990963], [1436961933.740339, 748040, 0.03806299716234207], [1436962413.573845, 758252, 0.03807120397686958], [1436962893.610678, 768470, 0.03795558586716652], [1436963373.642878, 778674, 0.038018494844436646], [1436963853.558388, 788877, 0.038447774946689606], [1436964333.658419, 799099, 0.03842216357588768], [1436964813.573319, 809289, 0.03840547427535057], [1436965293.542098, 819484, 0.038492728024721146], [1436965773.545453, 829687, 0.0387515053153038], [1436966253.586517, 839901, 0.03869732841849327], [1436966733.639348, 850120, 0.03907460719347], [1436967213.697288, 860330, 0.0395859070122242], [1436967693.617172, 870539, 0.039280518889427185], [1436968173.593885, 880748, 0.0392826572060585], [1436968653.560836, 890955, 0.03899630531668663], [1436969133.676337, 901164, 0.03888440132141113], [1436969613.506638, 911358, 0.038790252059698105], [1436970093.595964, 921560, 0.03851785138249397], [1436970573.541227, 931756, 0.03913348540663719], [1436971053.624316, 941945, 0.038978900760412216], [1436971533.655543, 952138, 0.03925086557865143], [1436972013.604738, 962349, 0.039124101400375366], [1436972493.613199, 972551, 0.0390220545232296], [1436972973.501155, 982746, 0.039025235921144485], [1436973453.64842, 992945, 0.03877083212137222], [1436973933.689516, 1003147, 0.03902769833803177], [1436974413.577769, 1013350, 0.038719139993190765], [1436974893.542281, 1023545, 0.03872331231832504], [1436975373.638453, 1033759, 0.03927341103553772], [1436975853.524388, 1043955, 0.03930830955505371], [1436976333.625792, 1054148, 0.039153918623924255], [1436976813.610661, 1064342, 0.03932590410113335], [1436977293.601581, 1074539, 0.03922765702009201], [1436977773.575627, 1084733, 0.039390794932842255], [1436978253.564972, 1094914, 0.03935663774609566], [1436978733.673144, 1105109, 0.03939087316393852], [1436979213.540585, 1115293, 0.039371199905872345], [1436979693.699591, 1125483, 0.03982992097735405], [1436980173.613012, 1135670, 0.03941287472844124], [1436980653.575769, 1145862, 0.03933672979474068], [1436981133.719264, 1156045, 0.03919614478945732], [1436981613.563551, 1166236, 0.03906407952308655], [1436982093.553233, 1176436, 0.038837045431137085], [1436982573.577846, 1186636, 0.039009105414152145], [1436983053.605749, 1196837, 0.039010051637887955], [1436983533.684994, 1207025, 0.03891472890973091], [1436984013.561492, 1217233, 0.038610219955444336], [1436984493.629873, 1227437, 0.03866511583328247], [1436984973.606714, 1237643, 0.03865685313940048], [1436985453.690084, 1247835, 0.038945719599723816], [1436985933.711388, 1257951, 0.03925580158829689], [1436986413.598807, 1268125, 0.039332933723926544], [1436986893.631797, 1278290, 0.03918297216296196], [1436987373.596962, 1288473, 0.03883613646030426], [1436987853.555549, 1298650, 0.038776978850364685], [1436988333.722032, 1308841, 0.03888171166181564], [1436988813.55697, 1319018, 0.038825325667858124], [1436989293.756905, 1329221, 0.03864298388361931], [1436989773.665141, 1339417, 0.03865634649991989], [1436990253.768302, 1349610, 0.03898858651518822], [1436990733.708919, 1359759, 0.03906260430812836], [1436991213.663033, 1369914, 0.03911694139242172], [1436991693.730925, 1380074, 0.03875250369310379], [1436992173.751791, 1390224, 0.03882621228694916], [1436992653.758682, 1400383, 0.03877855837345123], [1436993133.835604, 1410542, 0.03870398923754692], [1436993613.674655, 1420684, 0.03887751325964928], [1436994093.747454, 1430832, 0.03915301710367203], [1436994573.768973, 1440986, 0.03938450664281845], [1436995053.666661, 1451174, 0.03919720649719238], [1436995533.83439, 1461345, 0.038862887769937515], [1436996013.556996, 1471495, 0.03901274502277374], [1436996493.635477, 1481663, 0.0388539656996727], [1436996973.668684, 1491822, 0.038732752203941345], [1436997453.59326, 1501979, 0.03879735246300697], [1436997933.774019, 1512139, 0.038524042814970016], [1436998413.575162, 1522290, 0.03869651257991791], [1436998893.640468, 1532431, 0.0383637398481369], [1436999373.551661, 1542579, 0.038300249725580215], [1436999853.57906, 1552734, 0.03799160569906235], [1437000333.680409, 1562888, 0.03759683296084404], [1437000813.602383, 1573037, 0.037678662687540054], [1437001293.610337, 1583190, 0.037575822323560715], [1437001773.618199, 1593341, 0.0376887246966362], [1437002253.572966, 1603497, 0.037922415882349014], [1437002733.67994, 1613657, 0.03766244649887085], [1437003213.583266, 1623809, 0.03754705190658569], [1437003693.639943, 1633966, 0.03738937899470329], [1437004173.568287, 1644113, 0.037347543984651566], [1437004653.610772, 1654268, 0.037374842911958694], [1437005133.663045, 1664424, 0.037443988025188446], [1437005613.580984, 1674567, 0.037457264959812164], [1437006093.601019, 1684715, 0.037874478846788406], [1437006573.625314, 1694857, 0.037644676864147186], [1437007053.584514, 1704999, 0.03743988648056984], [1437007533.719303, 1715150, 0.03739031031727791], [1437008013.604962, 1725282, 0.037301771342754364], [1437008493.655091, 1735432, 0.03735104575753212], [1437008973.640165, 1745584, 0.037282250821590424], [1437009453.715067, 1755742, 0.03729768097400665], [1437009933.765712, 1765896, 0.03717759624123573], [1437010413.632128, 1776052, 0.03691410645842552], [1437010893.66766, 1786195, 0.036807890981435776], [1437011373.636164, 1796346, 0.036659423261880875], [1437011853.631224, 1806481, 0.03682238608598709], [1437012333.706205, 1816617, 0.036776404827833176], [1437012813.61987, 1826754, 0.036672260612249374], [1437013293.479904, 1836883, 0.03666841238737106], [1437013773.604574, 1847029, 0.036642514169216156], [1437014253.618884, 1857175, 0.03654393553733826], [1437014733.756419, 1867312, 0.03638240322470665], [1437015213.638607, 1877459, 0.03610989451408386], [1437015693.625763, 1887608, 0.036011870950460434], [1437016173.63194, 1897759, 0.03607400134205818], [1437016653.609074, 1907909, 0.03581620752811432], [1437017133.717601, 1918074, 0.035680998116731644], [1437017613.716011, 1928220, 0.03547567501664162], [1437018093.626005, 1938377, 0.035375215113162994], [1437018573.626522, 1948523, 0.03534447029232979], [1437019053.648174, 1958678, 0.03535373508930206], [1437019533.803011, 1968831, 0.03541970252990723], [1437020013.667751, 1978978, 0.03534942492842674], [1437020493.659028, 1989133, 0.035337116569280624], [1437020973.657346, 1999287, 0.03519223630428314], [1437021453.650634, 2009437, 0.0350094810128212], [1437021933.848661, 2019588, 0.03481736779212952], [1437022413.674963, 2029736, 0.03482922539114952], [1437022893.69086, 2039894, 0.03482965752482414], [1437023373.68883, 2050054, 0.034710027277469635], [1437023853.686116, 2060205, 0.03447446599602699], [1437024333.763876, 2070362, 0.034356746822595596], [1437024813.707845, 2080507, 0.03430519998073578], [1437025293.483294, 2090645, 0.03412580490112305], [1437025773.695712, 2100793, 0.03409077599644661], [1437026253.672994, 2110943, 0.0340830534696579], [1437026733.780775, 2121094, 0.03400549292564392], [1437027213.617849, 2131235, 0.033846043050289154], [1437027693.694451, 2141382, 0.03379584103822708], [1437028173.68596, 2151537, 0.033618565648794174], [1437028653.584833, 2161685, 0.03352222591638565], [1437029133.792483, 2171839, 0.03338197246193886], [1437029613.661672, 2181977, 0.03323192894458771], [1437030093.641009, 2192118, 0.03313163295388222], [1437030573.656274, 2202268, 0.0331595316529274], [1437031053.643631, 2212416, 0.03310840204358101], [1437031533.777478, 2222583, 0.03298124670982361], [1437032013.704008, 2232736, 0.03288085386157036], [1437032493.638393, 2242882, 0.03281677886843681], [1437032973.684986, 2253041, 0.03261971473693848], [1437033453.699562, 2263183, 0.03251069411635399], [1437033933.918074, 2273320, 0.03243493288755417], [1437034413.596351, 2283443, 0.03251812607049942], [1437034893.640496, 2293579, 0.03244208171963692], [1437035373.637761, 2303701, 0.03246922418475151], [1437035853.669947, 2313823, 0.032652080059051514], [1437036333.78905, 2323961, 0.032621122896671295], [1437036813.699727, 2334089, 0.03248974680900574], [1437037293.662592, 2344235, 0.032404426485300064], [1437037773.66716, 2354364, 0.03240393102169037], [1437038253.603687, 2364507, 0.03238365799188614], [1437038733.78864, 2374644, 0.03244389593601227], [1437039213.641799, 2384782, 0.03239350765943527], [1437039693.687078, 2394923, 0.032426562160253525], [1437040173.635717, 2405058, 0.032403264194726944], [1437040653.673331, 2415194, 0.03231978043913841], [1437041133.764768, 2425322, 0.03223187103867531], [1437041613.629279, 2435449, 0.03213196247816086], [1437042093.703985, 2445575, 0.032153598964214325], [1437042573.496029, 2455712, 0.03199320286512375], [1437043053.686022, 2465844, 0.03188605234026909], [1437043533.731929, 2475974, 0.03178738057613373], [1437044013.636245, 2486095, 0.03171614184975624], [1437044493.69923, 2496238, 0.031645938754081726], [1437044973.652155, 2506373, 0.03155189007520676], [1437045453.691467, 2516497, 0.03144536912441254], [1437045933.935804, 2526637, 0.031432293355464935], [1437046413.635583, 2536770, 0.03129834309220314], [1437046893.626337, 2546896, 0.031195342540740967], [1437047373.67437, 2557029, 0.031033318489789963], [1437047853.652939, 2567169, 0.030938012525439262], [1437048333.778436, 2577306, 0.030827201902866364], [1437048813.654248, 2587433, 0.03068169392645359], [1437049293.610609, 2597552, 0.030520914122462273], [1437049773.646573, 2607690, 0.030437452718615532], [1437050253.667925, 2617808, 0.03041636385023594], [1437050733.735291, 2627933, 0.030291059985756874], [1437051213.620222, 2638053, 0.030283397063612938], [1437051693.601978, 2648171, 0.030193043872714043], [1437052173.634985, 2658299, 0.03004123829305172], [1437052653.687176, 2668425, 0.0299222432076931], [1437053133.762819, 2678556, 0.029762346297502518], [1437053613.643698, 2688671, 0.02970775216817856], [1437054093.673047, 2698804, 0.029604140669107437], [1437054573.667371, 2708956, 0.02949359640479088], [1437055053.650441, 2719087, 0.02943229116499424], [1437055533.778469, 2729219, 0.029304414987564087], [1437056013.694082, 2739343, 0.029147598892450333], [1437056493.674871, 2749458, 0.029033908620476723], [1437056973.700234, 2759575, 0.028886595740914345], [1437057453.666129, 2769697, 0.028734514489769936], [1437057933.848506, 2779821, 0.02874554693698883], [1437058413.643799, 2789941, 0.028716085478663445], [1437058893.715386, 2800076, 0.028669510036706924], [1437059373.62596, 2810207, 0.028530430048704147], [1437059853.650848, 2820334, 0.02839958481490612], [1437060333.792248, 2830465, 0.028364405035972595], [1437060813.682955, 2840600, 0.0282796248793602], [1437061293.681795, 2850745, 0.02820495329797268], [1437061773.691182, 2860880, 0.028159918263554573], [1437062253.662987, 2871013, 0.028104742988944054], [1437062733.760419, 2881153, 0.028099438175559044], [1437063213.651969, 2891278, 0.02802356891334057], [1437063693.723523, 2901406, 0.027945902198553085], [1437064173.68663, 2911533, 0.027897505089640617], [1437064653.547643, 2921667, 0.027821676805615425], [1437065133.62645, 2931813, 0.02770490199327469], [1437065613.566569, 2941947, 0.02761264331638813], [1437066093.537804, 2952102, 0.027557073161005974], [1437066573.529332, 2962243, 0.027522796764969826], [1437067053.520098, 2972400, 0.027469975873827934], [1437067533.605733, 2982561, 0.027299631386995316], [1437068013.535467, 2992698, 0.027225365862250328], [1437068493.559976, 3002839, 0.027095869183540344], [1437068973.558743, 3012983, 0.027036350220441818], [1437069453.562661, 3023116, 0.02693818509578705], [1437069933.627071, 3033256, 0.02687198854982853], [1437070413.574131, 3043386, 0.02687297947704792], [1437070893.658803, 3053528, 0.026770537719130516], [1437071373.638711, 3063659, 0.026667704805731773], [1437071853.621384, 3073794, 0.026571234688162804], [1437072333.665269, 3083926, 0.026447603479027748], [1437072813.584388, 3094040, 0.026389220729470253], [1437073293.569178, 3104172, 0.026299258694052696]] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d3.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d3.json deleted file mode 100644 index e489130ea7..0000000000 --- a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d3.json +++ /dev/null @@ -1 +0,0 @@ -[[1436925978.257845, 7, 0.03425809368491173], [1436926413.945391, 1476, 0.032557398080825806], [1436926893.945037, 6006, 0.0277252234518528], [1436927373.995472, 13786, 0.021282576024532318], [1436927853.989794, 23650, 0.015578101389110088], [1436928334.132361, 33755, 0.011687012389302254], [1436928813.973288, 43941, 0.00918175745755434], [1436929293.975949, 54146, 0.00784988235682249], [1436929773.992781, 64316, 0.007188988849520683], [1436930253.997415, 74465, 0.0072308750823140144], [1436930734.203004, 84611, 0.007685060612857342], [1436931214.03644, 94700, 0.008267422206699848], [1436931694.094564, 104766, 0.008946981281042099], [1436932174.114955, 114817, 0.009664506651461124], [1436932654.161382, 124880, 0.010994983837008476], [1436933133.960214, 134977, 0.011961394920945168], [1436933614.044337, 145062, 0.012674711644649506], [1436934094.166206, 155169, 0.013640021905303001], [1436934574.106036, 165284, 0.014305224642157555], [1436935054.150647, 175402, 0.014946703799068928], [1436935533.819562, 185538, 0.015737954527139664], [1436936013.710422, 195712, 0.016330912709236145], [1436936493.609025, 205906, 0.016695979982614517], [1436936973.683892, 216099, 0.017458846792578697], [1436937454.138383, 226331, 0.018533164635300636], [1436937933.838475, 236532, 0.01949200965464115], [1436938413.89688, 246724, 0.019517479464411736], [1436938894.018652, 256925, 0.019764307886362076], [1436939373.69067, 267137, 0.02008572220802307], [1436939853.673692, 277369, 0.021091068163514137], [1436940333.651346, 287620, 0.02140945754945278], [1436940813.599579, 297848, 0.021988170221447945], [1436941293.596313, 308088, 0.0223606675863266], [1436941773.659172, 318362, 0.022547796368598938], [1436942253.648479, 328621, 0.023031413555145264], [1436942733.752284, 338892, 0.023786410689353943], [1436943213.621881, 349144, 0.024008480831980705], [1436943693.698743, 359399, 0.024148935452103615], [1436944173.578463, 369649, 0.02457556128501892], [1436944653.692217, 379912, 0.02469060942530632], [1436945133.677298, 390180, 0.024952523410320282], [1436945613.572411, 400445, 0.02554873190820217], [1436946093.56123, 410703, 0.025771528482437134], [1436946573.542364, 420958, 0.02602078951895237], [1436947053.616578, 431216, 0.02602880820631981], [1436947533.636973, 441483, 0.026351822540163994], [1436948013.541574, 451751, 0.0262188371270895], [1436948493.560223, 462015, 0.026711203157901764], [1436948973.512541, 472260, 0.027218565344810486], [1436949453.550055, 482483, 0.02734719216823578], [1436949933.828011, 492731, 0.027217986062169075], [1436950413.603177, 502957, 0.027318857610225677], [1436950893.563009, 513185, 0.027305351570248604], [1436951373.620887, 523410, 0.027760380879044533], [1436951853.61941, 533618, 0.0280567966401577], [1436952333.694447, 543828, 0.028621215373277664], [1436952813.621004, 554042, 0.028958816081285477], [1436953293.588156, 564251, 0.029186993837356567], [1436953773.599734, 574464, 0.028960207477211952], [1436954253.621309, 584672, 0.028913332149386406], [1436954733.738119, 594882, 0.02921229600906372], [1436955213.56617, 605091, 0.029444556683301926], [1436955693.585366, 615296, 0.029747728258371353], [1436956173.626395, 625501, 0.030260732397437096], [1436956653.601937, 635705, 0.030394721776247025], [1436957133.665878, 645915, 0.03041674755513668], [1436957613.584762, 656116, 0.03058660589158535], [1436958093.549783, 666331, 0.030284838750958443], [1436958573.646778, 676543, 0.030354052782058716], [1436959053.585655, 686750, 0.030551131814718246], [1436959533.679696, 696961, 0.030686482787132263], [1436960013.633292, 707173, 0.030921922996640205], [1436960493.578778, 717383, 0.031079748645424843], [1436960973.596715, 727598, 0.03077232837677002], [1436961453.625644, 737818, 0.03084420971572399], [1436961933.740339, 748040, 0.03110562451183796], [1436962413.573845, 758252, 0.031141508370637894], [1436962893.610678, 768470, 0.031010067090392113], [1436963373.642878, 778674, 0.031100917607545853], [1436963853.558388, 788877, 0.03134296461939812], [1436964333.658419, 799099, 0.031301673501729965], [1436964813.573319, 809289, 0.031290579587221146], [1436965293.542098, 819484, 0.031435515731573105], [1436965773.545453, 829687, 0.031667787581682205], [1436966253.586517, 839901, 0.03169453889131546], [1436966733.639348, 850120, 0.03191617131233215], [1436967213.697288, 860330, 0.03205711767077446], [1436967693.617172, 870539, 0.03206227719783783], [1436968173.593885, 880748, 0.03195691108703613], [1436968653.560836, 890955, 0.03166574612259865], [1436969133.676337, 901164, 0.031929291784763336], [1436969613.506638, 911358, 0.031744007021188736], [1436970093.595964, 921560, 0.0315803587436676], [1436970573.541227, 931756, 0.031766779720783234], [1436971053.624316, 941945, 0.03181062266230583], [1436971533.655543, 952138, 0.0319465771317482], [1436972013.604738, 962349, 0.032054755836725235], [1436972493.613199, 972551, 0.03192495182156563], [1436972973.501155, 982746, 0.0319976881146431], [1436973453.64842, 992945, 0.03205036744475365], [1436973933.689516, 1003147, 0.032020118087530136], [1436974413.577769, 1013350, 0.03207429125905037], [1436974893.542281, 1023545, 0.032214779406785965], [1436975373.638453, 1033759, 0.03219134360551834], [1436975853.524388, 1043955, 0.0324082113802433], [1436976333.625792, 1054148, 0.03221917897462845], [1436976813.610661, 1064342, 0.03200480341911316], [1436977293.601581, 1074539, 0.03198748826980591], [1436977773.575627, 1084733, 0.032064300030469894], [1436978253.564972, 1094914, 0.032298240810632706], [1436978733.673144, 1105109, 0.03248215466737747], [1436979213.540585, 1115293, 0.03262820467352867], [1436979693.699591, 1125483, 0.032745134085416794], [1436980173.613012, 1135670, 0.032681502401828766], [1436980653.575769, 1145862, 0.03240214288234711], [1436981133.719264, 1156045, 0.03237201273441315], [1436981613.563551, 1166236, 0.03202598914504051], [1436982093.553233, 1176436, 0.032163310796022415], [1436982573.577846, 1186636, 0.03232435882091522], [1436983053.605749, 1196837, 0.032410554587841034], [1436983533.684994, 1207025, 0.03245232254266739], [1436984013.561492, 1217233, 0.03224659338593483], [1436984493.629873, 1227437, 0.03204221650958061], [1436984973.606714, 1237643, 0.03186390548944473], [1436985453.690084, 1247835, 0.031911786645650864], [1436985933.711388, 1257951, 0.032286882400512695], [1436986413.598807, 1268125, 0.032266560941934586], [1436986893.631797, 1278290, 0.03252791985869408], [1436987373.596962, 1288473, 0.03241678699851036], [1436987853.555549, 1298650, 0.03210347890853882], [1436988333.722032, 1308841, 0.031904902309179306], [1436988813.55697, 1319018, 0.03179018944501877], [1436989293.756905, 1329221, 0.0316874124109745], [1436989773.665141, 1339417, 0.03160090371966362], [1436990253.768302, 1349610, 0.03161816671490669], [1436990733.708919, 1359759, 0.0317724235355854], [1436991213.663033, 1369914, 0.03175821527838707], [1436991693.730925, 1380074, 0.031629402190446854], [1436992173.751791, 1390224, 0.031547073274850845], [1436992653.758682, 1400383, 0.031528495252132416], [1436993133.835604, 1410542, 0.03169562667608261], [1436993613.674655, 1420684, 0.031826674938201904], [1436994093.747454, 1430832, 0.03185039013624191], [1436994573.768973, 1440986, 0.03199826925992966], [1436995053.666661, 1451174, 0.03156091645359993], [1436995533.83439, 1461345, 0.031506411731243134], [1436996013.556996, 1471495, 0.031495608389377594], [1436996493.635477, 1481663, 0.03134337440133095], [1436996973.668684, 1491822, 0.031145554035902023], [1436997453.59326, 1501979, 0.031068041920661926], [1436997933.774019, 1512139, 0.031432390213012695], [1436998413.575162, 1522290, 0.03142932057380676], [1436998893.640468, 1532431, 0.03132513165473938], [1436999373.551661, 1542579, 0.03125539794564247], [1436999853.57906, 1552734, 0.0309873279184103], [1437000333.680409, 1562888, 0.03088490664958954], [1437000813.602383, 1573037, 0.0308260228484869], [1437001293.610337, 1583190, 0.030793415382504463], [1437001773.618199, 1593341, 0.03087344579398632], [1437002253.572966, 1603497, 0.0308389812707901], [1437002733.67994, 1613657, 0.03070608340203762], [1437003213.583266, 1623809, 0.0307186096906662], [1437003693.639943, 1633966, 0.03048117645084858], [1437004173.568287, 1644113, 0.03030446544289589], [1437004653.610772, 1654268, 0.030324051156640053], [1437005133.663045, 1664424, 0.03043009154498577], [1437005613.580984, 1674567, 0.030361991375684738], [1437006093.601019, 1684715, 0.030566193163394928], [1437006573.625314, 1694857, 0.030430208891630173], [1437007053.584514, 1704999, 0.030224468559026718], [1437007533.719303, 1715150, 0.030241932719945908], [1437008013.604962, 1725282, 0.030097855255007744], [1437008493.655091, 1735432, 0.030217904597520828], [1437008973.640165, 1745584, 0.030181601643562317], [1437009453.715067, 1755742, 0.030172593891620636], [1437009933.765712, 1765896, 0.030141659080982208], [1437010413.632128, 1776052, 0.030052196234464645], [1437010893.66766, 1786195, 0.03007938154041767], [1437011373.636164, 1796346, 0.02996920794248581], [1437011853.631224, 1806481, 0.029995175078511238], [1437012333.706205, 1816617, 0.03010040894150734], [1437012813.61987, 1826754, 0.030088385567069054], [1437013293.479904, 1836883, 0.029996229335665703], [1437013773.604574, 1847029, 0.029950618743896484], [1437014253.618884, 1857175, 0.029801754280924797], [1437014733.756419, 1867312, 0.029606210067868233], [1437015213.638607, 1877459, 0.029520301148295403], [1437015693.625763, 1887608, 0.02937021106481552], [1437016173.63194, 1897759, 0.02928493171930313], [1437016653.609074, 1907909, 0.029194936156272888], [1437017133.717601, 1918074, 0.029153617098927498], [1437017613.716011, 1928220, 0.029063349589705467], [1437018093.626005, 1938377, 0.02899051643908024], [1437018573.626522, 1948523, 0.02908063493669033], [1437019053.648174, 1958678, 0.029026903212070465], [1437019533.803011, 1968831, 0.029071694239974022], [1437020013.667751, 1978978, 0.029110101982951164], [1437020493.659028, 1989133, 0.02908976934850216], [1437020973.657346, 1999287, 0.028982611373066902], [1437021453.650634, 2009437, 0.028793690726161003], [1437021933.848661, 2019588, 0.02868787571787834], [1437022413.674963, 2029736, 0.028585631400346756], [1437022893.69086, 2039894, 0.02848806604743004], [1437023373.68883, 2050054, 0.028294002637267113], [1437023853.686116, 2060205, 0.02822807803750038], [1437024333.763876, 2070362, 0.02809525839984417], [1437024813.707845, 2080507, 0.027941878885030746], [1437025293.483294, 2090645, 0.02787884697318077], [1437025773.695712, 2100793, 0.027862509712576866], [1437026253.672994, 2110943, 0.027835993096232414], [1437026733.780775, 2121094, 0.027756690979003906], [1437027213.617849, 2131235, 0.027644263580441475], [1437027693.694451, 2141382, 0.02752007730305195], [1437028173.68596, 2151537, 0.027432529255747795], [1437028653.584833, 2161685, 0.027434471994638443], [1437029133.792483, 2171839, 0.027317894622683525], [1437029613.661672, 2181977, 0.027138294652104378], [1437030093.641009, 2192118, 0.027088705450296402], [1437030573.656274, 2202268, 0.027131302282214165], [1437031053.643631, 2212416, 0.02715957537293434], [1437031533.777478, 2222583, 0.027089620009064674], [1437032013.704008, 2232736, 0.026989320293068886], [1437032493.638393, 2242882, 0.026922713965177536], [1437032973.684986, 2253041, 0.02678370475769043], [1437033453.699562, 2263183, 0.0267350971698761], [1437033933.918074, 2273320, 0.026652036234736443], [1437034413.596351, 2283443, 0.0265977680683136], [1437034893.640496, 2293579, 0.02654072269797325], [1437035373.637761, 2303701, 0.026471523568034172], [1437035853.669947, 2313823, 0.026451298967003822], [1437036333.78905, 2323961, 0.026429779827594757], [1437036813.699727, 2334089, 0.026324886828660965], [1437037293.662592, 2344235, 0.026287589222192764], [1437037773.66716, 2354364, 0.026264755055308342], [1437038253.603687, 2364507, 0.026225194334983826], [1437038733.78864, 2374644, 0.02624845691025257], [1437039213.641799, 2384782, 0.02624380588531494], [1437039693.687078, 2394923, 0.026255516335368156], [1437040173.635717, 2405058, 0.026186630129814148], [1437040653.673331, 2415194, 0.026059549301862717], [1437041133.764768, 2425322, 0.02603207901120186], [1437041613.629279, 2435449, 0.025951188057661057], [1437042093.703985, 2445575, 0.025885486975312233], [1437042573.496029, 2455712, 0.0258584376424551], [1437043053.686022, 2465844, 0.02576967515051365], [1437043533.731929, 2475974, 0.02574247308075428], [1437044013.636245, 2486095, 0.025741368532180786], [1437044493.69923, 2496238, 0.025613142177462578], [1437044973.652155, 2506373, 0.025502001866698265], [1437045453.691467, 2516497, 0.025422129780054092], [1437045933.935804, 2526637, 0.02530006691813469], [1437046413.635583, 2536770, 0.02533203549683094], [1437046893.626337, 2546896, 0.025261884555220604], [1437047373.67437, 2557029, 0.02517615258693695], [1437047853.652939, 2567169, 0.025054262951016426], [1437048333.778436, 2577306, 0.024978358298540115], [1437048813.654248, 2587433, 0.024952327832579613], [1437049293.610609, 2597552, 0.024846646934747696], [1437049773.646573, 2607690, 0.024763893336057663], [1437050253.667925, 2617808, 0.024688972160220146], [1437050733.735291, 2627933, 0.024599123746156693], [1437051213.620222, 2638053, 0.024585271254181862], [1437051693.601978, 2648171, 0.024474715813994408], [1437052173.634985, 2658299, 0.0243435837328434], [1437052653.687176, 2668425, 0.024294523522257805], [1437053133.762819, 2678556, 0.024163981899619102], [1437053613.643698, 2688671, 0.024034887552261353], [1437054093.673047, 2698804, 0.024000374600291252], [1437054573.667371, 2708956, 0.023914175108075142], [1437055053.650441, 2719087, 0.02395522966980934], [1437055533.778469, 2729219, 0.023859599605202675], [1437056013.694082, 2739343, 0.02375946193933487], [1437056493.674871, 2749458, 0.023677179589867592], [1437056973.700234, 2759575, 0.023645443841814995], [1437057453.666129, 2769697, 0.02356558106839657], [1437057933.848506, 2779821, 0.023514214903116226], [1437058413.643799, 2789941, 0.023489613085985184], [1437058893.715386, 2800076, 0.023429814726114273], [1437059373.62596, 2810207, 0.023343827575445175], [1437059853.650848, 2820334, 0.02322673238813877], [1437060333.792248, 2830465, 0.023134106770157814], [1437060813.682955, 2840600, 0.023055672645568848], [1437061293.681795, 2850745, 0.022985080257058144], [1437061773.691182, 2860880, 0.02291373908519745], [1437062253.662987, 2871013, 0.022864071652293205], [1437062733.760419, 2881153, 0.0227896086871624], [1437063213.651969, 2891278, 0.02276325598359108], [1437063693.723523, 2901406, 0.022676151245832443], [1437064173.68663, 2911533, 0.022622840479016304], [1437064653.547643, 2921667, 0.022551873698830605], [1437065133.62645, 2931813, 0.022431621327996254], [1437065613.566569, 2941947, 0.022368427366018295], [1437066093.537804, 2952102, 0.022323856130242348], [1437066573.529332, 2962243, 0.022268367931246758], [1437067053.520098, 2972400, 0.022210223600268364], [1437067533.605733, 2982561, 0.022118542343378067], [1437068013.535467, 2992698, 0.022013003006577492], [1437068493.559976, 3002839, 0.021971898153424263], [1437068973.558743, 3012983, 0.021911533549427986], [1437069453.562661, 3023116, 0.021851375699043274], [1437069933.627071, 3033256, 0.021762363612651825], [1437070413.574131, 3043386, 0.021733952686190605], [1437070893.658803, 3053528, 0.021669508889317513], [1437071373.638711, 3063659, 0.021594204008579254], [1437071853.621384, 3073794, 0.021531015634536743], [1437072333.665269, 3083926, 0.021499203518033028], [1437072813.584388, 3094040, 0.021456807851791382], [1437073293.569178, 3104172, 0.02136526256799698]] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d4.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d4.json deleted file mode 100644 index 434b78cd0f..0000000000 --- a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars/beta/d4.json +++ /dev/null @@ -1 +0,0 @@ -[[1436925978.257845, 7, 0.5028539896011353], [1436926413.945391, 1476, 0.4976981580257416], [1436926893.945037, 6006, 0.5092837810516357], [1436927373.995472, 13786, 0.5118998885154724], [1436927853.989794, 23650, 0.5314905643463135], [1436928334.132361, 33755, 0.550969123840332], [1436928813.973288, 43941, 0.5487659573554993], [1436929293.975949, 54146, 0.5263530015945435], [1436929773.992781, 64316, 0.5077286958694458], [1436930253.997415, 74465, 0.5120566487312317], [1436930734.203004, 84611, 0.5140185952186584], [1436931214.03644, 94700, 0.5133042335510254], [1436931694.094564, 104766, 0.5233010053634644], [1436932174.114955, 114817, 0.5230671763420105], [1436932654.161382, 124880, 0.5250263810157776], [1436933133.960214, 134977, 0.5088120698928833], [1436933614.044337, 145062, 0.5097426176071167], [1436934094.166206, 155169, 0.5103482007980347], [1436934574.106036, 165284, 0.5021579265594482], [1436935054.150647, 175402, 0.49785494804382324], [1436935533.819562, 185538, 0.4970649182796478], [1436936013.710422, 195712, 0.5023221373558044], [1436936493.609025, 205906, 0.5063169002532959], [1436936973.683892, 216099, 0.50455641746521], [1436937454.138383, 226331, 0.5104150772094727], [1436937933.838475, 236532, 0.5066487193107605], [1436938413.89688, 246724, 0.5183079838752747], [1436938894.018652, 256925, 0.5163102746009827], [1436939373.69067, 267137, 0.5216323733329773], [1436939853.673692, 277369, 0.5153006315231323], [1436940333.651346, 287620, 0.5240126252174377], [1436940813.599579, 297848, 0.5263218879699707], [1436941293.596313, 308088, 0.5236956477165222], [1436941773.659172, 318362, 0.534295916557312], [1436942253.648479, 328621, 0.540306031703949], [1436942733.752284, 338892, 0.5359382033348083], [1436943213.621881, 349144, 0.540198564529419], [1436943693.698743, 359399, 0.5404431819915771], [1436944173.578463, 369649, 0.5429667234420776], [1436944653.692217, 379912, 0.5415231585502625], [1436945133.677298, 390180, 0.54068922996521], [1436945613.572411, 400445, 0.5396349430084229], [1436946093.56123, 410703, 0.5486253499984741], [1436946573.542364, 420958, 0.5451043248176575], [1436947053.616578, 431216, 0.5478819608688354], [1436947533.636973, 441483, 0.5503379106521606], [1436948013.541574, 451751, 0.5534676313400269], [1436948493.560223, 462015, 0.5574610829353333], [1436948973.512541, 472260, 0.5558810234069824], [1436949453.550055, 482483, 0.5529404878616333], [1436949933.828011, 492731, 0.5618430972099304], [1436950413.603177, 502957, 0.5641138553619385], [1436950893.563009, 513185, 0.5707159638404846], [1436951373.620887, 523410, 0.5676558613777161], [1436951853.61941, 533618, 0.5637813806533813], [1436952333.694447, 543828, 0.5682924389839172], [1436952813.621004, 554042, 0.5690237283706665], [1436953293.588156, 564251, 0.5655006766319275], [1436953773.599734, 574464, 0.553955614566803], [1436954253.621309, 584672, 0.5558924674987793], [1436954733.738119, 594882, 0.5603042840957642], [1436955213.56617, 605091, 0.5625290870666504], [1436955693.585366, 615296, 0.5668522715568542], [1436956173.626395, 625501, 0.5736584663391113], [1436956653.601937, 635705, 0.5693879723548889], [1436957133.665878, 645915, 0.576599657535553], [1436957613.584762, 656116, 0.5648065805435181], [1436958093.549783, 666331, 0.5632508397102356], [1436958573.646778, 676543, 0.5660487413406372], [1436959053.585655, 686750, 0.568809449672699], [1436959533.679696, 696961, 0.5667826533317566], [1436960013.633292, 707173, 0.5637232661247253], [1436960493.578778, 717383, 0.5675314664840698], [1436960973.596715, 727598, 0.5714674592018127], [1436961453.625644, 737818, 0.564845085144043], [1436961933.740339, 748040, 0.5700833797454834], [1436962413.573845, 758252, 0.5702976584434509], [1436962893.610678, 768470, 0.5745863914489746], [1436963373.642878, 778674, 0.5763651728630066], [1436963853.558388, 788877, 0.5721960067749023], [1436964333.658419, 799099, 0.5714120864868164], [1436964813.573319, 809289, 0.5687000155448914], [1436965293.542098, 819484, 0.5728974938392639], [1436965773.545453, 829687, 0.5738612413406372], [1436966253.586517, 839901, 0.5702064037322998], [1436966733.639348, 850120, 0.5715107321739197], [1436967213.697288, 860330, 0.5695001482963562], [1436967693.617172, 870539, 0.5783872008323669], [1436968173.593885, 880748, 0.5758792161941528], [1436968653.560836, 890955, 0.572809636592865], [1436969133.676337, 901164, 0.5752230286598206], [1436969613.506638, 911358, 0.5861247181892395], [1436970093.595964, 921560, 0.5834078788757324], [1436970573.541227, 931756, 0.5814791321754456], [1436971053.624316, 941945, 0.5803619623184204], [1436971533.655543, 952138, 0.5765199065208435], [1436972013.604738, 962349, 0.5693190693855286], [1436972493.613199, 972551, 0.5720453262329102], [1436972973.501155, 982746, 0.5741620063781738], [1436973453.64842, 992945, 0.5705713629722595], [1436973933.689516, 1003147, 0.5657351613044739], [1436974413.577769, 1013350, 0.5685256123542786], [1436974893.542281, 1023545, 0.5698860287666321], [1436975373.638453, 1033759, 0.5801734328269958], [1436975853.524388, 1043955, 0.577880322933197], [1436976333.625792, 1054148, 0.5780594348907471], [1436976813.610661, 1064342, 0.5804633498191833], [1436977293.601581, 1074539, 0.5842364430427551], [1436977773.575627, 1084733, 0.5745837092399597], [1436978253.564972, 1094914, 0.5848771333694458], [1436978733.673144, 1105109, 0.5795935392379761], [1436979213.540585, 1115293, 0.583346426486969], [1436979693.699591, 1125483, 0.5840965509414673], [1436980173.613012, 1135670, 0.5807850360870361], [1436980653.575769, 1145862, 0.5843925476074219], [1436981133.719264, 1156045, 0.5828814506530762], [1436981613.563551, 1166236, 0.5873864889144897], [1436982093.553233, 1176436, 0.5896572470664978], [1436982573.577846, 1186636, 0.5887367725372314], [1436983053.605749, 1196837, 0.5841871500015259], [1436983533.684994, 1207025, 0.5867579579353333], [1436984013.561492, 1217233, 0.5940297842025757], [1436984493.629873, 1227437, 0.5925037860870361], [1436984973.606714, 1237643, 0.5981529951095581], [1436985453.690084, 1247835, 0.5954598188400269], [1436985933.711388, 1257951, 0.5903756022453308], [1436986413.598807, 1268125, 0.5837404131889343], [1436986893.631797, 1278290, 0.583182156085968], [1436987373.596962, 1288473, 0.5860618352890015], [1436987853.555549, 1298650, 0.5829544067382812], [1436988333.722032, 1308841, 0.5798720121383667], [1436988813.55697, 1319018, 0.589148998260498], [1436989293.756905, 1329221, 0.5905702710151672], [1436989773.665141, 1339417, 0.5900465250015259], [1436990253.768302, 1349610, 0.5893078446388245], [1436990733.708919, 1359759, 0.589722752571106], [1436991213.663033, 1369914, 0.5907371640205383], [1436991693.730925, 1380074, 0.5939858555793762], [1436992173.751791, 1390224, 0.5906378626823425], [1436992653.758682, 1400383, 0.5876493453979492], [1436993133.835604, 1410542, 0.5912420153617859], [1436993613.674655, 1420684, 0.5887293219566345], [1436994093.747454, 1430832, 0.589107096195221], [1436994573.768973, 1440986, 0.5928497910499573], [1436995053.666661, 1451174, 0.5916265845298767], [1436995533.83439, 1461345, 0.5911784768104553], [1436996013.556996, 1471495, 0.5890726447105408], [1436996493.635477, 1481663, 0.5914839506149292], [1436996973.668684, 1491822, 0.5915400385856628], [1436997453.59326, 1501979, 0.591564416885376], [1436997933.774019, 1512139, 0.5926578640937805], [1436998413.575162, 1522290, 0.5942149758338928], [1436998893.640468, 1532431, 0.5931802988052368], [1436999373.551661, 1542579, 0.587592601776123], [1436999853.57906, 1552734, 0.5877953171730042], [1437000333.680409, 1562888, 0.590681791305542], [1437000813.602383, 1573037, 0.5924896001815796], [1437001293.610337, 1583190, 0.5913501381874084], [1437001773.618199, 1593341, 0.5952408909797668], [1437002253.572966, 1603497, 0.5953922271728516], [1437002733.67994, 1613657, 0.6002237200737], [1437003213.583266, 1623809, 0.6042569875717163], [1437003693.639943, 1633966, 0.6017740368843079], [1437004173.568287, 1644113, 0.6037994623184204], [1437004653.610772, 1654268, 0.6037947535514832], [1437005133.663045, 1664424, 0.6028310060501099], [1437005613.580984, 1674567, 0.603211522102356], [1437006093.601019, 1684715, 0.6052727699279785], [1437006573.625314, 1694857, 0.6032628417015076], [1437007053.584514, 1704999, 0.5978461503982544], [1437007533.719303, 1715150, 0.602828323841095], [1437008013.604962, 1725282, 0.6063790917396545], [1437008493.655091, 1735432, 0.6047347784042358], [1437008973.640165, 1745584, 0.6031648516654968], [1437009453.715067, 1755742, 0.6067507863044739], [1437009933.765712, 1765896, 0.6062817573547363], [1437010413.632128, 1776052, 0.609245240688324], [1437010893.66766, 1786195, 0.6066284775733948], [1437011373.636164, 1796346, 0.6102170944213867], [1437011853.631224, 1806481, 0.609173595905304], [1437012333.706205, 1816617, 0.6035751104354858], [1437012813.61987, 1826754, 0.604059636592865], [1437013293.479904, 1836883, 0.6039224863052368], [1437013773.604574, 1847029, 0.5974730849266052], [1437014253.618884, 1857175, 0.6040806174278259], [1437014733.756419, 1867312, 0.6017186045646667], [1437015213.638607, 1877459, 0.5987159609794617], [1437015693.625763, 1887608, 0.6047909259796143], [1437016173.63194, 1897759, 0.6033824682235718], [1437016653.609074, 1907909, 0.6038352847099304], [1437017133.717601, 1918074, 0.6083348989486694], [1437017613.716011, 1928220, 0.6044996380805969], [1437018093.626005, 1938377, 0.6009799242019653], [1437018573.626522, 1948523, 0.60047847032547], [1437019053.648174, 1958678, 0.6019382476806641], [1437019533.803011, 1968831, 0.6007305383682251], [1437020013.667751, 1978978, 0.6025127172470093], [1437020493.659028, 1989133, 0.6051828861236572], [1437020973.657346, 1999287, 0.6085876822471619], [1437021453.650634, 2009437, 0.6065122485160828], [1437021933.848661, 2019588, 0.6084572076797485], [1437022413.674963, 2029736, 0.6065473556518555], [1437022893.69086, 2039894, 0.6075063347816467], [1437023373.68883, 2050054, 0.6095973253250122], [1437023853.686116, 2060205, 0.6047213077545166], [1437024333.763876, 2070362, 0.6034210324287415], [1437024813.707845, 2080507, 0.6008927822113037], [1437025293.483294, 2090645, 0.604469895362854], [1437025773.695712, 2100793, 0.6068717837333679], [1437026253.672994, 2110943, 0.6099737882614136], [1437026733.780775, 2121094, 0.6105009317398071], [1437027213.617849, 2131235, 0.611957311630249], [1437027693.694451, 2141382, 0.6141949892044067], [1437028173.68596, 2151537, 0.6135279536247253], [1437028653.584833, 2161685, 0.6111017465591431], [1437029133.792483, 2171839, 0.6135671138763428], [1437029613.661672, 2181977, 0.6112024188041687], [1437030093.641009, 2192118, 0.6097264289855957], [1437030573.656274, 2202268, 0.6097284555435181], [1437031053.643631, 2212416, 0.6121350526809692], [1437031533.777478, 2222583, 0.6147991418838501], [1437032013.704008, 2232736, 0.6118316054344177], [1437032493.638393, 2242882, 0.6191433072090149], [1437032973.684986, 2253041, 0.6188027262687683], [1437033453.699562, 2263183, 0.6163974404335022], [1437033933.918074, 2273320, 0.6144159436225891], [1437034413.596351, 2283443, 0.6123769879341125], [1437034893.640496, 2293579, 0.6139131188392639], [1437035373.637761, 2303701, 0.6150627136230469], [1437035853.669947, 2313823, 0.6149951219558716], [1437036333.78905, 2323961, 0.6155945658683777], [1437036813.699727, 2334089, 0.613308310508728], [1437037293.662592, 2344235, 0.6153736114501953], [1437037773.66716, 2354364, 0.6160987615585327], [1437038253.603687, 2364507, 0.611574113368988], [1437038733.78864, 2374644, 0.6145234107971191], [1437039213.641799, 2384782, 0.6117951273918152], [1437039693.687078, 2394923, 0.6129845380783081], [1437040173.635717, 2405058, 0.6095831394195557], [1437040653.673331, 2415194, 0.6110679507255554], [1437041133.764768, 2425322, 0.6099690198898315], [1437041613.629279, 2435449, 0.6105908155441284], [1437042093.703985, 2445575, 0.6124749779701233], [1437042573.496029, 2455712, 0.6118302345275879], [1437043053.686022, 2465844, 0.6094756722450256], [1437043533.731929, 2475974, 0.6094986796379089], [1437044013.636245, 2486095, 0.6114639639854431], [1437044493.69923, 2496238, 0.6101082563400269], [1437044973.652155, 2506373, 0.6105718612670898], [1437045453.691467, 2516497, 0.6115666627883911], [1437045933.935804, 2526637, 0.6128115653991699], [1437046413.635583, 2536770, 0.6122986078262329], [1437046893.626337, 2546896, 0.6142017245292664], [1437047373.67437, 2557029, 0.6111341714859009], [1437047853.652939, 2567169, 0.611350417137146], [1437048333.778436, 2577306, 0.6126709580421448], [1437048813.654248, 2587433, 0.6111524105072021], [1437049293.610609, 2597552, 0.6135894060134888], [1437049773.646573, 2607690, 0.6136029362678528], [1437050253.667925, 2617808, 0.6141685843467712], [1437050733.735291, 2627933, 0.6170881390571594], [1437051213.620222, 2638053, 0.6189730167388916], [1437051693.601978, 2648171, 0.6157540678977966], [1437052173.634985, 2658299, 0.6178646683692932], [1437052653.687176, 2668425, 0.6164441108703613], [1437053133.762819, 2678556, 0.6175132393836975], [1437053613.643698, 2688671, 0.6158696413040161], [1437054093.673047, 2698804, 0.6162974238395691], [1437054573.667371, 2708956, 0.6160892844200134], [1437055053.650441, 2719087, 0.6176281571388245], [1437055533.778469, 2729219, 0.6165231466293335], [1437056013.694082, 2739343, 0.6171510219573975], [1437056493.674871, 2749458, 0.6124134659767151], [1437056973.700234, 2759575, 0.6120688319206238], [1437057453.666129, 2769697, 0.6126770377159119], [1437057933.848506, 2779821, 0.6126595139503479], [1437058413.643799, 2789941, 0.616513729095459], [1437058893.715386, 2800076, 0.6130264401435852], [1437059373.62596, 2810207, 0.6114044785499573], [1437059853.650848, 2820334, 0.6077002882957458], [1437060333.792248, 2830465, 0.6086235046386719], [1437060813.682955, 2840600, 0.6084680557250977], [1437061293.681795, 2850745, 0.6094310879707336], [1437061773.691182, 2860880, 0.6066345572471619], [1437062253.662987, 2871013, 0.6094250082969666], [1437062733.760419, 2881153, 0.609106719493866], [1437063213.651969, 2891278, 0.6080747246742249], [1437063693.723523, 2901406, 0.6081057786941528], [1437064173.68663, 2911533, 0.6066460609436035], [1437064653.547643, 2921667, 0.6057829856872559], [1437065133.62645, 2931813, 0.6092885136604309], [1437065613.566569, 2941947, 0.6089289784431458], [1437066093.537804, 2952102, 0.6070758700370789], [1437066573.529332, 2962243, 0.6096142530441284], [1437067053.520098, 2972400, 0.609714925289154], [1437067533.605733, 2982561, 0.6116167306900024], [1437068013.535467, 2992698, 0.6119107007980347], [1437068493.559976, 3002839, 0.6119140386581421], [1437068973.558743, 3012983, 0.6115538477897644], [1437069453.562661, 3023116, 0.6126777529716492], [1437069933.627071, 3033256, 0.6146017909049988], [1437070413.574131, 3043386, 0.6119789481163025], [1437070893.658803, 3053528, 0.6139205694198608], [1437071373.638711, 3063659, 0.612362802028656], [1437071853.621384, 3073794, 0.6109192371368408], [1437072333.665269, 3083926, 0.6141091585159302], [1437072813.584388, 3094040, 0.6132751703262329], [1437073293.569178, 3104172, 0.6132386922836304]] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_bar_2Fsquare.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_bar_2Fsquare.json new file mode 100644 index 0000000000..6d584fb4a9 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_bar_2Fsquare.json @@ -0,0 +1 @@ +[[0.0, 0, 0.0], [10.0, 1, 1.0], [20.0, 2, 4.0], [30.0, 3, 9.0], [40.0, 4, 16.0]] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_foo_2Fcos.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_foo_2Fcos.json new file mode 100644 index 0000000000..025eaa16e9 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_foo_2Fcos.json @@ -0,0 +1 @@ +[[0.0, 0, 1.0], [10.0, 1, 0.5403022766113281], [20.0, 2, -0.416146844625473], [30.0, 3, -0.9899924993515015], [40.0, 4, -0.6536436080932617]] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_foo_2Fsin.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_foo_2Fsin.json new file mode 100644 index 0000000000..eae69dd78f --- /dev/null +++ b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_foo_2Fsin.json @@ -0,0 +1 @@ +[[0.0, 0, 0.0], [10.0, 1, 0.8414709568023682], [20.0, 2, 0.9092974066734314], [30.0, 3, 0.14112000167369843], [40.0, 4, -0.756802499294281]] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_foo_2Fsquare.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_foo_2Fsquare.json new file mode 100644 index 0000000000..6d584fb4a9 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run1_tag_foo_2Fsquare.json @@ -0,0 +1 @@ +[[0.0, 0, 0.0], [10.0, 1, 1.0], [20.0, 2, 4.0], [30.0, 3, 9.0], [40.0, 4, 16.0]] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run2_tag_bar_2Fsquare.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run2_tag_bar_2Fsquare.json new file mode 100644 index 0000000000..6d584fb4a9 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run2_tag_bar_2Fsquare.json @@ -0,0 +1 @@ +[[0.0, 0, 0.0], [10.0, 1, 1.0], [20.0, 2, 4.0], [30.0, 3, 9.0], [40.0, 4, 16.0]] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run2_tag_foo_2Fcos.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run2_tag_foo_2Fcos.json new file mode 100644 index 0000000000..dd3593f9d1 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run2_tag_foo_2Fcos.json @@ -0,0 +1 @@ +[[0.0, 0, 2.0], [10.0, 1, 1.0806045532226562], [20.0, 2, -0.832293689250946], [30.0, 3, -1.979984998703003], [40.0, 4, -1.3072872161865234]] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run2_tag_foo_2Fsquare.json b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run2_tag_foo_2Fsquare.json new file mode 100644 index 0000000000..0ff9ef0551 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/data/scalars_run_run2_tag_foo_2Fsquare.json @@ -0,0 +1 @@ +[[0.0, 0, 0.0], [10.0, 1, 2.0], [20.0, 2, 8.0], [30.0, 3, 18.0], [40.0, 4, 32.0]] \ No newline at end of file diff --git a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/index.html b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/index.html index 02646c6c18..586ee2a47d 100644 --- a/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/index.html +++ b/tensorflow/tensorboard/components/tf_scalar_dashboard/demo/index.html @@ -16,33 +16,47 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - - - - Event Dashboard Demo Demo - - - + + + + + +Scalar Dashboard Demo + + + + -- GitLab From feb53ba9d8165927a2ff70ce7ea55379da95f827 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 15:37:54 -0800 Subject: [PATCH 059/101] Make TensorForest dense input shape a little more flexible by inferring size 1 if needed. Change: 148825114 --- tensorflow/contrib/tensor_forest/python/ops/data_ops.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tensorflow/contrib/tensor_forest/python/ops/data_ops.py b/tensorflow/contrib/tensor_forest/python/ops/data_ops.py index 398db3acd0..2e54f620d5 100644 --- a/tensorflow/contrib/tensor_forest/python/ops/data_ops.py +++ b/tensorflow/contrib/tensor_forest/python/ops/data_ops.py @@ -138,7 +138,11 @@ def ParseDataTensorOrDict(data): col_spec.original_type = DTYPE_TO_FTYPE[data[k].dtype] col_spec.name = k # the second dimension of get_shape should always be known. - col_spec.size = data[k].get_shape()[1].value + shape = data[k].get_shape() + if len(shape) == 1: + col_spec.size = 1 + else: + col_spec.size = shape[1].value dense_features_size += col_spec.size dense_features.append(CastToFloat(data[k])) -- GitLab From 1296e563c986280059b2da666540997e49fcfe9a Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 15:54:38 -0800 Subject: [PATCH 060/101] Add optional transport_options to RecvTensorRequest. Change: 148827175 --- tensorflow/core/protobuf/worker.proto | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tensorflow/core/protobuf/worker.proto b/tensorflow/core/protobuf/worker.proto index c8fa0f3d21..9d0ab0c2db 100644 --- a/tensorflow/core/protobuf/worker.proto +++ b/tensorflow/core/protobuf/worker.proto @@ -229,6 +229,9 @@ message RecvTensorRequest { // Optional information on server-side device locality. DeviceLocality server_locality = 5; + + // Optional information needed by the RPC subsystem. + google.protobuf.Any transport_options = 6; } message RecvTensorResponse { @@ -243,7 +246,7 @@ message RecvTensorResponse { int64 send_start_micros = 3; // Optional additional information about how to receive the tensor, - // in the event that `RecvTensorRequest.dma_ok` was true. + // e.g. in the event that `RecvTensorRequest.dma_ok` was true. google.protobuf.Any transport_options = 4; } -- GitLab From 676f94a952df76d36a134a5e3b92285fabb72cc8 Mon Sep 17 00:00:00 2001 From: Blake Hechtman Date: Tue, 28 Feb 2017 16:32:28 -0800 Subject: [PATCH 061/101] Fixes XLA open source build. Change: 148831489 --- .../compiler/xla/service/algebraic_simplifier.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tensorflow/compiler/xla/service/algebraic_simplifier.cc b/tensorflow/compiler/xla/service/algebraic_simplifier.cc index efbfda4d3f..e225c4e927 100644 --- a/tensorflow/compiler/xla/service/algebraic_simplifier.cc +++ b/tensorflow/compiler/xla/service/algebraic_simplifier.cc @@ -757,21 +757,23 @@ StatusOr AlgebraicSimplifierVisitor:: new_user_operands[reshape_or_broadcast_operand_index] = operand; auto new_user = computation_->AddInstruction(user->CloneWithNewOperands( ShapeUtil::MakeShape(user->shape().element_type(), - operand->shape().dimensions()), + AsInt64Slice(operand->shape().dimensions())), new_user_operands)); HloInstruction* new_reshape_or_broadcast = nullptr; if (reshape_or_broadcast->opcode() == HloOpcode::kReshape) { new_reshape_or_broadcast = computation_->AddInstruction(HloInstruction::CreateReshape( - ShapeUtil::MakeShape(user->shape().element_type(), - reshape_or_broadcast->shape().dimensions()), + ShapeUtil::MakeShape( + user->shape().element_type(), + AsInt64Slice(reshape_or_broadcast->shape().dimensions())), new_user)); } else { TF_RET_CHECK(reshape_or_broadcast->opcode() == HloOpcode::kBroadcast); new_reshape_or_broadcast = computation_->AddInstruction(HloInstruction::CreateBroadcast( - ShapeUtil::MakeShape(user->shape().element_type(), - reshape_or_broadcast->shape().dimensions()), + ShapeUtil::MakeShape( + user->shape().element_type(), + AsInt64Slice(reshape_or_broadcast->shape().dimensions())), new_user, reshape_or_broadcast->dimensions())); } TF_RETURN_IF_ERROR( -- GitLab From 4ee4d1de7cf8c4c6f146a5b81baf288df17c944f Mon Sep 17 00:00:00 2001 From: Eugene Brevdo Date: Tue, 28 Feb 2017 16:40:43 -0800 Subject: [PATCH 062/101] Cleaner error messages for RNNCell scope failures. Change: 148832474 --- .../python/kernel_tests/core_rnn_cell_test.py | 23 +++++++++++++++++++ .../rnn/python/ops/core_rnn_cell_impl.py | 6 ++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/tensorflow/contrib/rnn/python/kernel_tests/core_rnn_cell_test.py b/tensorflow/contrib/rnn/python/kernel_tests/core_rnn_cell_test.py index 8b0a9a2bbf..b38f08d4d5 100644 --- a/tensorflow/contrib/rnn/python/kernel_tests/core_rnn_cell_test.py +++ b/tensorflow/contrib/rnn/python/kernel_tests/core_rnn_cell_test.py @@ -344,6 +344,29 @@ class RNNCellTest(test.TestCase): outputs, _ = cell(x, m) self.assertTrue("cpu:14159" in outputs.device.lower()) + def testUsingSecondCellInScopeWithExistingVariablesFails(self): + # This test should go away when this behavior is no longer an + # error (Approx. May 2017) + cell1 = core_rnn_cell_impl.LSTMCell(3) + cell2 = core_rnn_cell_impl.LSTMCell(3) + x = array_ops.zeros([1, 3]) + m = core_rnn_cell_impl.LSTMStateTuple(*[array_ops.zeros([1, 3])] * 2) + cell1(x, m) + with self.assertRaisesRegexp(ValueError, r"LSTMCell\(..., reuse=True\)"): + cell2(x, m) + + def testUsingCellInDifferentScopeFromFirstCallFails(self): + # This test should go away when this behavior is no longer an + # error (Approx. May 2017) + cell = core_rnn_cell_impl.LSTMCell(3) + x = array_ops.zeros([1, 3]) + m = core_rnn_cell_impl.LSTMStateTuple(*[array_ops.zeros([1, 3])] * 2) + with variable_scope.variable_scope("scope1"): + cell(x, m) + with variable_scope.variable_scope("scope2"): + with self.assertRaisesRegexp(ValueError, r"Attempt to reuse RNNCell"): + cell(x, m) + def testDropoutWrapper(self): with self.test_session() as sess: with variable_scope.variable_scope( diff --git a/tensorflow/contrib/rnn/python/ops/core_rnn_cell_impl.py b/tensorflow/contrib/rnn/python/ops/core_rnn_cell_impl.py index 75c8cdc6ae..148d2ef93a 100644 --- a/tensorflow/contrib/rnn/python/ops/core_rnn_cell_impl.py +++ b/tensorflow/contrib/rnn/python/ops/core_rnn_cell_impl.py @@ -81,11 +81,11 @@ def _checked_scope(cell, scope, reuse=None, **kwargs): if weights_found and reuse is None: raise ValueError( "Attempt to have a second RNNCell use the weights of a variable " - "scope that already has weights: '%s' (and RNNCell was not " - "constructed with reuse=True). " + "scope that already has weights: '%s'; and the cell was not " + "constructed as %s(..., reuse=True). " "To share the weights of an RNNCell, simply " "reuse it in your second calculation, or create a new one with " - "the argument reuse=True." % scope_name) + "the argument reuse=True." % (scope_name, type(cell).__name__)) # Everything is OK. Update the cell's scope and yield it. cell._scope = checking_scope # pylint: disable=protected-access -- GitLab From 4c0bd97d6855e4175a48a0fef6aa79b3cbc2f991 Mon Sep 17 00:00:00 2001 From: Shanqing Cai Date: Tue, 28 Feb 2017 16:52:12 -0800 Subject: [PATCH 063/101] Fix user ops test broken by doc file move Change: 148833774 --- .../tools/ci_build/builds/test_user_ops.sh | 6 +- .../builds/user_ops/cuda_op_kernel.cc | 55 ++++++++++++++++ .../builds/user_ops/cuda_op_kernel.cu.cc | 31 ++++++++++ .../builds/user_ops/zero_out_op_kernel_1.cc | 62 +++++++++++++++++++ 4 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 tensorflow/tools/ci_build/builds/user_ops/cuda_op_kernel.cc create mode 100644 tensorflow/tools/ci_build/builds/user_ops/cuda_op_kernel.cu.cc create mode 100644 tensorflow/tools/ci_build/builds/user_ops/zero_out_op_kernel_1.cc diff --git a/tensorflow/tools/ci_build/builds/test_user_ops.sh b/tensorflow/tools/ci_build/builds/test_user_ops.sh index 216abbe8e6..3b7e2348ad 100755 --- a/tensorflow/tools/ci_build/builds/test_user_ops.sh +++ b/tensorflow/tools/ci_build/builds/test_user_ops.sh @@ -123,7 +123,7 @@ if [[ ${IS_GPU} == "0" ]]; then EXPECTED_OUTPUT="[42, 0, 0]" # Locate the op kernel C++ file - OP_KERNEL_CC="${SCRIPT_DIR}/../../../g3doc/how_tos/adding_an_op/zero_out_op_kernel_1.cc" + OP_KERNEL_CC="${SCRIPT_DIR}/user_ops/zero_out_op_kernel_1.cc" OP_KERNEL_CC=$(realpath "${OP_KERNEL_CC}") if [[ ! -f "${OP_KERNEL_CC}" ]]; then @@ -162,13 +162,13 @@ else "${NVCC_BIN}" --version echo "" - OP_KERNEL_CU="${SCRIPT_DIR}/../../../g3doc/how_tos/adding_an_op/cuda_op_kernel.cu.cc" + OP_KERNEL_CU="${SCRIPT_DIR}/user_ops/cuda_op_kernel.cu.cc" OP_KERNEL_CU=$(realpath "${OP_KERNEL_CU}") if [[ ! -f "${OP_KERNEL_CU}" ]]; then die "ERROR: Unable to find user-op kernel CUDA file at: ${OP_KERNEL_CU}" fi - OP_KERNEL_CC="${SCRIPT_DIR}/../../../g3doc/how_tos/adding_an_op/cuda_op_kernel.cc" + OP_KERNEL_CC="${SCRIPT_DIR}/user_ops/cuda_op_kernel.cc" OP_KERNEL_CC=$(realpath "${OP_KERNEL_CC}") if [[ ! -f "${OP_KERNEL_CC}" ]]; then die "ERROR: Unable to find user-op kernel C++ file at: ${OP_KERNEL_CC}" diff --git a/tensorflow/tools/ci_build/builds/user_ops/cuda_op_kernel.cc b/tensorflow/tools/ci_build/builds/user_ops/cuda_op_kernel.cc new file mode 100644 index 0000000000..eb8ea96255 --- /dev/null +++ b/tensorflow/tools/ci_build/builds/user_ops/cuda_op_kernel.cc @@ -0,0 +1,55 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#include "tensorflow/core/framework/op.h" +#include "tensorflow/core/framework/op_kernel.h" + +using namespace tensorflow; + +REGISTER_OP("AddOne") + .Input("input: int32") + .Output("output: int32") + .Doc(R"doc( +Adds 1 to all elements of the tensor. + +output: A Tensor. + output = input + 1 +)doc"); + +void AddOneKernelLauncher(const int* in, const int N, int* out); + +class AddOneOp : public OpKernel { + public: + explicit AddOneOp(OpKernelConstruction* context) : OpKernel(context) {} + + void Compute(OpKernelContext* context) override { + // Grab the input tensor + const Tensor& input_tensor = context->input(0); + auto input = input_tensor.flat(); + + // Create an output tensor + Tensor* output_tensor = NULL; + OP_REQUIRES_OK(context, context->allocate_output(0, input_tensor.shape(), + &output_tensor)); + auto output = output_tensor->template flat(); + + // Set all but the first element of the output tensor to 0. + const int N = input.size(); + // Call the cuda kernel launcher + AddOneKernelLauncher(input.data(), N, output.data()); + } +}; + +REGISTER_KERNEL_BUILDER(Name("AddOne").Device(DEVICE_GPU), AddOneOp); diff --git a/tensorflow/tools/ci_build/builds/user_ops/cuda_op_kernel.cu.cc b/tensorflow/tools/ci_build/builds/user_ops/cuda_op_kernel.cu.cc new file mode 100644 index 0000000000..65b50bd3ae --- /dev/null +++ b/tensorflow/tools/ci_build/builds/user_ops/cuda_op_kernel.cu.cc @@ -0,0 +1,31 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#if GOOGLE_CUDA +#define EIGEN_USE_GPU +#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor" + +__global__ void AddOneKernel(const int* in, const int N, int* out) { + for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < N; + i += blockDim.x * gridDim.x) { + out[i] = in[i] + 1; + } +} + +void AddOneKernelLauncher(const int* in, const int N, int* out) { + AddOneKernel<<<32, 256>>>(in, N, out); +} + +#endif diff --git a/tensorflow/tools/ci_build/builds/user_ops/zero_out_op_kernel_1.cc b/tensorflow/tools/ci_build/builds/user_ops/zero_out_op_kernel_1.cc new file mode 100644 index 0000000000..18e9d7fedf --- /dev/null +++ b/tensorflow/tools/ci_build/builds/user_ops/zero_out_op_kernel_1.cc @@ -0,0 +1,62 @@ +/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#include "tensorflow/core/framework/op.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/framework/shape_inference.h" + +using namespace tensorflow; + +REGISTER_OP("ZeroOut") + .Input("to_zero: int32") + .Output("zeroed: int32") + .SetShapeFn([](shape_inference::InferenceContext* c) { + c->set_output(0, c->input(0)); + return Status::OK(); + }) + .Doc(R"doc( +Zeros out all but the first value of a Tensor. + +zeroed: A Tensor whose first value is identical to `to_zero`, and 0 + otherwise. +)doc"); + +class ZeroOutOp : public OpKernel { + public: + explicit ZeroOutOp(OpKernelConstruction* context) : OpKernel(context) {} + + void Compute(OpKernelContext* context) override { + // Grab the input tensor + const Tensor& input_tensor = context->input(0); + auto input = input_tensor.flat(); + + // Create an output tensor + Tensor* output_tensor = NULL; + OP_REQUIRES_OK(context, context->allocate_output(0, input_tensor.shape(), + &output_tensor)); + auto output = output_tensor->template flat(); + + // Set all but the first element of the output tensor to 0. + const int N = input.size(); + for (int i = 1; i < N; i++) { + output(i) = 0; + } + + // Preserve the first input value. + if (N > 0) output(0) = input(0); + } +}; + +REGISTER_KERNEL_BUILDER(Name("ZeroOut").Device(DEVICE_CPU), ZeroOutOp); -- GitLab From cd5d96735f18bcf32fff7026fac6ff8271f571f4 Mon Sep 17 00:00:00 2001 From: Skye Wanderman-Milne Date: Tue, 28 Feb 2017 16:58:45 -0800 Subject: [PATCH 064/101] Refactor python BUILD targets. The deps of the "framework" target did not reflect the actual imports used in those files. Adding the missing deps causes circular dependencies, so this patch refactors "framework" into per-file targets. It still exposes the "framework" and "framework_for_generated_wrappers" to avoid breaking the many targets that have these as dependencies. Change: 148834459 --- tensorflow/python/BUILD | 304 ++++++++++++++++++++++++++++++++------ tensorflow/tensorflow.bzl | 2 +- 2 files changed, 261 insertions(+), 45 deletions(-) diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD index 9b89a32e34..d541749883 100644 --- a/tensorflow/python/BUILD +++ b/tensorflow/python/BUILD @@ -329,62 +329,115 @@ cc_library( deps = [":python_op_gen"], ) -# What is needed for tf_gen_op_wrapper_py. py_library( name = "framework_for_generated_wrappers", - srcs = [ - "framework/constant_op.py", - "framework/device.py", - "framework/dtypes.py", - "framework/function.py", - "framework/op_def_library.py", - "framework/op_def_registry.py", - "framework/ops.py", - "framework/registry.py", - "framework/tensor_shape.py", - "framework/versions.py", + srcs_version = "PY2AND3", + visibility = ["//visibility:public"], + deps = [ + ":constant_op", + ":device", + ":dtypes", + ":framework_ops", + ":function", + ":op_def_library", + ":op_def_registry", + ":registry", + ":tensor_shape", + ":versions", ], +) + +# What is needed for tf_gen_op_wrapper_py. This is the same as +# "framework_for_generated_wrappers" minus the "function" dep. This is to avoid +# circular dependencies, as "function" uses generated op wrappers. +py_library( + name = "framework_for_generated_wrappers_v2", srcs_version = "PY2AND3", visibility = ["//visibility:public"], deps = [ - ":platform", - ":util", - "//tensorflow/core:protos_all_py", - "//third_party/py/numpy", - "@six_archive//:six", + ":constant_op", + ":device", + ":dtypes", + ":framework_ops", + ":op_def_library", + ":op_def_registry", + ":registry", + ":tensor_shape", + ":versions", ], ) py_library( name = "framework", srcs = [ - "framework/common_shapes.py", "framework/framework_lib.py", "framework/graph_io.py", - "framework/graph_util.py", - "framework/graph_util_impl.py", "framework/importer.py", "framework/load_library.py", "framework/meta_graph.py", - "framework/random_seed.py", - "framework/sparse_tensor.py", "framework/subscribe.py", - "framework/tensor_util.py", ], srcs_version = "PY2AND3", deps = [ + ":common_shapes", ":cpp_shape_inference_proto_py", ":errors", ":framework_for_generated_wrappers", + ":graph_util", ":lib", ":platform", ":pywrap_tensorflow", + ":random_seed", + ":sparse_tensor", + ":tensor_util", ":util", "//third_party/py/numpy", "@six_archive//:six", ], ) +py_library( + name = "common_shapes", + srcs = ["framework/common_shapes.py"], + srcs_version = "PY2AND3", + deps = [ + ":cpp_shape_inference_proto_py", + ":errors", + ":framework_ops", + ":pywrap_tensorflow", + ":tensor_shape", + ":tensor_util", + "//tensorflow/core:protos_all_py", + ], +) + +py_library( + name = "constant_op", + srcs = ["framework/constant_op.py"], + srcs_version = "PY2AND3", + deps = [ + ":dtypes", + ":framework_ops", + ":tensor_shape", + "//tensorflow/core:protos_all_py", + ], +) + +py_library( + name = "device", + srcs = ["framework/device.py"], + srcs_version = "PY2AND3", +) + +py_library( + name = "dtypes", + srcs = ["framework/dtypes.py"], + srcs_version = "PY2AND3", + deps = [ + "//tensorflow/core:protos_all_py", + ], +) + py_library( name = "errors", srcs = [ @@ -395,6 +448,139 @@ py_library( deps = [":util"], ) +py_library( + name = "function", + srcs = ["framework/function.py"], + srcs_version = "PY2AND3", + deps = [ + ":array_ops", + ":dtypes", + ":framework_ops", + ":op_def_registry", + ":util", + ":variable_scope", + "//tensorflow/core:protos_all_py", + ], +) + +py_library( + name = "graph_util", + srcs = [ + "framework/graph_util.py", + "framework/graph_util_impl.py", + ], + srcs_version = "PY2AND3", + deps = [ + ":dtypes", + ":framework_ops", + ":platform", + ":tensor_util", + "//tensorflow/core:protos_all_py", + ], +) + +py_library( + name = "op_def_library", + srcs = ["framework/op_def_library.py"], + srcs_version = "PY2AND3", + deps = [ + ":dtypes", + ":framework_ops", + ":platform", + ":tensor_shape", + ":util", + "//tensorflow/core:protos_all_py", + "@six_archive//:six", + ], +) + +py_library( + name = "op_def_registry", + srcs = ["framework/op_def_registry.py"], + srcs_version = "PY2AND3", + deps = [ + "//tensorflow/core:protos_all_py", + ], +) + +py_library( + name = "framework_ops", # "ops" is already the name of a deprecated target + srcs = ["framework/ops.py"], + srcs_version = "PY2AND3", + deps = [ + ":device", + ":dtypes", + ":op_def_registry", + ":platform", + ":registry", + ":tensor_shape", + ":util", + ":versions", + "//tensorflow/core:protos_all_py", + "@six_archive//:six", + ], +) + +py_library( + name = "random_seed", + srcs = ["framework/random_seed.py"], + srcs_version = "PY2AND3", + deps = [ + ":framework_ops", + ], +) + +py_library( + name = "registry", + srcs = ["framework/registry.py"], + srcs_version = "PY2AND3", + deps = [ + ":platform", + ":util", + ], +) + +py_library( + name = "sparse_tensor", + srcs = ["framework/sparse_tensor.py"], + srcs_version = "PY2AND3", + deps = [ + ":dtypes", + ":framework_ops", + ":tensor_util", + ], +) + +py_library( + name = "tensor_shape", + srcs = ["framework/tensor_shape.py"], + srcs_version = "PY2AND3", + deps = [ + ":util", + "//tensorflow/core:protos_all_py", + ], +) + +py_library( + name = "tensor_util", + srcs = ["framework/tensor_util.py"], + srcs_version = "PY2AND3", + deps = [ + ":tensor_shape", + ":util", + "//tensorflow/core:protos_all_py", + ], +) + +py_library( + name = "versions", + srcs = ["framework/versions.py"], + srcs_version = "PY2AND3", + deps = [ + ":pywrap_tensorflow", + ], +) + # load("//third_party/py/cython:build_defs.bzl", "pyx_library") py_library( @@ -514,11 +700,13 @@ py_library( srcs_version = "PY2AND3", deps = [ ":array_ops", + ":constant_op", ":control_flow_ops", - ":framework", - ":framework_for_generated_wrappers", + ":framework_ops", ":functional_ops_gen", + ":sparse_tensor", ":tensor_array_ops", + ":tensor_shape", ":util", ":variable_scope", ], @@ -997,9 +1185,14 @@ py_library( srcs_version = "PY2AND3", deps = [ ":array_ops_gen", - ":framework", - ":framework_for_generated_wrappers", + ":common_shapes", + ":constant_op", + ":dtypes", + ":framework_ops", ":math_ops_gen", + ":sparse_tensor", + ":tensor_shape", + ":tensor_util", ":util", "//third_party/py/numpy", "@six_archive//:six", @@ -1079,17 +1272,21 @@ py_library( srcs = ["ops/control_flow_ops.py"], srcs_version = "PY2AND3", deps = [ + "tensor_shape", ":array_ops", ":array_ops_gen", + ":constant_op", ":control_flow_ops_gen", ":data_flow_ops_gen", - ":framework", - ":framework_for_generated_wrappers", + ":dtypes", + ":framework_ops", ":logging_ops_gen", ":math_ops", ":platform", + ":sparse_tensor", ":tensor_array_ops", ":util", + "//tensorflow/core:protos_all_py", "@six_archive//:six", ], ) @@ -1232,7 +1429,8 @@ py_library( srcs_version = "PY2AND3", deps = [ ":array_ops", - ":framework_for_generated_wrappers", + ":constant_op", + ":dtypes", ":linalg_ops", ":math_ops", ":nn_ops", @@ -1270,7 +1468,8 @@ py_library( srcs_version = "PY2AND3", deps = [ ":array_ops", - ":framework_for_generated_wrappers", + ":dtypes", + ":framework_ops", ":linalg_ops_gen", ":math_ops", "//third_party/py/numpy", @@ -1308,15 +1507,20 @@ py_library( srcs = ["ops/math_ops.py"], srcs_version = "PY2AND3", deps = [ + "constant_op", ":array_ops", + ":common_shapes", ":control_flow_ops_gen", ":data_flow_ops_gen", - ":framework", - ":framework_for_generated_wrappers", + ":dtypes", + ":framework_ops", + ":graph_util", ":math_ops_gen", ":sparse_ops_gen", + ":sparse_tensor", ":state_ops", ":state_ops_gen", + ":tensor_shape", ":util", "//third_party/py/numpy", ], @@ -1340,10 +1544,12 @@ py_library( srcs_version = "PY2AND3", deps = [ ":array_ops", - ":framework_for_generated_wrappers", + ":framework_ops", ":resource_variable_ops_gen", + ":tensor_shape", ":util", ":variables", + "//tensorflow/core:protos_all_py", ], ) @@ -1390,11 +1596,14 @@ py_library( srcs_version = "PY2AND3", deps = [ ":array_ops", - ":framework", - ":framework_for_generated_wrappers", + ":dtypes", + ":framework_ops", + ":graph_util", ":math_ops", ":nn_ops_gen", ":random_ops", + ":tensor_shape", + ":tensor_util", "//third_party/py/numpy", ], ) @@ -1443,10 +1652,11 @@ py_library( deps = [ ":array_ops", ":control_flow_ops", - ":framework", - ":framework_for_generated_wrappers", + ":dtypes", + ":framework_ops", ":math_ops", ":random_ops_gen", + ":random_seed", ], ) @@ -1669,9 +1879,10 @@ py_library( srcs = ["ops/state_ops.py"], srcs_version = "PY2AND3", deps = [ - ":framework_for_generated_wrappers", + ":framework_ops", ":resource_variable_ops_gen", ":state_ops_gen", + ":tensor_shape", ], ) @@ -1726,9 +1937,10 @@ py_library( deps = [ ":array_ops", ":data_flow_ops_gen", - ":framework", - ":framework_for_generated_wrappers", + ":framework_ops", ":math_ops", + ":tensor_shape", + ":tensor_util", ":util", ], ) @@ -1738,11 +1950,12 @@ py_library( srcs = ["ops/variable_scope.py"], srcs_version = "PY2AND3", deps = [ - ":array_ops", - ":framework_for_generated_wrappers", + ":dtypes", + ":framework_ops", ":init_ops", ":platform", ":resource_variable_ops", + ":tensor_shape", ":variables", "@six_archive//:six", ], @@ -1755,10 +1968,13 @@ py_library( deps = [ ":array_ops", ":control_flow_ops", - ":framework_for_generated_wrappers", + ":dtypes", + ":framework_ops", ":math_ops", ":state_ops", + ":tensor_shape", ":util", + "//tensorflow/core:protos_all_py", ], ) diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl index 33c4ff5c3d..cb6b43b625 100644 --- a/tensorflow/tensorflow.bzl +++ b/tensorflow/tensorflow.bzl @@ -328,7 +328,7 @@ def tf_gen_op_wrapper_py(name, out=None, hidden=None, visibility=None, deps=[], srcs_version="PY2AND3", visibility=visibility, deps=[ - "//tensorflow/python:framework_for_generated_wrappers", + "//tensorflow/python:framework_for_generated_wrappers_v2", ],) # Define a bazel macro that creates cc_test for tensorflow. -- GitLab From 4fc5581f8b80fa959d85ceba423eafa573a2efab Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 16:58:54 -0800 Subject: [PATCH 065/101] Use 'name' instead of 'test_name' when forming benchmark output file name. Change: 148834478 --- tensorflow/tools/test/run_and_gather_logs_lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/tools/test/run_and_gather_logs_lib.py b/tensorflow/tools/test/run_and_gather_logs_lib.py index 963e1e8321..4042c491ed 100644 --- a/tensorflow/tools/test/run_and_gather_logs_lib.py +++ b/tensorflow/tools/test/run_and_gather_logs_lib.py @@ -124,7 +124,7 @@ def run_and_gather_logs(name, test_name, test_args): test_executable = os.path.join(".", test_executable) temp_directory = tempfile.mkdtemp(prefix="run_and_gather_logs") - mangled_test_name = test_name.strip("/").replace("/", "_").replace(":", "_") + mangled_test_name = name.strip("/").replace("/", "_").replace(":", "_") test_file_prefix = os.path.join(temp_directory, mangled_test_name) test_file_prefix = "%s." % test_file_prefix -- GitLab From 0eb245d2f951a71ae9b293149ecbc34562745100 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 17:00:36 -0800 Subject: [PATCH 066/101] Set explicit launch bounds on DepthwiseConv2dBackpropInputGPUKernel(). Otherwise it ends up using too many registers and causes launch failures. Change: 148834647 --- tensorflow/core/kernels/depthwise_conv_op_gpu.cu.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tensorflow/core/kernels/depthwise_conv_op_gpu.cu.cc b/tensorflow/core/kernels/depthwise_conv_op_gpu.cu.cc index b256d24517..18ee815ca0 100644 --- a/tensorflow/core/kernels/depthwise_conv_op_gpu.cu.cc +++ b/tensorflow/core/kernels/depthwise_conv_op_gpu.cu.cc @@ -135,11 +135,11 @@ template struct DepthwiseConv2dGPULaunch; // A Cuda kernel to compute the depthwise convolution backprop w.r.t. input. template -__global__ void DepthwiseConv2dBackpropInputGPUKernel(const DepthwiseArgs args, - const T* out_backprop, - const T* filter, - T* in_backprop, - int num_in_backprop) { +__global__ void __launch_bounds__(1024) + DepthwiseConv2dBackpropInputGPUKernel(const DepthwiseArgs args, + const T* out_backprop, + const T* filter, T* in_backprop, + int num_in_backprop) { const int in_rows = args.in_rows; const int in_cols = args.in_cols; const int in_depth = args.in_depth; -- GitLab From 3e6c638727c3274908a7c9c6bbf4474c014511fe Mon Sep 17 00:00:00 2001 From: Rohan Jain Date: Tue, 28 Feb 2017 17:12:06 -0800 Subject: [PATCH 067/101] Fixing a bug in GetMatchingFiles when the top level directory is null. There was an inconsistency in which we translated the directory and all the patterns etc. that were being matched. As a result ./ worked but did not. Change: 148836014 --- tensorflow/core/platform/file_system.cc | 14 +++++-- tensorflow/core/platform/file_system_test.cc | 44 +++++++++++++++++--- 2 files changed, 48 insertions(+), 10 deletions(-) diff --git a/tensorflow/core/platform/file_system.cc b/tensorflow/core/platform/file_system.cc index c82b6403c6..4564297b5f 100644 --- a/tensorflow/core/platform/file_system.cc +++ b/tensorflow/core/platform/file_system.cc @@ -80,11 +80,17 @@ Status FileSystem::GetMatchingPaths(const string& pattern, std::vector* results) { results->clear(); // Find the fixed prefix by looking for the first wildcard. - const string& fixed_prefix = - pattern.substr(0, pattern.find_first_of("*?[\\")); + string fixed_prefix = pattern.substr(0, pattern.find_first_of("*?[\\")); + string eval_pattern = pattern; std::vector all_files; string dir = io::Dirname(fixed_prefix).ToString(); - if (dir.empty()) dir = "."; + // If dir is empty then we need to fix up fixed_prefix and eval_pattern to + // include . as the top level directory. + if (dir.empty()) { + dir = "."; + fixed_prefix = io::JoinPath(dir, fixed_prefix); + eval_pattern = io::JoinPath(dir, pattern); + } // Setup a BFS to explore everything under dir. std::deque dir_q; @@ -132,7 +138,7 @@ Status FileSystem::GetMatchingPaths(const string& pattern, // Match all obtained files to the input pattern. for (const auto& f : all_files) { - if (Env::Default()->MatchPath(f, pattern)) { + if (Env::Default()->MatchPath(f, eval_pattern)) { results->push_back(f); } } diff --git a/tensorflow/core/platform/file_system_test.cc b/tensorflow/core/platform/file_system_test.cc index 67b0a47267..47d6ce73bb 100644 --- a/tensorflow/core/platform/file_system_test.cc +++ b/tensorflow/core/platform/file_system_test.cc @@ -166,7 +166,7 @@ string Match(InterPlanetaryFileSystem* ipfs, const string& suffix_pattern) { } } -TEST(TestFileSystem, IPFSMatch) { +TEST(InterPlanetaryFileSystemTest, IPFSMatch) { InterPlanetaryFileSystem ipfs; EXPECT_EQ(Match(&ipfs, "thereisnosuchfile"), ""); EXPECT_EQ(Match(&ipfs, "*"), @@ -183,7 +183,7 @@ TEST(TestFileSystem, IPFSMatch) { EXPECT_EQ(Match(&ipfs, "Planet?"), "Planet0,Planet1"); } -TEST(TestFileSystem, MatchSimple) { +TEST(InterPlanetaryFileSystemTest, MatchSimple) { InterPlanetaryFileSystem ipfs; TF_EXPECT_OK(ipfs.CreateDir(io::JoinPath(kPrefix, "match-00"))); TF_EXPECT_OK(ipfs.CreateDir(io::JoinPath(kPrefix, "match-0a"))); @@ -199,7 +199,7 @@ TEST(TestFileSystem, MatchSimple) { // Create 2 directories abcd and evil_directory. Look for abcd and make sure // that evil_directory isn't accessed. -TEST(TestFileSystem, MatchOnlyNeeded) { +TEST(InterPlanetaryFileSystemTest, MatchOnlyNeeded) { InterPlanetaryFileSystem ipfs; TF_EXPECT_OK(ipfs.CreateDir(io::JoinPath(kPrefix, "abcd"))); TF_EXPECT_OK(ipfs.CreateDir(io::JoinPath(kPrefix, "evil_directory"))); @@ -207,7 +207,7 @@ TEST(TestFileSystem, MatchOnlyNeeded) { EXPECT_EQ(Match(&ipfs, "abcd"), "abcd"); } -TEST(TestFileSystem, MatchDirectory) { +TEST(InterPlanetaryFileSystemTest, MatchDirectory) { InterPlanetaryFileSystem ipfs; TF_EXPECT_OK( ipfs.RecursivelyCreateDir(io::JoinPath(kPrefix, "match-00/abc/x"))); @@ -228,7 +228,7 @@ TEST(TestFileSystem, MatchDirectory) { EXPECT_EQ(Match(&ipfs, "match-?[^a]/abc/x"), "match-00/abc/x,match-01/abc/x"); } -TEST(TestFileSystem, MatchMultipleWildcards) { +TEST(InterPlanetaryFileSystemTest, MatchMultipleWildcards) { InterPlanetaryFileSystem ipfs; TF_EXPECT_OK( ipfs.RecursivelyCreateDir(io::JoinPath(kPrefix, "match-00/abc/00"))); @@ -249,7 +249,7 @@ TEST(TestFileSystem, MatchMultipleWildcards) { "match-00/abc/00,match-00/abc/01,match-01/abc/00,match-01/abc/04"); } -TEST(TestFileSystem, RecursivelyCreateAlreadyExistingDir) { +TEST(InterPlanetaryFileSystemTest, RecursivelyCreateAlreadyExistingDir) { InterPlanetaryFileSystem ipfs; const string dirname = io::JoinPath(kPrefix, "match-00/abc/00"); TF_EXPECT_OK(ipfs.RecursivelyCreateDir(dirname)); @@ -259,4 +259,36 @@ TEST(TestFileSystem, RecursivelyCreateAlreadyExistingDir) { TF_EXPECT_OK(ipfs.RecursivelyCreateDir(dirname)); } +// A simple file system with a root directory and a single file underneath it. +class TestFileSystem : public NullFileSystem { + public: + // Only allow for a single root directory. + Status IsDirectory(const string& dirname) override { + if (dirname == "." || dirname == "") { + return Status::OK(); + } + return Status(tensorflow::error::FAILED_PRECONDITION, "Not a dir"); + } + + // Simulating a FS with a root dir and a single file underneath it. + Status GetChildren(const string& dir, std::vector* result) override { + if (dir == "." || dir == "") { + result->push_back("test"); + } + return Status::OK(); + } +}; + +// Making sure that ./ and have the same result. +TEST(TestFileSystemTest, RootDirectory) { + TestFileSystem fs; + std::vector results; + auto ret = fs.GetMatchingPaths("./te*", &results); + EXPECT_EQ(1, results.size()); + EXPECT_EQ("./test", results[0]); + ret = fs.GetMatchingPaths("te*", &results); + EXPECT_EQ(1, results.size()); + EXPECT_EQ("./test", results[0]); +} + } // namespace tensorflow -- GitLab From 0e7edf20ee67c4e2ece258649147f8e9f2027f6b Mon Sep 17 00:00:00 2001 From: Manjunath Kudlur Date: Tue, 28 Feb 2017 17:28:23 -0800 Subject: [PATCH 068/101] Make selective registration handle spaces in kernel name. Change: 148837641 --- tensorflow/core/framework/op_kernel.h | 4 +- ...rint_selective_registration_header_test.py | 63 +++++++++++++------ .../selective_registration_header_lib.py | 37 +++++++++-- 3 files changed, 80 insertions(+), 24 deletions(-) diff --git a/tensorflow/core/framework/op_kernel.h b/tensorflow/core/framework/op_kernel.h index b6e302c492..eb1ca88938 100644 --- a/tensorflow/core/framework/op_kernel.h +++ b/tensorflow/core/framework/op_kernel.h @@ -1140,9 +1140,11 @@ class Name : public KernelDefBuilder { REGISTER_KERNEL_BUILDER_UNIQ(ctr, kernel_builder, __VA_ARGS__) #define REGISTER_KERNEL_BUILDER_UNIQ(ctr, kernel_builder, ...) \ + constexpr bool should_register_##ctr##__flag = \ + SHOULD_REGISTER_OP_KERNEL(#__VA_ARGS__); \ static ::tensorflow::kernel_factory::OpKernelRegistrar \ registrar__body__##ctr##__object( \ - SHOULD_REGISTER_OP_KERNEL(#__VA_ARGS__) \ + should_register_##ctr##__flag \ ? ::tensorflow::register_kernel::kernel_builder.Build() \ : nullptr, \ #__VA_ARGS__, \ diff --git a/tensorflow/python/tools/print_selective_registration_header_test.py b/tensorflow/python/tools/print_selective_registration_header_test.py index 6947428831..08b146f970 100644 --- a/tensorflow/python/tools/print_selective_registration_header_test.py +++ b/tensorflow/python/tools/print_selective_registration_header_test.py @@ -148,28 +148,53 @@ class PrintOpFilegroupTest(test.TestCase): default_ops = '' graphs = [text_format.Parse(GRAPH_DEF_TXT_2, graph_pb2.GraphDef())] + expected = '''#ifndef OPS_TO_REGISTER +#define OPS_TO_REGISTER +constexpr inline bool ShouldRegisterOp(const char op[]) { + return false + || (strcmp(op, "BiasAdd") == 0) + ; +} +#define SHOULD_REGISTER_OP(op) ShouldRegisterOp(op) + + + namespace { + constexpr const char* skip(const char* x) { + return (*x) ? (*x == ' ' ? skip(x + 1) : x) : x; + } + + constexpr bool isequal(const char* x, const char* y) { + return (*skip(x) && *skip(y)) + ? (*skip(x) == *skip(y) && isequal(skip(x) + 1, skip(y) + 1)) + : (!*skip(x) && !*skip(y)); + } + + template + struct find_in { + static constexpr bool f(const char* x, const char* const y[N]) { + return isequal(x, y[0]) || find_in::f(x, y + 1); + } + }; + + template<> + struct find_in<0> { + static constexpr bool f(const char* x, const char* const y[]) { + return false; + } + }; + } // end namespace + constexpr const char* kNecessaryOpKernelClasses[] = { +"BiasOp", +}; +#define SHOULD_REGISTER_OP_KERNEL(clz) (find_in::f(clz, kNecessaryOpKernelClasses)) + +#define SHOULD_REGISTER_OP_GRADIENT false +#endif''' + header = selective_registration_header_lib.get_header( self.WriteGraphFiles(graphs), 'rawproto', default_ops) print(header) - self.assertListEqual([ - '#ifndef OPS_TO_REGISTER', - '#define OPS_TO_REGISTER', - 'constexpr inline bool ShouldRegisterOp(const char op[]) {', - ' return false', - ' || (strcmp(op, "BiasAdd") == 0)', - ' ;', - '}', - '#define SHOULD_REGISTER_OP(op) ShouldRegisterOp(op)', - '', - 'const char kNecessaryOpKernelClasses[] = ","', - '"BiasOp,"', - ';', - '#define SHOULD_REGISTER_OP_KERNEL(clz)' - ' (strstr(kNecessaryOpKernelClasses, "," clz ",") != nullptr)', - '', - '#define SHOULD_REGISTER_OP_GRADIENT false', - '#endif', - ], header.split('\n')) + self.assertListEqual(expected.split('\n'), header.split('\n')) if __name__ == '__main__': diff --git a/tensorflow/python/tools/selective_registration_header_lib.py b/tensorflow/python/tools/selective_registration_header_lib.py index 1229ea2532..b297721aff 100644 --- a/tensorflow/python/tools/selective_registration_header_lib.py +++ b/tensorflow/python/tools/selective_registration_header_lib.py @@ -106,13 +106,42 @@ def get_header_from_ops_and_kernels(ops_and_kernels, append('#define SHOULD_REGISTER_OP(op) ShouldRegisterOp(op)') append('') - line = 'const char kNecessaryOpKernelClasses[] = ","\n' + line = ''' + namespace { + constexpr const char* skip(const char* x) { + return (*x) ? (*x == ' ' ? skip(x + 1) : x) : x; + } + + constexpr bool isequal(const char* x, const char* y) { + return (*skip(x) && *skip(y)) + ? (*skip(x) == *skip(y) && isequal(skip(x) + 1, skip(y) + 1)) + : (!*skip(x) && !*skip(y)); + } + + template + struct find_in { + static constexpr bool f(const char* x, const char* const y[N]) { + return isequal(x, y[0]) || find_in::f(x, y + 1); + } + }; + + template<> + struct find_in<0> { + static constexpr bool f(const char* x, const char* const y[]) { + return false; + } + }; + } // end namespace + ''' + line += 'constexpr const char* kNecessaryOpKernelClasses[] = {\n' for _, kernel_class in ops_and_kernels: - line += '"%s,"\n' % kernel_class - line += ';' + line += '"%s",\n' % kernel_class + line += '};' append(line) append('#define SHOULD_REGISTER_OP_KERNEL(clz) ' - '(strstr(kNecessaryOpKernelClasses, "," clz ",") != nullptr)') + '(find_in::f(clz, ' + 'kNecessaryOpKernelClasses))') append('') append('#define SHOULD_REGISTER_OP_GRADIENT ' + ( -- GitLab From 0899b36d623d40c1a67d789c9d2b8c6a1f139643 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Tue, 28 Feb 2017 17:49:47 -0800 Subject: [PATCH 069/101] Use best practices junit definition Change: 148839605 --- tensorflow/java/BUILD | 12 ++++++------ tensorflow/workspace.bzl | 32 +++++++++++++++++++++++--------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/tensorflow/java/BUILD b/tensorflow/java/BUILD index cc024cf6c3..78ef152689 100644 --- a/tensorflow/java/BUILD +++ b/tensorflow/java/BUILD @@ -38,7 +38,7 @@ java_test( deps = [ ":tensorflow", ":testutil", - "//external:junit", + "@junit", ], ) @@ -50,7 +50,7 @@ java_test( deps = [ ":tensorflow", ":testutil", - "//external:junit", + "@junit", ], ) @@ -62,7 +62,7 @@ java_test( deps = [ ":tensorflow", ":testutil", - "//external:junit", + "@junit", ], ) @@ -74,7 +74,7 @@ java_test( deps = [ ":tensorflow", ":testutil", - "//external:junit", + "@junit", ], ) @@ -85,7 +85,7 @@ java_test( test_class = "org.tensorflow.TensorFlowTest", deps = [ ":tensorflow", - "//external:junit", + "@junit", ], ) @@ -97,7 +97,7 @@ java_test( deps = [ ":tensorflow", ":testutil", - "//external:junit", + "@junit", ], ) diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl index 246c83931c..4885baf038 100644 --- a/tensorflow/workspace.bzl +++ b/tensorflow/workspace.bzl @@ -1,5 +1,6 @@ # TensorFlow external dependencies that can be loaded in WORKSPACE files. +load("@io_bazel_rules_closure//closure/private:java_import_external.bzl", "java_import_external") load("@io_bazel_rules_closure//closure:defs.bzl", "filegroup_external") load("@io_bazel_rules_closure//closure:defs.bzl", "webfiles_external") load("//third_party/gpus:cuda_configure.bzl", "cuda_configure") @@ -413,16 +414,29 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""): build_file = str(Label("//third_party:nccl.BUILD")), ) - # Make junit-4.12 available as //external:junit - native.maven_jar( - name = "junit_junit", - artifact = "junit:junit:4.12", - sha1 = "2973d150c0dc1fefe998f834810d68f278ea58ec", - ) - - native.bind( + java_import_external( name = "junit", - actual = "@junit_junit//jar", + jar_sha256 = "59721f0805e223d84b90677887d9ff567dc534d7c502ca903c0c2b17f05c116a", + jar_urls = [ + "http://bazel-mirror.storage.googleapis.com/repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar", + "http://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar", + "http://maven.ibiblio.org/maven2/junit/junit/4.12/junit-4.12.jar", + ], + licenses = ["reciprocal"], # Common Public License Version 1.0 + testonly_ = True, + deps = ["@org_hamcrest_core"], + ) + + java_import_external( + name = "org_hamcrest_core", + jar_sha256 = "66fdef91e9739348df7a096aa384a5685f4e875584cce89386a7a47251c4d8e9", + jar_urls = [ + "http://bazel-mirror.storage.googleapis.com/repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar", + "http://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar", + "http://maven.ibiblio.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar", + ], + licenses = ["notice"], # New BSD License + testonly_ = True, ) temp_workaround_http_archive( -- GitLab From 4e63540076921d2c08d03aa9efb76fd483920593 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 18:23:43 -0800 Subject: [PATCH 070/101] Fix typo spooted by #7906 Change: 148842430 --- tensorflow/docs_src/tutorials/layers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/docs_src/tutorials/layers.md b/tensorflow/docs_src/tutorials/layers.md index d7f294a38c..fd305b58ba 100644 --- a/tensorflow/docs_src/tutorials/layers.md +++ b/tensorflow/docs_src/tutorials/layers.md @@ -281,7 +281,7 @@ output of the convolution. Here, we specify ReLU activation with @{tf.nn.relu}. Our output tensor produced by `conv2d()` has a shape of -[batch_size, 28, 28, 1]: the same width and height +[batch_size, 28, 28, 32]: the same width and height dimensions as the input, but now with 32 channels holding the output from each of the filters. -- GitLab From 718812c9e4df55b8b3275aa4db7bb6833ed03111 Mon Sep 17 00:00:00 2001 From: Jonathan Hseu Date: Tue, 28 Feb 2017 18:36:23 -0800 Subject: [PATCH 071/101] Fix the dlopen contrib test hack by making a pywrap_tensorflow module that imports pywrap_tensorflow_internal with RTLD_GLOBAL. Fixes #6568 Change: 148843302 --- .../python/kernel_tests/entropy_test.py | 7 --- .../python/kernel_tests/monte_carlo_test.py | 7 --- .../variational_inference_test.py | 7 --- tensorflow/contrib/cmake/tf_python.cmake | 32 +++++------ .../crf/python/kernel_tests/crf_test.py | 6 --- .../kernel_tests/clustering_ops_test.py | 7 --- .../kernel_tests/masked_matmul_benchmark.py | 7 --- .../kernel_tests/masked_matmul_ops_test.py | 7 --- .../kernel_tests/wals_solver_ops_test.py | 7 --- .../python/ops/factorization_ops_test.py | 6 --- .../factorization/python/ops/gmm_ops_test.py | 6 --- .../factorization/python/ops/gmm_test.py | 7 --- .../python/kernel_tests/grid_rnn_test.py | 7 --- .../python/kernel_tests/image_ops_test.py | 7 --- .../kernel_tests/bucketization_op_test.py | 7 --- .../sparse_feature_cross_op_test.py | 7 --- .../python/layers/embedding_ops_test.py | 5 -- .../layers/python/layers/encoders_test.py | 7 --- .../python/layers/feature_column_ops_test.py | 6 --- .../layers/python/layers/initializers_test.py | 7 --- .../layers/python/layers/layers_test.py | 6 --- .../layers/python/layers/optimizers_test.py | 7 --- .../layers/python/layers/regularizers_test.py | 7 --- .../layers/python/layers/summaries_test.py | 7 --- .../python/layers/target_column_test.py | 7 --- .../layers/python/layers/utils_test.py | 7 --- .../layers/python/ops/sparse_ops_test.py | 7 --- .../learn/python/learn/datasets/base_test.py | 7 --- .../python/learn/datasets/load_csv_test.py | 7 --- .../learn/estimators/composable_model_test.py | 7 --- .../estimators/dnn_linear_combined_test.py | 6 --- .../learn/python/learn/estimators/dnn_test.py | 6 --- .../estimators/dynamic_rnn_estimator_test.py | 6 --- .../python/learn/estimators/estimator_test.py | 9 ---- .../learn/estimators/estimators_test.py | 6 --- .../python/learn/estimators/head_test.py | 6 --- .../python/learn/estimators/kmeans_test.py | 6 --- .../python/learn/estimators/linear_test.py | 6 --- .../estimators/logistic_regressor_test.py | 7 --- .../learn/estimators/multioutput_test.py | 6 --- .../python/learn/estimators/nonlinear_test.py | 6 --- .../learn/estimators/regression_test.py | 7 --- .../learn/estimators/rnn_common_test.py | 7 --- .../learn/estimators/run_config_test.py | 6 --- .../python/learn/estimators/stability_test.py | 6 --- .../state_saving_rnn_estimator_test.py | 6 --- .../learn/python/learn/estimators/svm_test.py | 7 --- .../learn/estimators/tensor_signature_test.py | 7 --- .../learn/python/learn/experiment_test.py | 6 --- .../learn/python/learn/graph_actions_test.py | 6 --- .../learn/python/learn/grid_search_test.py | 6 --- .../python/learn/learn_io/data_feeder_test.py | 7 --- .../python/learn/learn_io/graph_io_test.py | 6 --- .../learn/python/learn/learn_io/io_test.py | 6 --- .../python/learn/learn_io/numpy_io_test.py | 7 --- .../python/learn/learn_io/pandas_io_test.py | 7 --- .../learn/python/learn/learn_runner_test.py | 6 --- .../learn/python/learn/metric_spec_test.py | 6 --- .../learn/python/learn/monitors_test.py | 6 --- .../learn/python/learn/ops/ops_test.py | 7 --- .../python/learn/ops/seq2seq_ops_test.py | 7 --- .../preprocessing/tests/categorical_test.py | 7 --- .../tests/categorical_vocabulary_test.py | 7 --- .../learn/preprocessing/tests/text_test.py | 7 --- .../dataframe/arithmetic_transform_test.py | 7 --- .../learn/tests/dataframe/batch_test.py | 7 --- .../tests/dataframe/binary_transform_test.py | 7 --- .../tests/dataframe/boolean_mask_test.py | 7 --- .../learn/tests/dataframe/csv_parser_test.py | 7 --- .../learn/tests/dataframe/dataframe_test.py | 7 --- .../tests/dataframe/estimator_utils_test.py | 7 --- .../tests/dataframe/feeding_functions_test.py | 6 --- .../dataframe/feeding_queue_runner_test.py | 7 --- .../tests/dataframe/in_memory_source_test.py | 7 --- .../tests/dataframe/reader_source_test.py | 7 --- .../learn/tests/dataframe/series_test.py | 7 --- .../tests/dataframe/sparsify_densify_test.py | 7 --- .../dataframe/tensorflow_dataframe_test.py | 6 --- .../learn/tests/dataframe/transform_test.py | 7 --- .../tests/dataframe/unary_transform_test.py | 7 --- .../learn/python/learn/utils/gc_test.py | 6 --- .../python/kernel_tests/seq2seq_test.py | 6 --- .../python/kernel_tests/sdca_ops_test.py | 6 --- .../contrib/ndlstm/python/lstm1d_test.py | 7 --- .../contrib/ndlstm/python/lstm2d_test.py | 7 --- tensorflow/contrib/ndlstm/python/misc_test.py | 7 --- .../python/kernel_tests/core_rnn_cell_test.py | 6 --- .../rnn/python/kernel_tests/core_rnn_test.py | 6 --- .../kernel_tests/fused_rnn_cell_test.py | 7 --- .../rnn/python/kernel_tests/gru_ops_test.py | 6 --- .../rnn/python/kernel_tests/lstm_ops_test.py | 7 --- .../rnn/python/kernel_tests/rnn_cell_test.py | 6 --- .../rnn/python/kernel_tests/rnn_test.py | 6 --- .../slim/python/slim/nets/alexnet_test.py | 7 --- .../python/slim/nets/inception_v1_test.py | 7 --- .../python/slim/nets/inception_v2_test.py | 7 --- .../python/slim/nets/inception_v3_test.py | 7 --- .../slim/python/slim/nets/overfeat_test.py | 7 --- .../slim/python/slim/nets/resnet_v1_test.py | 7 --- .../slim/python/slim/nets/resnet_v2_test.py | 7 --- .../contrib/slim/python/slim/nets/vgg_test.py | 7 --- tensorflow/contrib/specs/python/specs_test.py | 7 --- .../contrib/specs/python/summaries_test.py | 7 --- .../client/random_forest_test.py | 7 --- .../count_extremely_random_stats_op_test.py | 7 --- .../python/kernel_tests/grow_tree_op_test.py | 7 --- .../kernel_tests/sample_inputs_op_test.py | 7 --- .../kernel_tests/scatter_add_ndim_op_test.py | 7 --- .../python/tensor_forest_test.py | 7 --- .../tools/tfprof/model_analyzer_test.py | 6 --- .../tools/tfprof/print_model_analysis_test.py | 7 --- .../python/tools/tfprof/tfprof_logger_test.py | 7 --- tensorflow/python/BUILD | 9 +++- tensorflow/python/__init__.py | 25 +-------- .../python/framework/file_system_test.py | 6 --- .../python/kernel_tests/conv_ops_test.py | 6 --- tensorflow/python/kernel_tests/rnn_test.py | 6 --- tensorflow/python/pywrap_tensorflow.py | 54 +++++++++++++++++++ tensorflow/tools/pip_package/setup.py | 4 +- 119 files changed, 82 insertions(+), 801 deletions(-) create mode 100644 tensorflow/python/pywrap_tensorflow.py diff --git a/tensorflow/contrib/bayesflow/python/kernel_tests/entropy_test.py b/tensorflow/contrib/bayesflow/python/kernel_tests/entropy_test.py index 57a38bd5f9..d98d4e737c 100644 --- a/tensorflow/contrib/bayesflow/python/kernel_tests/entropy_test.py +++ b/tensorflow/contrib/bayesflow/python/kernel_tests/entropy_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib import distributions as distributions_lib diff --git a/tensorflow/contrib/bayesflow/python/kernel_tests/monte_carlo_test.py b/tensorflow/contrib/bayesflow/python/kernel_tests/monte_carlo_test.py index 12c05e34e4..fd3c79976a 100644 --- a/tensorflow/contrib/bayesflow/python/kernel_tests/monte_carlo_test.py +++ b/tensorflow/contrib/bayesflow/python/kernel_tests/monte_carlo_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib import distributions as distributions_lib from tensorflow.contrib import layers as layers_lib from tensorflow.contrib.bayesflow.python.ops import monte_carlo_impl as monte_carlo_lib diff --git a/tensorflow/contrib/bayesflow/python/kernel_tests/variational_inference_test.py b/tensorflow/contrib/bayesflow/python/kernel_tests/variational_inference_test.py index 12eb66b65d..a46d755897 100644 --- a/tensorflow/contrib/bayesflow/python/kernel_tests/variational_inference_test.py +++ b/tensorflow/contrib/bayesflow/python/kernel_tests/variational_inference_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib import distributions as distributions_lib from tensorflow.contrib import layers from tensorflow.contrib.bayesflow.python.ops import stochastic_tensor diff --git a/tensorflow/contrib/cmake/tf_python.cmake b/tensorflow/contrib/cmake/tf_python.cmake index 7a05d6d265..cf17c6f666 100644 --- a/tensorflow/contrib/cmake/tf_python.cmake +++ b/tensorflow/contrib/cmake/tf_python.cmake @@ -6,7 +6,7 @@ # * No support for tf.contrib. (TODO(mrry): Add rules for building op libraries.) # * No support for Python 3. (TODO(mrry): Add override for FindPythonInterp.) # -# The _pywrap_tensorflow target builds everything. +# The _pywrap_tensorflow_internal target builds everything. ######################################################## # Resolve installed dependencies @@ -545,27 +545,27 @@ find_package(SWIG REQUIRED) # always re-link the Python extension, but we don't have to track the # individual headers on which the SWIG wrapper depends. add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/python/pywrap_tensorflow.py" - "${CMAKE_CURRENT_BINARY_DIR}/pywrap_tensorflow.cc" + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/python/pywrap_tensorflow_internal.py" + "${CMAKE_CURRENT_BINARY_DIR}/pywrap_tensorflow_internal.cc" DEPENDS tf_python_touchup_modules __force_rebuild COMMAND ${SWIG_EXECUTABLE} ARGS -python -c++ -I${tensorflow_source_dir} -I${CMAKE_CURRENT_BINARY_DIR} - -module pywrap_tensorflow + -module pywrap_tensorflow_internal -outdir ${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/python - -o ${CMAKE_CURRENT_BINARY_DIR}/pywrap_tensorflow.cc + -o ${CMAKE_CURRENT_BINARY_DIR}/pywrap_tensorflow_internal.cc -globals '' ${tensorflow_source_dir}/tensorflow/python/tensorflow.i COMMENT "Running SWIG to generate Python wrappers" VERBATIM ) -# pywrap_tensorflow is a shared library containing all of the TensorFlow -# runtime and the standard ops and kernels. These are installed into +# pywrap_tensorflow_internal is a shared library containing all of the +# TensorFlow runtime and the standard ops and kernels. These are installed into # tf_python/tensorflow/python/. # TODO(mrry): Refactor this to expose a framework library that # facilitates `tf.load_op_library()`. -add_library(pywrap_tensorflow SHARED +add_library(pywrap_tensorflow_internal SHARED "${tensorflow_source_dir}/tensorflow/python/client/tf_session_helper.h" "${tensorflow_source_dir}/tensorflow/python/client/tf_session_helper.cc" "${tensorflow_source_dir}/tensorflow/python/framework/cpp_shape_inference.h" @@ -588,7 +588,7 @@ add_library(pywrap_tensorflow SHARED "${tensorflow_source_dir}/tensorflow/c/checkpoint_reader.h" "${tensorflow_source_dir}/tensorflow/c/tf_status_helper.cc" "${tensorflow_source_dir}/tensorflow/c/tf_status_helper.h" - "${CMAKE_CURRENT_BINARY_DIR}/pywrap_tensorflow.cc" + "${CMAKE_CURRENT_BINARY_DIR}/pywrap_tensorflow_internal.cc" $ $ $ @@ -600,11 +600,11 @@ add_library(pywrap_tensorflow SHARED $<$:$> $<$:$> ) -target_include_directories(pywrap_tensorflow PUBLIC +target_include_directories(pywrap_tensorflow_internal PUBLIC ${PYTHON_INCLUDE_DIR} ${NUMPY_INCLUDE_DIR} ) -target_link_libraries(pywrap_tensorflow +target_link_libraries(pywrap_tensorflow_internal ${tf_core_gpu_kernels_lib} ${tensorflow_EXTERNAL_LIBRARIES} tf_protos_cc @@ -617,7 +617,7 @@ target_link_libraries(pywrap_tensorflow ############################################################ add_custom_target(tf_python_build_pip_package) add_dependencies(tf_python_build_pip_package - pywrap_tensorflow + pywrap_tensorflow_internal tensorboard_copy_dependencies tf_python_copy_scripts_to_destination tf_python_touchup_modules @@ -627,12 +627,12 @@ add_custom_command(TARGET tf_python_build_pip_package POST_BUILD ${CMAKE_CURRENT_BINARY_DIR}/tf_python/) if(WIN32) add_custom_command(TARGET tf_python_build_pip_package POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/pywrap_tensorflow.dll - ${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/python/_pywrap_tensorflow.pyd) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/pywrap_tensorflow_internal.dll + ${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/python/_pywrap_tensorflow_internal.pyd) else() add_custom_command(TARGET tf_python_build_pip_package POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/libpywrap_tensorflow.so - ${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/python/_pywrap_tensorflow.so) + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/libpywrap_tensorflow_internal.so + ${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/python/_pywrap_tensorflow_internal.so) endif() add_custom_command(TARGET tf_python_build_pip_package POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${tensorflow_source_dir}/tensorflow/tools/pip_package/README diff --git a/tensorflow/contrib/crf/python/kernel_tests/crf_test.py b/tensorflow/contrib/crf/python/kernel_tests/crf_test.py index ce683ad5ce..448bcafffe 100644 --- a/tensorflow/contrib/crf/python/kernel_tests/crf_test.py +++ b/tensorflow/contrib/crf/python/kernel_tests/crf_test.py @@ -19,15 +19,9 @@ from __future__ import division from __future__ import print_function import itertools -import sys import numpy as np -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.crf.python.ops import crf from tensorflow.python.framework import constant_op from tensorflow.python.ops import array_ops diff --git a/tensorflow/contrib/factorization/python/kernel_tests/clustering_ops_test.py b/tensorflow/contrib/factorization/python/kernel_tests/clustering_ops_test.py index f6d035a2c6..450f64063a 100644 --- a/tensorflow/contrib/factorization/python/kernel_tests/clustering_ops_test.py +++ b/tensorflow/contrib/factorization/python/kernel_tests/clustering_ops_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.factorization.python.ops import clustering_ops diff --git a/tensorflow/contrib/factorization/python/kernel_tests/masked_matmul_benchmark.py b/tensorflow/contrib/factorization/python/kernel_tests/masked_matmul_benchmark.py index 69c1d4dff9..a5d2cbf2cc 100644 --- a/tensorflow/contrib/factorization/python/kernel_tests/masked_matmul_benchmark.py +++ b/tensorflow/contrib/factorization/python/kernel_tests/masked_matmul_benchmark.py @@ -18,14 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - # pylint: disable=g-bad-todo, g-import-not-at-top -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import time from tensorflow.contrib.factorization.python.ops import gen_factorization_ops diff --git a/tensorflow/contrib/factorization/python/kernel_tests/masked_matmul_ops_test.py b/tensorflow/contrib/factorization/python/kernel_tests/masked_matmul_ops_test.py index 97b74eacd4..3a909e2373 100644 --- a/tensorflow/contrib/factorization/python/kernel_tests/masked_matmul_ops_test.py +++ b/tensorflow/contrib/factorization/python/kernel_tests/masked_matmul_ops_test.py @@ -18,14 +18,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - # pylint: disable=g-bad-todo, g-import-not-at-top -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.factorization.python.ops import gen_factorization_ops diff --git a/tensorflow/contrib/factorization/python/kernel_tests/wals_solver_ops_test.py b/tensorflow/contrib/factorization/python/kernel_tests/wals_solver_ops_test.py index 80aee4c904..ba30fd9977 100644 --- a/tensorflow/contrib/factorization/python/kernel_tests/wals_solver_ops_test.py +++ b/tensorflow/contrib/factorization/python/kernel_tests/wals_solver_ops_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.factorization.python.ops import gen_factorization_ops diff --git a/tensorflow/contrib/factorization/python/ops/factorization_ops_test.py b/tensorflow/contrib/factorization/python/ops/factorization_ops_test.py index bbfcfabf40..40b8550ac8 100644 --- a/tensorflow/contrib/factorization/python/ops/factorization_ops_test.py +++ b/tensorflow/contrib/factorization/python/ops/factorization_ops_test.py @@ -19,12 +19,6 @@ from __future__ import division from __future__ import print_function import random -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) import numpy as np from six.moves import xrange # pylint: disable=redefined-builtin diff --git a/tensorflow/contrib/factorization/python/ops/gmm_ops_test.py b/tensorflow/contrib/factorization/python/ops/gmm_ops_test.py index 0c06e4f5d8..df8fc40ffa 100644 --- a/tensorflow/contrib/factorization/python/ops/gmm_ops_test.py +++ b/tensorflow/contrib/factorization/python/ops/gmm_ops_test.py @@ -18,14 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys import time -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from six.moves import xrange # pylint: disable=redefined-builtin diff --git a/tensorflow/contrib/factorization/python/ops/gmm_test.py b/tensorflow/contrib/factorization/python/ops/gmm_test.py index c951a6981f..889d162200 100644 --- a/tensorflow/contrib/factorization/python/ops/gmm_test.py +++ b/tensorflow/contrib/factorization/python/ops/gmm_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from six.moves import xrange # pylint: disable=redefined-builtin diff --git a/tensorflow/contrib/grid_rnn/python/kernel_tests/grid_rnn_test.py b/tensorflow/contrib/grid_rnn/python/kernel_tests/grid_rnn_test.py index e2a5a5556f..758e0bcc07 100644 --- a/tensorflow/contrib/grid_rnn/python/kernel_tests/grid_rnn_test.py +++ b/tensorflow/contrib/grid_rnn/python/kernel_tests/grid_rnn_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.grid_rnn.python.ops import grid_rnn_cell diff --git a/tensorflow/contrib/image/python/kernel_tests/image_ops_test.py b/tensorflow/contrib/image/python/kernel_tests/image_ops_test.py index 4200031028..8ac1ee2a64 100644 --- a/tensorflow/contrib/image/python/kernel_tests/image_ops_test.py +++ b/tensorflow/contrib/image/python/kernel_tests/image_ops_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.image.python.ops import image_ops diff --git a/tensorflow/contrib/layers/python/kernel_tests/bucketization_op_test.py b/tensorflow/contrib/layers/python/kernel_tests/bucketization_op_test.py index 1e0e5ec403..abc6cc5674 100644 --- a/tensorflow/contrib/layers/python/kernel_tests/bucketization_op_test.py +++ b/tensorflow/contrib/layers/python/kernel_tests/bucketization_op_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.layers.python.ops import bucketization_op from tensorflow.python.framework import constant_op from tensorflow.python.framework import errors_impl diff --git a/tensorflow/contrib/layers/python/kernel_tests/sparse_feature_cross_op_test.py b/tensorflow/contrib/layers/python/kernel_tests/sparse_feature_cross_op_test.py index 7f05b7d75d..f701647c2b 100644 --- a/tensorflow/contrib/layers/python/kernel_tests/sparse_feature_cross_op_test.py +++ b/tensorflow/contrib/layers/python/kernel_tests/sparse_feature_cross_op_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy from tensorflow.contrib import layers diff --git a/tensorflow/contrib/layers/python/layers/embedding_ops_test.py b/tensorflow/contrib/layers/python/layers/embedding_ops_test.py index 61b6bc84d7..dfa8067f27 100644 --- a/tensorflow/contrib/layers/python/layers/embedding_ops_test.py +++ b/tensorflow/contrib/layers/python/layers/embedding_ops_test.py @@ -23,11 +23,6 @@ import itertools import math import sys -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.layers.python.layers import embedding_ops diff --git a/tensorflow/contrib/layers/python/layers/encoders_test.py b/tensorflow/contrib/layers/python/layers/encoders_test.py index 7b0e999a3c..e8528e9890 100644 --- a/tensorflow/contrib/layers/python/layers/encoders_test.py +++ b/tensorflow/contrib/layers/python/layers/encoders_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.layers.python.layers import encoders from tensorflow.contrib.layers.python.ops import sparse_ops from tensorflow.python.ops import init_ops diff --git a/tensorflow/contrib/layers/python/layers/feature_column_ops_test.py b/tensorflow/contrib/layers/python/layers/feature_column_ops_test.py index f074bf8f27..6624f201c1 100644 --- a/tensorflow/contrib/layers/python/layers/feature_column_ops_test.py +++ b/tensorflow/contrib/layers/python/layers/feature_column_ops_test.py @@ -19,12 +19,6 @@ from __future__ import division from __future__ import print_function import os -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) import numpy as np diff --git a/tensorflow/contrib/layers/python/layers/initializers_test.py b/tensorflow/contrib/layers/python/layers/initializers_test.py index fe044f4bb7..b7fe878893 100644 --- a/tensorflow/contrib/layers/python/layers/initializers_test.py +++ b/tensorflow/contrib/layers/python/layers/initializers_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib import layers diff --git a/tensorflow/contrib/layers/python/layers/layers_test.py b/tensorflow/contrib/layers/python/layers/layers_test.py index ffdc4d9e6d..1ba0534b5d 100644 --- a/tensorflow/contrib/layers/python/layers/layers_test.py +++ b/tensorflow/contrib/layers/python/layers/layers_test.py @@ -19,12 +19,6 @@ from __future__ import division from __future__ import print_function import math -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) import numpy as np diff --git a/tensorflow/contrib/layers/python/layers/optimizers_test.py b/tensorflow/contrib/layers/python/layers/optimizers_test.py index d048a99047..b88843aa46 100644 --- a/tensorflow/contrib/layers/python/layers/optimizers_test.py +++ b/tensorflow/contrib/layers/python/layers/optimizers_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.layers.python.layers import optimizers as optimizers_lib diff --git a/tensorflow/contrib/layers/python/layers/regularizers_test.py b/tensorflow/contrib/layers/python/layers/regularizers_test.py index 89a5557aa2..d7a233835d 100644 --- a/tensorflow/contrib/layers/python/layers/regularizers_test.py +++ b/tensorflow/contrib/layers/python/layers/regularizers_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.layers.python.layers import regularizers diff --git a/tensorflow/contrib/layers/python/layers/summaries_test.py b/tensorflow/contrib/layers/python/layers/summaries_test.py index 6f3690b7d6..a1ef06feec 100644 --- a/tensorflow/contrib/layers/python/layers/summaries_test.py +++ b/tensorflow/contrib/layers/python/layers/summaries_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.layers.python.layers import summaries as summaries_lib from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops diff --git a/tensorflow/contrib/layers/python/layers/target_column_test.py b/tensorflow/contrib/layers/python/layers/target_column_test.py index 31defe5517..1baa663151 100644 --- a/tensorflow/contrib/layers/python/layers/target_column_test.py +++ b/tensorflow/contrib/layers/python/layers/target_column_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.layers.python.layers import target_column as target_column_lib from tensorflow.python.client import session from tensorflow.python.framework import constant_op diff --git a/tensorflow/contrib/layers/python/layers/utils_test.py b/tensorflow/contrib/layers/python/layers/utils_test.py index 0bea3e779a..6e35f63256 100644 --- a/tensorflow/contrib/layers/python/layers/utils_test.py +++ b/tensorflow/contrib/layers/python/layers/utils_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.layers.python.layers import utils diff --git a/tensorflow/contrib/layers/python/ops/sparse_ops_test.py b/tensorflow/contrib/layers/python/ops/sparse_ops_test.py index 664f7e3c1f..b27174e437 100644 --- a/tensorflow/contrib/layers/python/ops/sparse_ops_test.py +++ b/tensorflow/contrib/layers/python/ops/sparse_ops_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.layers.python.ops import sparse_ops diff --git a/tensorflow/contrib/learn/python/learn/datasets/base_test.py b/tensorflow/contrib/learn/python/learn/datasets/base_test.py index 6a8abcbd25..bc60d3797d 100644 --- a/tensorflow/contrib/learn/python/learn/datasets/base_test.py +++ b/tensorflow/contrib/learn/python/learn/datasets/base_test.py @@ -17,13 +17,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.learn.python.learn.datasets import base from tensorflow.python.platform import test diff --git a/tensorflow/contrib/learn/python/learn/datasets/load_csv_test.py b/tensorflow/contrib/learn/python/learn/datasets/load_csv_test.py index 6683193a8b..9a62feac57 100644 --- a/tensorflow/contrib/learn/python/learn/datasets/load_csv_test.py +++ b/tensorflow/contrib/learn/python/learn/datasets/load_csv_test.py @@ -17,13 +17,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.learn.python.learn import datasets from tensorflow.python.platform import test diff --git a/tensorflow/contrib/learn/python/learn/estimators/composable_model_test.py b/tensorflow/contrib/learn/python/learn/estimators/composable_model_test.py index fe1812c61b..d5de734d2b 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/composable_model_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/composable_model_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.framework.python.ops import variables as contrib_variables from tensorflow.contrib.layers.python.layers import feature_column from tensorflow.contrib.learn.python.learn.datasets import base diff --git a/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined_test.py b/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined_test.py index 01e14c32e5..c081587f67 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined_test.py @@ -20,14 +20,8 @@ from __future__ import print_function import functools import json -import sys import tempfile -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.framework.python.ops import variables diff --git a/tensorflow/contrib/learn/python/learn/estimators/dnn_test.py b/tensorflow/contrib/learn/python/learn/estimators/dnn_test.py index b244b02e3f..465548fbf2 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/dnn_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/dnn_test.py @@ -20,14 +20,8 @@ from __future__ import print_function import functools import json -import sys import tempfile -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.layers.python.layers import feature_column diff --git a/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator_test.py b/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator_test.py index 443d336214..c0d5933d48 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator_test.py @@ -18,14 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys import tempfile -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib import rnn diff --git a/tensorflow/contrib/learn/python/learn/estimators/estimator_test.py b/tensorflow/contrib/learn/python/learn/estimators/estimator_test.py index 2bf710ba1c..4edbfeed20 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/estimator_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/estimator_test.py @@ -22,17 +22,8 @@ import functools import itertools import json import os -import sys import tempfile -# pylint: disable=g-bad-todo -# TODO(#6568): Remove this hack that makes dlopen() not crash. -# pylint: enable=g-bad-todo -# pylint: disable=g-import-not-at-top -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np import six from six.moves import xrange # pylint: disable=redefined-builtin diff --git a/tensorflow/contrib/learn/python/learn/estimators/estimators_test.py b/tensorflow/contrib/learn/python/learn/estimators/estimators_test.py index 7372bb7a1a..5feae53cdd 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/estimators_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/estimators_test.py @@ -19,12 +19,6 @@ from __future__ import division from __future__ import print_function import random -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) import numpy as np diff --git a/tensorflow/contrib/learn/python/learn/estimators/head_test.py b/tensorflow/contrib/learn/python/learn/estimators/head_test.py index 725e4f72cd..ef7b8ea9b2 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/head_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/head_test.py @@ -19,14 +19,8 @@ from __future__ import division from __future__ import print_function import math -import sys # pylint: disable=g-bad-todo,g-import-not-at-top -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np import six diff --git a/tensorflow/contrib/learn/python/learn/estimators/kmeans_test.py b/tensorflow/contrib/learn/python/learn/estimators/kmeans_test.py index 7a0b778839..e5c01336cf 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/kmeans_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/kmeans_test.py @@ -19,18 +19,12 @@ from __future__ import division from __future__ import print_function import math -import sys import time import numpy as np from sklearn.cluster import KMeans as SklearnKMeans # pylint: disable=g-import-not-at-top -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.learn.python import learn from tensorflow.contrib.learn.python.learn.estimators import kmeans as kmeans_lib from tensorflow.contrib.learn.python.learn.estimators import run_config diff --git a/tensorflow/contrib/learn/python/learn/estimators/linear_test.py b/tensorflow/contrib/learn/python/learn/estimators/linear_test.py index ef5bd0175c..7a32b9d9b4 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/linear_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/linear_test.py @@ -20,14 +20,8 @@ from __future__ import print_function import functools import json -import sys import tempfile -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.layers.python.layers import feature_column as feature_column_lib diff --git a/tensorflow/contrib/learn/python/learn/estimators/logistic_regressor_test.py b/tensorflow/contrib/learn/python/learn/estimators/logistic_regressor_test.py index b2749b3d37..021918f0ef 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/logistic_regressor_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/logistic_regressor_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib import layers diff --git a/tensorflow/contrib/learn/python/learn/estimators/multioutput_test.py b/tensorflow/contrib/learn/python/learn/estimators/multioutput_test.py index 11a096e423..325c543a08 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/multioutput_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/multioutput_test.py @@ -19,12 +19,6 @@ from __future__ import division from __future__ import print_function import random -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) import numpy as np diff --git a/tensorflow/contrib/learn/python/learn/estimators/nonlinear_test.py b/tensorflow/contrib/learn/python/learn/estimators/nonlinear_test.py index 3366ce564a..85765c6598 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/nonlinear_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/nonlinear_test.py @@ -19,12 +19,6 @@ from __future__ import division from __future__ import print_function import random -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) from tensorflow.contrib.layers.python.layers import feature_column from tensorflow.contrib.learn.python.learn.datasets import base diff --git a/tensorflow/contrib/learn/python/learn/estimators/regression_test.py b/tensorflow/contrib/learn/python/learn/estimators/regression_test.py index 2f6b33dc0c..6a57caaa8e 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/regression_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/regression_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python import learn diff --git a/tensorflow/contrib/learn/python/learn/estimators/rnn_common_test.py b/tensorflow/contrib/learn/python/learn/estimators/rnn_common_test.py index 1cb63995dd..82563141cc 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/rnn_common_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/rnn_common_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn.estimators import rnn_common diff --git a/tensorflow/contrib/learn/python/learn/estimators/run_config_test.py b/tensorflow/contrib/learn/python/learn/estimators/run_config_test.py index 4824651842..9b7a013705 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/run_config_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/run_config_test.py @@ -19,12 +19,6 @@ from __future__ import division from __future__ import print_function import json -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) from tensorflow.contrib.learn.python.learn import run_config from tensorflow.contrib.learn.python.learn.estimators import run_config as run_config_lib diff --git a/tensorflow/contrib/learn/python/learn/estimators/stability_test.py b/tensorflow/contrib/learn/python/learn/estimators/stability_test.py index 859e98e45a..d69ed494b6 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/stability_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/stability_test.py @@ -19,12 +19,6 @@ from __future__ import division from __future__ import print_function import random -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) from tensorflow.contrib.framework.python.ops import variables from tensorflow.contrib.layers.python.layers import feature_column diff --git a/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator_test.py b/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator_test.py index efbe445c6d..643a7d987b 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/state_saving_rnn_estimator_test.py @@ -18,14 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys import tempfile -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib import lookup diff --git a/tensorflow/contrib/learn/python/learn/estimators/svm_test.py b/tensorflow/contrib/learn/python/learn/estimators/svm_test.py index 277148cabb..ccb33cae1e 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/svm_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/svm_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.layers.python.layers import feature_column from tensorflow.contrib.learn.python.learn.estimators import svm from tensorflow.python.framework import constant_op diff --git a/tensorflow/contrib/learn/python/learn/estimators/tensor_signature_test.py b/tensorflow/contrib/learn/python/learn/estimators/tensor_signature_test.py index 178c1180da..26c2b7840f 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/tensor_signature_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/tensor_signature_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.learn.python.learn.estimators import tensor_signature from tensorflow.python.framework import dtypes from tensorflow.python.framework import sparse_tensor diff --git a/tensorflow/contrib/learn/python/learn/experiment_test.py b/tensorflow/contrib/learn/python/learn/experiment_test.py index 9bed98de2d..5fdb8ba08e 100644 --- a/tensorflow/contrib/learn/python/learn/experiment_test.py +++ b/tensorflow/contrib/learn/python/learn/experiment_test.py @@ -19,15 +19,9 @@ from __future__ import print_function import json import os -import sys import tempfile import threading -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.learn.python.learn import evaluable from tensorflow.contrib.learn.python.learn import experiment from tensorflow.contrib.learn.python.learn import monitors diff --git a/tensorflow/contrib/learn/python/learn/graph_actions_test.py b/tensorflow/contrib/learn/python/learn/graph_actions_test.py index 1f131516d5..2aeddfd84a 100644 --- a/tensorflow/contrib/learn/python/learn/graph_actions_test.py +++ b/tensorflow/contrib/learn/python/learn/graph_actions_test.py @@ -19,14 +19,8 @@ from __future__ import division from __future__ import print_function import shutil -import sys import tempfile -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib import testing from tensorflow.contrib.framework.python.framework import checkpoint_utils from tensorflow.contrib.framework.python.ops import variables as variables_lib diff --git a/tensorflow/contrib/learn/python/learn/grid_search_test.py b/tensorflow/contrib/learn/python/learn/grid_search_test.py index f16496380a..b7c3e21dee 100644 --- a/tensorflow/contrib/learn/python/learn/grid_search_test.py +++ b/tensorflow/contrib/learn/python/learn/grid_search_test.py @@ -20,12 +20,6 @@ from __future__ import print_function import os import random -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) from tensorflow.contrib.learn.python import learn from tensorflow.python.platform import test diff --git a/tensorflow/contrib/learn/python/learn/learn_io/data_feeder_test.py b/tensorflow/contrib/learn/python/learn/learn_io/data_feeder_test.py index 7f5711ac1b..eaf6ae4ed7 100644 --- a/tensorflow/contrib/learn/python/learn/learn_io/data_feeder_test.py +++ b/tensorflow/contrib/learn/python/learn/learn_io/data_feeder_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np import six from six.moves import xrange # pylint: disable=redefined-builtin diff --git a/tensorflow/contrib/learn/python/learn/learn_io/graph_io_test.py b/tensorflow/contrib/learn/python/learn/learn_io/graph_io_test.py index 0f7307e406..137ccb91d8 100644 --- a/tensorflow/contrib/learn/python/learn/learn_io/graph_io_test.py +++ b/tensorflow/contrib/learn/python/learn/learn_io/graph_io_test.py @@ -21,14 +21,8 @@ from __future__ import print_function import base64 import os import random -import sys import tempfile -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from six.moves import xrange # pylint: disable=redefined-builtin from tensorflow.contrib.learn.python.learn.learn_io import graph_io diff --git a/tensorflow/contrib/learn/python/learn/learn_io/io_test.py b/tensorflow/contrib/learn/python/learn/learn_io/io_test.py index d3c582c9f9..678f80c45c 100644 --- a/tensorflow/contrib/learn/python/learn/learn_io/io_test.py +++ b/tensorflow/contrib/learn/python/learn/learn_io/io_test.py @@ -19,12 +19,6 @@ from __future__ import division from __future__ import print_function import random -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) # pylint: disable=wildcard-import from tensorflow.contrib.learn.python import learn diff --git a/tensorflow/contrib/learn/python/learn/learn_io/numpy_io_test.py b/tensorflow/contrib/learn/python/learn/learn_io/numpy_io_test.py index 350506af63..2ac384d5f6 100644 --- a/tensorflow/contrib/learn/python/learn/learn_io/numpy_io_test.py +++ b/tensorflow/contrib/learn/python/learn/learn_io/numpy_io_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn.learn_io import numpy_io diff --git a/tensorflow/contrib/learn/python/learn/learn_io/pandas_io_test.py b/tensorflow/contrib/learn/python/learn/learn_io/pandas_io_test.py index b020831495..c738f0e8f3 100644 --- a/tensorflow/contrib/learn/python/learn/learn_io/pandas_io_test.py +++ b/tensorflow/contrib/learn/python/learn/learn_io/pandas_io_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn.learn_io import pandas_io diff --git a/tensorflow/contrib/learn/python/learn/learn_runner_test.py b/tensorflow/contrib/learn/python/learn/learn_runner_test.py index 31e0dd561d..1afd6a5c82 100644 --- a/tensorflow/contrib/learn/python/learn/learn_runner_test.py +++ b/tensorflow/contrib/learn/python/learn/learn_runner_test.py @@ -20,12 +20,6 @@ from __future__ import print_function import json import os -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) from tensorflow.contrib.learn.python.learn import evaluable # pylint: disable=g-import-not-at-top from tensorflow.contrib.learn.python.learn import experiment diff --git a/tensorflow/contrib/learn/python/learn/metric_spec_test.py b/tensorflow/contrib/learn/python/learn/metric_spec_test.py index 7df5aa5b38..8d578174ad 100644 --- a/tensorflow/contrib/learn/python/learn/metric_spec_test.py +++ b/tensorflow/contrib/learn/python/learn/metric_spec_test.py @@ -19,14 +19,8 @@ from __future__ import division from __future__ import print_function import functools -import sys # pylint: disable=g-bad-todo,g-import-not-at-top -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.learn.python.learn.metric_spec import MetricSpec from tensorflow.python.platform import test diff --git a/tensorflow/contrib/learn/python/learn/monitors_test.py b/tensorflow/contrib/learn/python/learn/monitors_test.py index 6f310c27db..f9ee03c944 100644 --- a/tensorflow/contrib/learn/python/learn/monitors_test.py +++ b/tensorflow/contrib/learn/python/learn/monitors_test.py @@ -20,15 +20,9 @@ from __future__ import print_function import collections import shutil -import sys import tempfile import time -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from six.moves import xrange # pylint: disable=redefined-builtin from tensorflow.contrib import testing diff --git a/tensorflow/contrib/learn/python/learn/ops/ops_test.py b/tensorflow/contrib/learn/python/learn/ops/ops_test.py index dd145b9900..d0b9eb8abc 100644 --- a/tensorflow/contrib/learn/python/learn/ops/ops_test.py +++ b/tensorflow/contrib/learn/python/learn/ops/ops_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.layers import conv2d diff --git a/tensorflow/contrib/learn/python/learn/ops/seq2seq_ops_test.py b/tensorflow/contrib/learn/python/learn/ops/seq2seq_ops_test.py index 10e9e88370..a9116c2d54 100644 --- a/tensorflow/contrib/learn/python/learn/ops/seq2seq_ops_test.py +++ b/tensorflow/contrib/learn/python/learn/ops/seq2seq_ops_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn import ops diff --git a/tensorflow/contrib/learn/python/learn/preprocessing/tests/categorical_test.py b/tensorflow/contrib/learn/python/learn/preprocessing/tests/categorical_test.py index 77c9140999..4e9cb9df62 100644 --- a/tensorflow/contrib/learn/python/learn/preprocessing/tests/categorical_test.py +++ b/tensorflow/contrib/learn/python/learn/preprocessing/tests/categorical_test.py @@ -20,13 +20,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn.learn_io import HAS_PANDAS diff --git a/tensorflow/contrib/learn/python/learn/preprocessing/tests/categorical_vocabulary_test.py b/tensorflow/contrib/learn/python/learn/preprocessing/tests/categorical_vocabulary_test.py index 454083e64f..54e90ddd70 100644 --- a/tensorflow/contrib/learn/python/learn/preprocessing/tests/categorical_vocabulary_test.py +++ b/tensorflow/contrib/learn/python/learn/preprocessing/tests/categorical_vocabulary_test.py @@ -19,13 +19,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.learn.python.learn.preprocessing import categorical_vocabulary from tensorflow.python.platform import test diff --git a/tensorflow/contrib/learn/python/learn/preprocessing/tests/text_test.py b/tensorflow/contrib/learn/python/learn/preprocessing/tests/text_test.py index bbf2e0dac6..e9555140d0 100644 --- a/tensorflow/contrib/learn/python/learn/preprocessing/tests/text_test.py +++ b/tensorflow/contrib/learn/python/learn/preprocessing/tests/text_test.py @@ -20,13 +20,6 @@ from __future__ import division from __future__ import print_function from __future__ import unicode_literals -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.learn.python.learn.preprocessing import CategoricalVocabulary from tensorflow.contrib.learn.python.learn.preprocessing import text from tensorflow.python.platform import test diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/arithmetic_transform_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/arithmetic_transform_test.py index a04c3b6904..21aae5f739 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/arithmetic_transform_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/arithmetic_transform_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn.dataframe import tensorflow_dataframe as df diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/batch_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/batch_test.py index 9de6367dac..596f256869 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/batch_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/batch_test.py @@ -17,13 +17,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn.dataframe.transforms import batch diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/binary_transform_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/binary_transform_test.py index c21574cf8e..f8602ff227 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/binary_transform_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/binary_transform_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn.dataframe import tensorflow_dataframe as df diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/boolean_mask_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/boolean_mask_test.py index fdf8edbf9f..218ef4db2e 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/boolean_mask_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/boolean_mask_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn.tests.dataframe import mocks diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/csv_parser_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/csv_parser_test.py index 4c4083aade..80ace7c3b7 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/csv_parser_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/csv_parser_test.py @@ -17,13 +17,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn.dataframe.transforms import csv_parser diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/dataframe_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/dataframe_test.py index a4beffb559..e92696cc97 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/dataframe_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/dataframe_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.learn.python import learn from tensorflow.contrib.learn.python.learn.tests.dataframe import mocks from tensorflow.python.framework import dtypes diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/estimator_utils_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/estimator_utils_test.py index 325d0beca1..17a556db1b 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/estimator_utils_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/estimator_utils_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.layers import feature_column from tensorflow.contrib.learn.python import learn from tensorflow.contrib.learn.python.learn.dataframe import estimator_utils diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/feeding_functions_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/feeding_functions_test.py index 5ab72a3d5e..6d83ca7409 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/feeding_functions_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/feeding_functions_test.py @@ -19,12 +19,6 @@ from __future__ import division from __future__ import print_function import collections -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) import numpy as np diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/feeding_queue_runner_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/feeding_queue_runner_test.py index 125a3e13d5..247e8099ff 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/feeding_queue_runner_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/feeding_queue_runner_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn.dataframe.queues import feeding_functions as ff diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/in_memory_source_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/in_memory_source_test.py index c5147e2768..fd344dcd09 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/in_memory_source_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/in_memory_source_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn.dataframe.transforms import in_memory_source diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/reader_source_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/reader_source_test.py index 74f6bfd5c6..e7d46a1ce6 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/reader_source_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/reader_source_test.py @@ -17,13 +17,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - # pylint: disable=g-import-not-at-top from tensorflow.contrib.learn.python.learn.dataframe.transforms import reader_source as rs from tensorflow.python.ops import io_ops diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/series_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/series_test.py index bfef2b173a..c9e062efe6 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/series_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/series_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.learn.python import learn from tensorflow.contrib.learn.python.learn.tests.dataframe import mocks from tensorflow.python.framework import dtypes diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/sparsify_densify_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/sparsify_densify_test.py index 7f526e0309..944024d8a2 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/sparsify_densify_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/sparsify_densify_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn.dataframe.transforms import densify diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/tensorflow_dataframe_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/tensorflow_dataframe_test.py index d294b60568..c164a12b1d 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/tensorflow_dataframe_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/tensorflow_dataframe_test.py @@ -20,14 +20,8 @@ from __future__ import print_function import csv import math -import sys import tempfile -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn.dataframe import tensorflow_dataframe as df diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/transform_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/transform_test.py index a2f2217166..2bca38415a 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/transform_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/transform_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.learn.python import learn from tensorflow.contrib.learn.python.learn.dataframe.transform import _make_list_of_series from tensorflow.contrib.learn.python.learn.tests.dataframe import mocks diff --git a/tensorflow/contrib/learn/python/learn/tests/dataframe/unary_transform_test.py b/tensorflow/contrib/learn/python/learn/tests/dataframe/unary_transform_test.py index 6dd26cfc8d..bf74b67a0e 100644 --- a/tensorflow/contrib/learn/python/learn/tests/dataframe/unary_transform_test.py +++ b/tensorflow/contrib/learn/python/learn/tests/dataframe/unary_transform_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn.dataframe import tensorflow_dataframe as df diff --git a/tensorflow/contrib/learn/python/learn/utils/gc_test.py b/tensorflow/contrib/learn/python/learn/utils/gc_test.py index 07c7f7138f..d3270dcc16 100644 --- a/tensorflow/contrib/learn/python/learn/utils/gc_test.py +++ b/tensorflow/contrib/learn/python/learn/utils/gc_test.py @@ -20,12 +20,6 @@ from __future__ import print_function import os import re -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) from six.moves import xrange # pylint: disable=redefined-builtin diff --git a/tensorflow/contrib/legacy_seq2seq/python/kernel_tests/seq2seq_test.py b/tensorflow/contrib/legacy_seq2seq/python/kernel_tests/seq2seq_test.py index 5d77593619..d71cfd4669 100644 --- a/tensorflow/contrib/legacy_seq2seq/python/kernel_tests/seq2seq_test.py +++ b/tensorflow/contrib/legacy_seq2seq/python/kernel_tests/seq2seq_test.py @@ -21,12 +21,6 @@ from __future__ import print_function import functools import math import random -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) import numpy as np diff --git a/tensorflow/contrib/linear_optimizer/python/kernel_tests/sdca_ops_test.py b/tensorflow/contrib/linear_optimizer/python/kernel_tests/sdca_ops_test.py index 71217f8060..eb1bdeff59 100644 --- a/tensorflow/contrib/linear_optimizer/python/kernel_tests/sdca_ops_test.py +++ b/tensorflow/contrib/linear_optimizer/python/kernel_tests/sdca_ops_test.py @@ -18,14 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys import threading -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.linear_optimizer.python.ops.sdca_ops import SdcaModel from tensorflow.contrib.linear_optimizer.python.ops.sparse_feature_column import SparseFeatureColumn from tensorflow.core.example import example_pb2 diff --git a/tensorflow/contrib/ndlstm/python/lstm1d_test.py b/tensorflow/contrib/ndlstm/python/lstm1d_test.py index 6b907295ff..49b15cc814 100644 --- a/tensorflow/contrib/ndlstm/python/lstm1d_test.py +++ b/tensorflow/contrib/ndlstm/python/lstm1d_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.ndlstm.python import lstm1d as lstm1d_lib diff --git a/tensorflow/contrib/ndlstm/python/lstm2d_test.py b/tensorflow/contrib/ndlstm/python/lstm2d_test.py index 23d75898e1..3dbbb81796 100644 --- a/tensorflow/contrib/ndlstm/python/lstm2d_test.py +++ b/tensorflow/contrib/ndlstm/python/lstm2d_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.ndlstm.python import lstm2d as lstm2d_lib diff --git a/tensorflow/contrib/ndlstm/python/misc_test.py b/tensorflow/contrib/ndlstm/python/misc_test.py index 5ee29f302f..fac9023da3 100644 --- a/tensorflow/contrib/ndlstm/python/misc_test.py +++ b/tensorflow/contrib/ndlstm/python/misc_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.ndlstm.python import misc as misc_lib diff --git a/tensorflow/contrib/rnn/python/kernel_tests/core_rnn_cell_test.py b/tensorflow/contrib/rnn/python/kernel_tests/core_rnn_cell_test.py index b38f08d4d5..a86a8648f6 100644 --- a/tensorflow/contrib/rnn/python/kernel_tests/core_rnn_cell_test.py +++ b/tensorflow/contrib/rnn/python/kernel_tests/core_rnn_cell_test.py @@ -19,12 +19,6 @@ from __future__ import division from __future__ import print_function import functools -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) import numpy as np diff --git a/tensorflow/contrib/rnn/python/kernel_tests/core_rnn_test.py b/tensorflow/contrib/rnn/python/kernel_tests/core_rnn_test.py index 85c3b057b8..a6b599a988 100644 --- a/tensorflow/contrib/rnn/python/kernel_tests/core_rnn_test.py +++ b/tensorflow/contrib/rnn/python/kernel_tests/core_rnn_test.py @@ -19,12 +19,6 @@ from __future__ import division from __future__ import print_function import itertools -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) import numpy as np from six.moves import xrange # pylint: disable=redefined-builtin diff --git a/tensorflow/contrib/rnn/python/kernel_tests/fused_rnn_cell_test.py b/tensorflow/contrib/rnn/python/kernel_tests/fused_rnn_cell_test.py index 0233320bf0..a656831c02 100644 --- a/tensorflow/contrib/rnn/python/kernel_tests/fused_rnn_cell_test.py +++ b/tensorflow/contrib/rnn/python/kernel_tests/fused_rnn_cell_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.rnn.python.ops import core_rnn diff --git a/tensorflow/contrib/rnn/python/kernel_tests/gru_ops_test.py b/tensorflow/contrib/rnn/python/kernel_tests/gru_ops_test.py index f842c7c643..4247aeb839 100644 --- a/tensorflow/contrib/rnn/python/kernel_tests/gru_ops_test.py +++ b/tensorflow/contrib/rnn/python/kernel_tests/gru_ops_test.py @@ -18,14 +18,8 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys import time -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.rnn.python.ops import core_rnn_cell_impl diff --git a/tensorflow/contrib/rnn/python/kernel_tests/lstm_ops_test.py b/tensorflow/contrib/rnn/python/kernel_tests/lstm_ops_test.py index 6c73d458a2..9a96d4e856 100644 --- a/tensorflow/contrib/rnn/python/kernel_tests/lstm_ops_test.py +++ b/tensorflow/contrib/rnn/python/kernel_tests/lstm_ops_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.rnn.python.ops import core_rnn diff --git a/tensorflow/contrib/rnn/python/kernel_tests/rnn_cell_test.py b/tensorflow/contrib/rnn/python/kernel_tests/rnn_cell_test.py index 43732e12d2..ec0291cd7a 100644 --- a/tensorflow/contrib/rnn/python/kernel_tests/rnn_cell_test.py +++ b/tensorflow/contrib/rnn/python/kernel_tests/rnn_cell_test.py @@ -19,12 +19,6 @@ from __future__ import division from __future__ import print_function import itertools -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) import numpy as np diff --git a/tensorflow/contrib/rnn/python/kernel_tests/rnn_test.py b/tensorflow/contrib/rnn/python/kernel_tests/rnn_test.py index 444dd70ab0..5f96c565e8 100644 --- a/tensorflow/contrib/rnn/python/kernel_tests/rnn_test.py +++ b/tensorflow/contrib/rnn/python/kernel_tests/rnn_test.py @@ -19,12 +19,6 @@ from __future__ import division from __future__ import print_function import itertools -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) import numpy as np diff --git a/tensorflow/contrib/slim/python/slim/nets/alexnet_test.py b/tensorflow/contrib/slim/python/slim/nets/alexnet_test.py index ec880fa759..eb93f753ae 100644 --- a/tensorflow/contrib/slim/python/slim/nets/alexnet_test.py +++ b/tensorflow/contrib/slim/python/slim/nets/alexnet_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.framework.python.ops import variables as variables_lib from tensorflow.contrib.slim.python.slim.nets import alexnet from tensorflow.python.ops import math_ops diff --git a/tensorflow/contrib/slim/python/slim/nets/inception_v1_test.py b/tensorflow/contrib/slim/python/slim/nets/inception_v1_test.py index 8d21f3605b..7a3d1c9703 100644 --- a/tensorflow/contrib/slim/python/slim/nets/inception_v1_test.py +++ b/tensorflow/contrib/slim/python/slim/nets/inception_v1_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.framework.python.ops import arg_scope diff --git a/tensorflow/contrib/slim/python/slim/nets/inception_v2_test.py b/tensorflow/contrib/slim/python/slim/nets/inception_v2_test.py index 34a7cc9478..5fbc9e5aa3 100644 --- a/tensorflow/contrib/slim/python/slim/nets/inception_v2_test.py +++ b/tensorflow/contrib/slim/python/slim/nets/inception_v2_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.framework.python.ops import arg_scope diff --git a/tensorflow/contrib/slim/python/slim/nets/inception_v3_test.py b/tensorflow/contrib/slim/python/slim/nets/inception_v3_test.py index 41b17f4ecb..6ba02318ed 100644 --- a/tensorflow/contrib/slim/python/slim/nets/inception_v3_test.py +++ b/tensorflow/contrib/slim/python/slim/nets/inception_v3_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.framework.python.ops import arg_scope diff --git a/tensorflow/contrib/slim/python/slim/nets/overfeat_test.py b/tensorflow/contrib/slim/python/slim/nets/overfeat_test.py index c519ca9782..317af3cb29 100644 --- a/tensorflow/contrib/slim/python/slim/nets/overfeat_test.py +++ b/tensorflow/contrib/slim/python/slim/nets/overfeat_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.framework.python.ops import variables as variables_lib from tensorflow.contrib.slim.python.slim.nets import overfeat from tensorflow.python.ops import math_ops diff --git a/tensorflow/contrib/slim/python/slim/nets/resnet_v1_test.py b/tensorflow/contrib/slim/python/slim/nets/resnet_v1_test.py index 5d5e6ed89e..cb701c42c5 100644 --- a/tensorflow/contrib/slim/python/slim/nets/resnet_v1_test.py +++ b/tensorflow/contrib/slim/python/slim/nets/resnet_v1_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib import layers diff --git a/tensorflow/contrib/slim/python/slim/nets/resnet_v2_test.py b/tensorflow/contrib/slim/python/slim/nets/resnet_v2_test.py index b33b7921ab..e9437bb85a 100644 --- a/tensorflow/contrib/slim/python/slim/nets/resnet_v2_test.py +++ b/tensorflow/contrib/slim/python/slim/nets/resnet_v2_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib import layers diff --git a/tensorflow/contrib/slim/python/slim/nets/vgg_test.py b/tensorflow/contrib/slim/python/slim/nets/vgg_test.py index 317aca00ef..36628b32d1 100644 --- a/tensorflow/contrib/slim/python/slim/nets/vgg_test.py +++ b/tensorflow/contrib/slim/python/slim/nets/vgg_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.framework.python.ops import variables as variables_lib from tensorflow.contrib.slim.python.slim.nets import vgg from tensorflow.python.framework import ops diff --git a/tensorflow/contrib/specs/python/specs_test.py b/tensorflow/contrib/specs/python/specs_test.py index 7004ca2e63..41782a9fc9 100644 --- a/tensorflow/contrib/specs/python/specs_test.py +++ b/tensorflow/contrib/specs/python/specs_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.specs import python diff --git a/tensorflow/contrib/specs/python/summaries_test.py b/tensorflow/contrib/specs/python/summaries_test.py index 090b4d2361..34ff4bc8ca 100644 --- a/tensorflow/contrib/specs/python/summaries_test.py +++ b/tensorflow/contrib/specs/python/summaries_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.specs.python import specs diff --git a/tensorflow/contrib/tensor_forest/client/random_forest_test.py b/tensorflow/contrib/tensor_forest/client/random_forest_test.py index 1e774dab2b..e78c772af3 100644 --- a/tensorflow/contrib/tensor_forest/client/random_forest_test.py +++ b/tensorflow/contrib/tensor_forest/client/random_forest_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - import numpy as np from tensorflow.contrib.learn.python.learn.datasets import base diff --git a/tensorflow/contrib/tensor_forest/python/kernel_tests/count_extremely_random_stats_op_test.py b/tensorflow/contrib/tensor_forest/python/kernel_tests/count_extremely_random_stats_op_test.py index 28a4983407..351245fbdd 100644 --- a/tensorflow/contrib/tensor_forest/python/kernel_tests/count_extremely_random_stats_op_test.py +++ b/tensorflow/contrib/tensor_forest/python/kernel_tests/count_extremely_random_stats_op_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.tensor_forest.python.ops import data_ops from tensorflow.contrib.tensor_forest.python.ops import tensor_forest_ops diff --git a/tensorflow/contrib/tensor_forest/python/kernel_tests/grow_tree_op_test.py b/tensorflow/contrib/tensor_forest/python/kernel_tests/grow_tree_op_test.py index 6c53b871bb..150632c398 100644 --- a/tensorflow/contrib/tensor_forest/python/kernel_tests/grow_tree_op_test.py +++ b/tensorflow/contrib/tensor_forest/python/kernel_tests/grow_tree_op_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.tensor_forest.python.ops import tensor_forest_ops from tensorflow.python.framework import test_util from tensorflow.python.ops import state_ops diff --git a/tensorflow/contrib/tensor_forest/python/kernel_tests/sample_inputs_op_test.py b/tensorflow/contrib/tensor_forest/python/kernel_tests/sample_inputs_op_test.py index 89ba53a427..705949a454 100644 --- a/tensorflow/contrib/tensor_forest/python/kernel_tests/sample_inputs_op_test.py +++ b/tensorflow/contrib/tensor_forest/python/kernel_tests/sample_inputs_op_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.tensor_forest.python.ops import data_ops from tensorflow.contrib.tensor_forest.python.ops import tensor_forest_ops diff --git a/tensorflow/contrib/tensor_forest/python/kernel_tests/scatter_add_ndim_op_test.py b/tensorflow/contrib/tensor_forest/python/kernel_tests/scatter_add_ndim_op_test.py index baf7db609a..e429d12e96 100644 --- a/tensorflow/contrib/tensor_forest/python/kernel_tests/scatter_add_ndim_op_test.py +++ b/tensorflow/contrib/tensor_forest/python/kernel_tests/scatter_add_ndim_op_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.tensor_forest.python.ops import tensor_forest_ops from tensorflow.python.framework import test_util from tensorflow.python.ops import variables diff --git a/tensorflow/contrib/tensor_forest/python/tensor_forest_test.py b/tensorflow/contrib/tensor_forest/python/tensor_forest_test.py index 254d0de6ef..a9a3f66bbf 100644 --- a/tensorflow/contrib/tensor_forest/python/tensor_forest_test.py +++ b/tensorflow/contrib/tensor_forest/python/tensor_forest_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.tensor_forest.python import tensor_forest from tensorflow.python.framework import ops from tensorflow.python.framework import sparse_tensor diff --git a/tensorflow/contrib/tfprof/python/tools/tfprof/model_analyzer_test.py b/tensorflow/contrib/tfprof/python/tools/tfprof/model_analyzer_test.py index 3344407cd2..66b9267cbe 100644 --- a/tensorflow/contrib/tfprof/python/tools/tfprof/model_analyzer_test.py +++ b/tensorflow/contrib/tfprof/python/tools/tfprof/model_analyzer_test.py @@ -18,12 +18,6 @@ from __future__ import division from __future__ import print_function import os -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) from tensorflow.core.protobuf import config_pb2 from tensorflow.python.client import session diff --git a/tensorflow/contrib/tfprof/python/tools/tfprof/print_model_analysis_test.py b/tensorflow/contrib/tfprof/python/tools/tfprof/print_model_analysis_test.py index 07ed324d7c..f0ac36c66a 100644 --- a/tensorflow/contrib/tfprof/python/tools/tfprof/print_model_analysis_test.py +++ b/tensorflow/contrib/tfprof/python/tools/tfprof/print_model_analysis_test.py @@ -18,13 +18,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from google.protobuf import text_format from tensorflow.python.client import session diff --git a/tensorflow/contrib/tfprof/python/tools/tfprof/tfprof_logger_test.py b/tensorflow/contrib/tfprof/python/tools/tfprof/tfprof_logger_test.py index 9a7fe9a887..87dfdc0fc1 100644 --- a/tensorflow/contrib/tfprof/python/tools/tfprof/tfprof_logger_test.py +++ b/tensorflow/contrib/tfprof/python/tools/tfprof/tfprof_logger_test.py @@ -17,13 +17,6 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib.copy_graph.python.util import copy_elements from tensorflow.contrib.tfprof.python.tools.tfprof import tfprof_logger from tensorflow.core.protobuf import config_pb2 diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD index d541749883..387eb68210 100644 --- a/tensorflow/python/BUILD +++ b/tensorflow/python/BUILD @@ -2524,8 +2524,15 @@ tf_cuda_library( ], ) -tf_py_wrap_cc( +py_library( name = "pywrap_tensorflow", + srcs = ["pywrap_tensorflow.py"], + srcs_version = "PY2AND3", + deps = [":pywrap_tensorflow_internal"], +) + +tf_py_wrap_cc( + name = "pywrap_tensorflow_internal", srcs = ["tensorflow.i"], swig_includes = [ "client/device_lib.i", diff --git a/tensorflow/python/__init__.py b/tensorflow/python/__init__.py index 917c2fb991..96281f5192 100644 --- a/tensorflow/python/__init__.py +++ b/tensorflow/python/__init__.py @@ -46,30 +46,9 @@ import traceback # go/tf-wildcard-import # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top -# On UNIX-based platforms, pywrap_tensorflow is a SWIG-generated -# python library that dynamically loads _pywrap_tensorflow.so. The -# default mode for loading keeps all the symbol private and not -# visible to other libraries that may be loaded. Setting the mode to -# RTLD_GLOBAL to make the symbols visible, so that custom op libraries -# imported using `tf.load_op_library()` can access symbols defined in -# _pywrap_tensorflow.so. import numpy as np -try: - if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'): - _default_dlopen_flags = sys.getdlopenflags() - sys.setdlopenflags(_default_dlopen_flags | ctypes.RTLD_GLOBAL) - from tensorflow.python import pywrap_tensorflow - sys.setdlopenflags(_default_dlopen_flags) - else: - # TODO(keveman,mrry): Support dynamic op loading on platforms that do not - # use `dlopen()` for dynamic loading. - from tensorflow.python import pywrap_tensorflow -except ImportError: - msg = """%s\n\nFailed to load the native TensorFlow runtime.\n -See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error\n -for some common reasons and solutions. Include the entire stack trace -above this error message when asking for help.""" % traceback.format_exc() - raise ImportError(msg) + +from tensorflow.python import pywrap_tensorflow # Protocol buffers from tensorflow.core.framework.graph_pb2 import * diff --git a/tensorflow/python/framework/file_system_test.py b/tensorflow/python/framework/file_system_test.py index fb5659dd70..26b2a5b9b9 100644 --- a/tensorflow/python/framework/file_system_test.py +++ b/tensorflow/python/framework/file_system_test.py @@ -19,12 +19,6 @@ from __future__ import division from __future__ import print_function import os -import sys - -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) from tensorflow.python.framework import dtypes from tensorflow.python.framework import load_library diff --git a/tensorflow/python/kernel_tests/conv_ops_test.py b/tensorflow/python/kernel_tests/conv_ops_test.py index 428253f55e..ffda847701 100644 --- a/tensorflow/python/kernel_tests/conv_ops_test.py +++ b/tensorflow/python/kernel_tests/conv_ops_test.py @@ -19,16 +19,10 @@ from __future__ import division from __future__ import print_function import os -import sys import time import numpy as np -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib import layers from tensorflow.python.client import session as session_lib from tensorflow.python.framework import constant_op diff --git a/tensorflow/python/kernel_tests/rnn_test.py b/tensorflow/python/kernel_tests/rnn_test.py index 34fed7f3a2..c5d26408c2 100644 --- a/tensorflow/python/kernel_tests/rnn_test.py +++ b/tensorflow/python/kernel_tests/rnn_test.py @@ -18,17 +18,11 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import sys import time import timeit import numpy as np -# TODO: #6568 Remove this hack that makes dlopen() not crash. -if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"): - import ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - from tensorflow.contrib import rnn as contrib_rnn from tensorflow.core.protobuf import config_pb2 from tensorflow.python.client import session diff --git a/tensorflow/python/pywrap_tensorflow.py b/tensorflow/python/pywrap_tensorflow.py new file mode 100644 index 0000000000..f116081752 --- /dev/null +++ b/tensorflow/python/pywrap_tensorflow.py @@ -0,0 +1,54 @@ +# Copyright 2017 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================= +"""pywrap_tensorflow wrapper that exports all symbols with RTLD_GLOBAL.""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import ctypes +import sys +import traceback + +# pylint: disable=wildcard-import,g-import-not-at-top,unused-import,line-too-long + +# On UNIX-based platforms, pywrap_tensorflow is a SWIG-generated +# python library that dynamically loads _pywrap_tensorflow.so. The +# default mode for loading keeps all the symbol private and not +# visible to other libraries that may be loaded. Setting the mode to +# RTLD_GLOBAL to make the symbols visible, so that custom op libraries +# imported using `tf.load_op_library()` can access symbols defined in +# _pywrap_tensorflow.so. +try: + # TODO(keveman,mrry): Support dynamic op loading on platforms that do not + # use `dlopen()` for dynamic loading. + _use_rtld_global = hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags') + if _use_rtld_global: + _default_dlopen_flags = sys.getdlopenflags() + sys.setdlopenflags(_default_dlopen_flags | ctypes.RTLD_GLOBAL) + from tensorflow.python.pywrap_tensorflow_internal import * + from tensorflow.python.pywrap_tensorflow_internal import __version__ + from tensorflow.python.pywrap_tensorflow_internal import __git_version__ + from tensorflow.python.pywrap_tensorflow_internal import __compiler_version__ + if _use_rtld_global: + sys.setdlopenflags(_default_dlopen_flags) +except ImportError: + msg = """%s\n\nFailed to load the native TensorFlow runtime.\n +See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error\n +for some common reasons and solutions. Include the entire stack trace +above this error message when asking for help.""" % traceback.format_exc() + raise ImportError(msg) + +# pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long diff --git a/tensorflow/tools/pip_package/setup.py b/tensorflow/tools/pip_package/setup.py index b07915aaf5..ea4c7e9ff4 100644 --- a/tensorflow/tools/pip_package/setup.py +++ b/tensorflow/tools/pip_package/setup.py @@ -154,9 +154,9 @@ matches = ['../' + x for x in find_files('*', 'external') if '.py' not in x] matches += ['../' + x for x in find_files('*', '_solib_k8') if '.py' not in x] if os.name == 'nt': - EXTENSION_NAME = 'python/_pywrap_tensorflow.pyd' + EXTENSION_NAME = 'python/_pywrap_tensorflow_internal.pyd' else: - EXTENSION_NAME = 'python/_pywrap_tensorflow.so' + EXTENSION_NAME = 'python/_pywrap_tensorflow_internal.so' headers = (list(find_files('*.h', 'tensorflow/core')) + list(find_files('*.h', 'tensorflow/stream_executor')) + -- GitLab From 9560e4163c256fc828c2047c2435ae0ef32f44f9 Mon Sep 17 00:00:00 2001 From: James Qin Date: Tue, 28 Feb 2017 18:42:32 -0800 Subject: [PATCH 072/101] Fix TF-learn eval_evalset/eval_evaltrain job failure due to race condition. TF-learn creates two jobs for evaluation: one uses evalset data and the other uses train data. Both job call Experiment._continuous_eval() -> Experiment._maybe_export() -> export_strategy.export() For TF-learn, the export function above is created by saved_model_export_utils.make_export_strategy() which calls garbage_collect_exports() after calling Estimator.export_savedmodel() The two jobs might trigger a race condition where they both try to delete the same dir. Then one fails with `NotFoundError` which isn't caught. Change: 148843701 --- .../learn/python/learn/utils/saved_model_export_utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tensorflow/contrib/learn/python/learn/utils/saved_model_export_utils.py b/tensorflow/contrib/learn/python/learn/utils/saved_model_export_utils.py index 9da69ae0bb..d265d2479a 100644 --- a/tensorflow/contrib/learn/python/learn/utils/saved_model_export_utils.py +++ b/tensorflow/contrib/learn/python/learn/utils/saved_model_export_utils.py @@ -28,7 +28,9 @@ from tensorflow.contrib.learn.python.learn.estimators import prediction_key from tensorflow.contrib.learn.python.learn.utils import gc from tensorflow.contrib.learn.python.learn.utils import input_fn_utils from tensorflow.python.framework import dtypes +from tensorflow.python.framework import errors_impl from tensorflow.python.platform import gfile +from tensorflow.python.platform import tf_logging as logging from tensorflow.python.saved_model import signature_constants from tensorflow.python.saved_model import signature_def_utils @@ -317,7 +319,10 @@ def garbage_collect_exports(export_dir_base, exports_to_keep): delete_filter = gc.negation(keep_filter) for p in delete_filter(gc.get_paths(export_dir_base, parser=_export_version_parser)): - gfile.DeleteRecursively(p.path) + try: + gfile.DeleteRecursively(p.path) + except errors_impl.NotFoundError as e: + logging.warn('Can not delete %s recursively: %s', p.path, e) def make_export_strategy(serving_input_fn, -- GitLab From 88a6508d5beffa4df034907bf42fc46b437311b9 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 28 Feb 2017 20:22:27 -0800 Subject: [PATCH 073/101] Add mean and variance atop health pills. Change: 148849242 --- .../components/tf_graph/tf-graph-scene.html | 6 +++-- .../tf_graph_common/lib/scene/scene.ts | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/tensorflow/tensorboard/components/tf_graph/tf-graph-scene.html b/tensorflow/tensorboard/components/tf_graph/tf-graph-scene.html index c837e6c684..09513699c3 100644 --- a/tensorflow/tensorboard/components/tf_graph/tf-graph-scene.html +++ b/tensorflow/tensorboard/components/tf_graph/tf-graph-scene.html @@ -479,11 +479,13 @@ limitations under the License. display: none; } -::content .health-pill { - filter: url(#health-pill-shadow); +::content .health-pill-stats { + font-size: 4px; + text-anchor: middle; } ::content .health-pill rect { + filter: url(#health-pill-shadow); rx: 3; ry: 3; } diff --git a/tensorflow/tensorboard/components/tf_graph_common/lib/scene/scene.ts b/tensorflow/tensorboard/components/tf_graph_common/lib/scene/scene.ts index 2b5e6c8b29..0e50188e63 100644 --- a/tensorflow/tensorboard/components/tf_graph_common/lib/scene/scene.ts +++ b/tensorflow/tensorboard/components/tf_graph_common/lib/scene/scene.ts @@ -505,6 +505,17 @@ export function positionEllipse(ellipse, cx: number, cy: number, }); }; +/** + * @param {number} stat A stat for a health pill (such as mean or variance). + * @return {string} A human-friendly string representation of that stat. + */ +function _humanizeHealthPillStat(stat) { + if (Math.abs(stat) >= 1) { + return stat.toFixed(1); + } + return stat.toExponential(1); +} + /** * Renders a health pill for an op atop a node. */ @@ -594,6 +605,19 @@ function _addHealthPill( healthPillY += nodeInfo.labelOffset; } + if (lastHealthPillOverview[8] !== Infinity) { + // At least 1 "non-Inf and non-NaN" value exists. Show stats on tensor + // values. + let statsSvg = document.createElementNS(svgNamespace, 'text'); + const minString = _humanizeHealthPillStat(lastHealthPillData[8]); + const maxString = _humanizeHealthPillStat(lastHealthPillData[9]); + statsSvg.textContent = minString + ' ~ ' + maxString; + statsSvg.classList.add('health-pill-stats'); + statsSvg.setAttribute('x', String(healthPillWidth / 2)); + statsSvg.setAttribute('y', '-2'); + healthPillGroup.appendChild(statsSvg); + } + healthPillGroup.setAttribute( 'transform', 'translate(' + healthPillX + ', ' + healthPillY + ')'); -- GitLab From 8777d9a15614b65271d25401f488b70b6b3dca1e Mon Sep 17 00:00:00 2001 From: Asim Shankar Date: Tue, 28 Feb 2017 20:41:32 -0800 Subject: [PATCH 074/101] Windows: Script to generate binary release for the Java and C libraries. A step towards #7877 Change: 148850174 --- .../windows/cpu/bazel/run_libtensorflow.bat | 1 + .../ci_build/windows/libtensorflow_cpu.sh | 91 +++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 tensorflow/tools/ci_build/windows/cpu/bazel/run_libtensorflow.bat create mode 100755 tensorflow/tools/ci_build/windows/libtensorflow_cpu.sh diff --git a/tensorflow/tools/ci_build/windows/cpu/bazel/run_libtensorflow.bat b/tensorflow/tools/ci_build/windows/cpu/bazel/run_libtensorflow.bat new file mode 100644 index 0000000000..6a88b1865a --- /dev/null +++ b/tensorflow/tools/ci_build/windows/cpu/bazel/run_libtensorflow.bat @@ -0,0 +1 @@ +c:\tools\msys64\usr\bin\bash -l %cd%/tensorflow/tools/ci_build/windows/libtensorflow_cpu.sh %* diff --git a/tensorflow/tools/ci_build/windows/libtensorflow_cpu.sh b/tensorflow/tools/ci_build/windows/libtensorflow_cpu.sh new file mode 100755 index 0000000000..7bab520f61 --- /dev/null +++ b/tensorflow/tools/ci_build/windows/libtensorflow_cpu.sh @@ -0,0 +1,91 @@ +#!/usr/bin/env bash +# Copyright 2017 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +# +# Script to produce binary release of libtensorflow (C API, Java jars etc.). + +set -ex +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# Setup environment for bazel builds +source "${SCRIPT_DIR}/bazel/common_env.sh" +source "${SCRIPT_DIR}/bazel/bazel_test_lib.sh" + +# Sanity check that this is being run from the root of the git repository. +cd ${SCRIPT_DIR}/../../../.. +if [ ! -e "WORKSPACE" ]; then + echo "Must run this from the root of the bazel workspace" + echo "Currently at ${PWD}, script is at ${SCRIPT_DIR}" + exit 1 +fi + +#### BEGIN HACKS TO BE RESOLVED WITH NEWER BAZEL VERSIONS #### +# Disable nccl. +# This can be removed once we switch to a bazel release that includes +# https://github.com/bazelbuild/bazel/commit/8e0991cb19eadfcb651cd6987255d5f7c0a58e0a +# (the fix for https://github.com/bazelbuild/bazel/issues/2494). +# Most likley bazel 0.4.5 will contain that. +sed -i -e "s/\"@nccl_archive/#\"@nccl_archive/" ./tensorflow/contrib/nccl/BUILD +sed -i -e "s/\"@nccl_archive/#\"@nccl_archive/" ./tensorflow/tools/pip_package/BUILD + +# Enable JNI support for Windows in Bazel. +# This can be removed once +# https://github.com/bazelbuild/bazel/pull/2599 +# has been merged and we switch to a bazel release containing it. +cp "${JAVA_HOME}/include/win32/jni_md.h" "./tensorflow/java/src/main/native/windows_jni_md.h" +sed -i -e "s|@bazel_tools//tools/jdk:jni_md_header-linux|windows_jni_md.h|" ./tensorflow/java/src/main/native/BUILD +#### END HACKS TO BE RESOLVED WITH NEW BAZEL VERSIONS #### + +clean_output_base +run_configure_for_cpu_build + +# build_libtensorflow_tarball in ../builds/libtensorflow.sh +# cannot be used on Windows since it relies on pkg_tar rules. +# So we do something special here +bazel build -c opt ${BUILD_OPTS} \ + tensorflow:libtensorflow.so \ + tensorflow/tools/lib_package:clicenses_generate \ + tensorflow/java:libtensorflow_jni.so \ + tensorflow/tools/lib_package:jnilicenses_generate + +# Revert the hacks above +git checkout ./tensorflow/contrib/nccl/BUILD ./tensorflow/tools/pip_package/BUILD +git checkout ./tensorflow/java/src/main/native/BUILD +rm -f ./tensorflow/java/src/main/native/windows_jni_md.h + +DIR=lib_package +mkdir -p ${DIR} + +# Zip up the .dll and the LICENSE for the JNI library. +cp bazel-bin/tensorflow/java/libtensorflow_jni.so ${DIR}/tensorflow_jni.dll +zip -j ${DIR}/libtensorflow_jni-cpu-windows-$(uname -m).zip \ + ${DIR}/tensorflow_jni.dll \ + bazel-genfiles/tensorflow/tools/lib_package/include/tensorflow/jni/LICENSE +rm -f ${DIR}/tensorflow_jni.dll + +# Zip up the .dll, LICENSE and include files for the C library. +cd ${DIR} +mkdir -p include/tensorflow/c +mkdir -p lib +cp bazel-bin/tensorflow/libtensorflow.so lib/tensorflow.dll +cp tensorflow/c/c_api.h include/tensorflow/c +cp ../bazel-genfiles/tensorflow/tools/lib_package/include/tensorflow/c/LICENSE include/tensorflow/c +zip libtensorflow-cpu-windows-$(uname -m).zip lib/* include/* +# Zip up the .dll, LICENSE and header files for the C library. +zip -j libtensorflow-cpu-windows-$(uname -m).zip \ + lib/tensorflow.dll \ + include/c/c_api.h \ + include/c/LICENSE +rm -rf lib include -- GitLab From ccf9a752f9f10cbee2f4f53b0d46a5951d620922 Mon Sep 17 00:00:00 2001 From: Jingyue Wu Date: Tue, 28 Feb 2017 22:09:13 -0800 Subject: [PATCH 075/101] Add new ops for memory statistics. This CL adds only the MaxBytesInUse op, which collects the peak memory usage of a device allocator. Other ops can be added similarly when demanded. For now, we only enable MaxBytesInUse for GPU because memory statistics are unreliable for CPU allocators. This CL essentially merges part of Yaroslav Bulatov's work on https://github.com/yaroslavvb/memory_probe_ops to TensorFlow. Change: 148854571 --- tensorflow/contrib/BUILD | 1 + tensorflow/contrib/__init__.py | 1 + tensorflow/contrib/memory_stats/BUILD | 74 +++++++++++++++++++ tensorflow/contrib/memory_stats/__init__.py | 20 +++++ .../memory_stats/kernels/memory_stats_ops.cc | 43 +++++++++++ .../memory_stats/ops/memory_stats_ops.cc | 21 ++++++ .../kernel_tests/memory_stats_ops_test.py | 63 ++++++++++++++++ .../python/ops/memory_stats_ops.py | 30 ++++++++ 8 files changed, 253 insertions(+) create mode 100644 tensorflow/contrib/memory_stats/BUILD create mode 100644 tensorflow/contrib/memory_stats/__init__.py create mode 100644 tensorflow/contrib/memory_stats/kernels/memory_stats_ops.cc create mode 100644 tensorflow/contrib/memory_stats/ops/memory_stats_ops.cc create mode 100644 tensorflow/contrib/memory_stats/python/kernel_tests/memory_stats_ops_test.py create mode 100644 tensorflow/contrib/memory_stats/python/ops/memory_stats_ops.py diff --git a/tensorflow/contrib/BUILD b/tensorflow/contrib/BUILD index 251c3bb33f..6240de21ca 100644 --- a/tensorflow/contrib/BUILD +++ b/tensorflow/contrib/BUILD @@ -38,6 +38,7 @@ py_library( "//tensorflow/contrib/linear_optimizer:sdca_ops_py", "//tensorflow/contrib/lookup:lookup_py", "//tensorflow/contrib/losses:losses_py", + "//tensorflow/contrib/memory_stats:memory_stats_py", "//tensorflow/contrib/metrics:metrics_py", "//tensorflow/contrib/nccl:nccl_py", "//tensorflow/contrib/ndlstm", diff --git a/tensorflow/contrib/__init__.py b/tensorflow/contrib/__init__.py index fede580f0f..84ca2b1405 100644 --- a/tensorflow/contrib/__init__.py +++ b/tensorflow/contrib/__init__.py @@ -41,6 +41,7 @@ from tensorflow.contrib import linalg from tensorflow.contrib import linear_optimizer from tensorflow.contrib import lookup from tensorflow.contrib import losses +from tensorflow.contrib import memory_stats from tensorflow.contrib import metrics from tensorflow.contrib import nn from tensorflow.contrib import opt diff --git a/tensorflow/contrib/memory_stats/BUILD b/tensorflow/contrib/memory_stats/BUILD new file mode 100644 index 0000000000..bbb78383fa --- /dev/null +++ b/tensorflow/contrib/memory_stats/BUILD @@ -0,0 +1,74 @@ +# Description: +# Ops that get statistics on memory allocators. + +licenses(["notice"]) # Apache 2.0 + +exports_files(["LICENSE"]) + +package(default_visibility = ["//tensorflow:__subpackages__"]) + +load("//tensorflow:tensorflow.bzl", "tf_custom_op_library") +load("//tensorflow:tensorflow.bzl", "tf_gen_op_libs") +load("//tensorflow:tensorflow.bzl", "tf_gen_op_wrapper_py") +load("//tensorflow:tensorflow.bzl", "cuda_py_test") + +tf_custom_op_library( + name = "python/ops/_memory_stats_ops.so", + srcs = [ + "kernels/memory_stats_ops.cc", + "ops/memory_stats_ops.cc", + ], +) + +tf_gen_op_libs( + op_lib_names = ["memory_stats_ops"], + deps = [ + "//tensorflow/core:lib", + ], +) + +tf_gen_op_wrapper_py( + name = "memory_stats_ops", + deps = [":memory_stats_ops_op_lib"], +) + +py_library( + name = "memory_stats_py", + srcs = [ + "__init__.py", + "python/ops/memory_stats_ops.py", + ], + data = [ + ":python/ops/_memory_stats_ops.so", + ], + srcs_version = "PY2AND3", + visibility = ["//visibility:public"], + deps = [ + ":memory_stats_ops", + "//tensorflow/contrib/util:util_py", + ], +) + +cuda_py_test( + name = "memory_stats_ops_test", + size = "small", + srcs = ["python/kernel_tests/memory_stats_ops_test.py"], + additional_deps = [ + ":memory_stats_py", + "//tensorflow/python:client_testlib", + "//tensorflow/python:math_ops", + "//tensorflow/python:random_ops", + ], +) + +filegroup( + name = "all_files", + srcs = glob( + ["**/*"], + exclude = [ + "**/METADATA", + "**/OWNERS", + ], + ), + visibility = ["//tensorflow:__subpackages__"], +) diff --git a/tensorflow/contrib/memory_stats/__init__.py b/tensorflow/contrib/memory_stats/__init__.py new file mode 100644 index 0000000000..78146b701e --- /dev/null +++ b/tensorflow/contrib/memory_stats/__init__.py @@ -0,0 +1,20 @@ +# Copyright 2017 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +"""Ops for memory statistics.""" + +from tensorflow.contrib.memory_stats.python.ops.memory_stats_ops import MaxBytesInUse + +from tensorflow.python.util.all_util import remove_undocumented +remove_undocumented(__name__) diff --git a/tensorflow/contrib/memory_stats/kernels/memory_stats_ops.cc b/tensorflow/contrib/memory_stats/kernels/memory_stats_ops.cc new file mode 100644 index 0000000000..c5a4a2de75 --- /dev/null +++ b/tensorflow/contrib/memory_stats/kernels/memory_stats_ops.cc @@ -0,0 +1,43 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#include "tensorflow/core/framework/op_kernel.h" + +namespace tensorflow { + +// Op that measures the peak memory in bytes. +class MaxBytesInUseOp : public OpKernel { + public: + explicit MaxBytesInUseOp(OpKernelConstruction* context) : OpKernel(context) {} + + void Compute(OpKernelContext* context) override { + Allocator* allocator = + context->device()->GetAllocator(AllocatorAttributes()); + AllocatorStats allocator_stats; + allocator->GetStats(&allocator_stats); + + Tensor* output_tensor = nullptr; + OP_REQUIRES_OK( + context, context->allocate_output(0, TensorShape({}), &output_tensor)); + output_tensor->scalar()() = allocator_stats.max_bytes_in_use; + } +}; + +// MallocExtension_GetAllocatedSize doesn't return the allocated size reliably +// for CPU allocators, so we register this op on GPU only. +REGISTER_KERNEL_BUILDER( + Name("MaxBytesInUse").Device(DEVICE_GPU).HostMemory("out"), + MaxBytesInUseOp); + +} // namespace tensorflow diff --git a/tensorflow/contrib/memory_stats/ops/memory_stats_ops.cc b/tensorflow/contrib/memory_stats/ops/memory_stats_ops.cc new file mode 100644 index 0000000000..cdca15388a --- /dev/null +++ b/tensorflow/contrib/memory_stats/ops/memory_stats_ops.cc @@ -0,0 +1,21 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#include "tensorflow/core/framework/op.h" + +namespace tensorflow { + +REGISTER_OP("MaxBytesInUse").Output("out: int64").SetIsStateful(); + +} // namespace tensorflow diff --git a/tensorflow/contrib/memory_stats/python/kernel_tests/memory_stats_ops_test.py b/tensorflow/contrib/memory_stats/python/kernel_tests/memory_stats_ops_test.py new file mode 100644 index 0000000000..b0d23b8155 --- /dev/null +++ b/tensorflow/contrib/memory_stats/python/kernel_tests/memory_stats_ops_test.py @@ -0,0 +1,63 @@ +# Copyright 2017 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +"""Tests for memory statistics ops.""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +from tensorflow.contrib.memory_stats.python.ops import memory_stats_ops +from tensorflow.python.framework import dtypes +from tensorflow.python.framework import tensor_shape +from tensorflow.python.framework import test_util +from tensorflow.python.ops import math_ops +from tensorflow.python.ops import random_ops +from tensorflow.python.platform import test + + +class MemoryStatsOpsTest(test_util.TensorFlowTestCase): + + # Tests the peak memory usage of the following computation. + # a b + # | / | + # c | + # \ | + # \ | + # d + # The memory for matrix "a" can be reused for matrix "d". Therefore, this + # computation needs space for only three matrix plus some small overhead. + def testChainOfMatmul(self): + # MaxBytesInUse is registerd on GPU only. See kernels/memory_stats_ops.cc. + if not test.is_gpu_available(): + return + + with self.test_session(use_gpu=True) as sess: + matrix_size = 64 + matrix_shape = tensor_shape.TensorShape([matrix_size, matrix_size]) + dtype = dtypes.float32 + matrix_size_in_bytes = matrix_shape.num_elements() * dtype.size + a = random_ops.random_uniform(matrix_shape, dtype=dtype) + b = random_ops.random_uniform(matrix_shape, dtype=dtype) + c = math_ops.matmul(a, b) + d = math_ops.matmul(c, b) + sess.run(d) + + max_bytes_in_use = sess.run(memory_stats_ops.MaxBytesInUse()) + self.assertGreaterEqual(max_bytes_in_use, matrix_size_in_bytes * 3) + self.assertLess(max_bytes_in_use, matrix_size_in_bytes * 4) + + +if __name__ == '__main__': + test.main() diff --git a/tensorflow/contrib/memory_stats/python/ops/memory_stats_ops.py b/tensorflow/contrib/memory_stats/python/ops/memory_stats_ops.py new file mode 100644 index 0000000000..0e0772e6be --- /dev/null +++ b/tensorflow/contrib/memory_stats/python/ops/memory_stats_ops.py @@ -0,0 +1,30 @@ +# Copyright 2017 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +"""Ops for memory statistics.""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +from tensorflow.contrib.memory_stats.ops import gen_memory_stats_ops +from tensorflow.contrib.util import loader +from tensorflow.python.platform import resource_loader + +_memory_stats_ops_so = loader.load_op_library( + resource_loader.get_path_to_datafile("_memory_stats_ops.so")) + + +def MaxBytesInUse(): + return gen_memory_stats_ops.max_bytes_in_use() -- GitLab From d0eb4d6a2e0b22a5f72d880232871b57da892bfa Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 1 Mar 2017 00:30:08 -0800 Subject: [PATCH 076/101] Remove spurious (unreachable) return statement. Reported by #7917 Change: 148861244 --- tensorflow/compiler/xla/service/algebraic_simplifier.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/tensorflow/compiler/xla/service/algebraic_simplifier.cc b/tensorflow/compiler/xla/service/algebraic_simplifier.cc index e225c4e927..fa087d6991 100644 --- a/tensorflow/compiler/xla/service/algebraic_simplifier.cc +++ b/tensorflow/compiler/xla/service/algebraic_simplifier.cc @@ -686,7 +686,6 @@ Status AlgebraicSimplifierVisitor::HandlePower(HloInstruction* power, } changed_ = true; return computation_->ReplaceWithNewInstruction(power, std::move(ones)); - return Status::OK(); } VLOG(10) << "trying transform [pow(A, 1) => A]: " << power->ToString(); -- GitLab From 7e48bada5a6c5583ab6e9a103337780863af08cc Mon Sep 17 00:00:00 2001 From: Jack Rae Date: Wed, 1 Mar 2017 01:55:01 -0800 Subject: [PATCH 077/101] Improve error message reporting for check_numerics gradient. At present the op message is only printed if the numeric check fails during the op's 'forward' computation. If the check fails during the gradient, there is no identifier on *which* op's gradient failed. Change: 148866334 --- tensorflow/cc/BUILD | 1 + tensorflow/cc/gradients/array_grad.cc | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tensorflow/cc/BUILD b/tensorflow/cc/BUILD index a488440076..a4d93e6ae9 100644 --- a/tensorflow/cc/BUILD +++ b/tensorflow/cc/BUILD @@ -229,6 +229,7 @@ cc_library( ":cc_ops_internal", ":grad_op_registry", ":gradients", + "//tensorflow/core:lib_proto_parsing", ], ) diff --git a/tensorflow/cc/gradients/array_grad.cc b/tensorflow/cc/gradients/array_grad.cc index cafa15347e..58a34bd277 100644 --- a/tensorflow/cc/gradients/array_grad.cc +++ b/tensorflow/cc/gradients/array_grad.cc @@ -17,6 +17,7 @@ limitations under the License. #include "tensorflow/cc/ops/array_ops_internal.h" #include "tensorflow/cc/ops/standard_ops.h" +#include "tensorflow/core/lib/strings/strcat.h" #include "tensorflow/cc/framework/grad_op_registry.h" #include "tensorflow/cc/framework/gradients.h" @@ -151,9 +152,12 @@ REGISTER_GRADIENT_OP("GatherNd", GatherNdGrad); Status CheckNumericsGrad(const Scope& scope, const Operation& op, const std::vector& grad_inputs, std::vector* grad_outputs) { - grad_outputs->push_back(CheckNumerics( - scope, grad_inputs[0], - "Not a number (NaN) or infinity (Inf) values detected in gradient.")); + string message; + TF_RETURN_IF_ERROR(GetNodeAttr(op.node()->def(), "message", &message)); + string err_msg = strings::StrCat( + "Not a number (NaN) or infinity (Inf) values detected in gradient. ", + message); + grad_outputs->push_back(CheckNumerics(scope, grad_inputs[0], err_msg)); return scope.status(); } REGISTER_GRADIENT_OP("CheckNumerics", CheckNumericsGrad); -- GitLab From ec86b037893fb00be8e9c366a5a6196d89a6dd72 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 1 Mar 2017 02:29:36 -0800 Subject: [PATCH 078/101] Extends fold_batch_norms transform to also fold the mul introduced by batch normalization after fully connected layers (MatMul). Change: 148868461 --- tensorflow/tools/graph_transforms/README.md | 13 ++-- .../graph_transforms/fold_batch_norms.cc | 18 +++--- .../graph_transforms/fold_batch_norms_test.cc | 60 ++++++++++++++++++- 3 files changed, 75 insertions(+), 16 deletions(-) diff --git a/tensorflow/tools/graph_transforms/README.md b/tensorflow/tools/graph_transforms/README.md index 8cba86f63e..36a5c01a0c 100644 --- a/tensorflow/tools/graph_transforms/README.md +++ b/tensorflow/tools/graph_transforms/README.md @@ -341,12 +341,13 @@ Args: None \ Prerequisites: [fold_constants](#fold_constants) This transform tries to optimize away the Mul that's introduced after a Conv2D -when batch normalization has been used during training. It scans the graph for -any channel-wise multiplies immediately after convolutions, and multiplies the -convolution's weights with the Mul instead so this can be omitted at inference -time. You'll need to make sure you run [fold_constants](#fold_constants) first, -since the pattern can only be spotted if the normal complex expression that's -produced by training for the Mul input is collapsed down into a simple constant. +(or a MatMul) when batch normalization has been used during training. It scans +the graph for any channel-wise multiplies immediately after convolutions, and +multiplies the convolution's (or matrix multiplication's) weights with the Mul +instead so this can be omitted at inference time. You'll need to make sure you +run [fold_constants](#fold_constants) first, since the pattern can only be +spotted if the normal complex expression that's produced by training for the Mul +input is collapsed down into a simple constant. ### fold_constants diff --git a/tensorflow/tools/graph_transforms/fold_batch_norms.cc b/tensorflow/tools/graph_transforms/fold_batch_norms.cc index 9f3393f126..7daacb55a2 100644 --- a/tensorflow/tools/graph_transforms/fold_batch_norms.cc +++ b/tensorflow/tools/graph_transforms/fold_batch_norms.cc @@ -27,23 +27,24 @@ limitations under the License. namespace tensorflow { namespace graph_transforms { -// Converts Conv2D ops followed by column-wise Muls into equivalent ops with the -// Mul baked into the convolution weights, to save computation during inference. +// Converts Conv2D or MatMul ops followed by column-wise Muls into equivalent +// ops with the Mul baked into the convolution weights, to save computation +// during inference. Status FoldBatchNorms(const GraphDef& input_graph_def, const TransformFuncContext& context, GraphDef* output_graph_def) { GraphDef replaced_graph_def; TF_RETURN_IF_ERROR(ReplaceMatchingOpTypes( input_graph_def, // clang-format off - {"Mul", // mul_node + {"Mul", // mul_node { - {"Conv2D", // conv_node + {"Conv2D|MatMul", // conv_node { - {"*"}, // input_node - {"Const"}, // weights_node + {"*"}, // input_node + {"Const"}, // weights_node } }, - {"Const"}, // mul_values_node + {"Const"}, // mul_values_node } }, // clang-format on [](const NodeMatch& match, const std::set& input_nodes, @@ -61,7 +62,8 @@ Status FoldBatchNorms(const GraphDef& input_graph_def, // Make sure all the inputs really are vectors, with as many entries as // there are columns in the weights. - const int64 weights_cols = weights.shape().dim_size(3); + const int weights_cols_index = conv_node.op() == "Conv2D" ? 3 : 1; + const int64 weights_cols = weights.shape().dim_size(weights_cols_index); if ((mul_values.shape().dims() != 1) || (mul_values.shape().dim_size(0) != weights_cols)) { return errors::InvalidArgument( diff --git a/tensorflow/tools/graph_transforms/fold_batch_norms_test.cc b/tensorflow/tools/graph_transforms/fold_batch_norms_test.cc index b9983fdd0b..ed741f002c 100644 --- a/tensorflow/tools/graph_transforms/fold_batch_norms_test.cc +++ b/tensorflow/tools/graph_transforms/fold_batch_norms_test.cc @@ -15,6 +15,7 @@ limitations under the License. #include "tensorflow/cc/ops/const_op.h" #include "tensorflow/cc/ops/image_ops.h" +#include "tensorflow/cc/ops/math_ops.h" #include "tensorflow/cc/ops/nn_ops.h" #include "tensorflow/cc/ops/sendrecv_ops.h" #include "tensorflow/cc/ops/standard_ops.h" @@ -35,7 +36,7 @@ Status FoldBatchNorms(const GraphDef& input_graph_def, class FoldBatchNormsTest : public ::testing::Test { protected: - void TestFoldBatchNorms() { + void TestFoldBatchNormsConv2D() { auto root = tensorflow::Scope::NewRootScope(); using namespace ::tensorflow::ops; // NOLINT(build/namespaces) @@ -85,9 +86,64 @@ class FoldBatchNormsTest : public ::testing::Test { EXPECT_NE("Mul", node.op()); } } + + void TestFoldBatchNormsMatMul() { + auto root = tensorflow::Scope::NewRootScope(); + using namespace ::tensorflow::ops; // NOLINT(build/namespaces) + + Tensor input_data(DT_FLOAT, TensorShape({6, 2})); + test::FillValues( + &input_data, {1.0f, 4.0f, 2.0f, 5.0f, 3.0f, 6.0f, -1.0f, -4.0f, -2.0f, + -5.0f, -3.0f, -6.0f}); + Output input_op = + Const(root.WithOpName("input_op"), Input::Initializer(input_data)); + + Tensor weights_data(DT_FLOAT, TensorShape({2, 2})); + test::FillValues(&weights_data, {1.0f, 2.0f, 0.3f, 0.4f}); + Output weights_op = + Const(root.WithOpName("weights_op"), Input::Initializer(weights_data)); + + Output matmul_op = + MatMul(root.WithOpName("matmul_op"), input_op, weights_op); + + Tensor mul_values_data(DT_FLOAT, TensorShape({2})); + test::FillValues(&mul_values_data, {2.0f, 3.0f}); + Output mul_values_op = Const(root.WithOpName("mul_values"), + Input::Initializer(mul_values_data)); + + Output mul_op = Mul(root.WithOpName("output"), matmul_op, mul_values_op); + + GraphDef original_graph_def; + TF_ASSERT_OK(root.ToGraphDef(&original_graph_def)); + + std::unique_ptr original_session(NewSession(SessionOptions())); + TF_ASSERT_OK(original_session->Create(original_graph_def)); + std::vector original_outputs; + TF_ASSERT_OK(original_session->Run({}, {"output"}, {}, &original_outputs)); + + GraphDef fused_graph_def; + TF_ASSERT_OK( + FoldBatchNorms(original_graph_def, {{}, {"output"}}, &fused_graph_def)); + + std::unique_ptr fused_session(NewSession(SessionOptions())); + TF_ASSERT_OK(fused_session->Create(fused_graph_def)); + std::vector fused_outputs; + TF_ASSERT_OK(fused_session->Run({}, {"output"}, {}, &fused_outputs)); + + test::ExpectTensorNear(original_outputs[0], fused_outputs[0], 1e-5); + + for (const NodeDef& node : fused_graph_def.node()) { + EXPECT_NE("Mul", node.op()); + } + } }; -TEST_F(FoldBatchNormsTest, TestFoldBatchNorms) { TestFoldBatchNorms(); } +TEST_F(FoldBatchNormsTest, TestFoldBatchNormsConv2D) { + TestFoldBatchNormsConv2D(); +} +TEST_F(FoldBatchNormsTest, TestFoldBatchNormsMatMul) { + TestFoldBatchNormsMatMul(); +} } // namespace graph_transforms } // namespace tensorflow -- GitLab From 1617ffbc3df4066ff76325e889ce79d12e4b1c0f Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 1 Mar 2017 04:35:36 -0800 Subject: [PATCH 079/101] Move dynamic_rnn_estimator._construct_rnn_cell() into rnn_common and make it public. Change: 148875698 --- .../learn/estimators/dynamic_rnn_estimator.py | 62 ++----------------- .../python/learn/estimators/rnn_common.py | 61 ++++++++++++++++++ 2 files changed, 65 insertions(+), 58 deletions(-) diff --git a/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator.py b/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator.py index 2c0799a9b7..35f1c3cc63 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator.py +++ b/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator.py @@ -50,11 +50,6 @@ class RNNKeys(object): STATE_PREFIX = 'rnn_cell_state' -_CELL_TYPES = {'basic_rnn': contrib_rnn.BasicRNNCell, - 'lstm': contrib_rnn.LSTMCell, - 'gru': contrib_rnn.GRUCell,} - - def _get_state_name(i): """Constructs the name string for state component `i`.""" return '{}_{}'.format(rnn_common.RNNKeys.STATE_PREFIX, i) @@ -532,7 +527,8 @@ def _get_dynamic_rnn_model_fn( dropout = (dropout_keep_probabilities if mode == model_fn.ModeKeys.TRAIN else None) - cell = _construct_rnn_cell(cell_type, num_units, dropout) + # This class promises to use the cell type selected by that function. + cell = rnn_common.construct_rnn_cell(num_units, cell_type, dropout) initial_state = dict_to_state_tuple(features, cell) rnn_activations, final_state = construct_rnn( initial_state, @@ -589,58 +585,6 @@ def _get_dynamic_rnn_model_fn( return _dynamic_rnn_model_fn -def _get_single_cell(cell_type, num_units): - """Constructs and return an single `RNNCell`. - - Args: - cell_type: Either a string identifying the `RNNCell` type, a subclass of - `RNNCell` or an instance of an `RNNCell`. - num_units: The number of units in the `RNNCell`. - Returns: - An initialized `RNNCell`. - Raises: - ValueError: `cell_type` is an invalid `RNNCell` name. - TypeError: `cell_type` is not a string or a subclass of `RNNCell`. - """ - if isinstance(cell_type, contrib_rnn.RNNCell): - return cell_type - if isinstance(cell_type, str): - cell_type = _CELL_TYPES.get(cell_type) - if cell_type is None: - raise ValueError('The supported cell types are {}; got {}'.format( - list(_CELL_TYPES.keys()), cell_type)) - if not issubclass(cell_type, contrib_rnn.RNNCell): - raise TypeError( - 'cell_type must be a subclass of RNNCell or one of {}.'.format( - list(_CELL_TYPES.keys()))) - return cell_type(num_units=num_units) - - -def _construct_rnn_cell(cell_type, num_units, dropout_keep_probabilities): - """Constructs cells, applies dropout and assembles a `MultiRNNCell`. - - Args: - cell_type: A string identifying the `RNNCell` type, a subclass of - `RNNCell` or an instance of an `RNNCell`. - num_units: A single `int` or a list/tuple of `int`s. The size of the - `RNNCell`s. - dropout_keep_probabilities: a list of dropout probabilities or `None`. If a - list is given, it must have length `len(cell_type) + 1`. - - Returns: - An initialized `RNNCell`. - """ - if not isinstance(num_units, (list, tuple)): - num_units = (num_units,) - - cells = [_get_single_cell(cell_type, n) for n in num_units] - if dropout_keep_probabilities: - cells = rnn_common.apply_dropout(cells, dropout_keep_probabilities) - if len(cells) == 1: - return cells[0] - return contrib_rnn.MultiRNNCell(cells) - - def _get_dropout_and_num_units(cell_type, num_units, num_rnn_layers, @@ -695,6 +639,8 @@ class DynamicRnnEstimator(estimator.Estimator): all state components or none of them. If none are included, then the default (zero) state is used as an initial state. See the documentation for `dict_to_state_tuple` and `state_tuple_to_dict` for further details. + The input function can call rnn_common.construct_rnn_cell() to obtain the + same cell type that this class will select from arguments to __init__. The `predict()` method of the `Estimator` returns a dictionary with keys `STATE_PREFIX_i` for `0 <= i < n` where `n` is the number of nested elements diff --git a/tensorflow/contrib/learn/python/learn/estimators/rnn_common.py b/tensorflow/contrib/learn/python/learn/estimators/rnn_common.py index b3aea01ffa..51ecfe13dd 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/rnn_common.py +++ b/tensorflow/contrib/learn/python/learn/estimators/rnn_common.py @@ -40,6 +40,67 @@ class RNNKeys(object): STATE_PREFIX = 'rnn_cell_state' +_CELL_TYPES = {'basic_rnn': contrib_rnn.BasicRNNCell, + 'lstm': contrib_rnn.LSTMCell, + 'gru': contrib_rnn.GRUCell,} + + +def _get_single_cell(cell_type, num_units): + """Constructs and return a single `RNNCell`. + + Args: + cell_type: Either a string identifying the `RNNCell` type, a subclass of + `RNNCell` or an instance of an `RNNCell`. + num_units: The number of units in the `RNNCell`. + Returns: + An initialized `RNNCell`. + Raises: + ValueError: `cell_type` is an invalid `RNNCell` name. + TypeError: `cell_type` is not a string or a subclass of `RNNCell`. + """ + if isinstance(cell_type, contrib_rnn.RNNCell): + return cell_type + if isinstance(cell_type, str): + cell_type = _CELL_TYPES.get(cell_type) + if cell_type is None: + raise ValueError('The supported cell types are {}; got {}'.format( + list(_CELL_TYPES.keys()), cell_type)) + if not issubclass(cell_type, contrib_rnn.RNNCell): + raise TypeError( + 'cell_type must be a subclass of RNNCell or one of {}.'.format( + list(_CELL_TYPES.keys()))) + return cell_type(num_units=num_units) + + +def construct_rnn_cell(num_units, cell_type='basic_rnn', + dropout_keep_probabilities=None): + """Constructs cells, applies dropout and assembles a `MultiRNNCell`. + + The cell type chosen by DynamicRNNEstimator.__init__() is the same as + returned by this function when called with the same arguments. + + Args: + num_units: A single `int` or a list/tuple of `int`s. The size of the + `RNNCell`s. + cell_type: A string identifying the `RNNCell` type, a subclass of + `RNNCell` or an instance of an `RNNCell`. + dropout_keep_probabilities: a list of dropout probabilities or `None`. If a + list is given, it must have length `len(cell_type) + 1`. + + Returns: + An initialized `RNNCell`. + """ + if not isinstance(num_units, (list, tuple)): + num_units = (num_units,) + + cells = [_get_single_cell(cell_type, n) for n in num_units] + if dropout_keep_probabilities: + cells = apply_dropout(cells, dropout_keep_probabilities) + if len(cells) == 1: + return cells[0] + return contrib_rnn.MultiRNNCell(cells) + + def apply_dropout(cells, dropout_keep_probabilities, random_seed=None): """Applies dropout to the outputs and inputs of `cell`. -- GitLab From 410cde0425a751c722e5c5cc8c1aeb84ccbdc5d4 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 1 Mar 2017 04:54:02 -0800 Subject: [PATCH 080/101] Add --printoptions flag to inspect_checkpoint, to control how numpy formats tensor values. For example, this allows --printoptions threshold=1000000 to print all the values in a large tensor instead of ellipsis in place of most of them. Change: 148876650 --- tensorflow/python/tools/inspect_checkpoint.py | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tensorflow/python/tools/inspect_checkpoint.py b/tensorflow/python/tools/inspect_checkpoint.py index e218fd06ab..a6bda5d305 100644 --- a/tensorflow/python/tools/inspect_checkpoint.py +++ b/tensorflow/python/tools/inspect_checkpoint.py @@ -20,8 +20,11 @@ from __future__ import print_function import argparse import sys +import numpy as np + from tensorflow.python import pywrap_tensorflow from tensorflow.python.platform import app +from tensorflow.python.platform import flags FLAGS = None @@ -58,6 +61,38 @@ def print_tensors_in_checkpoint_file(file_name, tensor_name, all_tensors): "with SNAPPY.") +def parse_numpy_printoption(kv_str): + """Sets a single numpy printoption from a string of the form 'x=y'. + + See documentation on numpy.set_printoptions() for details about what values + x and y can take. x can be any option listed there other than 'formatter'. + + Args: + kv_str: A string of the form 'x=y', such as 'threshold=100000' + + Raises: + argparse.ArgumentTypeError: If the string couldn't be used to set any + nump printoption. + """ + k_v_str = kv_str.split("=", 1) + if len(k_v_str) != 2 or not k_v_str[0]: + raise argparse.ArgumentTypeError("'%s' is not in the form k=v." % kv_str) + k, v_str = k_v_str + printoptions = np.get_printoptions() + if k not in printoptions: + raise argparse.ArgumentTypeError("'%s' is not a valid printoption." % k) + v_type = type(printoptions[k]) + if v_type is type(None): + raise argparse.ArgumentTypeError( + "Setting '%s' from the command line is not supported." % k) + try: + v = (v_type(v_str) if v_type is not bool + else flags.BooleanParser().Parse(v_str)) + except ValueError as e: + raise argparse.ArgumentTypeError(e.message) + np.set_printoptions(**{k: v}) + + def main(unused_argv): if not FLAGS.file_name: print("Usage: inspect_checkpoint --file_name=checkpoint_file_name " @@ -87,5 +122,10 @@ if __name__ == "__main__": type="bool", default=False, help="If True, print the values of all the tensors.") + parser.add_argument( + "--printoptions", + nargs="*", + type=parse_numpy_printoption, + help="Argument for numpy.set_printoptions(), in the form 'k=v'.") FLAGS, unparsed = parser.parse_known_args() app.run(main=main, argv=[sys.argv[0]] + unparsed) -- GitLab From e6637fd99eddf92d27283795618c25697183d7bc Mon Sep 17 00:00:00 2001 From: Asim Shankar Date: Wed, 1 Mar 2017 06:02:13 -0800 Subject: [PATCH 081/101] core/platform/profile_utils: Make Windows friendly. Some changes to assist in getting the bazel build for Windows working. In particular: - With https://github.com/tensorflow/tensorflow/commit/8898e88d5b3014a14d269560fb2f928f68562f53 core/platform/profile_utils/* needs to be included in Windows builds (Changes to tensorflow/core/BUILD in this change) - Avoid building the AndroidArmV7ACpuUtilsHelper when not on Android. Change: 148880242 --- tensorflow/core/BUILD | 2 ++ .../android_armv7a_cpu_utils_helper.cc | 21 ------------------- .../android_armv7a_cpu_utils_helper.h | 5 +++++ .../profile_utils/clock_cycle_profiler.h | 2 ++ 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD index a2d835d422..f681501ff4 100644 --- a/tensorflow/core/BUILD +++ b/tensorflow/core/BUILD @@ -1128,6 +1128,8 @@ cc_library( "lib/**/*.cc", "platform/*.h", "platform/*.cc", + "platform/profile_utils/**/*.h", + "platform/profile_utils/**/*.cc", ], exclude = [ "**/*test*", diff --git a/tensorflow/core/platform/profile_utils/android_armv7a_cpu_utils_helper.cc b/tensorflow/core/platform/profile_utils/android_armv7a_cpu_utils_helper.cc index 8f419718d0..8f9fa1dc53 100644 --- a/tensorflow/core/platform/profile_utils/android_armv7a_cpu_utils_helper.cc +++ b/tensorflow/core/platform/profile_utils/android_armv7a_cpu_utils_helper.cc @@ -126,26 +126,5 @@ int64 AndroidArmV7ACpuUtilsHelper::ReadCpuFrequencyFile( } // namespace profile_utils } // namespace tensorflow -// defined(__ANDROID__) && defined(__ARM_ARCH_7A__) && (__ANDROID_API__ >= 21) -#else - -// Dummy implementations to avoid link error. - -namespace tensorflow { -namespace profile_utils { - -void AndroidArmV7ACpuUtilsHelper::ResetClockCycle() {} -uint64 AndroidArmV7ACpuUtilsHelper::GetCurrentClockCycle() { return 1; } -void AndroidArmV7ACpuUtilsHelper::EnableClockCycleProfiling(bool) {} -int AndroidArmV7ACpuUtilsHelper::OpenPerfEvent(perf_event_attr *const, - const pid_t, const int, - const int, const unsigned long) { - return 0; -} -int64 AndroidArmV7ACpuUtilsHelper::CalculateCpuFrequency() { return 0; } - -} // namespace profile_utils -} // namespace tensorflow - // defined(__ANDROID__) && defined(__ARM_ARCH_7A__) && (__ANDROID_API__ >= 21) #endif diff --git a/tensorflow/core/platform/profile_utils/android_armv7a_cpu_utils_helper.h b/tensorflow/core/platform/profile_utils/android_armv7a_cpu_utils_helper.h index 09c365dd9e..f4ac7964f3 100644 --- a/tensorflow/core/platform/profile_utils/android_armv7a_cpu_utils_helper.h +++ b/tensorflow/core/platform/profile_utils/android_armv7a_cpu_utils_helper.h @@ -22,6 +22,8 @@ limitations under the License. #include "tensorflow/core/platform/profile_utils/i_cpu_utils_helper.h" #include "tensorflow/core/platform/types.h" +#if defined(__ANDROID__) && defined(__ARM_ARCH_7A__) && (__ANDROID_API__ >= 21) + struct perf_event_attr; namespace tensorflow { @@ -58,4 +60,7 @@ class AndroidArmV7ACpuUtilsHelper : public ICpuUtilsHelper { } // profile_utils } // tensorflow +// defined(__ANDROID__) && defined(__ARM_ARCH_7A__) && (__ANDROID_API__ >= 21) +#endif + #endif // TENSORFLOW_PLATFORM_PROFILEUTILS_ANDROID_ARMV7A_CPU_UTILS_HELPER_H__ diff --git a/tensorflow/core/platform/profile_utils/clock_cycle_profiler.h b/tensorflow/core/platform/profile_utils/clock_cycle_profiler.h index 876bb9c020..de4eec28e3 100644 --- a/tensorflow/core/platform/profile_utils/clock_cycle_profiler.h +++ b/tensorflow/core/platform/profile_utils/clock_cycle_profiler.h @@ -16,6 +16,8 @@ limitations under the License. #ifndef TENSORFLOW_PLATFORM_PROFILE_UTILS_CLOCK_CYCLE_PROFILER_H_ #define TENSORFLOW_PLATFORM_PROFILE_UTILS_CLOCK_CYCLE_PROFILER_H_ +#include + #include "tensorflow/core/platform/logging.h" #include "tensorflow/core/platform/macros.h" #include "tensorflow/core/platform/profile_utils/cpu_utils.h" -- GitLab From f424ca38712a87aeaf614af454d96b5d155592ca Mon Sep 17 00:00:00 2001 From: Peter Hawkins Date: Wed, 1 Mar 2017 06:15:30 -0800 Subject: [PATCH 082/101] [TF:XLA] Add implementation of tf.one_hot to the XLA bridge. Fix crash in normal OneHot kernel for depth < 0. Change: 148881102 --- tensorflow/compiler/tests/nary_ops_test.py | 22 +++ tensorflow/compiler/tests/randomized_tests.cc | 30 ++++ tensorflow/compiler/tf2xla/const_analysis.cc | 1 + tensorflow/compiler/tf2xla/kernels/BUILD | 1 + .../compiler/tf2xla/kernels/one_hot_op.cc | 131 ++++++++++++++++++ tensorflow/compiler/tf2xla/literal_util.h | 4 +- .../compiler/tf2xla/op_registrations.cc | 4 + tensorflow/compiler/tf2xla/xla_op_kernel.cc | 21 +++ tensorflow/compiler/tf2xla/xla_op_kernel.h | 3 + tensorflow/core/kernels/one_hot_op.cc | 3 + 10 files changed, 218 insertions(+), 2 deletions(-) create mode 100644 tensorflow/compiler/tf2xla/kernels/one_hot_op.cc diff --git a/tensorflow/compiler/tests/nary_ops_test.py b/tensorflow/compiler/tests/nary_ops_test.py index d94e11b078..a1f1e67a9f 100644 --- a/tensorflow/compiler/tests/nary_ops_test.py +++ b/tensorflow/compiler/tests/nary_ops_test.py @@ -75,6 +75,28 @@ class NAryOpsTest(XLATestCase): expected=np.array( [[1, 2, 3, 7, 8, 9], [4, 5, 6, 10, 11, 12]], dtype=np.float32)) + def testOneHot(self): + with self.test_session() as session, self.test_scope(): + indices = array_ops.constant(np.array([[2, 3], [0, 1]], dtype=np.int32)) + op = array_ops.one_hot(indices, + np.int32(4), + on_value=np.float32(7), off_value=np.float32(3)) + output = session.run(op) + expected = np.array([[[3, 3, 7, 3], [3, 3, 3, 7]], + [[7, 3, 3, 3], [3, 7, 3, 3]]], + dtype=np.float32) + self.assertAllEqual(output, expected) + + op = array_ops.one_hot(indices, + np.int32(4), + on_value=np.int32(2), off_value=np.int32(1), + axis=1) + output = session.run(op) + expected = np.array([[[1, 1], [1, 1], [2, 1], [1, 2]], + [[2, 1], [1, 2], [1, 1], [1, 1]]], + dtype=np.int32) + self.assertAllEqual(output, expected) + def testSplitV(self): with self.test_session() as session: with self.test_scope(): diff --git a/tensorflow/compiler/tests/randomized_tests.cc b/tensorflow/compiler/tests/randomized_tests.cc index abc0cb2cce..41c474b9ac 100644 --- a/tensorflow/compiler/tests/randomized_tests.cc +++ b/tensorflow/compiler/tests/randomized_tests.cc @@ -1466,6 +1466,36 @@ TEST_F(OpTest, NotEqual) { }); } +TEST_F(OpTest, OneHot) { + Repeatedly([this]() { + DataType type = Choose(kAllXlaTypes); + + std::vector dims = RandomDims(); + int num_dims = dims.size(); + + int32 depth = RandomDim(); + + Tensor indices(DT_INT32, TensorShape(dims)); + std::uniform_int_distribution distribution(-depth * 2, depth * 2); + test::FillFn(&indices, [this, &distribution](int i) -> int32 { + return distribution(generator()); + }); + + int axis = std::uniform_int_distribution(-num_dims - 5, + num_dims + 5)(generator()); + + OpTestBuilder builder("OneHot"); + builder.Attr("T", type); + builder.Attr("TI", DT_INT32); + builder.Attr("axis", axis); + builder.Input(indices); + builder.Input(test::AsScalar(depth)); + builder.Input(RandomTensor(type, {})); + builder.Input(RandomTensor(type, {})); + ExpectTfAndXlaOutputsAreClose(builder); + }); +} + TEST_F(OpTest, Pack) { Repeatedly([this]() { DataType type = Choose(kAllXlaTypes); diff --git a/tensorflow/compiler/tf2xla/const_analysis.cc b/tensorflow/compiler/tf2xla/const_analysis.cc index e072ef7be7..361ce74791 100644 --- a/tensorflow/compiler/tf2xla/const_analysis.cc +++ b/tensorflow/compiler/tf2xla/const_analysis.cc @@ -53,6 +53,7 @@ Status BackwardsConstAnalysis(const Graph& g, {"Max", "reduction_indices"}, {"Mean", "reduction_indices"}, {"Min", "reduction_indices"}, + {"OneHot", "depth"}, {"Pad", "paddings"}, {"Prod", "reduction_indices"}, {"RandomStandardNormal", "shape"}, diff --git a/tensorflow/compiler/tf2xla/kernels/BUILD b/tensorflow/compiler/tf2xla/kernels/BUILD index c6b7cd21bc..07cc4414f7 100644 --- a/tensorflow/compiler/tf2xla/kernels/BUILD +++ b/tensorflow/compiler/tf2xla/kernels/BUILD @@ -33,6 +33,7 @@ tf_kernel_library( "lrn_ops.cc", "matmul_op.cc", "no_op.cc", + "one_hot_op.cc", "pack_op.cc", "pad_op.cc", "pooling_ops.cc", diff --git a/tensorflow/compiler/tf2xla/kernels/one_hot_op.cc b/tensorflow/compiler/tf2xla/kernels/one_hot_op.cc new file mode 100644 index 0000000000..a7e41fe1bf --- /dev/null +++ b/tensorflow/compiler/tf2xla/kernels/one_hot_op.cc @@ -0,0 +1,131 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// XLA implementation of OneHot operator. + +#include "tensorflow/compiler/tf2xla/literal_util.h" +#include "tensorflow/compiler/tf2xla/xla_op_kernel.h" +#include "tensorflow/compiler/tf2xla/xla_op_registry.h" + +namespace tensorflow { +namespace { + +template +Tensor MakeLinspaceTensor(const TensorShape& shape, int64 depth) { + Tensor linspace(DataTypeToEnum::v(), shape); + auto linspace_flat = linspace.flat(); + for (int64 i = 0; i < depth; ++i) { + linspace_flat(i) = i; + } + return linspace; +} + +class OneHotOp : public XlaOpKernel { + public: + explicit OneHotOp(OpKernelConstruction* ctx) : XlaOpKernel(ctx) { + OP_REQUIRES_OK(ctx, ctx->GetAttr("axis", &axis_)); + } + + void Compile(XlaOpKernelContext* ctx) override { + const TensorShape indices_shape = ctx->InputShape(0); + const TensorShape depth_shape = ctx->InputShape(1); + const TensorShape on_value_shape = ctx->InputShape(2); + const TensorShape off_value_shape = ctx->InputShape(3); + + const int indices_dims = indices_shape.dims(); + const int output_dims = indices_dims + 1; + + // Preliminary validation of sizes. + OP_REQUIRES( + ctx, axis_ == -1 || (axis_ >= 0 && axis_ < output_dims), + errors::InvalidArgument("Expected axis to be -1 or between [0, ", + output_dims, "). But received: ", axis_)); + OP_REQUIRES(ctx, TensorShapeUtils::IsScalar(depth_shape), + errors::InvalidArgument("depth must be a scalar, but got: ", + depth_shape.DebugString())); + OP_REQUIRES(ctx, TensorShapeUtils::IsScalar(on_value_shape), + errors::InvalidArgument("on_value must be a scalar, but got: ", + on_value_shape.DebugString())); + OP_REQUIRES(ctx, TensorShapeUtils::IsScalar(off_value_shape), + errors::InvalidArgument("off_value must be a scalar, but got: ", + off_value_shape.DebugString())); + + const int axis = (axis_ == -1) ? indices_dims : axis_; + + // The one-hot dimension. + int64 depth; + OP_REQUIRES_OK(ctx, ctx->ConstantInputAsIntScalar(1, &depth)); + OP_REQUIRES( + ctx, depth >= 0, + errors::InvalidArgument("depth must be non-negative, got: ", depth)); + + TensorShape output_shape = indices_shape; + output_shape.InsertDim(axis, depth); + + xla::ComputationDataHandle on_value = ctx->Input(2); + xla::ComputationDataHandle off_value = ctx->Input(3); + + // Build a Tensor populated with values 0, 1, 2, ... depth. + std::vector linspace_dims(output_dims, 1); + linspace_dims[axis] = depth; + TensorShape linspace_shape(linspace_dims); + Tensor linspace; + switch (ctx->input_type(0)) { + case DT_UINT8: + linspace = MakeLinspaceTensor(linspace_shape, depth); + break; + case DT_INT32: + linspace = MakeLinspaceTensor(linspace_shape, depth); + break; + case DT_INT64: + linspace = MakeLinspaceTensor(linspace_shape, depth); + break; + default: + ctx->SetStatus(errors::InvalidArgument( + "Invalid argument type ", DataTypeString(ctx->input_type(0)))); + return; + } + xla::Literal linspace_literal; + OP_REQUIRES_OK(ctx, HostTensorToLiteral(linspace, &linspace_literal)); + + xla::ComputationBuilder* builder = ctx->builder(); + xla::ComputationDataHandle indices = ctx->Input(0); + + // Broadcast the linspace constant across the indices along the new axis, + // and test equality at each position. + std::vector broadcast_dims(indices_shape.dims()); + std::iota(broadcast_dims.begin(), broadcast_dims.begin() + axis, 0); + std::iota(broadcast_dims.begin() + axis, broadcast_dims.end(), axis + 1); + xla::ComputationDataHandle one_hot = + builder->Eq(indices, builder->ConstantLiteral(linspace_literal), + broadcast_dims); + + // Selects the user-provided off_value and on_value values. + ctx->SetOutput( + 0, builder->Select( + one_hot, builder->Broadcast(on_value, output_shape.dim_sizes()), + builder->Broadcast(off_value, output_shape.dim_sizes()))); + } + + private: + int32 axis_; + + TF_DISALLOW_COPY_AND_ASSIGN(OneHotOp); +}; + +REGISTER_XLA_OP("OneHot", OneHotOp); + +} // namespace +} // namespace tensorflow diff --git a/tensorflow/compiler/tf2xla/literal_util.h b/tensorflow/compiler/tf2xla/literal_util.h index 3e509375ef..e8b2233853 100644 --- a/tensorflow/compiler/tf2xla/literal_util.h +++ b/tensorflow/compiler/tf2xla/literal_util.h @@ -24,8 +24,8 @@ limitations under the License. namespace tensorflow { -// Copies 'host_tensor' to an XLA Literal. Fails if the host_tensor has zero -// elements or is of an unsupported type. +// Copies 'host_tensor' to an XLA Literal. Fails if host_tensor is of an +// unsupported type. Status HostTensorToLiteral(const Tensor& host_tensor, xla::Literal* literal); // Copies 'literal' to 'host_tensor', which is allocated of type . diff --git a/tensorflow/compiler/tf2xla/op_registrations.cc b/tensorflow/compiler/tf2xla/op_registrations.cc index 171e96d3b6..324634ac0c 100644 --- a/tensorflow/compiler/tf2xla/op_registrations.cc +++ b/tensorflow/compiler/tf2xla/op_registrations.cc @@ -168,6 +168,8 @@ REGISTER_XLA_KERNEL(DEVICE_CPU_XLA_JIT, Name("Neg").TypeConstraint("T", kCpuNumericTypes)); REGISTER_XLA_KERNEL(DEVICE_CPU_XLA_JIT, Name("NotEqual").TypeConstraint("T", kCpuNumericTypes)); +REGISTER_XLA_KERNEL(DEVICE_CPU_XLA_JIT, + Name("OneHot").TypeConstraint("T", kCpuAllTypes)); REGISTER_XLA_KERNEL(DEVICE_CPU_XLA_JIT, Name("Pack").TypeConstraint("T", kCpuAllTypes)); REGISTER_XLA_KERNEL(DEVICE_CPU_XLA_JIT, @@ -432,6 +434,8 @@ REGISTER_XLA_KERNEL(DEVICE_GPU_XLA_JIT, Name("Neg").TypeConstraint("T", kGpuNumericTypes)); REGISTER_XLA_KERNEL(DEVICE_GPU_XLA_JIT, Name("NotEqual").TypeConstraint("T", kGpuNumericTypes)); +REGISTER_XLA_KERNEL(DEVICE_GPU_XLA_JIT, + Name("OneHot").TypeConstraint("T", kGpuAllTypes)); REGISTER_XLA_KERNEL(DEVICE_GPU_XLA_JIT, Name("Pack").TypeConstraint("T", kGpuAllTypes)); REGISTER_XLA_KERNEL(DEVICE_GPU_XLA_JIT, diff --git a/tensorflow/compiler/tf2xla/xla_op_kernel.cc b/tensorflow/compiler/tf2xla/xla_op_kernel.cc index f51adba617..dc5a342bcd 100644 --- a/tensorflow/compiler/tf2xla/xla_op_kernel.cc +++ b/tensorflow/compiler/tf2xla/xla_op_kernel.cc @@ -137,6 +137,27 @@ Status XlaOpKernelContext::ConstantInputReshaped( return Status::OK(); } +// Converts an int32 or int64 scalar literal to an int64. +static Status LiteralToInt64Scalar(const xla::Literal& literal, int64* out) { + if (xla::ShapeUtil::Rank(literal.shape()) != 0) { + return errors::InvalidArgument("value is not a scalar"); + } + if (literal.shape().element_type() == xla::S32) { + *out = xla::LiteralUtil::Get(literal, {}); + } else if (literal.shape().element_type() == xla::S64) { + *out = xla::LiteralUtil::Get(literal, {}); + } else { + return errors::InvalidArgument("value must be either int32 or int64"); + } + return Status::OK(); +} + +Status XlaOpKernelContext::ConstantInputAsIntScalar(int index, int64* out) { + xla::Literal literal; + TF_RETURN_IF_ERROR(ConstantInput(index, &literal)); + return LiteralToInt64Scalar(literal, out); +} + // Converts an int32 or int64 1D literal to an int64 vector. static Status LiteralToInt64Vector(const xla::Literal& literal, std::vector* out) { diff --git a/tensorflow/compiler/tf2xla/xla_op_kernel.h b/tensorflow/compiler/tf2xla/xla_op_kernel.h index badc8e2274..d214879e3c 100644 --- a/tensorflow/compiler/tf2xla/xla_op_kernel.h +++ b/tensorflow/compiler/tf2xla/xla_op_kernel.h @@ -103,6 +103,9 @@ class XlaOpKernelContext { Status ConstantInputReshaped(int index, gtl::ArraySlice new_shape, xla::Literal* constant_literal); + // Converts a constant 1D int32 or int64 tensor into an int64. + Status ConstantInputAsIntScalar(int index, int64* out); + // Converts a constant 1D int32 or int64 tensor into a vector of int64s. Status ConstantInputAsIntVector(int index, std::vector* out); diff --git a/tensorflow/core/kernels/one_hot_op.cc b/tensorflow/core/kernels/one_hot_op.cc index 1dc1bf65b2..c1295291dc 100644 --- a/tensorflow/core/kernels/one_hot_op.cc +++ b/tensorflow/core/kernels/one_hot_op.cc @@ -75,6 +75,9 @@ class OneHotOp : public OpKernel { // The one-hot dimension. const int32 depth_v = depth.scalar()(); + OP_REQUIRES( + ctx, depth_v >= 0, + errors::InvalidArgument("depth must be non-negative, got: ", depth_v)); TensorShape output_shape = indices_shape; output_shape.InsertDim(axis, depth_v); -- GitLab From c0b379385bb23ad86c7233458f42c62aa7538788 Mon Sep 17 00:00:00 2001 From: Ian Langmore Date: Wed, 1 Mar 2017 07:31:58 -0800 Subject: [PATCH 083/101] LinearOperatorUDVHUpdate argument name change: diag --> update_diag Change: 148886147 --- .../python/ops/mvn_diag_plus_low_rank.py | 4 +- .../linear_operator_udvh_update_test.py | 68 +++++++-------- .../python/ops/linear_operator_udvh_update.py | 82 ++++++++++--------- 3 files changed, 79 insertions(+), 75 deletions(-) diff --git a/tensorflow/contrib/distributions/python/ops/mvn_diag_plus_low_rank.py b/tensorflow/contrib/distributions/python/ops/mvn_diag_plus_low_rank.py index 9806839106..ac0836736e 100644 --- a/tensorflow/contrib/distributions/python/ops/mvn_diag_plus_low_rank.py +++ b/tensorflow/contrib/distributions/python/ops/mvn_diag_plus_low_rank.py @@ -240,8 +240,8 @@ class MultivariateNormalDiagPlusLowRank( scale = linalg.LinearOperatorUDVHUpdate( scale, u=scale_perturb_factor, - diag=scale_perturb_diag, - is_diag_positive=scale_perturb_diag is None, + diag_update=scale_perturb_diag, + is_diag_update_positive=scale_perturb_diag is None, is_non_singular=True, # Implied by is_positive_definite=True. is_self_adjoint=True, is_positive_definite=True, diff --git a/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_udvh_update_test.py b/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_udvh_update_test.py index 019f73312a..7abe12f1a4 100644 --- a/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_udvh_update_test.py +++ b/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_udvh_update_test.py @@ -39,13 +39,13 @@ class BaseLinearOperatorUDVHUpdatetest(object): # If True, A = L + UDV^H # If False, A = L + UV^H or A = L + UU^H, depending on _use_v. - _use_diag_perturbation = None + _use_diag_update = None # If True, diag is > 0, which means D is symmetric positive definite. - _is_diag_positive = None + _is_diag_update_positive = None # If True, A = L + UDV^H - # If False, A = L + UDU^H or A = L + UU^H, depending on _use_diag_perturbation + # If False, A = L + UDU^H or A = L + UU^H, depending on _use_diag_update _use_v = None @property @@ -67,7 +67,7 @@ class BaseLinearOperatorUDVHUpdatetest(object): diag_shape = shape[:-1] k = shape[-2] // 2 + 1 u_perturbation_shape = shape[:-1] + [k] - diag_perturbation_shape = shape[:-2] + [k] + diag_update_shape = shape[:-2] + [k] # base_operator L will be a symmetric positive definite diagonal linear # operator, with condition number as high as 1e4. @@ -86,13 +86,13 @@ class BaseLinearOperatorUDVHUpdatetest(object): v_ph = array_ops.placeholder(dtype=dtype) # D - if self._is_diag_positive: - diag_perturbation = linear_operator_test_util.random_uniform( - diag_perturbation_shape, minval=1e-4, maxval=1., dtype=dtype) + if self._is_diag_update_positive: + diag_update = linear_operator_test_util.random_uniform( + diag_update_shape, minval=1e-4, maxval=1., dtype=dtype) else: - diag_perturbation = linear_operator_test_util.random_normal( - diag_perturbation_shape, stddev=1e-4, dtype=dtype) - diag_perturbation_ph = array_ops.placeholder(dtype=dtype) + diag_update = linear_operator_test_util.random_normal( + diag_update_shape, stddev=1e-4, dtype=dtype) + diag_update_ph = array_ops.placeholder(dtype=dtype) if use_placeholder: # Evaluate here because (i) you cannot feed a tensor, and (ii) @@ -101,7 +101,7 @@ class BaseLinearOperatorUDVHUpdatetest(object): base_diag = base_diag.eval() u = u.eval() v = v.eval() - diag_perturbation = diag_perturbation.eval() + diag_update = diag_update.eval() # In all cases, set base_operator to be positive definite. base_operator = linalg.LinearOperatorDiag( @@ -111,13 +111,13 @@ class BaseLinearOperatorUDVHUpdatetest(object): base_operator, u=u_ph, v=v_ph if self._use_v else None, - diag=diag_perturbation_ph if self._use_diag_perturbation else None, - is_diag_positive=self._is_diag_positive) + diag_update=diag_update_ph if self._use_diag_update else None, + is_diag_update_positive=self._is_diag_update_positive) feed_dict = { base_diag_ph: base_diag, u_ph: u, v_ph: v, - diag_perturbation_ph: diag_perturbation} + diag_update_ph: diag_update} else: base_operator = linalg.LinearOperatorDiag( base_diag, is_positive_definite=True) @@ -125,31 +125,31 @@ class BaseLinearOperatorUDVHUpdatetest(object): base_operator, u, v=v if self._use_v else None, - diag=diag_perturbation if self._use_diag_perturbation else None, - is_diag_positive=self._is_diag_positive) + diag_update=diag_update if self._use_diag_update else None, + is_diag_update_positive=self._is_diag_update_positive) feed_dict = None # The matrix representing L base_diag_mat = array_ops.matrix_diag(base_diag) # The matrix representing D - diag_perturbation_mat = array_ops.matrix_diag(diag_perturbation) + diag_update_mat = array_ops.matrix_diag(diag_update) # Set up mat as some variant of A = L + UDV^H - if self._use_v and self._use_diag_perturbation: + if self._use_v and self._use_diag_update: # In this case, we have L + UDV^H and it isn't symmetric. expect_use_cholesky = False mat = base_diag_mat + math_ops.matmul( - u, math_ops.matmul(diag_perturbation_mat, v, adjoint_b=True)) + u, math_ops.matmul(diag_update_mat, v, adjoint_b=True)) elif self._use_v: # In this case, we have L + UDV^H and it isn't symmetric. expect_use_cholesky = False mat = base_diag_mat + math_ops.matmul(u, v, adjoint_b=True) - elif self._use_diag_perturbation: + elif self._use_diag_update: # In this case, we have L + UDU^H, which is PD if D > 0, since L > 0. - expect_use_cholesky = self._is_diag_positive + expect_use_cholesky = self._is_diag_update_positive mat = base_diag_mat + math_ops.matmul( - u, math_ops.matmul(diag_perturbation_mat, u, adjoint_b=True)) + u, math_ops.matmul(diag_update_mat, u, adjoint_b=True)) else: # In this case, we have L + UU^H, which is PD since L > 0. expect_use_cholesky = True @@ -168,8 +168,8 @@ class LinearOperatorUDVHUpdatetestWithDiagUseCholesky( linear_operator_test_util.SquareLinearOperatorDerivedClassTest): """A = L + UDU^H, D > 0, L > 0 ==> A > 0 and we can use a Cholesky.""" - _use_diag_perturbation = True - _is_diag_positive = True + _use_diag_update = True + _is_diag_update_positive = True _use_v = False def setUp(self): @@ -186,8 +186,8 @@ class LinearOperatorUDVHUpdatetestWithDiagCannotUseCholesky( linear_operator_test_util.SquareLinearOperatorDerivedClassTest): """A = L + UDU^H, D !> 0, L > 0 ==> A !> 0 and we cannot use a Cholesky.""" - _use_diag_perturbation = True - _is_diag_positive = False + _use_diag_update = True + _is_diag_update_positive = False _use_v = False def setUp(self): @@ -205,8 +205,8 @@ class LinearOperatorUDVHUpdatetestNoDiagUseCholesky( linear_operator_test_util.SquareLinearOperatorDerivedClassTest): """A = L + UU^H, L > 0 ==> A > 0 and we can use a Cholesky.""" - _use_diag_perturbation = False - _is_diag_positive = None + _use_diag_update = False + _is_diag_update_positive = None _use_v = False def setUp(self): @@ -223,8 +223,8 @@ class LinearOperatorUDVHUpdatetestNoDiagCannotUseCholesky( linear_operator_test_util.SquareLinearOperatorDerivedClassTest): """A = L + UV^H, L > 0 ==> A is not symmetric and we cannot use a Cholesky.""" - _use_diag_perturbation = False - _is_diag_positive = None + _use_diag_update = False + _is_diag_update_positive = None _use_v = True def setUp(self): @@ -242,8 +242,8 @@ class LinearOperatorUDVHUpdatetestWithDiagNotSquare( linear_operator_test_util.NonSquareLinearOperatorDerivedClassTest): """A = L + UDU^H, D > 0, L > 0 ==> A > 0 and we can use a Cholesky.""" - _use_diag_perturbation = True - _is_diag_positive = True + _use_diag_update = True + _is_diag_update_positive = True _use_v = True @@ -309,14 +309,14 @@ class LinearOpearatorUDVHUpdateBroadcastsShape(test.TestCase): u = rng.rand(5, 3, 2) diag = rng.rand(5, 4) # Last dimension should be 2 with self.assertRaisesRegexp(ValueError, "not compatible"): - linalg.LinearOperatorUDVHUpdate(base_operator, u=u, diag=diag) + linalg.LinearOperatorUDVHUpdate(base_operator, u=u, diag_update=diag) def test_diag_incompatible_batch_shape_raises(self): base_operator = linalg.LinearOperatorIdentity(num_rows=3, dtype=np.float64) u = rng.rand(5, 3, 2) diag = rng.rand(4, 2) # First dimension should be 5 with self.assertRaisesRegexp(ValueError, "Incompatible shapes"): - linalg.LinearOperatorUDVHUpdate(base_operator, u=u, diag=diag) + linalg.LinearOperatorUDVHUpdate(base_operator, u=u, diag_update=diag) if __name__ == "__main__": diff --git a/tensorflow/contrib/linalg/python/ops/linear_operator_udvh_update.py b/tensorflow/contrib/linalg/python/ops/linear_operator_udvh_update.py index bce27dcd6f..7c7776e624 100644 --- a/tensorflow/contrib/linalg/python/ops/linear_operator_udvh_update.py +++ b/tensorflow/contrib/linalg/python/ops/linear_operator_udvh_update.py @@ -61,14 +61,14 @@ class LinearOperatorUDVHUpdate(linear_operator.LinearOperator): ```python # Create a 3 x 3 diagonal linear operator. diag_operator = LinearOperatorDiag( - diag=[1., 2., 3.], is_non_singular=True, is_self_adjoint=True, + diag_update=[1., 2., 3.], is_non_singular=True, is_self_adjoint=True, is_positive_definite=True) # Perturb with a rank 2 perturbation operator = LinearOperatorUDVHUpdate( operator=diag_operator, u=[[1., 2.], [-1., 3.], [0., 0.]], - diag=[11., 12.], + diag_update=[11., 12.], v=[[1., 2.], [-1., 3.], [10., 10.]]) operator.shape @@ -112,7 +112,8 @@ class LinearOperatorUDVHUpdate(linear_operator.LinearOperator): #### Matrix property hints This `LinearOperator` is initialized with boolean flags of the form `is_X`, - for `X = non_singular, self_adjoint, positive_definite, diag_positive, square` + for `X = non_singular, self_adjoint, positive_definite, diag_update_positive` + and `square` These have the following meaning * If `is_X == True`, callers should expect the operator to have the property `X`. This is a promise that should be fulfilled, but is *not* a @@ -126,9 +127,9 @@ class LinearOperatorUDVHUpdate(linear_operator.LinearOperator): def __init__(self, base_operator, u, - diag=None, + diag_update=None, v=None, - is_diag_positive=None, + is_diag_update_positive=None, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, @@ -151,13 +152,14 @@ class LinearOperatorUDVHUpdate(linear_operator.LinearOperator): `LinearOperator`. This is `L` above. u: Shape `[B1,...,Bb, M, K]` `Tensor` of same `dtype` as `base_operator`. This is `U` above. - diag: Optional shape `[B1,...,Bb, K]` `Tensor` with same `dtype` as - `base_operator`. This is the diagonal of `D` above. + diag_update: Optional shape `[B1,...,Bb, K]` `Tensor` with same `dtype` + as `base_operator`. This is the diagonal of `D` above. Defaults to `D` being the identity operator. v: Optional `Tensor` of same `dtype` as `u` and shape `[B1,...,Bb, N, K]` Defaults to `v = u`, in which case the perturbation is symmetric. If `M != N`, then `v` must be set since the perturbation is not square. - is_diag_positive: Python `bool`. If `True`, expect `diag > 0`. + is_diag_update_positive: Python `bool`. + If `True`, expect `diag_update > 0`. is_non_singular: Expect that this operator is non-singular. Default is `None`, unless `is_positive_definite` is auto-set to be `True` (see below). @@ -166,8 +168,8 @@ class LinearOperatorUDVHUpdate(linear_operator.LinearOperator): and `v = None` (meaning `u=v`), in which case this defaults to `True`. is_positive_definite: Expect that this operator is positive definite. Default is `None`, unless `base_operator` is positive-definite - `v = None` (meaning `u=v`), and `is_diag_positive`, in which case this - defaults to `True`. + `v = None` (meaning `u=v`), and `is_diag_update_positive`, in which case + this defaults to `True`. is_square: Expect that this operator acts like square [batch] matrices. name: A name for this `LinearOperator`. @@ -177,10 +179,10 @@ class LinearOperatorUDVHUpdate(linear_operator.LinearOperator): # TODO(langmore) support complex types. # Complex types are not allowed due to tf.cholesky() requiring float. # If complex dtypes are allowed, we update the following - # 1. is_diag_positive should still imply that `diag > 0`, but we need to - # remind the user that this implies diag is real. This is needed because - # if diag has non-zero imaginary part, it will not be self-adjoint - # positive definite. + # 1. is_diag_update_positive should still imply that `diag > 0`, but we need + # to remind the user that this implies diag is real. This is needed + # because if diag has non-zero imaginary part, it will not be + # self-adjoint positive definite. dtype = base_operator.dtype allowed_dtypes = [dtypes.float32, dtypes.float64] if dtype not in allowed_dtypes: @@ -188,17 +190,17 @@ class LinearOperatorUDVHUpdate(linear_operator.LinearOperator): "Argument matrix must have dtype in %s. Found: %s" % (allowed_dtypes, dtype)) - if diag is None: - if is_diag_positive is False: + if diag_update is None: + if is_diag_update_positive is False: raise ValueError( "Default diagonal is the identity, which is positive. However, " - "user set 'is_diag_positive' to False.") - is_diag_positive = True + "user set 'is_diag_update_positive' to False.") + is_diag_update_positive = True # In this case, we can use a Cholesky decomposition to help us solve/det. self._use_cholesky = ( base_operator.is_positive_definite and base_operator.is_self_adjoint - and is_diag_positive + and is_diag_update_positive and v is None) # Possibly auto-set some characteristic flags from None to True. @@ -223,7 +225,7 @@ class LinearOperatorUDVHUpdate(linear_operator.LinearOperator): is_positive_definite = True is_self_adjoint = True - values = base_operator.graph_parents + [u, diag, v] + values = base_operator.graph_parents + [u, diag_update, v] with ops.name_scope(name, values=values): # Create U and V. @@ -233,14 +235,16 @@ class LinearOperatorUDVHUpdate(linear_operator.LinearOperator): else: self._v = ops.convert_to_tensor(v, name="v") - if diag is None: - self._diag = None + if diag_update is None: + self._diag_update = None else: - self._diag = ops.convert_to_tensor(diag, name="diag") + self._diag_update = ops.convert_to_tensor( + diag_update, name="diag_update") # Create base_operator L. self._base_operator = base_operator - graph_parents = base_operator.graph_parents + [self.u, self._diag, self.v] + graph_parents = base_operator.graph_parents + [ + self.u, self._diag_update, self.v] graph_parents = [p for p in graph_parents if p is not None] super(LinearOperatorUDVHUpdate, self).__init__( @@ -253,11 +257,11 @@ class LinearOperatorUDVHUpdate(linear_operator.LinearOperator): name=name) # Create the diagonal operator D. - self._set_diag_operators(diag, is_diag_positive) - self._is_diag_positive = is_diag_positive + self._set_diag_operators(diag_update, is_diag_update_positive) + self._is_diag_update_positive = is_diag_update_positive contrib_tensor_util.assert_same_float_dtype( - (base_operator, self.u, self.v, self._diag)) + (base_operator, self.u, self.v, self._diag_update)) self._check_shapes() # Pre-compute the so-called "capacitance" matrix @@ -278,18 +282,18 @@ class LinearOperatorUDVHUpdate(linear_operator.LinearOperator): self.base_operator.domain_dimension.assert_is_compatible_with( uv_shape[-2]) - if self._diag is not None: - uv_shape[-1].assert_is_compatible_with(self._diag.get_shape()[-1]) + if self._diag_update is not None: + uv_shape[-1].assert_is_compatible_with(self._diag_update.get_shape()[-1]) array_ops.broadcast_static_shape( - batch_shape, self._diag.get_shape()[:-1]) + batch_shape, self._diag_update.get_shape()[:-1]) - def _set_diag_operators(self, diag, is_diag_positive): - """Set attributes self._diag and self._diag_operator.""" - if diag is not None: + def _set_diag_operators(self, diag_update, is_diag_update_positive): + """Set attributes self._diag_update and self._diag_operator.""" + if diag_update is not None: self._diag_operator = linear_operator_diag.LinearOperatorDiag( - self._diag, is_positive_definite=is_diag_positive) + self._diag_update, is_positive_definite=is_diag_update_positive) self._diag_inv_operator = linear_operator_diag.LinearOperatorDiag( - 1. / self._diag, is_positive_definite=is_diag_positive) + 1. / self._diag_update, is_positive_definite=is_diag_update_positive) else: if self.u.get_shape()[-1].value is not None: r = self.u.get_shape()[-1].value @@ -310,14 +314,14 @@ class LinearOperatorUDVHUpdate(linear_operator.LinearOperator): return self._v @property - def is_diag_positive(self): + def is_diag_update_positive(self): """If this operator is `A = L + U D V^H`, this hints `D > 0` elementwise.""" - return self._is_diag_positive + return self._is_diag_update_positive @property - def diag_arg(self): + def diag_update(self): """If this operator is `A = L + U D V^H`, this is the diagonal of `D`.""" - return self._diag + return self._diag_update @property def diag_operator(self): -- GitLab From 21df335b5eacc4f0656d50bf3bc6a77cda268bde Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 1 Mar 2017 07:38:56 -0800 Subject: [PATCH 084/101] Remove workarounds that deal with spaces in macro expansions. Selective registrations has now been changed to handle these space properly. Change: 148886703 --- tensorflow/core/kernels/aggregate_ops.cc | 6 +----- tensorflow/core/kernels/constant_op.cc | 6 +----- tensorflow/core/kernels/cwise_ops_common.h | 11 +---------- tensorflow/core/kernels/scatter_op.cc | 8 ++------ 4 files changed, 5 insertions(+), 26 deletions(-) diff --git a/tensorflow/core/kernels/aggregate_ops.cc b/tensorflow/core/kernels/aggregate_ops.cc index ff6fb7add5..d95dcf576c 100644 --- a/tensorflow/core/kernels/aggregate_ops.cc +++ b/tensorflow/core/kernels/aggregate_ops.cc @@ -140,11 +140,7 @@ class AddNOp : public OpKernel { Name("AddN").Device(DEVICE_##dev).TypeConstraint("T"), \ AddNOp) -// There can be no space in front of "CPU" here as that space would become part -// of the kernel name due to a Clang bug. -// clang-format off -#define REGISTER_ADDN_CPU(type) REGISTER_ADDN(type,CPU) -// clang-format on +#define REGISTER_ADDN_CPU(type) REGISTER_ADDN(type, CPU) TF_CALL_NUMBER_TYPES(REGISTER_ADDN_CPU); #undef REGISTER_ADDN_CPU diff --git a/tensorflow/core/kernels/constant_op.cc b/tensorflow/core/kernels/constant_op.cc index 3ccc727fac..115a842d1c 100644 --- a/tensorflow/core/kernels/constant_op.cc +++ b/tensorflow/core/kernels/constant_op.cc @@ -240,11 +240,7 @@ class ZerosLikeOp : public OpKernel { Name("ZerosLike").Device(DEVICE_##dev).TypeConstraint("T"), \ ZerosLikeOp) -// There can be no space in front of "CPU" here as that space would become part -// of the kernel name due to a Clang bug. -// clang-format off -#define REGISTER_CPU(type) REGISTER_KERNEL(type,CPU) -// clang-format on +#define REGISTER_CPU(type) REGISTER_KERNEL(type, CPU) TF_CALL_POD_STRING_TYPES(REGISTER_CPU); #undef REGISTER_CPU diff --git a/tensorflow/core/kernels/cwise_ops_common.h b/tensorflow/core/kernels/cwise_ops_common.h index 4627f77931..1affc3a779 100644 --- a/tensorflow/core/kernels/cwise_ops_common.h +++ b/tensorflow/core/kernels/cwise_ops_common.h @@ -420,16 +420,7 @@ struct UnaryFunctor { } // end namespace functor -// This is a workaround for a bug in Clang. Clang currently keeps up to one -// space in front of a macro arg when first concatenating (##) and then -// stringifying (#). We are currently relying on a pure substring match in the -// generated SHOULD_REGISTER_OP_KERNEL macros and the space can lead to a -// mismatch. Remove when all supported versions of Clang are fixed or -// SHOULD_REGISTER_OP_KERNEL is made more robust wrt. these spaces. -// clang-format off -#define REGISTER(OP, D, N, F, T) REGISTER_INTERNAL(OP,D, N, F, T) -// clang-format on -#define REGISTER_INTERNAL(OP, D, N, F, T) \ +#define REGISTER(OP, D, N, F, T) \ REGISTER_KERNEL_BUILDER(Name(N).Device(DEVICE_##D).TypeConstraint("T"), \ OP>); diff --git a/tensorflow/core/kernels/scatter_op.cc b/tensorflow/core/kernels/scatter_op.cc index d1df346b95..827eb7dbca 100644 --- a/tensorflow/core/kernels/scatter_op.cc +++ b/tensorflow/core/kernels/scatter_op.cc @@ -138,13 +138,9 @@ class ScatterUpdateOp : public OpKernel { .TypeConstraint("Tindices"), \ ScatterUpdateOp) -// There can be no space in front of "dev" here as that space would become part -// of the kernel name due to a Clang bug. -// clang-format off #define REGISTER_SCATTER_KERNEL(type, dev, name, op) \ - REGISTER_SCATTER_KERNEL_INDEX(type, int32,dev, name, op); \ - REGISTER_SCATTER_KERNEL_INDEX(type, int64,dev, name, op); -// clang-format on + REGISTER_SCATTER_KERNEL_INDEX(type, int32, dev, name, op); \ + REGISTER_SCATTER_KERNEL_INDEX(type, int64, dev, name, op); #define REGISTER_SCATTER_ARITHEMTIC(type, dev) \ REGISTER_SCATTER_KERNEL(type, dev, "ScatterAdd", scatter_op::UpdateOp::ADD); \ -- GitLab From 2d64339bb2e1b5cd761aced7bfcb57534f326dd3 Mon Sep 17 00:00:00 2001 From: Ian Langmore Date: Wed, 1 Mar 2017 08:40:02 -0800 Subject: [PATCH 085/101] histogram_ops BUGFIX: Float64 was not previously handled. Also removing unnecessary tests. Some tests checked proper use of state, and were added at a time when histogram_fixed_width created an internal Variable. Since histogram is now (and has long been) TITO, this is not necessary. Change: 148891639 --- tensorflow/python/ops/histogram_ops.py | 8 +- tensorflow/python/ops/histogram_ops_test.py | 97 +++------------------ 2 files changed, 18 insertions(+), 87 deletions(-) diff --git a/tensorflow/python/ops/histogram_ops.py b/tensorflow/python/ops/histogram_ops.py index 2696c5d3b4..c145b11191 100644 --- a/tensorflow/python/ops/histogram_ops.py +++ b/tensorflow/python/ops/histogram_ops.py @@ -44,9 +44,9 @@ def histogram_fixed_width(values, Args: values: Numeric `Tensor`. - value_range: Shape [2] `Tensor`. new_values <= value_range[0] will be - mapped to hist[0], values >= value_range[1] will be mapped to hist[-1]. - Must be same dtype as new_values. + value_range: Shape [2] `Tensor` of same `dtype` as `values`. + values <= value_range[0] will be mapped to hist[0], + values >= value_range[1] will be mapped to hist[-1]. nbins: Scalar `int32 Tensor`. Number of histogram bins. dtype: dtype for returned histogram. name: A name for this operation (defaults to 'histogram_fixed_width'). @@ -74,7 +74,7 @@ def histogram_fixed_width(values, values = array_ops.reshape(values, [-1]) value_range = ops.convert_to_tensor(value_range, name='value_range') nbins = ops.convert_to_tensor(nbins, dtype=dtypes.int32, name='nbins') - nbins_float = math_ops.to_float(nbins) + nbins_float = math_ops.cast(nbins, values.dtype) # Map tensor values that fall within value_range to [0, 1]. scaled_values = math_ops.truediv(values - value_range[0], diff --git a/tensorflow/python/ops/histogram_ops_test.py b/tensorflow/python/ops/histogram_ops_test.py index dd04d2f2ae..e819e0234d 100644 --- a/tensorflow/python/ops/histogram_ops_test.py +++ b/tensorflow/python/ops/histogram_ops_test.py @@ -21,10 +21,7 @@ from __future__ import print_function import numpy as np from tensorflow.python.framework import dtypes -from tensorflow.python.ops import array_ops from tensorflow.python.ops import histogram_ops -from tensorflow.python.ops import init_ops -from tensorflow.python.ops import variables from tensorflow.python.platform import test @@ -41,108 +38,42 @@ class HistogramFixedWidthTest(test.TestCase): expected_bin_counts = [0, 0, 0, 0, 0] with self.test_session(): hist = histogram_ops.histogram_fixed_width(values, value_range, nbins=5) - - # Hist should start "fresh" with every eval. - self.assertAllClose(expected_bin_counts, hist.eval()) + self.assertEqual(dtypes.int32, hist.dtype) self.assertAllClose(expected_bin_counts, hist.eval()) - def test_one_update_on_constant_input(self): + def test_1d_values_int64_output(self): # Bins will be: # (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf) value_range = [0.0, 5.0] values = [-1.0, 0.0, 1.5, 2.0, 5.0, 15] expected_bin_counts = [2, 1, 1, 0, 2] with self.test_session(): - hist = histogram_ops.histogram_fixed_width(values, value_range, nbins=5) - - # Hist should start "fresh" with every eval. - self.assertAllClose(expected_bin_counts, hist.eval()) + hist = histogram_ops.histogram_fixed_width( + values, value_range, nbins=5, dtype=dtypes.int64) + self.assertEqual(dtypes.int64, hist.dtype) self.assertAllClose(expected_bin_counts, hist.eval()) - def test_one_update_on_constant_2d_input(self): + def test_1d_float64_values(self): # Bins will be: # (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf) - value_range = [0.0, 5.0] - values = [[-1.0, 0.0, 1.5], [2.0, 5.0, 15]] + value_range = np.float64([0.0, 5.0]) + values = np.float64([-1.0, 0.0, 1.5, 2.0, 5.0, 15]) expected_bin_counts = [2, 1, 1, 0, 2] with self.test_session(): hist = histogram_ops.histogram_fixed_width(values, value_range, nbins=5) - - # Hist should start "fresh" with every eval. + self.assertEqual(dtypes.int32, hist.dtype) self.assertAllClose(expected_bin_counts, hist.eval()) - self.assertAllClose(expected_bin_counts, hist.eval()) - - def test_two_updates_on_constant_input(self): - # Bins will be: - # (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf) - value_range = [0.0, 5.0] - values_1 = [-1.0, 0.0, 1.5, 2.0, 5.0, 15] - values_2 = [1.5, 4.5, 4.5, 4.5, 0.0, 0.0] - expected_bin_counts_1 = [2, 1, 1, 0, 2] - expected_bin_counts_2 = [2, 1, 0, 0, 3] - with self.test_session(): - values = array_ops.placeholder(dtypes.float32, shape=[6]) - hist = histogram_ops.histogram_fixed_width(values, value_range, nbins=5) - # The values in hist should depend on the current feed and nothing else. - self.assertAllClose( - expected_bin_counts_1, hist.eval(feed_dict={values: values_1})) - self.assertAllClose( - expected_bin_counts_2, hist.eval(feed_dict={values: values_2})) - self.assertAllClose( - expected_bin_counts_1, hist.eval(feed_dict={values: values_1})) - self.assertAllClose( - expected_bin_counts_1, hist.eval(feed_dict={values: values_1})) - - def test_two_updates_on_scalar_input(self): + def test_2d_values(self): # Bins will be: # (-inf, 1), [1, 2), [2, 3), [3, 4), [4, inf) value_range = [0.0, 5.0] - values_1 = 1.5 - values_2 = 2.5 - expected_bin_counts_1 = [0, 1, 0, 0, 0] - expected_bin_counts_2 = [0, 0, 1, 0, 0] + values = [[-1.0, 0.0, 1.5], [2.0, 5.0, 15]] + expected_bin_counts = [2, 1, 1, 0, 2] with self.test_session(): - values = array_ops.placeholder(dtypes.float32, shape=[]) hist = histogram_ops.histogram_fixed_width(values, value_range, nbins=5) - - # The values in hist should depend on the current feed and nothing else. - self.assertAllClose( - expected_bin_counts_2, hist.eval(feed_dict={values: values_2})) - self.assertAllClose( - expected_bin_counts_1, hist.eval(feed_dict={values: values_1})) - self.assertAllClose( - expected_bin_counts_1, hist.eval(feed_dict={values: values_1})) - self.assertAllClose( - expected_bin_counts_2, hist.eval(feed_dict={values: values_2})) - - def test_multiple_random_accumulating_updates_results_in_right_dist(self): - # Accumulate the updates in a new variable. Resultant - # histogram should be uniform. Use only 3 bins because with many bins it - # would be unlikely that all would be close to 1/n. If someone ever wants - # to test that, it would be better to check that the cdf was linear. - value_range = [1.0, 4.14159] - with self.test_session() as sess: - values = array_ops.placeholder(dtypes.float32, shape=[4, 4, 4]) - hist = histogram_ops.histogram_fixed_width( - values, value_range, nbins=3, dtype=dtypes.int64) - - hist_accum = variables.Variable(init_ops.zeros_initializer()( - [3], dtype=dtypes.int64)) - hist_accum = hist_accum.assign_add(hist) - - variables.global_variables_initializer().run() - - for _ in range(100): - # Map the rv: U[0, 1] --> U[value_range[0], value_range[1]]. - values_arr = ( - value_range[0] + - (value_range[1] - value_range[0]) * self.rng.rand(4, 4, 4)) - - hist_accum_arr = sess.run(hist_accum, feed_dict={values: values_arr}) - - pmf = hist_accum_arr / float(hist_accum_arr.sum()) - np.testing.assert_allclose(1 / 3, pmf, atol=0.02) + self.assertEqual(dtypes.int32, hist.dtype) + self.assertAllClose(expected_bin_counts, hist.eval()) if __name__ == '__main__': -- GitLab From 00a294d68e0f36c44fefcf2e07bf40068250a884 Mon Sep 17 00:00:00 2001 From: Skye Wanderman-Milne Date: Wed, 1 Mar 2017 09:04:46 -0800 Subject: [PATCH 086/101] Make import_graph_def work with functions This patch adds logic for recreating functions originally defined using @Defun and serialized in a GraphDef. Change: 148893654 --- tensorflow/core/graph/graph_constructor.cc | 5 + tensorflow/core/graph/graph_constructor.h | 2 + .../core/graph/graph_constructor_test.cc | 26 +++ tensorflow/python/framework/function.py | 200 ++++++++++++++---- tensorflow/python/framework/function_test.py | 183 ++++++++++++++++ tensorflow/python/framework/importer.py | 35 ++- tensorflow/python/framework/importer_test.py | 118 +++++++++-- 7 files changed, 494 insertions(+), 75 deletions(-) diff --git a/tensorflow/core/graph/graph_constructor.cc b/tensorflow/core/graph/graph_constructor.cc index 44646e9241..c68ac37fa8 100644 --- a/tensorflow/core/graph/graph_constructor.cc +++ b/tensorflow/core/graph/graph_constructor.cc @@ -22,6 +22,7 @@ limitations under the License. #include #include "tensorflow/core/common_runtime/shape_refiner.h" +#include "tensorflow/core/framework/function.pb.h" #include "tensorflow/core/framework/graph.pb.h" #include "tensorflow/core/framework/node_def_util.h" #include "tensorflow/core/framework/types.h" @@ -843,6 +844,10 @@ Status ImportGraphDef(const ImportGraphDefOptions& opts, const GraphDef& gdef, "size ", return_tensors->size(), ")"); } } + if (gdef.library().function_size() != 0) { + return errors::Unimplemented( + "Importing GraphDefs containing functions not yet implemented"); + } return GraphConstructor::Construct(opts, &gdef, g, refiner, return_tensors); } diff --git a/tensorflow/core/graph/graph_constructor.h b/tensorflow/core/graph/graph_constructor.h index 186859d132..4252b08e48 100644 --- a/tensorflow/core/graph/graph_constructor.h +++ b/tensorflow/core/graph/graph_constructor.h @@ -113,6 +113,8 @@ struct ImportGraphDefOptions { // with ops that are not defined in the binary calling ImportGraphDef. // Similar to the producer_op_list argument to import_graph_def in the // python API. + + // TODO(skyewm): Enable importing functions }; // Each `return_tensors` entry is the requested node and output index. The index diff --git a/tensorflow/core/graph/graph_constructor_test.cc b/tensorflow/core/graph/graph_constructor_test.cc index 7f4cc28a2d..c2eb8444b4 100644 --- a/tensorflow/core/graph/graph_constructor_test.cc +++ b/tensorflow/core/graph/graph_constructor_test.cc @@ -1563,6 +1563,32 @@ TEST_F(GraphConstructorTest, ImportGraphDef_ErrorsDoNoChangeTheGraph) { #undef EXPECT_IMPORT_FAILURE } +TEST_F(GraphConstructorTest, ImportGraphDef_ErrorFunctionDefsUnimplemented) { + ExpectError( + R"EOF( +library { + function { + signature { + name: "Foo_cc661786" + input_arg { + name: "x" + type: DT_FLOAT + } + output_arg { + name: "x" + type: DT_FLOAT + } + } + ret { + key: "x" + value: "x:0" + } + } +})EOF", + ImportGraphDefOptions(), + {"Importing GraphDefs containing functions not yet implemented"}); +} + TEST_F(GraphConstructorTest, CopyGraph) { const int v = TF_GRAPH_DEF_VERSION; const int bad = v + 17; diff --git a/tensorflow/python/framework/function.py b/tensorflow/python/framework/function.py index 7c0201f93e..9e7dba6946 100644 --- a/tensorflow/python/framework/function.py +++ b/tensorflow/python/framework/function.py @@ -21,6 +21,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function +import collections import hashlib import inspect import re @@ -300,7 +301,7 @@ class _FuncGraph(ops.Graph): dtype=None, initializer=None, trainable=True, - collections=None, + collections=None, # pylint: disable=redefined-outer-name use_resource=None, **kwargs): """A custom variable getter.""" @@ -517,6 +518,9 @@ class _DefinedFunction(object): outputs = [ops.convert_to_tensor(_) for _ in outputs] self._extra_inputs = temp_graph.extra_inputs inputs.extend(temp_graph.extra_args) + # pylint: disable=protected-access + self._sub_functions = temp_graph._functions + # pylint: enable=protected-access # Build the FunctionDef self._definition = _graph_to_function_def( @@ -530,61 +534,64 @@ class _DefinedFunction(object): self._definition.attr[k].CopyFrom(kwargs_attr[k]) # Hash the definition and its dependencies. - hasher = hashlib.sha1() + self._hash_str = self._create_hash_str( + self._definition.signature.input_arg, + self._definition.signature.output_arg, + self._definition.node_def) - def _hash_func_def(): - """Hash the function definition agnostic to node/map ordering.""" + # Finally, we decide the function name to use. If not specified, + # make up something which is almost certainly unique (but deterministic). + if not self._func_name: + self._func_name = "_".join([_get_func_name(self._func), self._hash_str]) + self._definition.signature.name = self._func_name + if self._func.__doc__: + self._definition.signature.description = self._func.__doc__ - def update_num(n): - hasher.update(compat.as_bytes("%x" % n)) + def _create_hash_str(self, input_arg, output_arg, node_def): + """Creates an 8-character string unique to this input. - def update_str(s): - update_num(len(s)) - hasher.update(compat.as_bytes(s)) + Args: + input_arg: the input_arg field of an OpDef + (e.g. self._definition.signature.input_arg) + output_arg: the output_arg field of an OpDef + (e.g. self._definition.signature.output_arg) + node_def: the node_def field of a FunctionDef + (e.g. self._definition.node_def) - def update_strs(slist): - update_num(len(slist)) - for s in slist: - update_str(s) + Returns: + The unique string for this input + """ + hasher = hashlib.sha1() - for adef in self._definition.signature.input_arg: - update_str(adef.SerializeToString()) + def update_num(n): + hasher.update(compat.as_bytes("%x" % n)) - for adef in self._definition.signature.output_arg: - update_str(adef.SerializeToString()) + def update_str(s): + update_num(len(s)) + hasher.update(compat.as_bytes(s)) - for n in sorted(self._definition.node_def, key=lambda n: n.name): - update_str(n.name) - update_str(n.op) - update_strs(n.input) - update_num(len(n.attr)) - # NOTE: protobuf map serialization does not guarantee ordering. - for k in sorted(n.attr): - update_str(k) - update_str(n.attr[k].SerializeToString()) + def update_strs(slist): + update_num(len(slist)) + for s in slist: + update_str(s) - _hash_func_def() - # pylint: disable=protected-access - self._sub_functions = temp_graph._functions - for subname in sorted(self._sub_functions.keys()): - hasher.update(compat.as_bytes(self._sub_functions[subname]._hash_str)) - # pylint: enable=protected-access + for adef in input_arg: + update_str(adef.SerializeToString()) - # Uses the first 8 bytes sha1 hash digest as the __hash__. - self._hash_str = hasher.hexdigest()[:8] - self._hash = int(self._hash_str, 16) + for adef in output_arg: + update_str(adef.SerializeToString()) - # Finally, we decide the function name to use. If not specified, - # make up something which is almost certainly unique. - if not self._func_name: - self._func_name = "_".join([_get_func_name(self._func), self._hash_str]) - self._definition.signature.name = self._func_name - if self._func.__doc__: - self._definition.signature.description = self._func.__doc__ + for n in sorted(node_def, key=lambda n: n.name): + update_str(n.name) + update_str(n.op) + update_strs(n.input) + update_num(len(n.attr)) + # NOTE: protobuf map serialization does not guarantee ordering. + for k in sorted(n.attr): + update_str(k) + update_str(n.attr[k].SerializeToString()) - def __hash__(self): - self._create_definition_if_needed() - return self._hash + return hasher.hexdigest()[:8] def add_to_graph(self, g): """Adds this function into the graph g.""" @@ -593,7 +600,7 @@ class _DefinedFunction(object): # pylint: disable=protected-access # If 'g' has an identical function already, do nothing. prev = g._get_function(self.name) - if prev and (prev._hash == self._hash): + if prev and (prev._hash_str == self._hash_str): return # Adds this function into 'g'. @@ -622,6 +629,105 @@ class _DefinedFunction(object): return ret +def _from_definition(fdef, grad_func=None): + """Creates a _DefinedFunction initialized from a FunctionDef proto. + + Args: + fdef: a FunctionDef + grad_func: a _DefinedFunction or None + + Returns: + A _DefinedFunction representing fdef + """ + # The Python callable is only needed to create a FunctionDef. Since we have + # the FunctionDef here, we don't need to set _DefinedFunction._func (nor do we + # have access to such a callable here). + func = None + argnames = [arg.name for arg in fdef.signature.input_arg] + input_types = tuple(dtypes.as_dtype(arg.type) + for arg in fdef.signature.input_arg) + func_name = fdef.signature.name + # Note: FunctionDefs do not include python gradient functions, so if the + # original _DefinedFunction included one it will not be reflected here. + python_grad_func = None + out_names = [arg.name for arg in fdef.signature.output_arg] + result = _DefinedFunction(func, argnames, input_types, func_name, grad_func, + python_grad_func, out_names) + # pylint: disable=protected-access + result._definition = fdef + # Captured inputs are added as regular inputs to a function when it's + # serialized, i.e. any extra inputs from the original function are now + # included in `result`._args + result._extra_inputs = [] + result._hash_str = result._create_hash_str( + result._definition.signature.input_arg, + result._definition.signature.output_arg, + result._definition.node_def) + # pylint: enable=protected-access + return result + + +def _from_library(lib): + """Creates _DefinedFunctions initialized from a FunctionDefLibrary proto. + + This method handles assigning the correct gradient functions to each + function. + + Args: + lib: a FunctionDefLibrary + + Returns: + A list of _DefinedFunctions + + Raises: + ValueError: `lib` is invalid + """ + if not lib.function and not lib.gradient: return [] + + # function name -> FunctionDef proto + funcs = {fdef.signature.name: fdef for fdef in lib.function} + + # Validate that all references function names have function defs + for g in lib.gradient: + if g.function_name not in funcs: + raise ValueError("FunctionDefLibrary missing '%s' FunctionDef\n%s" % + (g.function_name, str(lib))) + if g.gradient_func not in funcs: + raise ValueError("FunctionDefLibrary missing '%s' FunctionDef\n%s" % + (g.gradient_func, str(lib))) + + # function name -> gradient function name + func_to_grad = collections.defaultdict(lambda: None) + # gradient function name -> names of functions having that grad function + grad_to_funcs = collections.defaultdict(list) + + for gdef in lib.gradient: + func_to_grad[gdef.function_name] = gdef.gradient_func + grad_to_funcs[gdef.gradient_func].append(gdef.function_name) + + # Start with functions without gradients + ready = [fdef for fdef in lib.function + if func_to_grad[fdef.signature.name] is None] + if not ready: + raise ValueError("FunctionDefLibrary contains cyclic gradient functions!\n" + + str(lib)) + # function name -> _DefinedFunction + initialized = {} + + while ready: + fdef = ready.pop() + name = fdef.signature.name + + grad = initialized.get(func_to_grad[name]) + if func_to_grad[name]: assert grad + defined_func = _from_definition(fdef, grad_func=grad) + initialized[name] = defined_func + + ready.extend(funcs[f] for f in grad_to_funcs[name]) + + return initialized.values() + + # NOTE: The list needs to be extended when more data types are added. _DTYPE_TO_STR = { dtypes.float16: "f16", @@ -769,7 +875,7 @@ class Defun(object): default graph and adds the definition of the function into the default graph. Because the addition of the function into the graph is deferred, the decorator can be used anywhere in the program. - + Definitions of functions are frozen in a graph as soon as the graph is used to create a session. Therefore, nodes using the function must be created in the graph before the corresponding session is created. diff --git a/tensorflow/python/framework/function_test.py b/tensorflow/python/framework/function_test.py index bfe87a9869..a87f5f09bb 100644 --- a/tensorflow/python/framework/function_test.py +++ b/tensorflow/python/framework/function_test.py @@ -22,6 +22,7 @@ import time import numpy as np +from tensorflow.core.framework import function_pb2 from tensorflow.core.protobuf import config_pb2 from tensorflow.python.client import session from tensorflow.python.framework import constant_op @@ -663,6 +664,188 @@ class FunctionTest(test.TestCase): self.assertAllEqual(y.get_shape().as_list(), [1, 1, 2, 3]) +class FunctionsFromProtos(test.TestCase): + + def expectFunctionsEqual(self, func, grad_func=None, new_func=None): + if new_func is None: + # Make a copy of func.definition to avoid any bugs masked by using the + # same object + serialized_fdef = func.definition.SerializeToString() + # Serialize and then deserialize `func` to create `new_func` + fdef = function_pb2.FunctionDef.FromString(serialized_fdef) + new_func = function._from_definition(fdef, grad_func=grad_func) + self.assertEqual(func.name, new_func.name) + self.assertEqual(func.definition, new_func.definition) + self.assertEqual(func.grad_func_name, new_func.grad_func_name) + self.assertEqual(func.declared_input_types, new_func.declared_input_types) + self.assertEqual(func.captured_inputs, new_func.captured_inputs) + + def testBasic(self): + @function.Defun(dtypes.float32, dtypes.float32) + def Foo(x, y): + return x + y + self.expectFunctionsEqual(Foo) + + def testGradFunc(self): + @function.Defun(dtypes.float32, dtypes.float32) + def G(x, dy): + return x * dy + + @function.Defun(dtypes.float32, grad_func=G) + def F(x): + return math_ops.exp(x) - math_ops.exp(-x) + self.expectFunctionsEqual(F, grad_func=G) + + def testCapturedInputs(self): + c = constant_op.constant(10, dtypes.int64) + @function.Defun(dtypes.int64) + def Foo(x): + return x + c + + new_func = function._from_definition(Foo.definition) + + self.assertEqual(Foo.name, new_func.name) + self.assertEqual(Foo.definition, new_func.definition) + self.assertEqual(Foo.grad_func_name, new_func.grad_func_name) + + # Captured inputs are added as regular inputs to the function definition + self.assertEqual(new_func.declared_input_types, + Foo.declared_input_types + (dtypes.int64,)) + self.assertEqual(len(new_func.captured_inputs), 0) + + def testNestedFunctions(self): + @function.Defun(dtypes.float32) + def Outer(x): + + @function.Defun(dtypes.float32) + def Inner(y): + return y + 1 + + return Inner(Inner(x)) + + self.expectFunctionsEqual(Outer) + + def testFromLibrary(self): + # Define some functions with different gradient functions. Note that many of + # the below functions are identical since function bodies don't matter for + # this test. + + @function.Defun(dtypes.float32, dtypes.float32) + def G1(x, dy): + return x * dy + + @function.Defun(dtypes.float32, dtypes.float32) + def G2(x, dy): + return x * dy + + # F1 and F2 have the same gradient function + @function.Defun(dtypes.float32, grad_func=G1) + def F1(x): + return math_ops.exp(x) - math_ops.exp(-x) + + @function.Defun(dtypes.float32, grad_func=G1) + def F2(x): + return math_ops.exp(x) - math_ops.exp(-x) + + # F3 has a different gradient function + @function.Defun(dtypes.float32, grad_func=G2) + def F3(x): + return math_ops.exp(x) - math_ops.exp(-x) + + # F4 has no gradient function + @function.Defun(dtypes.float32) + def F4(x): + return math_ops.exp(x) - math_ops.exp(-x) + + # Instantiate all functions + g = ops.Graph() + with g.as_default(): + c = constant_op.constant(1.0, dtypes.float32) + f1 = F1(c) + f2 = F2(c) + f3 = F3(c) + f4 = F4(c) + gradients_impl.gradients([f1, f2, f3, f4], c) + + library = g.as_graph_def().library + new_funcs = function._from_library(library) + + def CheckNewFunc(func): + new_func = [f for f in new_funcs if f.name == func.name] + self.assertEqual(len(new_func), 1) + self.expectFunctionsEqual(func, new_func=new_func[0]) + + CheckNewFunc(G1) + CheckNewFunc(G2) + CheckNewFunc(F1) + CheckNewFunc(F2) + CheckNewFunc(F3) + CheckNewFunc(F4) + + def testFromLibraryEmptyLib(self): + library = function_pb2.FunctionDefLibrary() + self.assertEqual(len(function._from_library(library)), 0) + + def testFromLibraryMissingFuncDef(self): + @function.Defun(dtypes.float32, dtypes.float32) + def G1(x, dy): + return x * dy + + @function.Defun(dtypes.float32) + def F1(x): + return math_ops.exp(x) - math_ops.exp(-x) + + gradient = function_pb2.GradientDef() + gradient.function_name = F1.name + gradient.gradient_func = G1.name + + # Create invalid function def that is missing G1 function def + library = function_pb2.FunctionDefLibrary() + library.gradient.extend([gradient]) + library.function.extend([F1.definition]) + + with self.assertRaisesRegexp( + ValueError, "FunctionDefLibrary missing 'G1_........' FunctionDef"): + function._from_library(library) + + # Create invalid function def that is missing F1 function def + library = function_pb2.FunctionDefLibrary() + library.gradient.extend([gradient]) + library.function.extend([G1.definition]) + + with self.assertRaisesRegexp( + ValueError, "FunctionDefLibrary missing 'F1_........' FunctionDef"): + function._from_library(library) + + def testFromLibraryCyclicGradFuncs(self): + @function.Defun(dtypes.float32) + def F1(x): + return math_ops.exp(x) - math_ops.exp(-x) + + @function.Defun(dtypes.float32) + def F2(x): + return math_ops.exp(x) - math_ops.exp(-x) + + # Create invalid function def library where F1 has gradient function F2 and + # F2 has gradient function F1 + library = function_pb2.FunctionDefLibrary() + library.function.extend([F1.definition, F2.definition]) + + gradient1 = function_pb2.GradientDef() + gradient1.function_name = F1.name + gradient1.gradient_func = F2.name + + gradient2 = function_pb2.GradientDef() + gradient2.function_name = F2.name + gradient2.gradient_func = F1.name + + library.gradient.extend([gradient1, gradient2]) + + with self.assertRaisesRegexp( + ValueError, "FunctionDefLibrary contains cyclic gradient functions!"): + function._from_library(library) + + class FunctionOverloadTest(test.TestCase): def testBasic(self): diff --git a/tensorflow/python/framework/importer.py b/tensorflow/python/framework/importer.py index c0e33d99f1..fcddd9546d 100644 --- a/tensorflow/python/framework/importer.py +++ b/tensorflow/python/framework/importer.py @@ -19,11 +19,13 @@ from __future__ import division from __future__ import print_function import contextlib +import copy from tensorflow.core.framework import attr_value_pb2 from tensorflow.core.framework import graph_pb2 from tensorflow.core.framework import types_pb2 from tensorflow.python.framework import dtypes +from tensorflow.python.framework import function from tensorflow.python.framework import op_def_registry from tensorflow.python.framework import ops from tensorflow.python.framework import tensor_shape @@ -171,7 +173,8 @@ def import_graph_def(graph_def, input_map=None, return_elements=None, `graph_def` that will be returned as `Operation` objects; and/or tensor names in `graph_def` that will be returned as `Tensor` objects. name: (Optional.) A prefix that will be prepended to the names in - `graph_def`. Defaults to `"import"`. + `graph_def`. Note that this does not apply to imported function names. + Defaults to `"import"`. op_dict: (Optional.) A dictionary mapping op type names to `OpDef` protos. Must contain an `OpDef` proto for each op type named in `graph_def`. If omitted, uses the `OpDef` protos registered in the global registry. @@ -232,9 +235,24 @@ def import_graph_def(graph_def, input_map=None, return_elements=None, else: producer_op_dict = {op.name: op for op in producer_op_list.op} + g = ops.get_default_graph() + + # Add any functions defined in `graph_def` to `g` + if graph_def.library and graph_def.library.function: + # Copy op_dict so we don't clobber the original + op_dict = copy.copy(op_dict) + # pylint: disable=protected-access + # Note that we do not prepend `name` to the function name. The reasoning is + # that function names are similar to op definition names, which currently do + # not have a scoped name or namespace scheme. + functions = function._from_library(graph_def.library) + for f in functions: + g._add_function(f) + op_dict[f.name] = f.definition.signature + # pylint: enable=protected-access + # LINT.IfChange with ops.name_scope(name, 'import', input_map.values()) as scope: - g = ops.get_default_graph() # TODO(ashankar): Should this just copy over or should it do some # more nuanced merging? For example, the graph may already have some # marked "bad versions" and we don't want to lose those because of @@ -369,7 +387,7 @@ def import_graph_def(graph_def, input_map=None, return_elements=None, raise ValueError(_InvalidNodeMessage( node, 'Input tensor %r %s' % (input_name, te))) - # pylint: disable=protected_access + # pylint: disable=protected-access if op._input_dtypes != input_types: raise ValueError( _InvalidNodeMessage( @@ -377,12 +395,13 @@ def import_graph_def(graph_def, input_map=None, return_elements=None, 'Input types mismatch (expected %r but got %r)' % (', '.join(dtypes.as_dtype(x).name for x in input_types), ', '.join(x.name for x in op._input_dtypes)))) - # pylint: enable=protected_access + # pylint: enable=protected-access - # Execute shape inference for this op. - # NOTE(mrry): If the graph contains a cycle, the full shape information - # may not be available for this op's inputs. - ops.set_shapes_for_outputs(op) + if not g._is_function(op.type): # pylint: disable=protected-access + # Execute shape inference for this op. + # NOTE(mrry): If the graph contains a cycle, the full shape information + # may not be available for this op's inputs. + ops.set_shapes_for_outputs(op) # For nodes with _output_shapes set, set the output shapes. if '_output_shapes' in op.node_def.attr: for i, output in enumerate(op.outputs): diff --git a/tensorflow/python/framework/importer_test.py b/tensorflow/python/framework/importer_test.py index b946e18394..c82bf16bb2 100644 --- a/tensorflow/python/framework/importer_test.py +++ b/tensorflow/python/framework/importer_test.py @@ -27,6 +27,7 @@ from tensorflow.core.framework import op_def_pb2 from tensorflow.python.framework import constant_op from tensorflow.python.framework import device from tensorflow.python.framework import dtypes +from tensorflow.python.framework import function from tensorflow.python.framework import importer from tensorflow.python.framework import op_def_registry from tensorflow.python.framework import ops @@ -42,29 +43,29 @@ import tensorflow.python.ops.nn_grad # pylint: disable=unused-import from tensorflow.python.platform import test -def _unknown_shape(op): +def _UnknownShape(op): return [tensor_shape.unknown_shape() for _ in op.outputs] # NOTE(cwhipkey): Dummy shape registration for ops used in the tests, since they # don't have C++ op registrations on which to attach C++ shape fns. -ops.RegisterShape("If")(_unknown_shape) -ops.RegisterShape("Iff")(_unknown_shape) -ops.RegisterShape("Ii")(_unknown_shape) -ops.RegisterShape("Iif")(_unknown_shape) -ops.RegisterShape("Iii")(_unknown_shape) -ops.RegisterShape("In")(_unknown_shape) -ops.RegisterShape("Iri")(_unknown_shape) -ops.RegisterShape("None")(_unknown_shape) -ops.RegisterShape("Of")(_unknown_shape) -ops.RegisterShape("Oi")(_unknown_shape) -ops.RegisterShape("Oif")(_unknown_shape) -ops.RegisterShape("Oii")(_unknown_shape) -ops.RegisterShape("OpWithDefaultAttr")(_unknown_shape) -ops.RegisterShape("OpWithFutureDefaultAttr")(_unknown_shape) -ops.RegisterShape("Or")(_unknown_shape) -ops.RegisterShape("Otl")(_unknown_shape) -ops.RegisterShape("Unary")(_unknown_shape) +ops.RegisterShape("If")(_UnknownShape) +ops.RegisterShape("Iff")(_UnknownShape) +ops.RegisterShape("Ii")(_UnknownShape) +ops.RegisterShape("Iif")(_UnknownShape) +ops.RegisterShape("Iii")(_UnknownShape) +ops.RegisterShape("In")(_UnknownShape) +ops.RegisterShape("Iri")(_UnknownShape) +ops.RegisterShape("None")(_UnknownShape) +ops.RegisterShape("Of")(_UnknownShape) +ops.RegisterShape("Oi")(_UnknownShape) +ops.RegisterShape("Oif")(_UnknownShape) +ops.RegisterShape("Oii")(_UnknownShape) +ops.RegisterShape("OpWithDefaultAttr")(_UnknownShape) +ops.RegisterShape("OpWithFutureDefaultAttr")(_UnknownShape) +ops.RegisterShape("Or")(_UnknownShape) +ops.RegisterShape("Otl")(_UnknownShape) +ops.RegisterShape("Unary")(_UnknownShape) _op_list = op_def_pb2.OpList() text_format.Merge(""" @@ -748,13 +749,13 @@ class ImportGraphDefTest(test.TestCase): # We'll use the following device function to observe ops with two inputs. ops_with_two_inputs = [] - def input_counter(op): + def InputCounter(op): if any(in_t.dtype._is_ref_dtype for in_t in op.inputs): # pylint: disable=protected-access ops_with_two_inputs.append(op) return "" with ops.Graph().as_default() as g: - with ops.device(input_counter): + with ops.device(InputCounter): importer.import_graph_def(gdef) # We expect to see the initializer, two assign operations, and the add op. @@ -884,6 +885,83 @@ class ImportGraphDefTest(test.TestCase): producer_op_list=producer_op_list) self.assertEqual(987, a[0].get_attr("default_int")) + def testFunctions(self): + dtype = dtypes.float32 + @function.Defun(dtype, dtype, dtype, dtype) + def Grad(x, y, dout1, dout2): # pylint: disable=unused-argument + # Return the inputs for simplicity of testing. The correct return value + # would be (dout1 + dout2, dout1 - dout2) + return x, y + + @function.Defun(dtype, dtype, grad_func=Grad) + def FuncWithGrad(x, y): + return x + y, x - y + + @function.Defun(dtypes.int32) + def ExternalTensorFunc(x): + # c must be defined in the containing graph + return x + c + + @function.Defun(dtypes.int32, dtypes.int32) + def OuterFunc(x, y): + + @function.Defun(dtypes.int32) + def InnerFunc(x): + return x + x + + return InnerFunc(x) + y + + # Create graph with function calls and export to GraphDef + with ops.Graph().as_default() as g1: + p1 = array_ops.placeholder(dtype, name="p1") + p2 = array_ops.placeholder(dtype, name="p2") + # pylint: disable=unexpected-keyword-arg + a, b = FuncWithGrad(p1, p2, name="f") + + c = constant_op.constant(10, dtype=dtypes.int32) + ExternalTensorFunc(1, name="external") + + OuterFunc(10, 1, name="outer") + # pylint: enable=unexpected-keyword-arg + + gdef = g1.as_graph_def() + + # Import GraphDef into new graph, add imported gradients, and test that + # imported functions can be run + with ops.Graph().as_default() as g2: + p1, p2, a, b = importer.import_graph_def( + gdef, return_elements=["p1:0", "p2:0", "f:0", "f:1"], name="") + grad = gradients_impl.gradients([a], [p1, p2]) + + with self.test_session(graph=g2) as sess: + feed_dict = {p1: 1, p2: 2} + a_val, b_val, grad_val = sess.run([a, b, grad], feed_dict=feed_dict) + self.assertEqual(a_val, 3.0) + self.assertEqual(b_val, -1.0) + # Grad function returns inputs values for testing + self.assertEqual(grad_val, [1.0, 2.0]) + self.assertEqual(sess.run("external:0"), 11) + self.assertEqual(sess.run("outer:0"), 21) + + # Export the new graph and reimport to test that imported functions can be + # successfully exported/imported again + gdef = g2.as_graph_def() + with ops.Graph().as_default() as g3: + p1, p2, a, b = importer.import_graph_def( + gdef, return_elements=["p1:0", "p2:0", "f:0", "f:1"], name="") + # Create new gradient functions (in additional to the imported gradient + # functions created in g2). + grad = gradients_impl.gradients([a], [p1, p2]) + + with self.test_session(graph=g3) as sess: + feed_dict = {p1: 1, p2: 2} + a_val, b_val, grad_val = sess.run([a, b, grad], feed_dict=feed_dict) + self.assertEqual(a_val, 3.0) + self.assertEqual(b_val, -1.0) + self.assertEqual(grad_val, [1.0, 2.0]) + self.assertEqual(sess.run("external:0"), 11) + self.assertEqual(sess.run("outer:0"), 21) + if __name__ == "__main__": test.main() -- GitLab From 42da3010fa615a505e0784b3378daf5f3e1d1c0e Mon Sep 17 00:00:00 2001 From: Eugene Brevdo Date: Wed, 1 Mar 2017 09:12:14 -0800 Subject: [PATCH 087/101] Remove disribution.is_continuous property. Most of its usefulness is determined by the reparameterization type. In the future we'll be adding a distribution Domain object / property to better describe the domain of the values a distribution may take on. Change: 148894335 --- .../bayesflow/python/ops/stochastic_tensor_impl.py | 7 ++----- .../kernel_tests/conditional_distribution_test.py | 1 - .../python/kernel_tests/distribution_test.py | 1 - .../python/kernel_tests/mixture_test.py | 11 ++++------- .../python/kernel_tests/relaxed_bernoulli_test.py | 6 ------ .../contrib/distributions/python/ops/bernoulli.py | 1 - tensorflow/contrib/distributions/python/ops/beta.py | 1 - .../contrib/distributions/python/ops/binomial.py | 1 - .../contrib/distributions/python/ops/categorical.py | 1 - .../contrib/distributions/python/ops/dirichlet.py | 1 - .../python/ops/dirichlet_multinomial.py | 1 - .../contrib/distributions/python/ops/distribution.py | 12 ++---------- tensorflow/contrib/distributions/python/ops/gamma.py | 1 - .../contrib/distributions/python/ops/geometric.py | 1 - .../contrib/distributions/python/ops/gumbel.py | 1 - .../distributions/python/ops/inverse_gamma.py | 1 - .../contrib/distributions/python/ops/laplace.py | 1 - .../contrib/distributions/python/ops/logistic.py | 1 - .../contrib/distributions/python/ops/mixture.py | 6 ------ .../contrib/distributions/python/ops/multinomial.py | 1 - .../distributions/python/ops/negative_binomial.py | 1 - .../contrib/distributions/python/ops/normal.py | 1 - .../distributions/python/ops/onehot_categorical.py | 1 - .../contrib/distributions/python/ops/poisson.py | 1 - .../python/ops/quantized_distribution.py | 1 - .../python/ops/relaxed_onehot_categorical.py | 1 - .../contrib/distributions/python/ops/student_t.py | 1 - .../python/ops/transformed_distribution.py | 4 +--- .../contrib/distributions/python/ops/uniform.py | 1 - .../contrib/distributions/python/ops/wishart.py | 1 - 30 files changed, 9 insertions(+), 61 deletions(-) diff --git a/tensorflow/contrib/bayesflow/python/ops/stochastic_tensor_impl.py b/tensorflow/contrib/bayesflow/python/ops/stochastic_tensor_impl.py index fd907e9054..b810ad3093 100644 --- a/tensorflow/contrib/bayesflow/python/ops/stochastic_tensor_impl.py +++ b/tensorflow/contrib/bayesflow/python/ops/stochastic_tensor_impl.py @@ -361,9 +361,7 @@ class StochasticTensor(BaseStochasticTensor): if isinstance(self._value_type, MeanValue): return value_tensor # Using pathwise-derivative for this one. - if self._dist.is_continuous and ( - self._dist.reparameterization_type - is distribution.FULLY_REPARAMETERIZED): + if self._dist.reparameterization_type == distribution.FULLY_REPARAMETERIZED: return value_tensor # Using pathwise-derivative for this one. else: # Will have to perform some variant of score function @@ -399,8 +397,7 @@ class StochasticTensor(BaseStochasticTensor): if self._loss_fn is None: return None - if (self._dist.is_continuous and - self._dist.reparameterization_type is distribution.FULLY_REPARAMETERIZED + if (self._dist.reparameterization_type == distribution.FULLY_REPARAMETERIZED and not self._value_type.stop_gradient): # Can perform pathwise-derivative on this one; no additional loss needed. return None diff --git a/tensorflow/contrib/distributions/python/kernel_tests/conditional_distribution_test.py b/tensorflow/contrib/distributions/python/kernel_tests/conditional_distribution_test.py index 6898fe681a..982aa9c95b 100644 --- a/tensorflow/contrib/distributions/python/kernel_tests/conditional_distribution_test.py +++ b/tensorflow/contrib/distributions/python/kernel_tests/conditional_distribution_test.py @@ -36,7 +36,6 @@ class ConditionalDistributionTest(distribution_test.DistributionTest): self._static_event_shape = tensor_shape.TensorShape(event_shape) super(_FakeDistribution, self).__init__( dtype=dtypes.float32, - is_continuous=False, reparameterization_type=distributions.NOT_REPARAMETERIZED, validate_args=True, allow_nan_stats=True, diff --git a/tensorflow/contrib/distributions/python/kernel_tests/distribution_test.py b/tensorflow/contrib/distributions/python/kernel_tests/distribution_test.py index 22145ff17a..507ceb3585 100644 --- a/tensorflow/contrib/distributions/python/kernel_tests/distribution_test.py +++ b/tensorflow/contrib/distributions/python/kernel_tests/distribution_test.py @@ -134,7 +134,6 @@ class DistributionTest(test.TestCase): self._static_event_shape = tensor_shape.TensorShape(event_shape) super(FakeDistribution, self).__init__( dtype=dtypes.float32, - is_continuous=False, reparameterization_type=distributions.NOT_REPARAMETERIZED, validate_args=True, allow_nan_stats=True, diff --git a/tensorflow/contrib/distributions/python/kernel_tests/mixture_test.py b/tensorflow/contrib/distributions/python/kernel_tests/mixture_test.py index 132295842e..e8ef52547d 100644 --- a/tensorflow/contrib/distributions/python/kernel_tests/mixture_test.py +++ b/tensorflow/contrib/distributions/python/kernel_tests/mixture_test.py @@ -197,13 +197,10 @@ class MixtureTest(test.TestCase): ]) with self.assertRaisesWithPredicateMatch(ValueError, "non-empty list"): distributions_py.Mixture(distributions_py.Categorical([0.3, 0.2]), None) - with self.assertRaisesWithPredicateMatch(TypeError, - "either be continuous or not"): - distributions_py.Mixture( - cat, [ - distributions_py.Normal(loc=[1.0], scale=[2.0]), - distributions_py.Bernoulli(dtype=dtypes.float32, logits=[1.0]), - ]) + + # TODO(ebrevdo): once distribution Domains have been added, add a + # test to ensure that the domains of the distributions in a + # mixture are checked for equivalence. def testMeanUnivariate(self): with self.test_session() as sess: diff --git a/tensorflow/contrib/distributions/python/kernel_tests/relaxed_bernoulli_test.py b/tensorflow/contrib/distributions/python/kernel_tests/relaxed_bernoulli_test.py index 2fc63ff5a9..2cf12bbe50 100644 --- a/tensorflow/contrib/distributions/python/kernel_tests/relaxed_bernoulli_test.py +++ b/tensorflow/contrib/distributions/python/kernel_tests/relaxed_bernoulli_test.py @@ -101,12 +101,6 @@ class RelaxedBernoulliTest(test.TestCase): with self.assertRaises(errors_impl.InvalidArgumentError): sample.eval() - def testContinuous(self): - temperature = 1.0 - p = [0.1, 0.4] - dist = relaxed_bernoulli.RelaxedBernoulli(temperature, probs=p) - self.assertTrue(dist.is_continuous) - def testDtype(self): temperature = constant_op.constant(1.0, dtype=dtypes.float32) p = constant_op.constant([0.1, 0.4], dtype=dtypes.float32) diff --git a/tensorflow/contrib/distributions/python/ops/bernoulli.py b/tensorflow/contrib/distributions/python/ops/bernoulli.py index 7e984c4881..27eb0d7899 100644 --- a/tensorflow/contrib/distributions/python/ops/bernoulli.py +++ b/tensorflow/contrib/distributions/python/ops/bernoulli.py @@ -79,7 +79,6 @@ class Bernoulli(distribution.Distribution): name=name) super(Bernoulli, self).__init__( dtype=dtype, - is_continuous=False, reparameterization_type=distribution.NOT_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, diff --git a/tensorflow/contrib/distributions/python/ops/beta.py b/tensorflow/contrib/distributions/python/ops/beta.py index 4a59c6ccf4..a063634e23 100644 --- a/tensorflow/contrib/distributions/python/ops/beta.py +++ b/tensorflow/contrib/distributions/python/ops/beta.py @@ -165,7 +165,6 @@ class Beta(distribution.Distribution): dtype=self._total_concentration.dtype, validate_args=validate_args, allow_nan_stats=allow_nan_stats, - is_continuous=True, reparameterization_type=distribution.NOT_REPARAMETERIZED, parameters=parameters, graph_parents=[self._concentration1, diff --git a/tensorflow/contrib/distributions/python/ops/binomial.py b/tensorflow/contrib/distributions/python/ops/binomial.py index 8f7567ac5d..eb416ba47e 100644 --- a/tensorflow/contrib/distributions/python/ops/binomial.py +++ b/tensorflow/contrib/distributions/python/ops/binomial.py @@ -153,7 +153,6 @@ class Binomial(distribution.Distribution): name=name) super(Binomial, self).__init__( dtype=self._probs.dtype, - is_continuous=False, reparameterization_type=distribution.NOT_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, diff --git a/tensorflow/contrib/distributions/python/ops/categorical.py b/tensorflow/contrib/distributions/python/ops/categorical.py index b4b7f8fb40..68e4cad73c 100644 --- a/tensorflow/contrib/distributions/python/ops/categorical.py +++ b/tensorflow/contrib/distributions/python/ops/categorical.py @@ -146,7 +146,6 @@ class Categorical(distribution.Distribution): self._batch_shape_val = logits_shape[:-1] super(Categorical, self).__init__( dtype=dtype, - is_continuous=False, reparameterization_type=distribution.NOT_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, diff --git a/tensorflow/contrib/distributions/python/ops/dirichlet.py b/tensorflow/contrib/distributions/python/ops/dirichlet.py index 8c95bb3ce6..1934687ab4 100644 --- a/tensorflow/contrib/distributions/python/ops/dirichlet.py +++ b/tensorflow/contrib/distributions/python/ops/dirichlet.py @@ -162,7 +162,6 @@ class Dirichlet(distribution.Distribution): dtype=self._concentration.dtype, validate_args=validate_args, allow_nan_stats=allow_nan_stats, - is_continuous=True, reparameterization_type=distribution.NOT_REPARAMETERIZED, parameters=parameters, graph_parents=[self._concentration, diff --git a/tensorflow/contrib/distributions/python/ops/dirichlet_multinomial.py b/tensorflow/contrib/distributions/python/ops/dirichlet_multinomial.py index 8a8b500331..1a29fb9d9e 100644 --- a/tensorflow/contrib/distributions/python/ops/dirichlet_multinomial.py +++ b/tensorflow/contrib/distributions/python/ops/dirichlet_multinomial.py @@ -192,7 +192,6 @@ class DirichletMultinomial(distribution.Distribution): dtype=self._concentration.dtype, validate_args=validate_args, allow_nan_stats=allow_nan_stats, - is_continuous=False, reparameterization_type=distribution.NOT_REPARAMETERIZED, parameters=parameters, graph_parents=[self._total_count, diff --git a/tensorflow/contrib/distributions/python/ops/distribution.py b/tensorflow/contrib/distributions/python/ops/distribution.py index 1b0390a5dc..a3a2e95470 100644 --- a/tensorflow/contrib/distributions/python/ops/distribution.py +++ b/tensorflow/contrib/distributions/python/ops/distribution.py @@ -343,7 +343,6 @@ class Distribution(_BaseDistribution): def __init__(self, dtype, - is_continuous, reparameterization_type, validate_args, allow_nan_stats, @@ -356,8 +355,6 @@ class Distribution(_BaseDistribution): Args: dtype: The type of the event samples. `None` implies no type-enforcement. - is_continuous: Python `bool`. If `True` this `Distribution` is continuous - over its supported domain. reparameterization_type: Instance of `ReparameterizationType`. If `distributions.FULLY_REPARAMETERIZED`, this `Distribution` can be reparameterized in terms of some standard @@ -387,7 +384,6 @@ class Distribution(_BaseDistribution): if t is None or not contrib_framework.is_tensor(t): raise ValueError("Graph parent item %d is not a Tensor; %s." % (i, t)) self._dtype = dtype - self._is_continuous = is_continuous self._reparameterization_type = reparameterization_type self._allow_nan_stats = allow_nan_stats self._validate_args = validate_args @@ -477,10 +473,6 @@ class Distribution(_BaseDistribution): return dict((k, v) for k, v in self._parameters.items() if not k.startswith("__") and k != "self") - @property - def is_continuous(self): - return self._is_continuous - @property def reparameterization_type(self): """Describes how samples from the distribution are reparameterized. @@ -681,7 +673,7 @@ class Distribution(_BaseDistribution): raise original_exception def log_prob(self, value, name="log_prob"): - """Log probability density/mass function (depending on `is_continuous`). + """Log probability density/mass function. Args: value: `float` or `double` `Tensor`. @@ -708,7 +700,7 @@ class Distribution(_BaseDistribution): raise original_exception def prob(self, value, name="prob"): - """Probability density/mass function (depending on `is_continuous`). + """Probability density/mass function. Args: value: `float` or `double` `Tensor`. diff --git a/tensorflow/contrib/distributions/python/ops/gamma.py b/tensorflow/contrib/distributions/python/ops/gamma.py index a0c64b47aa..d580e9c62c 100644 --- a/tensorflow/contrib/distributions/python/ops/gamma.py +++ b/tensorflow/contrib/distributions/python/ops/gamma.py @@ -140,7 +140,6 @@ class Gamma(distribution.Distribution): dtype=self._concentration.dtype, validate_args=validate_args, allow_nan_stats=allow_nan_stats, - is_continuous=True, reparameterization_type=distribution.NOT_REPARAMETERIZED, parameters=parameters, graph_parents=[self._concentration, diff --git a/tensorflow/contrib/distributions/python/ops/geometric.py b/tensorflow/contrib/distributions/python/ops/geometric.py index fd9a50021f..c5bbcb3a47 100644 --- a/tensorflow/contrib/distributions/python/ops/geometric.py +++ b/tensorflow/contrib/distributions/python/ops/geometric.py @@ -96,7 +96,6 @@ class Geometric(distribution.Distribution): super(Geometric, self).__init__( dtype=self._probs.dtype, - is_continuous=False, reparameterization_type=distribution.NOT_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, diff --git a/tensorflow/contrib/distributions/python/ops/gumbel.py b/tensorflow/contrib/distributions/python/ops/gumbel.py index dbef176e4c..f9b564ded9 100644 --- a/tensorflow/contrib/distributions/python/ops/gumbel.py +++ b/tensorflow/contrib/distributions/python/ops/gumbel.py @@ -132,7 +132,6 @@ class _Gumbel(distribution.Distribution): contrib_tensor_util.assert_same_float_dtype([self._loc, self._scale]) super(_Gumbel, self).__init__( dtype=self._scale.dtype, - is_continuous=True, reparameterization_type=distribution.FULLY_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, diff --git a/tensorflow/contrib/distributions/python/ops/inverse_gamma.py b/tensorflow/contrib/distributions/python/ops/inverse_gamma.py index a74fb350d1..3c896038e9 100644 --- a/tensorflow/contrib/distributions/python/ops/inverse_gamma.py +++ b/tensorflow/contrib/distributions/python/ops/inverse_gamma.py @@ -140,7 +140,6 @@ class InverseGamma(distribution.Distribution): dtype=self._concentration.dtype, validate_args=validate_args, allow_nan_stats=allow_nan_stats, - is_continuous=True, reparameterization_type=distribution.NOT_REPARAMETERIZED, parameters=parameters, graph_parents=[self._concentration, diff --git a/tensorflow/contrib/distributions/python/ops/laplace.py b/tensorflow/contrib/distributions/python/ops/laplace.py index a2bd9bae81..3c62161211 100644 --- a/tensorflow/contrib/distributions/python/ops/laplace.py +++ b/tensorflow/contrib/distributions/python/ops/laplace.py @@ -108,7 +108,6 @@ class Laplace(distribution.Distribution): contrib_tensor_util.assert_same_float_dtype([self._loc, self._scale]) super(Laplace, self).__init__( dtype=self._loc.dtype, - is_continuous=True, reparameterization_type=distribution.FULLY_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, diff --git a/tensorflow/contrib/distributions/python/ops/logistic.py b/tensorflow/contrib/distributions/python/ops/logistic.py index 8ab5f1a604..94cab4dfeb 100644 --- a/tensorflow/contrib/distributions/python/ops/logistic.py +++ b/tensorflow/contrib/distributions/python/ops/logistic.py @@ -130,7 +130,6 @@ class Logistic(distribution.Distribution): contrib_tensor_util.assert_same_float_dtype([self._loc, self._scale]) super(Logistic, self).__init__( dtype=self._scale.dtype, - is_continuous=True, reparameterization_type=distribution.FULLY_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, diff --git a/tensorflow/contrib/distributions/python/ops/mixture.py b/tensorflow/contrib/distributions/python/ops/mixture.py index 7a42ea0f65..d69e74214d 100644 --- a/tensorflow/contrib/distributions/python/ops/mixture.py +++ b/tensorflow/contrib/distributions/python/ops/mixture.py @@ -106,11 +106,6 @@ class Mixture(distribution.Distribution): if not all(d.dtype == dtype for d in components): raise TypeError("All components must have the same dtype, but saw " "dtypes: %s" % [(d.name, d.dtype) for d in components]) - is_continuous = components[0].is_continuous - if not all(d.is_continuous == is_continuous for d in components): - raise TypeError( - "All components must either be continuous or not, but continuity " - "values are: %s" % [(d.name, d.is_continuous) for d in components]) static_event_shape = components[0].event_shape static_batch_shape = cat.batch_shape for d in components: @@ -170,7 +165,6 @@ class Mixture(distribution.Distribution): super(Mixture, self).__init__( dtype=dtype, reparameterization_type=distribution.NOT_REPARAMETERIZED, - is_continuous=is_continuous, validate_args=validate_args, allow_nan_stats=allow_nan_stats, parameters=parameters, diff --git a/tensorflow/contrib/distributions/python/ops/multinomial.py b/tensorflow/contrib/distributions/python/ops/multinomial.py index cd3e6ab3a4..ed17d05e87 100644 --- a/tensorflow/contrib/distributions/python/ops/multinomial.py +++ b/tensorflow/contrib/distributions/python/ops/multinomial.py @@ -172,7 +172,6 @@ class Multinomial(distribution.Distribution): self._mean_val = self._total_count[..., array_ops.newaxis] * self._probs super(Multinomial, self).__init__( dtype=self._probs.dtype, - is_continuous=False, reparameterization_type=distribution.NOT_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, diff --git a/tensorflow/contrib/distributions/python/ops/negative_binomial.py b/tensorflow/contrib/distributions/python/ops/negative_binomial.py index b8cffb3145..a537b8202a 100644 --- a/tensorflow/contrib/distributions/python/ops/negative_binomial.py +++ b/tensorflow/contrib/distributions/python/ops/negative_binomial.py @@ -100,7 +100,6 @@ class NegativeBinomial(distribution.Distribution): super(NegativeBinomial, self).__init__( dtype=self._probs.dtype, - is_continuous=False, reparameterization_type=distribution.NOT_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, diff --git a/tensorflow/contrib/distributions/python/ops/normal.py b/tensorflow/contrib/distributions/python/ops/normal.py index 770a81cf1a..190ef50bed 100644 --- a/tensorflow/contrib/distributions/python/ops/normal.py +++ b/tensorflow/contrib/distributions/python/ops/normal.py @@ -139,7 +139,6 @@ class Normal(distribution.Distribution): contrib_tensor_util.assert_same_float_dtype([self._loc, self._scale]) super(Normal, self).__init__( dtype=self._scale.dtype, - is_continuous=True, reparameterization_type=distribution.FULLY_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, diff --git a/tensorflow/contrib/distributions/python/ops/onehot_categorical.py b/tensorflow/contrib/distributions/python/ops/onehot_categorical.py index 7ebc48f004..e995c1045d 100644 --- a/tensorflow/contrib/distributions/python/ops/onehot_categorical.py +++ b/tensorflow/contrib/distributions/python/ops/onehot_categorical.py @@ -136,7 +136,6 @@ class OneHotCategorical(distribution.Distribution): super(OneHotCategorical, self).__init__( dtype=dtype, - is_continuous=False, reparameterization_type=distribution.NOT_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, diff --git a/tensorflow/contrib/distributions/python/ops/poisson.py b/tensorflow/contrib/distributions/python/ops/poisson.py index 45fcc2e7e8..0b4cdf5be2 100644 --- a/tensorflow/contrib/distributions/python/ops/poisson.py +++ b/tensorflow/contrib/distributions/python/ops/poisson.py @@ -86,7 +86,6 @@ class Poisson(distribution.Distribution): self._rate = array_ops.identity(rate, name="rate") super(Poisson, self).__init__( dtype=self._rate.dtype, - is_continuous=False, reparameterization_type=distribution.NOT_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, diff --git a/tensorflow/contrib/distributions/python/ops/quantized_distribution.py b/tensorflow/contrib/distributions/python/ops/quantized_distribution.py index 1ee77c05e4..0126333c21 100644 --- a/tensorflow/contrib/distributions/python/ops/quantized_distribution.py +++ b/tensorflow/contrib/distributions/python/ops/quantized_distribution.py @@ -253,7 +253,6 @@ class QuantizedDistribution(distributions.Distribution): super(QuantizedDistribution, self).__init__( dtype=self._dist.dtype, - is_continuous=False, reparameterization_type=distributions.NOT_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=self._dist.allow_nan_stats, diff --git a/tensorflow/contrib/distributions/python/ops/relaxed_onehot_categorical.py b/tensorflow/contrib/distributions/python/ops/relaxed_onehot_categorical.py index 82016cab25..f3c323e5de 100644 --- a/tensorflow/contrib/distributions/python/ops/relaxed_onehot_categorical.py +++ b/tensorflow/contrib/distributions/python/ops/relaxed_onehot_categorical.py @@ -187,7 +187,6 @@ class ExpRelaxedOneHotCategorical(distribution.Distribution): super(ExpRelaxedOneHotCategorical, self).__init__( dtype=dtype, - is_continuous=True, reparameterization_type=distribution.FULLY_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, diff --git a/tensorflow/contrib/distributions/python/ops/student_t.py b/tensorflow/contrib/distributions/python/ops/student_t.py index 24db27a2f5..b0b4733a66 100644 --- a/tensorflow/contrib/distributions/python/ops/student_t.py +++ b/tensorflow/contrib/distributions/python/ops/student_t.py @@ -165,7 +165,6 @@ class StudentT(distribution.Distribution): (self._df, self._loc, self._scale)) super(StudentT, self).__init__( dtype=self._scale.dtype, - is_continuous=True, reparameterization_type=distribution.NOT_REPARAMETERIZED, validate_args=validate_args, allow_nan_stats=allow_nan_stats, diff --git a/tensorflow/contrib/distributions/python/ops/transformed_distribution.py b/tensorflow/contrib/distributions/python/ops/transformed_distribution.py index 5907c4905e..86ae8d4a52 100644 --- a/tensorflow/contrib/distributions/python/ops/transformed_distribution.py +++ b/tensorflow/contrib/distributions/python/ops/transformed_distribution.py @@ -337,7 +337,6 @@ class TransformedDistribution(distributions.Distribution): self._bijector = bijector super(TransformedDistribution, self).__init__( dtype=self._distribution.dtype, - is_continuous=self._distribution.is_continuous, reparameterization_type=self._distribution.reparameterization_type, validate_args=validate_args, allow_nan_stats=self._distribution.allow_nan_stats, @@ -466,8 +465,7 @@ class TransformedDistribution(distributions.Distribution): return self.distribution.survival_function(x) def _entropy(self): - if (not self.distribution.is_continuous or - not self.bijector.is_constant_jacobian): + if not self.bijector.is_constant_jacobian: raise NotImplementedError("entropy is not implemented") # Suppose Y = g(X) where g is a diffeomorphism and X is a continuous rv. It # can be shown that: diff --git a/tensorflow/contrib/distributions/python/ops/uniform.py b/tensorflow/contrib/distributions/python/ops/uniform.py index 496fad5607..b87c67bfad 100644 --- a/tensorflow/contrib/distributions/python/ops/uniform.py +++ b/tensorflow/contrib/distributions/python/ops/uniform.py @@ -112,7 +112,6 @@ class Uniform(distribution.Distribution): super(Uniform, self).__init__( dtype=self._low.dtype, reparameterization_type=distribution.FULLY_REPARAMETERIZED, - is_continuous=True, validate_args=validate_args, allow_nan_stats=allow_nan_stats, parameters=parameters, diff --git a/tensorflow/contrib/distributions/python/ops/wishart.py b/tensorflow/contrib/distributions/python/ops/wishart.py index aec84a073b..2bca09dad9 100644 --- a/tensorflow/contrib/distributions/python/ops/wishart.py +++ b/tensorflow/contrib/distributions/python/ops/wishart.py @@ -156,7 +156,6 @@ class _WishartOperatorPD(distribution.Distribution): dtype=self._scale_operator_pd.dtype, validate_args=validate_args, allow_nan_stats=allow_nan_stats, - is_continuous=True, reparameterization_type=distribution.FULLY_REPARAMETERIZED, parameters=parameters, graph_parents=([self._df, self._dimension] + -- GitLab From f0357d2bb3b9cbbaec89fb8b0470712b4c2cda5e Mon Sep 17 00:00:00 2001 From: Ian Langmore Date: Wed, 1 Mar 2017 09:30:39 -0800 Subject: [PATCH 088/101] LinearOperator name change: LinearOperatorMatrix --> LinearOperatorFullMatrix Change: 148895969 --- tensorflow/contrib/linalg/BUILD | 4 +-- tensorflow/contrib/linalg/__init__.py | 4 +-- .../linear_operator_addition_test.py | 13 +++---- .../linear_operator_composition_test.py | 34 +++++++++---------- ...py => linear_operator_full_matrix_test.py} | 26 +++++++------- .../python/ops/linear_operator_addition.py | 8 ++--- .../python/ops/linear_operator_composition.py | 8 ++--- ...trix.py => linear_operator_full_matrix.py} | 22 ++++++------ .../python/ops/linear_operator_test_util.py | 2 +- 9 files changed, 61 insertions(+), 60 deletions(-) rename tensorflow/contrib/linalg/python/kernel_tests/{linear_operator_matrix_test.py => linear_operator_full_matrix_test.py} (89%) rename tensorflow/contrib/linalg/python/ops/{linear_operator_matrix.py => linear_operator_full_matrix.py} (91%) diff --git a/tensorflow/contrib/linalg/BUILD b/tensorflow/contrib/linalg/BUILD index b6d4625e6b..9b196e2cf5 100644 --- a/tensorflow/contrib/linalg/BUILD +++ b/tensorflow/contrib/linalg/BUILD @@ -100,9 +100,9 @@ cuda_py_tests( ) cuda_py_tests( - name = "linear_operator_matrix_test", + name = "linear_operator_full_matrix_test", size = "medium", - srcs = ["python/kernel_tests/linear_operator_matrix_test.py"], + srcs = ["python/kernel_tests/linear_operator_full_matrix_test.py"], additional_deps = [ ":linalg_py", "//tensorflow/python:array_ops", diff --git a/tensorflow/contrib/linalg/__init__.py b/tensorflow/contrib/linalg/__init__.py index 8398956ee3..44421a6b7d 100644 --- a/tensorflow/contrib/linalg/__init__.py +++ b/tensorflow/contrib/linalg/__init__.py @@ -20,7 +20,7 @@ See the @{$python/contrib.linalg} guide. @@LinearOperatorDiag @@LinearOperatorIdentity @@LinearOperatorScaledIdentity -@@LinearOperatorMatrix +@@LinearOperatorFullMatrix @@LinearOperatorTriL @@LinearOperatorUDVHUpdate @@LinearOperatorComposition @@ -37,8 +37,8 @@ from tensorflow.contrib.linalg.python.ops.linear_operator import * from tensorflow.contrib.linalg.python.ops.linear_operator_addition import * from tensorflow.contrib.linalg.python.ops.linear_operator_composition import * from tensorflow.contrib.linalg.python.ops.linear_operator_diag import * +from tensorflow.contrib.linalg.python.ops.linear_operator_full_matrix import * from tensorflow.contrib.linalg.python.ops.linear_operator_identity import * -from tensorflow.contrib.linalg.python.ops.linear_operator_matrix import * from tensorflow.contrib.linalg.python.ops.linear_operator_tril import * from tensorflow.contrib.linalg.python.ops.linear_operator_udvh_update import * diff --git a/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_addition_test.py b/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_addition_test.py index 5bb1c61e14..4746484755 100644 --- a/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_addition_test.py +++ b/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_addition_test.py @@ -137,7 +137,8 @@ class LinearOperatorAdditionCorrectnessTest(test.TestCase): self.assertEqual(None, op.is_non_singular) def test_matrix_diag_tril_diag_uses_custom_name(self): - op0 = linalg.LinearOperatorMatrix([[-1., -1.], [-1., -1.]], name="matrix") + op0 = linalg.LinearOperatorFullMatrix( + [[-1., -1.], [-1., -1.]], name="matrix") op1 = linalg.LinearOperatorDiag([1., 1.], name="diag_a") op2 = linalg.LinearOperatorTriL([[2., 0.], [1.5, 2.]], name="tril") op3 = linalg.LinearOperatorDiag([3., 3.], name="diag_b") @@ -145,24 +146,24 @@ class LinearOperatorAdditionCorrectnessTest(test.TestCase): op_sum = add_operators([op0, op1, op2, op3], operator_name="my_operator") self.assertEqual(1, len(op_sum)) op = op_sum[0] - self.assertTrue(isinstance(op, linalg_lib.LinearOperatorMatrix)) + self.assertTrue(isinstance(op, linalg_lib.LinearOperatorFullMatrix)) self.assertAllClose([[5., -1.], [0.5, 5.]], op.to_dense().eval()) self.assertEqual("my_operator", op.name) def test_incompatible_domain_dimensions_raises(self): - op1 = linalg.LinearOperatorMatrix(rng.rand(2, 3)) + op1 = linalg.LinearOperatorFullMatrix(rng.rand(2, 3)) op2 = linalg.LinearOperatorDiag(rng.rand(2, 4)) with self.assertRaisesRegexp(ValueError, "must.*same domain dimension"): add_operators([op1, op2]) def test_incompatible_range_dimensions_raises(self): - op1 = linalg.LinearOperatorMatrix(rng.rand(2, 3)) + op1 = linalg.LinearOperatorFullMatrix(rng.rand(2, 3)) op2 = linalg.LinearOperatorDiag(rng.rand(3, 3)) with self.assertRaisesRegexp(ValueError, "must.*same range dimension"): add_operators([op1, op2]) def test_non_broadcastable_batch_shape_raises(self): - op1 = linalg.LinearOperatorMatrix(rng.rand(2, 3, 3)) + op1 = linalg.LinearOperatorFullMatrix(rng.rand(2, 3, 3)) op2 = linalg.LinearOperatorDiag(rng.rand(4, 3, 3)) with self.assertRaisesRegexp(ValueError, "Incompatible shapes"): add_operators([op1, op2]) @@ -397,7 +398,7 @@ class AddAndReturnMatrixTest(test.TestCase): self.assertTrue(self._adder.can_add(diag1, diag2)) operator = self._adder.add(diag1, diag2, "my_operator", hints) - self.assertTrue(isinstance(operator, linalg.LinearOperatorMatrix)) + self.assertTrue(isinstance(operator, linalg.LinearOperatorFullMatrix)) with self.test_session(): self.assertAllClose([[0., 0.], [0., 5.]], operator.to_dense().eval()) diff --git a/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_composition_test.py b/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_composition_test.py index 6309d36258..998073e28b 100644 --- a/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_composition_test.py +++ b/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_composition_test.py @@ -65,11 +65,11 @@ class SquareLinearOperatorCompositionTest( # feed_dict. matrices = sess.run(matrices) operator = linalg.LinearOperatorComposition( - [linalg.LinearOperatorMatrix(m_ph) for m_ph in matrices_ph]) + [linalg.LinearOperatorFullMatrix(m_ph) for m_ph in matrices_ph]) feed_dict = {m_ph: m for (m_ph, m) in zip(matrices_ph, matrices)} else: operator = linalg.LinearOperatorComposition( - [linalg.LinearOperatorMatrix(m) for m in matrices]) + [linalg.LinearOperatorFullMatrix(m) for m in matrices]) feed_dict = None # Convert back to Tensor. Needed if use_placeholder, since then we have @@ -86,7 +86,7 @@ class SquareLinearOperatorCompositionTest( # The matrix values do not effect auto-setting of the flags. matrix = [[1., 0.], [1., 1.]] operator = linalg.LinearOperatorComposition( - [linalg.LinearOperatorMatrix(matrix)], + [linalg.LinearOperatorFullMatrix(matrix)], is_positive_definite=True, is_non_singular=True, is_self_adjoint=False) @@ -98,8 +98,8 @@ class SquareLinearOperatorCompositionTest( # Matrix with two positive eigenvalues, 11 and 8. # The matrix values do not effect auto-setting of the flags. matrix = [[11., 0.], [1., 8.]] - operator_1 = linalg.LinearOperatorMatrix(matrix, is_non_singular=True) - operator_2 = linalg.LinearOperatorMatrix(matrix, is_non_singular=True) + operator_1 = linalg.LinearOperatorFullMatrix(matrix, is_non_singular=True) + operator_2 = linalg.LinearOperatorFullMatrix(matrix, is_non_singular=True) operator = linalg.LinearOperatorComposition( [operator_1, operator_2], @@ -114,8 +114,8 @@ class SquareLinearOperatorCompositionTest( def test_name(self): matrix = [[11., 0.], [1., 8.]] - operator_1 = linalg.LinearOperatorMatrix(matrix, name="left") - operator_2 = linalg.LinearOperatorMatrix(matrix, name="right") + operator_1 = linalg.LinearOperatorFullMatrix(matrix, name="left") + operator_2 = linalg.LinearOperatorFullMatrix(matrix, name="right") operator = linalg.LinearOperatorComposition([operator_1, operator_2]) @@ -123,8 +123,8 @@ class SquareLinearOperatorCompositionTest( def test_different_dtypes_raises(self): operators = [ - linalg.LinearOperatorMatrix(rng.rand(2, 3, 3)), - linalg.LinearOperatorMatrix(rng.rand(2, 3, 3).astype(np.float32)) + linalg.LinearOperatorFullMatrix(rng.rand(2, 3, 3)), + linalg.LinearOperatorFullMatrix(rng.rand(2, 3, 3).astype(np.float32)) ] with self.assertRaisesRegexp(TypeError, "same dtype"): linalg.LinearOperatorComposition(operators) @@ -176,11 +176,11 @@ class NonSquareLinearOperatorCompositionTest( # feed_dict. matrices = sess.run(matrices) operator = linalg.LinearOperatorComposition( - [linalg.LinearOperatorMatrix(m_ph) for m_ph in matrices_ph]) + [linalg.LinearOperatorFullMatrix(m_ph) for m_ph in matrices_ph]) feed_dict = {m_ph: m for (m_ph, m) in zip(matrices_ph, matrices)} else: operator = linalg.LinearOperatorComposition( - [linalg.LinearOperatorMatrix(m) for m in matrices]) + [linalg.LinearOperatorFullMatrix(m) for m in matrices]) feed_dict = None # Convert back to Tensor. Needed if use_placeholder, since then we have @@ -194,16 +194,16 @@ class NonSquareLinearOperatorCompositionTest( def test_static_shapes(self): operators = [ - linalg.LinearOperatorMatrix(rng.rand(2, 3, 4)), - linalg.LinearOperatorMatrix(rng.rand(2, 4, 5)) + linalg.LinearOperatorFullMatrix(rng.rand(2, 3, 4)), + linalg.LinearOperatorFullMatrix(rng.rand(2, 4, 5)) ] operator = linalg.LinearOperatorComposition(operators) self.assertAllEqual((2, 3, 5), operator.shape) def test_shape_tensors_when_statically_available(self): operators = [ - linalg.LinearOperatorMatrix(rng.rand(2, 3, 4)), - linalg.LinearOperatorMatrix(rng.rand(2, 4, 5)) + linalg.LinearOperatorFullMatrix(rng.rand(2, 3, 4)), + linalg.LinearOperatorFullMatrix(rng.rand(2, 4, 5)) ] operator = linalg.LinearOperatorComposition(operators) with self.test_session(): @@ -217,8 +217,8 @@ class NonSquareLinearOperatorCompositionTest( feed_dict = {mat_ph_1: mat_1, mat_ph_2: mat_2} operators = [ - linalg.LinearOperatorMatrix(mat_ph_1), - linalg.LinearOperatorMatrix(mat_ph_2) + linalg.LinearOperatorFullMatrix(mat_ph_1), + linalg.LinearOperatorFullMatrix(mat_ph_2) ] operator = linalg.LinearOperatorComposition(operators) with self.test_session(): diff --git a/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_matrix_test.py b/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_full_matrix_test.py similarity index 89% rename from tensorflow/contrib/linalg/python/kernel_tests/linear_operator_matrix_test.py rename to tensorflow/contrib/linalg/python/kernel_tests/linear_operator_full_matrix_test.py index dcb2661197..93cbb48e1b 100644 --- a/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_matrix_test.py +++ b/tensorflow/contrib/linalg/python/kernel_tests/linear_operator_full_matrix_test.py @@ -29,7 +29,7 @@ linalg = linalg_lib random_seed.set_random_seed(23) -class SquareLinearOperatorMatrixTest( +class SquareLinearOperatorFullMatrixTest( linear_operator_test_util.SquareLinearOperatorDerivedClassTest): """Most tests done in the base class LinearOperatorDerivedClassTest.""" @@ -45,10 +45,10 @@ class SquareLinearOperatorMatrixTest( # values are random and we want the same value used for both mat and # feed_dict. matrix = matrix.eval() - operator = linalg.LinearOperatorMatrix(matrix) + operator = linalg.LinearOperatorFullMatrix(matrix) feed_dict = {matrix_ph: matrix} else: - operator = linalg.LinearOperatorMatrix(matrix) + operator = linalg.LinearOperatorFullMatrix(matrix) feed_dict = None # Convert back to Tensor. Needed if use_placeholder, since then we have @@ -60,7 +60,7 @@ class SquareLinearOperatorMatrixTest( def test_is_x_flags(self): # Matrix with two positive eigenvalues. matrix = [[1., 0.], [1., 11.]] - operator = linalg.LinearOperatorMatrix( + operator = linalg.LinearOperatorFullMatrix( matrix, is_positive_definite=True, is_non_singular=True, @@ -70,7 +70,7 @@ class SquareLinearOperatorMatrixTest( self.assertFalse(operator.is_self_adjoint) -class SquareLinearOperatorMatrixSymmetricPositiveDefiniteTest( +class SquareLinearOperatorFullMatrixSymmetricPositiveDefiniteTest( linear_operator_test_util.SquareLinearOperatorDerivedClassTest): """Most tests done in the base class LinearOperatorDerivedClassTest. @@ -104,11 +104,11 @@ class SquareLinearOperatorMatrixSymmetricPositiveDefiniteTest( # values are random and we want the same value used for both mat and # feed_dict. matrix = matrix.eval() - operator = linalg.LinearOperatorMatrix( + operator = linalg.LinearOperatorFullMatrix( matrix, is_self_adjoint=True, is_positive_definite=True) feed_dict = {matrix_ph: matrix} else: - operator = linalg.LinearOperatorMatrix( + operator = linalg.LinearOperatorFullMatrix( matrix, is_self_adjoint=True, is_positive_definite=True) feed_dict = None @@ -121,7 +121,7 @@ class SquareLinearOperatorMatrixSymmetricPositiveDefiniteTest( def test_is_x_flags(self): # Matrix with two positive eigenvalues. matrix = [[1., 0.], [0., 7.]] - operator = linalg.LinearOperatorMatrix( + operator = linalg.LinearOperatorFullMatrix( matrix, is_positive_definite=True, is_self_adjoint=True) self.assertTrue(operator.is_positive_definite) @@ -132,7 +132,7 @@ class SquareLinearOperatorMatrixSymmetricPositiveDefiniteTest( self.assertTrue(operator._is_spd) -class NonSquareLinearOperatorMatrixTest( +class NonSquareLinearOperatorFullMatrixTest( linear_operator_test_util.NonSquareLinearOperatorDerivedClassTest): """Most tests done in the base class LinearOperatorDerivedClassTest.""" @@ -144,10 +144,10 @@ class NonSquareLinearOperatorMatrixTest( # values are random and we want the same value used for both mat and # feed_dict. matrix = matrix.eval() - operator = linalg.LinearOperatorMatrix(matrix) + operator = linalg.LinearOperatorFullMatrix(matrix) feed_dict = {matrix_ph: matrix} else: - operator = linalg.LinearOperatorMatrix(matrix) + operator = linalg.LinearOperatorFullMatrix(matrix) feed_dict = None # Convert back to Tensor. Needed if use_placeholder, since then we have @@ -159,7 +159,7 @@ class NonSquareLinearOperatorMatrixTest( def test_is_x_flags(self): # Matrix with two positive eigenvalues. matrix = [[3., 0.], [1., 1.]] - operator = linalg.LinearOperatorMatrix( + operator = linalg.LinearOperatorFullMatrix( matrix, is_positive_definite=True, is_non_singular=True, @@ -170,7 +170,7 @@ class NonSquareLinearOperatorMatrixTest( def test_matrix_must_have_at_least_two_dims_or_raises(self): with self.assertRaisesRegexp(ValueError, "at least 2 dimensions"): - linalg.LinearOperatorMatrix([1.]) + linalg.LinearOperatorFullMatrix([1.]) if __name__ == "__main__": diff --git a/tensorflow/contrib/linalg/python/ops/linear_operator_addition.py b/tensorflow/contrib/linalg/python/ops/linear_operator_addition.py index 69e7f2bbd9..7617e1b591 100644 --- a/tensorflow/contrib/linalg/python/ops/linear_operator_addition.py +++ b/tensorflow/contrib/linalg/python/ops/linear_operator_addition.py @@ -24,8 +24,8 @@ import six from tensorflow.contrib.linalg.python.ops import linear_operator from tensorflow.contrib.linalg.python.ops import linear_operator_diag +from tensorflow.contrib.linalg.python.ops import linear_operator_full_matrix from tensorflow.contrib.linalg.python.ops import linear_operator_identity -from tensorflow.contrib.linalg.python.ops import linear_operator_matrix from tensorflow.contrib.linalg.python.ops import linear_operator_tril from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops @@ -356,7 +356,7 @@ class _AddAndReturnTriL(_Adder): class _AddAndReturnMatrix(_Adder): - """"Handles additions resulting in a `LinearOperatorMatrix`.""" + """"Handles additions resulting in a `LinearOperatorFullMatrix`.""" def can_add(self, op1, op2): # pylint: disable=unused-argument return isinstance(op1, linear_operator.LinearOperator) and isinstance( @@ -367,7 +367,7 @@ class _AddAndReturnMatrix(_Adder): op_add_to_tensor, op_other = op1, op2 else: op_add_to_tensor, op_other = op2, op1 - return linear_operator_matrix.LinearOperatorMatrix( + return linear_operator_full_matrix.LinearOperatorFullMatrix( matrix=op_add_to_tensor.add_to_tensor(op_other.to_dense()), is_non_singular=hints.is_non_singular, is_self_adjoint=hints.is_self_adjoint, @@ -399,7 +399,7 @@ def _type(operator): return _DIAG if isinstance(operator, linear_operator_tril.LinearOperatorTriL): return _TRIL - if isinstance(operator, linear_operator_matrix.LinearOperatorMatrix): + if isinstance(operator, linear_operator_full_matrix.LinearOperatorFullMatrix): return _MATRIX if isinstance(operator, linear_operator_identity.LinearOperatorIdentity): return _IDENTITY diff --git a/tensorflow/contrib/linalg/python/ops/linear_operator_composition.py b/tensorflow/contrib/linalg/python/ops/linear_operator_composition.py index 781282eb35..11ce5e0e64 100644 --- a/tensorflow/contrib/linalg/python/ops/linear_operator_composition.py +++ b/tensorflow/contrib/linalg/python/ops/linear_operator_composition.py @@ -52,8 +52,8 @@ class LinearOperatorComposition(linear_operator.LinearOperator): ```python # Create a 2 x 2 linear operator composed of two 2 x 2 operators. - operator_1 = LinearOperatorMatrix([[1., 2.], [3., 4.]]) - operator_2 = LinearOperatorMatrix([[1., 0.], [0., 1.]]) + operator_1 = LinearOperatorFullMatrix([[1., 2.], [3., 4.]]) + operator_2 = LinearOperatorFullMatrix([[1., 0.], [0., 1.]]) operator = LinearOperatorComposition([operator_1, operator_2]) operator.to_dense() @@ -72,11 +72,11 @@ class LinearOperatorComposition(linear_operator.LinearOperator): # Create a [2, 3] batch of 4 x 5 linear operators. matrix_45 = tf.random_normal(shape=[2, 3, 4, 5]) - operator_45 = LinearOperatorMatrix(matrix) + operator_45 = LinearOperatorFullMatrix(matrix) # Create a [2, 3] batch of 5 x 6 linear operators. matrix_56 = tf.random_normal(shape=[2, 3, 5, 6]) - operator_56 = LinearOperatorMatrix(matrix_56) + operator_56 = LinearOperatorFullMatrix(matrix_56) # Compose to create a [2, 3] batch of 4 x 6 operators. opeartor_46 = LinearOperatorComposition([operator_45, operator_56]) diff --git a/tensorflow/contrib/linalg/python/ops/linear_operator_matrix.py b/tensorflow/contrib/linalg/python/ops/linear_operator_full_matrix.py similarity index 91% rename from tensorflow/contrib/linalg/python/ops/linear_operator_matrix.py rename to tensorflow/contrib/linalg/python/ops/linear_operator_full_matrix.py index 2bd99845d8..f8d0202baf 100644 --- a/tensorflow/contrib/linalg/python/ops/linear_operator_matrix.py +++ b/tensorflow/contrib/linalg/python/ops/linear_operator_full_matrix.py @@ -25,10 +25,10 @@ from tensorflow.python.ops import array_ops from tensorflow.python.ops import linalg_ops from tensorflow.python.ops import math_ops -__all__ = ["LinearOperatorMatrix"] +__all__ = ["LinearOperatorFullMatrix"] -class LinearOperatorMatrix(linear_operator.LinearOperator): +class LinearOperatorFullMatrix(linear_operator.LinearOperator): """`LinearOperator` that wraps a [batch] matrix. This operator wraps a [batch] matrix `A` (which is a `Tensor`) with shape @@ -39,7 +39,7 @@ class LinearOperatorMatrix(linear_operator.LinearOperator): ```python # Create a 2 x 2 linear operator. matrix = [[1., 2.], [3., 4.]] - operator = LinearOperatorMatrix(matrix) + operator = LinearOperatorFullMatrix(matrix) operator.to_dense() ==> [[1., 2.] @@ -57,7 +57,7 @@ class LinearOperatorMatrix(linear_operator.LinearOperator): # Create a [2, 3] batch of 4 x 4 linear operators. matrix = tf.random_normal(shape=[2, 3, 4, 4]) - operator = LinearOperatorMatrix(matrix) + operator = LinearOperatorFullMatrix(matrix) ``` #### Shape compatibility @@ -72,14 +72,14 @@ class LinearOperatorMatrix(linear_operator.LinearOperator): #### Performance - `LinearOperatorMatrix` has exactly the same performance as would be achieved - by using standard `TensorFlow` matrix ops. Intelligent choices are made - based on the following initialization hints. + `LinearOperatorFullMatrix` has exactly the same performance as would be + achieved by using standard `TensorFlow` matrix ops. Intelligent choices are + made based on the following initialization hints. * If `dtype` is real, and `is_self_adjoint` and `is_positive_definite`, a Cholesky factorization is used for the determinant and solve. - In all cases, suppose `operator` is a `LinearOperatorMatrix` of shape + In all cases, suppose `operator` is a `LinearOperatorFullMatrix` of shape `[M, N]`, and `x.shape = [N, R]`. Then * `operator.apply(x)` is `O(M * N * R)`. @@ -108,8 +108,8 @@ class LinearOperatorMatrix(linear_operator.LinearOperator): is_non_singular=None, is_self_adjoint=None, is_positive_definite=None, - name="LinearOperatorMatrix"): - """Initialize a `LinearOperatorMatrix`. + name="LinearOperatorFullMatrix"): + """Initialize a `LinearOperatorFullMatrix`. Args: matrix: Shape `[B1,...,Bb, M, N]` with `b >= 0`, `M, N >= 0`. @@ -139,7 +139,7 @@ class LinearOperatorMatrix(linear_operator.LinearOperator): if self._is_spd: self._chol = linalg_ops.cholesky(self._matrix) - super(LinearOperatorMatrix, self).__init__( + super(LinearOperatorFullMatrix, self).__init__( dtype=self._matrix.dtype, graph_parents=[self._matrix], is_non_singular=is_non_singular, diff --git a/tensorflow/contrib/linalg/python/ops/linear_operator_test_util.py b/tensorflow/contrib/linalg/python/ops/linear_operator_test_util.py index 8fed8f7c46..0b7fc3da39 100644 --- a/tensorflow/contrib/linalg/python/ops/linear_operator_test_util.py +++ b/tensorflow/contrib/linalg/python/ops/linear_operator_test_util.py @@ -336,7 +336,7 @@ class NonSquareLinearOperatorDerivedClassTest(LinearOperatorDerivedClassTest): Square shapes are never tested by this class, so if you want to test your operator with a square shape, create two test classes, the other subclassing - SquareLinearOperatorMatrixTest. + SquareLinearOperatorFullMatrixTest. Sub-classes must still define all abstractmethods from LinearOperatorDerivedClassTest that are not defined here. -- GitLab From b8f85c613b55f792f9c62fe6a386c764b8895108 Mon Sep 17 00:00:00 2001 From: "Jeffrey A. Dean" Date: Wed, 1 Mar 2017 09:47:14 -0800 Subject: [PATCH 089/101] Minor speedups to xla util libraries. Change: 148897757 --- tensorflow/compiler/xla/index_util.cc | 12 ++++++++++-- tensorflow/compiler/xla/literal_util.cc | 7 ------- tensorflow/compiler/xla/literal_util.h | 7 +++++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/tensorflow/compiler/xla/index_util.cc b/tensorflow/compiler/xla/index_util.cc index e03bc1a210..4edbfd2482 100644 --- a/tensorflow/compiler/xla/index_util.cc +++ b/tensorflow/compiler/xla/index_util.cc @@ -77,9 +77,17 @@ namespace xla { // Scale factor holding the growing product of D{L(i)} terms. int64 scale = 1; int64 linear_index = 0; + bool first = true; for (auto dimension : shape.layout().minor_to_major()) { - linear_index += scale * multi_index[dimension]; - scale *= shape.dimensions(dimension); + if (first) { + // Avoid two multiplies on the first loop iteration + linear_index = multi_index[dimension]; + scale = shape.dimensions(dimension); + first = false; + } else { + linear_index += scale * multi_index[dimension]; + scale *= shape.dimensions(dimension); + } } return linear_index; } diff --git a/tensorflow/compiler/xla/literal_util.cc b/tensorflow/compiler/xla/literal_util.cc index b8bb56a97b..41974d915b 100644 --- a/tensorflow/compiler/xla/literal_util.cc +++ b/tensorflow/compiler/xla/literal_util.cc @@ -832,13 +832,6 @@ LiteralUtil::GetMutableRepeatedField( return literal->mutable_s64s(); } -template <> -/* static */ tensorflow::gtl::ArraySlice -LiteralUtil::GetArraySlice(const Literal& literal) { - CHECK(literal.shape().element_type() == F32); - return literal.f32s(); -} - template <> /* static */ tensorflow::protobuf::RepeatedField* LiteralUtil::GetMutableRepeatedField(Literal* literal) { diff --git a/tensorflow/compiler/xla/literal_util.h b/tensorflow/compiler/xla/literal_util.h index 80470f1586..315815bcbc 100644 --- a/tensorflow/compiler/xla/literal_util.h +++ b/tensorflow/compiler/xla/literal_util.h @@ -448,8 +448,11 @@ LiteralUtil::GetMutableRepeatedField( Literal* literal); template <> -/* static */ tensorflow::gtl::ArraySlice -LiteralUtil::GetArraySlice(const Literal& literal); +/* static */ inline tensorflow::gtl::ArraySlice +LiteralUtil::GetArraySlice(const Literal& literal) { + DCHECK(literal.shape().element_type() == F32); + return literal.f32s(); +} template <> /* static */ tensorflow::protobuf::RepeatedField* -- GitLab From 4ce2eb453502d8c42fd6a189be4cde3e40d240c3 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 1 Mar 2017 10:02:08 -0800 Subject: [PATCH 090/101] Delete .*weights_ and .*bias_ methods from canned estimators. Change: 148899498 --- .../learn/python/learn/estimators/dnn.py | 34 --------- .../learn/estimators/dnn_linear_combined.py | 72 +------------------ .../estimators/dnn_linear_combined_test.py | 58 +++++++++------ .../learn/python/learn/estimators/linear.py | 65 ----------------- .../python/learn/estimators/linear_test.py | 55 +++++++++++--- .../python/learn/estimators/nonlinear_test.py | 23 ++++-- .../learn/estimators/regression_test.py | 4 +- .../python/learn/estimators/stability_test.py | 11 ++- 8 files changed, 113 insertions(+), 209 deletions(-) diff --git a/tensorflow/contrib/learn/python/learn/estimators/dnn.py b/tensorflow/contrib/learn/python/learn/estimators/dnn.py index bf1c93257b..bfe1cd0aed 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/dnn.py +++ b/tensorflow/contrib/learn/python/learn/estimators/dnn.py @@ -37,8 +37,6 @@ from tensorflow.python.ops import partitioned_variables from tensorflow.python.ops import variable_scope from tensorflow.python.summary import summary -_CENTERED_BIAS_WEIGHT = "centered_bias_weight" - # The default learning rate of 0.05 is a historical artifact of the initial # implementation, but seems a reasonable choice. _LEARNING_RATE = 0.05 @@ -299,9 +297,7 @@ class DNNClassifier(estimator.Estimator): Raises: ValueError: If `n_classes` < 2. """ - self._hidden_units = hidden_units self._feature_columns = tuple(feature_columns or []) - self._enable_centered_bias = enable_centered_bias super(DNNClassifier, self).__init__( model_fn=_dnn_model_fn, model_dir=model_dir, @@ -462,36 +458,6 @@ class DNNClassifier(estimator.Estimator): default_batch_size=default_batch_size, exports_to_keep=exports_to_keep) - @property - @deprecated("2016-10-30", - "This method will be removed after the deprecation date. " - "To inspect variables, use get_variable_names() and " - "get_variable_value().") - def weights_(self): - hiddenlayer_weights = [ - self.get_variable_value("dnn/hiddenlayer_%d/weights" % i) - for i, _ in enumerate(self._hidden_units) - ] - logits_weights = [self.get_variable_value("dnn/logits/weights")] - return hiddenlayer_weights + logits_weights - - @property - @deprecated("2016-10-30", - "This method will be removed after the deprecation date. " - "To inspect variables, use get_variable_names() and " - "get_variable_value().") - def bias_(self): - hiddenlayer_bias = [ - self.get_variable_value("dnn/hiddenlayer_%d/biases" % i) - for i, _ in enumerate(self._hidden_units) - ] - logits_bias = [self.get_variable_value("dnn/logits/biases")] - if self._enable_centered_bias: - centered_bias = [self.get_variable_value(_CENTERED_BIAS_WEIGHT)] - else: - centered_bias = [] - return hiddenlayer_bias + logits_bias + centered_bias - class DNNRegressor(estimator.Estimator): """A regressor for TensorFlow DNN models. diff --git a/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py b/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py index 644f975e57..e5da8c0082 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py +++ b/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py @@ -20,7 +20,6 @@ from __future__ import division from __future__ import print_function import math -import re import six from tensorflow.contrib import layers @@ -43,8 +42,6 @@ from tensorflow.python.ops import partitioned_variables from tensorflow.python.ops import variable_scope -_CENTERED_BIAS_WEIGHT = "centered_bias_weight" - # The default learning rates are a historical artifact of the initial # implementation, but seem a reasonable choice. _DNN_LEARNING_RATE = 0.05 @@ -192,7 +189,8 @@ def _dnn_linear_combined_model_fn(features, labels, mode, params, config=None): else: if not dnn_hidden_units: raise ValueError( - "dnn_hidden_units must be defined when dnn_feature_columns is specified.") + "dnn_hidden_units must be defined when dnn_feature_columns is " + "specified.") dnn_partitioner = ( partitioned_variables.min_max_variable_partitioner( max_partitions=num_ps_replicas)) @@ -546,15 +544,12 @@ class DNNLinearCombinedClassifier(estimator.Estimator): if n_classes < 2: raise ValueError("n_classes should be greater than 1. Given: {}".format( n_classes)) - self._linear_optimizer = linear_optimizer or "Ftrl" linear_feature_columns = tuple(linear_feature_columns or []) dnn_feature_columns = tuple(dnn_feature_columns or []) self._feature_columns = linear_feature_columns + dnn_feature_columns if not self._feature_columns: raise ValueError("Either linear_feature_columns or dnn_feature_columns " "must be defined.") - self._dnn_hidden_units = dnn_hidden_units - self._enable_centered_bias = enable_centered_bias head = head_lib._multi_class_head( # pylint: disable=protected-access n_classes=n_classes, weight_column_name=weight_column_name, @@ -566,7 +561,7 @@ class DNNLinearCombinedClassifier(estimator.Estimator): params={ "head": head, "linear_feature_columns": linear_feature_columns, - "linear_optimizer": self._linear_optimizer, + "linear_optimizer": linear_optimizer, "joint_linear_weights": _joint_linear_weights, "dnn_feature_columns": dnn_feature_columns, "dnn_optimizer": dnn_optimizer, @@ -710,67 +705,6 @@ class DNNLinearCombinedClassifier(estimator.Estimator): default_batch_size=default_batch_size, exports_to_keep=exports_to_keep) - @property - @deprecated("2016-10-30", - "This method will be removed after the deprecation date. " - "To inspect variables, use get_variable_names() and " - "get_variable_value().") - def dnn_weights_(self): - hiddenlayer_weights = [ - self.get_variable_value("dnn/hiddenlayer_%d/weights" % i) - for i, _ in enumerate(self._dnn_hidden_units) - ] - logits_weights = [self.get_variable_value("dnn/logits/weights")] - return hiddenlayer_weights + logits_weights - - @property - @deprecated("2016-10-30", - "This method will be removed after the deprecation date. " - "To inspect variables, use get_variable_names() and " - "get_variable_value().") - def linear_weights_(self): - values = {} - if isinstance(self._linear_optimizer, str): - optimizer_name = self._linear_optimizer - else: - optimizer_name = self._linear_optimizer.get_name() - optimizer_regex = r".*/"+optimizer_name + r"(_\d)?$" - for name in self.get_variable_names(): - if (name.startswith("linear/") and - name != "linear/bias_weight" and - name != "linear/learning_rate" and - not re.match(optimizer_regex, name)): - values[name] = self.get_variable_value(name) - if len(values) == 1: - return values[list(values.keys())[0]] - return values - - @property - @deprecated("2016-10-30", - "This method will be removed after the deprecation date. " - "To inspect variables, use get_variable_names() and " - "get_variable_value().") - def dnn_bias_(self): - hiddenlayer_bias = [self.get_variable_value("dnn/hiddenlayer_%d/biases" % i) - for i, _ in enumerate(self._dnn_hidden_units)] - logits_bias = [self.get_variable_value("dnn/logits/biases")] - if not self._enable_centered_bias: - return hiddenlayer_bias + logits_bias - centered_bias = [self.get_variable_value(_CENTERED_BIAS_WEIGHT)] - return hiddenlayer_bias + logits_bias + centered_bias - - @property - @deprecated("2016-10-30", - "This method will be removed after the deprecation date. " - "To inspect variables, use get_variable_names() and " - "get_variable_value().") - def linear_bias_(self): - linear_bias = self.get_variable_value("linear/bias_weight") - if not self._enable_centered_bias: - return linear_bias - centered_bias = [self.get_variable_value(_CENTERED_BIAS_WEIGHT)] - return linear_bias + centered_bias - class DNNLinearCombinedRegressor(estimator.Estimator): """A regressor for TensorFlow Linear and DNN joined training models. diff --git a/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined_test.py b/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined_test.py index c081587f67..380e75b693 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined_test.py @@ -250,9 +250,10 @@ class DNNLinearCombinedClassifierTest(test.TestCase): with self.assertRaisesRegexp( ValueError, - 'dnn_hidden_units must be defined when dnn_feature_columns is specified'): + 'dnn_hidden_units must be defined when dnn_feature_columns is ' + 'specified'): classifier = dnn_linear_combined.DNNLinearCombinedClassifier( - dnn_feature_columns=[age, language]) + dnn_feature_columns=[age, language]) classifier.fit(input_fn=_input_fn, steps=2) def testEmbeddingMultiplier(self): @@ -860,13 +861,16 @@ class DNNLinearCombinedClassifierTest(test.TestCase): loss2 = classifier.evaluate(input_fn=input_fn, steps=1)['loss'] self.assertLess(loss2, loss1) - self.assertNotIn('dnn/logits/biases', classifier.get_variable_names()) - self.assertNotIn('dnn/logits/weights', classifier.get_variable_names()) - self.assertEquals(1, len(classifier.linear_bias_)) - self.assertEquals(2, len(classifier.linear_weights_)) - self.assertEquals(1, len(classifier.linear_weights_['linear/age/weight'])) + variable_names = classifier.get_variable_names() + self.assertNotIn('dnn/logits/biases', variable_names) + self.assertNotIn('dnn/logits/weights', variable_names) + self.assertIn('linear/bias_weight', variable_names) + self.assertIn('linear/age/weight', variable_names) + self.assertIn('linear/language/weights', variable_names) self.assertEquals( - 100, len(classifier.linear_weights_['linear/language/weights'])) + 1, len(classifier.get_variable_value('linear/age/weight'))) + self.assertEquals( + 100, len(classifier.get_variable_value('linear/language/weights'))) def testLinearOnlyOneFeature(self): """Tests that linear-only instantiation works for one feature only.""" @@ -888,10 +892,15 @@ class DNNLinearCombinedClassifierTest(test.TestCase): loss2 = classifier.evaluate(input_fn=input_fn, steps=1)['loss'] self.assertLess(loss2, loss1) - self.assertNotIn('dnn/logits/biases', classifier.get_variable_names()) - self.assertNotIn('dnn/logits/weights', classifier.get_variable_names()) - self.assertEquals(1, len(classifier.linear_bias_)) - self.assertEquals(99, len(classifier.linear_weights_)) + variable_names = classifier.get_variable_names() + self.assertNotIn('dnn/logits/biases', variable_names) + self.assertNotIn('dnn/logits/weights', variable_names) + self.assertIn('linear/bias_weight', variable_names) + self.assertIn('linear/language/weights', variable_names) + self.assertEquals( + 1, len(classifier.get_variable_value('linear/bias_weight'))) + self.assertEquals( + 99, len(classifier.get_variable_value('linear/language/weights'))) def testDNNOnly(self): """Tests that DNN-only instantiation works.""" @@ -903,11 +912,15 @@ class DNNLinearCombinedClassifierTest(test.TestCase): classifier.fit(input_fn=test_data.iris_input_multiclass_fn, steps=1000) classifier.evaluate(input_fn=test_data.iris_input_multiclass_fn, steps=100) - self.assertEquals(3, len(classifier.dnn_bias_)) - self.assertEquals(3, len(classifier.dnn_weights_)) - self.assertNotIn('linear/bias_weight', classifier.get_variable_names()) - self.assertNotIn('linear/feature_BUCKETIZED_weights', - classifier.get_variable_names()) + variable_names = classifier.get_variable_names() + self.assertIn('dnn/hiddenlayer_0/weights', variable_names) + self.assertIn('dnn/hiddenlayer_0/biases', variable_names) + self.assertIn('dnn/hiddenlayer_1/weights', variable_names) + self.assertIn('dnn/hiddenlayer_1/biases', variable_names) + self.assertIn('dnn/logits/weights', variable_names) + self.assertIn('dnn/logits/biases', variable_names) + self.assertNotIn('linear/bias_weight', variable_names) + self.assertNotIn('linear/feature_BUCKETIZED/weight', variable_names) def testDNNWeightsBiasesNames(self): """Tests the names of DNN weights and biases in the checkpoints.""" @@ -924,10 +937,13 @@ class DNNLinearCombinedClassifierTest(test.TestCase): dnn_hidden_units=[3, 3]) classifier.fit(input_fn=_input_fn_train, steps=5) - # hiddenlayer_0/weights,hiddenlayer_1/weights and dnn_logits/weights. - self.assertEquals(3, len(classifier.dnn_weights_)) - # hiddenlayer_0/biases, hiddenlayer_1/biases, dnn_logits/biases. - self.assertEquals(3, len(classifier.dnn_bias_)) + variable_names = classifier.get_variable_names() + self.assertIn('dnn/hiddenlayer_0/weights', variable_names) + self.assertIn('dnn/hiddenlayer_0/biases', variable_names) + self.assertIn('dnn/hiddenlayer_1/weights', variable_names) + self.assertIn('dnn/hiddenlayer_1/biases', variable_names) + self.assertIn('dnn/logits/weights', variable_names) + self.assertIn('dnn/logits/biases', variable_names) class DNNLinearCombinedRegressorTest(test.TestCase): diff --git a/tensorflow/contrib/learn/python/learn/estimators/linear.py b/tensorflow/contrib/learn/python/learn/estimators/linear.py index 2c75dc3946..30e78117a7 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/linear.py +++ b/tensorflow/contrib/learn/python/learn/estimators/linear.py @@ -20,7 +20,6 @@ from __future__ import division from __future__ import print_function import math -import re import six @@ -413,7 +412,6 @@ class LinearClassifier(estimator.Estimator): # requested for SDCA once its default changes to False. self._feature_columns = tuple(feature_columns or []) assert self._feature_columns - self._optimizer = optimizer chief_hook = None if (isinstance(optimizer, sdca_optimizer.SDCAOptimizer) and @@ -590,37 +588,6 @@ class LinearClassifier(estimator.Estimator): default_batch_size=default_batch_size, exports_to_keep=exports_to_keep) - @property - @deprecated("2016-10-30", - "This method will be removed after the deprecation date. " - "To inspect variables, use get_variable_names() and " - "get_variable_value().") - def weights_(self): - values = {} - if self._optimizer and not callable(self._optimizer): - optimizer_name = _get_optimizer(self._optimizer).get_name() - elif self._optimizer and callable(self._optimizer): - raise ValueError("Callable optimizer is not supported in this method.") - else: - optimizer_name = _get_default_optimizer(self._feature_columns).get_name() - optimizer_regex = r".*/" + optimizer_name + r"(_\d)?$" - for name in self.get_variable_names(): - if (name.startswith("linear/") and - name != "linear/bias_weight" and - not re.match(optimizer_regex, name)): - values[name] = self.get_variable_value(name) - if len(values) == 1: - return values[list(values.keys())[0]] - return values - - @property - @deprecated("2016-10-30", - "This method will be removed after the deprecation date. " - "To inspect variables, use get_variable_names() and " - "get_variable_value().") - def bias_(self): - return self.get_variable_value("linear/bias_weight") - class LinearRegressor(estimator.Estimator): """Linear regressor model. @@ -712,7 +679,6 @@ class LinearRegressor(estimator.Estimator): """ self._feature_columns = tuple(feature_columns or []) assert self._feature_columns - self._optimizer = optimizer chief_hook = None if (isinstance(optimizer, sdca_optimizer.SDCAOptimizer) and @@ -857,37 +823,6 @@ class LinearRegressor(estimator.Estimator): default_batch_size=default_batch_size, exports_to_keep=exports_to_keep) - @property - @deprecated("2016-10-30", - "This method will be removed after the deprecation date. " - "To inspect variables, use get_variable_names() and " - "get_variable_value().") - def weights_(self): - values = {} - if self._optimizer and not callable(self._optimizer): - optimizer_name = _get_optimizer(self._optimizer).get_name() - elif self._optimizer and callable(self._optimizer): - raise ValueError("Callable optimizer is not supported in this method.") - else: - optimizer_name = _get_default_optimizer(self._feature_columns).get_name() - optimizer_regex = r".*/" + optimizer_name + r"(_\d)?$" - for name in self.get_variable_names(): - if (name.startswith("linear/") and - name != "linear/bias_weight" and - not re.match(optimizer_regex, name)): - values[name] = self.get_variable_value(name) - if len(values) == 1: - return values[list(values.keys())[0]] - return values - - @property - @deprecated("2016-10-30", - "This method will be removed after the deprecation date. " - "To inspect variables, use get_variable_names() and " - "get_variable_value().") - def bias_(self): - return self.get_variable_value("linear/bias_weight") - # TODO(zakaria): Make it public when b/34751732 is fixed. class _LinearEstimator(estimator.Estimator): diff --git a/tensorflow/contrib/learn/python/learn/estimators/linear_test.py b/tensorflow/contrib/learn/python/learn/estimators/linear_test.py index 7a32b9d9b4..3a559377d6 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/linear_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/linear_test.py @@ -233,8 +233,14 @@ class LinearClassifierTest(test.TestCase): n_classes=3, feature_columns=[feature_column]) classifier.fit(input_fn=test_data.iris_input_multiclass_fn, steps=100) - self.assertEqual(4, len(classifier.weights_)) - self.assertEqual(3, len(classifier.bias_)) + + variable_names = classifier.get_variable_names() + self.assertIn('linear/feature/weight', variable_names) + self.assertIn('linear/bias_weight', variable_names) + self.assertEqual( + 4, len(classifier.get_variable_value('linear/feature/weight'))) + self.assertEqual( + 3, len(classifier.get_variable_value('linear/bias_weight'))) def testCustomOptimizerByObject(self): """Tests multi-class classification using matrix data as input.""" @@ -1359,8 +1365,10 @@ class LinearRegressorTest(test.TestCase): feature_columns=feature_columns, optimizer=ftrl.FtrlOptimizer(learning_rate=0.8)) regressor.fit(x, y, batch_size=64, steps=2000) + self.assertIn('linear//weight', regressor.get_variable_names()) + regressor_weights = regressor.get_variable_value('linear//weight') # Have to flatten weights since they come in (x, 1) shape. - self.assertAllClose(weights, regressor.weights_.flatten(), rtol=1) + self.assertAllClose(weights, regressor_weights.flatten(), rtol=1) # TODO(ispir): Disable centered_bias. # assert abs(bias - regressor.bias_) < 0.1 @@ -1387,8 +1395,10 @@ class LinearRegressorTest(test.TestCase): regressor.fit(input_fn=input_fn, steps=20) loss = regressor.evaluate(input_fn=input_fn, steps=1)['loss'] self.assertLess(loss, 0.01) + self.assertIn('linear/x/weight', regressor.get_variable_names()) + regressor_weights = regressor.get_variable_value('linear/x/weight') self.assertAllClose( - [w[0] for w in weights], regressor.weights_.flatten(), rtol=0.1) + [w[0] for w in weights], regressor_weights.flatten(), rtol=0.1) def testSdcaOptimizerMixedFeaturesArbitraryWeights(self): """Tests LinearRegressor with SDCAOptimizer and a mix of features.""" @@ -1458,7 +1468,15 @@ class LinearRegressorTest(test.TestCase): optimizer=sdca_optimizer) regressor.fit(input_fn=input_fn, steps=20) no_l1_reg_loss = regressor.evaluate(input_fn=input_fn, steps=1)['loss'] - no_l1_reg_weights = regressor.weights_ + variable_names = regressor.get_variable_names() + self.assertIn('linear/price/weight', variable_names) + self.assertIn('linear/country/weights', variable_names) + no_l1_reg_weights = { + 'linear/price/weight': regressor.get_variable_value( + 'linear/price/weight'), + 'linear/country/weights': regressor.get_variable_value( + 'linear/country/weights'), + } # Regressor with L1 regularization. sdca_optimizer = sdca_optimizer_lib.SDCAOptimizer( @@ -1469,7 +1487,12 @@ class LinearRegressorTest(test.TestCase): optimizer=sdca_optimizer) regressor.fit(input_fn=input_fn, steps=20) l1_reg_loss = regressor.evaluate(input_fn=input_fn, steps=1)['loss'] - l1_reg_weights = regressor.weights_ + l1_reg_weights = { + 'linear/price/weight': regressor.get_variable_value( + 'linear/price/weight'), + 'linear/country/weights': regressor.get_variable_value( + 'linear/country/weights'), + } # Unregularized loss is lower when there is no L1 regularization. self.assertLess(no_l1_reg_loss, l1_reg_loss) @@ -1570,11 +1593,17 @@ class LinearRegressorTest(test.TestCase): regressor.fit(input_fn=input_fn, steps=200) + variable_names = regressor.get_variable_names() + self.assertIn('linear/bias_weight', variable_names) + self.assertIn('linear/a/weight', variable_names) + self.assertIn('linear/b/weight', variable_names) # TODO(b/29339026): Change the expected results to expect a centered bias. self.assertNear( regressor.get_variable_value('linear/bias_weight')[0], 0.2, err=0.05) - self.assertNear(regressor.weights_['linear/a/weight'][0], 0.2, err=0.05) - self.assertNear(regressor.weights_['linear/b/weight'][0], 0.0, err=0.05) + self.assertNear( + regressor.get_variable_value('linear/a/weight')[0], 0.2, err=0.05) + self.assertNear( + regressor.get_variable_value('linear/b/weight')[0], 0.0, err=0.05) def testSdcaOptimizerBiasAndOtherColumnsFabricatedCentered(self): """Tests LinearClasssifier with SDCAOptimizer and validates bias weight.""" @@ -1616,10 +1645,16 @@ class LinearRegressorTest(test.TestCase): regressor.fit(input_fn=input_fn, steps=100) + variable_names = regressor.get_variable_names() + self.assertIn('linear/bias_weight', variable_names) + self.assertIn('linear/a/weight', variable_names) + self.assertIn('linear/b/weight', variable_names) self.assertNear( regressor.get_variable_value('linear/bias_weight')[0], 0.0, err=0.05) - self.assertNear(regressor.weights_['linear/a/weight'][0], 0.1, err=0.05) - self.assertNear(regressor.weights_['linear/b/weight'][0], -0.1, err=0.05) + self.assertNear( + regressor.get_variable_value('linear/a/weight')[0], 0.1, err=0.05) + self.assertNear( + regressor.get_variable_value('linear/b/weight')[0], -0.1, err=0.05) class LinearEstimatorTest(test.TestCase): diff --git a/tensorflow/contrib/learn/python/learn/estimators/nonlinear_test.py b/tensorflow/contrib/learn/python/learn/estimators/nonlinear_test.py index 85765c6598..8cf6270792 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/nonlinear_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/nonlinear_test.py @@ -44,13 +44,22 @@ class NonLinearTest(test.TestCase): n_classes=3, config=run_config.RunConfig(tf_random_seed=1)) classifier.fit(iris.data, iris.target, max_steps=200) - weights = classifier.weights_ - self.assertEqual(weights[0].shape, (4, 10)) - self.assertEqual(weights[1].shape, (10, 20)) - self.assertEqual(weights[2].shape, (20, 10)) - self.assertEqual(weights[3].shape, (10, 3)) - biases = classifier.bias_ - self.assertEqual(len(biases), 4) + variable_names = classifier.get_variable_names() + self.assertEqual( + classifier.get_variable_value("dnn/hiddenlayer_0/weights").shape, + (4, 10)) + self.assertEqual( + classifier.get_variable_value("dnn/hiddenlayer_1/weights").shape, + (10, 20)) + self.assertEqual( + classifier.get_variable_value("dnn/hiddenlayer_2/weights").shape, + (20, 10)) + self.assertEqual( + classifier.get_variable_value("dnn/logits/weights").shape, (10, 3)) + self.assertIn("dnn/hiddenlayer_0/biases", variable_names) + self.assertIn("dnn/hiddenlayer_1/biases", variable_names) + self.assertIn("dnn/hiddenlayer_2/biases", variable_names) + self.assertIn("dnn/logits/biases", variable_names) def testBostonDNN(self): boston = base.load_boston() diff --git a/tensorflow/contrib/learn/python/learn/estimators/regression_test.py b/tensorflow/contrib/learn/python/learn/estimators/regression_test.py index 6a57caaa8e..fef0a084d1 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/regression_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/regression_test.py @@ -40,8 +40,10 @@ class RegressionTest(test.TestCase): feature_columns=learn.infer_real_valued_columns_from_input(x), optimizer="SGD") regressor.fit(x, y, steps=200) + self.assertIn("linear//weight", regressor.get_variable_names()) + regressor_weights = regressor.get_variable_value("linear//weight") # Have to flatten weights since they come in (x, 1) shape. - self.assertAllClose(weights, regressor.weights_.flatten(), rtol=0.01) + self.assertAllClose(weights, regressor_weights.flatten(), rtol=0.01) # TODO(ispir): Disable centered_bias. # assert abs(bias - regressor.bias_) < 0.1 diff --git a/tensorflow/contrib/learn/python/learn/estimators/stability_test.py b/tensorflow/contrib/learn/python/learn/estimators/stability_test.py index d69ed494b6..6d04543819 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/stability_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/stability_test.py @@ -103,8 +103,15 @@ class StabilityTest(test.TestCase): optimizer=_NULL_OPTIMIZER, feature_columns=columns, config=config) regressor2.fit(x=boston.data, y=boston.target, steps=1) - self.assertAllClose(regressor1.weights_, regressor2.weights_) - self.assertAllClose(regressor1.bias_, regressor2.bias_) + variable_names = regressor1.get_variable_names() + self.assertIn('linear//weight', variable_names) + self.assertIn('linear/bias_weight', variable_names) + regressor1_weights = regressor1.get_variable_value('linear//weight') + regressor2_weights = regressor2.get_variable_value('linear//weight') + regressor1_bias = regressor1.get_variable_value('linear/bias_weight') + regressor2_bias = regressor2.get_variable_value('linear/bias_weight') + self.assertAllClose(regressor1_weights, regressor2_weights) + self.assertAllClose(regressor1_bias, regressor2_bias) self.assertAllClose( list(regressor1.predict_scores( boston.data, as_iterable=True)), -- GitLab From ccd7ca1fd6f4fa479f0c34e9b8499cfeebc02451 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 1 Mar 2017 10:50:59 -0800 Subject: [PATCH 091/101] Fix metagemm offsets in quantized matmul. Change: 148905332 --- tensorflow/core/kernels/meta_support.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorflow/core/kernels/meta_support.cc b/tensorflow/core/kernels/meta_support.cc index 0e899402a2..3973accefa 100644 --- a/tensorflow/core/kernels/meta_support.cc +++ b/tensorflow/core/kernels/meta_support.cc @@ -136,12 +136,12 @@ void QuantizedGemmImpl(OpKernelContext* tf_context, const quint8* a_data, params.left_stream.count = k; params.left_stream.stride = lda; - params.left_stream.multiplicative_sum_offset = offset_b; + params.left_stream.multiplicative_sum_offset = -offset_b; params.left_stream.additive_sum_offset = k * offset_a * offset_b; params.right_stream.count = k; params.right_stream.stride = ldb; - params.right_stream.multiplicative_sum_offset = offset_a; + params.right_stream.multiplicative_sum_offset = -offset_a; params.right_stream.additive_sum_offset = 0; params.fused_kernel.kernel.count = k; -- GitLab From ec204fc51c8f72bcb0983543f32e0934082502b2 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 1 Mar 2017 11:31:13 -0800 Subject: [PATCH 092/101] Make a version of generate.py that works with the 1.0 release branch (additional modules have been sealed since then). Change: 148910557 --- tensorflow/tools/docs/BUILD | 11 +++ tensorflow/tools/docs/generate_1_0.py | 127 ++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 tensorflow/tools/docs/generate_1_0.py diff --git a/tensorflow/tools/docs/BUILD b/tensorflow/tools/docs/BUILD index 444c5b86bc..0ae3035971 100644 --- a/tensorflow/tools/docs/BUILD +++ b/tensorflow/tools/docs/BUILD @@ -104,6 +104,17 @@ py_binary( ], ) +py_binary( + name = "generate_1_0", + srcs = ["generate_1_0.py"], + srcs_version = "PY2AND3", + deps = [ + ":generate_lib", + "//tensorflow:tensorflow_py", + "//tensorflow/python/debug:debug_py", + ], +) + py_library( name = "py_guide_parser", srcs = [ diff --git a/tensorflow/tools/docs/generate_1_0.py b/tensorflow/tools/docs/generate_1_0.py new file mode 100644 index 0000000000..c6a428d6bb --- /dev/null +++ b/tensorflow/tools/docs/generate_1_0.py @@ -0,0 +1,127 @@ +# Copyright 2015 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +"""Generate docs for the TensorFlow Python API.""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import argparse +import inspect +import os +import sys + +import tensorflow as tf + +from tensorflow.python import debug as tf_debug +from tensorflow.tools.docs import generate_lib + + +if __name__ == '__main__': + argument_parser = argparse.ArgumentParser() + argument_parser.add_argument( + '--output_dir', + type=str, + default=None, + required=True, + help='Directory to write docs to.' + ) + + argument_parser.add_argument( + '--src_dir', + type=str, + default=None, + required=True, + help='Directory with the source docs.' + ) + + # This doc generator works on the TensorFlow codebase. Since this script lives + # at tensorflow/tools/docs, and all code is defined somewhere inside + # tensorflow/, we can compute the base directory (two levels up), which is + # valid unless we're trying to apply this to a different code base, or are + # moving the script around. + script_dir = os.path.dirname(inspect.getfile(inspect.currentframe())) + default_base_dir = os.path.join(script_dir, '..', '..') + + argument_parser.add_argument( + '--base_dir', + type=str, + default=default_base_dir, + help=('Base directory to to strip from file names referenced in docs. ' + 'Defaults to two directories up from the location of this file.') + ) + + flags, _ = argument_parser.parse_known_args() + + # tf_debug is not imported with tf, it's a separate module altogether + modules = [('tf', tf), ('tfdbg', tf_debug)] + + # Access something in contrib so tf.contrib is properly loaded (it's hidden + # behind lazy loading) + _ = tf.contrib.__name__ + + generate_lib.do_not_descend_map = { + '': ['cli', 'lib', 'wrappers'], + 'contrib': [ + 'compiler', + 'factorization', + 'grid_rnn', + 'labeled_tensor', + 'ndlstm', + 'quantization', + 'session_bundle', + 'slim', + 'solvers', + 'specs', + 'tensor_forest', + 'tensorboard', + 'testing', + 'training', + 'tfprof', + ], + 'contrib.bayesflow': [ + 'entropy', 'monte_carlo', + 'special_math', 'stochastic_gradient_estimators', + 'stochastic_graph', 'stochastic_tensor', + 'stochastic_variables', 'variational_inference' + ], + 'contrib.distributions': ['bijector'], + 'contrib.ffmpeg': ['ffmpeg_ops'], + 'contrib.graph_editor': [ + 'edit', + 'match', + 'reroute', + 'subgraph', + 'transform', + 'select', + 'util' + ], + 'contrib.layers': ['feature_column', 'summaries'], + 'contrib.learn': [ + 'datasets', + 'head', + 'graph_actions', + 'io', + 'models', + 'monitors', + 'ops', + 'preprocessing', + 'utils', + ], + 'contrib.util': ['loader'], + } + + sys.exit(generate_lib.main( + flags.src_dir, flags.output_dir, flags.base_dir, modules)) -- GitLab From 990e24a35a3906df9bd23a14be0c87254c6366ed Mon Sep 17 00:00:00 2001 From: Zakaria Haque Date: Wed, 1 Mar 2017 11:54:33 -0800 Subject: [PATCH 093/101] Handles None train_op_fn properly. Makes it required for TRAIN mode. Provides a util function to create noon train op for cases when users want to handle optimization in model func. Also, Allows a dict of logits for multihead. See attached bug for more details. Change: 148913307 --- .../learn/python/learn/estimators/head.py | 52 ++++-- .../python/learn/estimators/head_test.py | 165 ++++++++++++------ 2 files changed, 143 insertions(+), 74 deletions(-) diff --git a/tensorflow/contrib/learn/python/learn/estimators/head.py b/tensorflow/contrib/learn/python/learn/estimators/head.py index 08c98e6758..b00c58b6e0 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/head.py +++ b/tensorflow/contrib/learn/python/learn/estimators/head.py @@ -226,7 +226,7 @@ def _multi_label_head(n_classes, metric_class_ids=None): """Creates a _Head for multi label classification. - The Head uses softmax cross entropy loss. + The Head uses sigmoid cross entropy loss. Args: n_classes: Integer, number of classes, must be >= 2 @@ -246,7 +246,7 @@ def _multi_label_head(n_classes, metrics. Must all be in the range `[0, n_classes)`. Returns: - An instance of _MultiClassHead. + An instance of _MultiLabelHead. Raises: ValueError: if n_classes is < 2 @@ -295,6 +295,11 @@ def _multi_head(heads, loss_weights=None): return _MultiHead(heads, loss_combiner=_weighted_loss_combiner) +def no_op_train_fn(loss): + del loss + return control_flow_ops.no_op() + + # TODO(zakaria): Make the classes public once we are ready for users to subclass # them. See b/34751732 class _Head(object): @@ -336,7 +341,8 @@ class _Head(object): mode: Estimator's `ModeKeys`. labels: Labels `Tensor`, or `dict` of same. train_op_fn: Function that takes a scalar loss and returns an op to - optimize with the loss. + optimize with the loss. Must not be `None` in TRAIN mode. If you want + to optimize loss yourself you can pass `no_op_train_fn`. logits: logits `Tensor`, or `dict` of same, to be used for the head. logits_input: `Tensor` from which to build logits. scope: Optional scope for `variable_scope`. @@ -520,7 +526,9 @@ def _create_model_fn_ops(features, logging_ops.scalar_summary( _summary_key(head_name, mkey.LOSS), weighted_average_loss) - if (mode == model_fn.ModeKeys.TRAIN) and (train_op_fn is not None): + if mode == model_fn.ModeKeys.TRAIN: + if train_op_fn is None: + raise ValueError("train_op_fn can not be None in TRAIN mode") train_op = _train_op(loss, labels, train_op_fn, centered_bias, logits_dimension, loss_fn) eval_metric_ops = metrics_fn( @@ -1206,10 +1214,6 @@ class _MultiLabelHead(_SingleHead): return metrics -def _noop(unused_loss): - return control_flow_ops.no_op() - - class _MultiHead(_Head): """_Head to combine multiple _Head objects. @@ -1266,10 +1270,15 @@ class _MultiHead(_Head): labels: Labels `Tensor`, or `dict` of same. train_op_fn: Function that takes a scalar loss and returns an op to optimize with the loss. - logits: Concatenated logits of (x, 1) shape where x is the sum of - `logits_dimension` of all the heads, i.e., same as `logits_dimension` - of this class. This function will split the logits tensor and pass - logits of proper size to each head. + logits: Concatenated logits for all heads or a dict of head name to logits + tensor. If concatenated logits, it should have (batchsize, x) shape + where x is the sum of `logits_dimension` of all the heads, + i.e., same as `logits_dimension` of this class. create_model_fn_ops + will split the logits tensor and pass logits of proper size to each + head. This is useful if we want to be agnostic about whether you + creating a single versus multihead. logits can also be a dict for + convenience where you are creating the head specific logits explicitly + and don't want to concatenate them yourself. logits_input: tensor to build logits from. scope: Optional scope for variable_scope. If provided, will be passed to all heads. Most users will want to set this to `None`, so each head @@ -1287,28 +1296,37 @@ class _MultiHead(_Head): if logits is None: # Use logits_input. for head in self._heads: - # TODO(ptucker): Do we need to let each head create its own logits? all_model_fn_ops.append( head.create_model_fn_ops( features=features, mode=mode, labels=labels, - train_op_fn=_noop, + train_op_fn=no_op_train_fn, logits_input=logits_input, scope=scope)) else: - # Split logits for each head. - for head, head_logits in zip(self._heads, self._split_logits(logits)): + head_logits_pairs = [] + if isinstance(logits, dict): + head_logits_pairs = [] + for head in self._heads: + head_logits_pairs.append((head, logits[head.head_name])) + else: + # Split logits for each head. + head_logits_pairs = zip(self._heads, self._split_logits(logits)) + + for head, head_logits in head_logits_pairs: all_model_fn_ops.append( head.create_model_fn_ops( features=features, mode=mode, labels=labels, - train_op_fn=_noop, + train_op_fn=no_op_train_fn, logits=head_logits, scope=scope)) if mode == model_fn.ModeKeys.TRAIN: + if train_op_fn is None: + raise ValueError("train_op_fn can not be None in TRAIN mode.") return self._combine_train(all_model_fn_ops, train_op_fn) if mode == model_fn.ModeKeys.INFER: return self._combine_infer(all_model_fn_ops) diff --git a/tensorflow/contrib/learn/python/learn/estimators/head_test.py b/tensorflow/contrib/learn/python/learn/estimators/head_test.py index ef7b8ea9b2..52ac8992e5 100644 --- a/tensorflow/contrib/learn/python/learn/estimators/head_test.py +++ b/tensorflow/contrib/learn/python/learn/estimators/head_test.py @@ -32,7 +32,6 @@ from tensorflow.core.framework import summary_pb2 from tensorflow.python.client import session from tensorflow.python.framework import ops from tensorflow.python.framework import sparse_tensor -from tensorflow.python.ops import control_flow_ops from tensorflow.python.ops import variables from tensorflow.python.platform import test # pylint: enable=g-bad-todo,g-import-not-at-top @@ -120,7 +119,7 @@ class PoissonHeadTest(test.TestCase): {}, labels=labels, mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=logits) self._assert_output_alternatives(model_fn_ops) _assert_summary_tags(self, ["loss"]) @@ -146,7 +145,7 @@ class RegressionHeadTest(test.TestCase): {}, labels=((0.,), (1.,), (1.,)), mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=((1.,), (1.,), (3.,))) self._assert_output_alternatives(model_fn_ops) _assert_summary_tags(self, ["loss"]) @@ -161,7 +160,7 @@ class RegressionHeadTest(test.TestCase): {}, labels=((0.,), (1.,), (1.,)), mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=((1., 1.), (1., 1.), (3., 1.))) def testRegressionWithLogitsInput(self): @@ -171,7 +170,7 @@ class RegressionHeadTest(test.TestCase): {}, labels=((0.,), (1.,), (1.,)), mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits_input=((0., 0.), (0., 0.), (0., 0.))) self._assert_output_alternatives(model_fn_ops) w = ("regression_head/logits/weights:0", @@ -191,7 +190,7 @@ class RegressionHeadTest(test.TestCase): {}, labels=((0.,), (1.,), (1.,)), mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits_input=((0., 0.), (0., 0.), (0., 0.)), logits=((1.,), (1.,), (3.,))) @@ -202,7 +201,7 @@ class RegressionHeadTest(test.TestCase): {}, labels=((1.,), (1.,), (3.,)), mode=model_fn.ModeKeys.EVAL, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=((0.,), (1.,), (1.,))) self._assert_output_alternatives(model_fn_ops) self.assertIsNone(model_fn_ops.train_op) @@ -218,7 +217,7 @@ class RegressionHeadTest(test.TestCase): {}, labels={label_name: ((0.,), (1.,), (1.,))}, mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=((1.,), (1.,), (3.,))) self._assert_output_alternatives(model_fn_ops) _assert_no_variables(self) @@ -233,7 +232,7 @@ class RegressionHeadTest(test.TestCase): features={"label_weight": weights}, labels=((0.,), (1.,), (1.,)), mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=((1.,), (1.,), (3.,))) self._assert_output_alternatives(model_fn_ops) _assert_no_variables(self) @@ -248,7 +247,7 @@ class RegressionHeadTest(test.TestCase): {}, labels=((0.,), (1.,), (1.,)), mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=((1.,), (1.,), (3.,))) self._assert_output_alternatives(model_fn_ops) _assert_variables( @@ -276,7 +275,7 @@ class RegressionHeadTest(test.TestCase): {}, labels=labels, mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=((1.,), (1.,), (3.,))) @@ -321,7 +320,7 @@ class MultiLabelHeadTest(test.TestCase): n_classes=n_classes, metric_class_ids=range(n_classes)) with ops.Graph().as_default(), session.Session(): model_fn_ops = head.create_model_fn_ops( - {}, model_fn.ModeKeys.TRAIN, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.TRAIN, self._labels, head_lib.no_op_train_fn, logits=self._logits) self._assert_output_alternatives(model_fn_ops) _assert_no_variables(self) @@ -339,7 +338,7 @@ class MultiLabelHeadTest(test.TestCase): with ops.Graph().as_default(), session.Session(): model_fn_ops = head.create_model_fn_ops( {}, model_fn.ModeKeys.TRAIN, labels=labels, - train_op_fn=_noop_train_op, logits=logits) + train_op_fn=head_lib.no_op_train_fn, logits=logits) self._assert_output_alternatives(model_fn_ops) _assert_no_variables(self) _assert_summary_tags(self, ["loss"]) @@ -365,7 +364,7 @@ class MultiLabelHeadTest(test.TestCase): with ops.Graph().as_default(), session.Session(): with self.assertRaisesRegexp(ValueError, "Dimensions.*not compatible"): head.create_model_fn_ops( - {}, model_fn.ModeKeys.TRAIN, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.TRAIN, self._labels, head_lib.no_op_train_fn, logits=self._logits) def testMultiLabelWithLogitsInput(self): @@ -374,7 +373,7 @@ class MultiLabelHeadTest(test.TestCase): n_classes=n_classes, metric_class_ids=range(n_classes)) with ops.Graph().as_default(), session.Session(): model_fn_ops = head.create_model_fn_ops( - {}, model_fn.ModeKeys.TRAIN, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.TRAIN, self._labels, head_lib.no_op_train_fn, logits_input=((0., 0.),)) self._assert_output_alternatives(model_fn_ops) w = ("multi_label_head/logits/weights:0", @@ -413,7 +412,7 @@ class MultiLabelHeadTest(test.TestCase): with self.assertRaisesRegexp( ValueError, "Both logits and logits_input supplied"): head.create_model_fn_ops( - {}, model_fn.ModeKeys.TRAIN, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.TRAIN, self._labels, head_lib.no_op_train_fn, logits_input=((0., 0.),), logits=self._logits) def testMultiLabelEvalMode(self): @@ -422,7 +421,7 @@ class MultiLabelHeadTest(test.TestCase): n_classes=n_classes, metric_class_ids=range(n_classes)) with ops.Graph().as_default(), session.Session(): model_fn_ops = head.create_model_fn_ops( - {}, model_fn.ModeKeys.EVAL, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.EVAL, self._labels, head_lib.no_op_train_fn, logits=self._logits) self._assert_output_alternatives(model_fn_ops) self.assertIsNone(model_fn_ops.train_op) @@ -441,7 +440,7 @@ class MultiLabelHeadTest(test.TestCase): # logloss: z:label, x:logit # z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) model_fn_ops = head.create_model_fn_ops( - {}, model_fn.ModeKeys.EVAL, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.EVAL, self._labels, head_lib.no_op_train_fn, logits=logits) self._assert_output_alternatives(model_fn_ops) self.assertIsNone(model_fn_ops.train_op) @@ -481,7 +480,7 @@ class MultiLabelHeadTest(test.TestCase): with ops.Graph().as_default(), session.Session(): model_fn_ops = head.create_model_fn_ops( {}, model_fn.ModeKeys.TRAIN, {label_name: self._labels}, - _noop_train_op, logits=self._logits) + head_lib.no_op_train_fn, logits=self._logits) self._assert_output_alternatives(model_fn_ops) _assert_no_variables(self) _assert_summary_tags(self, ["loss"]) @@ -500,7 +499,7 @@ class MultiLabelHeadTest(test.TestCase): features={"label_weight": .1}, labels=self._labels, mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=self._logits) self._assert_output_alternatives(model_fn_ops) _assert_no_variables(self) @@ -516,7 +515,7 @@ class MultiLabelHeadTest(test.TestCase): metric_class_ids=range(n_classes)) with ops.Graph().as_default(), session.Session(): model_fn_ops = head.create_model_fn_ops( - {}, model_fn.ModeKeys.TRAIN, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.TRAIN, self._labels, head_lib.no_op_train_fn, logits=self._logits) self._assert_output_alternatives(model_fn_ops) _assert_variables( @@ -550,7 +549,7 @@ class MultiLabelHeadTest(test.TestCase): features={}, mode=model_fn.ModeKeys.TRAIN, labels=labels, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=self._logits) _assert_no_variables(self) _assert_summary_tags(self, ["loss"]) @@ -576,7 +575,7 @@ class MultiLabelHeadTest(test.TestCase): features={}, labels=labels, mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=[0.]) @@ -614,7 +613,7 @@ class BinaryClassificationHeadTest(test.TestCase): # logloss: z:label, x:logit # z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) model_fn_ops = head.create_model_fn_ops( - {}, model_fn.ModeKeys.TRAIN, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.TRAIN, self._labels, head_lib.no_op_train_fn, logits=self._logits) self._assert_output_alternatives(model_fn_ops) _assert_no_variables(self) @@ -628,7 +627,7 @@ class BinaryClassificationHeadTest(test.TestCase): with ops.Graph().as_default(), session.Session(): with self.assertRaisesRegexp(ValueError, "Dimensions.*not compatible"): head.create_model_fn_ops( - {}, model_fn.ModeKeys.TRAIN, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.TRAIN, self._labels, head_lib.no_op_train_fn, logits=self._logits) def testBinaryClassificationWithLogitsInput(self): @@ -638,7 +637,7 @@ class BinaryClassificationHeadTest(test.TestCase): # logloss: z:label, x:logit # z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) model_fn_ops = head.create_model_fn_ops( - {}, model_fn.ModeKeys.TRAIN, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.TRAIN, self._labels, head_lib.no_op_train_fn, logits_input=((0., 0.), (0., 0.))) self._assert_output_alternatives(model_fn_ops) w = ("binary_logistic_head/logits/weights:0", @@ -667,7 +666,7 @@ class BinaryClassificationHeadTest(test.TestCase): with self.assertRaisesRegexp( ValueError, "Both logits and logits_input supplied"): head.create_model_fn_ops( - {}, model_fn.ModeKeys.TRAIN, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.TRAIN, self._labels, head_lib.no_op_train_fn, logits_input=((0., 0.), (0., 0.)), logits=self._logits) def testBinaryClassificationEvalMode(self): @@ -677,7 +676,7 @@ class BinaryClassificationHeadTest(test.TestCase): # logloss: z:label, x:logit # z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) model_fn_ops = head.create_model_fn_ops( - {}, model_fn.ModeKeys.EVAL, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.EVAL, self._labels, head_lib.no_op_train_fn, logits=self._logits) self._assert_output_alternatives(model_fn_ops) self.assertIsNone(model_fn_ops.train_op) @@ -694,7 +693,7 @@ class BinaryClassificationHeadTest(test.TestCase): # logloss: z:label, x:logit # z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) model_fn_ops = head.create_model_fn_ops( - {}, model_fn.ModeKeys.INFER, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.INFER, self._labels, head_lib.no_op_train_fn, logits=self._logits) self._assert_output_alternatives(model_fn_ops) self.assertIsNone(model_fn_ops.train_op) @@ -710,7 +709,7 @@ class BinaryClassificationHeadTest(test.TestCase): model_fn_ops = head.create_model_fn_ops( # This is what is being tested, features should not have weight for # inference. - {}, model_fn.ModeKeys.INFER, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.INFER, self._labels, head_lib.no_op_train_fn, logits=self._logits) self._assert_output_alternatives(model_fn_ops) self.assertIsNone(model_fn_ops.train_op) @@ -730,7 +729,7 @@ class BinaryClassificationHeadTest(test.TestCase): {}, model_fn.ModeKeys.TRAIN, labels, - _noop_train_op, + head_lib.no_op_train_fn, logits=((1.,), (1.,), (3.,))) def testBinaryClassificationWithLabelName(self): @@ -743,7 +742,7 @@ class BinaryClassificationHeadTest(test.TestCase): {}, labels={label_name: self._labels}, mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=self._logits) self._assert_output_alternatives(model_fn_ops) _assert_no_variables(self) @@ -764,7 +763,7 @@ class BinaryClassificationHeadTest(test.TestCase): features={"label_weight": weights}, labels=self._labels, mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=self._logits) self._assert_output_alternatives(model_fn_ops) _assert_no_variables(self) @@ -793,7 +792,7 @@ class BinaryClassificationHeadTest(test.TestCase): # logloss: z:label, x:logit # z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) model_fn_ops = head.create_model_fn_ops( - {}, model_fn.ModeKeys.TRAIN, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.TRAIN, self._labels, head_lib.no_op_train_fn, logits=self._logits) self._assert_output_alternatives(model_fn_ops) _assert_variables( @@ -854,7 +853,7 @@ class MultiClassHeadTest(test.TestCase): # logloss: z:label, x:logit # z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) model_fn_ops = head.create_model_fn_ops( - {}, model_fn.ModeKeys.TRAIN, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.TRAIN, self._labels, head_lib.no_op_train_fn, logits=self._logits) self._assert_output_alternatives(model_fn_ops) _assert_no_variables(self) @@ -868,7 +867,17 @@ class MultiClassHeadTest(test.TestCase): with ops.Graph().as_default(), session.Session(): with self.assertRaisesRegexp(ValueError, "Dimensions.*not compatible"): head.create_model_fn_ops( - {}, model_fn.ModeKeys.TRAIN, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.TRAIN, self._labels, head_lib.no_op_train_fn, + logits=self._logits) + + def testMultiClassWithNoneTrainOpFnInTrain(self): + head = head_lib._multi_class_head(n_classes=3) + with ops.Graph().as_default(), session.Session(): + with self.assertRaisesRegexp( + ValueError, "train_op_fn can not be None in TRAIN mode"): + head.create_model_fn_ops( + {}, model_fn.ModeKeys.TRAIN, self._labels, + train_op_fn=None, logits=self._logits) def testMultiClassWithLogitsInput(self): @@ -879,7 +888,7 @@ class MultiClassHeadTest(test.TestCase): # logloss: z:label, x:logit # z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) model_fn_ops = head.create_model_fn_ops( - {}, model_fn.ModeKeys.TRAIN, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.TRAIN, self._labels, head_lib.no_op_train_fn, logits_input=((0., 0.),)) self._assert_output_alternatives(model_fn_ops) w = ("multi_class_head/logits/weights:0", @@ -918,7 +927,7 @@ class MultiClassHeadTest(test.TestCase): with self.assertRaisesRegexp( ValueError, "Both logits and logits_input supplied"): head.create_model_fn_ops( - {}, model_fn.ModeKeys.TRAIN, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.TRAIN, self._labels, head_lib.no_op_train_fn, logits_input=((0., 0.),), logits=self._logits) def testMultiClassEvalMode(self): @@ -929,7 +938,7 @@ class MultiClassHeadTest(test.TestCase): # logloss: z:label, x:logit # z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) model_fn_ops = head.create_model_fn_ops( - {}, model_fn.ModeKeys.EVAL, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.EVAL, self._labels, head_lib.no_op_train_fn, logits=self._logits) self._assert_output_alternatives(model_fn_ops) self.assertIsNone(model_fn_ops.train_op) @@ -948,7 +957,7 @@ class MultiClassHeadTest(test.TestCase): # logloss: z:label, x:logit # z * -log(sigmoid(x)) + (1 - z) * -log(1 - sigmoid(x)) model_fn_ops = head.create_model_fn_ops( - {}, model_fn.ModeKeys.EVAL, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.EVAL, self._labels, head_lib.no_op_train_fn, logits=logits) self._assert_output_alternatives(model_fn_ops) self.assertIsNone(model_fn_ops.train_op) @@ -992,7 +1001,7 @@ class MultiClassHeadTest(test.TestCase): features={"label_weight": weight}, labels=self._labels, mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=self._logits) self._assert_output_alternatives(model_fn_ops) _assert_no_variables(self) @@ -1032,7 +1041,7 @@ class BinarySvmHeadTest(test.TestCase): {}, model_fn.ModeKeys.TRAIN, self._labels, - _noop_train_op, + head_lib.no_op_train_fn, logits=self._predictions) self._assert_output_alternatives(model_fn_ops) _assert_no_variables(self) @@ -1048,7 +1057,7 @@ class BinarySvmHeadTest(test.TestCase): with ops.Graph().as_default(), session.Session(): with self.assertRaisesRegexp(ValueError, "Dimensions.*not compatible"): head.create_model_fn_ops( - {}, model_fn.ModeKeys.TRAIN, self._labels, _noop_train_op, + {}, model_fn.ModeKeys.TRAIN, self._labels, head_lib.no_op_train_fn, logits=np.ones((2, 2))) def testBinarySVMWithLogitsInput(self): @@ -1058,7 +1067,7 @@ class BinarySvmHeadTest(test.TestCase): {}, model_fn.ModeKeys.TRAIN, self._labels, - _noop_train_op, + head_lib.no_op_train_fn, logits_input=((0., 0.), (0., 0.))) self._assert_output_alternatives(model_fn_ops) w = ("binary_svm_head/logits/weights:0", @@ -1082,7 +1091,7 @@ class BinarySvmHeadTest(test.TestCase): {}, model_fn.ModeKeys.TRAIN, self._labels, - _noop_train_op, + head_lib.no_op_train_fn, logits_input=((0., 0.), (0., 0.)), logits=self._predictions) @@ -1093,7 +1102,7 @@ class BinarySvmHeadTest(test.TestCase): {}, model_fn.ModeKeys.EVAL, self._labels, - _noop_train_op, + head_lib.no_op_train_fn, logits=self._predictions) self._assert_output_alternatives(model_fn_ops) self.assertIsNone(model_fn_ops.train_op) @@ -1113,7 +1122,7 @@ class BinarySvmHeadTest(test.TestCase): {}, model_fn.ModeKeys.TRAIN, {label_name: self._labels}, - _noop_train_op, + head_lib.no_op_train_fn, logits=self._predictions) self._assert_output_alternatives(model_fn_ops) _assert_no_variables(self) @@ -1132,7 +1141,7 @@ class BinarySvmHeadTest(test.TestCase): features={"weights": weights}, mode=model_fn.ModeKeys.TRAIN, labels=self._labels, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=self._predictions) self._assert_output_alternatives(model_fn_ops) _assert_no_variables(self) @@ -1151,7 +1160,7 @@ class BinarySvmHeadTest(test.TestCase): {}, model_fn.ModeKeys.TRAIN, self._labels, - _noop_train_op, + head_lib.no_op_train_fn, logits=self._predictions) self._assert_output_alternatives(model_fn_ops) _assert_variables( @@ -1184,6 +1193,25 @@ class MultiHeadTest(test.TestCase): with self.assertRaisesRegexp(ValueError, "must be SingleHead"): head_lib._multi_head((named_head, head_lib._multi_head((named_head,)))) + def testTrainWithNoneTrainOpFn(self): + head1 = head_lib._multi_class_head( + n_classes=3, label_name="label1", head_name="head1") + head2 = head_lib._multi_class_head( + n_classes=4, label_name="label2", head_name="head2") + head = head_lib._multi_head((head1, head2)) + labels = { + "label1": (1,), + "label2": (1,) + } + with self.assertRaisesRegexp( + ValueError, "train_op_fn can not be None in TRAIN mode"): + head.create_model_fn_ops( + features={"weights": (2.0, 10.0)}, + labels=labels, + mode=model_fn.ModeKeys.TRAIN, + train_op_fn=None, + logits=((-0.7, 0.2, .1, .1, .1, .1, .1),)) + def testTrain_withNoHeadWeights(self): head1 = head_lib._multi_class_head( n_classes=3, label_name="label1", head_name="head1") @@ -1198,7 +1226,7 @@ class MultiHeadTest(test.TestCase): features={"weights": (2.0, 10.0)}, labels=labels, mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=((-0.7, 0.2, .1, .1, .1, .1, .1),)) self.assertIsNone(model_fn_ops.predictions) @@ -1224,7 +1252,7 @@ class MultiHeadTest(test.TestCase): features={"weights": (2.0, 10.0)}, labels=labels, mode=model_fn.ModeKeys.TRAIN, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=((-0.7, 0.2, .1, .1, .1, .1, .1),)) self.assertIsNone(model_fn_ops.predictions) self.assertIsNotNone(model_fn_ops.loss) @@ -1235,6 +1263,33 @@ class MultiHeadTest(test.TestCase): with session.Session() as sess: self.assertAlmostEqual(1.531, sess.run(model_fn_ops.loss), places=3) + def testTrain_withDictLogits(self): + head1 = head_lib._multi_class_head( + n_classes=3, label_name="label1", head_name="head1") + head2 = head_lib._multi_class_head( + n_classes=4, label_name="label2", head_name="head2") + head = head_lib._multi_head((head1, head2)) + labels = { + "label1": (1,), + "label2": (1,) + } + model_fn_ops = head.create_model_fn_ops( + features={"weights": (2.0, 10.0)}, + labels=labels, + mode=model_fn.ModeKeys.TRAIN, + train_op_fn=head_lib.no_op_train_fn, + logits={head1.head_name: ((-0.7, 0.2, .1),), + head2.head_name: ((.1, .1, .1, .1),)}) + + self.assertIsNone(model_fn_ops.predictions) + self.assertIsNotNone(model_fn_ops.loss) + self.assertIsNotNone(model_fn_ops.train_op) + self.assertFalse(model_fn_ops.eval_metric_ops) + self.assertIsNone(model_fn_ops.output_alternatives) + + with session.Session() as sess: + self.assertAlmostEqual(2.224, sess.run(model_fn_ops.loss), places=3) + def testInfer(self): head1 = head_lib._multi_class_head( n_classes=3, label_name="label1", head_name="head1") @@ -1249,7 +1304,7 @@ class MultiHeadTest(test.TestCase): features={"weights": (2.0, 10.0)}, labels=labels, mode=model_fn.ModeKeys.INFER, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=((-0.7, 0.2, .1, .1, .1, .1, .1),)) self.assertIsNotNone(model_fn_ops.predictions) @@ -1299,7 +1354,7 @@ class MultiHeadTest(test.TestCase): features={"weights": (2.0, 10.0)}, labels=labels, mode=model_fn.ModeKeys.EVAL, - train_op_fn=_noop_train_op, + train_op_fn=head_lib.no_op_train_fn, logits=((-0.7, 0.2, .1, .1, .1, .1, .1),)) self.assertIsNotNone(model_fn_ops.predictions) @@ -1315,9 +1370,5 @@ class MultiHeadTest(test.TestCase): self.assertIn("accuracy/head2", metric_ops.keys()) -def _noop_train_op(unused_loss): - return control_flow_ops.no_op() - - if __name__ == "__main__": test.main() -- GitLab From 5902c73c9cee4388fcc5017f4b235eb2a13a2e99 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 1 Mar 2017 12:00:27 -0800 Subject: [PATCH 094/101] Add an options to quantize_nodes, allowing it to not quantize some types of Ops. Change: 148913966 --- .../tools/graph_transforms/quantize_nodes.cc | 17 +++++- .../graph_transforms/quantize_nodes_test.cc | 58 +++++++++++++++++++ 2 files changed, 72 insertions(+), 3 deletions(-) diff --git a/tensorflow/tools/graph_transforms/quantize_nodes.cc b/tensorflow/tools/graph_transforms/quantize_nodes.cc index 4533074268..5d1c76834f 100644 --- a/tensorflow/tools/graph_transforms/quantize_nodes.cc +++ b/tensorflow/tools/graph_transforms/quantize_nodes.cc @@ -636,14 +636,25 @@ Status QuantizeNodes(const GraphDef& input_graph_def, // The result will end up with a lot of redundant dequantize/quantize pairs // between adjacent quantized ops, but a later pass removes these where it // can. + + std::set ops_to_ignore; + if (context.params.count("ignore_op") > 0) { + for (const string& name : context.params.at("ignore_op")) { + ops_to_ignore.insert(name); + } + } + const std::vector& op_list = GetQuantizedOpList(); string op_pattern; bool is_first = true; std::map op_map; for (const QuantizedOpInfo& op_info : op_list) { - strings::StrAppend(&op_pattern, (is_first ? "" : "|"), op_info.float_name); - op_map.insert({op_info.float_name, op_info}); - is_first = false; + if (ops_to_ignore.count(op_info.float_name) == 0) { + strings::StrAppend(&op_pattern, (is_first ? "" : "|"), + op_info.float_name); + op_map.insert({op_info.float_name, op_info}); + is_first = false; + } } // If input_min and input max have been passed in, then we convert all float diff --git a/tensorflow/tools/graph_transforms/quantize_nodes_test.cc b/tensorflow/tools/graph_transforms/quantize_nodes_test.cc index c4de14d7a8..f8fe13ca13 100644 --- a/tensorflow/tools/graph_transforms/quantize_nodes_test.cc +++ b/tensorflow/tools/graph_transforms/quantize_nodes_test.cc @@ -152,6 +152,58 @@ class QuantizeNodesTest : public ::testing::Test { context, 2.0, quantized_graph_def); } + void TestIgnoreOps(std::initializer_list ops_to_ignore) { + auto root = tensorflow::Scope::NewRootScope(); + using namespace ::tensorflow::ops; // NOLINT(build/namespaces) + + // A small helper to construct a Const op. + auto const_op = [&](const string& name, const TensorShape& shape, + std::initializer_list values) { + Tensor tensor(DT_FLOAT, shape); + test::FillValues(&tensor, values); + return Const(root.WithOpName(name), Input::Initializer(tensor)); + }; + + // A simple graph with two different quantizable ops. + int m = 1; + int n = 1; + int k = 1; + Output a_op = const_op("a_op", {m, k}, {2}); + Output b_op = const_op("b_op", {k, n}, {3}); + Output c_op = const_op("c_op", {m, k}, {1}); + Output d_op = const_op("d_op", {k, n}, {4}); + Output mat_mul_op = MatMul(root.WithOpName("mat_mul_op"), a_op, b_op); + Output mul_op = Mul(root.WithOpName("mul"), c_op, d_op); + + GraphDef float_graph_def; + TF_ASSERT_OK(root.ToGraphDef(&float_graph_def)); + + TransformFuncContext context; + if (ops_to_ignore.size() > 0) { + context.params["ignore_op"] = ops_to_ignore; + } + + GraphDef quantized_graph_def; + TestTransformedVersusFloatGraph(QuantizeNodes, float_graph_def, {}, {}, + {"mat_mul_op", "mul"}, context, 1.0, + &quantized_graph_def); + + // Make sure the quantized graph still contains the op that should have + // been ignored by QuantizeNodes. + for (const string& op_name : ops_to_ignore) { + bool exists_in_quantized_graph = false; + for (const NodeDef& node : quantized_graph_def.node()) { + if (node.op() == op_name) { + exists_in_quantized_graph = true; + break; + } + } + EXPECT_TRUE(exists_in_quantized_graph) + << "Op " << op_name + << " should not have been replace by a quantized version"; + } + } + void TestQuantizeMatMul(int m, int n, int k, const std::vector& a_values, const std::vector& b_values) { @@ -1316,6 +1368,12 @@ class QuantizeNodesTest : public ::testing::Test { } }; +TEST_F(QuantizeNodesTest, TestIgnoreOps) { + TestIgnoreOps({}); + TestIgnoreOps({"MatMul"}); + TestIgnoreOps({"MatMul", "Mul"}); +} + TEST_F(QuantizeNodesTest, TestQuantizeMatMulTiny) { TestQuantizeMatMulTiny(); } TEST_F(QuantizeNodesTest, TestQuantizeMatMulSmall) { -- GitLab From 03f1ff73c7caf58cd46cbc5d3713eea63dca2246 Mon Sep 17 00:00:00 2001 From: Pete Warden Date: Wed, 1 Mar 2017 12:09:35 -0800 Subject: [PATCH 095/101] Internal-only changes Change: 148915145 --- tensorflow/core/BUILD | 8 ++++---- tensorflow/core/platform/default/build_config.bzl | 6 ++++++ tensorflow/core/platform/protobuf.h | 2 +- tensorflow/tools/proto_text/BUILD | 4 ++++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD index f681501ff4..2f8bacca85 100644 --- a/tensorflow/core/BUILD +++ b/tensorflow/core/BUILD @@ -107,6 +107,7 @@ load( "tf_kernel_tests_linkstatic", "tf_additional_cloud_op_deps", "tf_additional_cloud_kernel_deps", + "tf_lib_proto_parsing_deps", ) load( "//tensorflow/core:platform/default/build_config_root.bzl", @@ -221,10 +222,7 @@ cc_library( "platform/types.h", ] + glob(tf_additional_proto_hdrs()) + glob(tf_env_time_hdrs()), copts = tf_copts(), - deps = [ - ":protos_all_cc", - "//tensorflow/core/platform/default/build_config:proto_parsing", - ], + deps = tf_lib_proto_parsing_deps(), ) cc_library( @@ -446,7 +444,9 @@ cc_library( "framework/type_traits.h", "platform/default/dynamic_annotations.h", "platform/default/integral_types.h", + "platform/default/logging.h", "platform/default/mutex.h", + "platform/default/protobuf.h", "platform/default/thread_annotations.h", "platform/dynamic_annotations.h", "platform/macros.h", diff --git a/tensorflow/core/platform/default/build_config.bzl b/tensorflow/core/platform/default/build_config.bzl index 06418f83a1..a2c133b43a 100644 --- a/tensorflow/core/platform/default/build_config.bzl +++ b/tensorflow/core/platform/default/build_config.bzl @@ -241,3 +241,9 @@ def tf_additional_cloud_kernel_deps(): #if WITH_GCP_SUPPORT: # deps = if_not_mobile(["//tensorflow/core:cloud_ops_op_lib"]) return deps + +def tf_lib_proto_parsing_deps(): + return [ + ":protos_all_cc", + "//tensorflow/core/platform/default/build_config:proto_parsing", + ] diff --git a/tensorflow/core/platform/protobuf.h b/tensorflow/core/platform/protobuf.h index c7a72ee701..288d091624 100644 --- a/tensorflow/core/platform/protobuf.h +++ b/tensorflow/core/platform/protobuf.h @@ -25,7 +25,7 @@ limitations under the License. // TensorFlow code should use the ::tensorflow::protobuf namespace to // refer to all protobuf APIs. -#if defined(PLATFORM_GOOGLE) +#if defined(PLATFORM_GOOGLE) && !defined(USE_DEFAULT_PROTOBUF) #include "tensorflow/core/platform/google/protobuf.h" #else #include "tensorflow/core/platform/default/protobuf.h" diff --git a/tensorflow/tools/proto_text/BUILD b/tensorflow/tools/proto_text/BUILD index d439c9abfd..2d14538c8d 100644 --- a/tensorflow/tools/proto_text/BUILD +++ b/tensorflow/tools/proto_text/BUILD @@ -48,6 +48,10 @@ cc_library( "-lm", "-lpthread", ], + "//tensorflow:ios": [ + "-lm", + "-lpthread", + ], "//conditions:default": [ "-lm", "-lpthread", -- GitLab From 6d8cb080fe46586b3063c0e50dc659c42c31f7f5 Mon Sep 17 00:00:00 2001 From: Jingyue Wu Date: Wed, 1 Mar 2017 12:50:01 -0800 Subject: [PATCH 096/101] Fix cmake windows build. Change: 148919678 --- tensorflow/contrib/cmake/tf_core_ops.cmake | 1 + tensorflow/contrib/cmake/tf_python.cmake | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/tensorflow/contrib/cmake/tf_core_ops.cmake b/tensorflow/contrib/cmake/tf_core_ops.cmake index 763b77dc42..56072fbdd7 100644 --- a/tensorflow/contrib/cmake/tf_core_ops.cmake +++ b/tensorflow/contrib/cmake/tf_core_ops.cmake @@ -48,6 +48,7 @@ GENERATE_CONTRIB_OP_LIBRARY(cudnn_rnn "${tensorflow_source_dir}/tensorflow/contr GENERATE_CONTRIB_OP_LIBRARY(factorization_clustering "${tensorflow_source_dir}/tensorflow/contrib/factorization/ops/clustering_ops.cc") GENERATE_CONTRIB_OP_LIBRARY(factorization_factorization "${tensorflow_source_dir}/tensorflow/contrib/factorization/ops/factorization_ops.cc") GENERATE_CONTRIB_OP_LIBRARY(framework_variable "${tensorflow_source_dir}/tensorflow/contrib/framework/ops/variable_ops.cc") +GENERATE_CONTRIB_OP_LIBRARY(memory_stats "${tensorflow_source_dir}/tensorflow/contrib/memory_stats/ops/memory_stats_ops.cc") GENERATE_CONTRIB_OP_LIBRARY(tensor_forest "${tensorflow_source_dir}/tensorflow/contrib/tensor_forest/ops/tensor_forest_ops.cc") ######################################################## diff --git a/tensorflow/contrib/cmake/tf_python.cmake b/tensorflow/contrib/cmake/tf_python.cmake index cf17c6f666..07374e33fa 100644 --- a/tensorflow/contrib/cmake/tf_python.cmake +++ b/tensorflow/contrib/cmake/tf_python.cmake @@ -337,6 +337,12 @@ add_python_module("tensorflow/contrib/losses/python") add_python_module("tensorflow/contrib/losses/python/losses") add_python_module("tensorflow/contrib/makefile") add_python_module("tensorflow/contrib/makefile/test") +add_python_module("tensorflow/contrib/memory_stats") +add_python_module("tensorflow/contrib/memory_stats/kernels") +add_python_module("tensorflow/contrib/memory_stats/ops") +add_python_module("tensorflow/contrib/memory_stats/python") +add_python_module("tensorflow/contrib/memory_stats/python/kernel_tests") +add_python_module("tensorflow/contrib/memory_stats/python/ops") add_python_module("tensorflow/contrib/metrics") add_python_module("tensorflow/contrib/metrics/kernels") add_python_module("tensorflow/contrib/metrics/ops") @@ -528,6 +534,8 @@ GENERATE_PYTHON_OP_LIB("contrib_factorization_factorization_ops" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/contrib/factorization/python/ops/gen_factorization_ops.py) GENERATE_PYTHON_OP_LIB("contrib_framework_variable_ops" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/contrib/framework/python/ops/gen_variable_ops.py) +GENERATE_PYTHON_OP_LIB("contrib_memory_stats_ops" + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/contrib/memory_stats/ops/gen_memory_stats_ops.py) GENERATE_PYTHON_OP_LIB("contrib_tensor_forest_ops" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/tf_python/tensorflow/contrib/tensor_forest/python/ops/gen_tensor_forest_ops.py) -- GitLab From 4f5c6bb77836a6d464d072484942cf1807a1e303 Mon Sep 17 00:00:00 2001 From: Yuefeng Zhou Date: Wed, 1 Mar 2017 12:54:09 -0800 Subject: [PATCH 097/101] Add interfaces in OpKernelContext and ResourceBase for tracking persistent storage. Record persistent tensor memory and persistent memory (originally auxiliary memory) in the cost model. Change: 148920117 --- tensorflow/core/common_runtime/executor.cc | 12 +++ .../common_runtime/step_stats_collector.cc | 2 +- tensorflow/core/framework/cost_graph.proto | 8 +- tensorflow/core/framework/op_kernel.cc | 66 ++++++++++++++- tensorflow/core/framework/op_kernel.h | 40 +++++++++ tensorflow/core/framework/resource_mgr.h | 3 + tensorflow/core/framework/step_stats.proto | 11 +++ tensorflow/core/graph/costmodel.cc | 81 ++++++++++++------- tensorflow/core/graph/costmodel.h | 53 ++++++------ 9 files changed, 209 insertions(+), 67 deletions(-) diff --git a/tensorflow/core/common_runtime/executor.cc b/tensorflow/core/common_runtime/executor.cc index 98da489b15..6a1cb4e63e 100644 --- a/tensorflow/core/common_runtime/executor.cc +++ b/tensorflow/core/common_runtime/executor.cc @@ -166,6 +166,18 @@ void SetMemory(NodeExecStats* nt, OpKernelContext* ctx) { memory->set_live_bytes(std::get<2>(sizes)); } } + auto* ms = nt->mutable_memory_stats(); + ms->set_host_temp_memory_size(ctx->host_temp_memory_size()); + ms->set_device_temp_memory_size(ctx->device_temp_memory_size()); + for (const auto& alloc_id : ctx->host_persistent_alloc_ids()) { + ms->mutable_host_persistent_tensor_alloc_ids()->Add(alloc_id); + } + for (const auto& alloc_id : ctx->device_persistent_alloc_ids()) { + ms->mutable_device_persistent_tensor_alloc_ids()->Add(alloc_id); + } + ms->set_host_persistent_memory_size(ctx->host_persistent_memory_allocated()); + ms->set_device_persistent_memory_size( + ctx->device_persistent_memory_allocated()); } void SetReferencedTensors(NodeExecStats* nt, diff --git a/tensorflow/core/common_runtime/step_stats_collector.cc b/tensorflow/core/common_runtime/step_stats_collector.cc index e60f77de0f..9b43385d6f 100644 --- a/tensorflow/core/common_runtime/step_stats_collector.cc +++ b/tensorflow/core/common_runtime/step_stats_collector.cc @@ -186,7 +186,7 @@ void StepStatsCollector::BuildCostModel( .allocation_description() .allocation_id()); } - cm->RecordAllocatorMemory(node, stats.memory()); + cm->RecordMemoryStats(node, stats.memory_stats()); // Use hardware stats to record the execution time if they're available, // otherwise use the regular (less accurate) stats string node_name = dev_stats.regular_stats->node_stats(i).node_name(); diff --git a/tensorflow/core/framework/cost_graph.proto b/tensorflow/core/framework/cost_graph.proto index a6535853a2..f4837fbfc5 100644 --- a/tensorflow/core/framework/cost_graph.proto +++ b/tensorflow/core/framework/cost_graph.proto @@ -45,10 +45,10 @@ message CostGraphDef { // Temporary memory used by this node. int64 temporary_memory_size = 6; - int64 host_peak_memory_size = 10; - int64 device_peak_memory_size = 11; - int64 persisted_memory_size = 12; - int64 auxiliary_memory_size = 13; + int64 host_temp_memory_size = 10; + int64 device_temp_memory_size = 11; + int64 host_persistent_memory_size = 12; + int64 device_persistent_memory_size = 16; // Estimate of the computational cost of this node, in microseconds. int64 compute_cost = 9; diff --git a/tensorflow/core/framework/op_kernel.cc b/tensorflow/core/framework/op_kernel.cc index 186a0c104c..ca66d34f15 100644 --- a/tensorflow/core/framework/op_kernel.cc +++ b/tensorflow/core/framework/op_kernel.cc @@ -200,7 +200,12 @@ OpKernelContext::OpKernelContext(Params* params) params, static_cast(params->op_kernel->output_types().size())) {} OpKernelContext::OpKernelContext(Params* params, int num_outputs) - : params_(params), outputs_(num_outputs) { + : params_(params), + outputs_(num_outputs), + host_temp_memory_size_(0), + device_temp_memory_size_(0), + host_persistent_memory_allocated_(0), + device_persistent_memory_allocated_(0) { Allocator* eigen_gpu_allocator = get_allocator(AllocatorAttributes()); params_->ensure_eigen_gpu_device(); params_->device->ReinitializeGpuDevice(this, params_->eigen_gpu_device, @@ -223,7 +228,7 @@ OpKernelContext::~OpKernelContext() { Allocator* OpKernelContext::get_allocator(AllocatorAttributes attr) { Allocator* allocator = params_->device->GetStepAllocator(attr, resource_manager()); - if (params_->track_allocations) { + if (track_allocations()) { mutex_lock lock(mu_); for (const auto& wrapped : wrapped_allocators_) { if (wrapped.first == allocator) { @@ -602,6 +607,18 @@ Status OpKernelContext::allocate_temp( const AllocationAttributes& allocation_attr) { Status s = allocate_tensor(type, shape, out_temp, allocator_attr, allocation_attr); + if (track_allocations()) { + Allocator* a = get_allocator(allocator_attr); + if (a->TracksAllocationSizes()) { + int64 alloc_size = + a->AllocatedSize(const_cast(out_temp->tensor_data().data())); + if (allocate_on_host(allocator_attr)) { + record_host_temp_memory_size(alloc_size); + } else { + record_device_temp_memory_size(alloc_size); + } + } + } return s; } @@ -610,7 +627,6 @@ Status OpKernelContext::allocate_persistent(DataType type, PersistentTensor* out_persistent, Tensor** out_tensor, AllocatorAttributes attr) { - // TODO(misard) add specific memory tracking for persistent tensors Tensor persistent; Status s = allocate_tensor(type, shape, &persistent, attr); if (s.ok()) { @@ -619,6 +635,24 @@ Status OpKernelContext::allocate_persistent(DataType type, *out_tensor = out_persistent->AccessTensor(this); } } + if (track_allocations()) { + Allocator* a = get_allocator(attr); + if (a->TracksAllocationSizes()) { + int64 alloc_size = + a->AllocatedSize(const_cast(persistent.tensor_data().data())); + int64 alloc_id = + a->AllocationId(const_cast(persistent.tensor_data().data())); + if (allocate_on_host(attr)) { + record_host_persistent_memory_allocation(alloc_size, alloc_id); + // This function has called allocate_temp(), so we need to deduct the + // recorded temp memory size. + record_host_temp_memory_size(-alloc_size); + } else { + record_device_persistent_memory_allocation(alloc_size, alloc_id); + record_device_temp_memory_size(-alloc_size); + } + } + } return s; } @@ -719,6 +753,32 @@ Status OpKernelContext::MatchSignature(const DataTypeSlice expected_inputs, outputs); } +bool OpKernelContext::allocate_on_host(AllocatorAttributes alloc_attr) const { + return alloc_attr.on_host() || device()->attributes().device_type() == "CPU"; +} + +void OpKernelContext::record_host_persistent_memory_allocation(int64 size, + int64 alloc_id) { + host_persistent_memory_allocated_ += size; + host_persistent_alloc_ids_.push_back(alloc_id); +} + +void OpKernelContext::record_device_persistent_memory_allocation( + int64 size, int64 alloc_id) { + device_persistent_memory_allocated_ += size; + device_persistent_alloc_ids_.push_back(alloc_id); +} + +std::vector OpKernelContext::host_persistent_alloc_ids() const { + return std::vector(host_persistent_alloc_ids_.begin(), + host_persistent_alloc_ids_.end()); +} + +std::vector OpKernelContext::device_persistent_alloc_ids() const { + return std::vector(device_persistent_alloc_ids_.begin(), + device_persistent_alloc_ids_.end()); +} + // OpKernel registration ------------------------------------------------------ struct KernelRegistration { diff --git a/tensorflow/core/framework/op_kernel.h b/tensorflow/core/framework/op_kernel.h index eb1ca88938..5d0a2e3d24 100644 --- a/tensorflow/core/framework/op_kernel.h +++ b/tensorflow/core/framework/op_kernel.h @@ -1004,6 +1004,37 @@ class OpKernelContext { void set_output_ref(int index, mutex* mu, Tensor* tensor_for_ref); TensorValue release_output(int index); + bool track_allocations() const { return params_->track_allocations; } + + // Records temporary memory sizes. + void record_host_temp_memory_size(int64 size) { + host_temp_memory_size_ += size; + } + void record_device_temp_memory_size(int64 size) { + device_temp_memory_size_ += size; + } + + // Returns recorded size of temporary memory; + int64 host_temp_memory_size() const { return host_temp_memory_size_; } + int64 device_temp_memory_size() const { return device_temp_memory_size_; } + + // Records persistent memory allocation, size can be negative indicating + // deallocation. + void record_host_persistent_memory_allocation(int64 size, + int64 alloc_id = -1); + void record_device_persistent_memory_allocation(int64 size, + int64 alloc_id = -1); + + // Returns recorded size and ids of persistent memory. + int64 host_persistent_memory_allocated() const { + return host_persistent_memory_allocated_; + } + int64 device_persistent_memory_allocated() const { + return device_persistent_memory_allocated_; + } + std::vector host_persistent_alloc_ids() const; + std::vector device_persistent_alloc_ids() const; + private: bool input_is_ref(int index) const; @@ -1028,6 +1059,8 @@ class OpKernelContext { Tensor* out_tensor, AllocatorAttributes allocator_attr, const AllocationAttributes& allocation_attr); + bool allocate_on_host(AllocatorAttributes alloc_attr) const; + // This is called by PersistentTensor::AccessTensor whenever the // wrapped tensor is retrieved, to ensure the runtime knows that the // Tensor is being accessed within an Op. This is necessary for @@ -1047,6 +1080,13 @@ class OpKernelContext { bool is_output_dead_ = false; + int64 host_temp_memory_size_; + int64 device_temp_memory_size_; + gtl::InlinedVector host_persistent_alloc_ids_; + gtl::InlinedVector device_persistent_alloc_ids_; + int64 host_persistent_memory_allocated_; + int64 device_persistent_memory_allocated_; + TF_DISALLOW_COPY_AND_ASSIGN(OpKernelContext); }; diff --git a/tensorflow/core/framework/resource_mgr.h b/tensorflow/core/framework/resource_mgr.h index 882d56b611..fe6e09378f 100644 --- a/tensorflow/core/framework/resource_mgr.h +++ b/tensorflow/core/framework/resource_mgr.h @@ -77,6 +77,9 @@ class ResourceBase : public core::RefCounted { public: // Returns a debug string for *this. virtual string DebugString() = 0; + + // Returns memory used by this resource. + virtual int64 MemoryUsed() const { return 0; }; }; // Container used for per-step resources. diff --git a/tensorflow/core/framework/step_stats.proto b/tensorflow/core/framework/step_stats.proto index ed43b7a585..bda90f9d93 100644 --- a/tensorflow/core/framework/step_stats.proto +++ b/tensorflow/core/framework/step_stats.proto @@ -27,6 +27,16 @@ message NodeOutput { TensorDescription tensor_description = 3; }; +// For memory tracking. +message MemoryStats { + int64 host_temp_memory_size = 1; + int64 device_temp_memory_size = 2; + int64 host_persistent_memory_size = 3; + int64 device_persistent_memory_size = 4; + repeated int64 host_persistent_tensor_alloc_ids = 5; + repeated int64 device_persistent_tensor_alloc_ids = 6; +} + // Time/size stats recorded for a single execution of a graph node. message NodeExecStats { // TODO(tucker): Use some more compact form of node identity than @@ -44,6 +54,7 @@ message NodeExecStats { int64 scheduled_micros = 9; uint32 thread_id = 10; repeated AllocationDescription referenced_tensor = 11; + MemoryStats memory_stats = 12; }; message DeviceStepStats { diff --git a/tensorflow/core/graph/costmodel.cc b/tensorflow/core/graph/costmodel.cc index 11d199a88b..1809b35c84 100644 --- a/tensorflow/core/graph/costmodel.cc +++ b/tensorflow/core/graph/costmodel.cc @@ -143,15 +143,10 @@ void CostModel::SetNumOutputs(const Node* node, int num_outputs) { << node->name(); } else { perslot->resize(num_outputs, Bytes(-1)); + output_port_alloc_ids->resize(num_outputs, -1); max_mem_usage->output_port_mem.resize(num_outputs, Bytes(-1)); max_mem_usage->output_port_shape.resize(num_outputs, TensorShapeProto()); max_mem_usage->output_port_type.resize(num_outputs, DT_INVALID); - max_mem_usage->temp_memory_size = Bytes(-1); - max_mem_usage->host_peak_memory_size = Bytes(0); - max_mem_usage->device_peak_memory_size = Bytes(0); - max_mem_usage->persisted_memory_size = Bytes(0); - max_mem_usage->auxiliary_memory_size = Bytes(0); - output_port_alloc_ids->resize(num_outputs, -1); } } @@ -294,49 +289,59 @@ Bytes CostModel::TempMemorySize(const Node* node) const { return max_mem_usage_[id].temp_memory_size; } -Bytes CostModel::HostPeakMemorySize(const Node* node) const { +Bytes CostModel::HostTempMemorySize(const Node* node) const { const int id = Id(node); if (id < 0) { return Bytes(0); } - return max_mem_usage_[id].host_peak_memory_size; + return max_mem_usage_[id].host_temp_memory_size; } -Bytes CostModel::DevicePeakMemorySize(const Node* node) const { +Bytes CostModel::DeviceTempMemorySize(const Node* node) const { const int id = Id(node); if (id < 0) { return Bytes(0); } - return max_mem_usage_[id].device_peak_memory_size; + return max_mem_usage_[id].device_temp_memory_size; } -Bytes CostModel::PersistedMemorySize(const Node* node) const { +Bytes CostModel::HostPersistentMemorySize(const Node* node) const { const int id = Id(node); if (id < 0) { return Bytes(0); } - return max_mem_usage_[id].persisted_memory_size; + return max_mem_usage_[id].host_persistent_memory_size; } -Bytes CostModel::AuxiliaryMemorySize(const Node* node) const { +Bytes CostModel::DevicePersistentMemorySize(const Node* node) const { const int id = Id(node); if (id < 0) { return Bytes(0); } - return max_mem_usage_[id].auxiliary_memory_size; + return max_mem_usage_[id].device_persistent_memory_size; } -void CostModel::RecordAllocatorMemory( - const Node* node, - const protobuf::RepeatedPtrField& memory) { +void CostModel::RecordMemoryStats(const Node* node, + const MemoryStats& memory_stats) { const int id = Id(node); - for (const auto& allocator_memory : memory) { - if (allocator_memory.allocator_name().find("cpu") != string::npos) { - max_mem_usage_[id].host_peak_memory_size += - Bytes(allocator_memory.peak_bytes()); - } else { - max_mem_usage_[id].device_peak_memory_size += - Bytes(allocator_memory.peak_bytes()); + if (id < 0) return; + max_mem_usage_[id].host_temp_memory_size = + memory_stats.host_temp_memory_size(); + max_mem_usage_[id].device_temp_memory_size = + memory_stats.device_temp_memory_size(); + max_mem_usage_[id].host_persistent_memory_size = + memory_stats.host_persistent_memory_size(); + max_mem_usage_[id].device_persistent_memory_size = + memory_stats.device_persistent_memory_size(); + for (int64 alloc_id : memory_stats.host_persistent_tensor_alloc_ids()) { + if (alloc_id > 0) { + host_persistent_alloc_ids_.insert(alloc_id); + } + } + for (int64 alloc_id : memory_stats.device_persistent_tensor_alloc_ids()) { + if (alloc_id > 0) { + persistent_alloc_ids_by_devices_[node->assigned_device_name()].insert( + alloc_id); } } } @@ -373,6 +378,18 @@ int64 CostModel::AllocationId(const Node* node, int slot) const { return output_port_alloc_ids_[id][slot]; } +bool CostModel::IsPersistentTensor(const Node* node, int64 alloc_id) const { + if (host_persistent_alloc_ids_.count(alloc_id) > 0) { + return true; + } + if (persistent_alloc_ids_by_devices_.find(node->assigned_device_name()) == + persistent_alloc_ids_by_devices_.end()) { + return false; + } + return persistent_alloc_ids_by_devices_.at(node->assigned_device_name()) + .count(alloc_id); +} + Microseconds CostModel::CopyTimeEstimate(Bytes b, double network_latency_millis, double estimated_gbps) { // TODO(jeff,sanjay): estimate cost based on bandwidth along the @@ -498,7 +515,6 @@ void CostModel::AddToCostGraphDef(const Graph* graph, for (int i = 0; i < n->num_outputs(); i++) { CostGraphDef::Node::OutputInfo* output_info = cnode->add_output_info(); - output_info->set_size(MaxMemorySize(n, i).value()); int64 alloc_id = AllocationId(n, i); int64 alias_to_input = -1; for (const Edge* e : inputs) { @@ -511,17 +527,22 @@ void CostModel::AddToCostGraphDef(const Graph* graph, output_info->set_alias_input_port(alias_to_input); output_info->set_dtype(MaxMemoryType(n, i)); *output_info->mutable_shape() = MaxMemoryShape(n, i); + if (alias_to_input < 0 && IsPersistentTensor(n, alloc_id)) { + output_info->set_size(0); + } else { + output_info->set_size(MaxMemorySize(n, i).value()); + } } for (const Edge* e : control_inputs) { cnode->add_control_input(Id(e->src())); } - cnode->set_temporary_memory_size(TempMemorySize(n).value()); - cnode->set_host_peak_memory_size(HostPeakMemorySize(n).value()); - cnode->set_device_peak_memory_size(DevicePeakMemorySize(n).value()); - cnode->set_persisted_memory_size(PersistedMemorySize(n).value()); - cnode->set_auxiliary_memory_size(AuxiliaryMemorySize(n).value()); + cnode->set_host_temp_memory_size(HostTempMemorySize(n).value()); + cnode->set_device_temp_memory_size(DeviceTempMemorySize(n).value()); + cnode->set_host_persistent_memory_size(HostPersistentMemorySize(n).value()); + cnode->set_device_persistent_memory_size( + DevicePersistentMemorySize(n).value()); cnode->set_compute_cost(MaxExecutionTime(n).value()); diff --git a/tensorflow/core/graph/costmodel.h b/tensorflow/core/graph/costmodel.h index 6cb7b37392..da7fab489d 100644 --- a/tensorflow/core/graph/costmodel.h +++ b/tensorflow/core/graph/costmodel.h @@ -130,22 +130,16 @@ class CostModel { // Returns the size in bytes of temporary memory consumed by "node". Bytes TempMemorySize(const Node* node) const; - // Returns the size in bytes of host memory consumed by "node". - Bytes HostPeakMemorySize(const Node* node) const; - - // Returns the size in bytes of device memory consumed by "node". - Bytes DevicePeakMemorySize(const Node* node) const; - - // Returns the size in bytes of persisted memory consumed by "node". - Bytes PersistedMemorySize(const Node* node) const; + // Returns the size in bytes of temporary memory consumed by "node". + Bytes HostTempMemorySize(const Node* node) const; + Bytes DeviceTempMemorySize(const Node* node) const; - // Returns the size in bytes of auxiliary memory consumed by "node". - Bytes AuxiliaryMemorySize(const Node* node) const; + // Returns the size of persistent memory allocated by "node". + Bytes HostPersistentMemorySize(const Node* node) const; + Bytes DevicePersistentMemorySize(const Node* node) const; - // Records the memory allocated by allocators for a node. - void RecordAllocatorMemory( - const Node* node, - const protobuf::RepeatedPtrField& memory); + // Records memory stats such as temp momory and persistent memory. + void RecordMemoryStats(const Node* node, const MemoryStats& memory_stats); // Records the maximum execution time (in microseconds) of "node". void RecordMaxExecutionTime(const Node* node, Microseconds time); @@ -161,6 +155,8 @@ class CostModel { // Return the unique id of the tensor generated by "output_slot" of "node". int64 AllocationId(const Node* node, int output_slot) const; + bool IsPersistentTensor(const Node* node, int64 alloc_id) const; + // Helper routines to encapsulate static estimation heuristics // Compute an estimate of the time to copy "b" bytes over the network, @@ -211,25 +207,21 @@ class CostModel { // Maximum memory usage struct MemUsage { + MemUsage() + : temp_memory_size(-1), + host_temp_memory_size(0), + device_temp_memory_size(0), + host_persistent_memory_size(0), + device_persistent_memory_size(0) {} + // TODO(yuefengz): temp_memory_size is not being used, remove it. Bytes temp_memory_size; - // Peak memory includes temporary tensors, output tensors and persistent - // tensors. Some kernels may allocate temporary tensors on host even they - // are running on devices. - Bytes host_peak_memory_size; - Bytes device_peak_memory_size; - - // Persisted memory includes the output memory, persistent tensors. - // The current set of kernels only allocate persistent tensors on their own - // devices. - Bytes persisted_memory_size; + Bytes host_temp_memory_size; + Bytes device_temp_memory_size; - // Auxiliary memory is the momery used by resources (i.e. those in - // ResourceMgr, e.g. lookup tables) excluding their underlying persistent - // tensors (e.g. in variable containers). The auxiliary memory is usually - // allocated on host. - Bytes auxiliary_memory_size; + Bytes host_persistent_memory_size; + Bytes device_persistent_memory_size; gtl::InlinedVector output_port_mem; gtl::InlinedVector output_port_shape; @@ -239,6 +231,9 @@ class CostModel { std::vector > output_port_alloc_ids_; + std::set host_persistent_alloc_ids_; + std::map> persistent_alloc_ids_by_devices_; + TF_DISALLOW_COPY_AND_ASSIGN(CostModel); }; -- GitLab From ab03bd2c1acb4428312110a3ce456c9fc722498a Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 1 Mar 2017 12:59:07 -0800 Subject: [PATCH 098/101] Check for whether to show health pill stats based on presence of -, 0, and + values. We used to rely on the mean being infinite, but oddly, Tensorboard gives us those errant values as strings: [1, 256, 256, 0, 0, 0, 0, 0, "Infinity", "-Infinity", "NaN", "NaN"] This breaks logic that checks for !== Infinity because a string is not Infinity. Something in our stack might have difficulty reading Infinity and NaN from JSON. For now, I think we might want to resort to checking for valid values. This resolves a console error. Change: 148920617 --- .../tensorboard/components/tf_graph_common/lib/scene/scene.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tensorflow/tensorboard/components/tf_graph_common/lib/scene/scene.ts b/tensorflow/tensorboard/components/tf_graph_common/lib/scene/scene.ts index 0e50188e63..7c2df48a6d 100644 --- a/tensorflow/tensorboard/components/tf_graph_common/lib/scene/scene.ts +++ b/tensorflow/tensorboard/components/tf_graph_common/lib/scene/scene.ts @@ -605,7 +605,8 @@ function _addHealthPill( healthPillY += nodeInfo.labelOffset; } - if (lastHealthPillOverview[8] !== Infinity) { + if (lastHealthPillOverview[4] || lastHealthPillOverview[5] || + lastHealthPillOverview[6]) { // At least 1 "non-Inf and non-NaN" value exists. Show stats on tensor // values. let statsSvg = document.createElementNS(svgNamespace, 'text'); -- GitLab From 03cb20b96c2775e2f4c44290bd107c2ff3f29d46 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 1 Mar 2017 13:11:31 -0800 Subject: [PATCH 099/101] The first application of a template made with tf.make_template(create_scope_now_=True) will now create its operations in the same name scope as its variables. This means that all variables and ops created by a template that is only applied once end up in the same scope. Change: 148922089 --- .../python/kernel_tests/template_test.py | 49 +++++++++++++++++++ tensorflow/python/ops/template.py | 5 +- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/tensorflow/python/kernel_tests/template_test.py b/tensorflow/python/kernel_tests/template_test.py index 84f46c6278..be2d6a566a 100644 --- a/tensorflow/python/kernel_tests/template_test.py +++ b/tensorflow/python/kernel_tests/template_test.py @@ -21,6 +21,7 @@ import traceback from tensorflow.python.client import session from tensorflow.python.framework import random_seed +from tensorflow.python.ops import array_ops from tensorflow.python.ops import init_ops from tensorflow.python.ops import math_ops from tensorflow.python.ops import template @@ -318,6 +319,54 @@ class TemplateTest(test.TestCase): tmpl2() self.assertEqual(custom_getter_count[0], 2) + def test_name_scopes_for_variable_scopes(self): + # Test that name scopes are not unnecessarily uniquified (but are + # still uniquified when necessary). + def linear_module(x, output_size): + w = variable_scope.get_variable( + "w", shape=[x.get_shape()[1], output_size], + initializer=init_ops.zeros_initializer()) + b = variable_scope.get_variable( + "b", shape=[output_size], + initializer=init_ops.zeros_initializer()) + return (math_ops.matmul(x, w) + b), w + + def make_linear_module(output_size, name): + return template.make_template( + name, + linear_module, + output_size=output_size, + create_scope_now_=True) + + inputs = array_ops.ones((3, 4)) + + linear1 = make_linear_module(output_size=2, name="foo") + outputs_a, w1 = linear1(inputs) + outputs_b, _ = linear1(inputs) + self.assertEquals("foo", linear1.variable_scope.name) + self.assertEquals("foo/w:0", w1.name) + self.assertEquals("foo/add:0", outputs_a.name, + "First application of template should get " + "same name scope as variables.") + self.assertEquals("foo_1/add:0", outputs_b.name, + "Second application of template should get " + "a freshly uniquified name scope.") + + linear2 = make_linear_module(output_size=2, name="foo") + outputs_c, w2 = linear2(inputs) + outputs_d, _ = linear2(inputs) + self.assertEquals("foo_1", linear2.variable_scope.name, + "New template gets a freshly uniquified variable scope " + "because 'foo' is already taken.") + self.assertEquals("foo_1/w:0", w2.name) + self.assertEquals("foo_1_1/add:0", outputs_c.name, + "First application of template would get " + "same name scope as variables, but 'foo_1' is already " + "a name scope.") + self.assertEquals("foo_1_2/add:0", outputs_d.name, + "Second application of template should also get " + "a freshly uniquified name scope.") + if __name__ == "__main__": test.main() diff --git a/tensorflow/python/ops/template.py b/tensorflow/python/ops/template.py index d4778977b3..80dd74521b 100644 --- a/tensorflow/python/ops/template.py +++ b/tensorflow/python/ops/template.py @@ -197,8 +197,9 @@ class Template(object): if name is None: raise ValueError("name cannot be None.") if create_scope_now: - with variable_scope.variable_scope( - self._unique_name, self._name, + with variable_scope._pure_variable_scope( # pylint:disable=protected-access + (self._unique_name or + variable_scope._get_unique_variable_scope(self._name)), # pylint:disable=protected-access custom_getter=self._custom_getter) as vs: self._variable_scope = vs else: -- GitLab From 02d769cb2268f443b2c0e733ea777b43a7614661 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 1 Mar 2017 13:19:29 -0800 Subject: [PATCH 100/101] Fixed broken links in Installation guides. Change: 148922978 --- tensorflow/docs_src/install/install_linux.md | 2 +- tensorflow/docs_src/install/install_mac.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tensorflow/docs_src/install/install_linux.md b/tensorflow/docs_src/install/install_linux.md index 2eb91be437..586bcd8d45 100644 --- a/tensorflow/docs_src/install/install_linux.md +++ b/tensorflow/docs_src/install/install_linux.md @@ -255,7 +255,7 @@ take the following steps: $ pip3 install tensorflow-gpu # Python 3.n; GPU support If the preceding command runs to completion, you should now - [validate your installation](#ValidateInstallation). + [validate your installation](#ValidateYourInstallation). 3. (Optional.) If Step 2 failed, install the latest version of TensorFlow by issuing a command of the following format: diff --git a/tensorflow/docs_src/install/install_mac.md b/tensorflow/docs_src/install/install_mac.md index 6dc682c7d7..f1c36f904f 100644 --- a/tensorflow/docs_src/install/install_mac.md +++ b/tensorflow/docs_src/install/install_mac.md @@ -184,7 +184,7 @@ If you encounter installation problems, see ### Next Steps After installing TensorFlow, -[validate your installation](#ValidateInstallation) +[validate your installation](#ValidateYourInstallation) to confirm that the installation worked properly. Note that you must activate the virtualenv environment each time you @@ -295,7 +295,7 @@ take the following steps: $ pip3 install tensorflow-gpu # Python 3.n; GPU support If the preceding command runs to completion, you should now - [validate your installation](#ValidateInstallation). + [validate your installation](#ValidateYourInstallation). 3. (Optional.) If Step 2 failed, install the latest version of TensorFlow by issuing a command of the following format: @@ -392,7 +392,7 @@ Docker will download the TensorFlow binary image the first time you launch it. ### Next Steps You should now -[validate your installation](#ValidateInstallation). +[validate your installation](#ValidateYourInstallation). ## Installing with Anaconda @@ -430,7 +430,7 @@ Take the following steps to install TensorFlow in an Anaconda environment: - + ## Validate your installation To validate your TensorFlow installation, do the following: -- GitLab From 4111527988c4aaf21791df420b58565e49da4e3b Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 1 Mar 2017 13:40:42 -0800 Subject: [PATCH 101/101] Corrected the URL of the wheel files in "Installing TensorFlow on Windows." Change: 148925596 --- tensorflow/docs_src/install/install_windows.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorflow/docs_src/install/install_windows.md b/tensorflow/docs_src/install/install_windows.md index 570ac99c3a..9c3f2b92f5 100644 --- a/tensorflow/docs_src/install/install_windows.md +++ b/tensorflow/docs_src/install/install_windows.md @@ -114,12 +114,12 @@ Take the following steps to install TensorFlow in an Anaconda environment: environment. To install the CPU-only version of TensorFlow, enter the following command: -
(tensorflow)C:\> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.0-cp35-cp35m-win_x86_64.whl 
+
(tensorflow)C:\> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.0-cp35-cp35m-win_amd64.whl 
To install the GPU version of TensorFlow, enter the following command (on a single line): -
(tensorflow)C:\> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.0.0-cp35-cp35m-win_x86_64.whl 
+
(tensorflow)C:\> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.0.0-cp35-cp35m-win_amd64.whl 
## Validate your installation -- GitLab